fix dosage converter
This commit is contained in:
parent
6c4620996f
commit
511358f314
|
@ -1418,16 +1418,32 @@ public class VersionConvertor_30_40 {
|
||||||
tgt.setRoute(convertCodeableConcept(src.getRoute()));
|
tgt.setRoute(convertCodeableConcept(src.getRoute()));
|
||||||
if (src.hasMethod())
|
if (src.hasMethod())
|
||||||
tgt.setMethod(convertCodeableConcept(src.getMethod()));
|
tgt.setMethod(convertCodeableConcept(src.getMethod()));
|
||||||
if (src.hasDoseAndRate() && src.getDoseAndRate().get(0).hasDose())
|
if (src.hasDoseAndRate() && src.getDoseAndRate().get(0).hasDose()) {
|
||||||
tgt.setDose(convertType(src.getDoseAndRate().get(0).getDose()));
|
// We need to manually make sure that the convertSimpleQuantity method is
|
||||||
|
// called. Otherwise (if we would simply forward to the convertType method), this would lead
|
||||||
|
// to a conversion to another Quantity object, that would be invalid for the DSTU3 Dosage resource,
|
||||||
|
if (src.getDoseAndRate().get(0).getDose() instanceof org.hl7.fhir.r4.model.Quantity) {
|
||||||
|
tgt.setDose(convertSimpleQuantity((org.hl7.fhir.r4.model.Quantity) src.getDoseAndRate().get(0).getDose()));
|
||||||
|
} else {
|
||||||
|
tgt.setDose(convertType(src.getDoseAndRate().get(0).getDose()));
|
||||||
|
}
|
||||||
|
}
|
||||||
if (src.hasMaxDosePerPeriod())
|
if (src.hasMaxDosePerPeriod())
|
||||||
tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod()));
|
tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod()));
|
||||||
if (src.hasMaxDosePerAdministration())
|
if (src.hasMaxDosePerAdministration())
|
||||||
tgt.setMaxDosePerAdministration(convertSimpleQuantity(src.getMaxDosePerAdministration()));
|
tgt.setMaxDosePerAdministration(convertSimpleQuantity(src.getMaxDosePerAdministration()));
|
||||||
if (src.hasMaxDosePerLifetime())
|
if (src.hasMaxDosePerLifetime())
|
||||||
tgt.setMaxDosePerLifetime(convertSimpleQuantity(src.getMaxDosePerLifetime()));
|
tgt.setMaxDosePerLifetime(convertSimpleQuantity(src.getMaxDosePerLifetime()));
|
||||||
if (src.hasDoseAndRate() && src.getDoseAndRate().get(0).hasRate())
|
if (src.hasDoseAndRate() && src.getDoseAndRate().get(0).hasRate()) {
|
||||||
tgt.setRate(convertType(src.getDoseAndRate().get(0).getRate()));
|
// We need to manually make sure that the convertSimpleQuantity method is
|
||||||
|
// called. Otherwise (if we would simply forward to the convertType method), this would lead
|
||||||
|
// to a conversion to another Quantity object, that would be invalid for the DSTU3 Dosage resource,
|
||||||
|
if (src.getDoseAndRate().get(0).getRate() instanceof org.hl7.fhir.r4.model.Quantity) {
|
||||||
|
tgt.setRate(convertSimpleQuantity((org.hl7.fhir.r4.model.Quantity) src.getDoseAndRate().get(0).getRate()));
|
||||||
|
} else {
|
||||||
|
tgt.setRate(convertType(src.getDoseAndRate().get(0).getRate()));
|
||||||
|
}
|
||||||
|
}
|
||||||
return tgt;
|
return tgt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue