コード例 #1
0
 /*
  * 2011/8/16, jhalliday - New Data Model for 837P (Professional) claim.
  *
  * Team: dstrubhar, jhalliday and epkrause
  *
  * Purpose:
  * To create a C# object model that will serve as a container for the X12 837P data
  * AS ENTERED from a HCFA 1500 Professional claim form.
  *
  * Goal:
  * The team has the overall goal of creating tools that can be used to consume and
  * manipulate X12 messages (AKA files/documents) without the need to have a big project
  * budget.  For that reason, this and the related X12 Parser project tools are all open
  * source and freely usable.
  */
 public HCFA1500Claim()
 {
     if (Field03_PatientsDateOfBirth == null) Field03_PatientsDateOfBirth = new FormDate();
     if (Field09b_OtherInsuredsDateOfBirth == null) Field09b_OtherInsuredsDateOfBirth = new FormDate();
     if (Field11a_InsuredsDateOfBirth == null) Field11a_InsuredsDateOfBirth = new FormDate();
     if (Field12_PatientsOrAuthorizedSignatureDate == null) Field12_PatientsOrAuthorizedSignatureDate = new FormDate();
     if (Field14_DateOfCurrentIllnessInjuryOrPregnancy == null) Field14_DateOfCurrentIllnessInjuryOrPregnancy = new FormDate();
     if (Field15_DatePatientHadSameOrSimilarIllness == null) Field15_DatePatientHadSameOrSimilarIllness = new FormDate();
     if (Field16_DatePatientUnableToWork_Start == null) Field16_DatePatientUnableToWork_Start = new FormDate();
     if (Field16_DatePatientUnableToWork_End == null) Field16_DatePatientUnableToWork_End = new FormDate();
     if (Field18_HospitalizationDateFrom == null) Field18_HospitalizationDateFrom = new FormDate();
     if (Field18_HospitalizationDateTo == null) Field18_HospitalizationDateTo = new FormDate();
     if (Field24_ServiceLines == null) Field24_ServiceLines = new List<HCFA1500ServiceLine>();
 }
コード例 #2
0
ファイル: HCFA1500Claim.cs プロジェクト: kitecc/OopFactoryX12
 /*
  * 2011/8/16, jhalliday - New Data Model for 837P (Professional) claim.
  *
  * Team: dstrubhar, jhalliday and epkrause
  *
  * Purpose:
  * To create a C# object model that will serve as a container for the X12 837P data
  * AS ENTERED from a HCFA 1500 Professional claim form.
  *
  * Goal:
  * The team has the overall goal of creating tools that can be used to consume and
  * manipulate X12 messages (AKA files/documents) without the need to have a big project
  * budget.  For that reason, this and the related X12 Parser project tools are all open
  * source and freely usable.
  */
 public HCFA1500Claim()
 {
     if (Field03_PatientsDateOfBirth == null)
     {
         Field03_PatientsDateOfBirth = new FormDate();
     }
     if (Field09b_OtherInsuredsDateOfBirth == null)
     {
         Field09b_OtherInsuredsDateOfBirth = new FormDate();
     }
     if (Field11a_InsuredsDateOfBirth == null)
     {
         Field11a_InsuredsDateOfBirth = new FormDate();
     }
     if (Field12_PatientsOrAuthorizedSignatureDate == null)
     {
         Field12_PatientsOrAuthorizedSignatureDate = new FormDate();
     }
     if (Field14_DateOfCurrentIllnessInjuryOrPregnancy == null)
     {
         Field14_DateOfCurrentIllnessInjuryOrPregnancy = new FormDate();
     }
     if (Field15_DatePatientHadSameOrSimilarIllness == null)
     {
         Field15_DatePatientHadSameOrSimilarIllness = new FormDate();
     }
     if (Field16_DatePatientUnableToWork_Start == null)
     {
         Field16_DatePatientUnableToWork_Start = new FormDate();
     }
     if (Field16_DatePatientUnableToWork_End == null)
     {
         Field16_DatePatientUnableToWork_End = new FormDate();
     }
     if (Field18_HospitalizationDateFrom == null)
     {
         Field18_HospitalizationDateFrom = new FormDate();
     }
     if (Field18_HospitalizationDateTo == null)
     {
         Field18_HospitalizationDateTo = new FormDate();
     }
     if (Field24_ServiceLines == null)
     {
         Field24_ServiceLines = new List <HCFA1500ServiceLine>();
     }
 }
