8 * @link http://www.open-emr.org
9 * @author Matthew Vita <matthewvita48@gmail.com>
10 * @author Jerry Padgett <sjpadgett@gmail.com>
11 * @author Brady Miller <brady.g.miller@gmail.com>
12 * @author Yash Raj Bothra <yashrajbothra786@gmail.com>
13 * @copyright Copyright (c) 2018 Matthew Vita <matthewvita48@gmail.com>
14 * @copyright Copyright (c) 2018-2020 Jerry Padgett <sjpadgett@gmail.com>
15 * @copyright Copyright (c) 2019-2021 Brady Miller <brady.g.miller@gmail.com>
16 * @copyright Copyright (c) 2020 Yash Raj Bothra <yashrajbothra786@gmail.com>
17 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
21 * @OA\Info(title="OpenEMR API", version="7.0.0")
22 * @OA\Server(url="/apis/default/")
24 * securityScheme="openemr_auth",
27 * authorizationUrl="/oauth2/default/authorize",
28 * tokenUrl="/oauth2/default/token",
29 * refreshUrl="/oauth2/default/token",
30 * flow="authorizationCode",
32 * "openid": "Generic mandatory scope",
33 * "offline_access": "Will signal server to provide a refresh token",
34 * "launch/patient": "Will provide a patient selector when logging in as an OpenEMR user (required for testing patient/* scopes in swagger if not logging in as a patient)",
35 * "api:fhir": "FHIR R4 API",
36 * "patient/AllergyIntolerance.read": "Read allergy intolerance resources for the current patient (api:fhir)",
37 * "patient/Appointment.read": "Read appointment resources for the current patient (api:fhir)",
38 * "patient/Binary.read": "Read binary document resources for the current patient (api:fhir)",
39 * "patient/CarePlan.read": "Read care plan resources for the current patient (api:fhir)",
40 * "patient/CareTeam.read": "Read care team resources for the current patient (api:fhir)",
41 * "patient/Condition.read": "Read condition resources for the current patient (api:fhir)",
42 * "patient/Coverage.read": "Read coverage resources for the current patient (api:fhir)",
43 * "patient/Device.read": "Read device resources for the current patient (api:fhir)",
44 * "patient/DiagnosticReport.read": "Read diagnostic report resources for the current patient (api:fhir)",
45 * "patient/DocumentReference.read": "Read document reference resources for the current patient (api:fhir)",
46 * "patient/DocumentReference.$docref" : "Generate a document for the current patient or returns the most current Clinical Summary of Care Document (CCD)",
47 * "patient/Encounter.read": "Read encounter resources for the current patient (api:fhir)",
48 * "patient/Goal.read": "Read goal resources for the current patient (api:fhir)",
49 * "patient/Immunization.read": "Read immunization resources for the current patient (api:fhir)",
50 * "patient/Location.read": "Read location resources for the current patient (api:fhir)",
51 * "patient/Medication.read": "Read medication resources for the current patient (api:fhir)",
52 * "patient/MedicationRequest.read": "Read medication request resources for the current patient (api:fhir)",
53 * "patient/Observation.read": "Read observation resources for the current patient (api:fhir)",
54 * "patient/Organization.read": "Read organization resources for the current patient (api:fhir)",
55 * "patient/Patient.read": "Read patient resource for the current patient (api:fhir)",
56 * "patient/Person.read": "Read person resources for the current patient (api:fhir)",
57 * "patient/Practitioner.read": "Read practitioner resources for the current patient (api:fhir)",
58 * "patient/Procedure.read": "Read procedure resources for the current patient (api:fhir)",
59 * "patient/Provenance.read": "Read provenance resources for the current patient (api:fhir)",
60 * "system/AllergyIntolerance.read": "Read all allergy intolerance resources in the system (api:fhir)",
61 * "system/Binary.read": "Read all binary document resources in the system (api:fhir)",
62 * "system/CarePlan.read": "Read all care plan resources in the system (api:fhir)",
63 * "system/CareTeam.read": "Read all care team resources in the system (api:fhir)",
64 * "system/Condition.read": "Read all condition resources in the system (api:fhir)",
65 * "system/Coverage.read": "Read all coverage resources in the system (api:fhir)",
66 * "system/Device.read": "Read all device resources in the system (api:fhir)",
67 * "system/DiagnosticReport.read": "Read all diagnostic report resources in the system (api:fhir)",
68 * "system/DocumentReference.read": "Read all document reference resources in the system (api:fhir)",
69 * "system/DocumentReference.$docref" : "Generate a document for any patient in the system or returns the most current Clinical Summary of Care Document (CCD)",
70 * "system/Encounter.read": "Read all encounter resources in the system (api:fhir)",
71 * "system/Goal.read": "Read all goal resources in the system (api:fhir)",
72 * "system/Group.read": "Read all group resources in the system (api:fhir)",
73 * "system/Immunization.read": "Read all immunization resources in the system (api:fhir)",
74 * "system/Location.read": "Read all location resources in the system (api:fhir)",
75 * "system/Medication.read": "Read all medication resources in the system (api:fhir)",
76 * "system/MedicationRequest.read": "Read all medication request resources in the system (api:fhir)",
77 * "system/Observation.read": "Read all observation resources in the system (api:fhir)",
78 * "system/Organization.read": "Read all organization resources in the system (api:fhir)",
79 * "system/Patient.read": "Read all patient resources in the system (api:fhir)",
80 * "system/Person.read": "Read all person resources in the system (api:fhir)",
81 * "system/Practitioner.read": "Read all practitioner resources in the system (api:fhir)",
82 * "system/PractitionerRole.read": "Read all practitioner role resources in the system (api:fhir)",
83 * "system/Procedure.read": "Read all procedure resources in the system (api:fhir)",
84 * "system/Provenance.read": "Read all provenance resources in the system (api:fhir)",
85 * "user/AllergyIntolerance.read": "Read all allergy intolerance resources the user has access to (api:fhir)",
86 * "user/Binary.read" : "Read all binary documents the user has access to (api:fhir)",
87 * "user/CarePlan.read": "Read all care plan resources the user has access to (api:fhir)",
88 * "user/CareTeam.read": "Read all care team resources the user has access to (api:fhir)",
89 * "user/Condition.read": "Read all condition resources the user has access to (api:fhir)",
90 * "user/Coverage.read": "Read all coverage resources the user has access to (api:fhir)",
91 * "user/Device.read": "Read all device resources the user has access to (api:fhir)",
92 * "user/DiagnosticReport.read": "Read all diagnostic report resources the user has access to (api:fhir)",
93 * "user/DocumentReference.read": "Read all document reference resources the user has access to (api:fhir)",
94 * "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)",
95 * "user/Encounter.read": "Read all encounter resources the user has access to (api:fhir)",
96 * "user/Goal.read": "Read all goal resources the user has access to (api:fhir)",
97 * "user/Immunization.read": "Read all immunization resources the user has access to (api:fhir)",
98 * "user/Location.read": "Read all location resources the user has access to (api:fhir)",
99 * "user/Medication.read": "Read all medication resources the user has access to (api:fhir)",
100 * "user/MedicationRequest.read": "Read all medication request resources the user has access to (api:fhir)",
101 * "user/Observation.read": "Read all observation resources the user has access to (api:fhir)",
102 * "user/Organization.read": "Read all organization resources the user has access to (api:fhir)",
103 * "user/Organization.write": "Write all organization resources the user has access to (api:fhir)",
104 * "user/Patient.read": "Read all patient resources the user has access to (api:fhir)",
105 * "user/Patient.write": "Write all patient resources the user has access to (api:fhir)",
106 * "user/Person.read": "Read all person resources the user has access to (api:fhir)",
107 * "user/Practitioner.read": "Read all practitioner resources the user has access to (api:fhir)",
108 * "user/Practitioner.write": "Write all practitioner resources the user has access to (api:fhir)",
109 * "user/PractitionerRole.read": "Read all practitioner role resources the user has access to (api:fhir)",
110 * "user/Procedure.read": "Read all procedure resources the user has access to (api:fhir)",
111 * "user/Provenance.read": "Read all provenance resources the user has access to (api:fhir)",
112 * "api:oemr": "Standard OpenEMR API",
113 * "user/allergy.read": "Read allergies the user has access to (api:oemr)",
114 * "user/allergy.write": "Write allergies the user has access to for (api:oemr)",
115 * "user/appointment.read": "Read appointments the user has access to (api:oemr)",
116 * "user/appointment.write": "Write appointments the user has access to for (api:oemr)",
117 * "user/dental_issue.read": "Read dental issues the user has access to (api:oemr)",
118 * "user/dental_issue.write": "Write dental issues the user has access to (api:oemr)",
119 * "user/document.read": "Read documents the user has access to (api:oemr)",
120 * "user/document.write": "Write documents the user has access to (api:oemr)",
121 * "user/drug.read": "Read drugs the user has access to (api:oemr)",
122 * "user/encounter.read": "Read encounters the user has access to (api:oemr)",
123 * "user/encounter.write": "Write encounters the user has access to (api:oemr)",
124 * "user/facility.read": "Read facilities the user has access to (api:oemr)",
125 * "user/facility.write": "Write facilities the user has access to (api:oemr)",
126 * "user/immunization.read": "Read immunizations the user has access to (api:oemr)",
127 * "user/insurance.read": "Read insurances the user has access to (api:oemr)",
128 * "user/insurance.write": "Write insurances the user has access to (api:oemr)",
129 * "user/insurance_company.read": "Read insurance companies the user has access to (api:oemr)",
130 * "user/insurance_company.write": "Write insurance companies the user has access to (api:oemr)",
131 * "user/insurance_type.read": "Read insurance types the user has access to (api:oemr)",
132 * "user/list.read": "Read lists the user has access to (api:oemr)",
133 * "user/medical_problem.read": "Read medical problems the user has access to (api:oemr)",
134 * "user/medical_problem.write": "Write medical problems the user has access to (api:oemr)",
135 * "user/medication.read": "Read medications the user has access to (api:oemr)",
136 * "user/medication.write": "Write medications the user has access to (api:oemr)",
137 * "user/message.write": "Read messages the user has access to (api:oemr)",
138 * "user/patient.read": "Read patients the user has access to (api:oemr)",
139 * "user/patient.write": "Write patients the user has access to (api:oemr)",
140 * "user/practitioner.read": "Read practitioners the user has access to (api:oemr)",
141 * "user/practitioner.write": "Write practitioners the user has access to (api:oemr)",
142 * "user/prescription.read": "Read prescriptions the user has access to (api:oemr)",
143 * "user/procedure.read": "Read procedures the user has access to (api:oemr)",
144 * "user/soap_note.read": "Read soap notes the user has access to (api:oemr)",
145 * "user/soap_note.write": "Write soap notes the user has access to (api:oemr)",
146 * "user/surgery.read": "Read surgeries the user has access to (api:oemr)",
147 * "user/surgery.write": "Write surgeries the user has access to (api:oemr)",
148 * "user/transaction.read": "Read transactions the user has access to (api:oemr)",
149 * "user/transaction.write": "Write transactions the user has access to (api:oemr)",
150 * "user/user.read": "Read users the current user has access to (api:oemr)",
151 * "user/vital.read": "Read vitals the user has access to (api:oemr)",
152 * "user/vital.write": "Write vitals the user has access to (api:oemr)",
153 * "api:port": "Standard Patient Portal OpenEMR API",
154 * "patient/encounter.read": "Read encounters the patient has access to (api:port)",
155 * "patient/patient.read": "Write encounters the patient has access to (api:port)",
156 * "patient/appointment.read": "Read appointments the patient has access to (api:port)"
162 * description="FHIR R4 API"
166 * description="Standard OpenEMR API"
169 * name="standard-patient",
170 * description="Standard Patient Portal OpenEMR API"
176 * 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)",
183 * name="_lastUpdated",
185 * parameter="_lastUpdated",
186 * description="The date the resource was last updated.",
193 * response="standard",
194 * description="Standard Response",
196 * mediaType="application/json",
199 * property="validationErrors",
200 * description="Validation errors.",
207 * property="internalErrors",
208 * description="Internal errors.",
216 * description="Returned data.",
223 * "validationErrors": {},
224 * "error_description": {},
231 * response="badrequest",
232 * description="Bad Request",
234 * mediaType="application/json",
237 * property="validationErrors",
238 * description="Validation errors.",
242 * "validationErrors":
244 * "_id": "The search field argument was invalid, improperly formatted, or could not be parsed. Inner message: UUID columns must be a valid UUID string"
251 * response="unauthorized",
252 * description="Unauthorized",
254 * mediaType="application/json",
258 * description="The error.",
262 * property="error_description",
263 * description="The description of the error.",
268 * description="More specific information on the error.",
272 * property="message",
273 * description="Message regarding the error.",
277 * "error": "access_denied",
278 * "error_description": "The resource owner or authorization server denied the request.",
279 * "hint": "Missing ""Authorization"" header",
280 * "message": "The resource owner or authorization server denied the request."
286 * response="uuidnotfound",
287 * description="Not Found",
289 * mediaType="application/json",
293 * description="empty",
302 // Lets keep our controller classes with the routes.
304 use OpenEMR\Common\Acl\AccessDeniedException
;
305 use OpenEMR\Common\Http\HttpRestRequest
;
306 use OpenEMR\RestControllers\AllergyIntoleranceRestController
;
307 use OpenEMR\RestControllers\FacilityRestController
;
308 use OpenEMR\RestControllers\VersionRestController
;
309 use OpenEMR\RestControllers\ProductRegistrationRestController
;
310 use OpenEMR\RestControllers\PatientRestController
;
311 use OpenEMR\RestControllers\EncounterRestController
;
312 use OpenEMR\RestControllers\PractitionerRestController
;
313 use OpenEMR\RestControllers\ListRestController
;
314 use OpenEMR\RestControllers\InsuranceCompanyRestController
;
315 use OpenEMR\RestControllers\AppointmentRestController
;
316 use OpenEMR\RestControllers\ConditionRestController
;
317 use OpenEMR\RestControllers\ONoteRestController
;
318 use OpenEMR\RestControllers\DocumentRestController
;
319 use OpenEMR\RestControllers\DrugRestController
;
320 use OpenEMR\RestControllers\ImmunizationRestController
;
321 use OpenEMR\RestControllers\InsuranceRestController
;
322 use OpenEMR\RestControllers\MessageRestController
;
323 use OpenEMR\RestControllers\PrescriptionRestController
;
324 use OpenEMR\RestControllers\ProcedureRestController
;
325 use OpenEMR\RestControllers\TransactionRestController
;
326 use OpenEMR\RestControllers\UserRestController
;
327 use OpenEMR\Services\Search\SearchQueryConfig
;
329 // Note some Http clients may not send auth as json so a function
330 // is implemented to determine and parse encoding on auth route's.
332 // Note that the api route is only for users role
333 // (there is a mechanism in place to ensure only user role can access the api route)
334 RestConfig
::$ROUTE_MAP = array(
337 * path="/api/facility",
338 * description="Returns a single facility.",
343 * description="The name for the facility.",
350 * name="facility_npi",
352 * description="The facility_npi for the facility.",
361 * description="The phone for the facility.",
370 * description="The fax for the facility.",
379 * description="The street for the facility.",
388 * description="The city for the facility.",
397 * description="The state for the facility.",
404 * name="postal_code",
406 * description="The postal_code for the facility.",
413 * name="country_code",
415 * description="The country_code for the facility.",
422 * name="federal_ein",
424 * description="The federal_ein for the facility.",
433 * description="The website for the facility.",
442 * description="The email for the facility.",
449 * name="domain_identifier",
451 * description="The domain_identifier for the facility.",
458 * name="facility_taxonomy",
460 * description="The facility_taxonomy for the facility.",
467 * name="facility_code",
469 * description="The facility_code for the facility.",
476 * name="billing_location",
478 * description="The billing_location setting for the facility.",
485 * name="accepts_assignment",
487 * description="The accepts_assignment setting for the facility.",
496 * description="The oid for the facility.",
503 * name="service_location",
505 * description="The service_location setting for the facility.",
513 * ref="#/components/responses/standard"
517 * ref="#/components/responses/badrequest"
521 * ref="#/components/responses/unauthorized"
523 * security={{"openemr_auth":{}}}
526 "GET /api/facility" => function () {
527 RestConfig
::authorization_check("admin", "users");
528 $return = (new FacilityRestController())->getAll($_GET);
529 RestConfig
::apiLog($return);
535 * path="/api/facility/{fuuid}",
536 * description="Returns a single facility.",
541 * description="The uuid for the facility.",
549 * ref="#/components/responses/standard"
553 * ref="#/components/responses/badrequest"
557 * ref="#/components/responses/unauthorized"
559 * security={{"openemr_auth":{}}}
562 "GET /api/facility/:fuuid" => function ($fuuid) {
563 RestConfig
::authorization_check("admin", "users");
564 $return = (new FacilityRestController())->getOne($fuuid);
565 RestConfig
::apiLog($return);
571 * path="/api/facility",
572 * description="Creates a facility in the system",
577 * mediaType="application/json",
581 * description="The name for the facility.",
585 * property="facility_npi",
586 * description="The facility_npi for the facility.",
591 * description="The phone for the facility.",
596 * description="The fax for the facility.",
601 * description="The street for the facility.",
606 * description="The city for the facility.",
611 * description="The state for the facility.",
615 * property="postal_code",
616 * description="The postal_code for the facility.",
620 * property="country_code",
621 * description="The country_code for the facility.",
625 * property="federal_ein",
626 * description="The federal_ein for the facility.",
630 * property="website",
631 * description="The website for the facility.",
636 * description="The email for the facility.",
640 * property="domain_identifier",
641 * description="The domain_identifier for the facility.",
645 * property="facility_taxonomy",
646 * description="The facility_taxonomy for the facility.",
650 * property="facility_code",
651 * description="The facility_code for the facility.",
655 * property="billing_location",
656 * description="The billing_location setting for the facility.",
660 * property="accepts_assignment",
661 * description="The accepts_assignment setting for the facility.",
666 * description="The oid for the facility.",
670 * property="service_location",
671 * description="The service_location setting for the facility.",
674 * required={"name", "facility_npi"},
677 * "facility_npi": "123456789123",
678 * "phone": "808-606-3030",
679 * "fax": "808-606-3031",
680 * "street": "1337 Bit Shifter Ln",
681 * "city": "San Lorenzo",
683 * "postal_code": "54321",
684 * "country_code": "US",
685 * "federal_ein": "4343434",
686 * "website": "https://example.com",
687 * "email": "foo@bar.com",
688 * "domain_identifier": "",
689 * "facility_taxonomy": "",
690 * "facility_code": "",
691 * "billing_location": "1",
692 * "accepts_assignment": "1",
694 * "service_location": "1"
701 * ref="#/components/responses/standard"
705 * ref="#/components/responses/badrequest"
709 * ref="#/components/responses/unauthorized"
711 * security={{"openemr_auth":{}}}
714 "POST /api/facility" => function () {
715 RestConfig
::authorization_check("admin", "super");
716 $data = (array) (json_decode(file_get_contents("php://input")));
717 $return = (new FacilityRestController())->post($data);
718 RestConfig
::apiLog($return, $data);
724 * path="/api/facility/{fuuid}",
725 * description="Updates a facility in the system",
730 * description="The uuid for the facility.",
739 * mediaType="application/json",
743 * description="The name for the facility.",
747 * property="facility_npi",
748 * description="The facility_npi for the facility.",
753 * description="The phone for the facility.",
758 * description="The fax for the facility.",
763 * description="The street for the facility.",
768 * description="The city for the facility.",
773 * description="The state for the facility.",
777 * property="postal_code",
778 * description="The postal_code for the facility.",
782 * property="country_code",
783 * description="The country_code for the facility.",
787 * property="federal_ein",
788 * description="The federal_ein for the facility.",
792 * property="website",
793 * description="The website for the facility.",
798 * description="The email for the facility.",
802 * property="domain_identifier",
803 * description="The domain_identifier for the facility.",
807 * property="facility_taxonomy",
808 * description="The facility_taxonomy for the facility.",
812 * property="facility_code",
813 * description="The facility_code for the facility.",
817 * property="billing_location",
818 * description="The billing_location setting for the facility.",
822 * property="accepts_assignment",
823 * description="The accepts_assignment setting for the facility.",
828 * description="The oid for the facility.",
832 * property="service_location",
833 * description="The service_location setting for the facility.",
838 * "facility_npi": "123456789123",
839 * "phone": "808-606-3030",
840 * "fax": "808-606-3031",
841 * "street": "1337 Bit Shifter Ln",
842 * "city": "San Lorenzo",
844 * "postal_code": "54321",
845 * "country_code": "US",
846 * "federal_ein": "4343434",
847 * "website": "https://example.com",
848 * "email": "foo@bar.com",
849 * "domain_identifier": "",
850 * "facility_taxonomy": "",
851 * "facility_code": "",
852 * "billing_location": "1",
853 * "accepts_assignment": "1",
855 * "service_location": "1"
862 * ref="#/components/responses/standard"
866 * ref="#/components/responses/badrequest"
870 * ref="#/components/responses/unauthorized"
872 * security={{"openemr_auth":{}}}
875 "PUT /api/facility/:fuuid" => function ($fuuid) {
876 RestConfig
::authorization_check("admin", "super");
877 $data = (array) (json_decode(file_get_contents("php://input")));
878 $return = (new FacilityRestController())->patch($fuuid, $data);
879 RestConfig
::apiLog($return, $data);
885 * path="/api/patient",
886 * description="Retrieves a list of patients",
889 * ref="#/components/parameters/_sort"
894 * description="The first name for the patient.",
903 * description="The last name for the patient.",
912 * description="The social security number for the patient.",
921 * description="The street for the patient.",
928 * name="postal_code",
930 * description="The postal code for the patient.",
939 * description="The city for the patient.",
948 * description="The state for the patient.",
957 * description="The home phone for the patient.",
966 * description="The business phone for the patient.",
975 * description="The cell phone for the patient.",
982 * name="postal_contact",
984 * description="The postal_contact for the patient.",
993 * description="The gender for the patient.",
1000 * name="country_code",
1002 * description="The country code for the patient.",
1011 * description="The email for the patient.",
1020 * description="The DOB for the patient.",
1029 * description="The date this patient resource was last modified.",
1038 * description="The number of records to offset from this index in the search result.",
1047 * description="The maximum number of resources to return in the result set. 0 means unlimited.",
1057 * ref="#/components/responses/standard"
1061 * ref="#/components/responses/badrequest"
1065 * ref="#/components/responses/unauthorized"
1067 * security={{"openemr_auth":{}}}
1070 "GET /api/patient" => function () {
1071 RestConfig
::authorization_check("patients", "demo");
1072 $config = SearchQueryConfig
::createConfigFromQueryParams($_GET);
1073 $return = (new PatientRestController())->getAll($_GET, $config);
1074 RestConfig
::apiLog($return);
1079 * Schema for the patient request
1082 * schema="api_patient_request",
1085 * description="The title of patient.",
1090 * description="The fname of patient.",
1095 * description="The mname of patient.",
1100 * description="The lname of patient.",
1104 * property="street",
1105 * description="The street address of patient.",
1109 * property="postal_code",
1110 * description="The postal code of patient.",
1115 * description="The city of patient.",
1120 * description="The state of patient.",
1124 * property="country_code",
1125 * description="The country code of patient.",
1129 * property="phone_contact",
1130 * description="The phone contact of patient.",
1135 * description="The DOB of patient.",
1140 * description="The lname of patient.",
1145 * description="The race of patient.",
1149 * property="ethnicity",
1150 * description="The ethnicity of patient.",
1153 * required={"fname", "lname", "DOB", "sex"},
1159 * "street": "456 Tree Lane",
1160 * "postal_code": "08642",
1161 * "city": "FooTown",
1163 * "country_code": "US",
1164 * "phone_contact": "123-456-7890",
1165 * "DOB": "1992-02-02",
1174 * path="/api/patient",
1175 * description="Creates a new patient",
1176 * tags={"standard"},
1180 * mediaType="application/json",
1181 * @OA\Schema(ref="#/components/schemas/api_patient_request")
1186 * description="Standard response",
1188 * mediaType="application/json",
1191 * property="validationErrors",
1192 * description="Validation errors.",
1199 * property="internalErrors",
1200 * description="Internal errors.",
1208 * description="Returned data.",
1213 * description="patient pid",
1219 * "validationErrors": {},
1220 * "error_description": {},
1230 * ref="#/components/responses/unauthorized"
1232 * security={{"openemr_auth":{}}}
1235 "POST /api/patient" => function () {
1236 RestConfig
::authorization_check("patients", "demo");
1237 $data = (array) (json_decode(file_get_contents("php://input")));
1238 $return = (new PatientRestController())->post($data);
1239 RestConfig
::apiLog($return, $data);
1244 * Schema for the patient response
1247 * schema="api_patient_response",
1249 * property="validationErrors",
1250 * description="Validation errors.",
1257 * property="internalErrors",
1258 * description="Internal errors.",
1266 * description="Returned data.",
1271 * description="patient id",
1276 * description="patient pid",
1280 * property="pubpid",
1281 * description="patient public id",
1286 * description="patient title",
1291 * description="patient first name",
1296 * description="patient middle name",
1301 * description="patient last name",
1306 * description="patient social security number",
1310 * property="street",
1311 * description="patient street address",
1315 * property="postal_code",
1316 * description="patient postal code",
1321 * description="patient city",
1326 * description="patient state",
1330 * property="county",
1331 * description="patient county",
1335 * property="country_code",
1336 * description="patient country code",
1340 * property="drivers_license",
1341 * description="patient drivers license id",
1345 * property="contact_relationship",
1346 * description="patient contact relationship",
1350 * property="phone_contact",
1351 * description="patient phone contact",
1355 * property="phone_home",
1356 * description="patient home phone",
1360 * property="phone_biz",
1361 * description="patient work phone",
1365 * property="phone_cell",
1366 * description="patient mobile phone",
1371 * description="patient email",
1376 * description="patient DOB",
1381 * description="patient sex (gender)",
1386 * description="patient race",
1390 * property="ethnicity",
1391 * description="patient ethnicity",
1395 * property="status",
1396 * description="patient status",
1402 * "validationErrors": {},
1403 * "error_description": {},
1413 * "street": "456 Tree Lane",
1414 * "postal_code": "08642",
1415 * "city": "FooTown",
1418 * "country_code": "US",
1419 * "drivers_license": "",
1420 * "contact_relationship": "",
1421 * "phone_contact": "123-456-7890",
1426 * "DOB": "1992-02-03",
1437 * path="/api/patient/{puuid}",
1438 * description="Updates a patient",
1439 * tags={"standard"},
1443 * description="The uuid for the patient.",
1452 * mediaType="application/json",
1453 * @OA\Schema(ref="#/components/schemas/api_patient_request")
1458 * description="Standard response",
1460 * mediaType="application/json",
1461 * @OA\Schema(ref="#/components/schemas/api_patient_response")
1466 * ref="#/components/responses/unauthorized"
1468 * security={{"openemr_auth":{}}}
1471 "PUT /api/patient/:puuid" => function ($puuid) {
1472 RestConfig
::authorization_check("patients", "demo");
1473 $data = (array) (json_decode(file_get_contents("php://input")));
1474 $return = (new PatientRestController())->put($puuid, $data);
1475 RestConfig
::apiLog($return, $data);
1481 * path="/api/patient/{puuid}",
1482 * description="Retrieves a single patient by their uuid",
1483 * tags={"standard"},
1487 * description="The uuid for the patient.",
1495 * description="Standard response",
1497 * mediaType="application/json",
1498 * @OA\Schema(ref="#/components/schemas/api_patient_response")
1503 * ref="#/components/responses/unauthorized"
1505 * security={{"openemr_auth":{}}}
1508 "GET /api/patient/:puuid" => function ($puuid) {
1509 RestConfig
::authorization_check("patients", "demo");
1510 $return = (new PatientRestController())->getOne($puuid);
1511 RestConfig
::apiLog($return);
1517 * path="/api/patient/{puuid}/encounter",
1518 * description="Retrieves a list of encounters for a single patient",
1519 * tags={"standard"},
1523 * description="The uuid for the patient.",
1531 * ref="#/components/responses/standard"
1535 * ref="#/components/responses/badrequest"
1539 * ref="#/components/responses/unauthorized"
1541 * security={{"openemr_auth":{}}}
1544 "GET /api/patient/:puuid/encounter" => function ($puuid) {
1545 RestConfig
::authorization_check("encounters", "auth_a");
1546 $return = (new EncounterRestController())->getAll($puuid);
1547 RestConfig
::apiLog($return);
1552 * Schema for the encounter request
1555 * schema="api_encounter_request",
1558 * description="The date of encounter.",
1562 * property="onset_date",
1563 * description="The onset date of encounter.",
1567 * property="reason",
1568 * description="The reason of encounter.",
1572 * property="facility",
1573 * description="The facility of encounter.",
1577 * property="pc_catid",
1578 * description="The pc_catid of encounter.",
1582 * property="facility_id",
1583 * description="The facility id of encounter.",
1587 * property="billing_facility",
1588 * description="The billing facility id of encounter.",
1592 * property="sensitivity",
1593 * description="The sensitivity of encounter.",
1597 * property="referral_source",
1598 * description="The referral source of encounter.",
1602 * property="pos_code",
1603 * description="The pos_code of encounter.",
1607 * property="external_id",
1608 * description="The external id of encounter.",
1612 * property="provider_id",
1613 * description="The provider id of encounter.",
1617 * property="class_code",
1618 * description="The class_code of encounter.",
1621 * required={"pc_catid", "class_code"},
1623 * "date":"2020-11-10",
1625 * "reason": "Pregnancy Test",
1626 * "facility": "Owerri General Hospital",
1628 * "facility_id": "3",
1629 * "billing_facility": "3",
1630 * "sensitivity": "normal",
1631 * "referral_source": "",
1633 * "external_id": "",
1634 * "provider_id": "1",
1635 * "class_code" : "AMB"
1641 * path="/api/patient/{puuid}/encounter",
1642 * description="Creates a new encounter",
1643 * tags={"standard"},
1647 * description="The uuid for the patient.",
1656 * mediaType="application/json",
1657 * @OA\Schema(ref="#/components/schemas/api_encounter_request")
1662 * description="Standard response",
1664 * mediaType="application/json",
1667 * property="validationErrors",
1668 * description="Validation errors.",
1675 * property="internalErrors",
1676 * description="Internal errors.",
1684 * description="Returned data.",
1688 * property="encounter",
1689 * description="encounter id",
1694 * description="encounter uuid",
1700 * "validationErrors": {},
1701 * "error_description": {},
1704 * "uuid": "90c196f2-51cc-4655-8858-3a80aebff3ef"
1712 * ref="#/components/responses/unauthorized"
1714 * security={{"openemr_auth":{}}}
1717 "POST /api/patient/:puuid/encounter" => function ($puuid) {
1718 RestConfig
::authorization_check("encounters", "auth_a");
1719 $data = (array) (json_decode(file_get_contents("php://input")));
1720 $return = (new EncounterRestController())->post($puuid, $data);
1721 RestConfig
::apiLog($return, $data);
1726 * Schema for the encounter response
1729 * schema="api_encounter_response",
1731 * property="validationErrors",
1732 * description="Validation errors.",
1739 * property="internalErrors",
1740 * description="Internal errors.",
1748 * description="Returned data.",
1753 * description="encounter id",
1758 * description="encounter uuid",
1763 * description="encounter date",
1767 * property="reason",
1768 * description="encounter reason",
1772 * property="facility",
1773 * description="encounter facility name",
1777 * property="facility_id",
1778 * description="encounter facility id name",
1783 * description="encounter for patient pid",
1787 * property="onset_date",
1788 * description="encounter onset date",
1792 * property="sensitivity",
1793 * description="encounter sensitivity",
1797 * property="billing_note",
1798 * description="encounter billing note",
1802 * property="pc_catid",
1803 * description="encounter pc_catid",
1807 * property="last_level_billed",
1808 * description="encounter last_level_billed",
1812 * property="last_level_closed",
1813 * description="encounter last_level_closed",
1817 * property="last_stmt_date",
1818 * description="encounter last_stmt_date",
1822 * property="stmt_count",
1823 * description="encounter stmt_count",
1827 * property="provider_id",
1828 * description="provider id",
1832 * property="supervisor_id",
1833 * description="encounter supervisor id",
1837 * property="invoice_refno",
1838 * description="encounter invoice_refno",
1842 * property="referral_source",
1843 * description="encounter referral source",
1847 * property="billing_facility",
1848 * description="encounter billing facility id",
1852 * property="external_id",
1853 * description="encounter external id",
1857 * property="pos_code",
1858 * description="encounter pos_code",
1862 * property="class_code",
1863 * description="encounter class_code",
1867 * property="class_title",
1868 * description="encounter class_title",
1872 * property="pc_catname",
1873 * description="encounter pc_catname",
1877 * property="billing_facility_name",
1878 * description="encounter billing facility name",
1884 * "validationErrors": {},
1885 * "error_description": {},
1888 * "uuid": "90c196f2-51cc-4655-8858-3a80aebff3ef",
1889 * "date": "2019-09-14 00:00:00",
1890 * "reason": "Pregnancy Test",
1891 * "facility": "Owerri General Hospital",
1892 * "facility_id": "3",
1894 * "onset_date": "2019-04-20 00:00:00",
1895 * "sensitivity": "normal",
1896 * "billing_note": null,
1898 * "last_level_billed": "0",
1899 * "last_level_closed": "0",
1900 * "last_stmt_date": null,
1901 * "stmt_count": "0",
1902 * "provider_id": "1",
1903 * "supervisor_id": "0",
1904 * "invoice_refno": "",
1905 * "referral_source": "",
1906 * "billing_facility": "3",
1907 * "external_id": "",
1909 * "class_code": "AMB",
1910 * "class_title": "ambulatory",
1911 * "pc_catname": "Office Visit",
1912 * "billing_facility_name": "Owerri General Hospital"
1919 * path="/api/patient/{puuid}/encounter/{euuid}",
1920 * description="Modify a encounter",
1921 * tags={"standard"},
1925 * description="The uuid for the patient.",
1934 * description="The uuid for the encounter.",
1943 * mediaType="application/json",
1944 * @OA\Schema(ref="#/components/schemas/api_encounter_request")
1949 * description="Standard response",
1951 * mediaType="application/json",
1952 * @OA\Schema(ref="#/components/schemas/api_encounter_response")
1957 * ref="#/components/responses/unauthorized"
1959 * security={{"openemr_auth":{}}}
1962 "PUT /api/patient/:puuid/encounter/:euuid" => function ($puuid, $euuid) {
1963 RestConfig
::authorization_check("encounters", "auth_a");
1964 $data = (array) (json_decode(file_get_contents("php://input")));
1965 $return = (new EncounterRestController())->put($puuid, $euuid, $data);
1966 RestConfig
::apiLog($return, $data);
1972 * path="/api/patient/{puuid}/encounter/{euuid}",
1973 * description="Retrieves a single encounter for a patient",
1974 * tags={"standard"},
1978 * description="The uuid for the patient.",
1987 * description="The uuid for the encounter.",
1995 * description="Standard response",
1997 * mediaType="application/json",
1998 * @OA\Schema(ref="#/components/schemas/api_encounter_response")
2003 * ref="#/components/responses/unauthorized"
2005 * security={{"openemr_auth":{}}}
2008 "GET /api/patient/:puuid/encounter/:euuid" => function ($puuid, $euuid) {
2009 RestConfig
::authorization_check("encounters", "auth_a");
2010 $return = (new EncounterRestController())->getOne($puuid, $euuid);
2011 RestConfig
::apiLog($return);
2017 * path="/api/patient/{pid}/encounter/{eid}/soap_note",
2018 * description="Retrieves soap notes from an encounter for a patient",
2019 * tags={"standard"},
2023 * description="The pid for the patient.",
2032 * description="The id for the encounter.",
2040 * ref="#/components/responses/standard"
2044 * ref="#/components/responses/badrequest"
2048 * ref="#/components/responses/unauthorized"
2050 * security={{"openemr_auth":{}}}
2053 "GET /api/patient/:pid/encounter/:eid/soap_note" => function ($pid, $eid) {
2054 RestConfig
::authorization_check("encounters", "notes");
2055 $return = (new EncounterRestController())->getSoapNotes($pid, $eid);
2056 RestConfig
::apiLog($return);
2061 * Schema for the vital request
2064 * schema="api_vital_request",
2067 * description="The bps of vitals.",
2072 * description="The bpd of vitals.",
2076 * property="weight",
2077 * description="The weight of vitals. (unit is lb)",
2081 * property="height",
2082 * description="The height of vitals. (unit is inches)",
2086 * property="temperature",
2087 * description="The temperature of temperature. (unit is F)",
2091 * property="temp_method",
2092 * description="The temp_method of vitals.",
2097 * description="The pulse of vitals.",
2101 * property="respiration",
2102 * description="The respiration of vitals.",
2107 * description="The note (ie. comments) of vitals.",
2111 * property="waist_circ",
2112 * description="The waist circumference of vitals. (unit is inches)",
2116 * property="head_circ",
2117 * description="The head circumference of vitals. (unit is inches)",
2121 * property="oxygen_saturation",
2122 * description="The oxygen_saturation of vitals.",
2130 * "temperature": "98",
2131 * "temp_method": "Oral",
2133 * "respiration": "20",
2134 * "note": "Patient with difficulty standing, which made weight measurement difficult.",
2135 * "waist_circ": "37",
2136 * "head_circ": "22.2",
2137 * "oxygen_saturation": "96"
2143 * path="/api/patient/{pid}/encounter/{eid}/vital",
2144 * description="Submits a new vitals form",
2145 * tags={"standard"},
2149 * description="The id for the patient.",
2158 * description="The id for the encounter.",
2167 * mediaType="application/json",
2168 * @OA\Schema(ref="#/components/schemas/api_vital_request")
2173 * ref="#/components/responses/standard"
2177 * ref="#/components/responses/badrequest"
2181 * ref="#/components/responses/unauthorized"
2183 * security={{"openemr_auth":{}}}
2186 "POST /api/patient/:pid/encounter/:eid/vital" => function ($pid, $eid) {
2187 RestConfig
::authorization_check("encounters", "notes");
2188 $data = json_decode(file_get_contents("php://input"), true) ??
[];
2189 $return = (new EncounterRestController())->postVital($pid, $eid, $data);
2190 RestConfig
::apiLog($return, $data);
2196 * path="/api/patient/{pid}/encounter/{eid}/vital/{vid}",
2197 * description="Edit a vitals form",
2198 * tags={"standard"},
2202 * description="The id for the patient.",
2211 * description="The id for the encounter.",
2220 * description="The id for the vitalss form.",
2229 * mediaType="application/json",
2230 * @OA\Schema(ref="#/components/schemas/api_vital_request")
2235 * ref="#/components/responses/standard"
2239 * ref="#/components/responses/badrequest"
2243 * ref="#/components/responses/unauthorized"
2245 * security={{"openemr_auth":{}}}
2248 "PUT /api/patient/:pid/encounter/:eid/vital/:vid" => function ($pid, $eid, $vid) {
2249 RestConfig
::authorization_check("encounters", "notes");
2250 $data = json_decode(file_get_contents("php://input"), true) ??
[];
2251 $return = (new EncounterRestController())->putVital($pid, $eid, $vid, $data);
2252 RestConfig
::apiLog($return, $data);
2258 * path="/api/patient/{pid}/encounter/{eid}/vital",
2259 * description="Retrieves all vitals from an encounter for a patient",
2260 * tags={"standard"},
2264 * description="The pid for the patient.",
2273 * description="The id for the encounter.",
2281 * ref="#/components/responses/standard"
2285 * ref="#/components/responses/badrequest"
2289 * ref="#/components/responses/unauthorized"
2291 * security={{"openemr_auth":{}}}
2294 "GET /api/patient/:pid/encounter/:eid/vital" => function ($pid, $eid) {
2295 RestConfig
::authorization_check("encounters", "notes");
2296 $return = (new EncounterRestController())->getVitals($pid, $eid);
2297 RestConfig
::apiLog($return);
2303 * path="/api/patient/{pid}/encounter/{eid}/vital/{vid}",
2304 * description="Retrieves a vitals form from an encounter for a patient",
2305 * tags={"standard"},
2309 * description="The pid for the patient.",
2318 * description="The id for the encounter.",
2327 * description="The id for the vitals form.",
2335 * ref="#/components/responses/standard"
2339 * ref="#/components/responses/badrequest"
2343 * ref="#/components/responses/unauthorized"
2345 * security={{"openemr_auth":{}}}
2348 "GET /api/patient/:pid/encounter/:eid/vital/:vid" => function ($pid, $eid, $vid) {
2349 RestConfig
::authorization_check("encounters", "notes");
2350 $return = (new EncounterRestController())->getVital($pid, $eid, $vid);
2351 RestConfig
::apiLog($return);
2357 * path="/api/patient/{pid}/encounter/{eid}/soap_note/{sid}",
2358 * description="Retrieves a soap note from an encounter for a patient",
2359 * tags={"standard"},
2363 * description="The pid for the patient.",
2372 * description="The id for the encounter.",
2381 * description="The id for the soap note.",
2389 * ref="#/components/responses/standard"
2393 * ref="#/components/responses/badrequest"
2397 * ref="#/components/responses/unauthorized"
2399 * security={{"openemr_auth":{}}}
2402 "GET /api/patient/:pid/encounter/:eid/soap_note/:sid" => function ($pid, $eid, $sid) {
2403 RestConfig
::authorization_check("encounters", "notes");
2404 $return = (new EncounterRestController())->getSoapNote($pid, $eid, $sid);
2405 RestConfig
::apiLog($return);
2410 * Schema for the soap_note request
2413 * schema="api_soap_note_request",
2415 * property="subjective",
2416 * description="The subjective of soap note.",
2420 * property="objective",
2421 * description="The objective of soap note.",
2425 * property="assessment",
2426 * description="The assessment of soap note.",
2431 * description="The plan of soap note.",
2435 * "subjective": "The patient with mechanical fall and cut finger.",
2436 * "objective": "The patient with finger laceration on exam.",
2437 * "assessment": "The patient with finger laceration requiring sutures.",
2438 * "plan": "Sutured finger laceration."
2444 * path="/api/patient/{pid}/encounter/{eid}/soap_note",
2445 * description="Submits a new soap note",
2446 * tags={"standard"},
2450 * description="The id for the patient.",
2459 * description="The id for the encounter.",
2468 * mediaType="application/json",
2469 * @OA\Schema(ref="#/components/schemas/api_soap_note_request")
2474 * ref="#/components/responses/standard"
2478 * ref="#/components/responses/badrequest"
2482 * ref="#/components/responses/unauthorized"
2484 * security={{"openemr_auth":{}}}
2487 "POST /api/patient/:pid/encounter/:eid/soap_note" => function ($pid, $eid) {
2488 RestConfig
::authorization_check("encounters", "notes");
2489 $data = (array) (json_decode(file_get_contents("php://input")));
2490 $return = (new EncounterRestController())->postSoapNote($pid, $eid, $data);
2491 RestConfig
::apiLog($return, $data);
2497 * path="/api/patient/{pid}/encounter/{eid}/soap_note/{sid}",
2498 * description="Edit a soap note",
2499 * tags={"standard"},
2503 * description="The id for the patient.",
2512 * description="The id for the encounter.",
2521 * description="The id for the soap noted.",
2530 * mediaType="application/json",
2531 * @OA\Schema(ref="#/components/schemas/api_soap_note_request")
2536 * ref="#/components/responses/standard"
2540 * ref="#/components/responses/badrequest"
2544 * ref="#/components/responses/unauthorized"
2546 * security={{"openemr_auth":{}}}
2549 "PUT /api/patient/:pid/encounter/:eid/soap_note/:sid" => function ($pid, $eid, $sid) {
2550 RestConfig
::authorization_check("encounters", "notes");
2551 $data = (array) (json_decode(file_get_contents("php://input")));
2552 $return = (new EncounterRestController())->putSoapNote($pid, $eid, $sid, $data);
2553 RestConfig
::apiLog($return, $data);
2560 * path="/api/practitioner",
2561 * description="Retrieves a list of practitioners",
2562 * tags={"standard"},
2566 * description="The title for the practitioner.",
2575 * description="The first name for the practitioner.",
2584 * description="The last name for the practitioner.",
2593 * description="The middle name for the practitioner.",
2600 * name="federaltaxid",
2602 * description="The federal tax id for the practitioner.",
2609 * name="federaldrugid",
2611 * description="The federal drug id for the practitioner.",
2620 * description="The upin for the practitioner.",
2627 * name="facility_id",
2629 * description="The facility id for the practitioner.",
2638 * description="The facility for the practitioner.",
2647 * description="The npi for the practitioner.",
2656 * description="The email for the practitioner.",
2665 * description="The specialty for the practitioner.",
2674 * description="The billname for the practitioner.",
2683 * description="The url for the practitioner.",
2692 * description="The assistant for the practitioner.",
2699 * name="organization",
2701 * description="The organization for the practitioner.",
2708 * name="valedictory",
2710 * description="The valedictory for the practitioner.",
2719 * description="The street for the practitioner.",
2728 * description="The street (line 2) for the practitioner.",
2737 * description="The city for the practitioner.",
2746 * description="The state for the practitioner.",
2755 * description="The zip for the practitioner.",
2764 * description="The phone for the practitioner.",
2773 * description="The fax for the practitioner.",
2782 * description="The phonew1 for the practitioner.",
2791 * description="The phonecell for the practitioner.",
2800 * description="The notes for the practitioner.",
2807 * name="state_license_number2",
2809 * description="The state license number for the practitioner.",
2818 * description="The username for the practitioner.",
2826 * ref="#/components/responses/standard"
2830 * ref="#/components/responses/badrequest"
2834 * ref="#/components/responses/unauthorized"
2836 * security={{"openemr_auth":{}}}
2839 "GET /api/practitioner" => function () {
2840 RestConfig
::authorization_check("admin", "users");
2841 $return = (new PractitionerRestController())->getAll($_GET);
2842 RestConfig
::apiLog($return);
2848 * path="/api/practitioner/{pruuid}",
2849 * description="Retrieves a single practitioner by their uuid",
2850 * tags={"standard"},
2854 * description="The uuid for the practitioner.",
2862 * ref="#/components/responses/standard"
2866 * ref="#/components/responses/badrequest"
2870 * ref="#/components/responses/unauthorized"
2872 * security={{"openemr_auth":{}}}
2875 "GET /api/practitioner/:pruuid" => function ($pruuid) {
2876 RestConfig
::authorization_check("admin", "users");
2877 $return = (new PractitionerRestController())->getOne($pruuid);
2878 RestConfig
::apiLog($return);
2884 * path="/api/practitioner",
2885 * description="Submits a new practitioner",
2886 * tags={"standard"},
2890 * mediaType="application/json",
2894 * description="The title for the practitioner.",
2899 * description="The first name for the practitioner.",
2904 * description="The middle name for the practitioner.",
2909 * description="The last name for the practitioner.",
2913 * property="federaltaxid",
2914 * description="The federal tax id for the practitioner.",
2918 * property="federaldrugid",
2919 * description="The federal drug id for the practitioner.",
2924 * description="The upin for the practitioner.",
2928 * property="facility_id",
2929 * description="The facility_id for the practitioner.",
2933 * property="facility",
2934 * description="The facility name for the practitioner.",
2939 * description="The npi for the practitioner.",
2944 * description="The email for the practitioner.",
2948 * property="specialty",
2949 * description="The specialty for the practitioner.",
2953 * property="billname",
2954 * description="The billname for the practitioner.",
2959 * description="The url for the practitioner.",
2963 * property="assistant",
2964 * description="The assistant for the practitioner.",
2968 * property="valedictory",
2969 * description="The valedictory for the practitioner.",
2973 * property="street",
2974 * description="The street address for the practitioner.",
2978 * property="streetb",
2979 * description="The streetb address for the practitioner.",
2984 * description="The city for the practitioner.",
2989 * description="The state for the practitioner.",
2994 * description="The zip for the practitioner.",
2999 * description="The phone for the practitioner.",
3004 * description="The fax for the practitioner.",
3008 * property="phonew1",
3009 * description="The phonew1 for the practitioner.",
3013 * property="phonecell",
3014 * description="The phonecell for the practitioner.",
3019 * description="The notes for the practitioner.",
3023 * property="state_license_number",
3024 * description="The state license number for the practitioner.",
3028 * property="username",
3029 * description="The username for the practitioner.",
3032 * required={"fname", "lname", "npi"},
3035 * "fname": "Eduardo",
3038 * "federaltaxid": "",
3039 * "federaldrugid": "",
3041 * "facility_id": "3",
3042 * "facility": "Your Clinic Name Here",
3043 * "npi": "12345678901",
3044 * "email": "info@pennfirm.com",
3048 * "assistant": null,
3049 * "organization": null,
3050 * "valedictory": null,
3051 * "street": "789 Third Avenue",
3052 * "streetb": "123 Cannaut Street",
3053 * "city": "San Diego",
3056 * "phone": "(619) 555-9827",
3058 * "phonew1": "(619) 555-7822",
3059 * "phonecell": "(619) 555-7821",
3061 * "state_license_number": "123456",
3062 * "username": "eduardoperez"
3069 * description="Standard response",
3071 * mediaType="application/json",
3074 * property="validationErrors",
3075 * description="Validation errors.",
3082 * property="internalErrors",
3083 * description="Internal errors.",
3091 * description="Returned data.",
3096 * description="practitioner id",
3101 * description="practitioner uuid",
3107 * "validationErrors": {},
3108 * "error_description": {},
3111 * "uuid": "90d453fb-0248-4c0d-9575-d99d02b169f5"
3119 * ref="#/components/responses/unauthorized"
3121 * security={{"openemr_auth":{}}}
3124 "POST /api/practitioner" => function () {
3125 RestConfig
::authorization_check("admin", "users");
3126 $data = (array) (json_decode(file_get_contents("php://input")));
3127 $return = (new PractitionerRestController())->post($data);
3128 RestConfig
::apiLog($return, $data);
3134 * path="/api/practitioner/{pruuid}",
3135 * description="Edit a practitioner",
3136 * tags={"standard"},
3140 * description="The uuid for the practitioner.",
3149 * mediaType="application/json",
3153 * description="The title for the practitioner.",
3158 * description="The first name for the practitioner.",
3163 * description="The middle name for the practitioner.",
3168 * description="The last name for the practitioner.",
3172 * property="federaltaxid",
3173 * description="The federal tax id for the practitioner.",
3177 * property="federaldrugid",
3178 * description="The federal drug id for the practitioner.",
3183 * description="The upin for the practitioner.",
3187 * property="facility_id",
3188 * description="The facility_id for the practitioner.",
3192 * property="facility",
3193 * description="The facility name for the practitioner.",
3198 * description="The npi for the practitioner.",
3203 * description="The email for the practitioner.",
3207 * property="specialty",
3208 * description="The specialty for the practitioner.",
3212 * property="billname",
3213 * description="The billname for the practitioner.",
3218 * description="The url for the practitioner.",
3222 * property="assistant",
3223 * description="The assistant for the practitioner.",
3227 * property="valedictory",
3228 * description="The valedictory for the practitioner.",
3232 * property="street",
3233 * description="The street address for the practitioner.",
3237 * property="streetb",
3238 * description="The streetb address for the practitioner.",
3243 * description="The city for the practitioner.",
3248 * description="The state for the practitioner.",
3253 * description="The zip for the practitioner.",
3258 * description="The phone for the practitioner.",
3263 * description="The fax for the practitioner.",
3267 * property="phonew1",
3268 * description="The phonew1 for the practitioner.",
3272 * property="phonecell",
3273 * description="The phonecell for the practitioner.",
3278 * description="The notes for the practitioner.",
3282 * property="state_license_number",
3283 * description="The state license number for the practitioner.",
3287 * property="username",
3288 * description="The username for the practitioner.",
3296 * "street": "456 Tree Lane",
3298 * "city": "FooTown",
3300 * "phone": "123-456-7890"
3307 * description="Standard response",
3309 * mediaType="application/json",
3312 * property="validationErrors",
3313 * description="Validation errors.",
3320 * property="internalErrors",
3321 * description="Internal errors.",
3329 * description="Returned data.",
3334 * description="practitioner id",
3339 * description="practitioner uuid",
3344 * description="practitioner title",
3349 * description="practitioner fname",
3354 * description="practitioner lname",
3359 * description="practitioner mname",
3363 * property="federaltaxid",
3364 * description="practitioner federaltaxid",
3368 * property="federaldrugid",
3369 * description="practitioner federaldrugid",
3374 * description="practitioner upin",
3378 * property="facility_id",
3379 * description="practitioner facility_id",
3383 * property="facility",
3384 * description="practitioner facility",
3389 * description="practitioner npi",
3394 * description="practitioner email",
3398 * property="active",
3399 * description="practitioner active setting",
3403 * property="specialty",
3404 * description="practitioner specialty",
3408 * property="billname",
3409 * description="practitioner billname",
3414 * description="practitioner url",
3418 * property="assistant",
3419 * description="practitioner assistant",
3423 * property="organization",
3424 * description="practitioner organization",
3428 * property="valedictory",
3429 * description="practitioner valedictory",
3433 * property="street",
3434 * description="practitioner street",
3438 * property="streetb",
3439 * description="practitioner streetb",
3444 * description="practitioner city",
3449 * description="practitioner state",
3454 * description="practitioner zip",
3459 * description="practitioner phone",
3464 * description="fax",
3468 * property="phonew1",
3469 * description="practitioner phonew1",
3473 * property="phonecell",
3474 * description="practitioner phonecell",
3479 * description="practitioner notes",
3483 * property="state_license_number",
3484 * description="practitioner state license number",
3488 * property="abook_title",
3489 * description="practitioner abook title",
3493 * property="physician_title",
3494 * description="practitioner physician title",
3498 * property="physician_code",
3499 * description="practitioner physician code",
3505 * "validationErrors": {},
3506 * "error_description": {},
3509 * "uuid": "90d453fb-0248-4c0d-9575-d99d02b169f5",
3514 * "federaltaxid": "",
3515 * "federaldrugid": "",
3517 * "facility_id": "3",
3518 * "facility": "Your Clinic Name Here",
3519 * "npi": "0123456789",
3520 * "email": "info@pennfirm.com",
3526 * "organization": "",
3527 * "valedictory": "",
3528 * "street": "456 Tree Lane",
3529 * "streetb": "123 Cannaut Street",
3530 * "city": "FooTown",
3533 * "phone": "123-456-7890",
3535 * "phonew1": "(619) 555-7822",
3536 * "phonecell": "(619) 555-7821",
3538 * "state_license_number": "123456",
3539 * "abook_title": null,
3540 * "physician_title": null,
3541 * "physician_code": null
3549 * ref="#/components/responses/unauthorized"
3551 * security={{"openemr_auth":{}}}
3554 "PUT /api/practitioner/:pruuid" => function ($pruuid) {
3555 RestConfig
::authorization_check("admin", "users");
3556 $data = (array) (json_decode(file_get_contents("php://input")));
3557 $return = (new PractitionerRestController())->patch($pruuid, $data);
3558 RestConfig
::apiLog($return, $data);
3564 * path="/api/medical_problem",
3565 * description="Retrieves a list of medical problems",
3566 * tags={"standard"},
3570 * description="The uuid for the patient.",
3577 * name="condition_uuid",
3579 * description="The uuid for the medical problem.",
3588 * description="The title for the medical problem.",
3597 * description="The start date for the medical problem.",
3606 * description="The end date for the medical problem.",
3615 * description="The diagnosis for the medical problem.",
3623 * ref="#/components/responses/standard"
3627 * ref="#/components/responses/badrequest"
3631 * ref="#/components/responses/unauthorized"
3633 * security={{"openemr_auth":{}}}
3636 "GET /api/medical_problem" => function () {
3637 RestConfig
::authorization_check("encounters", "notes");
3638 $return = (new ConditionRestController())->getAll();
3639 RestConfig
::apiLog($return);
3645 * path="/api/medical_problem/{muuid}",
3646 * description="Retrieves a single medical problem by their uuid",
3647 * tags={"standard"},
3651 * description="The uuid for the medical problem.",
3659 * ref="#/components/responses/standard"
3663 * ref="#/components/responses/badrequest"
3667 * ref="#/components/responses/unauthorized"
3669 * security={{"openemr_auth":{}}}
3672 "GET /api/medical_problem/:muuid" => function ($muuid) {
3673 RestConfig
::authorization_check("encounters", "notes");
3674 $return = (new ConditionRestController())->getOne($muuid);
3675 RestConfig
::apiLog($return);
3681 * path="/api/patient/{puuid}/medical_problem",
3682 * description="Retrieves all medical problems for a patient",
3683 * tags={"standard"},
3687 * description="The uuid for the patient.",
3695 * ref="#/components/responses/standard"
3699 * ref="#/components/responses/badrequest"
3703 * ref="#/components/responses/unauthorized"
3705 * security={{"openemr_auth":{}}}
3708 "GET /api/patient/:puuid/medical_problem" => function ($puuid) {
3709 RestConfig
::authorization_check("encounters", "notes");
3710 $return = (new ConditionRestController())->getAll(['puuid' => $puuid, 'condition_uuid' => $muuid], "medical_problem");
3711 RestConfig
::apiLog($return);
3717 * path="/api/patient/{puuid}/medical_problem/{muuid}",
3718 * description="Retrieves a medical problem for a patient",
3719 * tags={"standard"},
3723 * description="The uuid for the patient.",
3732 * description="The uuid for the medical problem.",
3740 * ref="#/components/responses/standard"
3744 * ref="#/components/responses/badrequest"
3748 * ref="#/components/responses/unauthorized"
3750 * security={{"openemr_auth":{}}}
3753 "GET /api/patient/:puuid/medical_problem/:muuid" => function ($puuid, $muuid) {
3754 RestConfig
::authorization_check("patients", "med");
3755 $return = (new ConditionRestController())->getAll(['puuid' => $puuid, 'condition_uuid' => $muuid]);
3756 RestConfig
::apiLog($return);
3761 * Schema for the medical_problem request
3764 * schema="api_medical_problem_request",
3767 * description="The title of medical problem.",
3771 * property="begdate",
3772 * description="The beginning date of medical problem.",
3776 * property="enddate",
3777 * description="The end date of medical problem.",
3781 * property="diagnosis",
3782 * description="The diagnosis of medical problem. In format `<codetype>:<code>`",
3785 * required={"title", "begdate"},
3787 * "title": "Dermatochalasis",
3788 * "begdate": "2010-10-13",
3790 * "diagnosis": "ICD10:H02.839"
3796 * path="/api/patient/{puuid}/medical_problem",
3797 * description="Submits a new medical problem",
3798 * tags={"standard"},
3802 * description="The uuid for the patient.",
3811 * mediaType="application/json",
3812 * @OA\Schema(ref="#/components/schemas/api_medical_problem_request")
3817 * ref="#/components/responses/standard"
3821 * ref="#/components/responses/badrequest"
3825 * ref="#/components/responses/unauthorized"
3827 * security={{"openemr_auth":{}}}
3830 "POST /api/patient/:puuid/medical_problem" => function ($puuid) {
3831 RestConfig
::authorization_check("patients", "med");
3832 $data = (array) (json_decode(file_get_contents("php://input")));
3833 $return = (new ConditionRestController())->post($puuid, $data);
3834 RestConfig
::apiLog($return, $data);
3840 * path="/api/patient/{puuid}/medical_problem/{muuid}",
3841 * description="Edit a medical problem",
3842 * tags={"standard"},
3846 * description="The uuid for the patient.",
3855 * description="The uuid for the medical problem.",
3864 * mediaType="application/json",
3865 * @OA\Schema(ref="#/components/schemas/api_medical_problem_request")
3870 * ref="#/components/responses/standard"
3874 * ref="#/components/responses/badrequest"
3878 * ref="#/components/responses/unauthorized"
3880 * security={{"openemr_auth":{}}}
3883 "PUT /api/patient/:puuid/medical_problem/:muuid" => function ($puuid, $muuid) {
3884 RestConfig
::authorization_check("patients", "med");
3885 $data = (array) (json_decode(file_get_contents("php://input")));
3886 $return = (new ConditionRestController())->put($puuid, $muuid, $data);
3887 RestConfig
::apiLog($return, $data);
3893 * path="/api/patient/{puuid}/medical_problem/{muuid}",
3894 * description="Delete a medical problem",
3895 * tags={"standard"},
3899 * description="The uuid for the patient.",
3908 * description="The uuid for the medical problem.",
3916 * ref="#/components/responses/standard"
3920 * ref="#/components/responses/badrequest"
3924 * ref="#/components/responses/unauthorized"
3926 * security={{"openemr_auth":{}}}
3929 "DELETE /api/patient/:puuid/medical_problem/:muuid" => function ($puuid, $muuid) {
3930 RestConfig
::authorization_check("patients", "med");
3931 $return = (new ConditionRestController())->delete($puuid, $muuid);
3932 RestConfig
::apiLog($return);
3938 * path="/api/allergy",
3939 * description="Retrieves a list of allergies",
3940 * tags={"standard"},
3944 * description="The uuid for the patient.",
3953 * description="The uuid for the allergy.",
3962 * description="The title for the allergy.",
3971 * description="The start date for the allergy.",
3980 * description="The end date for the allergy.",
3989 * description="The diagnosis for the allergy.",
3997 * ref="#/components/responses/standard"
4001 * ref="#/components/responses/badrequest"
4005 * ref="#/components/responses/unauthorized"
4007 * security={{"openemr_auth":{}}}
4010 "GET /api/allergy" => function () {
4011 RestConfig
::authorization_check("patients", "med");
4012 $return = (new AllergyIntoleranceRestController())->getAll();
4013 RestConfig
::apiLog($return);
4019 * path="/api/allergy/{auuid}",
4020 * description="Retrieves a single allergy by their uuid",
4021 * tags={"standard"},
4025 * description="The uuid for the allergy.",
4033 * ref="#/components/responses/standard"
4037 * ref="#/components/responses/badrequest"
4041 * ref="#/components/responses/unauthorized"
4043 * security={{"openemr_auth":{}}}
4046 "GET /api/allergy/:auuid" => function ($auuid) {
4047 RestConfig
::authorization_check("patients", "med");
4048 $return = (new AllergyIntoleranceRestController())->getOne($auuid);
4049 RestConfig
::apiLog($return);
4055 * path="/api/patient/{puuid}/allergy",
4056 * description="Retrieves all allergies for a patient",
4057 * tags={"standard"},
4061 * description="The uuid for the patient.",
4069 * ref="#/components/responses/standard"
4073 * ref="#/components/responses/badrequest"
4077 * ref="#/components/responses/unauthorized"
4079 * security={{"openemr_auth":{}}}
4082 "GET /api/patient/:puuid/allergy" => function ($puuid) {
4083 RestConfig
::authorization_check("patients", "med");
4084 $return = (new AllergyIntoleranceRestController())->getAll(['lists.pid' => $puuid]);
4085 RestConfig
::apiLog($return);
4091 * path="/api/patient/{puuid}/allergy/{auuid}",
4092 * description="Retrieves a allergy for a patient",
4093 * tags={"standard"},
4097 * description="The uuid for the patient.",
4106 * description="The uuid for the allergy.",
4114 * ref="#/components/responses/standard"
4118 * ref="#/components/responses/badrequest"
4122 * ref="#/components/responses/unauthorized"
4124 * security={{"openemr_auth":{}}}
4127 "GET /api/patient/:puuid/allergy/:auuid" => function ($puuid, $auuid) {
4128 RestConfig
::authorization_check("patients", "med");
4129 $return = (new AllergyIntoleranceRestController())->getAll(['lists.pid' => $puuid, 'lists.id' => $auuid]);
4130 RestConfig
::apiLog($return);
4135 * Schema for the allergy request
4138 * schema="api_allergy_request",
4141 * description="The title of allergy.",
4145 * property="begdate",
4146 * description="The beginning date of allergy.",
4150 * property="enddate",
4151 * description="The end date of allergy.",
4155 * property="diagnosis",
4156 * description="The diagnosis of allergy. In format `<codetype>:<code>`",
4159 * required={"title", "begdate"},
4161 * "title": "Iodine",
4162 * "begdate": "2010-10-13",
4169 * path="/api/patient/{puuid}/allergy",
4170 * description="Submits a new allergy",
4171 * tags={"standard"},
4175 * description="The uuid for the patient.",
4184 * mediaType="application/json",
4185 * @OA\Schema(ref="#/components/schemas/api_allergy_request")
4190 * ref="#/components/responses/standard"
4194 * ref="#/components/responses/badrequest"
4198 * ref="#/components/responses/unauthorized"
4200 * security={{"openemr_auth":{}}}
4203 "POST /api/patient/:puuid/allergy" => function ($puuid) {
4204 RestConfig
::authorization_check("patients", "med");
4205 $data = (array) (json_decode(file_get_contents("php://input")));
4206 $return = (new AllergyIntoleranceRestController())->post($puuid, $data);
4207 RestConfig
::apiLog($return, $data);
4213 * path="/api/patient/{puuid}/allergy/{auuid}",
4214 * description="Edit a allergy",
4215 * tags={"standard"},
4219 * description="The uuid for the patient.",
4228 * description="The uuid for the allergy.",
4237 * mediaType="application/json",
4238 * @OA\Schema(ref="#/components/schemas/api_allergy_request")
4243 * ref="#/components/responses/standard"
4247 * ref="#/components/responses/badrequest"
4251 * ref="#/components/responses/unauthorized"
4253 * security={{"openemr_auth":{}}}
4256 "PUT /api/patient/:puuid/allergy/:auuid" => function ($puuid, $auuid) {
4257 RestConfig
::authorization_check("patients", "med");
4258 $data = (array) (json_decode(file_get_contents("php://input")));
4259 $return = (new AllergyIntoleranceRestController())->put($puuid, $auuid, $data);
4260 RestConfig
::apiLog($return, $data);
4266 * path="/api/patient/{puuid}/allergy/{auuid}",
4267 * description="Delete a medical problem",
4268 * tags={"standard"},
4272 * description="The uuid for the patient.",
4281 * description="The uuid for the allergy.",
4289 * ref="#/components/responses/standard"
4293 * ref="#/components/responses/badrequest"
4297 * ref="#/components/responses/unauthorized"
4299 * security={{"openemr_auth":{}}}
4302 "DELETE /api/patient/:puuid/allergy/:auuid" => function ($puuid, $auuid) {
4303 RestConfig
::authorization_check("patients", "med");
4304 $return = (new AllergyIntoleranceRestController())->delete($puuid, $auuid);
4305 RestConfig
::apiLog($return);
4311 * path="/api/patient/{pid}/medication",
4312 * description="Retrieves all medications for a patient",
4313 * tags={"standard"},
4317 * description="The pid for the patient.",
4325 * ref="#/components/responses/standard"
4329 * ref="#/components/responses/badrequest"
4333 * ref="#/components/responses/unauthorized"
4335 * security={{"openemr_auth":{}}}
4338 "GET /api/patient/:pid/medication" => function ($pid) {
4339 RestConfig
::authorization_check("patients", "med");
4340 $return = (new ListRestController())->getAll($pid, "medication");
4341 RestConfig
::apiLog($return);
4346 * Schema for the medication request
4349 * schema="api_medication_request",
4352 * description="The title of medication.",
4356 * property="begdate",
4357 * description="The beginning date of medication.",
4361 * property="enddate",
4362 * description="The end date of medication.",
4366 * property="diagnosis",
4367 * description="The diagnosis of medication. In format `<codetype>:<code>`",
4370 * required={"title", "begdate"},
4372 * "title": "Norvasc",
4373 * "begdate": "2013-04-13",
4380 * path="/api/patient/{pid}/medication",
4381 * description="Submits a new medication",
4382 * tags={"standard"},
4386 * description="The pid for the patient.",
4395 * mediaType="application/json",
4396 * @OA\Schema(ref="#/components/schemas/api_medication_request")
4401 * ref="#/components/responses/standard"
4405 * ref="#/components/responses/badrequest"
4409 * ref="#/components/responses/unauthorized"
4411 * security={{"openemr_auth":{}}}
4414 "POST /api/patient/:pid/medication" => function ($pid) {
4415 RestConfig
::authorization_check("patients", "med");
4416 $data = (array) (json_decode(file_get_contents("php://input")));
4417 $return = (new ListRestController())->post($pid, "medication", $data);
4418 RestConfig
::apiLog($return, $data);
4424 * path="/api/patient/{pid}/medication/{mid}",
4425 * description="Edit a medication",
4426 * tags={"standard"},
4430 * description="The pid for the patient.",
4439 * description="The id for the medication.",
4448 * mediaType="application/json",
4449 * @OA\Schema(ref="#/components/schemas/api_medication_request")
4454 * ref="#/components/responses/standard"
4458 * ref="#/components/responses/badrequest"
4462 * ref="#/components/responses/unauthorized"
4464 * security={{"openemr_auth":{}}}
4467 "PUT /api/patient/:pid/medication/:mid" => function ($pid, $mid) {
4468 RestConfig
::authorization_check("patients", "med");
4469 $data = (array) (json_decode(file_get_contents("php://input")));
4470 $return = (new ListRestController())->put($pid, $mid, "medication", $data);
4471 RestConfig
::apiLog($return, $data);
4477 * path="/api/patient/{pid}/medication/{mid}",
4478 * description="Retrieves a medication for a patient",
4479 * tags={"standard"},
4483 * description="The id for the patient.",
4492 * description="The id for the medication.",
4500 * ref="#/components/responses/standard"
4504 * ref="#/components/responses/badrequest"
4508 * ref="#/components/responses/unauthorized"
4510 * security={{"openemr_auth":{}}}
4513 "GET /api/patient/:pid/medication/:mid" => function ($pid, $mid) {
4514 RestConfig
::authorization_check("patients", "med");
4515 $return = (new ListRestController())->getOne($pid, "medication", $mid);
4516 RestConfig
::apiLog($return);
4522 * path="/api/patient/{pid}/medication/{mid}",
4523 * description="Delete a medication",
4524 * tags={"standard"},
4528 * description="The id for the patient.",
4537 * description="The id for the medication.",
4545 * ref="#/components/responses/standard"
4549 * ref="#/components/responses/badrequest"
4553 * ref="#/components/responses/unauthorized"
4555 * security={{"openemr_auth":{}}}
4558 "DELETE /api/patient/:pid/medication/:mid" => function ($pid, $mid) {
4559 RestConfig
::authorization_check("patients", "med");
4560 $return = (new ListRestController())->delete($pid, $mid, "medication");
4561 RestConfig
::apiLog($return);
4567 * path="/api/patient/{pid}/surgery",
4568 * description="Retrieves all surgeries for a patient",
4569 * tags={"standard"},
4573 * description="The pid for the patient.",
4581 * ref="#/components/responses/standard"
4585 * ref="#/components/responses/badrequest"
4589 * ref="#/components/responses/unauthorized"
4591 * security={{"openemr_auth":{}}}
4594 "GET /api/patient/:pid/surgery" => function ($pid) {
4595 RestConfig
::authorization_check("patients", "med");
4596 $return = (new ListRestController())->getAll($pid, "surgery");
4597 RestConfig
::apiLog($return);
4603 * path="/api/patient/{pid}/surgery/{sid}",
4604 * description="Retrieves a surgery for a patient",
4605 * tags={"standard"},
4609 * description="The id for the patient.",
4618 * description="The id for the surgery.",
4626 * ref="#/components/responses/standard"
4630 * ref="#/components/responses/badrequest"
4634 * ref="#/components/responses/unauthorized"
4636 * security={{"openemr_auth":{}}}
4639 "GET /api/patient/:pid/surgery/:sid" => function ($pid, $sid) {
4640 RestConfig
::authorization_check("patients", "med");
4641 $return = (new ListRestController())->getOne($pid, "surgery", $sid);
4642 RestConfig
::apiLog($return);
4648 * path="/api/patient/{pid}/surgery/{sid}",
4649 * description="Delete a surgery",
4650 * tags={"standard"},
4654 * description="The id for the patient.",
4663 * description="The id for the surgery.",
4671 * ref="#/components/responses/standard"
4675 * ref="#/components/responses/badrequest"
4679 * ref="#/components/responses/unauthorized"
4681 * security={{"openemr_auth":{}}}
4684 "DELETE /api/patient/:pid/surgery/:sid" => function ($pid, $sid) {
4685 RestConfig
::authorization_check("patients", "med");
4686 $return = (new ListRestController())->delete($pid, $sid, "surgery");
4687 RestConfig
::apiLog($return);
4692 * Schema for the surgery request
4695 * schema="api_surgery_request",
4698 * description="The title of surgery.",
4702 * property="begdate",
4703 * description="The beginning date of surgery.",
4707 * property="enddate",
4708 * description="The end date of surgery.",
4712 * property="diagnosis",
4713 * description="The diagnosis of surgery. In format `<codetype>:<code>`",
4716 * required={"title", "begdate"},
4718 * "title": "Blepharoplasty",
4719 * "begdate": "2013-10-14",
4721 * "diagnosis": "CPT4:15823-50"
4727 * path="/api/patient/{pid}/surgery",
4728 * description="Submits a new surgery",
4729 * tags={"standard"},
4733 * description="The pid for the patient.",
4742 * mediaType="application/json",
4743 * @OA\Schema(ref="#/components/schemas/api_surgery_request")
4748 * ref="#/components/responses/standard"
4752 * ref="#/components/responses/badrequest"
4756 * ref="#/components/responses/unauthorized"
4758 * security={{"openemr_auth":{}}}
4761 "POST /api/patient/:pid/surgery" => function ($pid) {
4762 RestConfig
::authorization_check("patients", "med");
4763 $data = (array) (json_decode(file_get_contents("php://input")));
4764 $return = (new ListRestController())->post($pid, "surgery", $data);
4765 RestConfig
::apiLog($return, $data);
4771 * path="/api/patient/{pid}/surgery/{sid}",
4772 * description="Edit a surgery",
4773 * tags={"standard"},
4777 * description="The pid for the patient.",
4786 * description="The id for the surgery.",
4795 * mediaType="application/json",
4796 * @OA\Schema(ref="#/components/schemas/api_surgery_request")
4801 * ref="#/components/responses/standard"
4805 * ref="#/components/responses/badrequest"
4809 * ref="#/components/responses/unauthorized"
4811 * security={{"openemr_auth":{}}}
4814 "PUT /api/patient/:pid/surgery/:sid" => function ($pid, $sid) {
4815 RestConfig
::authorization_check("patients", "med");
4816 $data = (array) (json_decode(file_get_contents("php://input")));
4817 $return = (new ListRestController())->put($pid, $sid, "surgery", $data);
4818 RestConfig
::apiLog($return, $data);
4824 * path="/api/patient/{pid}/dental_issue",
4825 * description="Retrieves all dental issues for a patient",
4826 * tags={"standard"},
4830 * description="The pid for the patient.",
4838 * ref="#/components/responses/standard"
4842 * ref="#/components/responses/badrequest"
4846 * ref="#/components/responses/unauthorized"
4848 * security={{"openemr_auth":{}}}
4851 "GET /api/patient/:pid/dental_issue" => function ($pid) {
4852 RestConfig
::authorization_check("patients", "med");
4853 $return = (new ListRestController())->getAll($pid, "dental");
4854 RestConfig
::apiLog($return);
4860 * path="/api/patient/{pid}/dental_issue/{did}",
4861 * description="Retrieves a dental issue for a patient",
4862 * tags={"standard"},
4866 * description="The id for the patient.",
4875 * description="The id for the dental issue.",
4883 * ref="#/components/responses/standard"
4887 * ref="#/components/responses/badrequest"
4891 * ref="#/components/responses/unauthorized"
4893 * security={{"openemr_auth":{}}}
4896 "GET /api/patient/:pid/dental_issue/:did" => function ($pid, $did) {
4897 RestConfig
::authorization_check("patients", "med");
4898 $return = (new ListRestController())->getOne($pid, "dental", $did);
4899 RestConfig
::apiLog($return);
4905 * path="/api/patient/{pid}/dental_issue/{did}",
4906 * description="Delete a dental issue",
4907 * tags={"standard"},
4911 * description="The id for the patient.",
4920 * description="The id for the dental issue.",
4928 * ref="#/components/responses/standard"
4932 * ref="#/components/responses/badrequest"
4936 * ref="#/components/responses/unauthorized"
4938 * security={{"openemr_auth":{}}}
4941 "DELETE /api/patient/:pid/dental_issue/:did" => function ($pid, $did) {
4942 RestConfig
::authorization_check("patients", "med");
4943 $return = (new ListRestController())->delete($pid, $did, "dental");
4944 RestConfig
::apiLog($return);
4949 * Schema for the dental_issue request
4952 * schema="api_dental_issue_request",
4955 * description="The title of dental issue.",
4959 * property="begdate",
4960 * description="The beginning date of dental issue.",
4964 * property="enddate",
4965 * description="The end date of dental issue.",
4969 * property="diagnosis",
4970 * description="The diagnosis of dental issue. In format `<codetype>:<code>`",
4973 * required={"title", "begdate"},
4975 * "title": "Halitosis",
4976 * "begdate": "2015-03-17",
4983 * path="/api/patient/{pid}/dental_issue",
4984 * description="Submits a new dental issue",
4985 * tags={"standard"},
4989 * description="The pid for the patient.",
4998 * mediaType="application/json",
4999 * @OA\Schema(ref="#/components/schemas/api_dental_issue_request")
5004 * ref="#/components/responses/standard"
5008 * ref="#/components/responses/badrequest"
5012 * ref="#/components/responses/unauthorized"
5014 * security={{"openemr_auth":{}}}
5017 "POST /api/patient/:pid/dental_issue" => function ($pid) {
5018 RestConfig
::authorization_check("patients", "med");
5019 $data = (array) (json_decode(file_get_contents("php://input")));
5020 $return = (new ListRestController())->post($pid, "dental", $data);
5021 RestConfig
::apiLog($return, $data);
5027 * path="/api/patient/{pid}/dental_issue/{did}",
5028 * description="Edit a dental issue",
5029 * tags={"standard"},
5033 * description="The pid for the patient.",
5042 * description="The id for the dental issue.",
5051 * mediaType="application/json",
5052 * @OA\Schema(ref="#/components/schemas/api_dental_issue_request")
5057 * ref="#/components/responses/standard"
5061 * ref="#/components/responses/badrequest"
5065 * ref="#/components/responses/unauthorized"
5067 * security={{"openemr_auth":{}}}
5070 "PUT /api/patient/:pid/dental_issue/:did" => function ($pid, $did) {
5071 RestConfig
::authorization_check("patients", "med");
5072 $data = (array) (json_decode(file_get_contents("php://input")));
5073 $return = (new ListRestController())->put($pid, $did, "dental", $data);
5074 RestConfig
::apiLog($return, $data);
5080 * path="/api/patient/{pid}/appointment",
5081 * description="Retrieves all appointments for a patient",
5082 * tags={"standard"},
5086 * description="The pid for the patient.",
5094 * ref="#/components/responses/standard"
5098 * ref="#/components/responses/badrequest"
5102 * ref="#/components/responses/unauthorized"
5104 * security={{"openemr_auth":{}}}
5107 "GET /api/patient/:pid/appointment" => function ($pid) {
5108 RestConfig
::authorization_check("patients", "appt");
5109 $return = (new AppointmentRestController())->getAllForPatient($pid);
5110 RestConfig
::apiLog($return);
5116 * path="/api/patient/{pid}/appointment",
5117 * description="Submits a new appointment",
5118 * tags={"standard"},
5122 * description="The id for the patient.",
5131 * mediaType="application/json",
5134 * property="pc_catid",
5135 * description="The category of the appointment.",
5139 * property="pc_title",
5140 * description="The title of the appointment.",
5144 * property="pc_duration",
5145 * description="The duration of the appointment.",
5149 * property="pc_hometext",
5150 * description="Comments for the appointment.",
5154 * property="pc_apptstatus",
5155 * description="use an option from resource=/api/list/apptstat",
5159 * property="pc_eventDate",
5160 * description="The date of the appointment.",
5164 * property="pc_startTime",
5165 * description="The time of the appointment.",
5169 * property="pc_facility",
5170 * description="The facility id of the appointment.",
5174 * property="pc_billing_location",
5175 * description="The billinag location id of the appointment.",
5179 * property="pc_aid",
5180 * description="The provider id for the appointment.",
5183 * required={"pc_catid", "pc_title", "pc_duration", "pc_hometext", "pc_apptstatus", "pc_eventDate", "pc_startTime", "pc_facility", "pc_billing_location"},
5186 * "pc_title": "Office Visit",
5187 * "pc_duration": "900",
5188 * "pc_hometext": "Test",
5189 * "pc_apptstatus": "-",
5190 * "pc_eventDate": "2018-10-19",
5191 * "pc_startTime": "09:00",
5192 * "pc_facility": "9",
5193 * "pc_billing_location": "10",
5201 * ref="#/components/responses/standard"
5205 * ref="#/components/responses/badrequest"
5209 * ref="#/components/responses/unauthorized"
5211 * security={{"openemr_auth":{}}}
5214 "POST /api/patient/:pid/appointment" => function ($pid) {
5215 RestConfig
::authorization_check("patients", "appt");
5216 $data = (array) (json_decode(file_get_contents("php://input")));
5217 $return = (new AppointmentRestController())->post($pid, $data);
5218 RestConfig
::apiLog($return, $data);
5224 * path="/api/appointment",
5225 * description="Retrieves all appointments",
5226 * tags={"standard"},
5229 * ref="#/components/responses/standard"
5233 * ref="#/components/responses/badrequest"
5237 * ref="#/components/responses/unauthorized"
5239 * security={{"openemr_auth":{}}}
5242 "GET /api/appointment" => function () {
5243 RestConfig
::authorization_check("patients", "appt");
5244 $return = (new AppointmentRestController())->getAll();
5245 RestConfig
::apiLog($return);
5251 * path="/api/appointment/{eid}",
5252 * description="Retrieves an appointment",
5253 * tags={"standard"},
5257 * description="The eid for the appointment.",
5265 * ref="#/components/responses/standard"
5269 * ref="#/components/responses/badrequest"
5273 * ref="#/components/responses/unauthorized"
5275 * security={{"openemr_auth":{}}}
5278 "GET /api/appointment/:eid" => function ($eid) {
5279 RestConfig
::authorization_check("patients", "appt");
5280 $return = (new AppointmentRestController())->getOne($eid);
5281 RestConfig
::apiLog($return);
5287 * path="/api/patient/{pid}/appointment/{eid}",
5288 * description="Delete a appointment",
5289 * tags={"standard"},
5293 * description="The id for the patient.",
5302 * description="The eid for the appointment.",
5310 * ref="#/components/responses/standard"
5314 * ref="#/components/responses/badrequest"
5318 * ref="#/components/responses/unauthorized"
5320 * security={{"openemr_auth":{}}}
5323 "DELETE /api/patient/:pid/appointment/:eid" => function ($pid, $eid) {
5324 RestConfig
::authorization_check("patients", "appt");
5325 $return = (new AppointmentRestController())->delete($eid);
5326 RestConfig
::apiLog($return);
5332 * path="/api/patient/{pid}/appointment/{eid}",
5333 * description="Retrieves a appointment for a patient",
5334 * tags={"standard"},
5338 * description="The id for the patient.",
5347 * description="The eid for the appointment.",
5355 * ref="#/components/responses/standard"
5359 * ref="#/components/responses/badrequest"
5363 * ref="#/components/responses/unauthorized"
5365 * security={{"openemr_auth":{}}}
5368 "GET /api/patient/:pid/appointment/:eid" => function ($pid, $eid) {
5369 RestConfig
::authorization_check("patients", "appt");
5370 $return = (new AppointmentRestController())->getOne($eid);
5371 RestConfig
::apiLog($return);
5377 * path="/api/list/{list_name}",
5378 * description="Retrieves a list",
5379 * tags={"standard"},
5383 * description="The list_id of the list.",
5391 * ref="#/components/responses/standard"
5395 * ref="#/components/responses/badrequest"
5399 * ref="#/components/responses/unauthorized"
5401 * security={{"openemr_auth":{}}}
5404 "GET /api/list/:list_name" => function ($list_name) {
5405 RestConfig
::authorization_check("lists", "default");
5406 $return = (new ListRestController())->getOptions($list_name);
5407 RestConfig
::apiLog($return);
5414 * description="Retrieves a list of users",
5415 * tags={"standard"},
5419 * description="The id for the user.",
5428 * description="The title for the user.",
5437 * description="The first name for the user.",
5446 * description="The last name for the user.",
5455 * description="The middle name for the user.",
5462 * name="federaltaxid",
5464 * description="The federal tax id for the user.",
5471 * name="federaldrugid",
5473 * description="The federal drug id for the user.",
5482 * description="The upin for the user.",
5489 * name="facility_id",
5491 * description="The facility id for the user.",
5500 * description="The facility for the user.",
5509 * description="The npi for the user.",
5518 * description="The email for the user.",
5527 * description="The specialty for the user.",
5536 * description="The billname for the user.",
5545 * description="The url for the user.",
5554 * description="The assistant for the user.",
5561 * name="organization",
5563 * description="The organization for the user.",
5570 * name="valedictory",
5572 * description="The valedictory for the user.",
5581 * description="The street for the user.",
5590 * description="The street (line 2) for the user.",
5599 * description="The city for the user.",
5608 * description="The state for the user.",
5617 * description="The zip for the user.",
5626 * description="The phone for the user.",
5635 * description="The fax for the user.",
5644 * description="The phonew1 for the user.",
5653 * description="The phonecell for the user.",
5662 * description="The notes for the user.",
5669 * name="state_license_number2",
5671 * description="The state license number for the user.",
5680 * description="The username for the user.",
5688 * ref="#/components/responses/standard"
5692 * ref="#/components/responses/badrequest"
5696 * ref="#/components/responses/unauthorized"
5698 * security={{"openemr_auth":{}}}
5701 "GET /api/user" => function () {
5702 RestConfig
::authorization_check("admin", "users");
5703 $return = (new UserRestController())->getAll($_GET);
5704 RestConfig
::apiLog($return);
5710 * path="/api/user/{uuid}",
5711 * description="Retrieves a single user by their uuid",
5712 * tags={"standard"},
5716 * description="The uuid for the user.",
5724 * ref="#/components/responses/standard"
5728 * ref="#/components/responses/badrequest"
5732 * ref="#/components/responses/unauthorized"
5734 * security={{"openemr_auth":{}}}
5737 "GET /api/user/:uuid" => function ($uuid) {
5738 RestConfig
::authorization_check("admin", "users");
5739 $return = (new UserRestController())->getOne($uuid);
5740 RestConfig
::apiLog($return);
5746 * path="/api/version",
5747 * description="Retrieves the OpenEMR version information",
5748 * tags={"standard"},
5751 * ref="#/components/responses/standard"
5755 * ref="#/components/responses/badrequest"
5759 * ref="#/components/responses/unauthorized"
5761 * security={{"openemr_auth":{}}}
5764 "GET /api/version" => function () {
5765 $return = (new VersionRestController())->getOne();
5766 RestConfig
::apiLog($return);
5772 * path="/api/product",
5773 * description="Retrieves the OpenEMR product registration information",
5774 * tags={"standard"},
5777 * ref="#/components/responses/standard"
5781 * ref="#/components/responses/badrequest"
5785 * ref="#/components/responses/unauthorized"
5787 * security={{"openemr_auth":{}}}
5790 "GET /api/product" => function () {
5791 $return = (new ProductRegistrationRestController())->getOne();
5792 RestConfig
::apiLog($return);
5798 * path="/api/insurance_company",
5799 * description="Retrieves all insurance companies",
5800 * tags={"standard"},
5803 * ref="#/components/responses/standard"
5807 * ref="#/components/responses/badrequest"
5811 * ref="#/components/responses/unauthorized"
5813 * security={{"openemr_auth":{}}}
5816 "GET /api/insurance_company" => function () {
5817 $return = (new InsuranceCompanyRestController())->getAll();
5818 RestConfig
::apiLog($return);
5824 * path="/api/insurance_company/{iid}",
5825 * description="Retrieves insurance company",
5826 * tags={"standard"},
5830 * description="The id of the insurance company.",
5838 * ref="#/components/responses/standard"
5842 * ref="#/components/responses/badrequest"
5846 * ref="#/components/responses/unauthorized"
5848 * security={{"openemr_auth":{}}}
5851 "GET /api/insurance_company/:iid" => function ($iid) {
5852 $return = (new InsuranceCompanyRestController())->getOne($iid);
5853 RestConfig
::apiLog($return);
5859 * path="/api/insurance_type",
5860 * description="Retrieves all insurance types",
5861 * tags={"standard"},
5864 * ref="#/components/responses/standard"
5868 * ref="#/components/responses/badrequest"
5872 * ref="#/components/responses/unauthorized"
5874 * security={{"openemr_auth":{}}}
5877 "GET /api/insurance_type" => function () {
5878 $return = (new InsuranceCompanyRestController())->getInsuranceTypes();
5879 RestConfig
::apiLog($return);
5884 * Schema for the insurance_company request
5887 * schema="api_insurance_company_request",
5890 * description="The name of insurance company.",
5895 * description="The attn of insurance company.",
5899 * property="cms_id",
5900 * description="The cms id of insurance company.",
5904 * property="ins_type_code",
5905 * description="The insurance type code of insurance company. The insurance type code can be found by inspecting the route at (/api/insurance_type).",
5909 * property="x12_receiver_id",
5910 * description="The x12 receiver id of insurance company.",
5914 * property="x12_default_partner_id",
5915 * description="The x12 default partner id of insurance company.",
5919 * property="alt_cms_id",
5920 * description="The alternate cms id of insurance company.",
5925 * description="The line1 address of insurance company.",
5930 * description="The line2 address of insurance company.",
5935 * description="The city of insurance company.",
5940 * description="The state of insurance company.",
5945 * description="The zip of insurance company.",
5949 * property="country",
5950 * description="The country of insurance company.",
5953 * required={"name"},
5955 * "name": "Cool Insurance Company",
5958 * "ins_type_code": "2",
5959 * "x12_receiver_id": null,
5960 * "x12_default_partner_id": null,
5962 * "line1": "123 Cool Lane",
5963 * "line2": "Suite 123",
5964 * "city": "Cooltown",
5973 * path="/api/insurance_company",
5974 * description="Submits a new insurance company",
5975 * tags={"standard"},
5979 * mediaType="application/json",
5980 * @OA\Schema(ref="#/components/schemas/api_insurance_company_request")
5985 * ref="#/components/responses/standard"
5989 * ref="#/components/responses/badrequest"
5993 * ref="#/components/responses/unauthorized"
5995 * security={{"openemr_auth":{}}}
5998 "POST /api/insurance_company" => function () {
5999 $data = (array) (json_decode(file_get_contents("php://input")));
6000 $return = (new InsuranceCompanyRestController())->post($data);
6001 RestConfig
::apiLog($return, $data);
6007 * path="/api/insurance_company/{iid}",
6008 * description="Edit a insurance company",
6009 * tags={"standard"},
6013 * description="The id for the insurance company.",
6022 * mediaType="application/json",
6023 * @OA\Schema(ref="#/components/schemas/api_insurance_company_request")
6028 * ref="#/components/responses/standard"
6032 * ref="#/components/responses/badrequest"
6036 * ref="#/components/responses/unauthorized"
6038 * security={{"openemr_auth":{}}}
6041 "PUT /api/insurance_company/:iid" => function ($iid) {
6042 $data = (array) (json_decode(file_get_contents("php://input")));
6043 $return = (new InsuranceCompanyRestController())->put($iid, $data);
6044 RestConfig
::apiLog($return, $data);
6050 * path="/api/patient/{pid}/document",
6051 * description="Submits a new patient document",
6052 * tags={"standard"},
6056 * description="The pid for the patient.",
6065 * description="The category of the document.",
6074 * mediaType="multipart/form-data",
6077 * property="document",
6078 * description="document",
6087 * ref="#/components/responses/standard"
6091 * ref="#/components/responses/badrequest"
6095 * ref="#/components/responses/unauthorized"
6097 * security={{"openemr_auth":{}}}
6100 "POST /api/patient/:pid/document" => function ($pid) {
6101 $return = (new DocumentRestController())->postWithPath($pid, $_GET['path'], $_FILES['document']);
6102 RestConfig
::apiLog($return);
6108 * path="/api/patient/{pid}/document",
6109 * description="Retrieves all file information of documents from a category for a patient",
6110 * tags={"standard"},
6114 * description="The pid for the patient.",
6123 * description="The category of the documents.",
6131 * ref="#/components/responses/standard"
6135 * ref="#/components/responses/badrequest"
6139 * ref="#/components/responses/unauthorized"
6141 * security={{"openemr_auth":{}}}
6144 "GET /api/patient/:pid/document" => function ($pid) {
6145 $return = (new DocumentRestController())->getAllAtPath($pid, $_GET['path']);
6146 RestConfig
::apiLog($return);
6152 * path="/api/patient/{pid}/document/{did}",
6153 * description="Retrieves a document for a patient",
6154 * tags={"standard"},
6158 * description="The pid for the patient.",
6167 * description="The id for the patient document.",
6175 * ref="#/components/responses/standard"
6179 * ref="#/components/responses/badrequest"
6183 * ref="#/components/responses/unauthorized"
6185 * security={{"openemr_auth":{}}}
6188 "GET /api/patient/:pid/document/:did" => function ($pid, $did) {
6189 $return = (new DocumentRestController())->downloadFile($pid, $did);
6190 RestConfig
::apiLog($return);
6196 * path="/api/patient/{pid}/insurance",
6197 * description="Retrieves all insurances for a patient",
6198 * tags={"standard"},
6202 * description="The pid for the patient.",
6210 * ref="#/components/responses/standard"
6214 * ref="#/components/responses/badrequest"
6218 * ref="#/components/responses/unauthorized"
6220 * security={{"openemr_auth":{}}}
6223 "GET /api/patient/:pid/insurance" => function ($pid) {
6224 $return = (new InsuranceRestController())->getAll($pid);
6225 RestConfig
::apiLog($return);
6231 * path="/api/patient/{pid}/insurance/{type}",
6232 * description="Retrieves a insurance (by type) for a patient",
6233 * tags={"standard"},
6237 * description="The pid for the patient.",
6246 * description="The insurance type for the patient. (options are 'primary', 'secondary', or 'tertiary')",
6254 * ref="#/components/responses/standard"
6258 * ref="#/components/responses/badrequest"
6262 * ref="#/components/responses/unauthorized"
6264 * security={{"openemr_auth":{}}}
6267 "GET /api/patient/:pid/insurance/:type" => function ($pid, $type) {
6268 $return = (new InsuranceRestController())->getOne($pid, $type);
6269 RestConfig
::apiLog($return);
6274 * Schema for the insurance request
6277 * schema="api_insurance_request",
6279 * property="provider",
6280 * description="The insurance company id.",
6284 * property="plan_name",
6285 * description="The plan name of insurance.",
6289 * property="policy_number",
6290 * description="The policy number of insurance.",
6294 * property="group_number",
6295 * description="The group number of insurance.",
6299 * property="subscriber_lname",
6300 * description="The subscriber last name of insurance.",
6304 * property="subscriber_mname",
6305 * description="The subscriber middle name of insurance.",
6309 * property="subscriber_fname",
6310 * description="The subscriber first name of insurance.",
6314 * property="subscriber_relationship",
6315 * description="The subscriber relationship of insurance.",
6319 * property="subscriber_ss",
6320 * description="The subscriber ss number of insurance.",
6324 * property="subscriber_DOB",
6325 * description="The subscriber DOB of insurance.",
6329 * property="subscriber_street",
6330 * description="The subscriber street address of insurance.",
6334 * property="subscriber_postal_code",
6335 * description="The subscriber postal code of insurance.",
6339 * property="subscriber_city",
6340 * description="The subscriber city of insurance.",
6344 * property="subscriber_state",
6345 * description="The subscriber state of insurance. `state` can be found by querying `resource=/api/list/state`",
6349 * property="subscriber_country",
6350 * description="The subscriber country of insurance. `country` can be found by querying `resource=/api/list/country`",
6354 * property="subscriber_phone",
6355 * description="The subscriber phone of insurance.",
6359 * property="subscriber_employer",
6360 * description="The subscriber employer of insurance.",
6364 * property="subscriber_employer_street",
6365 * description="The subscriber employer street of insurance.",
6369 * property="subscriber_employer_postal_code",
6370 * description="The subscriber employer postal code of insurance.",
6374 * property="subscriber_employer_state",
6375 * description="The subscriber employer state of insurance.",
6379 * property="subscriber_employer_country",
6380 * description="The subscriber employer country of insurance.",
6384 * property="subscriber_employer_city",
6385 * description="The subscriber employer city of insurance.",
6390 * description="The copay of insurance.",
6395 * description="The date of insurance.",
6399 * property="subscriber_sex",
6400 * description="The subscriber sex of insurance.",
6404 * property="accept_assignment",
6405 * description="The accept_assignment of insurance.",
6409 * property="policy_type",
6410 * description="The policy_type of insurance.",
6413 * required={"provider", "plan_name", "policy_number", "group_number", "subscriber_fname", "subscriber_lname", "subscriber_relationship", "subscriber_ss", "subscriber_DOB", "subscriber_street", "subscriber_postal_code", "subscriber_city", "subscriber_state", "subscriber_country", "subscriber_phone", "subscriber_sex", "accept_assignment", "policy_type"},
6416 * "plan_name": "Some Plan",
6417 * "policy_number": "12345",
6418 * "group_number": "252412",
6419 * "subscriber_lname": "Tester",
6420 * "subscriber_mname": "Xi",
6421 * "subscriber_fname": "Foo",
6422 * "subscriber_relationship": "other",
6423 * "subscriber_ss": "234231234",
6424 * "subscriber_DOB": "2018-10-03",
6425 * "subscriber_street": "183 Cool St",
6426 * "subscriber_postal_code": "23418",
6427 * "subscriber_city": "Cooltown",
6428 * "subscriber_state": "AZ",
6429 * "subscriber_country": "USA",
6430 * "subscriber_phone": "234-598-2123",
6431 * "subscriber_employer": "Some Employer",
6432 * "subscriber_employer_street": "123 Heather Lane",
6433 * "subscriber_employer_postal_code": "23415",
6434 * "subscriber_employer_state": "AZ",
6435 * "subscriber_employer_country": "USA",
6436 * "subscriber_employer_city": "Cooltown",
6438 * "date": "2018-10-15",
6439 * "subscriber_sex": "Female",
6440 * "accept_assignment": "TRUE",
6441 * "policy_type": "a"
6447 * path="/api/patient/{pid}/insurance/{type}",
6448 * description="Submits a new patient insurance (with type)",
6449 * tags={"standard"},
6453 * description="The pid for the patient.",
6462 * description="The insurance type for the patient. (options are 'primary', 'secondary', or 'tertiary')",
6471 * mediaType="application/json",
6472 * @OA\Schema(ref="#/components/schemas/api_insurance_request")
6477 * ref="#/components/responses/standard"
6481 * ref="#/components/responses/badrequest"
6485 * ref="#/components/responses/unauthorized"
6487 * security={{"openemr_auth":{}}}
6490 "POST /api/patient/:pid/insurance/:type" => function ($pid, $type) {
6491 $data = (array) (json_decode(file_get_contents("php://input")));
6492 $return = (new InsuranceRestController())->post($pid, $type, $data);
6493 RestConfig
::apiLog($return, $data);
6499 * path="/api/patient/{pid}/insurance/{type}",
6500 * description="Edit a patient insurance (by type)",
6501 * tags={"standard"},
6505 * description="The pid for the patient.",
6514 * description="The insurance type for the patient. (options are 'primary', 'secondary', or 'tertiary')",
6523 * mediaType="application/json",
6524 * @OA\Schema(ref="#/components/schemas/api_insurance_request")
6529 * ref="#/components/responses/standard"
6533 * ref="#/components/responses/badrequest"
6537 * ref="#/components/responses/unauthorized"
6539 * security={{"openemr_auth":{}}}
6542 "PUT /api/patient/:pid/insurance/:type" => function ($pid, $type) {
6543 $data = (array) (json_decode(file_get_contents("php://input")));
6544 $return = (new InsuranceRestController())->put($pid, $type, $data);
6545 RestConfig
::apiLog($return, $data);
6550 * Schema for the message request
6553 * schema="api_message_request",
6556 * description="The body of message.",
6560 * property="groupname",
6561 * description="The group name (usually is 'Default').",
6566 * description="The sender of the message.",
6571 * description="The recipient of the message.",
6576 * description="use an option from resource=/api/list/note_type",
6580 * property="message_status",
6581 * description="use an option from resource=/api/list/message_status",
6584 * required={"body", "groupname", "from", "to", "title", "message_status"},
6586 * "body": "Test 456",
6587 * "groupname": "Default",
6588 * "from": "Matthew",
6591 * "message_status": "New"
6597 * path="/api/patient/{pid}/message",
6598 * description="Submits a pnote message",
6599 * tags={"standard"},
6603 * description="The id for the patient.",
6612 * mediaType="application/json",
6613 * @OA\Schema(ref="#/components/schemas/api_message_request")
6618 * ref="#/components/responses/standard"
6622 * ref="#/components/responses/badrequest"
6626 * ref="#/components/responses/unauthorized"
6628 * security={{"openemr_auth":{}}}
6631 "POST /api/patient/:pid/message" => function ($pid) {
6632 RestConfig
::authorization_check("patients", "notes");
6633 $data = (array) (json_decode(file_get_contents("php://input")));
6634 $return = (new MessageRestController())->post($pid, $data);
6635 RestConfig
::apiLog($return, $data);
6641 * path="/api/patient/{pid}/transaction",
6642 * description="Get Transactions for a patient",
6643 * tags={"standard"},
6647 * description="The pid for the patient",
6655 * ref="#/components/responses/standard"
6659 * ref="#/components/responses/badrequest"
6663 * ref="#/components/responses/unauthorized"
6665 * security={{"openemr_auth":{}}}
6669 "GET /api/patient/:pid/transaction" => function ($pid) {
6670 RestConfig
::authorization_check("patients", "trans");
6671 $cont = new TransactionRestController();
6672 $return = (new TransactionRestController())->GetPatientTransactions($pid);
6673 RestConfig
::apiLog($return);
6678 * Schema for the transaction request
6681 * schema="api_transaction_request",
6683 * property="message",
6684 * description="The message of the transaction.",
6689 * description="The type of transaction. Use an option from resource=/api/transaction_type",
6693 * property="groupname",
6694 * description="The group name (usually is 'Default').",
6698 * property="referByNpi",
6699 * description="NPI of the person creating the referral.",
6703 * property="referToNpi",
6704 * description="NPI of the person getting the referral.",
6708 * property="referDiagnosis",
6709 * description="The referral diagnosis.",
6713 * property="riskLevel",
6714 * description="The risk level. (Low, Medium, High)",
6718 * property="includeVitals",
6719 * description="Are vitals included (0,1)",
6723 * property="referralDate",
6724 * description="The date of the referral",
6728 * property="authorization",
6729 * description="The authorization for the referral",
6733 * property="visits",
6734 * description="The number of vists for the referral",
6738 * property="validFrom",
6739 * description="The date the referral is valid from",
6743 * property="validThrough",
6744 * description="The date the referral is valid through",
6747 * required={"message", "groupname", "title"},
6749 * "message": "Message",
6751 * "groupname": "Default",
6752 * "referByNpi":"9999999999",
6753 * "referToNpi":"9999999999",
6754 * "referDiagnosis":"Diag 1",
6755 * "riskLevel":"Low",
6756 * "includeVitals":"1",
6757 * "referralDate":"2022-01-01",
6758 * "authorization":"Auth_123",
6760 * "validFrom": "2022-01-02",
6761 * "validThrough": "2022-01-03",
6762 * "body": "Reason 1"
6768 * path="/api/patient/{pid}/transaction",
6769 * description="Submits a transaction",
6770 * tags={"standard"},
6774 * description="The pid for the patient.",
6783 * mediaType="application/json",
6784 * @OA\Schema(ref="#/components/schemas/api_transaction_request")
6789 * ref="#/components/responses/standard"
6793 * ref="#/components/responses/badrequest"
6797 * ref="#/components/responses/unauthorized"
6799 * security={{"openemr_auth":{}}}
6802 "POST /api/patient/:pid/transaction" => function ($pid) {
6803 RestConfig
::authorization_check("patients", "trans");
6804 $data = (array) (json_decode(file_get_contents("php://input")));
6805 $return = (new TransactionRestController())->CreateTransaction($pid, $data);
6806 RestConfig
::apiLog($return, $data);
6812 * path="/api/transaction/{tid}",
6813 * description="Updates a transaction",
6814 * tags={"standard"},
6818 * description="The id for the transaction.",
6827 * mediaType="application/json",
6828 * @OA\Schema(ref="#/components/schemas/api_transaction_request")
6833 * ref="#/components/responses/standard"
6837 * ref="#/components/responses/badrequest"
6841 * ref="#/components/responses/unauthorized"
6843 * security={{"openemr_auth":{}}}
6846 "PUT /api/transaction/:tid" => function ($tid) {
6847 RestConfig
::authorization_check("patients", "trans");
6848 $data = (array) (json_decode(file_get_contents("php://input")));
6849 $return = (new TransactionRestController())->UpdateTransaction($tid, $data);
6850 RestConfig
::apiLog($return, $data);
6856 * path="/api/patient/{pid}/message/{mid}",
6857 * description="Edit a pnote message",
6858 * tags={"standard"},
6862 * description="The id for the patient.",
6871 * description="The id for the pnote message.",
6880 * mediaType="application/json",
6881 * @OA\Schema(ref="#/components/schemas/api_message_request")
6886 * ref="#/components/responses/standard"
6890 * ref="#/components/responses/badrequest"
6894 * ref="#/components/responses/unauthorized"
6896 * security={{"openemr_auth":{}}}
6899 "PUT /api/patient/:pid/message/:mid" => function ($pid, $mid) {
6900 RestConfig
::authorization_check("patients", "notes");
6901 $data = (array) (json_decode(file_get_contents("php://input")));
6902 $return = (new MessageRestController())->put($pid, $mid, $data);
6903 RestConfig
::apiLog($return, $data);
6909 * path="/api/patient/{pid}/message/{mid}",
6910 * description="Delete a pnote message",
6911 * tags={"standard"},
6915 * description="The id for the patient.",
6924 * description="The id for the pnote message.",
6932 * ref="#/components/responses/standard"
6936 * ref="#/components/responses/badrequest"
6940 * ref="#/components/responses/unauthorized"
6942 * security={{"openemr_auth":{}}}
6945 "DELETE /api/patient/:pid/message/:mid" => function ($pid, $mid) {
6946 RestConfig
::authorization_check("patients", "notes");
6947 $return = (new MessageRestController())->delete($pid, $mid);
6948 RestConfig
::apiLog($return);
6954 * path="/api/immunization",
6955 * description="Retrieves a list of immunizations",
6956 * tags={"standard"},
6958 * name="patient_id",
6960 * description="The pid for the patient.",
6969 * description="The id for the immunization.",
6978 * description="The uuid for the immunization.",
6985 * name="administered_date",
6987 * description="The administered date for the immunization.",
6994 * name="immunization_id",
6996 * description="The immunization list_id for the immunization.",
7005 * description="The cvx code for the immunization.",
7012 * name="manufacturer",
7014 * description="The manufacturer for the immunization.",
7021 * name="lot_number",
7023 * description="The lot number for the immunization.",
7030 * name="administered_by_id",
7032 * description="The administered by id for the immunization.",
7039 * name="administered_by",
7041 * description="The administered by for the immunization.",
7048 * name="education_date",
7050 * description="The education date for the immunization.",
7059 * description="The vis date for the immunization.",
7068 * description="The note for the immunization.",
7075 * name="create_date",
7077 * description="The create date for the immunization.",
7084 * name="update_date",
7086 * description="The update date for the immunization.",
7093 * name="created_by",
7095 * description="The created_by for the immunization.",
7102 * name="updated_by",
7104 * description="The updated_by for the immunization.",
7111 * name="amount_administered",
7113 * description="The amount administered for the immunization.",
7120 * name="amount_administered_unit",
7122 * description="The amount administered unit for the immunization.",
7129 * name="expiration_date",
7131 * description="The expiration date for the immunization.",
7140 * description="The route for the immunization.",
7147 * name="administration_site",
7149 * description="The administration site for the immunization.",
7156 * name="added_erroneously",
7158 * description="The added_erroneously for the immunization.",
7165 * name="external_id",
7167 * description="The external_id for the immunization.",
7174 * name="completion_status",
7176 * description="The completion status for the immunization.",
7183 * name="information_source",
7185 * description="The information source for the immunization.",
7192 * name="refusal_reason",
7194 * description="The refusal reason for the immunization.",
7201 * name="ordering_provider",
7203 * description="The ordering provider for the immunization.",
7211 * ref="#/components/responses/standard"
7215 * ref="#/components/responses/badrequest"
7219 * ref="#/components/responses/unauthorized"
7221 * security={{"openemr_auth":{}}}
7224 "GET /api/immunization" => function () {
7225 RestConfig
::authorization_check("patients", "med");
7226 $return = (new ImmunizationRestController())->getAll($_GET);
7227 RestConfig
::apiLog($return);
7233 * path="/api/immunization/{uuid}",
7234 * description="Retrieves a immunization",
7235 * tags={"standard"},
7239 * description="The uuid for the immunization.",
7247 * ref="#/components/responses/standard"
7251 * ref="#/components/responses/badrequest"
7255 * ref="#/components/responses/unauthorized"
7257 * security={{"openemr_auth":{}}}
7260 "GET /api/immunization/:uuid" => function ($uuid) {
7261 RestConfig
::authorization_check("patients", "med");
7262 $return = (new ImmunizationRestController())->getOne($uuid);
7263 RestConfig
::apiLog($return);
7269 * path="/api/procedure",
7270 * description="Retrieves a list of all procedures",
7271 * tags={"standard"},
7274 * ref="#/components/responses/standard"
7278 * ref="#/components/responses/badrequest"
7282 * ref="#/components/responses/unauthorized"
7284 * security={{"openemr_auth":{}}}
7287 "GET /api/procedure" => function () {
7288 RestConfig
::authorization_check("patients", "med");
7289 $return = (new ProcedureRestController())->getAll();
7290 RestConfig
::apiLog($return);
7296 * path="/api/procedure/{uuid}",
7297 * description="Retrieves a procedure",
7298 * tags={"standard"},
7302 * description="The uuid for the procedure.",
7310 * ref="#/components/responses/standard"
7314 * ref="#/components/responses/badrequest"
7318 * ref="#/components/responses/unauthorized"
7320 * security={{"openemr_auth":{}}}
7323 "GET /api/procedure/:uuid" => function ($uuid) {
7324 RestConfig
::authorization_check("patients", "med");
7325 $return = (new ProcedureRestController())->getOne($uuid);
7326 RestConfig
::apiLog($return);
7333 * description="Retrieves a list of all drugs",
7334 * tags={"standard"},
7337 * ref="#/components/responses/standard"
7341 * ref="#/components/responses/badrequest"
7345 * ref="#/components/responses/unauthorized"
7347 * security={{"openemr_auth":{}}}
7350 "GET /api/drug" => function () {
7351 RestConfig
::authorization_check("patients", "med");
7352 $return = (new DrugRestController())->getAll();
7353 RestConfig
::apiLog($return);
7359 * path="/api/drug/{uuid}",
7360 * description="Retrieves a drug",
7361 * tags={"standard"},
7365 * description="The uuid for the drug.",
7373 * ref="#/components/responses/standard"
7377 * ref="#/components/responses/badrequest"
7381 * ref="#/components/responses/unauthorized"
7383 * security={{"openemr_auth":{}}}
7386 "GET /api/drug/:uuid" => function ($uuid) {
7387 RestConfig
::authorization_check("patients", "med");
7388 $return = (new DrugRestController())->getOne($uuid);
7389 RestConfig
::apiLog($return);
7395 * path="/api/prescription",
7396 * description="Retrieves a list of all prescriptions",
7397 * tags={"standard"},
7400 * ref="#/components/responses/standard"
7404 * ref="#/components/responses/badrequest"
7408 * ref="#/components/responses/unauthorized"
7410 * security={{"openemr_auth":{}}}
7413 "GET /api/prescription" => function () {
7414 RestConfig
::authorization_check("patients", "med");
7415 $return = (new PrescriptionRestController())->getAll();
7416 RestConfig
::apiLog($return);
7422 * path="/api/prescription/{uuid}",
7423 * description="Retrieves a prescription",
7424 * tags={"standard"},
7428 * description="The uuid for the prescription.",
7436 * ref="#/components/responses/standard"
7440 * ref="#/components/responses/badrequest"
7444 * ref="#/components/responses/unauthorized"
7446 * security={{"openemr_auth":{}}}
7449 "GET /api/prescription/:uuid" => function ($uuid) {
7450 RestConfig
::authorization_check("patients", "med");
7451 $return = (new PrescriptionRestController())->getOne($uuid);
7452 RestConfig
::apiLog($return);
7457 use OpenEMR\Common\Http\StatusCode
;
7458 use OpenEMR\Common\Http\Psr17Factory
;
7459 use OpenEMR\RestControllers\FHIR\FhirAllergyIntoleranceRestController
;
7460 use OpenEMR\RestControllers\FHIR\FhirAppointmentRestController
;
7461 use OpenEMR\RestControllers\FHIR\FhirCarePlanRestController
;
7462 use OpenEMR\RestControllers\FHIR\FhirCareTeamRestController
;
7463 use OpenEMR\RestControllers\FHIR\FhirConditionRestController
;
7464 use OpenEMR\RestControllers\FHIR\FhirCoverageRestController
;
7465 use OpenEMR\RestControllers\FHIR\FhirDeviceRestController
;
7466 use OpenEMR\RestControllers\FHIR\FhirDiagnosticReportRestController
;
7467 use OpenEMR\RestControllers\FHIR\FhirDocumentReferenceRestController
;
7468 use OpenEMR\RestControllers\FHIR\FhirEncounterRestController
;
7469 use OpenEMR\RestControllers\FHIR\FhirObservationRestController
;
7470 use OpenEMR\RestControllers\FHIR\FhirImmunizationRestController
;
7471 use OpenEMR\RestControllers\FHIR\FhirGoalRestController
;
7472 use OpenEMR\RestControllers\FHIR\FhirGroupRestController
;
7473 use OpenEMR\RestControllers\FHIR\FhirLocationRestController
;
7474 use OpenEMR\RestControllers\FHIR\FhirMedicationRestController
;
7475 use OpenEMR\RestControllers\FHIR\FhirMedicationRequestRestController
;
7476 use OpenEMR\RestControllers\FHIR\FhirOrganizationRestController
;
7477 use OpenEMR\RestControllers\FHIR\FhirPatientRestController
;
7478 use OpenEMR\RestControllers\FHIR\FhirPersonRestController
;
7479 use OpenEMR\RestControllers\FHIR\FhirPractitionerRoleRestController
;
7480 use OpenEMR\RestControllers\FHIR\FhirPractitionerRestController
;
7481 use OpenEMR\RestControllers\FHIR\FhirProcedureRestController
;
7482 use OpenEMR\RestControllers\FHIR\FhirProvenanceRestController
;
7483 use OpenEMR\RestControllers\FHIR\FhirMetaDataRestController
;
7484 use OpenEMR\RestControllers\FHIR\Operations\FhirOperationExportRestController
;
7485 use OpenEMR\RestControllers\FHIR\Operations\FhirOperationDocRefRestController
;
7486 use OpenEMR\RestControllers\FHIR\Operations\FhirOperationDefinitionRestController
;
7488 // Note that the fhir route includes both user role and patient role
7489 // (there is a mechanism in place to ensure patient role is binded
7490 // to only see the data of the one patient)
7491 RestConfig
::$FHIR_ROUTE_MAP = array(
7494 * path="/fhir/AllergyIntolerance",
7495 * description="Returns a list of AllergyIntolerance resources.",
7500 * description="The uuid for the AllergyIntolerance resource.",
7509 * description="The uuid for the patient.",
7517 * description="Standard Response",
7519 * mediaType="application/json",
7522 * property="json object",
7523 * description="FHIR Json object.",
7528 * "lastUpdated": "2021-09-14T09:13:51"
7530 * "resourceType": "Bundle",
7531 * "type": "collection",
7535 * "relation": "self",
7536 * "url": "https://localhost:9300/apis/default/fhir/AllergyIntolerance"
7545 * ref="#/components/responses/badrequest"
7549 * ref="#/components/responses/unauthorized"
7551 * security={{"openemr_auth":{}}}
7554 "GET /fhir/AllergyIntolerance" => function (HttpRestRequest
$request) {
7555 $getParams = $request->getQueryParams();
7556 if ($request->isPatientRequest()) {
7557 // only allow access to data of binded patient
7558 $return = (new FhirAllergyIntoleranceRestController($request))->getAll($getParams, $request->getPatientUUIDString());
7560 RestConfig
::authorization_check("patients", "med");
7561 $return = (new FhirAllergyIntoleranceRestController($request))->getAll($getParams);
7563 RestConfig
::apiLog($return);
7569 * path="/fhir/AllergyIntolerance/{uuid}",
7570 * description="Returns a single AllergyIntolerance resource.",
7575 * description="The uuid for the AllergyIntolerance resource.",
7583 * description="Standard Response",
7585 * mediaType="application/json",
7588 * property="json object",
7589 * description="FHIR Json object.",
7593 * "id": "94682fe5-f383-4885-9505-64b02e34906f",
7596 * "lastUpdated": "2021-09-16T00:27:32+00:00"
7598 * "resourceType": "AllergyIntolerance",
7600 * "status": "additional",
7601 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'>penicillin</div>"
7603 * "clinicalStatus": {
7606 * "system": "http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical",
7608 * "display": "Active"
7612 * "verificationStatus": {
7615 * "system": "http://terminology.hl7.org/CodeSystem/allergyintolerance-verification",
7616 * "code": "confirmed",
7617 * "display": "Confirmed"
7624 * "criticality": "low",
7628 * "system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
7629 * "code": "unknown",
7630 * "display": "Unknown"
7635 * "reference": "Patient/94682ef5-b0e3-4289-b19a-11b9592e9c92"
7639 * "manifestation": {
7643 * "system": "http://snomed.info/sct",
7644 * "code": "422587007",
7645 * "display": "Nausea"
7659 * ref="#/components/responses/badrequest"
7663 * ref="#/components/responses/unauthorized"
7667 * ref="#/components/responses/uuidnotfound"
7669 * security={{"openemr_auth":{}}}
7672 "GET /fhir/AllergyIntolerance/:uuid" => function ($uuid, HttpRestRequest
$request) {
7673 if ($request->isPatientRequest()) {
7674 // only allow access to data of binded patient
7675 $return = (new FhirAllergyIntoleranceRestController($request))->getOne($uuid, $request->getPatientUUIDString());
7677 RestConfig
::authorization_check("patients", "med");
7678 $return = (new FhirAllergyIntoleranceRestController($request))->getOne($uuid);
7680 RestConfig
::apiLog($return);
7686 * path="/fhir/Appointment",
7687 * description="Returns a list of Appointment resources.",
7692 * description="The uuid for the Appointment resource.",
7701 * description="The uuid for the patient.",
7709 * description="Standard Response",
7711 * mediaType="application/json",
7714 * property="json object",
7715 * description="FHIR Json object.",
7720 * "lastUpdated": "2021-09-14T09:13:51"
7722 * "resourceType": "Bundle",
7723 * "type": "collection",
7727 * "relation": "self",
7728 * "url": "https://localhost:9300/apis/default/fhir/AllergyIntolerance"
7737 * ref="#/components/responses/badrequest"
7741 * ref="#/components/responses/unauthorized"
7743 * security={{"openemr_auth":{}}}
7746 "GET /fhir/Appointment" => function (HttpRestRequest
$request) {
7747 $getParams = $request->getQueryParams();
7748 if ($request->isPatientRequest()) {
7749 // only allow access to data of binded patient
7750 $return = (new FhirAppointmentRestController($request))->getAll($getParams, $request->getPatientUUIDString());
7752 RestConfig
::authorization_check("patients", "appt");
7753 $return = (new FhirAppointmentRestController($request))->getAll($getParams);
7755 RestConfig
::apiLog($return);
7761 * path="/fhir/Appointment/{uuid}",
7762 * description="Returns a single Appointment resource.",
7767 * description="The uuid for the Appointment resource.",
7775 * description="Standard Response",
7777 * mediaType="application/json",
7780 * property="json object",
7781 * description="FHIR Json object.",
7790 * ref="#/components/responses/badrequest"
7794 * ref="#/components/responses/unauthorized"
7798 * ref="#/components/responses/uuidnotfound"
7800 * security={{"openemr_auth":{}}}
7803 "GET /fhir/Appointment/:uuid" => function ($uuid, HttpRestRequest
$request) {
7804 if ($request->isPatientRequest()) {
7805 // only allow access to data of binded patient
7806 $return = (new FhirAppointmentRestController($request))->getOne($uuid, $request->getPatientUUIDString());
7808 RestConfig
::authorization_check("patients", "appt");
7809 $return = (new FhirAppointmentRestController($request))->getOne($uuid);
7811 RestConfig
::apiLog($return);
7817 * path="/fhir/CarePlan",
7818 * description="Returns a list of CarePlan resources.",
7823 * description="The uuid for the CarePlan resource.",
7832 * description="The uuid for the patient.",
7841 * description="The category of the CarePlan resource.",
7849 * description="Standard Response",
7851 * mediaType="application/json",
7854 * property="json object",
7855 * description="FHIR Json object.",
7860 * "lastUpdated": "2021-09-14T09:13:51"
7862 * "resourceType": "Bundle",
7863 * "type": "collection",
7867 * "relation": "self",
7868 * "url": "https://localhost:9300/apis/default/fhir/CarePlan"
7877 * ref="#/components/responses/badrequest"
7881 * ref="#/components/responses/unauthorized"
7883 * security={{"openemr_auth":{}}}
7886 "GET /fhir/CarePlan" => function (HttpRestRequest
$request) {
7887 $getParams = $request->getQueryParams();
7888 if ($request->isPatientRequest()) {
7889 // only allow access to data of binded patient
7890 $return = (new FhirCarePlanRestController())->getAll($getParams, $request->getPatientUUIDString());
7892 RestConfig
::authorization_check("patients", "med");
7893 $return = (new FhirCarePlanRestController())->getAll($getParams);
7895 RestConfig
::apiLog($return);
7901 * path="/fhir/CarePlan/{uuid}",
7902 * description="Returns a single CarePlan resource.",
7907 * description="The uuid for the CarePlan resource.",
7915 * description="Standard Response",
7917 * mediaType="application/json",
7920 * property="json object",
7921 * description="FHIR Json object.",
7925 * "id": "94682f08-8fbc-451e-b1ec-f922d765c38f_1",
7928 * "lastUpdated": "2021-09-16T00:54:18+00:00"
7930 * "resourceType": "CarePlan",
7932 * "status": "generated",
7933 * "div": "<div xmlns=""http://www.w3.org/1999/xhtml""><p>Treat flu.</p></div>"
7935 * "status": "active",
7941 * "system": "http://hl7.org/fhir/us/core/CodeSystem/careplan-category",
7942 * "code": "assess-plan"
7947 * "description": "Treat flu.",
7949 * "reference": "Patient/94682ef5-b0e3-4289-b19a-11b9592e9c92",
7958 * ref="#/components/responses/badrequest"
7962 * ref="#/components/responses/unauthorized"
7966 * ref="#/components/responses/uuidnotfound"
7968 * security={{"openemr_auth":{}}}
7971 "GET /fhir/CarePlan/:uuid" => function ($uuid, HttpRestRequest
$request) {
7972 if ($request->isPatientRequest()) {
7973 // only allow access to data of binded patient
7974 $return = (new FhirCarePlanRestController())->getOne($uuid, $request->getPatientUUIDString());
7976 RestConfig
::authorization_check("patients", "med");
7977 $return = (new FhirCarePlanRestController())->getOne($uuid);
7979 RestConfig
::apiLog($return);
7985 * path="/fhir/CareTeam",
7986 * description="Returns a list of CareTeam resources.",
7991 * description="The uuid for the CareTeam resource.",
8000 * description="The uuid for the patient.",
8009 * description="The status of the CarePlan resource.",
8017 * description="Standard Response",
8019 * mediaType="application/json",
8022 * property="json object",
8023 * description="FHIR Json object.",
8028 * "lastUpdated": "2021-09-14T09:13:51"
8030 * "resourceType": "Bundle",
8031 * "type": "collection",
8035 * "relation": "self",
8036 * "url": "https://localhost:9300/apis/default/fhir/CareTeam"
8045 * ref="#/components/responses/badrequest"
8049 * ref="#/components/responses/unauthorized"
8051 * security={{"openemr_auth":{}}}
8054 "GET /fhir/CareTeam" => function (HttpRestRequest
$request) {
8055 $getParams = $request->getQueryParams();
8056 if ($request->isPatientRequest()) {
8057 // only allow access to data of binded patient
8058 $return = (new FhirCareTeamRestController())->getAll($getParams, $request->getPatientUUIDString());
8060 RestConfig
::authorization_check("patients", "med");
8061 $return = (new FhirCareTeamRestController())->getAll($getParams);
8063 RestConfig
::apiLog($return);
8069 * path="/fhir/CareTeam/{uuid}",
8070 * description="Returns a single CareTeam resource.",
8075 * description="The uuid for the CareTeam resource.",
8083 * description="Standard Response",
8085 * mediaType="application/json",
8088 * property="json object",
8089 * description="FHIR Json object.",
8093 * "id": "94682f09-69fe-4ada-8ea6-753a52bd1516",
8096 * "lastUpdated": "2021-09-16T01:07:22+00:00"
8098 * "resourceType": "CareTeam",
8099 * "status": "active",
8101 * "reference": "Patient/94682ef5-b0e3-4289-b19a-11b9592e9c92",
8110 * "system": "http://nucc.org/provider-taxonomy",
8111 * "code": "102L00000X",
8112 * "display": "Psychoanalyst"
8118 * "reference": "Practitioner/94682c68-f712-4c39-9158-ff132a08f26b",
8119 * "type": "Practitioner"
8122 * "reference": "Organization/94682c62-b801-4498-84a1-13f158bb2a18",
8123 * "type": "Organization"
8131 * "system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
8132 * "code": "unknown",
8133 * "display": "Unknown"
8139 * "reference": "Organization/94682c62-b801-4498-84a1-13f158bb2a18",
8140 * "type": "Organization"
8150 * ref="#/components/responses/badrequest"
8154 * ref="#/components/responses/unauthorized"
8158 * ref="#/components/responses/uuidnotfound"
8160 * security={{"openemr_auth":{}}}
8163 "GET /fhir/CareTeam/:uuid" => function ($uuid, HttpRestRequest
$request) {
8164 if ($request->isPatientRequest()) {
8165 // only allow access to data of binded patient
8166 $return = (new FhirCareTeamRestController())->getOne($uuid, $request->getPatientUUIDString());
8168 RestConfig
::authorization_check("patients", "med");
8169 $return = (new FhirCareTeamRestController())->getOne($uuid);
8171 RestConfig
::apiLog($return);
8177 * path="/fhir/Condition",
8178 * description="Returns a list of Condition resources.",
8183 * description="The uuid for the Condition resource.",
8192 * description="The uuid for the patient.",
8200 * description="Standard Response",
8202 * mediaType="application/json",
8205 * property="json object",
8206 * description="FHIR Json object.",
8211 * "lastUpdated": "2021-09-14T09:13:51"
8213 * "resourceType": "Bundle",
8214 * "type": "collection",
8218 * "relation": "self",
8219 * "url": "https://localhost:9300/apis/default/fhir/Condition"
8228 * ref="#/components/responses/badrequest"
8232 * ref="#/components/responses/unauthorized"
8234 * security={{"openemr_auth":{}}}
8237 "GET /fhir/Condition" => function (HttpRestRequest
$request) {
8238 $getParams = $request->getQueryParams();
8239 if ($request->isPatientRequest()) {
8240 // only allow access to data of binded patient
8241 $return = (new FhirConditionRestController())->getAll($getParams, $request->getPatientUUIDString());
8243 RestConfig
::authorization_check("patients", "med");
8244 $return = (new FhirConditionRestController())->getAll($getParams);
8246 RestConfig
::apiLog($return);
8252 * path="/fhir/Condition/{uuid}",
8253 * description="Returns a single Condition resource.",
8258 * description="The uuid for the Condition resource.",
8266 * description="Standard Response",
8268 * mediaType="application/json",
8271 * property="json object",
8272 * description="FHIR Json object.",
8276 * "id": "94682c68-e5bb-4c5c-859a-cebaa5a1e582",
8279 * "lastUpdated": "2021-09-16T02:41:53+00:00"
8281 * "resourceType": "Condition",
8282 * "clinicalStatus": {
8285 * "system": "http://terminology.hl7.org/CodeSystem/condition-clinical",
8286 * "code": "inactive",
8287 * "display": "Inactive"
8291 * "verificationStatus": {
8294 * "system": "http://terminology.hl7.org/CodeSystem/condition-ver-status",
8295 * "code": "unconfirmed",
8296 * "display": "Unconfirmed"
8304 * "system": "http://terminology.hl7.org/CodeSystem/condition-category",
8305 * "code": "problem-list-item",
8306 * "display": "Problem List Item"
8314 * "system": "http://snomed.info/sct",
8315 * "code": "444814009",
8321 * "reference": "Patient/94682c62-d37e-48b5-8018-c5f6f3566609"
8329 * ref="#/components/responses/badrequest"
8333 * ref="#/components/responses/unauthorized"
8337 * ref="#/components/responses/uuidnotfound"
8339 * security={{"openemr_auth":{}}}
8342 "GET /fhir/Condition/:uuid" => function ($uuid, HttpRestRequest
$request) {
8343 if ($request->isPatientRequest()) {
8344 // only allow access to data of binded patient
8345 $return = (new FhirConditionRestController())->getOne($uuid, $request->getPatientUUIDString());
8347 RestConfig
::authorization_check("patients", "med");
8348 $return = (new FhirConditionRestController())->getOne($uuid);
8350 RestConfig
::apiLog($return);
8356 * path="/fhir/Coverage",
8357 * description="Returns a list of Coverage resources.",
8362 * description="The uuid for the Coverage resource.",
8371 * description="The uuid for the patient.",
8380 * description="The payor of the Coverage resource.",
8388 * description="Standard Response",
8390 * mediaType="application/json",
8393 * property="json object",
8394 * description="FHIR Json object.",
8399 * "lastUpdated": "2021-09-14T09:13:51"
8401 * "resourceType": "Bundle",
8402 * "type": "collection",
8406 * "relation": "self",
8407 * "url": "https://localhost:9300/apis/default/fhir/Coverage"
8416 * ref="#/components/responses/badrequest"
8420 * ref="#/components/responses/unauthorized"
8422 * security={{"openemr_auth":{}}}
8425 "GET /fhir/Coverage" => function (HttpRestRequest
$request) {
8426 if ($request->isPatientRequest()) {
8427 // only allow access to data of binded patient
8428 $return = (new FhirCoverageRestController())->getAll($request->getQueryParams(), $request->getPatientUUIDString());
8430 RestConfig
::authorization_check("admin", "super");
8431 $return = (new FhirCoverageRestController())->getAll($request->getQueryParams());
8433 RestConfig
::apiLog($return);
8439 * path="/fhir/Coverage/{uuid}",
8440 * description="Returns a single Coverage resource.",
8445 * description="The uuid for the Coverage resource.",
8453 * description="Standard Response",
8455 * mediaType="application/json",
8458 * property="json object",
8459 * description="FHIR Json object.",
8463 * "id": "960d5f10-edc6-4c65-a6d4-39a1e1da87a8",
8466 * "lastUpdated": "2022-04-14T07:58:45+00:00"
8468 * "resourceType": "Coverage",
8469 * "status": "active",
8471 * "reference": "Patient/960d5f08-9fdf-4bdc-9108-84a149e28bac"
8476 * "system": "http://terminology.hl7.org/CodeSystem/subscriber-relationship",
8487 * ref="#/components/responses/badrequest"
8491 * ref="#/components/responses/unauthorized"
8495 * ref="#/components/responses/uuidnotfound"
8497 * security={{"openemr_auth":{}}}
8500 "GET /fhir/Coverage/:uuid" => function ($uuid, HttpRestRequest
$request) {
8501 if ($request->isPatientRequest()) {
8502 // only allow access to data of binded patient
8503 $return = (new FhirCoverageRestController())->getOne($uuid, $request->getPatientUUIDString());
8505 RestConfig
::authorization_check("admin", "super");
8506 $return = (new FhirCoverageRestController())->getOne($uuid);
8508 RestConfig
::apiLog($return);
8514 * path="/fhir/Device",
8515 * description="Returns a list of Device resources.",
8520 * description="The uuid for the Device resource.",
8529 * description="The uuid for the patient.",
8537 * description="Standard Response",
8539 * mediaType="application/json",
8542 * property="json object",
8543 * description="FHIR Json object.",
8548 * "lastUpdated": "2021-09-14T09:13:51"
8550 * "resourceType": "Bundle",
8551 * "type": "collection",
8555 * "relation": "self",
8556 * "url": "https://localhost:9300/apis/default/fhir/Device"
8565 * ref="#/components/responses/badrequest"
8569 * ref="#/components/responses/unauthorized"
8571 * security={{"openemr_auth":{}}}
8574 "GET /fhir/Device" => function (HttpRestRequest
$request) {
8575 if ($request->isPatientRequest()) {
8576 // only allow access to data of binded patient
8577 $return = (new FhirDeviceRestController())->getAll($request->getQueryParams(), $request->getPatientUUIDString());
8579 RestConfig
::authorization_check("admin", "super");
8580 $return = (new FhirDeviceRestController())->getAll($request->getQueryParams());
8582 RestConfig
::apiLog($return);
8588 * path="/fhir/Device/{uuid}",
8589 * description="Returns a single Device resource.",
8594 * description="The uuid for the Device resource.",
8602 * description="Standard Response",
8604 * mediaType="application/json",
8607 * property="json object",
8608 * description="FHIR Json object.",
8612 * "id": "946dce19-c80a-402c-862a-eadf3f2377f0",
8615 * "lastUpdated": "2021-09-18T19:28:59+00:00"
8617 * "resourceType": "Device",
8620 * "deviceIdentifier": "08717648200274",
8621 * "carrierHRF": "=/08717648200274=,000025=A99971312345600=>014032=}013032&,1000000000000XYZ123"
8624 * "distinctIdentifier": "A99971312345600",
8625 * "manufactureDate": "2013-02-01",
8626 * "expirationDate": "2014-02-01",
8627 * "lotNumber": "000000000000XYZ123",
8628 * "serialNumber": "000025",
8632 * "valueCode": "unknown",
8633 * "url": "http://hl7.org/fhir/StructureDefinition/data-absent-reason"
8638 * "reference": "Patient/946da619-c631-431a-a282-487cd6fb7802",
8647 * ref="#/components/responses/badrequest"
8651 * ref="#/components/responses/unauthorized"
8655 * ref="#/components/responses/uuidnotfound"
8657 * security={{"openemr_auth":{}}}
8660 "GET /fhir/Device/:uuid" => function ($uuid, HttpRestRequest
$request) {
8661 if ($request->isPatientRequest()) {
8662 // only allow access to data of binded patient
8663 $return = (new FhirDeviceRestController())->getOne($uuid, $request->getPatientUUIDString());
8665 RestConfig
::authorization_check("admin", "super");
8666 $return = (new FhirDeviceRestController())->getOne($uuid);
8668 RestConfig
::apiLog($return);
8674 * path="/fhir/DiagnosticReport",
8675 * description="Returns a list of DiagnosticReport resources.",
8680 * description="The uuid for the DiagnosticReport resource.",
8689 * description="The uuid for the patient.",
8698 * description="The code of the DiagnosticReport resource.",
8707 * description="The category of the DiagnosticReport resource.",
8716 * description="The datetime of the DiagnosticReport resource.",
8724 * description="Standard Response",
8726 * mediaType="application/json",
8729 * property="json object",
8730 * description="FHIR Json object.",
8735 * "lastUpdated": "2021-09-14T09:13:51"
8737 * "resourceType": "Bundle",
8738 * "type": "collection",
8742 * "relation": "self",
8743 * "url": "https://localhost:9300/apis/default/fhir/DiagnosticReport"
8752 * ref="#/components/responses/badrequest"
8756 * ref="#/components/responses/unauthorized"
8758 * security={{"openemr_auth":{}}}
8761 "GET /fhir/DiagnosticReport" => function (HttpRestRequest
$request) {
8762 $getParams = $request->getQueryParams();
8763 if ($request->isPatientRequest()) {
8764 // only allow access to data of binded patient
8765 $return = (new FhirDiagnosticReportRestController())->getAll($getParams, $request->getPatientUUIDString());
8767 RestConfig
::authorization_check("admin", "super");
8768 $return = (new FhirDiagnosticReportRestController())->getAll($getParams);
8770 RestConfig
::apiLog($return);
8776 * path="/fhir/DiagnosticReport/{uuid}",
8777 * description="Returns a single DiagnosticReport resource.",
8782 * description="The uuid for the DiagnosticReport resource.",
8790 * description="Standard Response",
8792 * mediaType="application/json",
8795 * property="json object",
8796 * description="FHIR Json object.",
8800 * "id": "93fb2d6a-77ac-48ca-a12d-1a17e40007e3",
8803 * "lastUpdated": "2021-09-18T20:52:34+00:00"
8805 * "resourceType": "DiagnosticReport",
8806 * "status": "final",
8811 * "system": "http://loinc.org",
8812 * "code": "LP7839-6",
8813 * "display": "Pathology"
8821 * "system": "http://loinc.org",
8822 * "code": "11502-2",
8823 * "display": "Laboratory report"
8828 * "reference": "Patient/9353b8f5-0a87-4e2a-afd4-25341fdb0fbc",
8832 * "reference": "Encounter/93540818-cb5f-49df-b73b-83901bb793b6",
8833 * "type": "Encounter"
8835 * "effectiveDateTime": "2015-06-22T00:00:00+00:00",
8836 * "issued": "2015-06-22T00:00:00+00:00",
8839 * "reference": "Organization/935249b5-0ba6-4b5b-8863-a7a27d4c6350",
8840 * "type": "Organization"
8843 * "presentedForm": {
8845 * "contentType": "text/plain",
8846 * "data": "TXMgQWxpY2UgTmV3bWFuIHdhcyB0ZXN0ZWQgZm9yIHRoZSBVcmluYW5hbHlzaXMgbWFjcm8gcGFuZWwgYW5kIHRoZSByZXN1bHRzIGhhdmUgYmVlbiBmb3VuZCB0byBiZSANCm5vcm1hbC4="
8855 * ref="#/components/responses/badrequest"
8859 * ref="#/components/responses/unauthorized"
8863 * ref="#/components/responses/uuidnotfound"
8865 * security={{"openemr_auth":{}}}
8868 "GET /fhir/DiagnosticReport/:uuid" => function ($uuid, HttpRestRequest
$request) {
8869 $getParams = $request->getQueryParams();
8870 if ($request->isPatientRequest()) {
8871 // only allow access to data of binded patient
8872 $return = (new FhirDiagnosticReportRestController())->getOne($uuid, $request->getPatientUUIDString());
8874 RestConfig
::authorization_check("admin", "super");
8875 $return = (new FhirDiagnosticReportRestController())->getOne($uuid);
8877 RestConfig
::apiLog($return);
8883 * path="/fhir/DocumentReference",
8884 * description="Returns a list of DocumentReference resources.",
8889 * description="The uuid for the DocumentReference resource.",
8898 * description="The uuid for the patient.",
8907 * description="The type of the DocumentReference resource.",
8916 * description="The category of the DocumentReference resource.",
8925 * description="The datetime of the DocumentReference resource.",
8933 * description="Standard Response",
8935 * mediaType="application/json",
8938 * property="json object",
8939 * description="FHIR Json object.",
8944 * "lastUpdated": "2021-09-14T09:13:51"
8946 * "resourceType": "Bundle",
8947 * "type": "collection",
8951 * "relation": "self",
8952 * "url": "https://localhost:9300/apis/default/fhir/DocumentReference"
8961 * ref="#/components/responses/badrequest"
8965 * ref="#/components/responses/unauthorized"
8967 * security={{"openemr_auth":{}}}
8970 'GET /fhir/DocumentReference' => function (HttpRestRequest
$request) {
8971 $getParams = $request->getQueryParams();
8972 if ($request->isPatientRequest()) {
8973 // only allow access to data of binded patient
8974 $return = (new FhirDocumentReferenceRestController($request))->getAll($getParams, $request->getPatientUUIDString());
8976 RestConfig
::authorization_check("admin", "super");
8977 $return = (new FhirDocumentReferenceRestController($request))->getAll($getParams);
8979 RestConfig
::apiLog($return);
8985 * path="/fhir/DocumentReference/$docref",
8986 * 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.",
8988 * @OA\ExternalDocumentation(description="Detailed documentation on this operation", url="https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API"),
8992 * description="The uuid for the patient.",
9001 * 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.",
9010 * 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.",
9019 * 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).",
9027 * description="A search bundle of DocumentReferences is returned"
9031 * ref="#/components/responses/badrequest"
9035 * ref="#/components/responses/unauthorized"
9037 * security={{"openemr_auth":{}}}
9040 'POST /fhir/DocumentReference/$docref' => function (HttpRestRequest
$request) {
9042 // NOTE: The order of this route is IMPORTANT as it needs to come before the DocumentReference single request.
9043 if ($request->isPatientRequest()) {
9044 // only allow access to data of binded patient
9045 $return = (new FhirOperationDocRefRestController($request))->getAll($request->getQueryParams(), $request->getPatientUUIDString());
9047 // TODO: it seems like regular users should be able to grab authorship / provenance information
9048 RestConfig
::authorization_check("patients", "demo");
9049 $return = (new FhirOperationDocRefRestController($request))->getAll($request->getQueryParams());
9051 RestConfig
::apiLog($return);
9057 * path="/fhir/DocumentReference/{uuid}",
9058 * description="Returns a single DocumentReference resource.",
9063 * description="The uuid for the DocumentReference resource.",
9071 * description="Standard Response",
9073 * mediaType="application/json",
9076 * property="json object",
9077 * description="FHIR Json object.",
9081 * "id": "946e7553-1aaa-49f8-8f81-ae15ccaa9165",
9084 * "lastUpdated": "2021-09-19T03:17:51+00:00"
9086 * "resourceType": "DocumentReference",
9089 * "value": "946e7553-1aaa-49f8-8f81-ae15ccaa9165"
9092 * "status": "current",
9096 * "system": "http://terminology.hl7.org/CodeSystem/v3-NullFlavor",
9098 * "display": "unknown"
9106 * "system": "https://localhost:9300/apis/default/fhir/ValueSet/openemr-document-types",
9107 * "code": "openemr-document",
9108 * "display": "OpenEMR Document"
9114 * "reference": "Patient/946da619-c631-431a-a282-487cd6fb7802",
9117 * "date": "2021-09-19T03:15:56+00:00",
9124 * "contentType": "image/gif",
9125 * "url": "https://localhost:9300/apis/default/fhir/Binary/7"
9128 * "system": "http://ihe.net/fhir/ValueSet/IHE.FormatCode.codesystem",
9129 * "code": "urn:ihe:iti:xds:2017:mimeTypeSufficient",
9130 * "display": "mimeType Sufficient"
9140 * ref="#/components/responses/badrequest"
9144 * ref="#/components/responses/unauthorized"
9148 * ref="#/components/responses/uuidnotfound"
9150 * security={{"openemr_auth":{}}}
9153 "GET /fhir/DocumentReference/:uuid" => function ($uuid, HttpRestRequest
$request) {
9154 $getParams = $request->getQueryParams();
9155 if ($request->isPatientRequest()) {
9156 // only allow access to data of binded patient
9157 $return = (new FhirDocumentReferenceRestController($request))->getOne($uuid, $request->getPatientUUIDString());
9159 RestConfig
::authorization_check("admin", "super");
9160 $return = (new FhirDocumentReferenceRestController($request))->getOne($uuid);
9162 RestConfig
::apiLog($return);
9168 * path="/fhir/Binary/{id}",
9169 * 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>",
9174 * description="The id for the Document.",
9182 * description="The documentation for working with BULK FHIR or $docref document exports can be found at <a href='https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API' target='_blank' rel='noopener'>https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API</a>"
9186 * ref="#/components/responses/badrequest"
9190 * ref="#/components/responses/unauthorized"
9192 * security={{"openemr_auth":{}}}
9195 'GET /fhir/Binary/:id' => function ($documentId, HttpRestRequest
$request) {
9196 $docController = new \OpenEMR\RestControllers\FHIR\
FhirDocumentRestController($request);
9198 if ($request->isPatientRequest()) {
9199 $response = $docController->downloadDocument($documentId, $request->getPatientUUIDString());
9201 RestConfig
::authorization_check("admin", "users");
9202 $response = $docController->downloadDocument($documentId);
9210 * path="/fhir/Encounter",
9211 * description="Returns a list of Encounter resources.",
9216 * description="The uuid for the Encounter resource.",
9225 * description="The uuid for the patient.",
9234 * description="The datetime of the Encounter resource.",
9242 * description="Standard Response",
9244 * mediaType="application/json",
9247 * property="json object",
9248 * description="FHIR Json object.",
9253 * "lastUpdated": "2021-09-14T09:13:51"
9255 * "resourceType": "Bundle",
9256 * "type": "collection",
9260 * "relation": "self",
9261 * "url": "https://localhost:9300/apis/default/fhir/Encounter"
9270 * ref="#/components/responses/badrequest"
9274 * ref="#/components/responses/unauthorized"
9276 * security={{"openemr_auth":{}}}
9279 "GET /fhir/Encounter" => function (HttpRestRequest
$request) {
9280 $getParams = $request->getQueryParams();
9281 if ($request->isPatientRequest()) {
9282 // only allow access to data of binded patient
9283 $return = (new FhirEncounterRestController())->getAll($getParams, $request->getPatientUUIDString());
9285 RestConfig
::authorization_check("encounters", "auth_a");
9286 $return = (new FhirEncounterRestController())->getAll($getParams);
9288 RestConfig
::apiLog($return);
9294 * path="/fhir/Encounter/{uuid}",
9295 * description="Returns a single Encounter resource.",
9300 * description="The uuid for the Encounter resource.",
9308 * description="Standard Response",
9310 * mediaType="application/json",
9313 * property="json object",
9314 * description="FHIR Json object.",
9318 * "id": "946da61d-6b95-4f8e-abe5-534a25913b71",
9321 * "lastUpdated": "2021-09-19T06:27:41+00:00"
9323 * "resourceType": "Encounter",
9326 * "system": "urn:ietf:rfc:3986",
9327 * "value": "946da61d-6b95-4f8e-abe5-534a25913b71"
9330 * "status": "finished",
9332 * "system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
9334 * "display": "ambulatory"
9340 * "system": "http://snomed.info/sct",
9341 * "code": "185349003",
9342 * "display": "Encounter for check up (procedure)"
9348 * "reference": "Patient/946da61b-626b-4f88-81e2-adfb88f4f0fe",
9357 * "system": "http://terminology.hl7.org/CodeSystem/v3-ParticipationType",
9359 * "display": "Primary Performer"
9365 * "start": "2012-08-13T00:00:00+00:00"
9368 * "reference": "Practitioner/946da61d-ac5f-4fdc-b3f2-7b58dc49976b",
9369 * "type": "Practitioner"
9374 * "start": "2012-08-13T00:00:00+00:00"
9382 * ref="#/components/responses/badrequest"
9386 * ref="#/components/responses/unauthorized"
9390 * ref="#/components/responses/uuidnotfound"
9392 * security={{"openemr_auth":{}}}
9395 "GET /fhir/Encounter/:uuid" => function ($uuid, HttpRestRequest
$request) {
9396 if ($request->isPatientRequest()) {
9397 // only allow access to data of binded patient
9398 $return = (new FhirEncounterRestController())->getOne($uuid, $request->getPatientUUIDString());
9400 RestConfig
::authorization_check("admin", "super");
9401 $return = (new FhirEncounterRestController())->getOne($uuid);
9403 RestConfig
::apiLog($return);
9409 * path="/fhir/Goal",
9410 * description="Returns a list of Condition resources.",
9415 * description="The uuid for the Goal resource.",
9424 * description="The uuid for the patient.",
9432 * description="Standard Response",
9434 * mediaType="application/json",
9437 * property="json object",
9438 * description="FHIR Json object.",
9443 * "lastUpdated": "2021-09-14T09:13:51"
9445 * "resourceType": "Bundle",
9446 * "type": "collection",
9450 * "relation": "self",
9451 * "url": "https://localhost:9300/apis/default/fhir/Goal"
9460 * ref="#/components/responses/badrequest"
9464 * ref="#/components/responses/unauthorized"
9466 * security={{"openemr_auth":{}}}
9469 "GET /fhir/Goal" => function (HttpRestRequest
$request) {
9470 $getParams = $request->getQueryParams();
9471 if ($request->isPatientRequest()) {
9472 // only allow access to data of binded patient
9473 $return = (new FhirGoalRestController())->getAll($getParams, $request->getPatientUUIDString());
9475 RestConfig
::authorization_check("admin", "super");
9476 $return = (new FhirGoalRestController())->getAll($getParams);
9478 RestConfig
::apiLog($return);
9484 * path="/fhir/Goal/{uuid}",
9485 * description="Returns a single Goal resource.",
9490 * description="The uuid for the Goal resource.",
9498 * description="Standard Response",
9500 * mediaType="application/json",
9503 * property="json object",
9504 * description="FHIR Json object.",
9508 * "id": "946da61d-6b88-4d54-bdd6-4029e2ad9e3f_1",
9511 * "lastUpdated": "2021-09-19T06:45:58+00:00"
9513 * "resourceType": "Goal",
9514 * "lifecycleStatus": "active",
9516 * "text": "Eating more vegetables."
9519 * "reference": "Patient/946da619-c631-431a-a282-487cd6fb7802",
9527 * "valueCode": "unknown",
9528 * "url": "http://hl7.org/fhir/StructureDefinition/data-absent-reason"
9532 * "detailString": "Eating more vegetables.",
9533 * "dueDate": "2021-09-09"
9542 * ref="#/components/responses/badrequest"
9546 * ref="#/components/responses/unauthorized"
9550 * ref="#/components/responses/uuidnotfound"
9552 * security={{"openemr_auth":{}}}
9555 "GET /fhir/Goal/:uuid" => function ($uuid, HttpRestRequest
$request) {
9556 if ($request->isPatientRequest()) {
9557 // only allow access to data of binded patient
9558 $return = (new FhirGoalRestController())->getOne($uuid, $request->getPatientUUIDString());
9560 RestConfig
::authorization_check("admin", "super");
9561 $return = (new FhirGoalRestController())->getOne($uuid);
9563 RestConfig
::apiLog($return);
9569 * path="/fhir/Group",
9570 * 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>",
9575 * description="The uuid for the Group resource.",
9584 * description="The uuid for the patient.",
9592 * description="Standard Response",
9594 * mediaType="application/json",
9597 * property="json object",
9598 * description="FHIR Json object.",
9603 * "lastUpdated": "2021-09-14T09:13:51"
9605 * "resourceType": "Bundle",
9606 * "type": "collection",
9610 * "relation": "self",
9611 * "url": "https://localhost:9300/apis/default/fhir/Group"
9620 * ref="#/components/responses/badrequest"
9624 * ref="#/components/responses/unauthorized"
9626 * security={{"openemr_auth":{}}}
9629 'GET /fhir/Group' => function (HttpRestRequest
$request) {
9630 RestConfig
::authorization_check("admin", "users");
9631 $getParams = $request->getQueryParams();
9632 if ($request->isPatientRequest()) {
9633 // only allow access to data of binded patient
9634 $return = (new FhirGroupRestController())->getAll($getParams, $request->getPatientUUIDString());
9636 $return = (new FhirGroupRestController())->getAll($getParams);
9638 RestConfig
::apiLog($return);
9644 * path="/fhir/Group/{uuid}",
9645 * 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>",
9650 * description="The uuid for the Group resource.",
9658 * description="The BULK FHIR Exports documentation can be found at <a href='https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API' target='_blank' rel='noopener'>https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API</a>"
9662 * ref="#/components/responses/badrequest"
9666 * ref="#/components/responses/unauthorized"
9670 * ref="#/components/responses/uuidnotfound"
9672 * security={{"openemr_auth":{}}}
9675 "GET /fhir/Group/:uuid" => function ($uuid, HttpRestRequest
$request) {
9676 RestConfig
::authorization_check("admin", "users");
9677 if ($request->isPatientRequest()) {
9678 // only allow access to data of binded patient
9679 $return = (new FhirGroupRestController())->getOne($uuid, $request->getPatientUUIDString());
9681 $return = (new FhirGroupRestController())->getOne($uuid);
9683 RestConfig
::apiLog($return);
9689 * path="/fhir/Group/{id}/$export",
9690 * description="The BULK FHIR Exports documentation can be found at <a href='https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API' target='_blank' rel='noopener'>https://www.open-emr.org/wiki/index.php/OpenEMR_Wiki_Home_Page#API</a>",
9694 * 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>"
9698 * ref="#/components/responses/badrequest"
9702 * ref="#/components/responses/unauthorized"
9704 * security={{"openemr_auth":{}}}
9707 'GET /fhir/Group/:id/$export' => function ($groupId, HttpRestRequest
$request) {
9708 RestConfig
::authorization_check("admin", "users");
9709 $fhirExportService = new FhirOperationExportRestController($request);
9710 $exportParams = $request->getQueryParams();
9711 $exportParams['groupId'] = $groupId;
9712 $return = $fhirExportService->processExport(
9715 $request->getHeader('Accept')[0] ??
'',
9716 $request->getHeader('Prefer')[0] ??
''
9718 RestConfig
::apiLog($return);
9724 * path="/fhir/Immunization",
9725 * description="Returns a list of Immunization resources.",
9730 * description="The uuid for the Immunization resource.",
9739 * description="The uuid for the patient.",
9747 * description="Standard Response",
9749 * mediaType="application/json",
9752 * property="json object",
9753 * description="FHIR Json object.",
9758 * "lastUpdated": "2021-09-14T09:13:51"
9760 * "resourceType": "Bundle",
9761 * "type": "collection",
9765 * "relation": "self",
9766 * "url": "https://localhost:9300/apis/default/fhir/Immunization"
9775 * ref="#/components/responses/badrequest"
9779 * ref="#/components/responses/unauthorized"
9781 * security={{"openemr_auth":{}}}
9784 "GET /fhir/Immunization" => function (HttpRestRequest
$request) {
9785 $getParams = $request->getQueryParams();
9786 if ($request->isPatientRequest()) {
9787 // only allow access to data of binded patient
9788 $return = (new FhirImmunizationRestController())->getAll($getParams, $request->getPatientUUIDString());
9790 RestConfig
::authorization_check("patients", "med");
9791 $return = (new FhirImmunizationRestController())->getAll($getParams);
9793 RestConfig
::apiLog($return);
9799 * path="/fhir/Immunization/{uuid}",
9800 * description="Returns a single Immunization resource.",
9805 * description="The uuid for the Immunization resource.",
9813 * description="Standard Response",
9815 * mediaType="application/json",
9818 * property="json object",
9819 * description="FHIR Json object.",
9823 * "id": "95e8d8b7-e3e2-4e03-8eb1-31e1d9097d8f",
9826 * "lastUpdated": "2022-03-26T05:42:59+00:00"
9828 * "resourceType": "Immunization",
9829 * "status": "completed",
9833 * "system": "http://hl7.org/fhir/sid/cvx",
9835 * "display": "SARS-COV-2 (COVID-19) vaccine, mRNA, spike protein, LNP, preservative free, 100 mcg/0.5mL dose"
9840 * "reference": "Patient/95e8d830-3068-48cf-930a-2fefb18c2bcf"
9842 * "occurrenceDateTime": "2022-03-26T05:35:00+00:00",
9843 * "recorded": "2022-03-26T05:42:26+00:00",
9844 * "primarySource": false
9851 * ref="#/components/responses/badrequest"
9855 * ref="#/components/responses/unauthorized"
9859 * ref="#/components/responses/uuidnotfound"
9861 * security={{"openemr_auth":{}}}
9864 "GET /fhir/Immunization/:uuid" => function ($uuid, HttpRestRequest
$request) {
9865 if ($request->isPatientRequest()) {
9866 // only allow access to data of binded patient
9867 $return = (new FhirImmunizationRestController())->getOne($uuid, $request->getPatientUUIDString());
9869 RestConfig
::authorization_check("patients", "med");
9870 $return = (new FhirImmunizationRestController())->getOne($uuid);
9872 RestConfig
::apiLog($return);
9878 * path="/fhir/Location",
9879 * description="Returns a list of Location resources.",
9884 * description="The uuid for the Location resource.",
9892 * description="Standard Response",
9894 * mediaType="application/json",
9897 * property="json object",
9898 * description="FHIR Json object.",
9903 * "lastUpdated": "2021-09-14T09:13:51"
9905 * "resourceType": "Bundle",
9906 * "type": "collection",
9910 * "relation": "self",
9911 * "url": "https://localhost:9300/apis/default/fhir/Location"
9920 * ref="#/components/responses/badrequest"
9924 * ref="#/components/responses/unauthorized"
9926 * security={{"openemr_auth":{}}}
9929 "GET /fhir/Location" => function (HttpRestRequest
$request) {
9930 $return = (new FhirLocationRestController())->getAll($request->getQueryParams(), $request->getPatientUUIDString());
9931 RestConfig
::apiLog($return);
9937 * path="/fhir/Location/{uuid}",
9938 * description="Returns a single Location resource.",
9943 * description="The uuid for the Location resource.",
9951 * description="Standard Response",
9953 * mediaType="application/json",
9956 * property="json object",
9957 * description="FHIR Json object.",
9961 * "id": "946da61d-c4f2-4f03-a2a7-b571f6a24b65",
9964 * "lastUpdated": "2021-09-19T08:14:58+00:00"
9966 * "resourceType": "Location",
9967 * "status": "active",
9968 * "name": "Your Clinic Name Here",
9971 * "system": "phone",
9972 * "value": "000-000-0000"
9976 * "value": "000-000-0000"
9985 * ref="#/components/responses/badrequest"
9989 * ref="#/components/responses/unauthorized"
9993 * ref="#/components/responses/uuidnotfound"
9995 * security={{"openemr_auth":{}}}
9998 "GET /fhir/Location/:uuid" => function ($uuid, HttpRestRequest
$request) {
9999 $return = (new FhirLocationRestController())->getOne($uuid, $request->getPatientUUIDString());
10000 RestConfig
::apiLog($return);
10006 * path="/fhir/Medication",
10007 * description="Returns a list of Medication resources.",
10011 * description="Standard Response",
10013 * mediaType="application/json",
10016 * property="json object",
10017 * description="FHIR Json object.",
10022 * "lastUpdated": "2021-09-14T09:13:51"
10024 * "resourceType": "Bundle",
10025 * "type": "collection",
10029 * "relation": "self",
10030 * "url": "https://localhost:9300/apis/default/fhir/Medication"
10039 * ref="#/components/responses/badrequest"
10043 * ref="#/components/responses/unauthorized"
10045 * security={{"openemr_auth":{}}}
10048 "GET /fhir/Medication" => function (HttpRestRequest
$request) {
10049 RestConfig
::authorization_check("patients", "med");
10050 $return = (new FhirMedicationRestController())->getAll($request->getQueryParams());
10051 RestConfig
::apiLog($return);
10057 * path="/fhir/Medication/{uuid}",
10058 * description="Returns a single Medication resource.",
10063 * description="The uuid for the Medication resource.",
10071 * description="Standard Response",
10073 * mediaType="application/json",
10076 * property="json object",
10077 * description="FHIR Json object.",
10081 * "id": "961aa334-9348-4145-8252-de665e3c4afa",
10083 * "versionId": "1",
10084 * "lastUpdated": "2022-04-19T23:42:14+00:00"
10086 * "resourceType": "Medication",
10090 * "system": "http://www.nlm.nih.gov/research/umls/rxnorm",
10095 * "status": "active",
10097 * "lotNumber": "132",
10098 * "expirationDate": "0000-00-00"
10106 * ref="#/components/responses/badrequest"
10110 * ref="#/components/responses/unauthorized"
10114 * ref="#/components/responses/uuidnotfound"
10116 * security={{"openemr_auth":{}}}
10119 "GET /fhir/Medication/:uuid" => function ($uuid, HttpRestRequest
$request) {
10120 if ($request->isPatientRequest()) {
10121 // only allow access to data of binded patient
10122 $return = (new FhirMedicationRestController())->getOne($uuid, $request->getPatientUUIDString());
10124 RestConfig
::authorization_check("patients", "med");
10125 $return = (new FhirMedicationRestController())->getOne($uuid);
10127 RestConfig
::apiLog($return);
10133 * path="/fhir/MedicationRequest",
10134 * description="Returns a list of MedicationRequest resources.",
10139 * description="The uuid for the MedicationRequest resource.",
10148 * description="The uuid for the patient.",
10157 * description="The intent of the MedicationRequest resource.",
10166 * description="The status of the MedicationRequest resource.",
10174 * description="Standard Response",
10176 * mediaType="application/json",
10179 * property="json object",
10180 * description="FHIR Json object.",
10185 * "lastUpdated": "2021-09-14T09:13:51"
10187 * "resourceType": "Bundle",
10188 * "type": "collection",
10192 * "relation": "self",
10193 * "url": "https://localhost:9300/apis/default/fhir/MedicationRequest"
10202 * ref="#/components/responses/badrequest"
10206 * ref="#/components/responses/unauthorized"
10208 * security={{"openemr_auth":{}}}
10211 "GET /fhir/MedicationRequest" => function (HttpRestRequest
$request) {
10212 $getParams = $request->getQueryParams();
10213 if ($request->isPatientRequest()) {
10214 // only allow access to data of binded patient
10215 $return = (new FhirMedicationRequestRestController())->getAll($getParams, $request->getPatientUUIDString());
10217 RestConfig
::authorization_check("patients", "med");
10218 $return = (new FhirMedicationRequestRestController())->getAll($getParams);
10220 RestConfig
::apiLog($return);
10226 * path="/fhir/MedicationRequest/{uuid}",
10227 * description="Returns a single MedicationRequest resource.",
10232 * description="The uuid for the MedicationRequest resource.",
10240 * description="Standard Response",
10242 * mediaType="application/json",
10245 * property="json object",
10246 * description="FHIR Json object.",
10250 * "id": "946da61d-9cff-4416-8d27-805f19f9d7d8",
10252 * "versionId": "1",
10253 * "lastUpdated": "2021-09-20T04:03:14+00:00"
10255 * "resourceType": "MedicationRequest",
10256 * "status": "active",
10257 * "intent": "order",
10262 * "system": "http://terminology.hl7.org/CodeSystem/medicationrequest-category",
10263 * "code": "community",
10264 * "display": "Home/Community"
10269 * "reportedBoolean": false,
10270 * "medicationCodeableConcept": {
10273 * "system": "http://www.nlm.nih.gov/research/umls/rxnorm",
10274 * "code": "1738139",
10275 * "display": "Acetaminophen 325 MG Oral Tablet"
10280 * "reference": "Patient/946da617-1a4a-4b2c-ae66-93b84377cb1e",
10281 * "type": "Patient"
10283 * "authoredOn": "2021-09-18T00:00:00+00:00",
10285 * "reference": "Practitioner/946da61d-ac5f-4fdc-b3f2-7b58dc49976b",
10286 * "type": "Practitioner"
10294 * ref="#/components/responses/badrequest"
10298 * ref="#/components/responses/unauthorized"
10302 * ref="#/components/responses/uuidnotfound"
10304 * security={{"openemr_auth":{}}}
10307 "GET /fhir/MedicationRequest/:uuid" => function ($uuid, HttpRestRequest
$request) {
10308 if ($request->isPatientRequest()) {
10309 // only allow access to data of binded patient
10310 $return = (new FhirMedicationRequestRestController())->getOne($uuid, $request->getPatientUUIDString());
10312 RestConfig
::authorization_check("patients", "med");
10313 $return = (new FhirMedicationRequestRestController())->getOne($uuid);
10315 RestConfig
::apiLog($return);
10321 * path="/fhir/Observation",
10322 * description="Returns a list of Observation resources.",
10327 * description="The uuid for the Observation resource.",
10336 * description="The uuid for the patient.",
10345 * description="The code of the Observation resource.",
10354 * description="The category of the Observation resource.",
10363 * description="The datetime of the Observation resource.",
10371 * description="Standard Response",
10373 * mediaType="application/json",
10376 * property="json object",
10377 * description="FHIR Json object.",
10382 * "lastUpdated": "2021-09-14T09:13:51"
10384 * "resourceType": "Bundle",
10385 * "type": "collection",
10389 * "relation": "self",
10390 * "url": "https://localhost:9300/apis/default/fhir/Observation"
10399 * ref="#/components/responses/badrequest"
10403 * ref="#/components/responses/unauthorized"
10405 * security={{"openemr_auth":{}}}
10408 "GET /fhir/Observation" => function (HttpRestRequest
$request) {
10409 $getParams = $request->getQueryParams();
10410 if ($request->isPatientRequest()) {
10411 // only allow access to data of binded patient
10412 $return = (new FhirObservationRestController())->getAll($getParams, $request->getPatientUUIDString());
10414 RestConfig
::authorization_check("patients", "med");
10415 $return = (new FhirObservationRestController())->getAll($getParams);
10417 RestConfig
::apiLog($return);
10423 * path="/fhir/Observation/{uuid}",
10424 * description="Returns a single Observation resource.",
10429 * description="The uuid for the Observation resource.",
10437 * description="Standard Response",
10439 * mediaType="application/json",
10442 * property="json object",
10443 * description="FHIR Json object.",
10447 * "id": "946da61e-0597-485e-9dfd-a87205ea56b3",
10449 * "versionId": "1",
10450 * "lastUpdated": "2021-09-20T04:12:16+00:00"
10452 * "resourceType": "Observation",
10453 * "status": "final",
10458 * "system": "http://terminology.hl7.org/CodeSystem/observation-category",
10459 * "code": "vital-signs"
10467 * "system": "http://loinc.org",
10468 * "code": "85354-9",
10469 * "display": "Blood pressure systolic and diastolic"
10474 * "reference": "Patient/946da619-c631-431a-a282-487cd6fb7802",
10475 * "type": "Patient"
10477 * "effectiveDateTime": "2015-08-31T00:00:00+00:00",
10483 * "system": "http://loinc.org",
10484 * "code": "8480-6",
10485 * "display": "Systolic blood pressure"
10489 * "valueQuantity": {
10491 * "unit": "mm[Hg]",
10492 * "system": "http://unitsofmeasure.org",
10500 * "system": "http://loinc.org",
10501 * "code": "8462-4",
10502 * "display": "Diastolic blood pressure"
10506 * "valueQuantity": {
10508 * "unit": "mm[Hg]",
10509 * "system": "http://unitsofmeasure.org",
10520 * ref="#/components/responses/badrequest"
10524 * ref="#/components/responses/unauthorized"
10528 * ref="#/components/responses/uuidnotfound"
10530 * security={{"openemr_auth":{}}}
10533 "GET /fhir/Observation/:uuid" => function ($uuid, HttpRestRequest
$request) {
10534 if ($request->isPatientRequest()) {
10535 // only allow access to data of binded patient
10536 $return = (new FhirObservationRestController())->getOne($uuid, $request->getPatientUUIDString());
10538 RestConfig
::authorization_check("patients", "med");
10539 $return = (new FhirObservationRestController())->getOne($uuid);
10541 RestConfig
::apiLog($return);
10547 * path="/fhir/Organization",
10548 * description="Returns a list of Organization resources.",
10553 * description="The uuid for the Organization resource.",
10562 * description="The name of the Organization resource.",
10571 * description="The email of the Organization resource.",
10580 * description="The phone of the Organization resource.",
10589 * description="The telecom of the Organization resource.",
10598 * description="The address of the Organization resource.",
10605 * name="address-city",
10607 * description="The address-city of the Organization resource.",
10614 * name="address-postalcode",
10616 * description="The address-postalcode of the Organization resource.",
10623 * name="address-state",
10625 * description="The address-state of the Organization resource.",
10633 * description="Standard Response",
10635 * mediaType="application/json",
10638 * property="json object",
10639 * description="FHIR Json object.",
10644 * "lastUpdated": "2021-09-14T09:13:51"
10646 * "resourceType": "Bundle",
10647 * "type": "collection",
10651 * "relation": "self",
10652 * "url": "https://localhost:9300/apis/default/fhir/Organization"
10661 * ref="#/components/responses/badrequest"
10665 * ref="#/components/responses/unauthorized"
10667 * security={{"openemr_auth":{}}}
10670 "GET /fhir/Organization" => function (HttpRestRequest
$request) {
10671 if (!$request->isPatientRequest()) {
10672 RestConfig
::authorization_check("admin", "users");
10674 $return = (new FhirOrganizationRestController())->getAll($request->getQueryParams());
10675 RestConfig
::apiLog($return);
10681 * path="/fhir/Organization/{uuid}",
10682 * description="Returns a single Organization resource.",
10687 * description="The uuid for the Organization resource.",
10695 * description="Standard Response",
10697 * mediaType="application/json",
10700 * property="json object",
10701 * description="FHIR Json object.",
10705 * "id": "95f0e672-be37-4c73-95c9-649c2d200018",
10707 * "versionId": "1",
10708 * "lastUpdated": "2022-03-30T07:43:23+00:00"
10710 * "resourceType": "Organization",
10712 * "status": "generated",
10713 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Your Clinic Name Here</p></div>"
10717 * "system": "http://hl7.org/fhir/sid/us-npi",
10718 * "value": "1234567890"
10726 * "system": "http://terminology.hl7.org/CodeSystem/organization-type",
10728 * "display": "Healthcare Provider"
10733 * "name": "Your Clinic Name Here",
10736 * "system": "phone",
10737 * "value": "000-000-0000",
10742 * "value": "000-000-0000",
10755 * ref="#/components/responses/badrequest"
10759 * ref="#/components/responses/unauthorized"
10763 * ref="#/components/responses/uuidnotfound"
10765 * security={{"openemr_auth":{}}}
10768 "GET /fhir/Organization/:uuid" => function ($uuid, HttpRestRequest
$request) {
10769 $patientUUID = null;
10770 if (!$request->isPatientRequest()) {
10771 RestConfig
::authorization_check("admin", "users");
10773 $patientUUID = $request->getPatientUUIDString();
10775 $return = (new FhirOrganizationRestController())->getOne($uuid, $patientUUID);
10777 RestConfig
::apiLog($return);
10783 * path="/fhir/Organization",
10784 * description="Adds a Organization resource.",
10789 * mediaType="application/json",
10791 * description="The json object for the Organization resource.",
10795 * "id": "95f0e672-be37-4c73-95c9-649c2d200018",
10797 * "versionId": "1",
10798 * "lastUpdated": "2022-03-30T07:43:23+00:00"
10800 * "resourceType": "Organization",
10802 * "status": "generated",
10803 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Your Clinic Name Here</p></div>"
10807 * "system": "http://hl7.org/fhir/sid/us-npi",
10808 * "value": "1234567890"
10816 * "system": "http://terminology.hl7.org/CodeSystem/organization-type",
10818 * "display": "Healthcare Provider"
10823 * "name": "Your Clinic Name Here Hey",
10826 * "system": "phone",
10827 * "value": "000-000-0000",
10832 * "value": "000-000-0000",
10844 * description="Standard Response",
10846 * mediaType="application/json",
10849 * property="json object",
10850 * description="FHIR Json object.",
10854 * "id": "95f0e672-be37-4c73-95c9-649c2d200018",
10856 * "versionId": "1",
10857 * "lastUpdated": "2022-03-30T07:43:23+00:00"
10859 * "resourceType": "Organization",
10861 * "status": "generated",
10862 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Your Clinic Name Here</p></div>"
10866 * "system": "http://hl7.org/fhir/sid/us-npi",
10867 * "value": "1234567890"
10875 * "system": "http://terminology.hl7.org/CodeSystem/organization-type",
10877 * "display": "Healthcare Provider"
10882 * "name": "Your Clinic Name Here Now",
10885 * "system": "phone",
10886 * "value": "000-000-0000",
10891 * "value": "000-000-0000",
10904 * ref="#/components/responses/badrequest"
10908 * ref="#/components/responses/unauthorized"
10910 * security={{"openemr_auth":{}}}
10913 "POST /fhir/Organization" => function (HttpRestRequest
$request) {
10914 RestConfig
::authorization_check("admin", "super");
10915 $data = (array) (json_decode(file_get_contents("php://input"), true));
10916 $return = (new FhirOrganizationRestController())->post($data);
10917 RestConfig
::apiLog($return, $data);
10923 * path="/fhir/Organization/{uuid}",
10924 * description="Modifies a Organization resource.",
10929 * description="The uuid for the organization.",
10938 * mediaType="application/json",
10940 * description="The json object for the Organization resource.",
10944 * "id": "95f0e672-be37-4c73-95c9-649c2d200018",
10946 * "versionId": "1",
10947 * "lastUpdated": "2022-03-30T07:43:23+00:00"
10949 * "resourceType": "Organization",
10951 * "status": "generated",
10952 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Your Clinic Name Here</p></div>"
10956 * "system": "http://hl7.org/fhir/sid/us-npi",
10957 * "value": "1234567890"
10965 * "system": "http://terminology.hl7.org/CodeSystem/organization-type",
10967 * "display": "Healthcare Provider"
10972 * "name": "Your Clinic Name Here",
10975 * "system": "phone",
10976 * "value": "000-000-0000",
10981 * "value": "000-000-0000",
10993 * description="Standard Response",
10995 * mediaType="application/json",
10999 * "uuid": "95f217c1-258c-44ca-bf11-909dce369574"
11006 * ref="#/components/responses/badrequest"
11010 * ref="#/components/responses/unauthorized"
11012 * security={{"openemr_auth":{}}}
11015 "PUT /fhir/Organization/:uuid" => function ($uuid, HttpRestRequest
$request) {
11016 RestConfig
::authorization_check("admin", "super");
11017 $data = (array) (json_decode(file_get_contents("php://input"), true));
11018 $return = (new FhirOrganizationRestController())->patch($uuid, $data);
11019 RestConfig
::apiLog($return, $data);
11025 * path="/fhir/Patient",
11026 * description="Adds a Patient resource.",
11031 * mediaType="application/json",
11033 * description="The json object for the Patient resource.",
11037 * "id": "95f22ff4-dd25-4290-8b52-1dd2fedf8e54",
11039 * "versionId": "1",
11040 * "lastUpdated": "2022-03-31T02:48:28+00:00"
11042 * "resourceType": "Patient",
11044 * "status": "generated",
11045 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Brenda Smith</p></div>"
11049 * "valueCode": "F",
11050 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex"
11056 * "system": "http://terminology.hl7.org/CodeSystem/v3-NullFlavor",
11058 * "display": "Unknown"
11060 * "url": "ombCategory"
11063 * "valueString": "Unknown",
11067 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"
11072 * "use": "official",
11076 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
11081 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
11088 * "use": "official",
11089 * "family": "Smith",
11095 * "gender": "female",
11096 * "birthDate": "2017-03-10",
11097 * "communication": {
11102 * "system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
11103 * "code": "unknown",
11104 * "display": "Unknown"
11115 * description="Standard Response",
11117 * mediaType="application/json",
11120 * property="json object",
11121 * description="FHIR Json object.",
11125 * "id": "95f22ff4-dd25-4290-8b52-1dd2fedf8e54",
11127 * "versionId": "1",
11128 * "lastUpdated": "2022-03-31T02:48:28+00:00"
11130 * "resourceType": "Patient",
11132 * "status": "generated",
11133 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Brenda Smith</p></div>"
11137 * "valueCode": "F",
11138 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex"
11144 * "system": "http://terminology.hl7.org/CodeSystem/v3-NullFlavor",
11146 * "display": "Unknown"
11148 * "url": "ombCategory"
11151 * "valueString": "Unknown",
11155 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"
11160 * "use": "official",
11164 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
11169 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
11176 * "use": "official",
11177 * "family": "Smith",
11183 * "gender": "female",
11184 * "birthDate": "2017-03-10",
11185 * "communication": {
11190 * "system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
11191 * "code": "unknown",
11192 * "display": "Unknown"
11204 * ref="#/components/responses/badrequest"
11208 * ref="#/components/responses/unauthorized"
11210 * security={{"openemr_auth":{}}}
11213 "POST /fhir/Patient" => function (HttpRestRequest
$request) {
11214 RestConfig
::authorization_check("patients", "demo");
11215 $data = (array) (json_decode(file_get_contents("php://input"), true));
11216 $return = (new FhirPatientRestController())->post($data);
11217 RestConfig
::apiLog($return, $data);
11223 * path="/fhir/Patient/{uuid}",
11224 * description="Modifies a Patient resource.",
11229 * description="The uuid for the Patient resource.",
11238 * mediaType="application/json",
11240 * description="The json object for the Patient resource.",
11244 * "id": "95f22ff4-dd25-4290-8b52-1dd2fedf8e54",
11246 * "versionId": "1",
11247 * "lastUpdated": "2022-03-31T02:48:28+00:00"
11249 * "resourceType": "Patient",
11251 * "status": "generated",
11252 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Brenda Smith</p></div>"
11256 * "valueCode": "F",
11257 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex"
11263 * "system": "http://terminology.hl7.org/CodeSystem/v3-NullFlavor",
11265 * "display": "Unknown"
11267 * "url": "ombCategory"
11270 * "valueString": "Unknown",
11274 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"
11279 * "use": "official",
11283 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
11288 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
11295 * "use": "official",
11296 * "family": "Smith",
11302 * "gender": "female",
11303 * "birthDate": "2017-03-10",
11304 * "communication": {
11309 * "system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
11310 * "code": "unknown",
11311 * "display": "Unknown"
11322 * description="Standard Response",
11324 * mediaType="application/json",
11328 * "uuid": "95f2ad04-5834-4243-8838-e396a7faadbf"
11335 * ref="#/components/responses/badrequest"
11339 * ref="#/components/responses/unauthorized"
11341 * security={{"openemr_auth":{}}}
11344 "PUT /fhir/Patient/:uuid" => function ($uuid, HttpRestRequest
$request) {
11345 RestConfig
::authorization_check("patients", "demo");
11346 $data = (array) (json_decode(file_get_contents("php://input"), true));
11347 $return = (new FhirPatientRestController())->put($uuid, $data);
11348 RestConfig
::apiLog($return, $data);
11354 * path="/fhir/Patient",
11355 * description="Returns a list of Patient resources.",
11360 * description="The uuid for the Patient resource.",
11367 * name="identifier",
11369 * description="The identifier of the Patient resource.",
11378 * description="The name of the Patient resource.",
11385 * name="birthdate",
11387 * description="The birthdate of the Patient resource.",
11396 * description="The gender of the Patient resource.",
11405 * description="The address of the Patient resource.",
11412 * name="address-city",
11414 * description="The address-city of the Patient resource.",
11421 * name="address-postalcode",
11423 * description="The address-postalcode of the Patient resource.",
11430 * name="address-state",
11432 * description="The address-state of the Patient resource.",
11441 * description="The email of the Patient resource.",
11450 * description="The family name of the Patient resource.",
11459 * description="The given name of the Patient resource.",
11468 * description="The phone number of the Patient resource.",
11477 * description="The fax number of the Patient resource.",
11484 * ref="#/components/parameters/_lastUpdated"
11488 * description="Standard Response",
11490 * mediaType="application/json",
11493 * property="json object",
11494 * description="FHIR Json object.",
11499 * "lastUpdated": "2021-09-14T09:13:51"
11501 * "resourceType": "Bundle",
11502 * "type": "collection",
11506 * "relation": "self",
11507 * "url": "https://localhost:9300/apis/default/fhir/Patient"
11516 * ref="#/components/responses/badrequest"
11520 * ref="#/components/responses/unauthorized"
11522 * security={{"openemr_auth":{}}}
11525 "GET /fhir/Patient" => function (HttpRestRequest
$request) {
11526 $params = $request->getQueryParams();
11527 if ($request->isPatientRequest()) {
11528 // only allow access to data of binded patient
11529 // Note in Patient context still have to return a bundle even if it is just one resource. (ie.
11530 // need to use getAll rather than getOne)
11531 $params['_id'] = $request->getPatientUUIDString();
11532 $return = (new FhirPatientRestController())->getAll($params, $request->getPatientUUIDString());
11534 RestConfig
::authorization_check("patients", "demo");
11535 $return = (new FhirPatientRestController())->getAll($params);
11537 RestConfig
::apiLog($return);
11543 * path="/fhir/Patient/$export",
11544 * 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>",
11548 * 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>"
11552 * ref="#/components/responses/badrequest"
11556 * ref="#/components/responses/unauthorized"
11558 * security={{"openemr_auth":{}}}
11561 // we have to have the bulk fhir export operation here otherwise it will match $export to the patient $id
11562 'GET /fhir/Patient/$export' => function (HttpRestRequest
$request) {
11563 RestConfig
::authorization_check("admin", "users");
11564 $fhirExportService = new FhirOperationExportRestController($request);
11565 $return = $fhirExportService->processExport(
11566 $request->getQueryParams(),
11568 $request->getHeader('Accept')[0] ??
'',
11569 $request->getHeader('Prefer')[0] ??
''
11571 RestConfig
::apiLog($return);
11577 * path="/fhir/Patient/{uuid}",
11578 * description="Returns a single Patient resource.",
11583 * description="The uuid for the Patient resource.",
11591 * description="Standard Response",
11593 * mediaType="application/json",
11596 * property="json object",
11597 * description="FHIR Json object.",
11601 * "id": "946da617-1a4a-4b2c-ae66-93b84377cb1e",
11603 * "versionId": "1",
11604 * "lastUpdated": "2021-09-21T17:08:03+00:00"
11606 * "resourceType": "Patient",
11608 * "status": "generated",
11609 * "div": "<div xmlns=""http://www.w3.org/1999/xhtml""> <p>Aurore252 Von197</p></div>"
11613 * "valueCode": "F",
11614 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex"
11620 * "system": "urn:oid:2.16.840.1.113883.6.238",
11621 * "code": "1006-6",
11622 * "display": "Abenaki"
11624 * "url": "ombCategory"
11627 * "valueString": "Abenaki",
11631 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-race"
11636 * "valueString": "Declined To Specify",
11640 * "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-ethnicity"
11645 * "use": "official",
11649 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
11654 * "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
11661 * "use": "official",
11662 * "family": "Von197",
11668 * "gender": "female",
11669 * "birthDate": "1970-07-03",
11675 * "city": "Boston",
11676 * "state": "Massachusetts",
11677 * "postalCode": "02215",
11679 * "start": "2020-09-21T17:08:03.532+00:00"
11683 * "communication": {
11688 * "system": "http://terminology.hl7.org/CodeSystem/data-absent-reason",
11689 * "code": "unknown",
11690 * "display": "Unknown"
11702 * ref="#/components/responses/badrequest"
11706 * ref="#/components/responses/unauthorized"
11710 * ref="#/components/responses/uuidnotfound"
11712 * security={{"openemr_auth":{}}}
11715 "GET /fhir/Patient/:uuid" => function ($uuid, HttpRestRequest
$request) {
11716 if ($request->isPatientRequest()) {
11717 // only allow access to data of binded patient
11718 if (empty($uuid) ||
($uuid != $request->getPatientUUIDString())) {
11719 throw new AccessDeniedException("patients", "demo", "patient id invalid");
11721 $uuid = $request->getPatientUUIDString();
11723 RestConfig
::authorization_check("patients", "demo");
11725 $return = (new FhirPatientRestController())->getOne($uuid);
11726 RestConfig
::apiLog($return);
11732 * path="/fhir/Person",
11733 * description="Returns a list of Person resources.",
11738 * description="The name of the Person resource.",
11747 * description="The active status of the Person resource.",
11756 * description="The address of the Person resource.",
11763 * name="address-city",
11765 * description="The address-city of the Person resource.",
11772 * name="address-postalcode",
11774 * description="The address-postalcode of the Person resource.",
11781 * name="address-state",
11783 * description="The address-state of the Person resource.",
11792 * description="The email of the Person resource.",
11801 * description="The family name of the Person resource.",
11810 * description="The given name of the Person resource.",
11819 * description="The phone number of the Person resource.",
11828 * description="The fax number of the Person resource.",
11836 * description="Standard Response",
11838 * mediaType="application/json",
11841 * property="json object",
11842 * description="FHIR Json object.",
11847 * "lastUpdated": "2021-09-14T09:13:51"
11849 * "resourceType": "Bundle",
11850 * "type": "collection",
11854 * "relation": "self",
11855 * "url": "https://localhost:9300/apis/default/fhir/Person"
11864 * ref="#/components/responses/badrequest"
11868 * ref="#/components/responses/unauthorized"
11870 * security={{"openemr_auth":{}}}
11873 "GET /fhir/Person" => function (HttpRestRequest
$request) {
11874 RestConfig
::authorization_check("admin", "users");
11875 $return = (new FhirPersonRestController())->getAll($request->getQueryParams());
11876 RestConfig
::apiLog($return);
11882 * path="/fhir/Person/{uuid}",
11883 * description="Returns a single Person resource.",
11888 * description="The uuid for the Person resource.",
11896 * description="Standard Response",
11898 * mediaType="application/json",
11901 * property="json object",
11902 * description="FHIR Json object.",
11906 * "id": "960c7cd6-187a-4119-8cd4-85389d80efb9",
11908 * "versionId": "1",
11909 * "lastUpdated": "2022-04-13T08:57:32+00:00"
11911 * "resourceType": "Person",
11913 * "status": "generated",
11914 * "div": "<div xmlns='http://www.w3.org/1999/xhtml'> <p>Administrator Administrator</p></div>"
11918 * "use": "official",
11919 * "family": "Administrator",
11928 * "system": "phone",
11929 * "value": "1234567890",
11933 * "system": "phone",
11934 * "value": "1234567890",
11938 * "system": "phone",
11939 * "value": "1234567890",
11943 * "system": "email",
11944 * "value": "hey@hey.com",
11951 * "123 Lane Street"
11953 * "city": "Bellevue",
11956 * "start": "2021-04-13T08:57:32.146+00:00"
11967 * ref="#/components/responses/badrequest"
11971 * ref="#/components/responses/unauthorized"
11975 * ref="#/components/responses/uuidnotfound"
11977 * security={{"openemr_auth":{}}}
11980 "GET /fhir/Person/:uuid" => function ($uuid, HttpRestRequest
$request) {
11981 // if the api user is requesting their own user we need to let it through
11982 // this is because the /Person endpoint needs to be responsive to the fhirUser return value
11983 // for the currently logged in user
11984 if ($request->getRequestUserUUIDString() == $uuid) {
11985 $return = (new FhirPersonRestController())->getOne($uuid);
11986 } else if (!$request->isPatientRequest()) {
11987 // not a patient ,make sure we have access to the users ACL
11988 RestConfig
::authorization_check("admin", "users");
11989 $return = (new FhirPersonRestController())->getOne($uuid);
11991 // if we are a patient bound request we need to make sure we are only bound to the patient
11992 $return = (new FhirPersonRestController())->getOne($uuid, $request->getPatientUUIDString());
11995 RestConfig
::apiLog($return);
12001 * path="/fhir/Practitioner",
12002 * description="Returns a list of Practitioner resources.",
12007 * description="The uuid for the Practitioner resource.",
12016 * description="The name of the Practitioner resource.",
12025 * description="The active status of the Practitioner resource.",
12034 * description="The address of the Practitioner resource.",
12041 * name="address-city",
12043 * description="The address-city of the Practitioner resource.",
12050 * name="address-postalcode",
12052 * description="The address-postalcode of the Practitioner resource.",
12059 * name="address-state",
12061 * description="The address-state of the Practitioner resource.",
12070 * description="The email of the Practitioner resource.",
12079 * description="The family name of the Practitioner resource.",
12088 * description="The given name of the Practitioner resource.",
12097 * description="The phone number of the Practitioner resource.",
12106 * description="The fax number of the Practitioner resource.",
12114 * description="Standard Response",
12116 * mediaType="application/json",
12119 * property="json object",
12120 * description="FHIR Json object.",
12125 * "lastUpdated": "2021-09-14T09:13:51"
12127 * "resourceType": "Bundle",
12128 * "type": "collection",
12132 * "relation": "self",
12133 * "url": "https://localhost:9300/apis/default/fhir/Practitioner"
12142 * ref="#/components/responses/badrequest"
12146 * ref="#/components/responses/unauthorized"
12148 * security={{"openemr_auth":{}}}
12151 "GET /fhir/Practitioner" => function (HttpRestRequest
$request) {
12153 // TODO: @adunsulag talk with brady.miller about patients needing access to any practitioner resource
12154 // that is referenced in connected patient resources -- such as AllergyIntollerance.
12155 // I don't believe patients are assigned to a particular practitioner
12156 // should we allow just open api access to admin information? Should we restrict particular pieces
12157 // of data in the practitioner side (phone number, address information) based on a permission set?
12158 if (!$request->isPatientRequest()) {
12159 RestConfig
::authorization_check("admin", "users");
12161 $return = (new FhirPractitionerRestController())->getAll($request->getQueryParams());
12162 RestConfig
::apiLog($return);
12168 * path="/fhir/Practitioner/{uuid}",
12169 * description="Returns a single Practitioner resource.",
12174 * description="The uuid for the Practitioner resource.",
12182 * description="Standard Response",
12184 * mediaType="application/json",
12187 * property="json object",
12188 * description="FHIR Json object.",
12192 * "id": "9473b0cf-e969-4eaa-8044-51037767fa4f",
12194 * "versionId": "1",
12195 * "lastUpdated": "2021-09-21T17:41:57+00:00"
12197 * "resourceType": "Practitioner",
12199 * "status": "generated",
12200 * "div": "<div xmlns=""http://www.w3.org/1999/xhtml""> <p>Billy Smith</p></div>"
12204 * "system": "http://hl7.org/fhir/sid/us-npi",
12205 * "value": "11223344554543"
12211 * "use": "official",
12212 * "family": "Smith",
12224 * ref="#/components/responses/badrequest"
12228 * ref="#/components/responses/unauthorized"
12232 * ref="#/components/responses/uuidnotfound"
12234 * security={{"openemr_auth":{}}}
12237 "GET /fhir/Practitioner/:uuid" => function ($uuid, HttpRestRequest
$request) {
12238 // TODO: @adunsulag talk with brady.miller about patients needing access to any practitioner resource
12239 // that is referenced in connected patient resources -- such as AllergyIntollerance.
12240 // I don't believe patients are assigned to a particular practitioner
12241 // should we allow just open api access to admin information? Should we restrict particular pieces
12242 // of data in the practitioner side (phone number, address information) based on a permission set?
12243 if (!$request->isPatientRequest()) {
12244 RestConfig
::authorization_check("admin", "users");
12246 $return = (new FhirPractitionerRestController())->getOne($uuid);
12247 RestConfig
::apiLog($return);
12253 * path="/fhir/Practitioner",
12254 * description="Adds a Practitioner resources.",
12259 * mediaType="application/json",
12261 * description="The json object for the Practitioner resource.",
12265 * "id": "9473b0cf-e969-4eaa-8044-51037767fa4f",
12267 * "versionId": "1",
12268 * "lastUpdated": "2021-09-21T17:41:57+00:00"
12270 * "resourceType": "Practitioner",
12272 * "status": "generated",
12273 * "div": "<div xmlns=""http://www.w3.org/1999/xhtml""> <p>Billy Smith</p></div>"
12277 * "system": "http://hl7.org/fhir/sid/us-npi",
12278 * "value": "11223344554543"
12284 * "use": "official",
12285 * "family": "Smith",
12296 * description="Standard Response",
12298 * mediaType="application/json",
12301 * property="json object",
12302 * description="FHIR Json object.",
12306 * "id": "9473b0cf-e969-4eaa-8044-51037767fa4f",
12308 * "versionId": "1",
12309 * "lastUpdated": "2021-09-21T17:41:57+00:00"
12311 * "resourceType": "Practitioner",
12313 * "status": "generated",
12314 * "div": "<div xmlns=""http://www.w3.org/1999/xhtml""> <p>Billy Smith</p></div>"
12318 * "system": "http://hl7.org/fhir/sid/us-npi",
12319 * "value": "11223344554543"
12325 * "use": "official",
12326 * "family": "Smith",
12338 * ref="#/components/responses/badrequest"
12342 * ref="#/components/responses/unauthorized"
12344 * security={{"openemr_auth":{}}}
12347 "POST /fhir/Practitioner" => function (HttpRestRequest
$request) {
12348 RestConfig
::authorization_check("admin", "users");
12349 $data = (array) (json_decode(file_get_contents("php://input"), true));
12350 $return = (new FhirPractitionerRestController())->post($data);
12351 RestConfig
::apiLog($return, $data);
12357 * path="/fhir/Practitioner/{uuid}",
12358 * description="Modify a Practitioner resource.",
12363 * description="The uuid for the Practitioner resource.",
12372 * mediaType="application/json",
12374 * description="The json object for the Practitioner resource.",
12378 * "id": "9473b0cf-e969-4eaa-8044-51037767fa4f",
12380 * "versionId": "1",
12381 * "lastUpdated": "2021-09-21T17:41:57+00:00"
12383 * "resourceType": "Practitioner",
12385 * "status": "generated",
12386 * "div": "<div xmlns=""http://www.w3.org/1999/xhtml""> <p>Billy Smith</p></div>"
12390 * "system": "http://hl7.org/fhir/sid/us-npi",
12391 * "value": "11223344554543"
12397 * "use": "official",
12398 * "family": "Smith",
12409 * description="Standard Response",
12411 * mediaType="application/json",
12415 * "uuid": "95f294d7-e14c-441d-81a6-309fe369ee21"
12422 * ref="#/components/responses/badrequest"
12426 * ref="#/components/responses/unauthorized"
12428 * security={{"openemr_auth":{}}}
12431 "PUT /fhir/Practitioner/:uuid" => function ($uuid, HttpRestRequest
$request) {
12432 RestConfig
::authorization_check("admin", "users");
12433 $data = (array) (json_decode(file_get_contents("php://input"), true));
12434 $return = (new FhirPractitionerRestController())->patch($uuid, $data);
12435 RestConfig
::apiLog($return, $data);
12441 * path="/fhir/PractitionerRole",
12442 * description="Returns a list of PractitionerRole resources.",
12445 * name="specialty",
12447 * description="The specialty of the PractitionerRole resource.",
12454 * name="practitioner",
12456 * description="The practitioner of the PractitionerRole resource.",
12464 * description="Standard Response",
12466 * mediaType="application/json",
12469 * property="json object",
12470 * description="FHIR Json object.",
12475 * "lastUpdated": "2021-09-14T09:13:51"
12477 * "resourceType": "Bundle",
12478 * "type": "collection",
12482 * "relation": "self",
12483 * "url": "https://localhost:9300/apis/default/fhir/PractitionerRole"
12492 * ref="#/components/responses/badrequest"
12496 * ref="#/components/responses/unauthorized"
12498 * security={{"openemr_auth":{}}}
12501 "GET /fhir/PractitionerRole" => function (HttpRestRequest
$request) {
12502 RestConfig
::authorization_check("admin", "users");
12503 $return = (new FhirPractitionerRoleRestController())->getAll($request->getQueryParams());
12504 RestConfig
::apiLog($return);
12510 * path="/fhir/PractitionerRole/{uuid}",
12511 * description="Returns a single PractitionerRole resource.",
12516 * description="The uuid for the PractitionerRole resource.",
12524 * description="Standard Response",
12526 * mediaType="application/json",
12529 * property="json object",
12530 * description="FHIR Json object.",
12534 * "id": "960c806f-9463-482e-b228-67b5be1fed55",
12536 * "versionId": "1",
12537 * "lastUpdated": "2022-04-13T06:18:17+00:00"
12539 * "resourceType": "PractitionerRole",
12540 * "practitioner": {
12541 * "reference": "Practitioner/960c7cd6-187a-4119-8cd4-85389d80efb9",
12542 * "display": "Administrator Administrator"
12544 * "organization": {
12545 * "reference": "Organization/960c7cc6-b4ae-49bc-877b-1a2913271c43",
12546 * "display": "Your Clinic Name Here"
12553 * "text": "Psychoanalyst"
12559 * "text": "Counselor"
12568 * ref="#/components/responses/badrequest"
12572 * ref="#/components/responses/unauthorized"
12576 * ref="#/components/responses/uuidnotfound"
12578 * security={{"openemr_auth":{}}}
12581 "GET /fhir/PractitionerRole/:uuid" => function ($uuid, HttpRestRequest
$request) {
12582 RestConfig
::authorization_check("admin", "users");
12583 $return = (new FhirPractitionerRoleRestController())->getOne($uuid);
12584 RestConfig
::apiLog($return);
12590 * path="/fhir/Procedure",
12591 * description="Returns a list of Procedure resources.",
12596 * description="The uuid for the Procedure resource.",
12605 * description="The uuid for the patient.",
12614 * description="The datetime of the Procedure resource.",
12622 * description="Standard Response",
12624 * mediaType="application/json",
12627 * property="json object",
12628 * description="FHIR Json object.",
12633 * "lastUpdated": "2021-09-14T09:13:51"
12635 * "resourceType": "Bundle",
12636 * "type": "collection",
12640 * "relation": "self",
12641 * "url": "https://localhost:9300/apis/default/fhir/Procedure"
12650 * ref="#/components/responses/badrequest"
12654 * ref="#/components/responses/unauthorized"
12656 * security={{"openemr_auth":{}}}
12659 "GET /fhir/Procedure" => function (HttpRestRequest
$request) {
12660 if ($request->isPatientRequest()) {
12661 // only allow access to data of binded patient
12662 $return = (new FhirProcedureRestController())->getAll($request->getQueryParams(), $request->getPatientUUIDString());
12664 RestConfig
::authorization_check("patients", "med");
12665 $return = (new FhirProcedureRestController())->getAll($request->getQueryParams());
12667 RestConfig
::apiLog($return);
12673 * path="/fhir/Procedure/{uuid}",
12674 * description="Returns a single Procedure resource.",
12679 * description="The uuid for the Procedure resource.",
12687 * description="Standard Response",
12689 * mediaType="application/json",
12692 * property="json object",
12693 * description="FHIR Json object.",
12697 * "id": "95e9d3fb-fe7b-448a-aa60-d40b11b486a5",
12699 * "versionId": "1",
12700 * "lastUpdated": "2022-03-26T17:20:14+00:00"
12702 * "resourceType": "Procedure",
12703 * "status": "in-progress",
12705 * "reference": "Patient/95e8d830-3068-48cf-930a-2fefb18c2bcf",
12706 * "type": "Patient"
12714 * ref="#/components/responses/badrequest"
12718 * ref="#/components/responses/unauthorized"
12722 * ref="#/components/responses/uuidnotfound"
12724 * security={{"openemr_auth":{}}}
12727 "GET /fhir/Procedure/:uuid" => function ($uuid, HttpRestRequest
$request) {
12728 if ($request->isPatientRequest()) {
12729 // only allow access to data of binded patient
12730 $return = (new FhirProcedureRestController())->getOne($uuid, $request->getPatientUUIDString());
12732 RestConfig
::authorization_check("patients", "med");
12733 $return = (new FhirProcedureRestController())->getOne($uuid);
12735 RestConfig
::apiLog($return);
12741 * path="/fhir/Provenance/{uuid}",
12742 * description="Returns a single Provenance resource.",
12747 * description="The id for the Provenance resource. Format is \<resource name\>:\<uuid\> (Example: AllergyIntolerance:95ea43f3-1066-4bc7-b224-6c23b985f145).",
12755 * description="Standard Response",
12757 * mediaType="application/json",
12760 * property="json object",
12761 * description="FHIR Json object.",
12765 * "id": "AllergyIntolerance:95ea43f3-1066-4bc7-b224-6c23b985f145",
12766 * "resourceType": "Provenance",
12769 * "reference": "AllergyIntolerance/95ea43f3-1066-4bc7-b224-6c23b985f145",
12770 * "type": "AllergyIntolerance"
12773 * "recorded": "2022-03-26T22:43:30+00:00",
12779 * "system": "http://terminology.hl7.org/CodeSystem/provenance-participant-type",
12780 * "code": "author",
12781 * "display": "Author"
12786 * "reference": "Organization/95e8d810-7e55-44aa-bb48-fecd5b0d88c7",
12787 * "type": "Organization"
12790 * "reference": "Organization/95e8d810-7e55-44aa-bb48-fecd5b0d88c7",
12791 * "type": "Organization"
12798 * "system": "http://hl7.org/fhir/us/core/CodeSystem/us-core-provenance-participant-type",
12799 * "code": "transmitter",
12800 * "display": "Transmitter"
12806 * "reference": "Organization/95e8d810-7e55-44aa-bb48-fecd5b0d88c7",
12807 * "type": "Organization"
12810 * "reference": "Organization/95e8d810-7e55-44aa-bb48-fecd5b0d88c7",
12811 * "type": "Organization"
12820 * ref="#/components/responses/badrequest"
12824 * ref="#/components/responses/unauthorized"
12828 * ref="#/components/responses/uuidnotfound"
12830 * security={{"openemr_auth":{}}}
12833 "GET /fhir/Provenance/:uuid" => function ($uuid, HttpRestRequest
$request) {
12834 if ($request->isPatientRequest()) {
12835 // only allow access to data of binded patient
12836 $return = (new FhirProvenanceRestController($request))->getOne($uuid, $request->getPatientUUIDString());
12838 RestConfig
::authorization_check("admin", "super");
12839 $return = (new FhirProvenanceRestController($request))->getOne($uuid);
12841 RestConfig
::apiLog($return);
12847 * path="/fhir/Provenance",
12848 * description="Returns a list of Provenance resources.",
12853 * description="The id for the Provenance resource. Format is \<resource name\>:\<uuid\> (Example: AllergyIntolerance:95ea43f3-1066-4bc7-b224-6c23b985f145).",
12861 * description="Standard Response",
12863 * mediaType="application/json",
12866 * property="json object",
12867 * description="FHIR Json object.",
12872 * "lastUpdated": "2021-09-14T09:13:51"
12874 * "resourceType": "Bundle",
12875 * "type": "collection",
12879 * "relation": "self",
12880 * "url": "https://localhost:9300/apis/default/fhir/Provenance"
12889 * ref="#/components/responses/badrequest"
12893 * ref="#/components/responses/unauthorized"
12895 * security={{"openemr_auth":{}}}
12898 // NOTE: this GET request only supports requests with an _id parameter. FHIR inferno test tool requires the 'search'
12899 // property to support which is why this endpoint exists.
12900 "GET /fhir/Provenance" => function (HttpRestRequest
$request) {
12901 if ($request->isPatientRequest()) {
12902 // only allow access to data of binded patient
12903 $return = (new FhirProvenanceRestController($request))->getAll($request->getQueryParams(), $request->getPatientUUIDString());
12905 // TODO: it seems like regular users should be able to grab authorship / provenance information
12906 RestConfig
::authorization_check("admin", "super");
12907 $return = (new FhirProvenanceRestController($request))->getAll($request->getQueryParams());
12909 RestConfig
::apiLog($return);
12917 * path="/fhir/metadata",
12918 * description="Returns metadata (ie. CapabilityStatement resource) of the fhir server.",
12922 * description="Return CapabilityStatement resource of the fhir server"
12926 "GET /fhir/metadata" => function () {
12927 $return = (new FhirMetaDataRestController())->getMetaData();
12928 RestConfig
::apiLog($return);
12934 * path="/fhir/.well-known/smart-configuration",
12935 * description="Returns smart configuration of the fhir server.",
12939 * description="Return smart configuration of the fhir server"
12943 "GET /fhir/.well-known/smart-configuration" => function () {
12944 $authController = new \OpenEMR\RestControllers\
AuthorizationController();
12945 $return = (new \OpenEMR\RestControllers\SMART\
SMARTConfigurationController($authController))->getConfig();
12946 RestConfig
::apiLog($return);
12952 * path="/fhir/OperationDefinition",
12953 * description="Returns a list of the OperationDefinition resources that are specific to this OpenEMR installation",
12957 * description="Return list of OperationDefinition resources"
12961 "GET /fhir/OperationDefinition" => function (HttpRestRequest
$request) {
12962 // for now we will just hard code the custom resources
12963 $operationDefinitionController = new FhirOperationDefinitionRestController();
12964 $return = $operationDefinitionController->getAll($request->getQueryParams());
12965 RestConfig
::apiLog($return);
12971 * path="/fhir/OperationDefinition/{operation}",
12972 * description="Returns a single OperationDefinition resource that is specific to this OpenEMR installation",
12975 * name="operation",
12977 * description="The name of the operation to query. For example $bulkdata-status",
12985 * description="Standard Response",
12987 * mediaType="application/json",
12990 * property="json object",
12991 * description="FHIR Json object.",
12995 * "resourceType": "OperationDefinition",
12996 * "name": "$bulkdata-status",
12997 * "status": "active",
12998 * "kind": "operation",
13006 * "system": "http://hl7.org/fhir/data-types",
13007 * "code": "string",
13008 * "display": "string"
13011 * "system": "http://hl7.org/fhir/ValueSet/search-param-type",
13012 * "code": "string",
13013 * "display": "string"
13023 "GET /fhir/OperationDefinition/:operation" => function ($operation, HttpRestRequest
$request) {
13024 // for now we will just hard code the custom resources
13025 $operationDefinitionController = new FhirOperationDefinitionRestController();
13026 $return = $operationDefinitionController->getOne($operation);
13027 RestConfig
::apiLog($return);
13031 // FHIR root level operations
13035 * path="/fhir/$export",
13036 * 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>",
13040 * 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>"
13044 * ref="#/components/responses/badrequest"
13048 * ref="#/components/responses/unauthorized"
13050 * security={{"openemr_auth":{}}}
13053 'GET /fhir/$export' => function (HttpRestRequest
$request) {
13054 RestConfig
::authorization_check("admin", "users");
13055 $fhirExportService = new FhirOperationExportRestController($request);
13056 $return = $fhirExportService->processExport(
13057 $request->getQueryParams(),
13059 $request->getHeader('Accept')[0] ??
'',
13060 $request->getHeader('Prefer')[0] ??
''
13062 RestConfig
::apiLog($return);
13066 // these two operations are adopted based on the documentation used in the IBM FHIR Server
13067 // we'd reference cerner or epic but we couldn't find any documentation about those (Jan 30th 2021)
13068 // @see https://ibm.github.io/FHIR/guides/FHIRBulkOperations/
13072 * path="/fhir/$bulkdata-status",
13073 * 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>",
13077 * 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>"
13081 * ref="#/components/responses/badrequest"
13085 * ref="#/components/responses/unauthorized"
13087 * security={{"openemr_auth":{}}}
13090 'GET /fhir/$bulkdata-status' => function (HttpRestRequest
$request) {
13091 RestConfig
::authorization_check("admin", "users");
13092 $jobUuidString = $request->getQueryParam('job');
13093 // if we were truly async we would return 202 here to say we are in progress with a JSON response
13094 // since OpenEMR data is so small we just return the JSON from the database
13095 $fhirExportService = new FhirOperationExportRestController($request);
13096 $return = $fhirExportService->processExportStatusRequestForJob($jobUuidString);
13097 RestConfig
::apiLog($return);
13103 * path="/fhir/$bulkdata-status",
13104 * 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>",
13108 * 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>"
13112 * ref="#/components/responses/badrequest"
13116 * ref="#/components/responses/unauthorized"
13118 * security={{"openemr_auth":{}}}
13121 'DELETE /fhir/$bulkdata-status' => function (HttpRestRequest
$request) {
13122 RestConfig
::authorization_check("admin", "users");
13123 $job = $request->getQueryParam('job');
13124 $fhirExportService = new FhirOperationExportRestController($request);
13125 $return = $fhirExportService->processDeleteExportForJob($job);
13126 RestConfig
::apiLog($return);
13131 // Note that the portal (api) route is only for patient role
13132 // (there is a mechanism in place to ensure only patient role can access the portal (api) route)
13133 RestConfig
::$PORTAL_ROUTE_MAP = array(
13136 * path="/portal/patient",
13137 * description="Returns the patient.",
13138 * tags={"standard-patient"},
13141 * description="Standard response",
13143 * mediaType="application/json",
13144 * @OA\Schema(ref="#/components/schemas/api_patient_response")
13149 * ref="#/components/responses/unauthorized"
13151 * security={{"openemr_auth":{}}}
13154 "GET /portal/patient" => function (HttpRestRequest
$request) {
13155 $return = (new PatientRestController())->getOne($request->getPatientUUIDString());
13156 RestConfig
::apiLog($return);
13162 * path="/portal/patient/encounter",
13163 * description="Returns encounters for the patient.",
13164 * tags={"standard-patient"},
13167 * ref="#/components/responses/standard"
13171 * ref="#/components/responses/badrequest"
13175 * ref="#/components/responses/unauthorized"
13177 * security={{"openemr_auth":{}}}
13180 "GET /portal/patient/encounter" => function (HttpRestRequest
$request) {
13181 $return = (new EncounterRestController())->getAll($request->getPatientUUIDString());
13182 RestConfig
::apiLog($return);
13188 * path="/portal/patient/encounter/{euuid}",
13189 * description="Returns a selected encounter by its uuid.",
13190 * tags={"standard-patient"},
13194 * description="The uuid for the encounter.",
13202 * ref="#/components/responses/standard"
13206 * ref="#/components/responses/badrequest"
13210 * ref="#/components/responses/unauthorized"
13212 * security={{"openemr_auth":{}}}
13215 "GET /portal/patient/encounter/:euuid" => function ($euuid, HttpRestRequest
$request) {
13216 $return = (new EncounterRestController())->getOne($request->getPatientUUIDString(), $euuid);
13217 RestConfig
::apiLog($return);
13223 * path="/portal/patient/appointment",
13224 * description="Retrieves all appointments for a patient",
13225 * tags={"standard-patient"},
13228 * ref="#/components/responses/standard"
13232 * ref="#/components/responses/badrequest"
13236 * ref="#/components/responses/unauthorized"
13238 * security={{"openemr_auth":{}}}
13241 "GET /portal/patient/appointment" => function (HttpRestRequest
$request) {
13242 $return = (new AppointmentRestController())->getAllForPatientByUuid($request->getPatientUUIDString());
13243 RestConfig
::apiLog($return);
13250 * path="/portal/patient/appointment/{auuid}",
13251 * description="Returns a selected appointment by its uuid.",
13252 * tags={"standard-patient"},
13256 * description="The uuid for the appointment.",
13264 * ref="#/components/responses/standard"
13268 * ref="#/components/responses/badrequest"
13272 * ref="#/components/responses/unauthorized"
13274 * security={{"openemr_auth":{}}}
13277 "GET /portal/patient/appointment/:auuid" => function ($auuid, HttpRestRequest
$request) {
13278 $return = (new AppointmentRestController())->getOneForPatient($auuid, $request->getPatientUUIDString());
13279 RestConfig
::apiLog($return);