Exemplo n.º 1
0
 private void FormDiseaseEdit_Load(object sender, EventArgs e)
 {
     // Fill problem/icd9 - only one will exist (with a value not zero).
     if (DiseaseCur.DiseaseDefNum != 0)
     {
         textProblem.Text = DiseaseDefs.GetItem(DiseaseCur.DiseaseDefNum).DiseaseName;
     }
     else
     {
         textIcd9.Text = ICD9s.GetOne(DiseaseCur.ICD9Num).Description;
     }
     comboStatus.Items.Clear();
     for (int i = 0; i < Enum.GetNames(typeof(ProblemStatus)).Length; i++)
     {
         comboStatus.Items.Add(Enum.GetNames(typeof(ProblemStatus))[i]);
     }
     comboStatus.SelectedIndex = (int)DiseaseCur.ProbStatus;
     textNote.Text             = DiseaseCur.PatNote;
     if (DiseaseCur.DateStart.Year > 1880)
     {
         textDateStart.Text = DiseaseCur.DateStart.ToShortDateString();
     }
     if (DiseaseCur.DateStop.Year > 1880)
     {
         textDateStop.Text = DiseaseCur.DateStop.ToShortDateString();
     }
 }
Exemplo n.º 2
0
        private void butProblemSelect_Click(object sender, EventArgs e)
        {
            FormDiseaseDefs FormDD = new FormDiseaseDefs();

            FormDD.IsSelectionMode = true;
            FormDD.ShowDialog();
            if (FormDD.DialogResult != DialogResult.OK)
            {
                return;
            }
            DiseaseDef disCur = DiseaseDefs.GetItem(FormDD.SelectedDiseaseDefNum);

            if (disCur == null)
            {
                return;
            }
            EduResourceCur.DiseaseDefNum = FormDD.SelectedDiseaseDefNum;
            textProblem.Text             = disCur.DiseaseName;
            textICD9.Text   = ICD9s.GetCodeAndDescription(disCur.ICD9Code);
            textSnomed.Text = Snomeds.GetCodeAndDescription(disCur.SnomedCode);
            EduResourceCur.MedicationNum = 0;
            textLabResultsID.Text        = "";
            textLabTestName.Text         = "";
            textCompareValue.Text        = "";
        }
Exemplo n.º 3
0
        ///<summary>The values returned are sent to the webserver.</summary>
        public static List <ICD9m> GetMultICD9ms(List <long> icd9Nums)
        {
            List <ICD9>  ICD9List  = ICD9s.GetMultICD9s(icd9Nums);
            List <ICD9m> ICD9mList = ConvertListToM(ICD9List);

            return(ICD9mList);
        }
Exemplo n.º 4
0
        private void FillProblems()
        {
            DiseaseList = Diseases.Refresh(PatCur.PatNum);
            gridDiseases.BeginUpdate();
            gridDiseases.Columns.Clear();
            ODGridColumn col = new ODGridColumn(Lan.g("TableDiseases", "Name"), 140);        //total is about 325

            gridDiseases.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableDiseases", "Patient Note"), 145);
            gridDiseases.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableDisease", "Status"), 40);
            gridDiseases.Columns.Add(col);
            gridDiseases.Rows.Clear();
            ODGridRow row;

            for (int i = 0; i < DiseaseList.Count; i++)
            {
                row = new ODGridRow();
                if (DiseaseList[i].DiseaseDefNum != 0)
                {
                    row.Cells.Add(DiseaseDefs.GetName(DiseaseList[i].DiseaseDefNum));
                }
                else
                {
                    row.Cells.Add(ICD9s.GetDescription(DiseaseList[i].ICD9Num));
                }
                row.Cells.Add(DiseaseList[i].PatNote);
                row.Cells.Add(DiseaseList[i].ProbStatus.ToString());
                gridDiseases.Rows.Add(row);
            }
            gridDiseases.EndUpdate();
        }
Exemplo n.º 5
0
        private void FormDiseaseDefEdit_Load(object sender, System.EventArgs e)
        {
            textName.Text = DiseaseDefCur.DiseaseName;
            string i9descript = ICD9s.GetCodeAndDescription(DiseaseDefCur.ICD9Code);

            if (i9descript == "")
            {
                textICD9.Text = DiseaseDefCur.ICD9Code;
            }
            else
            {
                textICD9.Text = i9descript;
            }
            Icd10 i10 = Icd10s.GetByCode(DiseaseDefCur.Icd10Code);

            if (i10 == null)
            {
                textIcd10.Text = DiseaseDefCur.Icd10Code;
            }
            else
            {
                textIcd10.Text = i10.Icd10Code + "-" + i10.Description;
            }
            string sdescript = Snomeds.GetCodeAndDescription(DiseaseDefCur.SnomedCode);

            if (sdescript == "")
            {
                textSnomed.Text = DiseaseDefCur.SnomedCode;
            }
            else
            {
                textSnomed.Text = sdescript;
            }
            checkIsHidden.Checked = DiseaseDefCur.IsHidden;
        }
Exemplo n.º 6
0
        private void butIcd9_Click(object sender, EventArgs e)
        {
            FormIcd9s FormI = new FormIcd9s();

            FormI.IsSelectionMode = true;
            FormI.ShowDialog();
            if (FormI.DialogResult != DialogResult.OK)
            {
                return;
            }
            if (DiseaseDefs.ContainsICD9(FormI.SelectedIcd9.ICD9Code, DiseaseDefCur.DiseaseDefNum))
            {
                MsgBox.Show(this, "ICD-9 code already exists in the problems list.");
                return;
            }
            DiseaseDefCur.ICD9Code = FormI.SelectedIcd9.ICD9Code;
            string i9descript = ICD9s.GetCodeAndDescription(FormI.SelectedIcd9.ICD9Code);

            if (i9descript == "")
            {
                textICD9.Text = FormI.SelectedIcd9.ICD9Code;
            }
            else
            {
                textICD9.Text = i9descript;
            }
        }
