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 FillGrid()
        {
            listAllergyDefs = AllergyDefs.GetAll(checkShowHidden.Checked);
            gridMain.BeginUpdate();
            gridMain.Columns.Clear();
            ODGridColumn col = new ODGridColumn(Lan.g("FormAllergySetup", "Desciption"), 160);

            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("FormAllergySetup", "Hidden"), 60);
            gridMain.Columns.Add(col);
            gridMain.Rows.Clear();
            ODGridRow row;

            for (int i = 0; i < listAllergyDefs.Count; i++)
            {
                row = new ODGridRow();
                row.Cells.Add(listAllergyDefs[i].Description);
                if (listAllergyDefs[i].IsHidden)
                {
                    row.Cells.Add("X");
                }
                else
                {
                    row.Cells.Add("");
                }
                gridMain.Rows.Add(row);
            }
            gridMain.EndUpdate();
        }
Exemplo n.º 3
0
        ///<summary>Loops through corresponding list and sets the index to the item matching fieldName passed in.  Only called on load.</summary>
        private void SetListMedicalSelectedIndex(MedicalListType medListType, string fieldName)
        {
            switch (medListType)
            {
            case MedicalListType.allergy:
                for (int i = 0; i < allergyList.Count; i++)
                {
                    if (AllergyDefs.GetDescription(allergyList[i].AllergyDefNum) == fieldName)
                    {
                        listMedical.SelectedIndex = i;
                    }
                }
                break;

            case MedicalListType.problem:
                for (int i = 0; i < _listDiseaseDefs.Count; i++)
                {
                    if (_listDiseaseDefs[i].DiseaseName == fieldName)
                    {
                        listMedical.SelectedIndex = i;
                    }
                }
                break;
            }
        }
Exemplo n.º 4
0
        ///<summary>Fills listMedical with the corresponding list type.  This saves on load time by only filling necessary lists.</summary>
        private void FillListMedical(MedicalListType medListType)
        {
            switch (medListType)
            {
            case MedicalListType.allergy:
                if (allergyList == null)
                {
                    allergyList = AllergyDefs.GetAll(false);
                }
                listMedical.Items.Clear();
                for (int i = 0; i < allergyList.Count; i++)
                {
                    listMedical.Items.Add(allergyList[i].Description);
                }
                break;

            case MedicalListType.problem:
                listMedical.Items.Clear();
                for (int i = 0; i < _listDiseaseDefs.Count; i++)
                {
                    listMedical.Items.Add(_listDiseaseDefs[i].DiseaseName);
                }
                break;
            }
        }
Exemplo n.º 5
0
        private static bool AllergyComparison(AutomationCondition autoCond, long patNum)
        {
            List <Allergy> allergyList = Allergies.GetAll(patNum, false);

            switch (autoCond.Comparison)
            {
            case AutoCondComparison.Equals:
                for (int i = 0; i < allergyList.Count; i++)
                {
                    if (AllergyDefs.GetOne(allergyList[i].AllergyDefNum).Description == autoCond.CompareString)
                    {
                        return(true);
                    }
                }
                break;

            case AutoCondComparison.Contains:
                for (int i = 0; i < allergyList.Count; i++)
                {
                    if (AllergyDefs.GetOne(allergyList[i].AllergyDefNum).Description.ToLower().Contains(autoCond.CompareString.ToLower()))
                    {
                        return(true);
                    }
                }
                break;
            }
            return(false);
        }
Exemplo n.º 6
0
        ///<summary>The values returned are sent to the webserver.</summary>
        public static List <AllergyDefm> GetMultAllergyDefms(List <long> allergyDefNums)
        {
            List <AllergyDef>  AllergyDefList  = AllergyDefs.GetMultAllergyDefs(allergyDefNums);
            List <AllergyDefm> AllergyDefmList = ConvertListToM(AllergyDefList);

            return(AllergyDefmList);
        }
Exemplo n.º 7
0
 private void FillAlerts()
 {
     RxAlertList = RxAlerts.Refresh(RxDefCur.RxDefNum);
     listAlerts.Items.Clear();
     for (int i = 0; i < RxAlertList.Count; i++)
     {
         if (RxAlertList[i].DiseaseDefNum > 0)
         {
             listAlerts.Items.Add(DiseaseDefs.GetName(RxAlertList[i].DiseaseDefNum));
         }
         if (RxAlertList[i].AllergyDefNum > 0)
         {
             AllergyDef allergyDef = AllergyDefs.GetOne(RxAlertList[i].AllergyDefNum);
             if (allergyDef != null)
             {
                 listAlerts.Items.Add(allergyDef.Description);
             }
         }
         if (RxAlertList[i].MedicationNum > 0)
         {
             Medications.RefreshCache();
             Medication med = Medications.GetMedication(RxAlertList[i].MedicationNum);
             if (med != null)
             {
                 listAlerts.Items.Add(med.MedName);
             }
         }
     }
 }
Exemplo n.º 8
0
        private void FillForm()
        {
            textMedName.Text = MedicationCur.MedName;
            if (!IsNew)
            {
                textMedName.ReadOnly = true;
            }
            if (MedicationCur.MedicationNum == MedicationCur.GenericNum)
            {
                textGenericName.Text = MedicationCur.MedName;
                textNotes.Text       = MedicationCur.Notes;
                textNotes.ReadOnly   = false;
                Brands = Medications.GetBrands(MedicationCur.MedicationNum);
                comboBrands.Items.Clear();
                comboBrands.Items.AddRange(Brands);
                if (Brands.Length > 0)
                {
                    comboBrands.SelectedIndex = 0;
                }
            }
            else
            {
                textGenericName.Text = Medications.GetMedication(MedicationCur.GenericNum).MedName;
                textNotes.Text       = Medications.GetMedication(MedicationCur.GenericNum).Notes;
                textNotes.ReadOnly   = true;
                Brands = new string[0];
                comboBrands.Visible = false;
                labelBrands.Visible = false;
            }
            _patNameMeds = Medications.GetPatNamesForMed(MedicationCur.MedicationNum);
            comboPatients.Items.Clear();
            comboPatients.Items.AddRange(_patNameMeds);
            if (_patNameMeds.Length > 0)
            {
                comboPatients.SelectedIndex = 0;
            }
            AllergyDef alD = AllergyDefs.GetAllergyDefFromMedication(MedicationCur.MedicationNum);

            if (alD != null)
            {
                _patNameAllergies = Allergies.GetPatNamesForAllergy(alD.AllergyDefNum);
                comboPatientAllergy.Items.Clear();
                comboPatientAllergy.Items.AddRange(_patNameAllergies);
                if (_patNameAllergies.Length > 0)
                {
                    comboPatientAllergy.SelectedIndex = 0;
                }
            }
            if (CultureInfo.CurrentCulture.Name.EndsWith("US"))             //United States
            {
                textRxNormDesc.Text = RxNorms.GetDescByRxCui(MedicationCur.RxCui.ToString());
            }
            else
            {
                labelRxNorm.Visible     = false;
                textRxNormDesc.Visible  = false;
                butRxNormSelect.Visible = false;
            }
        }
