Exemplo n.º 1
0
        private void GenerateCCDA()
        {
            XmlDocument ccdaDocumentData = new XmlDocument();

            ccdaDocumentData.Load(fileUpload.FileContent);

            HealthRecordItem ccda = new HealthRecordItem(new Guid("9c48a2b8-952c-4f5a-935d-f3292326bf54"), ccdaDocumentData);

            if (_overrideCCDAfields)
            {
                StringBuilder stringBuilder = new StringBuilder(150);
                string        extSource     = "hv-meaningfuluse";

                using (XmlWriter writer = XmlWriter.Create(stringBuilder, new XmlWriterSettings()
                {
                    OmitXmlDeclaration = true
                }))
                {
                    writer.WriteStartElement("extension");
                    writer.WriteAttributeString("source", extSource);
                    if (_eventTime != DateTime.MinValue)
                    {
                        writer.WriteElementString("event-date", _eventTime.ToString());
                    }
                    if (!string.IsNullOrEmpty(_patientID))
                    {
                        writer.WriteElementString("patient-id", _patientID);
                    }
                    writer.WriteEndElement();
                }

                HealthRecordItemExtension ext = new HealthRecordItemExtension(extSource);
                ext.ExtensionData.CreateNavigator().InnerXml = stringBuilder.ToString();

                ccda.CommonData.Extensions.Add(ext);
            }

            _newCcdaItem = ccda;
        }
Exemplo n.º 2
0
    protected void Submit_Daily_Diet_Click(object sender, System.EventArgs e)
    {
        //Post Diet
        DietaryDailyIntake diet = new DietaryDailyIntake();
        int totalCarbs;

        int.TryParse(Txt_DailyDietCarbs.Text, out totalCarbs);
        diet.TotalCarbohydrates.Kilograms = totalCarbs * 1000;
        diet.CommonData.Note = Txt_DailyDietNote.Text;

        //Adding extension data
        string drinks = Txt_DailyDietAlcohol.Text;
        HealthRecordItemExtension extension =
            new HealthRecordItemExtension(_appDailyAlcoholExtensionName);

        diet.CommonData.Extensions.Add(extension);
        XPathNavigator navigator = extension.ExtensionData.CreateNavigator();

        navigator.InnerXml = @"<extension source=""" + _appDailyAlcoholExtensionName + @""">
                <alcoholic-drinks>" + drinks + "</alcoholic-drinks>";

        PersonInfo.SelectedRecord.NewItem(diet);
    }