Exemplo n.º 7
0
        private void butProblemSelect_Click(object sender, EventArgs e)
        {
            FormDiseaseDefs FormDD = new FormDiseaseDefs();

            FormDD.IsSelectionMode = true;
            FormDD.ShowDialog();
            if (FormDD.DialogResult != DialogResult.OK)
            {
                return;
            }
            //the list should only ever contain one item.
            DiseaseDef disCur = FormDD.ListSelectedDiseaseDefs[0];

            if (disCur == null)
            {
                return;
            }
            EduResourceCur.DiseaseDefNum    = disCur.DiseaseDefNum;
            EduResourceCur.MedicationNum    = 0;
            EduResourceCur.SmokingSnoMed    = "";
            EduResourceCur.LabResultID      = "";
            EduResourceCur.LabResultName    = "";
            EduResourceCur.LabResultCompare = "";
            textProblem.Text           = disCur.DiseaseName;
            textICD9.Text              = ICD9s.GetCodeAndDescription(disCur.ICD9Code);
            textSnomed.Text            = Snomeds.GetCodeAndDescription(disCur.SnomedCode);
            textMedication.Text        = "";
            textTobaccoAssessment.Text = "";
            textLabResultsID.Text      = "";
            textLabTestName.Text       = "";
            textCompareValue.Text      = "";
        }
Exemplo n.º 8
0
        private void FillGrid()
        {
            gridMain.BeginUpdate();
            gridMain.Columns.Clear();
            ODGridColumn col;

            col = new ODGridColumn("Reminder Criterion", 135);
            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:
                    row.Cells.Add("Problem = " + DiseaseDefs.GetName(listReminders[i].CriterionFK));
                    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.º 9
0
 private void FillGrid()
 {
     Cursor   = Cursors.WaitCursor;
     icd9List = ICD9s.GetByCodeOrDescription(textCode.Text);
     listMain.Items.Clear();
     for (int i = 0; i < icd9List.Count; i++)
     {
         listMain.Items.Add(icd9List[i].ICD9Code + " - " + icd9List[i].Description);
     }
     Cursor = Cursors.Default;
 }
Exemplo n.º 10
0
 private void FillGrid()
 {
     Cursor   = Cursors.WaitCursor;
     icd9List = ICD9s.GetByCodeOrDescription(textCode.Text);
     icd9List.RemoveAll(x => string.IsNullOrEmpty(x.ICD9Code));            //We have seen some old ICD9 codes with invalid codes.
     listMain.Items.Clear();
     for (int i = 0; i < icd9List.Count; i++)
     {
         listMain.Items.Add(icd9List[i].ICD9Code + " - " + icd9List[i].Description);
     }
     Cursor = Cursors.Default;
 }
Exemplo n.º 11
0
        ///<summary>Converts one Disease object to its mobile equivalent.  Warning! CustomerNum will always be 0.</summary>
        internal static Diseasem ConvertToM(Disease disease)
        {
            Diseasem diseasem = new Diseasem();

            //CustomerNum cannot be set.  Remains 0.
            diseasem.DiseaseNum    = disease.DiseaseNum;
            diseasem.PatNum        = disease.PatNum;
            diseasem.DiseaseDefNum = disease.DiseaseDefNum;
            diseasem.PatNote       = disease.PatNote;
            diseasem.ICD9Num       = ICD9s.GetByCode(DiseaseDefs.GetItem(disease.DiseaseDefNum).ICD9Code).ICD9Num;
            diseasem.ProbStatus    = disease.ProbStatus;
            diseasem.DateStart     = disease.DateStart;
            diseasem.DateStop      = disease.DateStop;
            return(diseasem);
        }
Exemplo n.º 12
0
 private void FormEduResourceEdit_Load(object sender, EventArgs e)
 {
     if (EduResourceCur.DiseaseDefNum != 0)
     {
         DiseaseDef def = DiseaseDefs.GetItem(EduResourceCur.DiseaseDefNum);
         textProblem.Text = def.DiseaseName;
         textICD9.Text    = ICD9s.GetCodeAndDescription(def.ICD9Code);
         textSnomed.Text  = Snomeds.GetCodeAndDescription(def.SnomedCode);
     }
     else if (EduResourceCur.MedicationNum != 0)
     {
         textMedication.Text = Medications.GetDescription(EduResourceCur.MedicationNum);
     }
     textLabResultsID.Text = EduResourceCur.LabResultID;
     textLabTestName.Text  = EduResourceCur.LabResultName;
     textCompareValue.Text = EduResourceCur.LabResultCompare;
     textUrl.Text          = EduResourceCur.ResourceUrl;
 }
Exemplo n.º 13
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();
 }
Exemplo n.º 14
0
 private void buttonDelete_Click(object sender, EventArgs e)
 {
     if (IsNew)
     {
         DialogResult = DialogResult.Cancel;
         return;
     }
     if (!MsgBox.Show(this, MsgBoxButtons.OKCancel, "Delete?"))
     {
         return;
     }
     try {
         ICD9s.Delete(Icd9Cur.ICD9Num);
         DialogResult = DialogResult.OK;
     }
     catch (ApplicationException ex) {
         MessageBox.Show(ex.Message);
     }
 }
Exemplo n.º 15
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;
 }
Exemplo n.º 16
0
 private void FormEduResourceEdit_Load(object sender, EventArgs e)
 {
     if (EduResourceCur.DiseaseDefNum != 0)
     {
         textProblem.Text = DiseaseDefs.GetName(EduResourceCur.DiseaseDefNum);
     }
     else if (EduResourceCur.Icd9Num != 0)
     {
         textICD9.Text = ICD9s.GetDescription(EduResourceCur.Icd9Num);
     }
     else if (EduResourceCur.MedicationNum != 0)
     {
         textMedication.Text = Medications.GetDescription(EduResourceCur.MedicationNum);
     }
     textLabResultsID.Text = EduResourceCur.LabResultID;
     textLabTestName.Text  = EduResourceCur.LabResultName;
     textCompareValue.Text = EduResourceCur.LabResultCompare;
     textUrl.Text          = EduResourceCur.ResourceUrl;
 }