コード例 #3
0
        private List<AbstractFormElement> MapValueExpressions(List<string> valueExpressions)
        {
            if (valueExpressions != null && valueExpressions.Count > 0)
            {
                List<AbstractFormElement> valueElements = new List<AbstractFormElement>();
                foreach (var item in valueExpressions)
                {
                    Regex blockRx = new Regex("{{block:(.*?)}}");
                    Regex dateRx = new Regex("{{date:(.*?)}}");
                    if (blockRx.Match(item).Success)
                    {
                        FormTextBlock textBlock = new FormTextBlock();
                        textBlock.Name = item.Replace("{{block:", string.Empty).Replace("}}", string.Empty);
                        textBlock.Expression = item;
                        textBlock.Text = string.Empty;

                        valueElements.Add(textBlock);
                    }
                    else if (dateRx.Match(item).Success)
                    {
                        FormDate date = new FormDate();
                        date.Name = item.Replace("{{date:", string.Empty).Replace("}}", string.Empty); ;
                        date.Expression = item;
                        date.Date = DateTime.Now;

                        valueElements.Add(date);
                    }
                    else
                    {
                        FormTextBox textBox = new FormTextBox();
                        textBox.Name = item.Replace("{{", string.Empty).Replace("}}", string.Empty);
                        textBox.Expression = item;
                        textBox.Text = string.Empty;

                        valueElements.Add(textBox);
                    }
                }
                return valueElements;
            }
            return null;
        }
コード例 #4
0
        private void ShowForm(FieldType fieldType)
        {
            switch (fieldType)
            {
            case FieldType.Date:
                var formDate = new FormDate();
                formDate.ShowDialogDate(entityDesigner);
                break;

            case FieldType.Bool:
                var formBool = new FormBool();
                formBool.ShowDialogBool(entityDesigner);
                break;

            case FieldType.Number:
            case FieldType.Money:
                var formMoney = new FormMoney();
                formMoney.MaxValue = entityDesigner.MaxValue;
                formMoney.ShowDialogMoney(entityDesigner);
                break;

            case FieldType.String:
                var formString = new FormString();
                formString.ShowDialogString(entityDesigner);
                break;

            case FieldType.None:
                break;

            case FieldType.Constraint:
                break;

            default:
                break;
            }
        }