Exemplo n.º 9
0
        private void butAddNew_Click(object sender, EventArgs e)
        {
            if (gridAllergyImport.SelectedIndices.Length == 0)
            {
                MsgBox.Show(this, "A row must be selected to add");
                return;
            }
            Allergy    al;
            AllergyDef alD;
            AllergyDef alDR      = null;
            int        skipCount = 0;
            bool       isValid;

            for (int i = 0; i < gridAllergyImport.SelectedIndices.Length; i++)
            {
                isValid = true;
                //Since gridAllergyImport and ListAllergyNew are a 1:1 list we can use the selected index position to get our allergy
                al  = ListAllergyNew[gridAllergyImport.SelectedIndices[i]];
                alD = ListAllergyDefNew[gridAllergyImport.SelectedIndices[i]];              //ListAllergyDefNew is also a 1:1 to gridAllergyImport.
                for (int j = 0; j < _listAllergyReconcile.Count; j++)
                {
                    if (_listAllergyReconcile[j].IsNew)
                    {
                        alDR = ListAllergyDefNew[ListAllergyNew.IndexOf(_listAllergyReconcile[j])];
                    }
                    else
                    {
                        alDR = AllergyDefs.GetOne(_listAllergyReconcile[j].AllergyDefNum);
                    }
                    if (alDR == null)
                    {
                        continue;
                    }
                    //if(alDR.SnomedAllergyTo!="" && alDR.SnomedAllergyTo!=null && alDR.SnomedAllergyTo==alD.SnomedAllergyTo) {//TODO: Change to UNII
                    //	isValid=false;
                    //	skipCount++;
                    //	break;
                    //}
                    if (alDR.MedicationNum != 0 && alDR.MedicationNum == alD.MedicationNum)
                    {
                        isValid = false;
                        skipCount++;
                        break;
                    }
                }
                if (isValid)
                {
                    _listAllergyReconcile.Add(al);
                }
            }
            if (skipCount > 0)
            {
                MessageBox.Show(Lan.g(this, " Row(s) skipped because allergy already present in the reconcile list") + ": " + skipCount);
            }
            FillReconcileGrid();
        }
Exemplo n.º 10
0
        private void butOK_Click(object sender, EventArgs e)
        {
            if (textDescription.Text.Trim() == "")
            {
                MsgBox.Show(this, "Description cannot be blank.");
                return;
            }
            if (textUnii.Text != "" && textMedication.Text != "")
            {
                MsgBox.Show(this, "Only one code is allowed per allergy def.");
                return;
            }
            string        validChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
            StringBuilder notAllowed = new StringBuilder();

            for (int i = 0; i < textUnii.Text.Length; i++)
            {
                if (validChars.IndexOf(textUnii.Text[i]) == -1)               //Not found.
                {
                    notAllowed.Append(textUnii.Text[i]);
                }
            }
            if (notAllowed.ToString() != "")
            {
                MessageBox.Show(Lan.g(this, "UNII code has invalid characters: ") + notAllowed);
                return;
            }
            if (textUnii.Text != "" && textUnii.Text.Length != 10)
            {
                MsgBox.Show(this, "UNII code must be 10 characters in length.");
                return;
            }
            AllergyDefCur.Description = textDescription.Text;
            AllergyDefCur.IsHidden    = checkHidden.Checked;
            AllergyDefCur.SnomedType  = (SnomedAllergy)comboSnomedAllergyType.SelectedIndex;
            AllergyDefCur.UniiCode    = textUnii.Text;
            //if(snomedAllergicTo!=null) { //TODO: Do UNII check once the table is added
            //	AllergyDefCur.SnomedAllergyTo=snomedAllergicTo.SnomedCode;
            //}
            if (AllergyDefCur.IsNew)
            {
                AllergyDefs.Insert(AllergyDefCur);
            }
            else
            {
                AllergyDefs.Update(AllergyDefCur);
            }
            DialogResult = DialogResult.OK;
        }
Exemplo n.º 11
0
 private void butDelete_Click(object sender, EventArgs e)
 {
     if (!AllergyDefCur.IsNew)
     {
         if (!AllergyDefs.DefIsInUse(AllergyDefCur.AllergyDefNum))
         {
             AllergyDefs.Delete(AllergyDefCur.AllergyDefNum);
         }
         else
         {
             MsgBox.Show(this, "Cannot delete allergies in use.");
             return;
         }
     }
     DialogResult = DialogResult.Cancel;
 }
Exemplo n.º 12
0
        private static bool AllergyComparison(AutomationCondition autoCond, long patNum)
        {
            List <AllergyDef> listAllergyDefs = AllergyDefs.GetAllergyDefs(patNum, false);

            switch (autoCond.Comparison)
            {
            case AutoCondComparison.Equals:
                return(listAllergyDefs.Any(x => x.Description == autoCond.CompareString));

            case AutoCondComparison.Contains:
                return(listAllergyDefs.Any(x => x.Description.ToLower().Contains(autoCond.CompareString.ToLower())));

            default:
                return(false);
            }
        }
