Exemple #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();
 }
        private void FormEncounterTool_Load(object sender, EventArgs e)
        {
            FillRecEncCodesList();
            int countNotInSnomedTable = 0;

            for (int i = 0; i < _listRecEncCodes.Count; i++)
            {
                if (!Snomeds.CodeExists(_listRecEncCodes[i]))
                {
                    countNotInSnomedTable++;
                    continue;
                }
                comboEncCodes.Items.Add(_listRecEncCodes[i]);
            }
            if (countNotInSnomedTable > 0)
            {
                MsgBox.Show(this, "The snomed table does not contain one or more codes from the list of recommended encounter codes.  The snomed table should "
                            + "be updated by running the Code System Importer tool found in Setup | Chart | EHR.");
            }
            comboEncCodes.SelectedIndex = EncListSelectedIdx;
            textEncCodeValue.Text       = EncCodeValue;
            textEncCodeDescript.Text    = CodeDescription;
            labelEncWarning.Visible     = false;
        }
        private void FillGrid()
        {
            gridMain.BeginUpdate();
            gridMain.Columns.Clear();
            ODGridColumn col;

            col = new ODGridColumn("Restriction", 70);
            gridMain.Columns.Add(col);
            col = new ODGridColumn("Compare string", 120);
            gridMain.Columns.Add(col);
            col = new ODGridColumn("Operand", 120);
            gridMain.Columns.Add(col);
            col = new ODGridColumn("Lab value", 80);
            gridMain.Columns.Add(col);
            col = new ODGridColumn("After Date", 120);
            gridMain.Columns.Add(col);
            col = new ODGridColumn("Before Date", 120);
            gridMain.Columns.Add(col);
            //col=new ODGridColumn("Order",120,HorizontalAlignment.Center);
            //gridMain.Columns.Add(col);
            gridMain.Rows.Clear();
            ODGridRow row;

            for (int i = 0; i < _elementList.Count; i++)
            {
                row = new ODGridRow();
                row.Cells.Add(_elementList[i].Restriction.ToString());
                if (_elementList[i].Restriction == EhrRestrictionType.Problem)
                {
                    if (Snomeds.CodeExists(_elementList[i].CompareString))
                    {
                        row.Cells.Add(_elementList[i].CompareString + " - " + Snomeds.GetByCode(_elementList[i].CompareString).Description);
                    }
                    else
                    {
                        row.Cells.Add(_elementList[i].CompareString + " - NON-SNOMED CT CODE");
                    }
                }
                else
                {
                    row.Cells.Add(_elementList[i].CompareString);
                }
                if (_elementList[i].Restriction == EhrRestrictionType.Gender ||
                    _elementList[i].Restriction == EhrRestrictionType.Problem ||
                    _elementList[i].Restriction == EhrRestrictionType.Medication ||
                    _elementList[i].Restriction == EhrRestrictionType.CommPref ||
                    _elementList[i].Restriction == EhrRestrictionType.Allergy)
                {
                    row.Cells.Add("");
                }
                else
                {
                    row.Cells.Add(_elementList[i].Operand.ToString());
                }
                row.Cells.Add(_elementList[i].LabValue);
                if (_elementList[i].StartDate.Year > 1880)
                {
                    row.Cells.Add(_elementList[i].StartDate.ToShortDateString());
                }
                else
                {
                    row.Cells.Add("");
                }
                if (_elementList[i].EndDate.Year > 1880)
                {
                    row.Cells.Add(_elementList[i].EndDate.ToShortDateString());
                }
                else
                {
                    row.Cells.Add("");
                }
                //if(ElementList[i].OrderBy) {
                //  row.Cells.Add("X");
                //}
                //else {
                //  row.Cells.Add("");
                //}
                gridMain.Rows.Add(row);
            }
            gridMain.EndUpdate();
        }
