Exemplo n.º 1
0
        private void FillGrid()
        {
            gridMain.BeginUpdate();
            gridMain.Columns.Clear();
            ODGridColumn col;

            col = new ODGridColumn("Reminder Criterion", 200);
            gridMain.Columns.Add(col);
            col = new ODGridColumn("Message", 200);
            gridMain.Columns.Add(col);
            listReminders = ReminderRules.SelectAll();
            gridMain.Rows.Clear();
            ODGridRow row;

            for (int i = 0; i < listReminders.Count; i++)
            {
                row = new ODGridRow();
                switch (listReminders[i].ReminderCriterion)
                {
                case EhrCriterion.Problem:
                    DiseaseDef def = DiseaseDefs.GetItem(listReminders[i].CriterionFK);
                    row.Cells.Add("Problem =" + def.ICD9Code + " " + def.DiseaseName);
                    break;

                case EhrCriterion.Medication:
                    Medication tempMed = Medications.GetMedication(listReminders[i].CriterionFK);
                    if (tempMed.MedicationNum == tempMed.GenericNum)                           //handle generic medication names.
                    {
                        row.Cells.Add("Medication = " + tempMed.MedName);
                    }
                    else
                    {
                        row.Cells.Add("Medication = " + tempMed.MedName + " / " + Medications.GetGenericName(tempMed.GenericNum));
                    }
                    break;

                case EhrCriterion.Allergy:
                    row.Cells.Add("Allergy = " + AllergyDefs.GetOne(listReminders[i].CriterionFK).Description);
                    break;

                case EhrCriterion.Age:
                    row.Cells.Add("Age " + listReminders[i].CriterionValue);
                    break;

                case EhrCriterion.Gender:
                    row.Cells.Add("Gender is " + listReminders[i].CriterionValue);
                    break;

                case EhrCriterion.LabResult:
                    row.Cells.Add("LabResult " + listReminders[i].CriterionValue);
                    break;
                    //case EhrCriterion.ICD9:
                    //  row.Cells.Add("ICD9 "+ICD9s.GetDescription(listReminders[i].CriterionFK));
                    //  break;
                }
                row.Cells.Add(listReminders[i].Message);
                gridMain.Rows.Add(row);
            }
            gridMain.EndUpdate();
        }
Exemplo n.º 2
0
 private void butDelete_Click(object sender, EventArgs e)
 {
     if (IsNew)
     {
         DialogResult = DialogResult.Cancel;
     }
     else
     {
         ReminderRules.Delete(RuleCur.ReminderRuleNum);
         DialogResult = DialogResult.OK;
     }
 }
Exemplo n.º 3
0
 private void butOk_Click(object sender, EventArgs e)
 {
     //Validate
     RuleCur.ReminderCriterion = (EhrCriterion)comboReminderCriterion.SelectedIndex;
     if (RuleCur.ReminderCriterion == EhrCriterion.Problem ||
         RuleCur.ReminderCriterion == EhrCriterion.Medication ||
         RuleCur.ReminderCriterion == EhrCriterion.Allergy)
     //|| RuleCur.ReminderCriterion==EhrCriterion.ICD9)
     {
         RuleCur.CriterionValue = "";
         if (RuleCur.CriterionFK == -1 || RuleCur.CriterionFK == 0)
         {
             MessageBox.Show("Please select a valid " + RuleCur.ReminderCriterion.ToString().ToLower() + ".");
             return;
         }
     }
     else if (RuleCur.ReminderCriterion == EhrCriterion.Gender)
     {
         RuleCur.CriterionFK = 0;
         if (textCriterionValue.Text.ToLower() != "male" && textCriterionValue.Text.ToLower() != "female")
         {
             MessageBox.Show("Please input male or female for gender value.");
             return;
         }
         RuleCur.CriterionValue = textCriterionValue.Text.ToLower();
     }
     else if (RuleCur.ReminderCriterion == EhrCriterion.LabResult)
     {
         RuleCur.CriterionFK = 0;
         if (textCriterionValue.Text == "")
         {
             MessageBox.Show("Please input a valid lab result.");
             return;
         }
         RuleCur.CriterionValue = textCriterionValue.Text;
     }
     else              //Age
     {
         if (textCriterionValue.Text.Length < 2)
         {
             MessageBox.Show("Criterion value must be comparator followed by an age. eg. \"<18\".");
             return;
         }
         if (textCriterionValue.Text[0] != '<' && textCriterionValue.Text[0] != '>')
         {
             MessageBox.Show("Age criterion must begin with either \"<\" or \">\".");
             return;
         }
         int tempAge;
         if (!int.TryParse(textCriterionValue.Text.Substring(1, textCriterionValue.Text.Length - 1), out tempAge))
         {
             MessageBox.Show("Age criterion is not in the form of a valid age.");
             return;
         }
         if (tempAge < 0 || tempAge > 200)
         {
             MessageBox.Show("Age must be between 0 and 200.");
             return;
         }
         RuleCur.CriterionValue = textCriterionValue.Text;
     }
     if (textReminderMessage.Text.Length > 255)
     {
         MessageBox.Show("Reminder message must be shorter than 255 characters.");
         return;
     }
     RuleCur.Message = textReminderMessage.Text;
     if (RuleCur.Message == "")
     {
         MessageBox.Show("Reminder will be saved with no reminder message.");
     }
     if (IsNew)
     {
         ReminderRules.Insert(RuleCur);
     }
     else
     {
         ReminderRules.Update(RuleCur);
     }
     DialogResult = DialogResult.OK;
 }