Exemplo n.º 13
0
        private void FillFK()
        {
            if (RuleCur.CriterionFK == -1 || RuleCur.CriterionFK == 0)
            {
                textCriterionFK.Text = "";
                return;
            }
            switch ((EhrCriterion)comboReminderCriterion.SelectedIndex)
            {
            case EhrCriterion.Problem:
                DiseaseDef def = DiseaseDefs.GetItem(RuleCur.CriterionFK);
                textCriterionFK.Text = def.DiseaseName;
                textICD9.Text        = def.ICD9Code;
                break;

            //case EhrCriterion.ICD9:
            //  textCriterionFK.Text=ICD9s.GetDescription(RuleCur.CriterionFK);
            //  break;
            case EhrCriterion.Medication:
                Medication tempMed = Medications.GetMedication(RuleCur.CriterionFK);
                if (tempMed.MedicationNum == tempMed.GenericNum)                       //handle generic medication names.
                {
                    textCriterionFK.Text = tempMed.MedName;
                }
                else
                {
                    textCriterionFK.Text = tempMed.MedName + " / " + Medications.GetGenericName(tempMed.GenericNum);
                }
                break;

            case EhrCriterion.Allergy:
                textCriterionFK.Text = AllergyDefs.GetOne(RuleCur.CriterionFK).Description;
                break;

            case EhrCriterion.Age:
            case EhrCriterion.Gender:
            case EhrCriterion.LabResult:
                //The FK boxes won't even be visible.
                break;

            default:                    //This should not happen.
                break;
            }
        }
Exemplo n.º 14
0
        ///<summary>Fills listMedical with the corresponding list type.  This saves on load time by only filling necessary lists.
        ///Attempts to seelct the cooresponding allergy/problem. Will select nothing if it does not exist. </summary>
        private void FillListMedical(MedicalListType medListType)
        {
            string medSelection = SheetFieldDefCur.FieldName.Remove(0, Math.Min(SheetFieldDefCur.FieldName.Length, 8));

            switch (medListType)
            {
            case MedicalListType.allergy:
                if (_listAllergies == null)
                {
                    _listAllergies = AllergyDefs.GetAll(false);
                }
                listMedical.SetItems(_listAllergies, (item) => item.Description, (item) => item.Description == medSelection);
                break;

            case MedicalListType.problem:
                listMedical.SetItems(_listDiseaseDefs, (item) => item.DiseaseName, (item) => item.DiseaseName == medSelection);
                break;
            }
        }
Exemplo n.º 15
0
        private void FormAllergyEdit_Load(object sender, EventArgs e)
        {
            int allergyIndex = 0;

            allergyDefList = AllergyDefs.GetAll(false);
            if (allergyDefList.Count < 1)
            {
                MsgBox.Show(this, "Need to set up at least one Allergy from EHR setup window.");
                DialogResult = DialogResult.Cancel;
                return;
            }
            for (int i = 0; i < allergyDefList.Count; i++)
            {
                comboAllergies.Items.Add(allergyDefList[i].Description);
                if (!AllergyCur.IsNew && allergyDefList[i].AllergyDefNum == AllergyCur.AllergyDefNum)
                {
                    allergyIndex = i;
                }
            }
            snomedReaction = Snomeds.GetByCode(AllergyCur.SnomedReaction);
            if (snomedReaction != null)
            {
                textSnomedReaction.Text = snomedReaction.Description;
            }
            if (!AllergyCur.IsNew)
            {
                if (AllergyCur.DateAdverseReaction < DateTime.Parse("01-01-1880"))
                {
                    textDate.Text = "";
                }
                else
                {
                    textDate.Text = AllergyCur.DateAdverseReaction.ToShortDateString();
                }
                comboAllergies.SelectedIndex = allergyIndex;
                textReaction.Text            = AllergyCur.Reaction;
                checkActive.Checked          = AllergyCur.StatusIsActive;
            }
            else
            {
                comboAllergies.SelectedIndex = 0;
            }
        }
Exemplo n.º 16
0
 private void butOK_Click(object sender, EventArgs e)
 {
     if (textDescription.Text.Trim() == "")
     {
         MsgBox.Show(this, "Description cannot be blank.");
         return;
     }
     AllergyDefCur.Description = textDescription.Text;
     AllergyDefCur.IsHidden    = checkHidden.Checked;
     AllergyDefCur.Snomed      = (SnomedAllergy)comboSnomedAllergyType.SelectedIndex;
     if (AllergyDefCur.IsNew)
     {
         AllergyDefs.Insert(AllergyDefCur);
     }
     else
     {
         AllergyDefs.Update(AllergyDefCur);
     }
     DialogResult = DialogResult.OK;
 }
Exemplo n.º 17
0
 private void FormRxAlertEdit_Load(object sender, EventArgs e)
 {
     textRxName.Text = RxDefCur.Drug;
     if (RxAlertCur.DiseaseDefNum > 0)
     {
         labelName.Text = Lan.g(this, "If the patient already has this Problem");
         textName.Text  = DiseaseDefs.GetName(RxAlertCur.DiseaseDefNum);
     }
     if (RxAlertCur.AllergyDefNum > 0)
     {
         labelName.Text = Lan.g(this, "If the patient already has this Allergy");
         textName.Text  = AllergyDefs.GetOne(RxAlertCur.AllergyDefNum).Description;
     }
     if (RxAlertCur.MedicationNum > 0)
     {
         labelName.Text = Lan.g(this, "If the patient is already taking this medication");
         textName.Text  = Medications.GetMedicationFromDb(RxAlertCur.MedicationNum).MedName;
     }
     textMessage.Text = RxAlertCur.NotificationMsg;
     checkIsHighSignificance.Checked = RxAlertCur.IsHighSignificance;
 }
