Skip to content

Commit

Permalink
FM2-312: Addressing requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruhanga committed Dec 14, 2020
1 parent 0d686a0 commit 3c4f9dd
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ protected void setupSearchParams(Criteria criteria, SearchParameterMap theParams
entry.getValue().forEach(d -> handleMedicationReference("d", (ReferenceAndListParam) d.getParam())
.ifPresent(c -> criteria.createAlias("drug", "d").add(c)));
break;
case FhirConstants.COMMON_SEARCH_HANDLER:
handleCommonSearchParameters(entry.getValue()).ifPresent(criteria::add);
break;
case FhirConstants.IDENTIFIER:
entry.getValue().forEach(orderNumber -> handleOrderNumber((TokenAndListParam) orderNumber.getParam())
.ifPresent(criteria::add));
break;
case FhirConstants.COMMON_SEARCH_HANDLER:
handleCommonSearchParameters(entry.getValue()).ifPresent(criteria::add);
break;
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ protected void setupSearchParams(Criteria criteria, SearchParameterMap theParams
entry.getValue().forEach(dateRangeParam -> handleDateRange((DateRangeParam) dateRangeParam.getParam())
.ifPresent(criteria::add));
break;
case FhirConstants.COMMON_SEARCH_HANDLER:
handleCommonSearchParameters(entry.getValue()).ifPresent(criteria::add);
break;
case FhirConstants.IDENTIFIER:
entry.getValue().forEach(orderNumber -> handleOrderNumber((TokenAndListParam) orderNumber.getParam())
.ifPresent(criteria::add));
break;
case FhirConstants.COMMON_SEARCH_HANDLER:
handleCommonSearchParameters(entry.getValue()).ifPresent(criteria::add);
break;
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,5 @@ public Identifier toFhirResource(@Nonnull Order order) {
public Order toOpenmrsType(Identifier resource) {
throw new InvalidRequestException("Order Identifier cannot be manualy set");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public ServiceRequest toFhirResource(@Nonnull TestOrder order) {
ServiceRequest serviceRequest = new ServiceRequest();

serviceRequest.setId(order.getUuid());

if (order.getOrderNumber() != null) {
serviceRequest.addIdentifier(orderIdentifierTranslator.toFhirResource(order));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ public class MedicationRequestTranslatorImplTest {

private static final String PRIOR_MEDICATION_REQUEST_REFERENCE = FhirConstants.MEDICATION + "/" + DRUG_ORDER_UUID;

private static final String DRUG_ORDER_NUMBER = "ORD-1";

private static final String DRUG_UUID = "99fdc8ad-fe4d-499b-93a8-8a991c1d477g";

private static final String CONCEPT_UUID = "33fdc8ad-fe4d-499b-93a8-8a991c1d488g";
Expand All @@ -79,6 +77,12 @@ public class MedicationRequestTranslatorImplTest {

private static final String DOSING_INSTRUCTIONS = "Dosing instructions";

private static final String IDENTIFIER_SYSTEM = "http://terminology.hl7.org/CodeSystem/v2-0203";

private static final String IDENTIFIER_CODE = "PLAC";

private static final String IDENTIFIER_DISPLAY = "Placer Identifier";

@Mock
private PractitionerReferenceTranslator<Provider> providerPractitionerReferenceTranslator;

Expand Down Expand Up @@ -156,6 +160,10 @@ public void toFhirResource_shouldTranslateToFhirResource() {
assertThat(result.getId(), notNullValue());
assertThat(result.getId(), equalTo(DRUG_ORDER_UUID));
assertThat(result.getIdentifier().get(0).getValue(), equalTo(DRUG_ORDER_NUMBER));
assertThat(result.getIdentifier().get(0).getType().getCoding().get(0).getSystem(), equalTo(IDENTIFIER_SYSTEM));
assertThat(result.getIdentifier().get(0).getType().getCoding().get(0).getCode(), equalTo(IDENTIFIER_CODE));
assertThat(result.getIdentifier().get(0).getType().getCoding().get(0).getDisplay(), equalTo(IDENTIFIER_DISPLAY));
assertThat(result.getIdentifier().get(0).getUse().getDisplay(), equalTo("Usual"));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ public class ServiceRequestTranslatorImplTest {

private static final String PRIOR_SERVICE_REQUEST_REFERENCE = FhirConstants.SERVICE_REQUEST + "/" + SERVICE_REQUEST_UUID;

private static final String TEST_ORDER_NUMBER = "ORD-1";

private static final String LOINC_CODE = "1000-1";

private static final String PATIENT_UUID = "14d4f066-15f5-102d-96e4-000c29c2a5d7";
Expand All @@ -85,6 +83,12 @@ public class ServiceRequestTranslatorImplTest {

private static final int COUNT = 1;

private static final String IDENTIFIER_SYSTEM = "http://terminology.hl7.org/CodeSystem/v2-0203";

private static final String IDENTIFIER_CODE = "PLAC";

private static final String IDENTIFIER_DISPLAY = "Placer Identifier";

private ServiceRequestTranslatorImpl translator;

@Mock
Expand Down Expand Up @@ -515,6 +519,10 @@ public void toFhirResource_shouldTranslateOrderNumber() {

assertThat(result, notNullValue());
assertThat(result.getValue(), containsString(TEST_ORDER_NUMBER));
assertThat(result.getType().getCoding().get(0).getSystem(), equalTo(IDENTIFIER_SYSTEM));
assertThat(result.getType().getCoding().get(0).getCode(), equalTo(IDENTIFIER_CODE));
assertThat(result.getType().getCoding().get(0).getDisplay(), equalTo(IDENTIFIER_DISPLAY));
assertThat(result.getUse().getDisplay(), equalTo("Usual"));
}

private List<Task> setUpBasedOnScenario(Task.TaskStatus status) {
Expand Down

0 comments on commit 3c4f9dd

Please sign in to comment.