Example #1
0
        private BareANY ConvertDataType(BareANY dataType)
        {
            object bareValue = dataType.BareValue;
            PeriodicIntervalTime   pivlR1 = (bareValue is PeriodicIntervalTime ? (PeriodicIntervalTime)bareValue : null);
            PeriodicIntervalTimeR2 pivlR2 = (pivlR1 == null ? null : ConvertPivl(pivlR1));
            BareANY result = new PIVLTSCDAR1Impl(pivlR2);

            result.DataType   = dataType.DataType;
            result.NullFlavor = dataType.NullFlavor;
            return(result);
        }
Example #2
0
        public virtual void TestPivlFrequency()
        {
            ModelToXmlResult result            = new ModelToXmlResult();
            PhysicalQuantity frequencyQuantity = new PhysicalQuantity(BigDecimal.ONE, Ca.Infoway.Messagebuilder.Domainvalue.Basic.UnitsOfMeasureCaseSensitive
                                                                      .DAY);
            PeriodicIntervalTimeR2 pivl = new PeriodicIntervalTimeR2(4, frequencyQuantity);
            BareANY       dataType      = new PIVLTSCDAR1Impl(pivl);
            FormatContext formatContext = new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl(result, string.Empty
                                                                                                                    , "pivl", "PIVLTSCDAR1", null, Ca.Infoway.Messagebuilder.Xml.ConformanceLevel.MANDATORY, Cardinality.Create("1"), false,
                                                                                                                    SpecificationVersion.R02_04_03, null, null, null, null, true);
            string xml = this.formatter.Format(formatContext, dataType);

            Assert.IsTrue(result.IsValid());
            string expected = "<pivl><frequency><numerator value=\"4\"/><denominator unit=\"d\" value=\"1\"/></frequency></pivl>";

            AssertXml("pivl output", expected, xml, true);
        }
Example #3
0
        public virtual void TestPivlPhasePeriod()
        {
            ModelToXmlResult        result              = new ModelToXmlResult();
            PlatformDate            dateLow             = DateUtil.GetDate(2012, 4, 3);
            DateWithPattern         dateWithPatternLow  = new DateWithPattern(dateLow, "yyyyMMdd");
            PlatformDate            dateHigh            = DateUtil.GetDate(2012, 6, 8);
            DateWithPattern         dateWithPatternHigh = new DateWithPattern(dateHigh, "yyyyMMdd");
            Interval <PlatformDate> phase = IntervalFactory.CreateLowHigh((PlatformDate)dateWithPatternLow, (PlatformDate)dateWithPatternHigh
                                                                          );
            PhysicalQuantity period = new PhysicalQuantity(BigDecimal.ONE, Ca.Infoway.Messagebuilder.Domainvalue.Basic.UnitsOfMeasureCaseSensitive
                                                           .DAY);
            PeriodicIntervalTimeR2 pivl = new PeriodicIntervalTimeR2(phase, period);
            BareANY       dataType      = new PIVLTSCDAR1Impl(pivl);
            FormatContext formatContext = new Ca.Infoway.Messagebuilder.Marshalling.HL7.Formatter.FormatContextImpl(result, string.Empty
                                                                                                                    , "pivl", "PIVLTSCDAR1", null, Ca.Infoway.Messagebuilder.Xml.ConformanceLevel.MANDATORY, Cardinality.Create("1"), false,
                                                                                                                    SpecificationVersion.R02_04_03, null, null, null, null, true);
            string xml = this.formatter.Format(formatContext, dataType);

            Assert.IsTrue(result.IsValid());
            string expected = "<pivl><period unit=\"d\" value=\"1\"/><phase><low value=\"20120503\"/><high value=\"20120708\"/></phase></pivl>";

            AssertXml("pivl output", expected, xml, true);
        }