Exemplo n.º 18
0
 private void FillAlerts()
 {
     RxAlertList = RxAlerts.Refresh(RxDefCur.RxDefNum);
     listAlerts.Items.Clear();
     for (int i = 0; i < RxAlertList.Count; i++)
     {
         if (RxAlertList[i].DiseaseDefNum > 0)
         {
             listAlerts.Items.Add(DiseaseDefs.GetName(RxAlertList[i].DiseaseDefNum));
         }
         if (RxAlertList[i].AllergyDefNum > 0)
         {
             listAlerts.Items.Add(AllergyDefs.GetOne(RxAlertList[i].AllergyDefNum).Description);
         }
         if (RxAlertList[i].MedicationNum > 0)
         {
             Medications.Refresh();
             listAlerts.Items.Add(Medications.GetMedication(RxAlertList[i].MedicationNum).MedName);
         }
     }
 }
Exemplo n.º 19
0
        private void FillAllergies()
        {
            allergyList = Allergies.GetAll(PatCur.PatNum, checkShowInactiveAllergies.Checked);
            gridAllergies.BeginUpdate();
            gridAllergies.Columns.Clear();
            ODGridColumn col = new ODGridColumn(Lan.g("TableAllergies", "Allergy"), 100);

            gridAllergies.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableAllergies", "Reaction"), 180);
            gridAllergies.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableAllergies", "Status"), 60, HorizontalAlignment.Center);
            gridAllergies.Columns.Add(col);
            gridAllergies.Rows.Clear();
            ODGridRow row;

            for (int i = 0; i < allergyList.Count; i++)
            {
                row = new ODGridRow();
                AllergyDef allergyDef = AllergyDefs.GetOne(allergyList[i].AllergyDefNum);
                row.Cells.Add(allergyDef.Description);
                if (allergyList[i].DateAdverseReaction < DateTime.Parse("1-1-1800"))
                {
                    row.Cells.Add(allergyList[i].Reaction);
                }
                else
                {
                    row.Cells.Add(allergyList[i].Reaction + " " + allergyList[i].DateAdverseReaction.ToShortDateString());
                }
                if (allergyList[i].StatusIsActive)
                {
                    row.Cells.Add("Active");
                }
                else
                {
                    row.Cells.Add("Inactive");
                }
                gridAllergies.Rows.Add(row);
            }
            gridAllergies.EndUpdate();
        }
Exemplo n.º 20
0
        private void FillFK()
        {
            if (RuleCur.CriterionFK == -1 || RuleCur.CriterionFK == 0)
            {
                textCriterionFK.Text = "";
                return;
            }
            switch ((EhrCriterion)comboReminderCriterion.SelectedIndex)
            {
            case EhrCriterion.Problem:
                textCriterionFK.Text = DiseaseDefs.GetName(RuleCur.CriterionFK);
                break;

            case EhrCriterion.ICD9:
                textCriterionFK.Text = ICD9s.GetDescription(RuleCur.CriterionFK);
                break;

            case EhrCriterion.Medication:
                Medication tempMed = Medications.GetMedication(RuleCur.CriterionFK);
                if (tempMed.MedicationNum == tempMed.GenericNum)                       //handle generic medication names.
                {
                    textCriterionFK.Text = tempMed.MedName;
                }
                else
                {
                    textCriterionFK.Text = tempMed.MedName + " / " + Medications.GetGenericName(tempMed.GenericNum);
                }
                break;

            case EhrCriterion.Allergy:
                textCriterionFK.Text = AllergyDefs.GetOne(RuleCur.CriterionFK).Description;
                break;

            default:
                //Nothing should happen here.
                break;
            }
        }
Exemplo n.º 21
0
 private void FormRxAlertEdit_Load(object sender, EventArgs e)
 {
     textRxName.Text = RxDefCur.Drug;
     if (RxAlertCur.DiseaseDefNum > 0)
     {
         labelName.Text = Lan.g(this, "If the patient already has this Problem");
         textName.Text  = DiseaseDefs.GetName(RxAlertCur.DiseaseDefNum);
     }
     if (RxAlertCur.AllergyDefNum > 0)
     {
         labelName.Text = Lan.g(this, "If the patient already has this Allergy");
         textName.Text  = AllergyDefs.GetOne(RxAlertCur.AllergyDefNum).Description;
     }
     if (RxAlertCur.MedicationNum > 0)
     {
         labelName.Text = Lan.g(this, "If the patient is already taking this medication");
         textName.Text  = Medications.GetMedicationFromDb(RxAlertCur.MedicationNum).MedName;
     }
     if (RxDefCur.RxCui != 0)
     {
         textRxNorm.Text = RxDefCur.RxCui.ToString() + " - " + RxNorms.GetDescByRxCui(RxDefCur.RxCui.ToString());
     }
     textMessage.Text = RxAlertCur.NotificationMsg;
 }