Exemplo n.º 17
0
        private void butICD9Select_Click(object sender, EventArgs e)
        {
            FormIcd9s FormICD9 = new FormIcd9s();

            FormICD9.IsSelectionMode = true;
            FormICD9.ShowDialog();
            if (FormICD9.DialogResult != DialogResult.OK)
            {
                return;
            }
            textProblem.Text             = "";
            EduResourceCur.DiseaseDefNum = 0;
            textICD9.Text                = "ICD9: " + ICD9s.GetDescription(FormICD9.SelectedIcd9Num);
            EduResourceCur.Icd9Num       = FormICD9.SelectedIcd9Num;
            textMedication.Text          = "";
            EduResourceCur.MedicationNum = 0;
            textLabResultsID.Text        = "";
            textLabTestName.Text         = "";
            textCompareValue.Text        = "";
        }
Exemplo n.º 18
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.º 19
0
        private void FillGrid()
        {
            gridEdu.BeginUpdate();
            gridEdu.Columns.Clear();
            ODGridColumn col = new ODGridColumn("Criteria", 300);

            gridEdu.Columns.Add(col);
            col = new ODGridColumn("Link", 700);
            gridEdu.Columns.Add(col);
            eduResourceList = EduResources.SelectAll();
            gridEdu.Rows.Clear();
            ODGridRow row;

            for (int i = 0; i < eduResourceList.Count; i++)
            {
                row = new ODGridRow();
                if (eduResourceList[i].DiseaseDefNum != 0)
                {
                    row.Cells.Add("Problem: " + DiseaseDefs.GetItem(eduResourceList[i].DiseaseDefNum).DiseaseName);
                }
                else if (eduResourceList[i].Icd9Num != 0)
                {
                    row.Cells.Add("ICD9: " + ICD9s.GetDescription(eduResourceList[i].Icd9Num));
                }
                else if (eduResourceList[i].MedicationNum != 0)
                {
                    row.Cells.Add("Medication: " + Medications.GetDescription(eduResourceList[i].MedicationNum));
                }
                else
                {
                    row.Cells.Add("Lab Results: " + eduResourceList[i].LabResultName + " " + eduResourceList[i].LabResultCompare);
                }
                row.Cells.Add(eduResourceList[i].ResourceUrl);
                gridEdu.Rows.Add(row);
            }
            gridEdu.EndUpdate();
        }
Exemplo n.º 20
0
        public static string Validate(Appointment appt)
        {
            StringBuilder sb           = new StringBuilder();
            Provider      provFacility = Providers.GetProv(PrefC.GetInt(PrefName.PracticeDefaultProv));

            if (!Regex.IsMatch(provFacility.NationalProvID, "^(80840)?[0-9]{10}$"))
            {
                WriteError(sb, "Invalid NPI for provider '" + provFacility.Abbr + "'");
            }
            if (PrefC.HasClinicsEnabled && appt.ClinicNum != 0)           //Using clinics and a clinic is assigned.
            {
                Clinic clinic = Clinics.GetClinic(appt.ClinicNum);
                if (clinic.Description == "")
                {
                    WriteError(sb, "Missing clinic description for clinic attached to appointment.");
                }
            }
            else              //Not using clinics for this patient
            {
                if (PrefC.GetString(PrefName.PracticeTitle) == "")
                {
                    WriteError(sb, "Missing practice title.");
                }
            }
            Patient pat = Patients.GetPat(appt.PatNum);

            if (pat.PatStatus == PatientStatus.Deceased && pat.DateTimeDeceased.Year < 1880)
            {
                WriteError(sb, "Missing date time deceased.");
            }
            List <EhrAptObs> listObservations = EhrAptObses.Refresh(appt.AptNum);

            if (listObservations.Count == 0)
            {
                WriteError(sb, "Missing observation.");
            }
            for (int i = 0; i < listObservations.Count; i++)
            {
                EhrAptObs obs = listObservations[i];
                if (obs.ValType == EhrAptObsType.Coded)
                {
                    if (obs.ValCodeSystem.Trim().ToUpper() == "LOINC")
                    {
                        Loinc loincVal = Loincs.GetByCode(obs.ValReported);
                        if (loincVal == null)
                        {
                            WriteError(sb, "Loinc code not found '" + loincVal.LoincCode + "'.  Please add by going to Setup | Chart | EHR.");
                        }
                    }
                    else if (obs.ValCodeSystem.Trim().ToUpper() == "SNOMEDCT")
                    {
                        Snomed snomedVal = Snomeds.GetByCode(obs.ValReported);
                        if (snomedVal == null)
                        {
                            WriteError(sb, "Snomed code not found '" + snomedVal.SnomedCode + "'.  Please add by going to Setup | Chart | EHR.");
                        }
                    }
                    else if (obs.ValCodeSystem.Trim().ToUpper() == "ICD9")
                    {
                        ICD9 icd9Val = ICD9s.GetByCode(obs.ValReported);
                        if (icd9Val == null)
                        {
                            WriteError(sb, "ICD9 code not found '" + icd9Val.ICD9Code + "'.  Please add by going to Setup | Chart | EHR.");
                        }
                    }
                    else if (obs.ValCodeSystem.Trim().ToUpper() == "ICD10")
                    {
                        Icd10 icd10Val = Icd10s.GetByCode(obs.ValReported);
                        if (icd10Val == null)
                        {
                            WriteError(sb, "ICD10 code not found '" + icd10Val.Icd10Code + "'.  Please add by going to Setup | Chart | EHR.");
                        }
                    }
                }
                else if (obs.ValType == EhrAptObsType.Numeric && obs.UcumCode != "")             //We only validate the ucum code if it will be sent out.  Blank units allowed.
                {
                    Ucum ucum = Ucums.GetByCode(obs.UcumCode);
                    if (ucum == null)
                    {
                        WriteError(sb, "Invalid unit code '" + obs.UcumCode + "' for observation (must be UCUM code).");
                    }
                }
            }
            return(sb.ToString());
        }