Exemple #4
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);
        }
        private void FormEhrSettings_Load(object sender, EventArgs e)
        {
            if (PrefC.GetString(PrefName.SoftwareName) != "")
            {
                this.Text += " - " + PrefC.GetString(PrefName.SoftwareName);
            }
            checkAlertHighSeverity.Checked = PrefC.GetBool(PrefName.EhrRxAlertHighSeverity);
            comboMU2.Items.Add("Stage 1");
            comboMU2.Items.Add("Stage 2");
            comboMU2.Items.Add("Modified Stage 2");
            comboMU2.SelectedIndex    = PrefC.GetInt(PrefName.MeaningfulUseTwo);
            checkAutoWebmails.Checked = PrefC.GetBool(PrefName.AutomaticSummaryOfCareWebmail);
            FillRecEncCodesList();
            FillDefaultEncCode();
            #region DefaultPregnancyGroup
            FillRecPregCodesList();
            string defaultPregCode       = PrefC.GetString(PrefName.PregnancyDefaultCodeValue);
            string defaultPregCodeSystem = PrefC.GetString(PrefName.PregnancyDefaultCodeSystem);
            NewPregCodeSystem      = defaultPregCodeSystem;
            OldPregListSelectedIdx = -1;
            int countNotInSnomedTable = 0;
            for (int i = 0; i < ListRecPregCodes.Count; i++)
            {
                if (i == 0)
                {
                    comboPregCodes.Items.Add(ListRecPregCodes[i]);
                    comboPregCodes.SelectedIndex = i;
                    if (defaultPregCode == ListRecPregCodes[i])
                    {
                        comboPregCodes.SelectedIndex = i;
                        OldPregListSelectedIdx       = i;
                    }
                    continue;
                }
                if (!Snomeds.CodeExists(ListRecPregCodes[i]))
                {
                    countNotInSnomedTable++;
                    continue;
                }
                comboPregCodes.Items.Add(ListRecPregCodes[i]);
                if (ListRecPregCodes[i] == defaultPregCode && defaultPregCodeSystem == "SNOMEDCT")
                {
                    comboPregCodes.SelectedIndex = i;
                    OldPregListSelectedIdx       = i;
                    labelPregWarning.Visible     = false;
                    textPregCodeDescript.Text    = Snomeds.GetByCode(ListRecPregCodes[i]).Description;               //Guaranteed to exist in snomed table from above check
                }
            }
            if (countNotInSnomedTable > 0)
            {
                MsgBox.Show(this, "The snomed table does not contain one or more codes from the list of recommended pregnancy codes.  The snomed table should be updated by running the Code System Importer tool found in Setup | Chart | EHR.");
            }
            if (comboPregCodes.SelectedIndex == -1)           //default preg code set to code not in recommended list and not 'none'
            {
                switch (defaultPregCodeSystem)
                {
                case "ICD9CM":
                    ICD9 i9Preg = ICD9s.GetByCode(defaultPregCode);
                    if (i9Preg != null)
                    {
                        textPregCodeValue.Text    = i9Preg.ICD9Code;
                        textPregCodeDescript.Text = i9Preg.Description;
                    }
                    break;

                case "SNOMEDCT":
                    Snomed sPreg = Snomeds.GetByCode(defaultPregCode);
                    if (sPreg != null)
                    {
                        textPregCodeValue.Text    = sPreg.SnomedCode;
                        textPregCodeDescript.Text = sPreg.Description;
                    }
                    break;

                case "ICD10CM":
                    Icd10 i10Preg = Icd10s.GetByCode(defaultPregCode);
                    if (i10Preg != null)
                    {
                        textPregCodeValue.Text    = i10Preg.Icd10Code;
                        textPregCodeDescript.Text = i10Preg.Description;
                    }
                    break;

                default:
                    break;
                }
            }
            #endregion
        }
        private void FillDefaultEncCode()
        {
            string defaultEncCode       = PrefC.GetString(PrefName.CQMDefaultEncounterCodeValue);
            string defaultEncCodeSystem = PrefC.GetString(PrefName.CQMDefaultEncounterCodeSystem);

            NewEncCodeSystem      = defaultEncCodeSystem;
            OldEncListSelectedIdx = -1;
            int countNotInSnomedTable = 0;

            for (int i = 0; i < ListRecEncCodes.Count; i++)
            {
                if (i == 0)
                {
                    comboEncCodes.Items.Add(ListRecEncCodes[i]);
                    comboEncCodes.SelectedIndex = i;
                    if (defaultEncCode == ListRecEncCodes[i])
                    {
                        comboEncCodes.SelectedIndex = i;
                        OldEncListSelectedIdx       = i;
                    }
                    continue;
                }
                if (!Snomeds.CodeExists(ListRecEncCodes[i]))
                {
                    countNotInSnomedTable++;
                    continue;
                }
                comboEncCodes.Items.Add(ListRecEncCodes[i]);
                if (ListRecEncCodes[i] == defaultEncCode && defaultEncCodeSystem == "SNOMEDCT")
                {
                    comboEncCodes.SelectedIndex = i;
                    OldEncListSelectedIdx       = i;
                    labelEncWarning.Visible     = false;
                    textEncCodeDescript.Text    = Snomeds.GetByCode(ListRecEncCodes[i]).Description;               //Guaranteed to exist in snomed table from above check
                }
            }
            if (countNotInSnomedTable > 0)
            {
                MsgBox.Show(this, "The snomed table does not contain one or more codes from the list of recommended encounter codes.  The snomed table should be updated by running the Code System Importer tool found in Setup | Chart | EHR.");
            }
            if (comboEncCodes.SelectedIndex == -1)           //default enc code set to code not in recommended list and not 'none'
            {
                switch (defaultEncCodeSystem)
                {
                case "CDT":
                    textEncCodeValue.Text    = ProcedureCodes.GetProcCode(defaultEncCode).ProcCode;                       //Will return a new ProcCode object, not null, if not found
                    textEncCodeDescript.Text = ProcedureCodes.GetProcCode(defaultEncCode).Descript;
                    break;

                case "CPT":
                    Cpt cEnc = Cpts.GetByCode(defaultEncCode);
                    if (cEnc != null)
                    {
                        textEncCodeValue.Text    = cEnc.CptCode;
                        textEncCodeDescript.Text = cEnc.Description;
                    }
                    break;

                case "SNOMEDCT":
                    Snomed sEnc = Snomeds.GetByCode(defaultEncCode);
                    if (sEnc != null)
                    {
                        textEncCodeValue.Text    = sEnc.SnomedCode;
                        textEncCodeDescript.Text = sEnc.Description;
                    }
                    break;

                case "HCPCS":
                    Hcpcs hEnc = Hcpcses.GetByCode(defaultEncCode);
                    if (hEnc != null)
                    {
                        textEncCodeValue.Text    = hEnc.HcpcsCode;
                        textEncCodeDescript.Text = hEnc.DescriptionShort;
                    }
                    break;
                }
            }
        }