Exemplo n.º 22
0
        private void FillGrid()
        {
            gridMain.BeginUpdate();
            gridMain.Columns.Clear();
            ODGridColumn col = new ODGridColumn("Category", 80);

            gridMain.Columns.Add(col);
            col = new ODGridColumn("Code", 100);
            gridMain.Columns.Add(col);
            col = new ODGridColumn("CodeSystem", 120);
            gridMain.Columns.Add(col);
            //col=new ODGridColumn("Op+Value",80);//Example: >=150
            //gridMain.Columns.Add(col);
            col = new ODGridColumn("Description", 250);         //Also includes values for labloinc and demographics and vitals. Example: ">150, BP Systolic"
            gridMain.Columns.Add(col);
            gridMain.Rows.Clear();
            ODGridRow row;

            //EhrTriggerCur.ProblemDefNumList-----------------------------------------------------------------------------------------------------------------------
            string[] arrayString = EhrTriggerCur.ProblemDefNumList.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
            for (int i = 0; i < arrayString.Length; i++)
            {
                row = new ODGridRow();
                row.Cells.Add("Problem");
                row.Cells.Add(arrayString[i]);
                row.Cells.Add("Problem Def");
                row.Cells.Add(DiseaseDefs.GetItem(PIn.Long(arrayString[i])).DiseaseName);
                gridMain.Rows.Add(row);
            }
            //EhrTriggerCur.ProblemIcd9List---------------------------------------------------------------------------------------------------------------------------
            arrayString = EhrTriggerCur.ProblemIcd9List.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
            for (int i = 0; i < arrayString.Length; i++)
            {
                row = new ODGridRow();
                row.Cells.Add("Problem");
                row.Cells.Add(arrayString[i]);
                row.Cells.Add("ICD9 CM");
                row.Cells.Add(ICD9s.GetByCode(arrayString[i]).Description);
                gridMain.Rows.Add(row);
            }
            //EhrTriggerCur.ProblemIcd10List;
            arrayString = EhrTriggerCur.ProblemIcd10List.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
            for (int i = 0; i < arrayString.Length; i++)
            {
                row = new ODGridRow();
                row.Cells.Add("Problem");
                row.Cells.Add(arrayString[i]);
                row.Cells.Add("ICD10 CM");
                row.Cells.Add(Icd10s.GetByCode(arrayString[i]).Description);
                gridMain.Rows.Add(row);
            }
            //EhrTriggerCur.ProblemSnomedList;
            arrayString = EhrTriggerCur.ProblemSnomedList.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
            for (int i = 0; i < arrayString.Length; i++)
            {
                row = new ODGridRow();
                row.Cells.Add("Problem");
                row.Cells.Add(arrayString[i]);
                row.Cells.Add("SNOMED CT");
                row.Cells.Add(Snomeds.GetByCode(arrayString[i]).Description);
                gridMain.Rows.Add(row);
            }
            //EhrTriggerCur.MedicationNumList
            arrayString = EhrTriggerCur.MedicationNumList.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
            for (int i = 0; i < arrayString.Length; i++)
            {
                row = new ODGridRow();
                row.Cells.Add("Medication");
                row.Cells.Add(arrayString[i]);
                row.Cells.Add("Medication Def");
                row.Cells.Add(Medications.GetDescription(PIn.Long(arrayString[i])));
                gridMain.Rows.Add(row);
            }
            //EhrTriggerCur.RxCuiList
            arrayString = EhrTriggerCur.RxCuiList.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
            for (int i = 0; i < arrayString.Length; i++)
            {
                row = new ODGridRow();
                row.Cells.Add("Medication");
                row.Cells.Add(arrayString[i]);
                row.Cells.Add("RxCui");
                row.Cells.Add(RxNorms.GetByRxCUI(arrayString[i]).Description);
                gridMain.Rows.Add(row);
            }
            //EhrTriggerCur.CvxList
            arrayString = EhrTriggerCur.CvxList.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
            for (int i = 0; i < arrayString.Length; i++)
            {
                row = new ODGridRow();
                row.Cells.Add("Medication");
                row.Cells.Add(arrayString[i]);
                row.Cells.Add("Cvx");
                row.Cells.Add(Cvxs.GetByCode(arrayString[i]).Description);
                gridMain.Rows.Add(row);
            }
            //EhrTriggerCur.AllergyDefNumList
            arrayString = EhrTriggerCur.AllergyDefNumList.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
            for (int i = 0; i < arrayString.Length; i++)
            {
                row = new ODGridRow();
                row.Cells.Add("Allergy");
                row.Cells.Add(arrayString[i]);
                row.Cells.Add("Allergy Def");
                row.Cells.Add(AllergyDefs.GetOne(PIn.Long(arrayString[i])).Description);
                gridMain.Rows.Add(row);
            }
            //EhrTriggerCur.DemographicsList
            arrayString = EhrTriggerCur.DemographicsList.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
            for (int i = 0; i < arrayString.Length; i++)
            {
                row = new ODGridRow();
                string[] arrayStringElements = arrayString[i].Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                switch (arrayStringElements[0])
                {
                case "age":
                    row.Cells.Add("Demographic");
                    row.Cells.Add("30525-0");
                    row.Cells.Add("LOINC");
                    row.Cells.Add("Age" + arrayStringElements[1]);                          //Example "Age>55"
                    gridMain.Rows.Add(row);
                    break;

                case "gender":
                    row.Cells.Add("Demographic");
                    row.Cells.Add("46098-0");
                    row.Cells.Add("LOINC");
                    row.Cells.Add("Gender:" + arrayString[i].Replace("gender,", ""));                         //Example "Gender:Male, Female, Unknown/Undifferentiated"
                    gridMain.Rows.Add(row);
                    break;

                default:
                    //should never happen
                    continue;                            //next trigger
                }
            }
            //EhrTriggerCur.LabLoincList
            arrayString = EhrTriggerCur.LabLoincList.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
            for (int i = 0; i < arrayString.Length; i++)
            {
                row = new ODGridRow();
                Loinc _loincTemp = Loincs.GetByCode(arrayString[i]);              //.Split(new string[] { ";" },StringSplitOptions.None)[0]);
                if (_loincTemp == null)
                {
                    continue;
                }
                row.Cells.Add("Laboratory");
                row.Cells.Add(_loincTemp.LoincCode);
                row.Cells.Add("LOINC");
                row.Cells.Add(_loincTemp.NameShort);
                //switch(arrayString[i].Split(new string[] { ";" },StringSplitOptions.RemoveEmptyEntries).Length) {
                //	case 1://loinc only comparison
                //		row.Cells.Add(_loincTemp.NameShort);
                //		break;
                //	case 2://microbiology or unitless lab.
                //		Snomed _snomedTemp=Snomeds.GetByCode(arrayString[i].Split(new string[] { ";" },StringSplitOptions.None)[1]);
                //		row.Cells.Add(_loincTemp.NameShort+", "
                //			+(_snomedTemp==null?arrayString[i].Split(new string[] { ";" },StringSplitOptions.None)[1]:_snomedTemp.Description));//Example: Bacteria Identified, Campylobacter jenuni
                //		break;
                //	case 3://"traditional lab results"
                //		row.Cells.Add(_loincTemp.NameShort+" "
                //	+arrayString[i].Split(new string[] { ";" },StringSplitOptions.None)[1]+" "//example: >150 or a snomed code if microbiology
                //	+arrayString[i].Split(new string[] { ";" },StringSplitOptions.None)[2]    //example: mg/dL or blank
                //			);
                //		break;
                //	default://should never happen. Will display blank.
                //		row.Cells.Add("");
                //		break;
                //}
                gridMain.Rows.Add(row);
            }
            //EhrTriggerCur.VitalLoincList
            arrayString = EhrTriggerCur.VitalLoincList.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
            for (int i = 0; i < arrayString.Length; i++)
            {
                row = new ODGridRow();
                string[] arrayStringElements = arrayString[i].Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                switch (arrayStringElements[0])
                {
                case "height":
                    row.Cells.Add("Vitals");
                    row.Cells.Add("8302-2");
                    row.Cells.Add("LOINC");
                    row.Cells.Add("Height" + arrayString[i].Replace("height,", "") + " in.");                       //Example "Age>55"
                    gridMain.Rows.Add(row);
                    break;

                case "weight":
                    row.Cells.Add("Vitals");
                    row.Cells.Add("29463-7");
                    row.Cells.Add("LOINC");
                    row.Cells.Add("Weight:" + arrayString[i].Replace("weight,", ""));                         //Example "Gender:Male, Female, Unknown/Undifferentiated"
                    gridMain.Rows.Add(row);
                    break;

                case "bp???":
                    row.Cells.Add("Vitals");
                    row.Cells.Add("???There are two.");
                    row.Cells.Add("LOINC");
                    row.Cells.Add("???");                            //Example "Gender:Male, Female, Unknown/Undifferentiated"
                    gridMain.Rows.Add(row);
                    break;

                case "BMI":
                    row.Cells.Add("Vitals");
                    row.Cells.Add("39156-5");
                    row.Cells.Add("LOINC");
                    row.Cells.Add("BMI" + arrayString[i].Replace("BMI,", "").Replace("%", "") + "%");                      //Example "Gender:Male, Female, Unknown/Undifferentiated"
                    gridMain.Rows.Add(row);
                    break;

                default:
                    //should never happen
                    continue;                            //next trigger
                }
            }
            //End trigger fields.
            gridMain.EndUpdate();
        }
