@@ -60,6 +60,8 @@ public HttpRequestActionBuilder getActiveVisitOfPatient(String patientUuid) {
60
60
return http ("Get Active Visits of Patient" )
61
61
.get ("/openmrs/ws/rest/v1/visit?patient=" + patientUuid + "&v=" + customRepresentation + "&includeInactive=false" );
62
62
}
63
+
64
+
63
65
64
66
public HttpRequestActionBuilder getProgramEnrollments (String patientUuid ) {
65
67
String customRepresentation = "custom:(uuid,display,program,dateEnrolled,dateCompleted," +
@@ -148,11 +150,52 @@ public HttpRequestActionBuilder getDrugOrders(String patientUuid) {
148
150
"&status=any&orderType=" + DRUG_ORDER +
149
151
"&v=" + customRepresentation );
150
152
}
153
+
154
+ public HttpRequestActionBuilder searchPatient (String searchQuery ) {
155
+ String customRepresentation = """
156
+ custom:(patientId,uuid,identifiers,display,patientIdentifier:(uuid,identifier),person:(gender,age,birthdate,birthdateEstimated,personName,addresses,display,dead,deathDate),attributes:(value,attributeType:(uuid,display)))
157
+ """ ;
158
+ return http ("Get Orders" )
159
+ .get ("/openmrs/ws/rest/v1/patient" +
160
+ "?q=" + searchQuery +
161
+ "&v=" + customRepresentation +
162
+ "&includeDead=" + true +
163
+ "&limit=" + 10 );
164
+ }
165
+
151
166
152
167
public HttpRequestActionBuilder getAllergies (String patientUuid ) {
153
168
return http ("Get Allergies of Patient" )
154
169
.get ("/openmrs/ws/fhir2/R4/AllergyIntolerance?patient=" + patientUuid + "&_summary=data" );
155
170
}
171
+
172
+ public HttpRequestActionBuilder saveAllergies (String patientUuid ) {
173
+ String payload = "{\n " +
174
+ " \" allergen\" : {\n " +
175
+ " \" allergenType\" : \" DRUG\" ,\n " +
176
+ " \" codedAllergen\" : {\n " +
177
+ " \" uuid\" : \" 71617AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\" \n " +
178
+ " }\n " +
179
+ " },\n " +
180
+ " \" severity\" : {\n " +
181
+ " \" uuid\" : \" 1498AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\" \n " +
182
+ " },\n " +
183
+ " \" comment\" : \" test\" ,\n " +
184
+ " \" reactions\" : [\n " +
185
+ " {\n " +
186
+ " \" reaction\" : {\n " +
187
+ " \" uuid\" : \" 121677AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\" \n " +
188
+ " }\n " +
189
+ " }\n " +
190
+ " ]\n " +
191
+ "}" ;
192
+
193
+ return http ("Save Allergies of Patient" )
194
+ .get ("/openmrs/ws/rest/v1/patient/" + patientUuid +"/allergy" )
195
+ .body (StringBody (payload ));
196
+
197
+
198
+ }
156
199
157
200
public HttpRequestActionBuilder getConditions (String patientUuid ) {
158
201
return http ("Get Conditions of Patient" )
0 commit comments