use of org.hl7.fhir.r4.model.MedicationStatement in project odm2fhir by num-codex.
the class COVID19Therapy method createMedicationStatement.
private MedicationStatement createMedicationStatement(ItemData specificCoding, ItemData accurateCodingOrText, ItemData dateCoding) {
var medicationStatement = (MedicationStatement) new MedicationStatement().addIdentifier(createIdentifier(MEDICATIONSTATEMENT, specificCoding)).setEffective(createDateTimeType(dateCoding)).setMeta(createMeta(PHARMACOLOGICAL_THERAPY));
var medicationCodeableConcept = new CodeableConcept();
for (var coding : createCodings(specificCoding)) {
switch(coding.getCode()) {
case "410605003":
medicationStatement.setStatus(MedicationStatementStatus.ACTIVE);
break;
case "410594000":
medicationStatement.setStatus(NOTTAKEN);
break;
case "261665006":
medicationStatement.setStatus(MedicationStatementStatus.UNKNOWN);
break;
case // Answer = Sonstige/Other
"385432009":
medicationCodeableConcept.addCoding(coding.setDisplay("Not applicable (qualifier value)"));
if (endsWith(accurateCodingOrText.getItemOID(), "_textfeld") && !accurateCodingOrText.isEmpty()) {
medicationCodeableConcept.setText(accurateCodingOrText.getValue());
}
break;
default:
// add Medication Codes
if (accurateCodingOrText.isEmpty()) {
medicationCodeableConcept.addCoding(coding);
}
break;
}
}
// insert coding of used medication
if (!accurateCodingOrText.isEmpty() && endsWith(accurateCodingOrText.getItemOID(), "_code")) {
for (var coding : createCodings(accurateCodingOrText)) {
medicationCodeableConcept.addCoding(coding);
}
}
return medicationCodeableConcept.isEmpty() ? new MedicationStatement() : medicationStatement.setMedication(medicationCodeableConcept);
}
use of org.hl7.fhir.r4.model.MedicationStatement in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeMedicationStatement.
protected void composeMedicationStatement(Complex parent, String parentType, String name, MedicationStatement element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeDomainResource(t, "MedicationStatement", name, element, index);
for (int i = 0; i < element.getIdentifier().size(); i++) composeIdentifier(t, "MedicationStatement", "identifier", element.getIdentifier().get(i), i);
for (int i = 0; i < element.getBasedOn().size(); i++) composeReference(t, "MedicationStatement", "basedOn", element.getBasedOn().get(i), i);
for (int i = 0; i < element.getPartOf().size(); i++) composeReference(t, "MedicationStatement", "partOf", element.getPartOf().get(i), i);
if (element.hasContext())
composeReference(t, "MedicationStatement", "context", element.getContext(), -1);
if (element.hasStatusElement())
composeEnum(t, "MedicationStatement", "status", element.getStatusElement(), -1);
if (element.hasCategory())
composeCodeableConcept(t, "MedicationStatement", "category", element.getCategory(), -1);
if (element.hasMedication())
composeType(t, "MedicationStatement", "medication", element.getMedication(), -1);
if (element.hasEffective())
composeType(t, "MedicationStatement", "effective", element.getEffective(), -1);
if (element.hasDateAssertedElement())
composeDateTime(t, "MedicationStatement", "dateAsserted", element.getDateAssertedElement(), -1);
if (element.hasInformationSource())
composeReference(t, "MedicationStatement", "informationSource", element.getInformationSource(), -1);
if (element.hasSubject())
composeReference(t, "MedicationStatement", "subject", element.getSubject(), -1);
for (int i = 0; i < element.getDerivedFrom().size(); i++) composeReference(t, "MedicationStatement", "derivedFrom", element.getDerivedFrom().get(i), i);
if (element.hasTakenElement())
composeEnum(t, "MedicationStatement", "taken", element.getTakenElement(), -1);
for (int i = 0; i < element.getReasonNotTaken().size(); i++) composeCodeableConcept(t, "MedicationStatement", "reasonNotTaken", element.getReasonNotTaken().get(i), i);
for (int i = 0; i < element.getReasonCode().size(); i++) composeCodeableConcept(t, "MedicationStatement", "reasonCode", element.getReasonCode().get(i), i);
for (int i = 0; i < element.getReasonReference().size(); i++) composeReference(t, "MedicationStatement", "reasonReference", element.getReasonReference().get(i), i);
for (int i = 0; i < element.getNote().size(); i++) composeAnnotation(t, "MedicationStatement", "note", element.getNote().get(i), i);
for (int i = 0; i < element.getDosage().size(); i++) composeDosage(t, "MedicationStatement", "dosage", element.getDosage().get(i), i);
}
use of org.hl7.fhir.r4.model.MedicationStatement in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeMedicationStatement.
protected void composeMedicationStatement(Complex parent, String parentType, String name, MedicationStatement element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeDomainResource(t, "MedicationStatement", name, element, index);
for (int i = 0; i < element.getIdentifier().size(); i++) composeIdentifier(t, "MedicationStatement", "identifier", element.getIdentifier().get(i), i);
for (int i = 0; i < element.getBasedOn().size(); i++) composeReference(t, "MedicationStatement", "basedOn", element.getBasedOn().get(i), i);
for (int i = 0; i < element.getPartOf().size(); i++) composeReference(t, "MedicationStatement", "partOf", element.getPartOf().get(i), i);
if (element.hasStatusElement())
composeEnum(t, "MedicationStatement", "status", element.getStatusElement(), -1);
for (int i = 0; i < element.getStatusReason().size(); i++) composeCodeableConcept(t, "MedicationStatement", "statusReason", element.getStatusReason().get(i), i);
if (element.hasCategory())
composeCodeableConcept(t, "MedicationStatement", "category", element.getCategory(), -1);
if (element.hasMedication())
composeType(t, "MedicationStatement", "medication", element.getMedication(), -1);
if (element.hasSubject())
composeReference(t, "MedicationStatement", "subject", element.getSubject(), -1);
if (element.hasContext())
composeReference(t, "MedicationStatement", "context", element.getContext(), -1);
if (element.hasEffective())
composeType(t, "MedicationStatement", "effective", element.getEffective(), -1);
if (element.hasDateAssertedElement())
composeDateTime(t, "MedicationStatement", "dateAsserted", element.getDateAssertedElement(), -1);
if (element.hasInformationSource())
composeReference(t, "MedicationStatement", "informationSource", element.getInformationSource(), -1);
for (int i = 0; i < element.getDerivedFrom().size(); i++) composeReference(t, "MedicationStatement", "derivedFrom", element.getDerivedFrom().get(i), i);
for (int i = 0; i < element.getReasonCode().size(); i++) composeCodeableConcept(t, "MedicationStatement", "reasonCode", element.getReasonCode().get(i), i);
for (int i = 0; i < element.getReasonReference().size(); i++) composeReference(t, "MedicationStatement", "reasonReference", element.getReasonReference().get(i), i);
for (int i = 0; i < element.getNote().size(); i++) composeAnnotation(t, "MedicationStatement", "note", element.getNote().get(i), i);
for (int i = 0; i < element.getDosage().size(); i++) composeDosage(t, "MedicationStatement", "dosage", element.getDosage().get(i), i);
}
use of org.hl7.fhir.r4.model.MedicationStatement in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeMedicationStatementMedicationStatementDosageComponent.
protected void composeMedicationStatementMedicationStatementDosageComponent(Complex parent, String parentType, String name, MedicationStatement.MedicationStatementDosageComponent element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeBackboneElement(t, "dosage", name, element, index);
if (element.hasTextElement())
composeString(t, "MedicationStatement", "text", element.getTextElement(), -1);
if (element.hasTiming())
composeTiming(t, "MedicationStatement", "timing", element.getTiming(), -1);
if (element.hasAsNeeded())
composeType(t, "MedicationStatement", "asNeeded", element.getAsNeeded(), -1);
if (element.hasSite())
composeType(t, "MedicationStatement", "site", element.getSite(), -1);
if (element.hasRoute())
composeCodeableConcept(t, "MedicationStatement", "route", element.getRoute(), -1);
if (element.hasMethod())
composeCodeableConcept(t, "MedicationStatement", "method", element.getMethod(), -1);
if (element.hasQuantity())
composeType(t, "MedicationStatement", "quantity", element.getQuantity(), -1);
if (element.hasRate())
composeType(t, "MedicationStatement", "rate", element.getRate(), -1);
if (element.hasMaxDosePerPeriod())
composeRatio(t, "MedicationStatement", "maxDosePerPeriod", element.getMaxDosePerPeriod(), -1);
}
use of org.hl7.fhir.r4.model.MedicationStatement in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeMedicationStatement.
protected void composeMedicationStatement(Complex parent, String parentType, String name, MedicationStatement element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeDomainResource(t, "MedicationStatement", name, element, index);
for (int i = 0; i < element.getIdentifier().size(); i++) composeIdentifier(t, "MedicationStatement", "identifier", element.getIdentifier().get(i), i);
if (element.hasStatusElement())
composeEnum(t, "MedicationStatement", "status", element.getStatusElement(), -1);
if (element.hasMedication())
composeType(t, "MedicationStatement", "medication", element.getMedication(), -1);
if (element.hasPatient())
composeReference(t, "MedicationStatement", "patient", element.getPatient(), -1);
if (element.hasEffective())
composeType(t, "MedicationStatement", "effective", element.getEffective(), -1);
if (element.hasInformationSource())
composeReference(t, "MedicationStatement", "informationSource", element.getInformationSource(), -1);
for (int i = 0; i < element.getSupportingInformation().size(); i++) composeReference(t, "MedicationStatement", "supportingInformation", element.getSupportingInformation().get(i), i);
if (element.hasDateAssertedElement())
composeDateTime(t, "MedicationStatement", "dateAsserted", element.getDateAssertedElement(), -1);
if (element.hasWasNotTakenElement())
composeBoolean(t, "MedicationStatement", "wasNotTaken", element.getWasNotTakenElement(), -1);
for (int i = 0; i < element.getReasonNotTaken().size(); i++) composeCodeableConcept(t, "MedicationStatement", "reasonNotTaken", element.getReasonNotTaken().get(i), i);
if (element.hasReasonForUse())
composeType(t, "MedicationStatement", "reasonForUse", element.getReasonForUse(), -1);
for (int i = 0; i < element.getNote().size(); i++) composeAnnotation(t, "MedicationStatement", "note", element.getNote().get(i), i);
for (int i = 0; i < element.getDosage().size(); i++) composeMedicationStatementMedicationStatementDosageComponent(t, "MedicationStatement", "dosage", element.getDosage().get(i), i);
}
Aggregations