Exemplo n.º 23
0
 private void butOK_Click(object sender, EventArgs e)
 {
     //Validate
     if (textDate.Text != "")
     {
         try {
             DateTime.Parse(textDate.Text);
         }
         catch {
             MessageBox.Show("Please input a valid date.");
             return;
         }
     }
     //Save
     if (textDate.Text != "")
     {
         AllergyCur.DateAdverseReaction = DateTime.Parse(textDate.Text);
     }
     else
     {
         AllergyCur.DateAdverseReaction = DateTime.MinValue;
     }
     AllergyCur.AllergyDefNum  = allergyDefList[comboAllergies.SelectedIndex].AllergyDefNum;
     AllergyCur.Reaction       = textReaction.Text;
     AllergyCur.SnomedReaction = "";
     if (snomedReaction != null)
     {
         AllergyCur.SnomedReaction = snomedReaction.SnomedCode;
     }
     AllergyCur.StatusIsActive = checkActive.Checked;
     if (AllergyCur.IsNew)
     {
         Allergies.Insert(AllergyCur);
         SecurityLogs.MakeLogEntry(Permissions.PatAllergyListEdit, AllergyCur.PatNum, AllergyDefs.GetDescription(AllergyCur.AllergyDefNum) + " added");
     }
     else
     {
         Allergies.Update(AllergyCur);
         SecurityLogs.MakeLogEntry(Permissions.PatAllergyListEdit, AllergyCur.PatNum, AllergyDefs.GetDescription(AllergyCur.AllergyDefNum) + " edited");
     }
     DialogResult = DialogResult.OK;
 }
Exemplo n.º 24
0
 private void butDelete_Click(object sender, EventArgs e)
 {
     if (AllergyCur.IsNew)
     {
         DialogResult = DialogResult.Cancel;
         return;
     }
     if (!MsgBox.Show(this, MsgBoxButtons.OKCancel, "Delete?"))
     {
         return;
     }
     Allergies.Delete(AllergyCur.AllergyNum);
     SecurityLogs.MakeLogEntry(Permissions.PatAllergyListEdit, AllergyCur.PatNum, AllergyDefs.GetDescription(AllergyCur.AllergyDefNum) + " deleted");
     DialogResult = DialogResult.OK;
 }
Exemplo n.º 25
0
        private void FillExistingGrid()
        {
            gridAllergyExisting.BeginUpdate();
            gridAllergyExisting.Columns.Clear();
            ODGridColumn col = new ODGridColumn("Last Modified", 90, HorizontalAlignment.Center);

            gridAllergyExisting.Columns.Add(col);
            col = new ODGridColumn("Description", 200);
            gridAllergyExisting.Columns.Add(col);
            col = new ODGridColumn("Reaction", 100);
            gridAllergyExisting.Columns.Add(col);
            col = new ODGridColumn("Inactive", 80, HorizontalAlignment.Center);
            gridAllergyExisting.Columns.Add(col);
            gridAllergyExisting.Rows.Clear();
            _listAllergyCur = Allergies.GetAll(_patCur.PatNum, false);
            List <long> allergyDefNums = new List <long>();

            for (int h = 0; h < _listAllergyCur.Count; h++)
            {
                if (_listAllergyCur[h].AllergyDefNum > 0)
                {
                    allergyDefNums.Add(_listAllergyCur[h].AllergyDefNum);
                }
            }
            _listAllergyDefCur = AllergyDefs.GetMultAllergyDefs(allergyDefNums);
            ODGridRow  row;
            AllergyDef ald;

            for (int i = 0; i < _listAllergyCur.Count; i++)
            {
                row = new ODGridRow();
                ald = new AllergyDef();
                ald = AllergyDefs.GetOne(_listAllergyCur[i].AllergyDefNum, _listAllergyDefCur);
                row.Cells.Add(_listAllergyCur[i].DateTStamp.ToShortDateString());
                if (ald.Description == null)
                {
                    row.Cells.Add("");
                }
                else
                {
                    row.Cells.Add(ald.Description);
                }
                if (_listAllergyCur[i].Reaction == null)
                {
                    row.Cells.Add("");
                }
                else
                {
                    row.Cells.Add(_listAllergyCur[i].Reaction);
                }
                if (_listAllergyCur[i].StatusIsActive)
                {
                    row.Cells.Add("");
                }
                else
                {
                    row.Cells.Add("X");
                }
                gridAllergyExisting.Rows.Add(row);
            }
            gridAllergyExisting.EndUpdate();
        }