Exemplo n.º 21
0
        private void FormEhrAptObsEdit_Load(object sender, EventArgs e)
        {
            _appt = Appointments.GetOneApt(_ehrAptObsCur.AptNum);
            comboObservationQuestion.Items.Clear();
            string[] arrayQuestionNames = Enum.GetNames(typeof(EhrAptObsIdentifier));
            for (int i = 0; i < arrayQuestionNames.Length; i++)
            {
                comboObservationQuestion.Items.Add(arrayQuestionNames[i]);
                EhrAptObsIdentifier ehrAptObsIdentifier = (EhrAptObsIdentifier)i;
                if (_ehrAptObsCur.IdentifyingCode == ehrAptObsIdentifier)
                {
                    comboObservationQuestion.SelectedIndex = i;
                }
            }
            listValueType.Items.Clear();
            string[] arrayValueTypeNames = Enum.GetNames(typeof(EhrAptObsType));
            for (int i = 0; i < arrayValueTypeNames.Length; i++)
            {
                listValueType.Items.Add(arrayValueTypeNames[i]);
                EhrAptObsType ehrAptObsType = (EhrAptObsType)i;
                if (_ehrAptObsCur.ValType == ehrAptObsType)
                {
                    listValueType.SelectedIndex = i;
                }
            }
            if (_ehrAptObsCur.ValType == EhrAptObsType.Coded)
            {
                _strValCodeSystem = _ehrAptObsCur.ValCodeSystem;
                if (_ehrAptObsCur.ValCodeSystem == "LOINC")
                {
                    _loincValue    = Loincs.GetByCode(_ehrAptObsCur.ValReported);
                    textValue.Text = _loincValue.NameShort;
                }
                else if (_ehrAptObsCur.ValCodeSystem == "SNOMEDCT")
                {
                    _snomedValue   = Snomeds.GetByCode(_ehrAptObsCur.ValReported);
                    textValue.Text = _snomedValue.Description;
                }
                else if (_ehrAptObsCur.ValCodeSystem == "ICD9")
                {
                    _icd9Value     = ICD9s.GetByCode(_ehrAptObsCur.ValReported);
                    textValue.Text = _icd9Value.Description;
                }
                else if (_ehrAptObsCur.ValCodeSystem == "ICD10")
                {
                    _icd10Value    = Icd10s.GetByCode(_ehrAptObsCur.ValReported);
                    textValue.Text = _icd10Value.Description;
                }
            }
            else
            {
                textValue.Text = _ehrAptObsCur.ValReported;
            }
            comboUnits.Items.Clear();
            comboUnits.Items.Add("none");
            comboUnits.SelectedIndex = 0;
            List <string> listUcumCodes = Ucums.GetAllCodes();

            for (int i = 0; i < listUcumCodes.Count; i++)
            {
                string ucumCode = listUcumCodes[i];
                comboUnits.Items.Add(ucumCode);
                if (ucumCode == _ehrAptObsCur.UcumCode)
                {
                    comboUnits.SelectedIndex = i + 1;
                }
            }
            SetFlags();
        }
Exemplo n.º 22
0
 ///<summary>The values returned are sent to the webserver.</summary>
 public static List <long> GetChangedSinceICD9Nums(DateTime changedSince)
 {
     return(ICD9s.GetChangedSinceICD9Nums(changedSince));
 }