コード例 #5
0
        public List <UIElement> BuildUIElements(List <AbstractFormElement> list)
        {
            Thickness        defaultMargin = new Thickness(20, 5, 20, 5);
            List <UIElement> uiList        = new List <UIElement>();

            foreach (var item in list)
            {
                if (item is FormCheckBox)
                {
                    FormCheckBox formCheckBox = item as FormCheckBox;

                    Grid grid = new Grid();

                    ColumnDefinition columnDefinition1 = new ColumnDefinition();
                    columnDefinition1.Width = new GridLength(1.0, GridUnitType.Star);
                    ColumnDefinition columnDefinition2 = new ColumnDefinition();
                    columnDefinition2.Width = new GridLength(1.0, GridUnitType.Star);

                    grid.ColumnDefinitions.Add(columnDefinition1);
                    grid.ColumnDefinitions.Add(columnDefinition2);

                    CheckBox checkBox = new CheckBox();
                    checkBox.Margin = defaultMargin;

                    Binding isChecked = new Binding("IsChecked");
                    isChecked.Source = formCheckBox;
                    isChecked.Mode   = BindingMode.TwoWay;
                    checkBox.SetBinding(CheckBox.IsCheckedProperty, isChecked);

                    TextBlock textBlock = new TextBlock();
                    textBlock.TextWrapping = TextWrapping.Wrap;
                    textBlock.Text         = formCheckBox.Text;

                    checkBox.Content = textBlock;

                    Grid.SetColumnSpan(checkBox, 2);

                    grid.Children.Add(checkBox);

                    uiList.Add(grid);
                }
                if (item is FormDropDown)
                {
                    FormDropDown formDropDown = item as FormDropDown;

                    Grid grid = new Grid();

                    ColumnDefinition columnDefinition1 = new ColumnDefinition();
                    columnDefinition1.Width = new GridLength(1.0, GridUnitType.Star);
                    ColumnDefinition columnDefinition2 = new ColumnDefinition();
                    columnDefinition2.Width = new GridLength(2.0, GridUnitType.Star);

                    grid.ColumnDefinitions.Add(columnDefinition1);
                    grid.ColumnDefinitions.Add(columnDefinition2);
                    grid.HorizontalAlignment = HorizontalAlignment.Stretch;
                    grid.VerticalAlignment   = VerticalAlignment.Stretch;

                    TextBlock textBlock = new TextBlock();
                    textBlock.Margin     = defaultMargin;
                    textBlock.FontWeight = FontWeights.Bold;

                    Binding text = new Binding("Name");
                    text.Source = formDropDown;
                    text.Mode   = BindingMode.OneWay;
                    textBlock.SetBinding(TextBlock.TextProperty, text);

                    ComboBox comboBox = new ComboBox();
                    comboBox.Margin = defaultMargin;

                    Binding options = new Binding("Options");
                    options.Source = formDropDown;
                    options.Mode   = BindingMode.TwoWay;
                    comboBox.SetBinding(ComboBox.ItemsSourceProperty, options);

                    Binding selectedIndex = new Binding("SelectedIndex");
                    selectedIndex.Source = formDropDown;
                    selectedIndex.Mode   = BindingMode.TwoWay;
                    comboBox.SetBinding(ComboBox.SelectedIndexProperty, selectedIndex);

                    Binding selectedValue = new Binding("SelectedValue");
                    selectedValue.Source = formDropDown;
                    selectedValue.Mode   = BindingMode.OneWay;
                    comboBox.SetBinding(ComboBox.SelectedValueProperty, selectedValue);

                    Grid.SetColumn(textBlock, 0);
                    Grid.SetColumn(comboBox, 1);

                    grid.Children.Add(textBlock);
                    grid.Children.Add(comboBox);

                    uiList.Add(grid);
                }
                if (item is FormRadioButton)
                {
                    FormRadioButton formRadioButton = item as FormRadioButton;

                    StackPanel stackPanel = new StackPanel();

                    stackPanel.HorizontalAlignment = HorizontalAlignment.Stretch;
                    stackPanel.VerticalAlignment   = VerticalAlignment.Stretch;

                    for (int i = 0; i < formRadioButton.Options.Count; i++)
                    {
                        TextBlock textBlock = new TextBlock();
                        textBlock.TextWrapping = TextWrapping.Wrap;
                        textBlock.Text         = formRadioButton.Options[i];

                        RadioButton radioButton = new RadioButton();
                        radioButton.Margin = defaultMargin;

                        radioButton.Content   = textBlock;
                        radioButton.GroupName = item.Name;
                        radioButton.Checked  += (sender, args) =>
                        {
                            formRadioButton.SelectedIndex = formRadioButton.Options.IndexOf(textBlock.Text);
                        };
                        if (i == formRadioButton.SelectedIndex)
                        {
                            radioButton.IsChecked = true;
                        }

                        RowDefinition rowDefinition = new RowDefinition();
                        stackPanel.Children.Add(radioButton);
                    }

                    GroupBox groupBox = new GroupBox();
                    groupBox.Header  = item.Name;
                    groupBox.Content = stackPanel;
                    groupBox.Margin  = defaultMargin;

                    uiList.Add(groupBox);
                }
                if (item is FormTextBox)
                {
                    FormTextBox formTextBox = item as FormTextBox;

                    Grid grid = new Grid();

                    ColumnDefinition columnDefinition1 = new ColumnDefinition();
                    columnDefinition1.Width = new GridLength(1.0, GridUnitType.Star);
                    ColumnDefinition columnDefinition2 = new ColumnDefinition();
                    columnDefinition2.Width = new GridLength(2.0, GridUnitType.Star);

                    grid.ColumnDefinitions.Add(columnDefinition1);
                    grid.ColumnDefinitions.Add(columnDefinition2);
                    grid.HorizontalAlignment = HorizontalAlignment.Stretch;
                    grid.VerticalAlignment   = VerticalAlignment.Stretch;

                    TextBlock textBlock = new TextBlock();
                    textBlock.FontWeight = FontWeights.Bold;
                    textBlock.Margin     = defaultMargin;

                    Binding label = new Binding("Name");
                    label.Source = formTextBox;
                    label.Mode   = BindingMode.OneWay;
                    textBlock.SetBinding(TextBlock.TextProperty, label);

                    TextBox textBox = new TextBox();
                    textBox.Margin = defaultMargin;

                    Binding text = new Binding("Text");
                    text.Source = formTextBox;
                    text.Mode   = BindingMode.TwoWay;
                    text.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
                    textBox.SetBinding(TextBox.TextProperty, text);

                    textBox.Text = item.Name;

                    Grid.SetColumn(textBlock, 0);
                    Grid.SetColumn(textBox, 1);

                    grid.Children.Add(textBlock);
                    grid.Children.Add(textBox);

                    uiList.Add(grid);
                }
                if (item is FormTextBlock)
                {
                    FormTextBlock formTextBlock = item as FormTextBlock;

                    StackPanel stackPanel = new StackPanel();

                    stackPanel.Orientation         = Orientation.Vertical;
                    stackPanel.HorizontalAlignment = HorizontalAlignment.Stretch;
                    stackPanel.VerticalAlignment   = VerticalAlignment.Stretch;
                    stackPanel.Margin = defaultMargin;

                    TextBlock textBlock = new TextBlock();
                    textBlock.FontWeight   = FontWeights.Bold;
                    textBlock.TextWrapping = TextWrapping.Wrap;

                    Binding label = new Binding("Name");
                    label.Source = formTextBlock;
                    label.Mode   = BindingMode.OneWay;
                    textBlock.SetBinding(TextBlock.TextProperty, label);

                    TextBox textBox = new TextBox();
                    textBox.MinLines      = 5;
                    textBox.AcceptsReturn = true;
                    textBox.AcceptsTab    = true;
                    textBox.TextWrapping  = TextWrapping.Wrap;

                    Binding text = new Binding("Text");
                    text.Source = formTextBlock;
                    text.Mode   = BindingMode.TwoWay;
                    text.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
                    textBox.SetBinding(TextBox.TextProperty, text);

                    textBox.Text = item.Name;

                    stackPanel.Children.Add(textBlock);
                    stackPanel.Children.Add(textBox);

                    uiList.Add(stackPanel);
                }
                if (item is FormDate)
                {
                    FormDate formDate = item as FormDate;

                    Grid grid = new Grid();

                    ColumnDefinition columnDefinition1 = new ColumnDefinition();
                    columnDefinition1.Width = new GridLength(1.0, GridUnitType.Star);
                    ColumnDefinition columnDefinition2 = new ColumnDefinition();
                    columnDefinition2.Width = new GridLength(2.0, GridUnitType.Star);

                    grid.ColumnDefinitions.Add(columnDefinition1);
                    grid.ColumnDefinitions.Add(columnDefinition2);
                    grid.HorizontalAlignment = HorizontalAlignment.Stretch;
                    grid.VerticalAlignment   = VerticalAlignment.Stretch;

                    TextBlock textBlock = new TextBlock();
                    textBlock.FontWeight   = FontWeights.Bold;
                    textBlock.Margin       = defaultMargin;
                    textBlock.TextWrapping = TextWrapping.Wrap;

                    Binding label = new Binding("Name");
                    label.Source = formDate;
                    label.Mode   = BindingMode.OneWay;
                    textBlock.SetBinding(TextBlock.TextProperty, label);

                    DatePicker datePicker = new DatePicker();
                    datePicker.Margin = defaultMargin;

                    Binding date = new Binding("Date");
                    date.Source = formDate;
                    date.Mode   = BindingMode.TwoWay;
                    date.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
                    datePicker.SetBinding(DatePicker.SelectedDateProperty, date);

                    Grid.SetColumn(textBlock, 0);
                    Grid.SetColumn(datePicker, 1);

                    grid.Children.Add(textBlock);
                    grid.Children.Add(datePicker);

                    uiList.Add(grid);
                }
            }
            return(uiList);
        }