Exemplo n.º 26
0
        private void butAddExist_Click(object sender, EventArgs e)
        {
            if (gridAllergyExisting.SelectedIndices.Length == 0)
            {
                MsgBox.Show(this, "A row must be selected to add");
                return;
            }
            Allergy    al;
            AllergyDef alD;
            int        skipCount = 0;
            bool       isValid;

            for (int i = 0; i < gridAllergyExisting.SelectedIndices.Length; i++)
            {
                isValid = true;
                //Since gridAllergyExisting and _listAllergyCur are a 1:1 list we can use the selected index position to get our allergy
                al  = _listAllergyCur[gridAllergyExisting.SelectedIndices[i]];
                alD = AllergyDefs.GetOne(al.AllergyDefNum, _listAllergyDefCur);
                if (_listAllergyReconcile.Count == 0)
                {
                    _listAllergyReconcile.Add(al);
                    continue;
                }
                for (int j = 0; j < _listAllergyReconcile.Count; j++)
                {
                    if (!_listAllergyReconcile[j].IsNew && _listAllergyReconcile[j].AllergyNum == al.AllergyNum)                   //If not new, then from existing list.  Check allergynums
                    {
                        isValid = false;
                        skipCount++;
                        break;
                    }
                    if (_listAllergyReconcile[j].IsNew)
                    {
                        //This is an allergy that is coming in from and external source.
                        AllergyDef alDN  = null;
                        int        index = ListAllergyNew.IndexOf(_listAllergyReconcile[j]);               //Find the corresponding allergy def by looping through the incoming allergies.
                        if (index == -1)
                        {
                            continue;                            //This should not happen
                        }
                        alDN = ListAllergyDefNew[index];         //Incoming allergy and allergy def lists are 1 to 1 so we can use the same index.
                        if (alDN != null && alDN.MedicationNum == alD.MedicationNum)
                        {
                            isValid = false;
                            skipCount++;
                            break;
                        }
                    }
                    if (al.AllergyDefNum == _listAllergyReconcile[j].AllergyDefNum)
                    {
                        isValid = false;
                        skipCount++;
                        break;
                    }
                    if (!isValid)
                    {
                        break;
                    }
                }
                if (isValid)
                {
                    _listAllergyReconcile.Add(al);
                }
            }
            if (skipCount > 0)
            {
                MessageBox.Show(Lan.g(this, " Row(s) skipped because allergy already present in the reconcile list") + ": " + skipCount);
            }
            FillReconcileGrid();
        }
Exemplo n.º 27
0
        private void butOK_Click(object sender, EventArgs e)
        {
            if (_listAllergyReconcile.Count == 0)
            {
                if (!MsgBox.Show(this, true, "The reconcile list is empty which will cause all existing allergies to be removed.  Continue?"))
                {
                    return;
                }
            }
            Allergy    al;
            AllergyDef alD;
            bool       isActive;

            //Discontinue any current medications that are not present in the reconcile list.
            for (int i = 0; i < _listAllergyCur.Count; i++)       //Start looping through all current allergies
            {
                isActive = false;
                al       = _listAllergyCur[i];
                alD      = AllergyDefs.GetOne(al.AllergyDefNum, _listAllergyDefCur);
                for (int j = 0; j < _listAllergyReconcile.Count; j++)           //Compare each reconcile allergy to the current allergy
                {
                    AllergyDef alDR = AllergyDefs.GetOne(_listAllergyReconcile[j].AllergyDefNum, _listAllergyDefCur);
                    if (_listAllergyReconcile[j].AllergyDefNum == _listAllergyCur[i].AllergyDefNum)                   //Has identical AllergyDefNums
                    {
                        isActive = true;
                        break;
                    }
                    if (alDR == null)
                    {
                        continue;
                    }
                    //if(alDR.SnomedAllergyTo!="" && alDR.SnomedAllergyTo==alD.SnomedAllergyTo) {//TODO: Change to UNII
                    //	isActive=true;
                    //	break;
                    //}
                    if (alDR.MedicationNum != 0 && alDR.MedicationNum == alD.MedicationNum)                 //Has a Snomed code and they are equal
                    {
                        isActive = true;
                        break;
                    }
                }
                if (!isActive)
                {
                    _listAllergyCur[i].StatusIsActive = isActive;
                    Allergies.Update(_listAllergyCur[i]);
                }
            }
            //Always update every current allergy for the patient so that DateTStamp reflects the last reconcile date.
            if (_listAllergyCur.Count > 0)
            {
                Allergies.ResetTimeStamps(_patCur.PatNum, true);
            }
            AllergyDef alDU;
            int        index;

            for (int j = 0; j < _listAllergyReconcile.Count; j++)
            {
                if (!_listAllergyReconcile[j].IsNew)
                {
                    continue;
                }
                index = ListAllergyNew.IndexOf(_listAllergyReconcile[j]);              //Returns -1 if not found.
                if (index < 0)
                {
                    continue;
                }
                //Insert the AllergyDef and Allergy if needed.
                if (ListAllergyDefNew[index].MedicationNum != 0)
                {
                    alDU = AllergyDefs.GetAllergyDefFromMedication(ListAllergyDefNew[index].MedicationNum);
                }
                else
                {
                    alDU = null;                  //remove once UNII is implemented
                    //alDU=AllergyDefs.GetAllergyDefFromCode(ListAllergyDefNew[index].SnomedAllergyTo);//TODO: Change to UNII
                }
                if (alDU == null)               //db is missing the def
                {
                    ListAllergyNew[index].AllergyDefNum = AllergyDefs.Insert(ListAllergyDefNew[index]);
                }
                else
                {
                    ListAllergyNew[index].AllergyDefNum = alDU.AllergyDefNum;                  //Set the allergydefnum on the allergy.
                }
                Allergies.Insert(ListAllergyNew[index]);
            }
            //TODO: Make an allergy measure event if one is needed for MU3.
            //EhrMeasureEvent newMeasureEvent = new EhrMeasureEvent();
            //newMeasureEvent.DateTEvent=DateTime.Now;
            //newMeasureEvent.EventType=EhrMeasureEventType.AllergyReconcile;
            //newMeasureEvent.PatNum=PatCur.PatNum;
            //newMeasureEvent.MoreInfo="";
            //EhrMeasureEvents.Insert(newMeasureEvent);
            for (int inter = 0; inter < _listAllergyReconcile.Count; inter++)
            {
                if (CDSPermissions.GetForUser(Security.CurUser.UserNum).ShowCDS&& CDSPermissions.GetForUser(Security.CurUser.UserNum).AllergyCDS)
                {
                    AllergyDef          alDInter = AllergyDefs.GetOne(_listAllergyReconcile[inter].AllergyDefNum);
                    FormCDSIntervention FormCDSI = new FormCDSIntervention();
                    FormCDSI.ListCDSI = EhrTriggers.TriggerMatch(alDInter, _patCur);
                    FormCDSI.ShowIfRequired(false);
                }
            }
            DialogResult = DialogResult.OK;
        }