Exemplo n.º 23
0
        ///<summary>Observation/result segment.  Used to transmit observations related to the patient and visit.  Guide page 64.</summary>
        private void OBX()
        {
            List <EhrAptObs> listObservations = EhrAptObses.Refresh(_appt.AptNum);

            for (int i = 0; i < listObservations.Count; i++)
            {
                EhrAptObs obs = listObservations[i];
                _seg = new SegmentHL7(SegmentNameHL7.OBX);
                _seg.SetField(0, "OBX");
                _seg.SetField(1, (i + 1).ToString());             //OBX-1 Set ID - OBX.  Required (length 1..4).  Must start at 1 and increment.
                //OBX-2 Value Type.  Required (length 1..3).  Cardinality [1..1].  Identifies the structure of data in observation value OBX-5.  Values allowed: TS=Time Stamp (Date and/or Time),TX=Text,NM=Numeric,CWE=Coded with exceptions,XAD=Address.
                if (obs.ValType == EhrAptObsType.Coded)
                {
                    _seg.SetField(2, "CWE");
                }
                else if (obs.ValType == EhrAptObsType.DateAndTime)
                {
                    _seg.SetField(2, "TS");
                }
                else if (obs.ValType == EhrAptObsType.Numeric)
                {
                    _seg.SetField(2, "NM");
                }
                else                  //obs.ValType==EhrAptObsType.Text
                {
                    _seg.SetField(2, "TX");
                }
                //OBX-3 Observation Identifier.  Required (length up to 478).  Cardinality [1..1].  Value set is HL7 table named "Observation Identifier".  Type CE.  We use LOINC codes because the testing tool used LOINC codes and so do vaccines.
                string obsIdCode         = "";
                string obsIdCodeDescript = "";
                string obsIdCodeSystem   = "LN";
                if (obs.IdentifyingCode == EhrAptObsIdentifier.BodyTemp)
                {
                    obsIdCode         = "11289-6";
                    obsIdCodeDescript = "Body temperature:Temp:Enctrfrst:Patient:Qn:";
                }
                else if (obs.IdentifyingCode == EhrAptObsIdentifier.CheifComplaint)
                {
                    obsIdCode         = "8661-1";
                    obsIdCodeDescript = "Chief complaint:Find:Pt:Patient:Nom:Reported";
                }
                else if (obs.IdentifyingCode == EhrAptObsIdentifier.DateIllnessOrInjury)
                {
                    obsIdCode         = "11368-8";
                    obsIdCodeDescript = "Illness or injury onset date and time:TmStp:Pt:Patient:Qn:";
                }
                else if (obs.IdentifyingCode == EhrAptObsIdentifier.OxygenSaturation)
                {
                    obsIdCode         = "59408-5";
                    obsIdCodeDescript = "Oxygen saturation:MFr:Pt:BldA:Qn:Pulse oximetry";
                }
                else if (obs.IdentifyingCode == EhrAptObsIdentifier.PatientAge)
                {
                    obsIdCode         = "21612-7";
                    obsIdCodeDescript = "Age Time Patient Reported";
                }
                else if (obs.IdentifyingCode == EhrAptObsIdentifier.PrelimDiag)
                {
                    obsIdCode         = "44833-2";
                    obsIdCodeDescript = "Diagnosis.preliminary:Imp:Pt:Patient:Nom:";
                }
                else if (obs.IdentifyingCode == EhrAptObsIdentifier.TreatFacilityID)
                {
                    obsIdCode         = "SS001";
                    obsIdCodeDescript = "Treating Facility Identifier";
                    obsIdCodeSystem   = "PHINQUESTION";
                }
                else if (obs.IdentifyingCode == EhrAptObsIdentifier.TreatFacilityLocation)
                {
                    obsIdCode         = "SS002";
                    obsIdCodeDescript = "Treating Facility Location";
                    obsIdCodeSystem   = "PHINQUESTION";
                }
                else if (obs.IdentifyingCode == EhrAptObsIdentifier.TriageNote)
                {
                    obsIdCode         = "54094-8";
                    obsIdCodeDescript = "Triage note:Find:Pt:Emergency department:Doc:";
                }
                else if (obs.IdentifyingCode == EhrAptObsIdentifier.VisitType)
                {
                    obsIdCode         = "SS003";
                    obsIdCodeDescript = "Facility / Visit Type";
                    obsIdCodeSystem   = "PHINQUESTION";
                }
                WriteCE(3, obsIdCode, obsIdCodeDescript, obsIdCodeSystem);
                //OBX-4 Observation Sub-ID.  No longer used.
                //OBX-5 Observation Value.  Required if known (length 1..99999).  Value must match type in OBX-2.
                if (obs.ValType == EhrAptObsType.Address)
                {
                    WriteXAD(5, _sendingFacilityAddress1, _sendingFacilityAddress2, _sendingFacilityCity, _sendingFacilityState, _sendingFacilityZip);
                }
                else if (obs.ValType == EhrAptObsType.Coded)
                {
                    string codeDescript     = "";
                    string codeSystemAbbrev = "";
                    if (obs.ValCodeSystem.Trim().ToUpper() == "LOINC")
                    {
                        Loinc loincVal = Loincs.GetByCode(obs.ValReported);
                        codeDescript     = loincVal.NameShort;
                        codeSystemAbbrev = "LN";
                    }
                    else if (obs.ValCodeSystem.Trim().ToUpper() == "SNOMEDCT")
                    {
                        Snomed snomedVal = Snomeds.GetByCode(obs.ValReported);
                        codeDescript     = snomedVal.Description;
                        codeSystemAbbrev = "SCT";
                    }
                    else if (obs.ValCodeSystem.Trim().ToUpper() == "ICD9")
                    {
                        ICD9 icd9Val = ICD9s.GetByCode(obs.ValReported);
                        codeDescript     = icd9Val.Description;
                        codeSystemAbbrev = "I9";
                    }
                    else if (obs.ValCodeSystem.Trim().ToUpper() == "ICD10")
                    {
                        Icd10 icd10Val = Icd10s.GetByCode(obs.ValReported);
                        codeDescript     = icd10Val.Description;
                        codeSystemAbbrev = "I10";
                    }
                    WriteCE(5, obs.ValReported.Trim(), codeDescript, codeSystemAbbrev);
                }
                else if (obs.ValType == EhrAptObsType.DateAndTime)
                {
                    DateTime dateVal    = DateTime.Parse(obs.ValReported.Trim());
                    string   strDateOut = dateVal.ToString("yyyyMMdd");
                    //The testing tool threw errors when there were trailing zeros, even though technically valid.
                    if (dateVal.Second > 0)
                    {
                        strDateOut += dateVal.ToString("HHmmss");
                    }
                    else if (dateVal.Minute > 0)
                    {
                        strDateOut += dateVal.ToString("HHmm");
                    }
                    else if (dateVal.Hour > 0)
                    {
                        strDateOut += dateVal.ToString("HH");
                    }
                    _seg.SetField(5, strDateOut);
                }
                else if (obs.ValType == EhrAptObsType.Numeric)
                {
                    _seg.SetField(5, obs.ValReported.Trim());
                }
                else                   //obs.ValType==EhrAptObsType.Text
                {
                    _seg.SetField(5, obs.ValReported);
                }
                //OBX-6 Units.  Required if OBX-2 is NM=Numeric.  Cardinality [0..1].  Type CE.  The guide suggests value sets: Pulse Oximetry Unit, Temperature Unit, or Age Unit.  However, the testing tool used UCUM, so we will use UCUM.
                if (obs.ValType == EhrAptObsType.Numeric)
                {
                    if (String.IsNullOrEmpty(obs.UcumCode))                      //If units are required but known, we must send a null flavor.
                    {
                        WriteCE(6, "UNK", "", "NULLFL");
                    }
                    else
                    {
                        Ucum ucum = Ucums.GetByCode(obs.UcumCode);
                        WriteCE(6, ucum.UcumCode, ucum.Description, "UCUM");
                    }
                }
                //OBX-7 References Range.  No longer used.
                //OBX-8 Abnormal Flags.  No longer used.
                //OBX-9 Probability.  No longer used.
                //OBX-10 Nature of Abnormal Test.  No longer used.
                _seg.SetField(11, "F");               //OBX-11 Observation Result Status.  Required (length 1..1).  Expected value is "F".
                //OBX-12 Effective Date of Reference Range.  No longer used.
                //OBX-13 User Defined Access Checks.  No longer used.
                //OBX-14 Date/Time of the Observation.  Optional.
                //OBX-15 Producer's ID.  No longer used.
                //OBX-16 Responsible Observer.  No longer used.
                //OBX-17 Observation Method.  No longer used.
                //OBX-18 Equipment Instance Identifier.  No longer used.
                //OBX-19 Date/Time of the Analysis.  No longer used.
                _msg.Segments.Add(_seg);
            }
        }
        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);
        }