コード例 #6
0
        public FormViewer(Form form)
        {
            InitializeComponent();

            form.InitSections();
            this.form = form;

            this.Title = form.Name;

            layout             = new StackLayout();
            layout.Orientation = StackOrientation.Vertical;

            foreach (Section section in form.sections)
            {
                FormSectionLabel lblSection = new FormSectionLabel();
                lblSection.Text = section.text;

                layout.Children.Add(lblSection);

                //loop through each child control inside the section
                foreach (Field field in section.fields)
                {
                    //create label
                    FormLabel lblText = new FormLabel(field);
                    lblText.Text = field.text;
                    layout.Children.Add(lblText);

                    //create field
                    switch (field.type)
                    {
                    case "text":
                        FormEntry entText = new FormEntry(field, lblText);
                        layout.Children.Add(entText);
                        entText.ClassId = field.id.ToString();
                        if (field.value != null && !String.IsNullOrWhiteSpace(field.value))
                        {
                            entText.Text = field.value;
                        }
                        break;

                    case "number":
                        FormEntry entNumber = new FormEntry(field, lblText)
                        {
                            Placeholder = "",
                            Keyboard    = Keyboard.Numeric,
                            ClassId     = field.id.ToString()
                        };
                        if (field.value != null && !String.IsNullOrWhiteSpace(field.value))
                        {
                            entNumber.Text = field.value;
                        }
                        layout.Children.Add(entNumber);
                        break;

                    case "radio":
                        FormDropDownList entPicker = new FormDropDownList(field, lblText)
                        {
                            Title   = "Select...",
                            ClassId = field.id.ToString()
                        };

                        foreach (string pickeritem in field.options)
                        {
                            entPicker.Items.Add(pickeritem);
                        }

                        if (field.value != null && !String.IsNullOrWhiteSpace(field.value))
                        {
                            entPicker.SelectedIndex = entPicker.Items.IndexOf(entPicker.Items.FirstOrDefault(i => i.ToString() == field.value));
                        }

                        layout.Children.Add(entPicker);
                        break;

                    case "date":
                        FormDate entDate = new FormDate(field, lblText)
                        {
                            Format  = "MMMM dd, yyyy",
                            ClassId = field.id.ToString()
                        };
                        if (field.value != null && !String.IsNullOrWhiteSpace(field.value))
                        {
                            entDate.Date = DateTime.Parse(field.value);
                        }
                        layout.Children.Add(entDate);
                        break;

                    case "boolean":
                        FormBoolean entToggle = new FormBoolean(field, lblText)
                        {
                            ClassId = field.id.ToString()
                        };

                        if (field.value != null && !String.IsNullOrWhiteSpace(field.value))
                        {
                            entToggle.IsToggled = field.value.Trim().ToLower() == "true";
                        }

                        layout.Children.Add(entToggle);
                        break;
                    }
                }
            }
            FormContent.Content = layout;

            // Bind the Help and Complete buttons
            btnHelp.Clicked += (sender, args) => {
                DisplayAlert("Help", "You have been alerted", "OK", "Cancel");
            };

            btnComplete.Clicked += (sender, args) =>
            {
                // if all fields are complete, set to complete status
                this.form.status2 = FormStatus.Complete;
                // Check that all required fields are valid
                if (AreAllFieldsValid())
                {
                    this.form.status2 = FormStatus.Complete;
                    Navigation.PopAsync();
                }
                else
                {
                    DisplayAlert("Form Invalid", "This form could not be marked as complete because there was invalid data entered", "Ok");
                }
            };
        }