use of org.hl7.fhir.dstu2.model.Quantity in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeContractValuedItemComponent.
protected void composeContractValuedItemComponent(Complex parent, String parentType, String name, Contract.ValuedItemComponent element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeBackboneElement(t, "valuedItem", name, element, index);
if (element.hasEntity())
composeType(t, "Contract", "entity", element.getEntity(), -1);
if (element.hasIdentifier())
composeIdentifier(t, "Contract", "identifier", element.getIdentifier(), -1);
if (element.hasEffectiveTimeElement())
composeDateTime(t, "Contract", "effectiveTime", element.getEffectiveTimeElement(), -1);
if (element.hasQuantity())
composeQuantity(t, "Contract", "quantity", element.getQuantity(), -1);
if (element.hasUnitPrice())
composeQuantity(t, "Contract", "unitPrice", element.getUnitPrice(), -1);
if (element.hasFactorElement())
composeDecimal(t, "Contract", "factor", element.getFactorElement(), -1);
if (element.hasPointsElement())
composeDecimal(t, "Contract", "points", element.getPointsElement(), -1);
if (element.hasNet())
composeQuantity(t, "Contract", "net", element.getNet(), -1);
}
use of org.hl7.fhir.dstu2.model.Quantity in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeExplanationOfBenefitDetailComponent.
protected void composeExplanationOfBenefitDetailComponent(Complex parent, String parentType, String name, ExplanationOfBenefit.DetailComponent element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeBackboneElement(t, "detail", name, element, index);
if (element.hasSequenceElement())
composePositiveInt(t, "ExplanationOfBenefit", "sequence", element.getSequenceElement(), -1);
if (element.hasType())
composeCoding(t, "ExplanationOfBenefit", "type", element.getType(), -1);
if (element.hasService())
composeCoding(t, "ExplanationOfBenefit", "service", element.getService(), -1);
for (int i = 0; i < element.getProgramCode().size(); i++) composeCoding(t, "ExplanationOfBenefit", "programCode", element.getProgramCode().get(i), i);
if (element.hasQuantity())
composeQuantity(t, "ExplanationOfBenefit", "quantity", element.getQuantity(), -1);
if (element.hasUnitPrice())
composeQuantity(t, "ExplanationOfBenefit", "unitPrice", element.getUnitPrice(), -1);
if (element.hasFactorElement())
composeDecimal(t, "ExplanationOfBenefit", "factor", element.getFactorElement(), -1);
if (element.hasPointsElement())
composeDecimal(t, "ExplanationOfBenefit", "points", element.getPointsElement(), -1);
if (element.hasNet())
composeQuantity(t, "ExplanationOfBenefit", "net", element.getNet(), -1);
for (int i = 0; i < element.getUdi().size(); i++) composeReference(t, "ExplanationOfBenefit", "udi", element.getUdi().get(i), i);
for (int i = 0; i < element.getAdjudication().size(); i++) composeExplanationOfBenefitDetailAdjudicationComponent(t, "ExplanationOfBenefit", "adjudication", element.getAdjudication().get(i), i);
for (int i = 0; i < element.getSubDetail().size(); i++) composeExplanationOfBenefitSubDetailComponent(t, "ExplanationOfBenefit", "subDetail", element.getSubDetail().get(i), i);
}
use of org.hl7.fhir.dstu2.model.Quantity in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeMedicationDispense.
protected void composeMedicationDispense(Complex parent, String parentType, String name, MedicationDispense element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeDomainResource(t, "MedicationDispense", name, element, index);
if (element.hasIdentifier())
composeIdentifier(t, "MedicationDispense", "identifier", element.getIdentifier(), -1);
if (element.hasStatusElement())
composeEnum(t, "MedicationDispense", "status", element.getStatusElement(), -1);
if (element.hasMedication())
composeType(t, "MedicationDispense", "medication", element.getMedication(), -1);
if (element.hasPatient())
composeReference(t, "MedicationDispense", "patient", element.getPatient(), -1);
if (element.hasDispenser())
composeReference(t, "MedicationDispense", "dispenser", element.getDispenser(), -1);
for (int i = 0; i < element.getAuthorizingPrescription().size(); i++) composeReference(t, "MedicationDispense", "authorizingPrescription", element.getAuthorizingPrescription().get(i), i);
if (element.hasType())
composeCodeableConcept(t, "MedicationDispense", "type", element.getType(), -1);
if (element.hasQuantity())
composeQuantity(t, "MedicationDispense", "quantity", element.getQuantity(), -1);
if (element.hasDaysSupply())
composeQuantity(t, "MedicationDispense", "daysSupply", element.getDaysSupply(), -1);
if (element.hasWhenPreparedElement())
composeDateTime(t, "MedicationDispense", "whenPrepared", element.getWhenPreparedElement(), -1);
if (element.hasWhenHandedOverElement())
composeDateTime(t, "MedicationDispense", "whenHandedOver", element.getWhenHandedOverElement(), -1);
if (element.hasDestination())
composeReference(t, "MedicationDispense", "destination", element.getDestination(), -1);
for (int i = 0; i < element.getReceiver().size(); i++) composeReference(t, "MedicationDispense", "receiver", element.getReceiver().get(i), i);
for (int i = 0; i < element.getNote().size(); i++) composeAnnotation(t, "MedicationDispense", "note", element.getNote().get(i), i);
for (int i = 0; i < element.getDosageInstruction().size(); i++) composeMedicationDispenseMedicationDispenseDosageInstructionComponent(t, "MedicationDispense", "dosageInstruction", element.getDosageInstruction().get(i), i);
if (element.hasSubstitution())
composeMedicationDispenseMedicationDispenseSubstitutionComponent(t, "MedicationDispense", "substitution", element.getSubstitution(), -1);
}
use of org.hl7.fhir.dstu2.model.Quantity in project org.hl7.fhir.core by hapifhir.
the class FHIRPathEngine method opGreaterOrEqual.
private List<Base> opGreaterOrEqual(List<Base> left, List<Base> right) throws FHIRException {
if (left.size() == 1 && right.size() == 1 && left.get(0).isPrimitive() && right.get(0).isPrimitive()) {
Base l = left.get(0);
Base r = right.get(0);
if (l.hasType("string") && r.hasType("string"))
return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) >= 0);
else if ((l.hasType("integer", "decimal")) && (r.hasType("integer", "decimal")))
return makeBoolean(new Double(l.primitiveValue()) >= new Double(r.primitiveValue()));
else if ((l.hasType("date", "dateTime", "instant")) && (r.hasType("date", "dateTime", "instant")))
return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) >= 0);
else if ((l.hasType("time")) && (r.hasType("time")))
return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) >= 0);
} else if (left.size() == 1 && right.size() == 1 && left.get(0).fhirType().equals("Quantity") && right.get(0).fhirType().equals("Quantity")) {
List<Base> lUnit = left.get(0).listChildrenByName("unit");
List<Base> rUnit = right.get(0).listChildrenByName("unit");
if (Base.compareDeep(lUnit, rUnit, true)) {
return opGreaterOrEqual(left.get(0).listChildrenByName("value"), right.get(0).listChildrenByName("value"));
} else {
throw new Error("Canonical Comparison isn't done yet");
}
}
return new ArrayList<Base>();
}
use of org.hl7.fhir.dstu2.model.Quantity in project org.hl7.fhir.core by hapifhir.
the class FHIRPathEngine method opLessThen.
private List<Base> opLessThen(List<Base> left, List<Base> right) throws FHIRException {
if (left.size() == 1 && right.size() == 1 && left.get(0).isPrimitive() && right.get(0).isPrimitive()) {
Base l = left.get(0);
Base r = right.get(0);
if (l.hasType("string") && r.hasType("string"))
return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) < 0);
else if ((l.hasType("integer") || l.hasType("decimal")) && (r.hasType("integer") || r.hasType("decimal")))
return makeBoolean(new Double(l.primitiveValue()) < new Double(r.primitiveValue()));
else if ((l.hasType("date", "dateTime", "instant")) && (r.hasType("date", "dateTime", "instant")))
return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) < 0);
else if ((l.hasType("time")) && (r.hasType("time")))
return makeBoolean(l.primitiveValue().compareTo(r.primitiveValue()) < 0);
} else if (left.size() == 1 && right.size() == 1 && left.get(0).fhirType().equals("Quantity") && right.get(0).fhirType().equals("Quantity")) {
List<Base> lUnit = left.get(0).listChildrenByName("unit");
List<Base> rUnit = right.get(0).listChildrenByName("unit");
if (Base.compareDeep(lUnit, rUnit, true)) {
return opLessThen(left.get(0).listChildrenByName("value"), right.get(0).listChildrenByName("value"));
} else {
throw new Error("Canonical Comparison isn't done yet");
}
}
return new ArrayList<Base>();
}
Aggregations