Exemplo n.º 25
0
        private void FillGrid()
        {
            gridMain.BeginUpdate();
            gridMain.Columns.Clear();
            ODGridColumn col = new ODGridColumn("Date", 70);

            gridMain.Columns.Add(col);
            col = new ODGridColumn("Prov", 50);
            gridMain.Columns.Add(col);
            col = new ODGridColumn("Intervention Type", 115);
            gridMain.Columns.Add(col);
            col = new ODGridColumn("Code", 70);
            gridMain.Columns.Add(col);
            col = new ODGridColumn("Code System", 85);
            gridMain.Columns.Add(col);
            col = new ODGridColumn("Code Description", 300);
            gridMain.Columns.Add(col);
            col = new ODGridColumn("Note", 100);
            gridMain.Columns.Add(col);
            gridMain.Rows.Clear();
            ODGridRow row;

            #region Interventions
            listIntervention = Interventions.Refresh(PatCur.PatNum);
            for (int i = 0; i < listIntervention.Count; i++)
            {
                row = new ODGridRow();
                row.Cells.Add(listIntervention[i].DateEntry.ToShortDateString());
                row.Cells.Add(Providers.GetAbbr(listIntervention[i].ProvNum));
                row.Cells.Add(listIntervention[i].CodeSet.ToString());
                row.Cells.Add(listIntervention[i].CodeValue);
                row.Cells.Add(listIntervention[i].CodeSystem);
                //Description of Intervention---------------------------------------------
                //to get description, first determine which table the code is from.  Interventions are allowed to be SNOMEDCT, ICD9, ICD10, HCPCS, or CPT.
                string descript = "";
                switch (listIntervention[i].CodeSystem)
                {
                case "SNOMEDCT":
                    Snomed sCur = Snomeds.GetByCode(listIntervention[i].CodeValue);
                    if (sCur != null)
                    {
                        descript = sCur.Description;
                    }
                    break;

                case "ICD9CM":
                    ICD9 i9Cur = ICD9s.GetByCode(listIntervention[i].CodeValue);
                    if (i9Cur != null)
                    {
                        descript = i9Cur.Description;
                    }
                    break;

                case "ICD10CM":
                    Icd10 i10Cur = Icd10s.GetByCode(listIntervention[i].CodeValue);
                    if (i10Cur != null)
                    {
                        descript = i10Cur.Description;
                    }
                    break;

                case "HCPCS":
                    Hcpcs hCur = Hcpcses.GetByCode(listIntervention[i].CodeValue);
                    if (hCur != null)
                    {
                        descript = hCur.DescriptionShort;
                    }
                    break;

                case "CPT":
                    Cpt cptCur = Cpts.GetByCode(listIntervention[i].CodeValue);
                    if (cptCur != null)
                    {
                        descript = cptCur.Description;
                    }
                    break;
                }
                row.Cells.Add(descript);
                row.Cells.Add(listIntervention[i].Note);
                row.Tag = listIntervention[i];
                gridMain.Rows.Add(row);
            }
            #endregion
            #region MedicationPats
            listMedPats = MedicationPats.Refresh(PatCur.PatNum, true);
            if (listMedPats.Count > 0)
            {
                //The following medications are used as interventions for some measures.  Include them in the intervention window if they belong to these value sets.
                //Above Normal Medications RxNorm Value Set, Below Normal Medications RxNorm Value Set, Tobacco Use Cessation Pharmacotherapy Value Set
                List <string> listVS = new List <string> {
                    "2.16.840.1.113883.3.600.1.1498", "2.16.840.1.113883.3.600.1.1499", "2.16.840.1.113883.3.526.3.1190"
                };
                List <EhrCode> listEhrMeds = EhrCodes.GetForValueSetOIDs(listVS, true);
                for (int i = listMedPats.Count - 1; i > -1; i--)
                {
                    bool found = false;
                    for (int j = 0; j < listEhrMeds.Count; j++)
                    {
                        if (listMedPats[i].RxCui.ToString() == listEhrMeds[j].CodeValue)
                        {
                            found = true;
                            break;
                        }
                    }
                    if (!found)
                    {
                        listMedPats.RemoveAt(i);
                    }
                }
            }
            for (int i = 0; i < listMedPats.Count; i++)
            {
                row = new ODGridRow();
                row.Cells.Add(listMedPats[i].DateStart.ToShortDateString());
                row.Cells.Add(Providers.GetAbbr(listMedPats[i].ProvNum));
                if (listMedPats[i].RxCui == 314153 || listMedPats[i].RxCui == 692876)
                {
                    row.Cells.Add(InterventionCodeSet.AboveNormalWeight.ToString() + " Medication");
                }
                else if (listMedPats[i].RxCui == 577154 || listMedPats[i].RxCui == 860215 || listMedPats[i].RxCui == 860221 || listMedPats[i].RxCui == 860225 || listMedPats[i].RxCui == 860231)
                {
                    row.Cells.Add(InterventionCodeSet.BelowNormalWeight.ToString() + " Medication");
                }
                else                  //There are 48 total medications that can be used as interventions.  The remaining 41 medications are tobacco cessation medications
                {
                    row.Cells.Add(InterventionCodeSet.TobaccoCessation.ToString() + " Medication");
                }
                row.Cells.Add(listMedPats[i].RxCui.ToString());
                row.Cells.Add("RXNORM");
                //Medications that are used as interventions are all RxNorm codes, get description from that table
                string descript = RxNorms.GetDescByRxCui(listMedPats[i].RxCui.ToString());
                row.Cells.Add(descript);
                row.Cells.Add(listMedPats[i].PatNote);
                row.Tag = listMedPats[i];
                gridMain.Rows.Add(row);
            }
            #endregion
            gridMain.EndUpdate();
        }