Exemplo n.º 28
0
 ///<summary>The values returned are sent to the webserver.</summary>
 public static List <long> GetChangedSinceAllergyDefNums(DateTime changedSince)
 {
     return(AllergyDefs.GetChangedSinceAllergyDefNums(changedSince));
 }
        private void butPicker_Click(object sender, EventArgs e)
        {
            switch (listRestriction.SelectedIndex)
            {
            case 0:                    //Birthdate
                //Not visible
                break;

            case 1:                    //problem
                if (sender.Equals(butPicker))
                {
                    FormIcd9s FormI9 = new FormIcd9s();
                    FormI9.IsSelectionMode = true;
                    FormI9.ShowDialog();
                    if (FormI9.DialogResult != DialogResult.OK)
                    {
                        return;
                    }
                    textCompareString.Text = FormI9.SelectedIcd9.ICD9Code;
                    textSNOMED.Text        = "";
                }
                else if (sender.Equals(butSNOMED))
                {
                    FormSnomeds FormS = new FormSnomeds();
                    FormS.IsSelectionMode = true;
                    FormS.ShowDialog();
                    if (FormS.DialogResult != DialogResult.OK)
                    {
                        return;
                    }
                    textSNOMED.Text        = FormS.SelectedSnomed.SnomedCode;
                    textCompareString.Text = "";
                }
                break;

            case 2:                    //Medication
                FormMedications FormM = new FormMedications();
                FormM.IsSelectionMode = true;
                FormM.ShowDialog();
                if (FormM.DialogResult != DialogResult.OK)
                {
                    return;
                }
                textCompareString.Text = Medications.GetNameOnly(FormM.SelectedMedicationNum);
                break;

            case 3:                    //LabResult
                //Not visible
                break;

            case 4:                    //Gender
                //Not visible
                break;

            case 5:                    //Comm preference
                FormCommPrefPicker FormCPP = new FormCommPrefPicker();
                FormCPP.ShowDialog();
                if (FormCPP.DialogResult != DialogResult.OK)
                {
                    return;
                }
                textCompareString.Text = Enum.GetName(typeof(ContactMethod), FormCPP.ContMethCur);
                break;

            case 6:                    //Alergy
                FormAllergySetup FormAS = new FormAllergySetup();
                FormAS.IsSelectionMode = true;
                FormAS.ShowDialog();
                if (FormAS.DialogResult != DialogResult.OK)
                {
                    return;
                }
                textCompareString.Text = AllergyDefs.GetDescription(FormAS.SelectedAllergyDefNum);
                break;

            default:                    //should never happen
                break;
            }
        }
        private bool IsValid()
        {
            int index = listRestriction.SelectedIndex;

            if (index != 3)           //Not LabResult
            {
                textLabValue.Text = "";
            }
            if (index == 4)
            {
                textCompareString.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 or ICD9 code.");
                    return(false);
                }
                if (textCompareString.Text != "")
                {
                    if (ICD9s.GetByCode(textCompareString.Text) == null)
                    {
                        MsgBox.Show(this, "ICD9 code does not exist in database, pick from list.");
                        return(false);
                    }
                }
                if (textSNOMED.Text != "")
                {
                    if (Snomeds.GetByCode(textSNOMED.Text) == null)
                    {
                        MsgBox.Show(this, "SNOMED code does not exist in database, pick from list.");
                        return(false);
                    }
                }
                if (textDateStart.errorProvider1.GetError(textDateStart) != "" ||
                    textDateStop.errorProvider1.GetError(textDateStop) != ""
                    )
                {
                    MessageBox.Show(Lan.g(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) != ""
                    )
                {
                    MessageBox.Show(Lan.g(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) != ""
                    )
                {
                    MessageBox.Show(Lan.g(this, "Please fix date entry errors."));
                    return(false);
                }
                break;

            case 4:                     //Gender---------------------------------------------------------------------------------------------------------------
                break;

            case 5:                     //CommPref-------------------------------------------------------------------------------------------------------------
                if (textCompareString.Text == "")
                {
                    MsgBox.Show(this, "Please enter a communication preference.");
                    return(false);
                }
                if (LOINCs.GetByCode(textCompareString.Text) == null)
                {
                    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) != ""
                    )
                {
                    MessageBox.Show(Lan.g(this, "Please fix date entry errors."));
                    return(false);
                }
                break;
            }
            return(true);
        }