From a8b715af9702412ad98633147d256785de6dc4b0 Mon Sep 17 00:00:00 2001 From: Itay Goren Date: Tue, 6 Oct 2020 19:07:57 +0300 Subject: [PATCH] fixed bug in conversion from dstu2 to r4 in timing resource --- .../convertors/VersionConvertor_10_40.java | 20 ++++++++++++------- .../resources/0_medication_request_40.json | 2 -- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_10_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_10_40.java index c9550402d..4db50132b 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_10_40.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_10_40.java @@ -2023,15 +2023,18 @@ public class VersionConvertor_10_40 { copyElement(src, tgt); if (src.hasBounds()) tgt.setBounds(convertType(src.getBounds())); - tgt.setCount(src.getCount()); + if (src.hasCount()) + tgt.setCount(src.getCount()); if (src.hasDurationElement()) tgt.setDurationElement(convertDecimal(src.getDurationElement())); if (src.hasDurationMaxElement()) tgt.setDurationMaxElement(convertDecimal(src.getDurationMaxElement())); if (src.hasDurationUnits()) tgt.setDurationUnitElement(convertUnitsOfTime(src.getDurationUnitsElement())); - tgt.setFrequency(src.getFrequency()); - tgt.setFrequencyMax(src.getFrequencyMax()); + if (src.hasFrequency()) + tgt.setFrequency(src.getFrequency()); + if (src.hasFrequencyMax()) + tgt.setFrequencyMax(src.getFrequencyMax()); if (src.hasPeriodElement()) tgt.setPeriodElement(convertDecimal(src.getPeriodElement())); if (src.hasPeriodMaxElement()) @@ -2051,15 +2054,18 @@ public class VersionConvertor_10_40 { copyElement(src, tgt); if (src.hasBounds()) tgt.setBounds(convertType(src.getBounds())); - tgt.setCount(src.getCount()); + if (src.hasCount()) + tgt.setCount(src.getCount()); if (src.hasDurationElement()) tgt.setDurationElement(convertDecimal(src.getDurationElement())); if (src.hasDurationMaxElement()) tgt.setDurationMaxElement(convertDecimal(src.getDurationMaxElement())); if (src.hasDurationUnit()) tgt.setDurationUnitsElement(convertUnitsOfTime(src.getDurationUnitElement())); - tgt.setFrequency(src.getFrequency()); - tgt.setFrequencyMax(src.getFrequencyMax()); + if (src.hasFrequency()) + tgt.setFrequency(src.getFrequency()); + if (src.hasFrequencyMax()) + tgt.setFrequencyMax(src.getFrequencyMax()); if (src.hasPeriodElement()) tgt.setPeriodElement(convertDecimal(src.getPeriodElement())); if (src.hasPeriodMaxElement()) @@ -3430,4 +3436,4 @@ public class VersionConvertor_10_40 { copyElement(src, tgt); return tgt; } -} \ No newline at end of file +} diff --git a/org.hl7.fhir.convertors/src/test/resources/0_medication_request_40.json b/org.hl7.fhir.convertors/src/test/resources/0_medication_request_40.json index 325b59a1a..a00906b3e 100644 --- a/org.hl7.fhir.convertors/src/test/resources/0_medication_request_40.json +++ b/org.hl7.fhir.convertors/src/test/resources/0_medication_request_40.json @@ -18,9 +18,7 @@ "dosageInstruction": [{"text": "Take 10 mg by mouth nightly.", "timing": {"repeat": {"boundsPeriod": {"start": "2016-11-15T00:00:00Z", "end": "2016-11-23T00:00:00Z"}, - "count": 0, "frequency": 1, - "frequencyMax": 0, "period": 1.0, "periodUnit": "d"}}, "asNeededBoolean": "False",