use of org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.ENTEREDINERROR in project org.hl7.fhir.core by hapifhir.
the class MedicationKnowledge40_50 method convertMedicationKnowledgeStatus.
private static org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeStatusCodes> convertMedicationKnowledgeStatus(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.MedicationKnowledge.MedicationKnowledgeStatus> src) {
if (src == null)
return null;
org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeStatusCodes> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new MedicationKnowledgeStatusCodesEnumFactory());
ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
switch(src.getValue()) {
case ACTIVE:
tgt.setValue(org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeStatusCodes.ACTIVE);
break;
case ENTEREDINERROR:
tgt.setValue(org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeStatusCodes.ENTEREDINERROR);
break;
case INACTIVE:
tgt.setValue(org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeStatusCodes.INACTIVE);
break;
case NULL:
tgt.setValue(org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeStatusCodes.NULL);
break;
}
return tgt;
}
use of org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.ENTEREDINERROR in project BridgeServer2 by Sage-Bionetworks.
the class CRCControllerTest method postAppointmentMistakeRollsBackAccount.
@Test
public void postAppointmentMistakeRollsBackAccount() throws Exception {
when(mockRequest.getHeader(AUTHORIZATION)).thenReturn(AUTHORIZATION_HEADER_VALUE);
when(mockAccountService.authenticate(any(), any())).thenReturn(account);
when(mockAccountService.getAccount(ACCOUNT_ID)).thenReturn(Optional.of(account));
Appointment appointment = new Appointment();
appointment.setStatus(ENTEREDINERROR);
addAppointmentParticipantComponent(appointment, LOCATION_NS + "foo");
addAppointmentSageId(appointment, TEST_USER_ID);
String json = FHIR_CONTEXT.newJsonParser().encodeResourceToString(appointment);
mockRequestBody(mockRequest, json);
ResponseEntity<StatusMessage> retValue = controller.postAppointment();
assertEquals(retValue.getBody().getMessage(), "Appointment deleted.");
assertEquals(retValue.getStatusCodeValue(), 200);
assertTrue(account.getDataGroups().contains("selected"));
verify(mockAccountService).updateAccount(account);
verify(mockReportService).deleteParticipantReportRecord(APP_ID, TEST_USER_ID, APPOINTMENT_REPORT, JAN1.toString(), HEALTH_CODE);
}
use of org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.ENTEREDINERROR in project hl7v2-fhir-converter by LinuxForHealth.
the class Hl7MedicationRequestFHIRConversionTest method test_medicationreq_status.
@Test
void test_medicationreq_status() {
// ORC.5 = A -> Expected medication status = (ACTIVE ORC.1 is present but ORC.5 takes precedence)
String hl7message = "MSH|^~\\&|APP|FAC|WHIA|IBM|20180622230000||RDE^O11^RDE_O11|MSGID221xx0xcnvMed31|T|2.6\n" + "PID|||1234^^^^MR||DOE^JANE^|||F||||||||||||||||||||||\n" + "ORC|NW|F800006^OE|P800006^RX||A|E|10^BID^D4^^^R||20180622230000\n" + "RXO|RX800006^Test15 SODIUM 100 MG CAPSULE|100||mg|||||G||10||5\n" + "RXE|^^^20180622230000^^R|62756-017^Testosterone Cypionate^NDC|100||mg|||||10||5\n";
List<BundleEntryComponent> e = ResourceUtils.createFHIRBundleFromHL7MessageReturnEntryList(ftv, hl7message);
List<Resource> medicationRequestList = ResourceUtils.getResourceList(e, ResourceType.MedicationRequest);
assertThat(medicationRequestList).hasSize(1);
MedicationRequest medicationRequest = ResourceUtils.getResourceMedicationRequest(medicationRequestList.get(0), ResourceUtils.context);
assertThat(medicationRequest.getStatus()).isEqualTo(MedicationRequestStatus.ACTIVE);
// ORC.5 = CM -> Expected medication status = COMPLETED (ORC.1 is present but ORC.5 takes precedence)
hl7message = "MSH|^~\\&|APP|FAC|WHIA|IBM|20180622230000||RDE^O11^RDE_O11|MSGID221xx0xcnvMed31|T|2.6\n" + "PID|||1234^^^^MR||DOE^JANE^|||F||||||||||||||||||||||\n" + "ORC|NW|F800006^OE|P800006^RX||CM|E|10^BID^D4^^^R||20180622230000\n" + "RXO|RX800006^Test15 SODIUM 100 MG CAPSULE|100||mg|||||G||10||5\n" + "RXE|^^^20180622230000^^R|62756-017^Testosterone Cypionate^NDC|100||mg|||||10||5\n";
e = ResourceUtils.createFHIRBundleFromHL7MessageReturnEntryList(ftv, hl7message);
medicationRequestList.clear();
medicationRequestList = ResourceUtils.getResourceList(e, ResourceType.MedicationRequest);
assertThat(medicationRequestList).hasSize(1);
medicationRequest = ResourceUtils.getResourceMedicationRequest(medicationRequestList.get(0), ResourceUtils.context);
assertThat(medicationRequest.getStatus()).isEqualTo(MedicationRequestStatus.COMPLETED);
// ORC.5 = ER -> Expected medication status = ENTEREDINERROR (ORC.1 is present but ORC.5 takes precedence)
hl7message = "MSH|^~\\&|APP|FAC|WHIA|IBM|20180622230000||RDE^O11^RDE_O11|MSGID221xx0xcnvMed31|T|2.6\n" + "PID|||1234^^^^MR||DOE^JANE^|||F||||||||||||||||||||||\n" + "ORC|NW|F800006^OE|P800006^RX||ER|E|10^BID^D4^^^R||20180622230000\n" + "RXO|RX800006^Test15 SODIUM 100 MG CAPSULE|100||mg|||||G||10||5\n" + "RXE|^^^20180622230000^^R|62756-017^Testosterone Cypionate^NDC|100||mg|||||10||5\n";
e = ResourceUtils.createFHIRBundleFromHL7MessageReturnEntryList(ftv, hl7message);
medicationRequestList.clear();
medicationRequestList = ResourceUtils.getResourceList(e, ResourceType.MedicationRequest);
assertThat(medicationRequestList).hasSize(1);
medicationRequest = ResourceUtils.getResourceMedicationRequest(medicationRequestList.get(0), ResourceUtils.context);
assertThat(medicationRequest.getStatus()).isEqualTo(MedicationRequestStatus.ENTEREDINERROR);
// ORC.1 = NW -> Expected medication status = ACTIVE (Missing ORC.5 so ORC.1 takes precedence)
hl7message = "MSH|^~\\&|APP|FAC|WHIA|IBM|20180622230000||RDE^O11^RDE_O11|MSGID221xx0xcnvMed31|T|2.6\n" + "PID|||1234^^^^MR||DOE^JANE^|||F||||||||||||||||||||||\n" + "ORC|NW|F800006^OE|P800006^RX|||E|10^BID^D4^^^R||20180622230000\n" + "RXO|RX800006^Test15 SODIUM 100 MG CAPSULE|100||mg|||||G||10||5\n" + "RXE|^^^20180622230000^^R|62756-017^Testosterone Cypionate^NDC|100||mg|||||10||5\n";
e = ResourceUtils.createFHIRBundleFromHL7MessageReturnEntryList(ftv, hl7message);
medicationRequestList.clear();
medicationRequestList = ResourceUtils.getResourceList(e, ResourceType.MedicationRequest);
assertThat(medicationRequestList).hasSize(1);
medicationRequest = ResourceUtils.getResourceMedicationRequest(medicationRequestList.get(0), ResourceUtils.context);
assertThat(medicationRequest.getStatus()).isEqualTo(MedicationRequestStatus.ACTIVE);
// ORC.1 = RP -> Expected medication status = UNKNOWN (Missing ORC.5 so ORC.1 takes precedence)
hl7message = "MSH|^~\\&|APP|FAC|WHIA|IBM|20180622230000||RDE^O11^RDE_O11|MSGID221xx0xcnvMed31|T|2.6\n" + "PID|||1234^^^^MR||DOE^JANE^|||F||||||||||||||||||||||\n" + "ORC|RP|F800006^OE|P800006^RX|||E|10^BID^D4^^^R||20180622230000\n" + "RXO|RX800006^Test15 SODIUM 100 MG CAPSULE|100||mg|||||G||10||5\n" + "RXE|^^^20180622230000^^R|62756-017^Testosterone Cypionate^NDC|100||mg|||||10||5\n";
e = ResourceUtils.createFHIRBundleFromHL7MessageReturnEntryList(ftv, hl7message);
medicationRequestList.clear();
medicationRequestList = ResourceUtils.getResourceList(e, ResourceType.MedicationRequest);
assertThat(medicationRequestList).hasSize(1);
medicationRequest = ResourceUtils.getResourceMedicationRequest(medicationRequestList.get(0), ResourceUtils.context);
assertThat(medicationRequest.getStatus()).isEqualTo(MedicationRequestStatus.UNKNOWN);
// ORC.1 = DC -> Expected medication status = STOPPED (Missing ORC.5 so ORC.1 takes precedence)
hl7message = "MSH|^~\\&|APP|FAC|WHIA|IBM|20180622230000||RDE^O11^RDE_O11|MSGID221xx0xcnvMed31|T|2.6\n" + "PID|||1234^^^^MR||DOE^JANE^|||F||||||||||||||||||||||\n" + "ORC|DC|F800006^OE|P800006^RX|||E|10^BID^D4^^^R||20180622230000\n" + "RXO|RX800006^Test15 SODIUM 100 MG CAPSULE|100||mg|||||G||10||5\n" + "RXE|^^^20180622230000^^R|62756-017^Testosterone Cypionate^NDC|100||mg|||||10||5\n";
e = ResourceUtils.createFHIRBundleFromHL7MessageReturnEntryList(ftv, hl7message);
medicationRequestList.clear();
medicationRequestList = ResourceUtils.getResourceList(e, ResourceType.MedicationRequest);
assertThat(medicationRequestList).hasSize(1);
medicationRequest = ResourceUtils.getResourceMedicationRequest(medicationRequestList.get(0), ResourceUtils.context);
assertThat(medicationRequest.getStatus()).isEqualTo(MedicationRequestStatus.STOPPED);
// Test that RDE_O11 messages don't create ServiceRequests
List<Resource> serviceRequestList = e.stream().filter(v -> ResourceType.ServiceRequest == v.getResource().getResourceType()).map(BundleEntryComponent::getResource).collect(Collectors.toList());
// Confirm that a serviceRequest was not created.
assertThat(serviceRequestList).isEmpty();
// ORC.1 = CA -> Expected medication status = CANCELLED (Missing ORC.5 so ORC.1 takes precedence)
hl7message = "MSH|^~\\&|APP|FAC|WHIA|IBM|20180622230000||RDE^O11^RDE_O11|MSGID221xx0xcnvMed31|T|2.6\n" + "PID|||1234^^^^MR||DOE^JANE^|||F||||||||||||||||||||||\n" + "PV1||I|6N^1234^A^GENHOS||||0100^ANDERSON,CARL|0148^ADDISON,JAMES||SUR|||||||0100^ANDERSON,CARL|S|V446911|A|||||||||||||||||||SF|K||||20180622230000\n" + "ORC|CA|F800006^OE|P800006^RX|||E|10^BID^D4^^^R||20180622230000\n" + "RXO|RX800006^Test15 SODIUM 100 MG CAPSULE|100||mg|||||G||10||5\n" + "RXE|^^^20180622230000^^R|62756-017^Testosterone Cypionate^NDC|100||mg|||||10||5\n";
e = ResourceUtils.createFHIRBundleFromHL7MessageReturnEntryList(ftv, hl7message);
medicationRequestList.clear();
medicationRequestList = ResourceUtils.getResourceList(e, ResourceType.MedicationRequest);
assertThat(medicationRequestList).hasSize(1);
medicationRequest = ResourceUtils.getResourceMedicationRequest(medicationRequestList.get(0), ResourceUtils.context);
assertThat(medicationRequest.getStatus()).isEqualTo(MedicationRequestStatus.CANCELLED);
// Test that RDE_O11 messages don't create ServiceRequests
serviceRequestList.clear();
serviceRequestList = e.stream().filter(v -> ResourceType.ServiceRequest == v.getResource().getResourceType()).map(BundleEntryComponent::getResource).collect(Collectors.toList());
// Confirm that a serviceRequest was not created.
assertThat(serviceRequestList).isEmpty();
}
use of org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.ENTEREDINERROR in project BridgeServer2 by Sage-Bionetworks.
the class CRCController method postAppointment.
@PutMapping("/v1/cuimc/appointments")
public ResponseEntity<StatusMessage> postAppointment() {
App app = httpBasicAuthentication();
IParser parser = FHIR_CONTEXT.newJsonParser();
JsonNode data = parseJson(JsonNode.class);
Appointment appointment = parser.parseResource(Appointment.class, data.toString());
String userId = findUserId(appointment);
// They send appointment when it is booked, cancelled, or (rarely) enteredinerror.
AccountStates state = TESTS_SCHEDULED;
String apptStatus = data.get("status").asText();
if ("entered-in-error".equals(apptStatus)) {
deleteReportAndUpdateState(app, userId);
return ResponseEntity.ok(new StatusMessage("Appointment deleted."));
} else if ("cancelled".equals(apptStatus)) {
state = TESTS_CANCELLED;
}
// Columbia wants us to call back to them to get information about the location.
// And UI team wants geocoding of location to render a map.
String locationString = findLocation(appointment);
if (locationString != null) {
AccountId accountId = parseAccountId(app.getIdentifier(), userId);
Account account = accountService.getAccount(accountId).orElseThrow(() -> new EntityNotFoundException(Account.class));
addLocation(data, account, locationString);
}
int status = writeReportAndUpdateState(app, userId, data, APPOINTMENT_REPORT, state, true);
if (status == 200) {
return ResponseEntity.ok(new StatusMessage("Appointment updated (status = " + apptStatus + ")."));
}
return ResponseEntity.created(URI.create("/v1/cuimc/appointments/" + userId)).body(new StatusMessage("Appointment created (status = " + apptStatus + ")."));
}
use of org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.ENTEREDINERROR in project org.hl7.fhir.core by hapifhir.
the class MedicationDispense10_50 method convertMedicationDispenseStatus.
public static org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.MedicationDispense.MedicationDispenseStatusCodes> convertMedicationDispenseStatus(org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.MedicationDispense.MedicationDispenseStatus> src) throws FHIRException {
if (src == null)
return null;
org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.MedicationDispense.MedicationDispenseStatusCodes> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new MedicationDispenseStatusCodesEnumFactory());
ConversionContext10_50.INSTANCE.getVersionConvertor_10_50().copyElement(src, tgt);
switch(src.getValue()) {
case COMPLETED:
tgt.setValue(org.hl7.fhir.r5.model.MedicationDispense.MedicationDispenseStatusCodes.COMPLETED);
break;
case ENTEREDINERROR:
tgt.setValue(org.hl7.fhir.r5.model.MedicationDispense.MedicationDispenseStatusCodes.ENTEREDINERROR);
break;
case INPROGRESS:
tgt.setValue(org.hl7.fhir.r5.model.MedicationDispense.MedicationDispenseStatusCodes.INPROGRESS);
break;
case NULL:
tgt.setValue(org.hl7.fhir.r5.model.MedicationDispense.MedicationDispenseStatusCodes.NULL);
break;
case ONHOLD:
tgt.setValue(org.hl7.fhir.r5.model.MedicationDispense.MedicationDispenseStatusCodes.ONHOLD);
break;
case STOPPED:
tgt.setValue(org.hl7.fhir.r5.model.MedicationDispense.MedicationDispenseStatusCodes.STOPPED);
break;
}
return tgt;
}
Aggregations