use of org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.CANCELLED in project redmatch by aehrc.
the class RedmatchApi method export.
/**
* Exports the generated FHIR resources that result from running a Redmatch rules document.
*
* @param redmatchRulesFile The Redmatch rules document.
* @param progressReporter An object used to report progress. Can be null.
* @param cancelToken Used to check if the user has cancelled the operation.
* @return List of diagnostic messages.
*/
public List<Diagnostic> export(@NotNull File redmatchRulesFile, ProgressReporter progressReporter, CancelChecker cancelToken) {
try {
Pair<Map<String, DomainResource>, List<Diagnostic>> data = transform(redmatchRulesFile, progressReporter, cancelToken);
// If the resource map is empty then something went wrong or the operation was cancelled by the user
if (data.getValue0().isEmpty()) {
return data.getValue1();
}
Map<String, DomainResource> resourceMap = data.getValue0();
// Group resources by type
final Map<String, List<DomainResource>> grouped = new HashMap<>();
for (String key : resourceMap.keySet()) {
DomainResource dr = resourceMap.get(key);
String resourceType = dr.getResourceType().toString();
List<DomainResource> list = grouped.computeIfAbsent(resourceType, k -> new ArrayList<>());
list.add(dr);
}
File baseFolder = redmatchRulesFile.toPath().getParent().toFile();
Path outputFolder = createOutputFolder(baseFolder).toPath();
save(grouped, outputFolder, progressReporter, cancelToken);
return data.getValue1();
} catch (Exception e) {
log.error(e);
return List.of(new Diagnostic(zeroZero, "Could not complete transformation:" + e.getLocalizedMessage(), DiagnosticSeverity.Error, "API"));
}
}
use of org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.CANCELLED in project org.hl7.fhir.core by hapifhir.
the class ImagingStudy30_40 method convertImagingStudy.
public static org.hl7.fhir.dstu3.model.ImagingStudy convertImagingStudy(org.hl7.fhir.r4.model.ImagingStudy src) throws FHIRException {
if (src == null)
return null;
org.hl7.fhir.dstu3.model.ImagingStudy tgt = new org.hl7.fhir.dstu3.model.ImagingStudy();
ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyDomainResource(src, tgt);
for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) {
if (URN_DICOM_UID.equals(t.getSystem())) {
tgt.setUid(t.getValue());
} else {
tgt.addIdentifier(Identifier30_40.convertIdentifier(t));
}
}
if (src.hasStatus()) {
org.hl7.fhir.r4.model.ImagingStudy.ImagingStudyStatus s = src.getStatus();
switch(s) {
case REGISTERED:
tgt.setAvailability(org.hl7.fhir.dstu3.model.ImagingStudy.InstanceAvailability.OFFLINE);
break;
case AVAILABLE:
tgt.setAvailability(org.hl7.fhir.dstu3.model.ImagingStudy.InstanceAvailability.ONLINE);
break;
case CANCELLED:
tgt.setAvailability(org.hl7.fhir.dstu3.model.ImagingStudy.InstanceAvailability.UNAVAILABLE);
break;
default:
break;
}
}
for (org.hl7.fhir.r4.model.Coding t : src.getModality()) {
tgt.addModalityList(Coding30_40.convertCoding(t));
}
if (src.hasSubject()) {
if (src.hasSubject())
tgt.setPatient(Reference30_40.convertReference(src.getSubject()));
}
if (src.hasEncounter()) {
if (src.hasEncounter())
tgt.setContext(Reference30_40.convertReference(src.getEncounter()));
}
if (src.hasStarted()) {
if (src.hasStartedElement())
tgt.setStartedElement(DateTime30_40.convertDateTime(src.getStartedElement()));
}
for (org.hl7.fhir.r4.model.Reference t : src.getBasedOn()) {
tgt.addBasedOn(Reference30_40.convertReference(t));
}
if (src.hasReferrer()) {
if (src.hasReferrer())
tgt.setReferrer(Reference30_40.convertReference(src.getReferrer()));
}
for (org.hl7.fhir.r4.model.Reference t : src.getInterpreter()) {
tgt.addInterpreter(Reference30_40.convertReference(t));
}
for (org.hl7.fhir.r4.model.Reference t : src.getEndpoint()) {
tgt.addEndpoint(Reference30_40.convertReference(t));
}
if (src.hasNumberOfSeries()) {
if (src.hasNumberOfSeriesElement())
tgt.setNumberOfSeriesElement(UnsignedInt30_40.convertUnsignedInt(src.getNumberOfSeriesElement()));
}
if (src.hasNumberOfInstances()) {
if (src.hasNumberOfInstancesElement())
tgt.setNumberOfInstancesElement(UnsignedInt30_40.convertUnsignedInt(src.getNumberOfInstancesElement()));
}
if (src.hasProcedureReference()) {
if (src.hasProcedureReference())
tgt.addProcedureReference(Reference30_40.convertReference(src.getProcedureReference()));
}
for (org.hl7.fhir.r4.model.CodeableConcept t : src.getProcedureCode()) {
tgt.addProcedureCode(CodeableConcept30_40.convertCodeableConcept(t));
}
List<CodeableConcept> reasonCodes = src.getReasonCode();
if (reasonCodes.size() > 0) {
tgt.setReason(CodeableConcept30_40.convertCodeableConcept(reasonCodes.get(0)));
if (reasonCodes.size() > 1) {
}
}
if (src.hasDescription()) {
if (src.hasDescriptionElement())
tgt.setDescriptionElement(String30_40.convertString(src.getDescriptionElement()));
}
for (org.hl7.fhir.r4.model.ImagingStudy.ImagingStudySeriesComponent t : src.getSeries()) {
tgt.addSeries(convertImagingStudySeriesComponent(t));
}
return tgt;
}
use of org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.CANCELLED in project org.hl7.fhir.core by hapifhir.
the class MedicationDispense40_50 method convertMedicationStatus.
private static org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.MedicationDispense.MedicationDispenseStatusCodes> convertMedicationStatus(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.MedicationDispense.MedicationDispenseStatus> src) {
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());
ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
switch(src.getValue()) {
case CANCELLED:
tgt.setValue(org.hl7.fhir.r5.model.MedicationDispense.MedicationDispenseStatusCodes.CANCELLED);
break;
case COMPLETED:
tgt.setValue(org.hl7.fhir.r5.model.MedicationDispense.MedicationDispenseStatusCodes.COMPLETED);
break;
case DECLINED:
tgt.setValue(org.hl7.fhir.r5.model.MedicationDispense.MedicationDispenseStatusCodes.DECLINED);
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 PREPARATION:
tgt.setValue(org.hl7.fhir.r5.model.MedicationDispense.MedicationDispenseStatusCodes.PREPARATION);
break;
case STOPPED:
tgt.setValue(org.hl7.fhir.r5.model.MedicationDispense.MedicationDispenseStatusCodes.STOPPED);
break;
case UNKNOWN:
tgt.setValue(org.hl7.fhir.r5.model.MedicationDispense.MedicationDispenseStatusCodes.UNKNOWN);
break;
}
return tgt;
}
Aggregations