Exemplo n.º 26
0
        private void FillGridObservations()
        {
            gridObservations.BeginUpdate();
            gridObservations.ListGridColumns.Clear();
            gridObservations.ListGridColumns.Add(new UI.GridColumn("Observation", 200));   //0
            gridObservations.ListGridColumns.Add(new UI.GridColumn("Value Type", 200));    //1
            gridObservations.ListGridColumns.Add(new UI.GridColumn("Value", 0));           //2
            gridObservations.ListGridRows.Clear();
            List <EhrAptObs> listEhrAptObses = EhrAptObses.Refresh(_appt.AptNum);

            for (int i = 0; i < listEhrAptObses.Count; i++)
            {
                EhrAptObs  obs = listEhrAptObses[i];
                UI.GridRow row = new UI.GridRow();
                row.Tag = obs;
                row.Cells.Add(obs.IdentifyingCode.ToString());                //0 Observation
                if (obs.ValType == EhrAptObsType.Coded)
                {
                    row.Cells.Add(obs.ValType.ToString() + " - " + obs.ValCodeSystem);                //1 Value Type
                    if (obs.ValCodeSystem == "LOINC")
                    {
                        Loinc loincValue = Loincs.GetByCode(obs.ValReported);
                        row.Cells.Add(loincValue.NameShort);                        //2 Value
                    }
                    else if (obs.ValCodeSystem == "SNOMEDCT")
                    {
                        Snomed snomedValue = Snomeds.GetByCode(obs.ValReported);
                        row.Cells.Add(snomedValue.Description);                        //2 Value
                    }
                    else if (obs.ValCodeSystem == "ICD9")
                    {
                        ICD9 icd9Value = ICD9s.GetByCode(obs.ValReported);
                        row.Cells.Add(icd9Value.Description);                        //2 Value
                    }
                    else if (obs.ValCodeSystem == "ICD10")
                    {
                        Icd10 icd10Value = Icd10s.GetByCode(obs.ValReported);
                        row.Cells.Add(icd10Value.Description);                        //2 Value
                    }
                }
                else if (obs.ValType == EhrAptObsType.Address)
                {
                    string sendingFacilityAddress1 = PrefC.GetString(PrefName.PracticeAddress);
                    string sendingFacilityAddress2 = PrefC.GetString(PrefName.PracticeAddress2);
                    string sendingFacilityCity     = PrefC.GetString(PrefName.PracticeCity);
                    string sendingFacilityState    = PrefC.GetString(PrefName.PracticeST);
                    string sendingFacilityZip      = PrefC.GetString(PrefName.PracticeZip);
                    if (PrefC.HasClinicsEnabled && _appt.ClinicNum != 0)                   //Using clinics and a clinic is assigned.
                    {
                        Clinic clinic = Clinics.GetClinic(_appt.ClinicNum);
                        sendingFacilityAddress1 = clinic.Address;
                        sendingFacilityAddress2 = clinic.Address2;
                        sendingFacilityCity     = clinic.City;
                        sendingFacilityState    = clinic.State;
                        sendingFacilityZip      = clinic.Zip;
                    }
                    row.Cells.Add(obs.ValType.ToString());                                                                                                                      //1 Value Type
                    row.Cells.Add(sendingFacilityAddress1 + " " + sendingFacilityAddress2 + " " + sendingFacilityCity + " " + sendingFacilityState + " " + sendingFacilityZip); //2 Value
                }
                else
                {
                    row.Cells.Add(obs.ValType.ToString());             //1 Value Type
                    row.Cells.Add(obs.ValReported);                    //2 Value
                }
                gridObservations.ListGridRows.Add(row);
            }
            gridObservations.EndUpdate();
        }
Exemplo n.º 27
0
        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
        }
