Fix up conversion for date problems

This commit is contained in:
Grahame Grieve 2020-09-02 08:09:36 +10:00
parent 3a30f0e780
commit 8c43803183
2 changed files with 10 additions and 3 deletions

View File

@ -65,6 +65,7 @@ import org.hl7.fhir.convertors.conv10_40.ValueSet10_40;
import org.hl7.fhir.dstu2.model.CodeableConcept; import org.hl7.fhir.dstu2.model.CodeableConcept;
import org.hl7.fhir.dstu2.model.Parameters; import org.hl7.fhir.dstu2.model.Parameters;
import org.hl7.fhir.dstu2.model.Parameters.ParametersParameterComponent; import org.hl7.fhir.dstu2.model.Parameters.ParametersParameterComponent;
import org.hl7.fhir.dstu2.model.PositiveIntType;
import org.hl7.fhir.dstu2.model.Reference; import org.hl7.fhir.dstu2.model.Reference;
import org.hl7.fhir.dstu2.utils.ToolingExtensions; import org.hl7.fhir.dstu2.utils.ToolingExtensions;
import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.exceptions.FHIRException;
@ -3423,4 +3424,10 @@ public class VersionConvertor_10_40 {
public static org.hl7.fhir.dstu2.model.Resource convertResource(org.hl7.fhir.r4.model.Resource src) throws FHIRException { public static org.hl7.fhir.dstu2.model.Resource convertResource(org.hl7.fhir.r4.model.Resource src) throws FHIRException {
return convertResource(src, null); return convertResource(src, null);
} }
public static UnsignedIntType convertUnsignedIntToPositive(PositiveIntType src) {
org.hl7.fhir.r4.model.UnsignedIntType tgt = src.hasValue() ? new org.hl7.fhir.r4.model.UnsignedIntType(src.getValue()) : new org.hl7.fhir.r4.model.UnsignedIntType();
copyElement(src, tgt);
return tgt;
}
} }

View File

@ -15,7 +15,7 @@ public class MedicationRequest10_40 {
tgt.setIntent(org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestIntent.ORDER); tgt.setIntent(org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestIntent.ORDER);
for (org.hl7.fhir.dstu2.model.Identifier identifier : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(identifier)); for (org.hl7.fhir.dstu2.model.Identifier identifier : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(identifier));
if (src.hasDateWritten()) if (src.hasDateWritten())
tgt.setAuthoredOn(src.getDateWritten()); tgt.setAuthoredOnElement(VersionConvertor_10_40.convertDateTime(src.getDateWrittenElement()));
if (src.hasStatus()) if (src.hasStatus())
tgt.setStatus(org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestStatus.fromCode(src.getStatus().toCode())); tgt.setStatus(org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestStatus.fromCode(src.getStatus().toCode()));
if (src.hasPatient()) if (src.hasPatient())
@ -48,7 +48,7 @@ public class MedicationRequest10_40 {
return null; return null;
org.hl7.fhir.r4.model.Dosage tgt = new org.hl7.fhir.r4.model.Dosage(); org.hl7.fhir.r4.model.Dosage tgt = new org.hl7.fhir.r4.model.Dosage();
if (src.hasText()) if (src.hasText())
tgt.setText(src.getText()); tgt.setTextElement(VersionConvertor_10_40.convertString(src.getTextElement()));
if (src.hasAdditionalInstructions()) if (src.hasAdditionalInstructions())
tgt.addAdditionalInstruction(VersionConvertor_10_40.convertCodeableConcept(src.getAdditionalInstructions())); tgt.addAdditionalInstruction(VersionConvertor_10_40.convertCodeableConcept(src.getAdditionalInstructions()));
if (src.hasTiming()) if (src.hasTiming())
@ -79,7 +79,7 @@ public class MedicationRequest10_40 {
if (src.hasValidityPeriod()) if (src.hasValidityPeriod())
tgt.setValidityPeriod(VersionConvertor_10_40.convertPeriod(src.getValidityPeriod())); tgt.setValidityPeriod(VersionConvertor_10_40.convertPeriod(src.getValidityPeriod()));
if (src.hasNumberOfRepeatsAllowed()) if (src.hasNumberOfRepeatsAllowed())
tgt.setNumberOfRepeatsAllowed(src.getNumberOfRepeatsAllowed()); tgt.setNumberOfRepeatsAllowedElement(VersionConvertor_10_40.convertUnsignedIntToPositive(src.getNumberOfRepeatsAllowedElement()));
if (src.hasQuantity()) if (src.hasQuantity())
tgt.setQuantity(VersionConvertor_10_40.convertSimpleQuantity(src.getQuantity())); tgt.setQuantity(VersionConvertor_10_40.convertSimpleQuantity(src.getQuantity()));
if (src.hasExpectedSupplyDuration()) if (src.hasExpectedSupplyDuration())