private void FillGrid(bool isExact) { Cursor = Cursors.WaitCursor; rxList = RxNorms.GetListByCodeOrDesc(textCode.Text, isExact, checkIgnore.Checked); gridMain.BeginUpdate(); gridMain.Columns.Clear(); ODGridColumn col = new ODGridColumn(Lan.g("FormRxNorms", "Code"), 80); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("FormRxNorms", "Description"), 110); gridMain.Columns.Add(col); gridMain.Rows.Clear(); ODGridRow row; for (int i = 0; i < rxList.Count; i++) { row = new ODGridRow(); row.Cells.Add(rxList[i].RxCui); row.Cells.Add(rxList[i].Description); gridMain.Rows.Add(row); } gridMain.EndUpdate(); gridMain.ScrollValue = 0; Cursor = Cursors.Default; }
private void FormRxNorms_Shown(object sender, EventArgs e) { if (RxNorms.IsRxNormTableEmpty()) { MessageBox.Show("The RxNorm table in the database is empty. If you intend to use RxNorm codes, use the code system importer tool in the Setup>EHR menu. It will add about 10 MB to your database size."); } }
private void FormRxNorms_Shown(object sender, EventArgs e) { if (RxNorms.IsRxNormTableEmpty()) { MessageBox.Show("The RxNorm table in the database is empty. If you intend to use RxNorm codes, use the button at the bottom of this window to load the RxNorm table with codes. It will add about 10 MB to your database size."); } }
private void FillForm() { textMedName.Text = MedicationCur.MedName; if (!IsNew) { textMedName.ReadOnly = true; } if (MedicationCur.MedicationNum == MedicationCur.GenericNum) { textGenericName.Text = MedicationCur.MedName; textNotes.Text = MedicationCur.Notes; textNotes.ReadOnly = false; Brands = Medications.GetBrands(MedicationCur.MedicationNum); comboBrands.Items.Clear(); comboBrands.Items.AddRange(Brands); if (Brands.Length > 0) { comboBrands.SelectedIndex = 0; } } else { textGenericName.Text = Medications.GetMedication(MedicationCur.GenericNum).MedName; textNotes.Text = Medications.GetMedication(MedicationCur.GenericNum).Notes; textNotes.ReadOnly = true; Brands = new string[0]; comboBrands.Visible = false; labelBrands.Visible = false; } _patNameMeds = Medications.GetPatNamesForMed(MedicationCur.MedicationNum); comboPatients.Items.Clear(); comboPatients.Items.AddRange(_patNameMeds); if (_patNameMeds.Length > 0) { comboPatients.SelectedIndex = 0; } AllergyDef alD = AllergyDefs.GetAllergyDefFromMedication(MedicationCur.MedicationNum); if (alD != null) { _patNameAllergies = Allergies.GetPatNamesForAllergy(alD.AllergyDefNum); comboPatientAllergy.Items.Clear(); comboPatientAllergy.Items.AddRange(_patNameAllergies); if (_patNameAllergies.Length > 0) { comboPatientAllergy.SelectedIndex = 0; } } if (CultureInfo.CurrentCulture.Name.EndsWith("US")) //United States { textRxNormDesc.Text = RxNorms.GetDescByRxCui(MedicationCur.RxCui.ToString()); } else { labelRxNorm.Visible = false; textRxNormDesc.Visible = false; butRxNormSelect.Visible = false; } }
private void butIntervention_Click(object sender, EventArgs e) { if (comboInterventionCode.SelectedIndex < 0) { MsgBox.Show(this, "You must select an intervention code."); return; } EhrCode iCodeCur = _listInterventionCodes[comboInterventionCode.SelectedIndex]; DateTime dateCur = PIn.Date(textDateIntervention.Text); if (iCodeCur.CodeSystem == "RXNORM" && !checkPatientDeclined.Checked) //if patient declines the medication, enter as a declined intervention //codeVal will be RxCui of medication, see if it already exists in Medication table { Medication medCur = Medications.GetMedicationFromDbByRxCui(PIn.Long(iCodeCur.CodeValue)); if (medCur == null) //no med with this RxCui, create one { medCur = new Medication(); Medications.Insert(medCur); //so that we will have the primary key medCur.GenericNum = medCur.MedicationNum; medCur.RxCui = PIn.Long(iCodeCur.CodeValue); medCur.MedName = RxNorms.GetDescByRxCui(iCodeCur.CodeValue); Medications.Update(medCur); Medications.RefreshCache(); //refresh cache to include new medication } MedicationPat medPatCur = new MedicationPat(); medPatCur.PatNum = PatCur.PatNum; medPatCur.ProvNum = PatCur.PriProv; medPatCur.MedicationNum = medCur.MedicationNum; medPatCur.RxCui = medCur.RxCui; medPatCur.DateStart = dateCur; FormMedPat FormMP = new FormMedPat(); FormMP.MedicationPatCur = medPatCur; FormMP.IsNew = true; FormMP.ShowDialog(); if (FormMP.DialogResult != DialogResult.OK) { return; } if (FormMP.MedicationPatCur.DateStart.Date < dateCur.AddMonths(-6).Date || FormMP.MedicationPatCur.DateStart.Date > dateCur.Date) { MsgBox.Show(this, "The medication order just entered is not within the 6 months prior to the date of this intervention. You can modify the " + "date of the medication order in the patient's medical history section."); } } else { Intervention iCur = new Intervention(); iCur.PatNum = PatCur.PatNum; iCur.ProvNum = PatCur.PriProv; iCur.DateEntry = dateCur; iCur.CodeValue = iCodeCur.CodeValue; iCur.CodeSystem = iCodeCur.CodeSystem; iCur.CodeSet = InterventionCodeSet.TobaccoCessation; iCur.IsPatDeclined = checkPatientDeclined.Checked; Interventions.Insert(iCur); } comboInterventionCode.SelectedIndex = -1; FillGridInterventions(); }
private void FillRxCui() { if (RxDefCur.RxCui == 0) { textRxCui.Text = ""; } else { textRxCui.Text = RxDefCur.RxCui.ToString() + " - " + RxNorms.GetDescByRxCui(RxDefCur.RxCui.ToString()); } }
private void FormRxNorms_Shown(object sender, EventArgs e) { if (RxNorms.IsRxNormTableSmall()) { if (MsgBox.Show(this, true, "Incomplete RxNorm list detected. " + "If you intend to use RxNorm codes, you can download them now by clicking OK. " + "The RxNorm codes will add about 10 MB to your database size. Download RxNorm codes?")) { FormCodeSystemsImport form = new FormCodeSystemsImport(CodeSystemName.RXNORM); form.ShowDialog(); } } }
private void butRxNorm_Click(object sender, EventArgs e) { FormRxNorms FormRN = new FormRxNorms(); FormRN.ShowDialog(); if (FormRN.DialogResult != DialogResult.OK) { return; } MedicationCur.RxCui = PIn.Long(FormRN.SelectedRxNorm.RxCui); textRxNormDesc.Text = RxNorms.GetDescByRxCui(MedicationCur.RxCui.ToString()); if (IsNew) { textMedName.Text = RxNorms.GetDescByRxCui(MedicationCur.RxCui.ToString()); } }
private void butRxNorm_Click(object sender, EventArgs e) { //if(!MsgBox.Show(this,MsgBoxButtons.OKCancel,"This will ")) { // return; //} Cursor = Cursors.WaitCursor; RxNorms.CreateFreshRxNormTableFromZip(); Cursor = Cursors.Default; MsgBox.Show(this, "done"); //just making sure it worked: /* * RxNorm rxNorm=RxNorms.GetOne(1); * MsgBox.Show(this,rxNorm.RxNormNum+" "+rxNorm.RxCui+" "+rxNorm.MmslCode+" "+rxNorm.Description); * MsgBox.Show(this,RxNorms.GetMmslCodeByRxCui("1000005")+" <-- should be 26420"); * MsgBox.Show(this,RxNorms.GetMmslCodeByRxCui("1000002")+" <-- should be blank");*/ }
private void butEdit_Click(object sender, System.EventArgs e) { Medications.Refresh(); FormMedicationEdit FormME = new FormMedicationEdit(); FormME.MedicationCur = Medications.GetMedication(MedicationPatCur.MedicationNum); //The edit button is not visible if MedicationNum=0. FormME.ShowDialog(); if (FormME.DialogResult != DialogResult.OK) { return; } MedicationPatCur.RxCui = FormME.MedicationCur.RxCui; textMedName.Text = Medications.GetMedication(MedicationPatCur.MedicationNum).MedName; //The edit button is not visible if MedicationNum=0. textGenericName.Text = Medications.GetGeneric(MedicationPatCur.MedicationNum).MedName; //The edit button is not visible if MedicationNum=0. textMedNote.Text = Medications.GetGeneric(MedicationPatCur.MedicationNum).Notes; //The edit button is not visible if MedicationNum=0. textRxNormDesc.Text = RxNorms.GetDescByRxCui(MedicationPatCur.RxCui.ToString()); }
//New Crop now handles formulary checks /*private void butFormulary_Click(object sender,EventArgs e) { * FormFormularies FormF=new FormFormularies(); * FormF.IsSelectionMode=true; * FormF.ShowDialog(); * Cursor=Cursors.WaitCursor; * if(FormF.DialogResult!=DialogResult.OK) { * Cursor=Cursors.Default; * return; * } * List<FormularyMed> ListMeds=FormularyMeds.GetMedsForFormulary(FormF.SelectedFormularyNum); * bool medIsInFormulary=false; * for(int i=0;i<ListMeds.Count;i++) { * if(ListMeds[i].MedicationNum==MedicationPatCur.MedicationNum) { * medIsInFormulary=true; * } * } * Cursor=Cursors.Default; * if(medIsInFormulary){ * MsgBox.Show(this,"This medication is in the selected formulary."); * } * else { * MsgBox.Show(this,"This medication is not in the selected forumulary."); * } * }*/ private void butRxNormSelect_Click(object sender, EventArgs e) { FormRxNorms FormRN = new FormRxNorms(); FormRN.IsSelectionMode = true; FormRN.InitSearchCodeOrDescript = textMedName.Text; FormRN.ShowDialog(); if (FormRN.DialogResult != DialogResult.OK) { return; } MedicationPatCur.RxCui = PIn.Long(FormRN.SelectedRxNorm.RxCui); textRxNormDesc.Text = RxNorms.GetDescByRxCui(MedicationPatCur.RxCui.ToString()); if (IsNew) { textMedName.Text = RxNorms.GetDescByRxCui(MedicationPatCur.RxCui.ToString()); } }
private void FillRxCui() { if (!CultureInfo.CurrentCulture.Name.EndsWith("US")) //Not United States { labelRxNorm.Visible = false; textRxCui.Visible = false; butRxNormSelect.Visible = false; return; } if (RxDefCur.RxCui == 0) { textRxCui.Text = ""; } else { textRxCui.Text = RxDefCur.RxCui.ToString() + " - " + RxNorms.GetDescByRxCui(RxDefCur.RxCui.ToString()); } }
///<summary>Inserts the new medication and returns it.</summary> public static Medication CreateMedication(string medName = "", string rxCui = "") { Medication medication = new Medication(); medication.MedName = medName; if (medication.MedName == "") { medication.MedName = "Med_" + MiscUtils.CreateRandomAlphaNumericString(8); } medication.RxCui = PIn.Long(rxCui, false); if (medication.RxCui != 0 && RxNorms.GetByRxCUI(rxCui) == null) { RxNorm rxNorm = new RxNorm(); rxNorm.RxCui = rxCui; rxNorm.Description = medication.MedName; RxNorms.Insert(rxNorm); } Medications.Insert(medication); return(medication); }
private void FillGrid(bool isExact) { Cursor = Cursors.WaitCursor; rxList = RxNorms.GetListByCodeOrDesc(textCode.Text, isExact, checkIgnore.Checked); List <string> listMedicationRxCuis = Medications.GetWhere(x => x.RxCui != 0).Select(x => x.RxCui.ToString()).Distinct().ToList(); List <string> listMedPatRxCuis = MedicationPats.GetForRxCuis(rxList.Select(x => x.RxCui).ToList()).Select(x => x.RxCui.ToString()).ToList(); gridMain.BeginUpdate(); gridMain.ListGridColumns.Clear(); GridColumn col = new GridColumn(Lan.g("FormRxNorms", "Code"), 80); gridMain.ListGridColumns.Add(col); col = new GridColumn(Lan.g("FormRxNorms", "InMedList"), 60, HorizontalAlignment.Center); gridMain.ListGridColumns.Add(col); col = new GridColumn(Lan.g("FormRxNorms", "MedCount"), 60, HorizontalAlignment.Center); gridMain.ListGridColumns.Add(col); col = new GridColumn(Lan.g("FormRxNorms", "Description"), 0); gridMain.ListGridColumns.Add(col); gridMain.ListGridRows.Clear(); GridRow row; foreach (RxNorm rxNorm in rxList) { row = new GridRow(); row.Cells.Add(rxNorm.RxCui); //Code if (listMedicationRxCuis.Exists(x => x == rxNorm.RxCui)) { row.Cells.Add("X"); //InMedList } else { row.Cells.Add(""); //InMedList } row.Cells.Add(listMedPatRxCuis.FindAll(x => x == rxNorm.RxCui).Count.ToString()); //MedCount row.Cells.Add(rxNorm.Description); gridMain.ListGridRows.Add(row); } gridMain.EndUpdate(); gridMain.ScrollValue = 0; Cursor = Cursors.Default; }
private void butEdit_Click(object sender, System.EventArgs e) { Medications.RefreshCache(); FormMedicationEdit FormME = new FormMedicationEdit(); Medication med = Medications.GetMedication(MedicationPatCur.MedicationNum); //The edit button is not visible if MedicationNum=0. if (med == null) //Possible to delete the medication from a separate WS while medication loaded in memory. { MsgBox.Show(this, "An error occurred loading medication."); return; } FormME.ShowDialog(); if (FormME.DialogResult != DialogResult.OK) { return; } MedicationPatCur.RxCui = FormME.MedicationCur.RxCui; textMedName.Text = Medications.GetMedication(MedicationPatCur.MedicationNum).MedName; //The edit button is not visible if MedicationNum=0. textGenericName.Text = Medications.GetGeneric(MedicationPatCur.MedicationNum).MedName; //The edit button is not visible if MedicationNum=0. textMedNote.Text = Medications.GetGeneric(MedicationPatCur.MedicationNum).Notes; //The edit button is not visible if MedicationNum=0. textRxNormDesc.Text = RxNorms.GetDescByRxCui(MedicationPatCur.RxCui.ToString()); }
private void FillForm() { textMedName.Text = MedicationCur.MedName; if (!IsNew) { textMedName.ReadOnly = true; } if (MedicationCur.MedicationNum == MedicationCur.GenericNum) { textGenericName.Text = MedicationCur.MedName; textNotes.Text = MedicationCur.Notes; textNotes.ReadOnly = false; Brands = Medications.GetBrands(MedicationCur.MedicationNum); comboBrands.Items.Clear(); comboBrands.Items.AddRange(Brands); if (Brands.Length > 0) { comboBrands.SelectedIndex = 0; } } else { textGenericName.Text = Medications.GetMedication(MedicationCur.GenericNum).MedName; textNotes.Text = Medications.GetMedication(MedicationCur.GenericNum).Notes; textNotes.ReadOnly = true; Brands = new string[0]; comboBrands.Visible = false; labelBrands.Visible = false; } PatNames = Medications.GetPats(MedicationCur.MedicationNum); comboPatients.Items.Clear(); comboPatients.Items.AddRange(PatNames); if (PatNames.Length > 0) { comboPatients.SelectedIndex = 0; } textRxNormDesc.Text = RxNorms.GetDescByRxCui(MedicationCur.RxCui.ToString()); }
private void FormRxAlertEdit_Load(object sender, EventArgs e) { textRxName.Text = RxDefCur.Drug; if (RxAlertCur.DiseaseDefNum > 0) { labelName.Text = Lan.g(this, "If the patient already has this Problem"); textName.Text = DiseaseDefs.GetName(RxAlertCur.DiseaseDefNum); } if (RxAlertCur.AllergyDefNum > 0) { labelName.Text = Lan.g(this, "If the patient already has this Allergy"); textName.Text = AllergyDefs.GetOne(RxAlertCur.AllergyDefNum).Description; } if (RxAlertCur.MedicationNum > 0) { labelName.Text = Lan.g(this, "If the patient is already taking this medication"); textName.Text = Medications.GetMedicationFromDb(RxAlertCur.MedicationNum).MedName; } if (RxDefCur.RxCui != 0) { textRxNorm.Text = RxDefCur.RxCui.ToString() + " - " + RxNorms.GetDescByRxCui(RxDefCur.RxCui.ToString()); } textMessage.Text = RxAlertCur.NotificationMsg; }
private void butOK_Click(object sender, EventArgs e) { //validate-------------------------------------- DateTime date; if (textDate.Text == "") { MsgBox.Show(this, "Please enter a date."); return; } try { date = DateTime.Parse(textDate.Text); } catch { MsgBox.Show(this, "Please fix date first."); return; } string codeVal = ""; string codeSys = ""; if (gridMain.GetSelectedIndex() == -1) //no intervention code selected { MsgBox.Show(this, "You must select a code for this intervention."); return; } else { codeVal = listCodes[gridMain.GetSelectedIndex()].CodeValue; codeSys = listCodes[gridMain.GetSelectedIndex()].CodeSystem; } //save-------------------------------------- //Intervention grid may contain medications, have to insert a new med if necessary and load FormMedPat for user to input data if (codeSys == "RXNORM" && !checkPatientDeclined.Checked) { //codeVal will be RxCui of medication, see if it already exists in Medication table Medication medCur = Medications.GetMedicationFromDbByRxCui(PIn.Long(codeVal)); if (medCur == null) //no med with this RxCui, create one { medCur = new Medication(); Medications.Insert(medCur); //so that we will have the primary key medCur.GenericNum = medCur.MedicationNum; medCur.RxCui = PIn.Long(codeVal); medCur.MedName = RxNorms.GetDescByRxCui(codeVal); Medications.Update(medCur); Medications.RefreshCache(); //refresh cache to include new medication } MedicationPat medPatCur = new MedicationPat(); medPatCur.PatNum = InterventionCur.PatNum; medPatCur.ProvNum = InterventionCur.ProvNum; medPatCur.MedicationNum = medCur.MedicationNum; medPatCur.RxCui = medCur.RxCui; medPatCur.DateStart = date; FormMedPat FormMP = new FormMedPat(); FormMP.MedicationPatCur = medPatCur; FormMP.IsNew = true; FormMP.ShowDialog(); if (FormMP.DialogResult != DialogResult.OK) { return; } if (FormMP.MedicationPatCur.DateStart.Date < InterventionCur.DateEntry.AddMonths(-6).Date || FormMP.MedicationPatCur.DateStart.Date > InterventionCur.DateEntry.Date) { MsgBox.Show(this, "The medication order just entered is not within the 6 months prior to the date of this intervention. You can modify the date of the medication order in the patient's medical history section."); } DialogResult = DialogResult.OK; return; } InterventionCur.DateEntry = date; InterventionCur.CodeValue = codeVal; InterventionCur.CodeSystem = codeSys; InterventionCur.Note = textNote.Text; InterventionCur.IsPatDeclined = checkPatientDeclined.Checked; string selectedCodeSet = comboCodeSet.SelectedItem.ToString().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)[0]; if (IsAllTypes) //CodeSet will be set by calling function unless showing all types, in which case we need to determine which InterventionCodeSet to assign { if (selectedCodeSet == "All") //All types showing and set to All, have to determine which InterventionCodeSet this code belongs to { List <string> listVSFound = new List <string>(); foreach (KeyValuePair <string, string> kvp in dictValueCodeSets) { List <EhrCode> listCodes = EhrCodes.GetForValueSetOIDs(new List <string> { kvp.Value }, true); for (int i = 0; i < listCodes.Count; i++) { if (listCodes[i].CodeValue == codeVal) { listVSFound.Add(kvp.Key); break; } } } if (listVSFound.Count > 1) //Selected code found in more than one value set, ask the user which InterventionCodeSet to assign to this intervention { InputBox chooseSet = new InputBox(Lan.g(this, "The selected code belongs to more than one intervention code set. Select the code set to assign to this intervention from the list below."), listVSFound); if (chooseSet.ShowDialog() != DialogResult.OK) { return; } if (chooseSet.comboSelection.SelectedIndex == -1) { MsgBox.Show(this, "You must select an intervention code set for the selected code."); return; } selectedCodeSet = chooseSet.comboSelection.SelectedItem.ToString().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)[0]; } else //the code must belong to at least one value set, since count in listVSFound is not greater than 1, it must be a code from exactly one set, use that for the InterventionCodeSet { selectedCodeSet = listVSFound[0].Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)[0]; } } InterventionCur.CodeSet = (InterventionCodeSet)Enum.Parse(typeof(InterventionCodeSet), selectedCodeSet); } //Nutrition is used for both nutrition and physical activity counseling for children, we have to determine which set this code belongs to else if (InterventionCur.CodeSet == InterventionCodeSet.Nutrition && selectedCodeSet != "Nutrition") //Nutrition set by calling form, user is showing all or physical activity codes only { if (selectedCodeSet == "All") //showing all codes from Nutrition and PhysicalActivity interventions, determine which set it belongs to //No codes exist in both code sets, so if it is not in the PhysicalActivity code set, we can safely assume this is a Nutrition intervention { List <EhrCode> listCodes = EhrCodes.GetForValueSetOIDs(new List <string> { dictValueCodeSets[InterventionCodeSet.PhysicalActivity.ToString() + " Counseling"] }, true); for (int i = 0; i < listCodes.Count; i++) { if (listCodes[i].CodeValue == codeVal) { InterventionCur.CodeSet = InterventionCodeSet.PhysicalActivity; break; } } } else { InterventionCur.CodeSet = InterventionCodeSet.PhysicalActivity; } } else { //if not all types, and not Nutrition with All or PhysicalActivity selected in combo box, the code set sent in by calling form will remain the code set for this intervention } if (InterventionCur.IsNew) { Interventions.Insert(InterventionCur); } else { Interventions.Update(InterventionCur); } DialogResult = DialogResult.OK; }
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(); }
private void FillGrid() { gridMain.BeginUpdate(); gridMain.Columns.Clear(); ODGridColumn col = new ODGridColumn("Date", 70); gridMain.Columns.Add(col); col = new ODGridColumn("Type", 170); gridMain.Columns.Add(col); col = new ODGridColumn("Description", 170); gridMain.Columns.Add(col); col = new ODGridColumn("Documentation", 170); gridMain.Columns.Add(col); gridMain.Rows.Clear(); ODGridRow row; List <ODGridRow> listRows = new List <ODGridRow>(); #region AssessedEvents _ListEvents = EhrMeasureEvents.RefreshByType(PatCur.PatNum, EhrMeasureEventType.TobaccoUseAssessed); for (int i = 0; i < _ListEvents.Count; i++) { row = new ODGridRow(); row.Cells.Add(_ListEvents[i].DateTEvent.ToShortDateString()); Loinc lCur = Loincs.GetByCode(_ListEvents[i].CodeValueEvent); //TobaccoUseAssessed events can be one of three types, all LOINC codes if (lCur != null) { row.Cells.Add(lCur.NameLongCommon); } else { row.Cells.Add(_ListEvents[i].EventType.ToString()); } Snomed sCur = Snomeds.GetByCode(_ListEvents[i].CodeValueResult); if (sCur != null) { row.Cells.Add(sCur.Description); } else { row.Cells.Add(""); } row.Cells.Add(_ListEvents[i].MoreInfo); row.Tag = _ListEvents[i]; listRows.Add(row); } #endregion #region CessationInterventions _ListInterventions = Interventions.Refresh(PatCur.PatNum, InterventionCodeSet.TobaccoCessation); for (int i = 0; i < _ListInterventions.Count; i++) { row = new ODGridRow(); row.Cells.Add(_ListInterventions[i].DateEntry.ToShortDateString()); row.Cells.Add(InterventionCodeSet.TobaccoCessation.ToString() + " Counseling"); string descript = ""; switch (_ListInterventions[i].CodeSystem) { case "CPT": Cpt cptCur = Cpts.GetByCode(_ListInterventions[i].CodeValue); if (cptCur != null) { descript = cptCur.Description; } break; case "SNOMEDCT": Snomed sCur = Snomeds.GetByCode(_ListInterventions[i].CodeValue); if (sCur != null) { descript = sCur.Description; } break; } row.Cells.Add(descript); row.Cells.Add(_ListInterventions[i].Note); row.Tag = _ListInterventions[i]; listRows.Add(row); } #endregion #region CessationMedications _ListMedPats = MedicationPats.Refresh(PatCur.PatNum, true); List <EhrCode> listEhrMeds = EhrCodes.GetForValueSetOIDs(new List <string> { "2.16.840.1.113883.3.526.3.1190" }, true); //Tobacco Use Cessation Pharmacotherapy Value Set //listEhrMeds will contain 41 medications for tobacco cessation if those exist in the rxnorm table 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(); string dateRange = ""; if (_ListMedPats[i].DateStart.Year > 1880) { dateRange = _ListMedPats[i].DateStart.ToShortDateString(); } if (_ListMedPats[i].DateStop.Year > 1880) { if (dateRange != "") { dateRange += " - "; } dateRange += _ListMedPats[i].DateStop.ToShortDateString(); } if (dateRange == "") { dateRange = _ListMedPats[i].DateTStamp.ToShortDateString(); } row.Cells.Add(dateRange); row.Cells.Add(InterventionCodeSet.TobaccoCessation.ToString() + " Medication"); string medDescript = RxNorms.GetDescByRxCui(_ListMedPats[i].RxCui.ToString()); row.Cells.Add(medDescript); row.Cells.Add(_ListMedPats[i].PatNote); row.Tag = _ListMedPats[i]; listRows.Add(row); } #endregion listRows.Sort(SortDate); for (int i = 0; i < listRows.Count; i++) { gridMain.Rows.Add(listRows[i]); } gridMain.EndUpdate(); }
private void FillGridInterventions() { gridInterventions.BeginUpdate(); gridInterventions.Columns.Clear(); gridInterventions.Columns.Add(new ODGridColumn("Date", 70)); gridInterventions.Columns.Add(new ODGridColumn("Type", 150)); gridInterventions.Columns.Add(new ODGridColumn("Description", 160)); gridInterventions.Columns.Add(new ODGridColumn("Declined", 60) { TextAlign = HorizontalAlignment.Center }); gridInterventions.Columns.Add(new ODGridColumn("Documentation", 140)); gridInterventions.Rows.Clear(); //build list of rows of CessationInterventions and CessationMedications so we can order the list by date and type before filling the grid List <ODGridRow> listRows = new List <ODGridRow>(); ODGridRow row; #region CessationInterventions List <Intervention> listInterventions = Interventions.Refresh(PatCur.PatNum, InterventionCodeSet.TobaccoCessation); foreach (Intervention iCur in listInterventions) { row = new ODGridRow(); row.Cells.Add(iCur.DateEntry.ToShortDateString()); string type = InterventionCodeSet.TobaccoCessation.ToString() + " Counseling"; string descript = ""; switch (iCur.CodeSystem) { case "CPT": Cpt cptCur = Cpts.GetByCode(iCur.CodeValue); descript = cptCur != null?cptCur.Description:""; break; case "SNOMEDCT": Snomed sCur = Snomeds.GetByCode(iCur.CodeValue); descript = sCur != null?sCur.Description:""; break; case "RXNORM": //if the user checks the "Patient Declined" checkbox, we enter the tobacco cessation medication as an intervention that was declined type = InterventionCodeSet.TobaccoCessation.ToString() + " Medication"; RxNorm rCur = RxNorms.GetByRxCUI(iCur.CodeValue); descript = rCur != null?rCur.Description:""; break; } row.Cells.Add(type); row.Cells.Add(descript); row.Cells.Add(iCur.IsPatDeclined?"X":""); row.Cells.Add(iCur.Note); row.Tag = iCur; listRows.Add(row); } #endregion #region CessationMedications //Tobacco Use Cessation Pharmacotherapy Value Set string[] arrayRxCuiStrings = EhrCodes.GetForValueSetOIDs(new List <string> { "2.16.840.1.113883.3.526.3.1190" }, true) .Select(x => x.CodeValue).ToArray(); //arrayRxCuiStrings will contain 41 RxCui strings for tobacco cessation medications if those exist in the rxnorm table List <MedicationPat> listMedPats = MedicationPats.Refresh(PatCur.PatNum, true).FindAll(x => arrayRxCuiStrings.Contains(x.RxCui.ToString())); foreach (MedicationPat medPatCur in listMedPats) { row = new ODGridRow(); List <string> listMedDates = new List <string>(); if (medPatCur.DateStart.Year > 1880) { listMedDates.Add(medPatCur.DateStart.ToShortDateString()); } if (medPatCur.DateStop.Year > 1880) { listMedDates.Add(medPatCur.DateStop.ToShortDateString()); } if (listMedDates.Count == 0) { listMedDates.Add(medPatCur.DateTStamp.ToShortDateString()); } row.Cells.Add(string.Join(" - ", listMedDates)); row.Cells.Add(InterventionCodeSet.TobaccoCessation.ToString() + " Medication"); row.Cells.Add(RxNorms.GetDescByRxCui(medPatCur.RxCui.ToString())); row.Cells.Add(medPatCur.PatNote); row.Tag = medPatCur; listRows.Add(row); } #endregion listRows.OrderBy(x => PIn.Date(x.Cells[0].Text)) //rows ordered by date, oldest first .ThenBy(x => x.Cells[3].Text != "") //interventions at the top, declined med interventions below normal interventions .ThenBy(x => x.Tag.GetType().Name != "Intervention" || ((Intervention)x.Tag).CodeSystem == "RXNORM").ToList() .ForEach(x => gridInterventions.Rows.Add(x)); //then add rows to gridInterventions gridInterventions.EndUpdate(); }
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(); }
private void FormMedPat_Load(object sender, System.EventArgs e) { if (PrefC.GetBool(PrefName.ShowFeatureEhr)) { labelPatNote.Text = "Count, Instructions, and Refills"; groupOrder.Text = "Medication Order"; } //Formulary checks now handled in NewCrop //else { // butFormulary.Visible=false; //} if (CultureInfo.CurrentCulture.Name.EndsWith("US")) //United States { textRxNormDesc.Text = RxNorms.GetDescByRxCui(MedicationPatCur.RxCui.ToString()); if (Erx.IsFromErx(MedicationPatCur.ErxGuid)) //This is a medical order that was automatically created when fetching prescriptions from eRx. //We allow the user to change the RxCui on the medical order, because eRx does not always supply an RxCui. //Also the MedicaitonNum on the order will always be 0, so there is no link between the order and the medication table. //If MedicationOrder was non-zero and we changed the RxCui on the order, then the automatic sync between medicationpat.RxCui and medication.RxCui would be tainted. { butRxNormSelect.Visible = true; } } else { labelRxNorm.Visible = false; textRxNormDesc.Visible = false; } if (MedicationPatCur.MedicationNum == 0) //Probably a medical order created during eRx prescription fetching, but not necessarily. { textMedName.Text = MedicationPatCur.MedDescript; labelGenericNotes.Visible = false; labelGenericName.Visible = false; textGenericName.Visible = false; textMedNote.Visible = false; butEdit.Visible = false; labelEdit.Visible = false; } else { textMedName.Text = Medications.GetMedication(MedicationPatCur.MedicationNum).MedName; textGenericName.Text = Medications.GetGeneric(MedicationPatCur.MedicationNum).MedName; textMedNote.Text = Medications.GetGeneric(MedicationPatCur.MedicationNum).Notes; } comboProv.Items.Add(Lan.g(this, "none")); _listProviders = Providers.GetDeepCopy(true); for (int i = 0; i < _listProviders.Count; i++) { comboProv.Items.Add(_listProviders[i].GetLongDesc()); } if (MedicationPatCur.ProvNum == 0) { comboProv.SelectedIndex = 0; } else { for (int i = 0; i < _listProviders.Count; i++) { if (MedicationPatCur.ProvNum == _listProviders[i].ProvNum) { comboProv.SelectedIndex = i + 1; } } //if a provider was subsequently hidden, then the combobox may now be -1. } if (MedicationPatCur.IsCpoe) { //We cannot allow the user to change the provider, because our EHR reports use the provider in combination with the IsCpoe flag to report CPOE. comboProv.Enabled = false; } textPatNote.Text = MedicationPatCur.PatNote; if (MedicationPatCur.DateStart.Year > 1880) { textDateStart.Text = MedicationPatCur.DateStart.ToShortDateString(); } if (MedicationPatCur.DateStop.Year > 1880) { textDateStop.Text = MedicationPatCur.DateStop.ToShortDateString(); } if (IsNew) { butEdit.Visible = false; labelEdit.Visible = false; } }
private void FillForm() { textMedName.Text = MedicationCur.MedName; if (!IsNew) { textMedName.ReadOnly = true; } if (MedicationCur.GenericNum == 0) { //Probably occurred from a previous bug. This makes sure we have a generic num that is not 0. MedicationCur.GenericNum = MedicationCur.MedicationNum; MsgBox.Show(this, "This medication had a missing generic name. The generic name has been set to the medication name."); } if (MedicationCur.MedicationNum == MedicationCur.GenericNum) { textGenericName.Text = MedicationCur.MedName; textNotes.Text = MedicationCur.Notes; textNotes.ReadOnly = false; Brands = Medications.GetBrands(MedicationCur.MedicationNum); comboBrands.Items.Clear(); comboBrands.Items.AddRange(Brands); if (Brands.Length > 0) { comboBrands.SelectedIndex = 0; } } else { textGenericName.Text = Medications.GetMedication(MedicationCur.GenericNum).MedName; textNotes.Text = Medications.GetMedication(MedicationCur.GenericNum).Notes; textNotes.ReadOnly = true; Brands = new string[0]; comboBrands.Visible = false; labelBrands.Visible = false; } _patNameMeds = Medications.GetPatNamesForMed(MedicationCur.MedicationNum); comboPatients.Items.Clear(); comboPatients.Items.AddRange(_patNameMeds); if (_patNameMeds.Length > 0) { comboPatients.SelectedIndex = 0; } AllergyDef alD = AllergyDefs.GetAllergyDefFromMedication(MedicationCur.MedicationNum); if (alD != null) { _patNameAllergies = Allergies.GetPatNamesForAllergy(alD.AllergyDefNum); comboPatientAllergy.Items.Clear(); comboPatientAllergy.Items.AddRange(_patNameAllergies); if (_patNameAllergies.Length > 0) { comboPatientAllergy.SelectedIndex = 0; } } if (CultureInfo.CurrentCulture.Name.EndsWith("US")) //United States { textRxNormDesc.Text = RxNorms.GetDescByRxCui(MedicationCur.RxCui.ToString()); } else { labelRxNorm.Visible = false; textRxNormDesc.Visible = false; butRxNormSelect.Visible = false; } }
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); } }