Exemple #7
0
        private void FormEhrSettings_Load(object sender, EventArgs e)
        {
            checkAlertHighSeverity.Checked = PrefC.GetBool(PrefName.EhrRxAlertHighSeverity);
            checkMU2.Checked = PrefC.GetBool(PrefName.MeaningfulUseTwo);
            #region DefaultEncounterGroup
            FillRecEncCodesList();
            string defaultEncCode       = PrefC.GetString(PrefName.CQMDefaultEncounterCodeValue);
            string defaultEncCodeSystem = PrefC.GetString(PrefName.CQMDefaultEncounterCodeSystem);
            NewEncCodeSystem      = defaultEncCodeSystem;
            OldEncListSelectedIdx = -1;
            int countNotInSnomedTable = 0;
            for (int i = 0; i < ListRecEncCodes.Count; i++)
            {
                if (i == 0)
                {
                    comboEncCodes.Items.Add(ListRecEncCodes[i]);
                    comboEncCodes.SelectedIndex = i;
                    if (defaultEncCode == ListRecEncCodes[i])
                    {
                        comboEncCodes.SelectedIndex = i;
                        OldEncListSelectedIdx       = i;
                    }
                    continue;
                }
                if (!Snomeds.CodeExists(ListRecEncCodes[i]))
                {
                    countNotInSnomedTable++;
                    continue;
                }
                comboEncCodes.Items.Add(ListRecEncCodes[i]);
                if (ListRecEncCodes[i] == defaultEncCode && defaultEncCodeSystem == "SNOMEDCT")
                {
                    comboEncCodes.SelectedIndex = i;
                    OldEncListSelectedIdx       = i;
                    labelEncWarning.Visible     = false;
                    textEncCodeDescript.Text    = Snomeds.GetByCode(ListRecEncCodes[i]).Description;               //Guaranteed to exist in snomed table from above check
                }
            }
            if (countNotInSnomedTable > 0)
            {
                MsgBox.Show(this, "The snomed table does not contain one or more codes from the list of recommended encounter codes.  The snomed table should be updated by running the Code System Importer tool found in Setup | EHR.");
            }
            if (comboEncCodes.SelectedIndex == -1)           //default enc code set to code not in recommended list and not 'none'
            {
                switch (defaultEncCodeSystem)
                {
                case "CDT":
                    textEncCodeValue.Text    = ProcedureCodes.GetProcCode(defaultEncCode).ProcCode;                       //Will return a new ProcCode object, not null, if not found
                    textEncCodeDescript.Text = ProcedureCodes.GetProcCode(defaultEncCode).Descript;
                    break;

                case "CPT":
                    Cpt cEnc = Cpts.GetByCode(defaultEncCode);
                    if (cEnc != null)
                    {
                        textEncCodeValue.Text    = cEnc.CptCode;
                        textEncCodeDescript.Text = cEnc.Description;
                    }
                    break;

                case "SNOMEDCT":
                    Snomed sEnc = Snomeds.GetByCode(defaultEncCode);
                    if (sEnc != null)
                    {
                        textEncCodeValue.Text    = sEnc.SnomedCode;
                        textEncCodeDescript.Text = sEnc.Description;
                    }
                    break;

                case "HCPCS":
                    Hcpcs hEnc = Hcpcses.GetByCode(defaultEncCode);
                    if (hEnc != null)
                    {
                        textEncCodeValue.Text    = hEnc.HcpcsCode;
                        textEncCodeDescript.Text = hEnc.DescriptionShort;
                    }
                    break;
                }
            }
            #endregion
            #region DefaultPregnancyGroup
            FillRecPregCodesList();
            string defaultPregCode       = PrefC.GetString(PrefName.PregnancyDefaultCodeValue);
            string defaultPregCodeSystem = PrefC.GetString(PrefName.PregnancyDefaultCodeSystem);
            NewPregCodeSystem      = defaultPregCodeSystem;
            OldPregListSelectedIdx = -1;
            countNotInSnomedTable  = 0;
            for (int i = 0; i < ListRecPregCodes.Count; i++)
            {
                if (i == 0)
                {
                    comboPregCodes.Items.Add(ListRecPregCodes[i]);
                    comboPregCodes.SelectedIndex = i;
                    if (defaultPregCode == ListRecPregCodes[i])
                    {
                        comboPregCodes.SelectedIndex = i;
                        OldPregListSelectedIdx       = i;
                    }
                    continue;
                }
                if (!Snomeds.CodeExists(ListRecPregCodes[i]))
                {
                    countNotInSnomedTable++;
                    continue;
                }
                comboPregCodes.Items.Add(ListRecPregCodes[i]);
                if (ListRecPregCodes[i] == defaultPregCode && defaultPregCodeSystem == "SNOMEDCT")
                {
                    comboPregCodes.SelectedIndex = i;
                    OldPregListSelectedIdx       = i;
                    labelPregWarning.Visible     = false;
                    textPregCodeDescript.Text    = Snomeds.GetByCode(ListRecPregCodes[i]).Description;               //Guaranteed to exist in snomed table from above check
                }
            }
            if (countNotInSnomedTable > 0)
            {
                MsgBox.Show(this, "The snomed table does not contain one or more codes from the list of recommended pregnancy codes.  The snomed table should be updated by running the Code System Importer tool found in Setup | EHR.");
            }
            if (comboPregCodes.SelectedIndex == -1)           //default preg code set to code not in recommended list and not 'none'
            {
                switch (defaultPregCodeSystem)
                {
                case "ICD9CM":
                    ICD9 i9Preg = ICD9s.GetByCode(defaultPregCode);
                    if (i9Preg != null)
                    {
                        textPregCodeValue.Text    = i9Preg.ICD9Code;
                        textPregCodeDescript.Text = i9Preg.Description;
                    }
                    break;

                case "SNOMEDCT":
                    Snomed sPreg = Snomeds.GetByCode(defaultPregCode);
                    if (sPreg != null)
                    {
                        textPregCodeValue.Text    = sPreg.SnomedCode;
                        textPregCodeDescript.Text = sPreg.Description;
                    }
                    break;

                case "ICD10CM":
                    Icd10 i10Preg = Icd10s.GetByCode(defaultPregCode);
                    if (i10Preg != null)
                    {
                        textPregCodeValue.Text    = i10Preg.Icd10Code;
                        textPregCodeDescript.Text = i10Preg.Description;
                    }
                    break;

                default:
                    break;
                }
            }
            #endregion
        }