Skip to content

Commit daa3003

Browse files
authored
O3-4632: Changing the request calls for medication orders (#99)
* O3-4632: Changing the request calls for medication orders * O3-4632: Changing the request calls for medication orders * Formatting changes * Formatting changes
1 parent 7b88bdf commit daa3003

File tree

2 files changed

+27
-15
lines changed

2 files changed

+27
-15
lines changed

src/test/java/org/openmrs/performance/http/DoctorHttpService.java

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -145,22 +145,32 @@ public HttpRequestActionBuilder getAllActiveOrders(String patientUuid) {
145145
"/openmrs/ws/rest/v1/order?patient=" + patientUuid + "&careSetting=" + CARE_SETTING_UUID + "&status=ACTIVE");
146146
}
147147

148-
public HttpRequestActionBuilder getDrugOrders(String patientUuid) {
148+
public HttpRequestActionBuilder getDrugOrdersExceptCancelledAndExpired(String patientUuid) {
149149
String customRepresentation = """
150-
custom:(uuid,dosingType,orderNumber,accessionNumber,
151-
patient:ref,action,careSetting:ref,previousOrder:ref,dateActivated,scheduledDate,dateStopped,autoExpireDate,
152-
orderType:ref,encounter:ref,
153-
orderer:(uuid,display,person:(display)),
154-
orderReason,orderReasonNonCoded,orderType,urgency,instructions,
155-
commentToFulfiller,
156-
drug:(uuid,display,strength,
157-
dosageForm:(display,uuid),concept),
158-
dose,doseUnits:ref,
159-
frequency:ref,asNeeded,asNeededCondition,quantity,quantityUnits:ref,numRefills,dosingInstructions,
160-
duration,durationUnits:ref,route:ref,brandName,dispenseAsWritten)
150+
custom:(uuid,dosingType,orderNumber,accessionNumber,patient:ref,action,careSetting:ref,
151+
previousOrder:ref,dateActivated,scheduledDate,dateStopped,autoExpireDate,orderType:ref,
152+
encounter:ref,orderer:(uuid,display,person:(display)),orderReason,orderReasonNonCoded,
153+
orderType,urgency,instructions,commentToFulfiller,drug:(uuid,display,strength,dosageForm:(display,uuid),concept),
154+
dose,doseUnits:ref,frequency:ref,asNeeded,asNeededCondition,quantity,quantityUnits:ref,
155+
numRefills,dosingInstructions,duration,durationUnits:ref,route:ref,brandName,dispenseAsWritten)
161156
""";
162-
return http("Get Orders").get("/openmrs/ws/rest/v1/order" + "?patient=" + patientUuid + "&careSetting="
163-
+ CARE_SETTING_UUID + "&status=any&orderType=" + DRUG_ORDER + "&v=" + customRepresentation);
157+
return http("Get Drug Orders except the cancelled and expired").get(
158+
"/openmrs/ws/rest/v1/order" + "?patient=" + patientUuid + "&careSetting=" + CARE_SETTING_UUID
159+
+ "&status=any&orderType=" + DRUG_ORDER + "&excludeCanceledAndExpired=true&v=" + customRepresentation);
160+
}
161+
162+
public HttpRequestActionBuilder getDrugOrdersExceptDiscontinuedOrders(String patientUuid) {
163+
String customRepresentation = """
164+
custom:(uuid,dosingType,orderNumber,accessionNumber,patient:ref,action,careSetting:ref,
165+
previousOrder:ref,dateActivated,scheduledDate,dateStopped,autoExpireDate,orderType:ref,
166+
encounter:ref,orderer:(uuid,display,person:(display)),orderReason,orderReasonNonCoded,
167+
orderType,urgency,instructions,commentToFulfiller,drug:(uuid,display,strength,dosageForm:(display,uuid),concept),
168+
dose,doseUnits:ref,frequency:ref,asNeeded,asNeededCondition,quantity,quantityUnits:ref,
169+
numRefills,dosingInstructions,duration,durationUnits:ref,route:ref,brandName,dispenseAsWritten)
170+
""";
171+
return http("Get Drug Orders except the discontinued orders").get("/openmrs/ws/rest/v1/order" + "?patient="
172+
+ patientUuid + "&careSetting=" + CARE_SETTING_UUID + "&status=any&orderType=" + DRUG_ORDER + "&v="
173+
+ customRepresentation + "&excludeDiscontinueOrders=true");
164174
}
165175

166176
public HttpRequestActionBuilder getAllergies(String patientUuid) {

src/test/java/org/openmrs/performance/registries/DoctorRegistry.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,9 @@ public ChainBuilder recordVitals(String patientUuid) {
6868
}
6969

7070
public ChainBuilder openMedicationsTab(String patientUuid) {
71-
return exec(httpService.getDrugOrders(patientUuid));
71+
return exec(httpService.getDrugOrdersExceptCancelledAndExpired(patientUuid))
72+
.exec(httpService.getDrugOrdersExceptDiscontinuedOrders(patientUuid))
73+
.exec(httpService.getActiveVisitOfPatient(patientUuid));
7274
}
7375

7476
public ChainBuilder openOrdersTab(String patientUuid) {

0 commit comments

Comments
 (0)