Exemplo n.º 28
0
        private void FormDiseaseEdit_Load(object sender, EventArgs e)
        {
            DiseaseDef diseasedef = DiseaseDefs.GetItem(DiseaseCur.DiseaseDefNum);          //guaranteed to have one

            textProblem.Text = diseasedef.DiseaseName;
            string i9descript = ICD9s.GetCodeAndDescription(diseasedef.ICD9Code);

            if (i9descript == "")
            {
                textIcd9.Text = diseasedef.ICD9Code;
            }
            else
            {
                textIcd9.Text = i9descript;
            }
            string sdescript = Snomeds.GetCodeAndDescription(diseasedef.SnomedCode);

            if (sdescript == "")
            {
                textSnomed.Text = diseasedef.SnomedCode;
            }
            else
            {
                textSnomed.Text = sdescript;
            }
            comboStatus.Items.Clear();
            for (int i = 0; i < Enum.GetNames(typeof(ProblemStatus)).Length; i++)
            {
                comboStatus.Items.Add(Enum.GetNames(typeof(ProblemStatus))[i]);
            }
            comboStatus.SelectedIndex = (int)DiseaseCur.ProbStatus;
            textNote.Text             = DiseaseCur.PatNote;
            if (DiseaseCur.DateStart.Year > 1880)
            {
                textDateStart.Text = DiseaseCur.DateStart.ToShortDateString();
            }
            if (DiseaseCur.DateStop.Year > 1880)
            {
                textDateStop.Text = DiseaseCur.DateStop.ToShortDateString();
            }
            comboSnomedProblemType.Items.Clear();
            comboSnomedProblemType.Items.Add("Problem");              //0 - Default value.  Problem (finding).  55607006
            comboSnomedProblemType.Items.Add("Finding");              //1 - Clinical finding (finding).  404684003
            comboSnomedProblemType.Items.Add("Complaint");            //2 - Complaint (finding).  409586006
            comboSnomedProblemType.Items.Add("Diagnosis");            //3 - Diagnosis interpretation (observable entity).  282291009
            comboSnomedProblemType.Items.Add("Condition");            //4 - Disease (disorder).  64572001
            comboSnomedProblemType.Items.Add("FunctionalLimitation"); //5 - Finding of functional performance and activity (finding).  248536006
            comboSnomedProblemType.Items.Add("Symptom");              //6 - Finding reported by subject or history provider (finding).  418799008
            if (DiseaseCur.SnomedProblemType == "404684003")          //Finding
            {
                comboSnomedProblemType.SelectedIndex = 1;
            }
            else if (DiseaseCur.SnomedProblemType == "409586006")           //Complaint
            {
                comboSnomedProblemType.SelectedIndex = 2;
            }
            else if (DiseaseCur.SnomedProblemType == "282291009")           //Diagnosis
            {
                comboSnomedProblemType.SelectedIndex = 3;
            }
            else if (DiseaseCur.SnomedProblemType == "64572001")           //Condition
            {
                comboSnomedProblemType.SelectedIndex = 4;
            }
            else if (DiseaseCur.SnomedProblemType == "248536006")           //FunctionalLimitation
            {
                comboSnomedProblemType.SelectedIndex = 5;
            }
            else if (DiseaseCur.SnomedProblemType == "418799008")           //Symptom
            {
                comboSnomedProblemType.SelectedIndex = 6;
            }
            else              //Problem
            {
                comboSnomedProblemType.SelectedIndex = 0;
            }
            comboEhrFunctionalStatus.Items.Clear();
            string[] arrayFunctionalStatusNames = Enum.GetNames(typeof(FunctionalStatus));
            for (int i = 0; i < arrayFunctionalStatusNames.Length; i++)
            {
                comboEhrFunctionalStatus.Items.Add(Lan.g(this, arrayFunctionalStatusNames[i]));
            }
            comboEhrFunctionalStatus.SelectedIndex = (int)DiseaseCur.FunctionStatus;          //The default value is 'Problem'
        }
Exemplo n.º 29
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.º 30
0
        private void FillGrid()
        {
            gridMain.BeginUpdate();
            gridMain.Columns.Clear();
            ODGridColumn col = new ODGridColumn("Code", 70);

            gridMain.Columns.Add(col);
            col = new ODGridColumn("CodeSystem", 90);
            gridMain.Columns.Add(col);
            col = new ODGridColumn("Description", 200);
            gridMain.Columns.Add(col);
            string        selectedValue  = comboCodeSet.SelectedItem.ToString();
            List <string> listValSetOIDs = new List <string>();

            if (selectedValue == "All")
            {
                listValSetOIDs = new List <string>(dictValueCodeSets.Values);
            }
            else              //this will limit the codes to only one value set oid
            {
                listValSetOIDs.Add(dictValueCodeSets[selectedValue]);
            }
            listCodes = EhrCodes.GetForValueSetOIDs(listValSetOIDs, true);         //these codes will exist in the corresponding table or will not be in the list
            gridMain.Rows.Clear();
            ODGridRow row;
            int       selectedIdx = -1;

            for (int i = 0; i < listCodes.Count; i++)
            {
                row = new ODGridRow();
                row.Cells.Add(listCodes[i].CodeValue);
                row.Cells.Add(listCodes[i].CodeSystem);
                //Retrieve description from the associated table
                string descript = "";
                switch (listCodes[i].CodeSystem)
                {
                case "CPT":
                    Cpt cCur = Cpts.GetByCode(listCodes[i].CodeValue);
                    if (cCur != null)
                    {
                        descript = cCur.Description;
                    }
                    break;

                case "HCPCS":
                    Hcpcs hCur = Hcpcses.GetByCode(listCodes[i].CodeValue);
                    if (hCur != null)
                    {
                        descript = hCur.DescriptionShort;
                    }
                    break;

                case "ICD9CM":
                    ICD9 i9Cur = ICD9s.GetByCode(listCodes[i].CodeValue);
                    if (i9Cur != null)
                    {
                        descript = i9Cur.Description;
                    }
                    break;

                case "ICD10CM":
                    Icd10 i10Cur = Icd10s.GetByCode(listCodes[i].CodeValue);
                    if (i10Cur != null)
                    {
                        descript = i10Cur.Description;
                    }
                    break;

                case "RXNORM":
                    descript = RxNorms.GetDescByRxCui(listCodes[i].CodeValue);
                    break;

                case "SNOMEDCT":
                    Snomed sCur = Snomeds.GetByCode(listCodes[i].CodeValue);
                    if (sCur != null)
                    {
                        descript = sCur.Description;
                    }
                    break;
                }
                row.Cells.Add(descript);
                gridMain.Rows.Add(row);
                if (listCodes[i].CodeValue == InterventionCur.CodeValue && listCodes[i].CodeSystem == InterventionCur.CodeSystem)
                {
                    selectedIdx = i;
                }
            }
            gridMain.EndUpdate();
            if (selectedIdx > -1)
            {
                gridMain.SetSelected(selectedIdx, true);
                gridMain.ScrollToIndex(selectedIdx);
            }
        }