Esempio n. 1
0
 private void FormPatListElementEdit_Load(object sender, EventArgs e)
 {
     listRestriction.Items.Clear();
     for (int i = 0; i < Enum.GetNames(typeof(EhrRestrictionType)).Length; i++)
     {
         listRestriction.Items.Add(Enum.GetNames(typeof(EhrRestrictionType))[i]);
     }
     listRestriction.SelectedIndex = (int)Element.Restriction;
     listOperand.SelectedIndex     = (int)Element.Operand;
     textCompareString.Text        = Element.CompareString;
     if (Element.Restriction == EhrRestrictionType.Problem && !IsNew)
     {
         textCompareString.Text = "";              //clear text box for simplicity
         if (ICD9s.CodeExists(Element.CompareString))
         {
             textCompareString.Text = Element.CompareString;
         }
         else if (Snomeds.CodeExists(Element.CompareString))
         {
             textSNOMED.Text = Element.CompareString;
         }
         else
         {
             MsgBox.Show(this, "Problem code provided is not an existing ICD9 or SNOMED code.");
             //no harm in continuing since this form is error checked on OK click.
         }
     }
     fillCombos();
     if (!IsNew)
     {
         comboUnits.Text = Element.LabValueUnits;
         comboLabValueType.SelectedIndex = (int)Element.LabValueType;
     }
     textLabValue.Text = Element.LabValue;
     if (Element.StartDate.Year > 1880)
     {
         textDateStart.Text = Element.StartDate.ToShortDateString();
     }
     if (Element.EndDate.Year > 1880)
     {
         textDateStop.Text = Element.EndDate.ToShortDateString();
     }
     ChangeLayout();
 }
Esempio n. 2
0
 private void butOK_Click(object sender, EventArgs e)
 {
     Icd9Cur.ICD9Code    = textCode.Text;
     Icd9Cur.Description = textDescription.Text;
     if (IsNew)                                  //Used the "+Add" button to open this form.
     {
         if (ICD9s.CodeExists(Icd9Cur.ICD9Code)) //Must enter a unique code.
         {
             MsgBox.Show(this, "You must choose a unique code.");
             return;
         }
         ICD9s.Insert(Icd9Cur);
     }
     else
     {
         ICD9s.Update(Icd9Cur);
     }
     DialogResult = DialogResult.OK;
 }
Esempio n. 3
0
        private bool IsValid()
        {
            int index = listRestriction.SelectedIndex;

            if (index != 3)           //Not LabResult
            {
                textLabValue.Text = "";
            }
            switch (index)
            {
            case 0:                                          //Birthdate------------------------------------------------------------------------------------------------------------
                try {
                    Convert.ToInt32(textCompareString.Text); //used intead of PIn so that an empty string is not evaluated as 0
                }
                catch {
                    MsgBox.Show(this, "Please enter a valid age.");
                    return(false);
                }
                break;

            case 1:                     //Disease--------------------------------------------------------------------------------------------------------------
                if (textCompareString.Text == "" && textSNOMED.Text == "")
                {
                    MsgBox.Show(this, "Please enter a valid SNOMED CT or ICD9 code.");
                    return(false);
                }
                if (textCompareString.Text != "")
                {
                    if (!ICD9s.CodeExists(textCompareString.Text))
                    {
                        MsgBox.Show(this, "ICD9 code does not exist in database, pick from list.");
                        return(false);
                    }
                }
                if (textSNOMED.Text != "")
                {
                    if (!Snomeds.CodeExists(textSNOMED.Text))
                    {
                        MsgBox.Show(this, "SNOMED CT code does not exist in database, pick from list.");
                        return(false);
                    }
                }
                if (textDateStart.errorProvider1.GetError(textDateStart) != "" ||
                    textDateStop.errorProvider1.GetError(textDateStop) != ""
                    )
                {
                    MsgBox.Show(this, "Please fix date entry errors.");
                    return(false);
                }
                break;

            case 2:                     //Medication-----------------------------------------------------------------------------------------------------------
                if (textCompareString.Text == "")
                {
                    MsgBox.Show(this, "Please enter a valid medication.");
                    return(false);
                }
                if (Medications.GetMedicationFromDbByName(textCompareString.Text) == null)
                {
                    MsgBox.Show(this, "Medication does not exist in database, pick from list.");
                    return(false);
                }
                if (textDateStart.errorProvider1.GetError(textDateStart) != "" ||
                    textDateStop.errorProvider1.GetError(textDateStop) != ""
                    )
                {
                    MsgBox.Show(this, "Please fix date entry errors.");
                    return(false);
                }
                break;

            case 3:                     //LabResult------------------------------------------------------------------------------------------------------------
                if (textCompareString.Text == "")
                {
                    MsgBox.Show(this, "Please select a valid Loinc Code.");
                    return(false);
                }
                //if(Loincs.GetByCode(textCompareString.Text)==null) {
                //	MsgBox.Show(this,"Loinc code does not exist in database, pick from list.");
                //	return false;
                //}
                if (textDateStart.errorProvider1.GetError(textDateStart) != "" ||
                    textDateStop.errorProvider1.GetError(textDateStop) != ""
                    )
                {
                    MsgBox.Show(this, "Please fix date entry errors.");
                    return(false);
                }
                break;

            case 4:                     //Gender---------------------------------------------------------------------------------------------------------------
                textCompareString.Text = "";
                break;

            case 5:                     //CommPref-------------------------------------------------------------------------------------------------------------
                if (textCompareString.Text == "")
                {
                    MsgBox.Show(this, "Please enter a communication preference.");
                    return(false);
                }
                if (!isContactMethod(textCompareString.Text))
                {
                    MsgBox.Show(this, "Communication preference not defined, pick from list.");
                    return(false);
                }
                break;

            case 6:                     //Allergy--------------------------------------------------------------------------------------------------------------
                if (textCompareString.Text == "")
                {
                    MsgBox.Show(this, "Please enter a valid allergy.");
                    return(false);
                }
                if (AllergyDefs.GetByDescription(textCompareString.Text) == null)
                {
                    MsgBox.Show(this, "Allergy does not exist in database, pick from list.");
                    return(false);
                }
                if (textDateStart.errorProvider1.GetError(textDateStart) != "" ||
                    textDateStop.errorProvider1.GetError(textDateStop) != ""
                    )
                {
                    MsgBox.Show(this, "Please fix date entry errors.");
                    return(false);
                }
                break;
            }
            return(true);
        }