private void FillGrid() { gridMain.BeginUpdate(); gridMain.Columns.Clear(); ODGridColumn col; col = new ODGridColumn("Reminder Criterion", 200); gridMain.Columns.Add(col); col = new ODGridColumn("Message", 200); gridMain.Columns.Add(col); listReminders = ReminderRules.SelectAll(); gridMain.Rows.Clear(); ODGridRow row; for (int i = 0; i < listReminders.Count; i++) { row = new ODGridRow(); switch (listReminders[i].ReminderCriterion) { case EhrCriterion.Problem: DiseaseDef def = DiseaseDefs.GetItem(listReminders[i].CriterionFK); row.Cells.Add("Problem =" + def.ICD9Code + " " + def.DiseaseName); break; case EhrCriterion.Medication: Medication tempMed = Medications.GetMedication(listReminders[i].CriterionFK); if (tempMed.MedicationNum == tempMed.GenericNum) //handle generic medication names. { row.Cells.Add("Medication = " + tempMed.MedName); } else { row.Cells.Add("Medication = " + tempMed.MedName + " / " + Medications.GetGenericName(tempMed.GenericNum)); } break; case EhrCriterion.Allergy: row.Cells.Add("Allergy = " + AllergyDefs.GetOne(listReminders[i].CriterionFK).Description); break; case EhrCriterion.Age: row.Cells.Add("Age " + listReminders[i].CriterionValue); break; case EhrCriterion.Gender: row.Cells.Add("Gender is " + listReminders[i].CriterionValue); break; case EhrCriterion.LabResult: row.Cells.Add("LabResult " + listReminders[i].CriterionValue); break; //case EhrCriterion.ICD9: // row.Cells.Add("ICD9 "+ICD9s.GetDescription(listReminders[i].CriterionFK)); // break; } row.Cells.Add(listReminders[i].Message); gridMain.Rows.Add(row); } gridMain.EndUpdate(); }
private void FillMeds() { Medications.Refresh(); MedicationPats.Refresh(PatCur.PatNum); gridMeds.BeginUpdate(); gridMeds.Columns.Clear(); ODGridColumn col = new ODGridColumn(Lan.g("TableMedications", "Drug Name"), 100); gridMeds.Columns.Add(col); col = new ODGridColumn(Lan.g("TableMedications", "Generic Name"), 100); gridMeds.Columns.Add(col); col = new ODGridColumn(Lan.g("TableMedications", "Notes"), 370); gridMeds.Columns.Add(col); col = new ODGridColumn(Lan.g("TableMedications", "Notes for Patient"), 370); gridMeds.Columns.Add(col); gridMeds.Rows.Clear(); ODGridRow row; for (int i = 0; i < MedicationPats.List.Length; i++) { row = new ODGridRow(); row.Cells.Add(Medications.GetMedication(MedicationPats.List[i].MedicationNum).MedName); row.Cells.Add(Medications.GetGeneric(MedicationPats.List[i].MedicationNum).MedName); row.Cells.Add(Medications.GetGeneric(MedicationPats.List[i].MedicationNum).Notes); row.Cells.Add(MedicationPats.List[i].PatNote); gridMeds.Rows.Add(row); } gridMeds.EndUpdate(); }
private void FillGrid() { Cursor = Cursors.WaitCursor; ListMeds = FormularyMeds.GetMedsForFormulary(FormularyCur.FormularyNum); gridMain.BeginUpdate(); gridMain.Columns.Clear(); ODGridColumn col = new ODGridColumn("Name", 150); gridMain.Columns.Add(col); //col=new ODGridColumn("Notes",250); //gridMain.Columns.Add(col); gridMain.Rows.Clear(); ODGridRow row; Medication medication; for (int i = 0; i < ListMeds.Count; i++) { medication = Medications.GetMedication(ListMeds[i].MedicationNum); row = new ODGridRow(); row.Cells.Add(medication.MedName.ToString()); //row.Cells.Add(Medications.GetMedication(medication.GenericNum).Notes.ToString()); gridMain.Rows.Add(row); } gridMain.EndUpdate(); Cursor = Cursors.Default; }
private void FillForm() { textMedName.Text = Medications.GetMedication(MedicationPatCur.MedicationNum).MedName; textGenericName.Text = Medications.GetGeneric(MedicationPatCur.MedicationNum).MedName; textMedNote.Text = Medications.GetGeneric(MedicationPatCur.MedicationNum).Notes; textPatNote.Text = MedicationPatCur.PatNote; }
private void FillAlerts() { RxAlertList = RxAlerts.Refresh(RxDefCur.RxDefNum); listAlerts.Items.Clear(); for (int i = 0; i < RxAlertList.Count; i++) { if (RxAlertList[i].DiseaseDefNum > 0) { listAlerts.Items.Add(DiseaseDefs.GetName(RxAlertList[i].DiseaseDefNum)); } if (RxAlertList[i].AllergyDefNum > 0) { AllergyDef allergyDef = AllergyDefs.GetOne(RxAlertList[i].AllergyDefNum); if (allergyDef != null) { listAlerts.Items.Add(allergyDef.Description); } } if (RxAlertList[i].MedicationNum > 0) { Medications.RefreshCache(); Medication med = Medications.GetMedication(RxAlertList[i].MedicationNum); if (med != null) { listAlerts.Items.Add(med.MedName); } } } }
private void gridAllMedications_CellDoubleClick(object sender, ODGridClickEventArgs e) { Medication med = (Medication)gridAllMedications.Rows[e.Row].Tag; med = Medications.GetMedication(med.MedicationNum); 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; } if (IsSelectionMode) { SelectedMedicationNum = med.MedicationNum; DialogResult = DialogResult.OK; } else //normal mode from main menu { if (!CultureInfo.CurrentCulture.Name.EndsWith("US") || e.Col != 3) //Not United States RxNorm Column { FormMedicationEdit FormME = new FormMedicationEdit(); FormME.MedicationCur = med; FormME.ShowDialog(); //This window refreshes the Medication cache if the user clicked OK. FillTab(); } } }
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 butEdit_Click(object sender, System.EventArgs e) { FormMedicationEdit FormME = new FormMedicationEdit(); FormME.MedicationCur = Medications.GetMedication(MedicationPatCur.MedicationNum); FormME.ShowDialog(); if (FormME.DialogResult != DialogResult.OK) { return; } FillForm(); }
private void butEdit_Click(object sender, System.EventArgs e) { Medications.Refresh(); FormMedicationEdit FormME = new FormMedicationEdit(); FormME.MedicationCur = Medications.GetMedication(MedicationPatCur.MedicationNum); FormME.ShowDialog(); if (FormME.DialogResult != DialogResult.OK) { return; } textMedName.Text = Medications.GetMedication(MedicationPatCur.MedicationNum).MedName; textGenericName.Text = Medications.GetGeneric(MedicationPatCur.MedicationNum).MedName; textMedNote.Text = Medications.GetGeneric(MedicationPatCur.MedicationNum).Notes; }
private void butChangeMedFrom_Click(object sender, EventArgs e) { FormMedications FormM = new FormMedications(); FormM.IsSelectionMode = true; FormM.ShowDialog(); if (FormM.DialogResult == DialogResult.OK) { _medFrom = Medications.GetMedication(FormM.SelectedMedicationNum); textGenNumFrom.Text = POut.Long(_medFrom.GenericNum); textMedNameFrom.Text = _medFrom.MedName; textMedNumFrom.Text = POut.Long(_medFrom.MedicationNum); textRxFrom.Text = POut.Long(_medFrom.RxCui); } CheckUIState(); }
private void FillMeds() { Medications.Refresh(); medList = MedicationPats.Refresh(PatCur.PatNum, checkDiscontinued.Checked); gridMeds.BeginUpdate(); gridMeds.Columns.Clear(); ODGridColumn col = new ODGridColumn(Lan.g("TableMedications", "Medication"), 140); gridMeds.Columns.Add(col); col = new ODGridColumn(Lan.g("TableMedications", "Notes for Patient"), 225); gridMeds.Columns.Add(col); col = new ODGridColumn(Lan.g("TableMedications", "Disc"), 10, HorizontalAlignment.Center); //discontinued gridMeds.Columns.Add(col); gridMeds.Rows.Clear(); ODGridRow row; for (int i = 0; i < medList.Count; i++) { row = new ODGridRow(); if (medList[i].MedicationNum == 0) { row.Cells.Add(medList[i].MedDescript); } else { Medication generic = Medications.GetGeneric(medList[i].MedicationNum); string medName = Medications.GetMedication(medList[i].MedicationNum).MedName; if (generic.MedicationNum != medList[i].MedicationNum) //not generic { medName += " (" + generic.MedName + ")"; } row.Cells.Add(medName); } row.Cells.Add(medList[i].PatNote); if (MedicationPats.IsMedActive(medList[i])) { row.Cells.Add(""); } else //discontinued { row.Cells.Add("X"); } gridMeds.Rows.Add(row); } gridMeds.EndUpdate(); }
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()); }
private void FillFK() { if (RuleCur.CriterionFK == -1 || RuleCur.CriterionFK == 0) { textCriterionFK.Text = ""; return; } switch ((EhrCriterion)comboReminderCriterion.SelectedIndex) { case EhrCriterion.Problem: DiseaseDef def = DiseaseDefs.GetItem(RuleCur.CriterionFK); textCriterionFK.Text = def.DiseaseName; textICD9.Text = def.ICD9Code; break; //case EhrCriterion.ICD9: // textCriterionFK.Text=ICD9s.GetDescription(RuleCur.CriterionFK); // break; case EhrCriterion.Medication: Medication tempMed = Medications.GetMedication(RuleCur.CriterionFK); if (tempMed.MedicationNum == tempMed.GenericNum) //handle generic medication names. { textCriterionFK.Text = tempMed.MedName; } else { textCriterionFK.Text = tempMed.MedName + " / " + Medications.GetGenericName(tempMed.GenericNum); } break; case EhrCriterion.Allergy: textCriterionFK.Text = AllergyDefs.GetOne(RuleCur.CriterionFK).Description; break; case EhrCriterion.Age: case EhrCriterion.Gender: case EhrCriterion.LabResult: //The FK boxes won't even be visible. break; default: //This should not happen. break; } }
private void FormMedPat_Load(object sender, System.EventArgs e) { if (PrefC.GetBool(PrefName.ShowFeatureEhr)) { labelPatNote.Text = "Count, Instructions, and Refills"; groupOrder.Text = "Medication Order"; } else { butFormulary.Visible = false; } 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")); for (int i = 0; i < ProviderC.ListShort.Count; i++) { comboProv.Items.Add(ProviderC.ListShort[i].GetLongDesc()); } if (MedicationPatCur.ProvNum == 0) { comboProv.SelectedIndex = 0; } else { for (int i = 0; i < ProviderC.ListShort.Count; i++) { if (MedicationPatCur.ProvNum == ProviderC.ListShort[i].ProvNum) { comboProv.SelectedIndex = i + 1; } } //if a provider was subsequently hidden, then the combobox may now be -1. } textPatNote.Text = MedicationPatCur.PatNote; if (MedicationPatCur.DateStart.Year > 1880) { textDateStart.Text = MedicationPatCur.DateStart.ToShortDateString(); } if (MedicationPatCur.DateStop.Year > 1880) { textDateStop.Text = MedicationPatCur.DateStop.ToShortDateString(); } }
private void butAddMed_Click(object sender, EventArgs e) { FormMedications FormM = new FormMedications(); FormM.IsSelectionMode = true; FormM.ShowDialog(); if (FormM.DialogResult != DialogResult.OK) { return; } Medication m = Medications.GetMedication(FormM.SelectedMedicationNum); EhrTriggerCur.MedicationNumList += " " + m.MedicationNum + " "; if (m.RxCui != 0) { EhrTriggerCur.RxCuiList += " " + m.RxCui + " "; } FillGrid(); }
private void FillMeds() { Medications.Refresh(); medList = MedicationPats.Refresh(PatCur.PatNum, checkDiscontinued.Checked); gridMeds.BeginUpdate(); gridMeds.Columns.Clear(); ODGridColumn col = new ODGridColumn(Lan.g("TableMedications", "Medication"), 120); gridMeds.Columns.Add(col); col = new ODGridColumn(Lan.g("TableMedications", "Notes"), 200); gridMeds.Columns.Add(col); col = new ODGridColumn(Lan.g("TableMedications", "Notes for Patient"), 200); gridMeds.Columns.Add(col); col = new ODGridColumn(Lan.g("TableMedications", "Status"), 60, HorizontalAlignment.Center); gridMeds.Columns.Add(col); gridMeds.Rows.Clear(); ODGridRow row; for (int i = 0; i < medList.Count; i++) { row = new ODGridRow(); Medication generic = Medications.GetGeneric(medList[i].MedicationNum); string medName = Medications.GetMedication(medList[i].MedicationNum).MedName; if (generic.MedicationNum != medList[i].MedicationNum) //not generic { medName += " (" + generic.MedName + ")"; } row.Cells.Add(medName); row.Cells.Add(Medications.GetGeneric(medList[i].MedicationNum).Notes); row.Cells.Add(medList[i].PatNote); if (medList[i].DateStop.Year > 1880) { row.Cells.Add("Inactive"); } else { row.Cells.Add("Active"); } gridMeds.Rows.Add(row); } gridMeds.EndUpdate(); }
private void FillAlerts() { RxAlertList = RxAlerts.Refresh(RxDefCur.RxDefNum); listAlerts.Items.Clear(); for (int i = 0; i < RxAlertList.Count; i++) { if (RxAlertList[i].DiseaseDefNum > 0) { listAlerts.Items.Add(DiseaseDefs.GetName(RxAlertList[i].DiseaseDefNum)); } if (RxAlertList[i].AllergyDefNum > 0) { listAlerts.Items.Add(AllergyDefs.GetOne(RxAlertList[i].AllergyDefNum).Description); } if (RxAlertList[i].MedicationNum > 0) { Medications.Refresh(); listAlerts.Items.Add(Medications.GetMedication(RxAlertList[i].MedicationNum).MedName); } } }
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 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; } }
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 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; } }
///<summary>Returns false if user does not with to continue after seeing alert. If called from FormRxSelect, then rxCui will be 0. If called from CPOE, then rxDefNum will be 0.</summary> public static bool DisplayAlerts(long patNum, long rxCui, long rxDefNum) { List <RxAlert> alertList = null; if (rxDefNum == 0) { alertList = RxAlerts.RefreshByRxCui(rxCui); //for CPOE } else { alertList = RxAlerts.Refresh(rxDefNum); //for Rx } List <Disease> diseases = Diseases.Refresh(patNum); List <Allergy> allergies = Allergies.Refresh(patNum); List <Medication> medications = Medications.GetMedicationsByPat(patNum); List <string> diseaseMatches = new List <string>(); List <string> allergiesMatches = new List <string>(); List <string> medicationsMatches = new List <string>(); List <string> customMessages = new List <string>(); for (int i = 0; i < alertList.Count; i++) { for (int j = 0; j < diseases.Count; j++) { //This does not look for matches with icd9s. //The only reason we support diseases anyway is for allergies that may have been entered as diseases. if (alertList[i].DiseaseDefNum == diseases[j].DiseaseDefNum && diseases[j].ProbStatus == 0) //ProbStatus is active. { if (alertList[i].NotificationMsg == "") { diseaseMatches.Add(DiseaseDefs.GetName(diseases[j].DiseaseDefNum)); } else { customMessages.Add(alertList[i].NotificationMsg); } } } for (int j = 0; j < allergies.Count; j++) { if (alertList[i].AllergyDefNum == allergies[j].AllergyDefNum && allergies[j].StatusIsActive) { if (alertList[i].NotificationMsg == "") { allergiesMatches.Add(AllergyDefs.GetOne(alertList[i].AllergyDefNum).Description); } else { customMessages.Add(alertList[i].NotificationMsg); } } } for (int j = 0; j < medications.Count; j++) { if (alertList[i].MedicationNum == medications[j].MedicationNum) { if (alertList[i].NotificationMsg == "") { Medications.Refresh(); medicationsMatches.Add(Medications.GetMedication(alertList[i].MedicationNum).MedName); } else { customMessages.Add(alertList[i].NotificationMsg); } } } } //these matches do not include ones that have custom messages. if (diseaseMatches.Count > 0 || allergiesMatches.Count > 0 || medicationsMatches.Count > 0) { string alert = ""; for (int i = 0; i < diseaseMatches.Count; i++) { if (i == 0) { alert += Lan.g("RxAlertL", "This patient has the following medical problems: "); } alert += diseaseMatches[i]; if ((i + 1) == diseaseMatches.Count) { alert += ".\r\n"; } else { alert += ", "; } } for (int i = 0; i < allergiesMatches.Count; i++) { if (i == 0 && diseaseMatches.Count > 0) { alert += "and the following allergies: "; } else if (i == 0) { alert = Lan.g("RxAlertL", "This patient has the following allergies: "); } alert += allergiesMatches[i]; if ((i + 1) == allergiesMatches.Count) { alert += ".\r\n"; } else { alert += ", "; } } for (int i = 0; i < medicationsMatches.Count; i++) { if (i == 0 && (diseaseMatches.Count > 0 || allergiesMatches.Count > 0)) { alert += "and is taking the following medications: "; } else if (i == 0) { alert = Lan.g("RxAlertL", "This patient is taking the following medications: "); } alert += medicationsMatches[i]; if ((i + 1) == medicationsMatches.Count) { alert += ".\r\n"; } else { alert += ", "; } } alert += "\r\n" + Lan.g("RxAlertL", "Continue anyway?"); if (MessageBox.Show(alert, "Alert", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation) != DialogResult.OK) { return(false); } } for (int i = 0; i < customMessages.Count; i++) { if (MessageBox.Show(customMessages[i] + "\r\n" + Lan.g("RxAlertL", "Continue anyway?"), "Alert", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation) != DialogResult.OK) { return(false); } } return(true); }
///<summary>Returns false if user does not wish to continue after seeing alert.</summary> public static bool DisplayAlerts(long patNum, long rxDefNum) { List <RxAlert> alertList = null; //if(rxDefNum==0){ // alertList=RxAlerts.RefreshByRxCui(rxCui);//for CPOE //} //else{ alertList = RxAlerts.Refresh(rxDefNum); //for Rx //} List <Disease> diseases = Diseases.Refresh(patNum); List <Allergy> allergies = Allergies.Refresh(patNum); List <MedicationPat> medicationPats = MedicationPats.Refresh(patNum, false); //Exclude discontinued, only active meds. List <string> diseaseMatches = new List <string>(); List <string> allergiesMatches = new List <string>(); List <string> medicationsMatches = new List <string>(); List <string> customMessages = new List <string>(); bool showHighSigOnly = PrefC.GetBool(PrefName.EhrRxAlertHighSeverity); for (int i = 0; i < alertList.Count; i++) { for (int j = 0; j < diseases.Count; j++) { //This does not look for matches with icd9s. if (alertList[i].DiseaseDefNum == diseases[j].DiseaseDefNum && diseases[j].ProbStatus == 0) //ProbStatus is active. { if (alertList[i].NotificationMsg == "") { diseaseMatches.Add(DiseaseDefs.GetName(diseases[j].DiseaseDefNum)); } else { customMessages.Add(alertList[i].NotificationMsg); } } } for (int j = 0; j < allergies.Count; j++) { if (alertList[i].AllergyDefNum == allergies[j].AllergyDefNum && allergies[j].StatusIsActive) { if (alertList[i].NotificationMsg == "") { allergiesMatches.Add(AllergyDefs.GetOne(alertList[i].AllergyDefNum).Description); } else { customMessages.Add(alertList[i].NotificationMsg); } } } for (int j = 0; j < medicationPats.Count; j++) { bool isMedInteraction = false; Medication medForAlert = Medications.GetMedication(alertList[i].MedicationNum); if (medForAlert == null) { continue; //MedicationNum will be 0 for all other alerts that are not medication alerts. } if (medicationPats[j].MedicationNum != 0 && alertList[i].MedicationNum == medicationPats[j].MedicationNum) //Medication from medication list. { isMedInteraction = true; } else if (medicationPats[j].MedicationNum == 0 && medForAlert.RxCui != 0 && medicationPats[j].RxCui == medForAlert.RxCui) //Medication from NewCrop. Unfortunately, neither of these RxCuis are required. { isMedInteraction = true; } if (!isMedInteraction) { continue; //No known interaction. } //Medication interaction. if (showHighSigOnly && !alertList[i].IsHighSignificance) //if set to only show high significance alerts and this is not a high significance interaction, do not show alert { continue; //Low significance alert. } if (alertList[i].NotificationMsg == "") { Medications.RefreshCache(); medicationsMatches.Add(Medications.GetMedication(alertList[i].MedicationNum).MedName); } else { customMessages.Add(alertList[i].NotificationMsg); } } } //these matches do not include ones that have custom messages. if (diseaseMatches.Count > 0 || allergiesMatches.Count > 0 || medicationsMatches.Count > 0) { string alert = ""; for (int i = 0; i < diseaseMatches.Count; i++) { if (i == 0) { alert += Lan.g("RxAlertL", "This patient has the following medical problems: "); } alert += diseaseMatches[i]; if ((i + 1) == diseaseMatches.Count) { alert += ".\r\n"; } else { alert += ", "; } } for (int i = 0; i < allergiesMatches.Count; i++) { if (i == 0 && diseaseMatches.Count > 0) { alert += "and the following allergies: "; } else if (i == 0) { alert = Lan.g("RxAlertL", "This patient has the following allergies: "); } alert += allergiesMatches[i]; if ((i + 1) == allergiesMatches.Count) { alert += ".\r\n"; } else { alert += ", "; } } for (int i = 0; i < medicationsMatches.Count; i++) { if (i == 0 && (diseaseMatches.Count > 0 || allergiesMatches.Count > 0)) { alert += "and is taking the following medications: "; } else if (i == 0) { alert = Lan.g("RxAlertL", "This patient is taking the following medications: "); } alert += medicationsMatches[i]; if ((i + 1) == medicationsMatches.Count) { alert += ".\r\n"; } else { alert += ", "; } } alert += "\r\n" + Lan.g("RxAlertL", "Continue anyway?"); if (MessageBox.Show(alert, "Alert", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation) != DialogResult.OK) { return(false); } } for (int i = 0; i < customMessages.Count; i++) { if (MessageBox.Show(customMessages[i] + "\r\n" + Lan.g("RxAlertL", "Continue anyway?"), "Alert", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation) != DialogResult.OK) { return(false); } } return(true); }
private void FillExistingGrid() { gridMedExisting.BeginUpdate(); gridMedExisting.ListGridColumns.Clear(); GridColumn col = new GridColumn("Last Modified", 100, HorizontalAlignment.Center); gridMedExisting.ListGridColumns.Add(col); col = new GridColumn("Date Start", 100, HorizontalAlignment.Center); gridMedExisting.ListGridColumns.Add(col); col = new GridColumn("Date Stop", 100, HorizontalAlignment.Center); gridMedExisting.ListGridColumns.Add(col); col = new GridColumn("Description", 320); gridMedExisting.ListGridColumns.Add(col); gridMedExisting.ListGridRows.Clear(); _listMedicationPatCur = MedicationPats.GetMedPatsForReconcile(_patCur.PatNum); List <long> medicationNums = new List <long>(); for (int h = 0; h < _listMedicationPatCur.Count; h++) { if (_listMedicationPatCur[h].MedicationNum > 0) { medicationNums.Add(_listMedicationPatCur[h].MedicationNum); } } _listMedicationCur = Medications.GetMultMedications(medicationNums); GridRow row; Medication med; for (int i = 0; i < _listMedicationPatCur.Count; i++) { row = new GridRow(); med = Medications.GetMedication(_listMedicationPatCur[i].MedicationNum); //Possibly change if we decided to postpone caching medications row.Cells.Add(_listMedicationPatCur[i].DateTStamp.ToShortDateString()); if (_listMedicationPatCur[i].DateStart.Year < 1880) { row.Cells.Add(""); } else { row.Cells.Add(_listMedicationPatCur[i].DateStart.ToShortDateString()); } if (_listMedicationPatCur[i].DateStop.Year < 1880) { row.Cells.Add(""); } else { row.Cells.Add(_listMedicationPatCur[i].DateStop.ToShortDateString()); } if (med.MedName == null) { row.Cells.Add(""); } else { row.Cells.Add(med.MedName); } gridMedExisting.ListGridRows.Add(row); } gridMedExisting.EndUpdate(); }
private void butOK_Click(object sender, System.EventArgs e) { if (textDateStart.errorProvider1.GetError(textDateStart) != "" || textDateStop.errorProvider1.GetError(textDateStop) != "" ) { MsgBox.Show(this, "Please fix data entry errors first."); return; } if (IsNewMedOrder) { if (textPatNote.Text == "" || textDateStart.Text == "") { MsgBox.Show(this, "For a new medical order, instructions and a start date are required."); return; } } //MedicationPatCur.MedicationNum is already set before entering this window, or else changed up above. if (comboProv.SelectedIndex == -1) { //don't make any changes to provnum. ProvNum is a hidden prov. } else if (comboProv.SelectedIndex == 0) { MedicationPatCur.ProvNum = 0; } else { MedicationPatCur.ProvNum = _listProviders[comboProv.SelectedIndex - 1].ProvNum; } MedicationPatCur.PatNote = textPatNote.Text; MedicationPatCur.DateStart = PIn.Date(textDateStart.Text); MedicationPatCur.DateStop = PIn.Date(textDateStop.Text); if (IsNew) { MedicationPats.Insert(MedicationPatCur); if (MedicationPatCur.MedicationNum == 0) { SecurityLogs.MakeLogEntry(Permissions.PatMedicationListEdit, MedicationPatCur.PatNum, MedicationPatCur.MedDescript + " added"); } else { SecurityLogs.MakeLogEntry(Permissions.PatMedicationListEdit, MedicationPatCur.PatNum, Medications.GetMedication(MedicationPatCur.MedicationNum).MedName + " added"); } } else { MedicationPats.Update(MedicationPatCur); if (MedicationPatCur.MedicationNum == 0) { SecurityLogs.MakeLogEntry(Permissions.PatMedicationListEdit, MedicationPatCur.PatNum, MedicationPatCur.MedDescript + " edited"); } else { SecurityLogs.MakeLogEntry(Permissions.PatMedicationListEdit, MedicationPatCur.PatNum, Medications.GetMedication(MedicationPatCur.MedicationNum).MedName + " edited"); } } DialogResult = DialogResult.OK; }
private void butRemove_Click(object sender, System.EventArgs e) { if (IsNew) { DialogResult = DialogResult.Cancel; return; } if (!MsgBox.Show(this, MsgBoxButtons.OKCancel, "Remove this medication from this patient? Patient notes will be lost.")) { return; } MedicationPats.Delete(MedicationPatCur); if (MedicationPatCur.MedicationNum == 0) { SecurityLogs.MakeLogEntry(Permissions.PatMedicationListEdit, MedicationPatCur.PatNum, MedicationPatCur.MedDescript + " deleted"); } else { SecurityLogs.MakeLogEntry(Permissions.PatMedicationListEdit, MedicationPatCur.PatNum, Medications.GetMedication(MedicationPatCur.MedicationNum).MedName + " deleted"); } MedicationPatCur = null; //This prevents other windows trying to use the medication pat after this window has closed. DialogResult = DialogResult.OK; }
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 FillReconcileGrid() { gridMedReconcile.BeginUpdate(); gridMedReconcile.ListGridColumns.Clear(); GridColumn col = new GridColumn("Last Modified", 130, HorizontalAlignment.Center); gridMedReconcile.ListGridColumns.Add(col); col = new GridColumn("Date Start", 100, HorizontalAlignment.Center); gridMedReconcile.ListGridColumns.Add(col); col = new GridColumn("Date Stop", 100, HorizontalAlignment.Center); gridMedReconcile.ListGridColumns.Add(col); col = new GridColumn("Description", 350); gridMedReconcile.ListGridColumns.Add(col); col = new GridColumn("Notes", 150); gridMedReconcile.ListGridColumns.Add(col); col = new GridColumn("Is Incoming", 50, HorizontalAlignment.Center); gridMedReconcile.ListGridColumns.Add(col); gridMedReconcile.ListGridRows.Clear(); GridRow row; for (int i = 0; i < _listMedicationPatReconcile.Count; i++) { row = new GridRow(); row.Cells.Add(DateTime.Now.ToShortDateString()); if (_listMedicationPatReconcile[i].DateStart.Year < 1880) { row.Cells.Add(""); } else { row.Cells.Add(_listMedicationPatReconcile[i].DateStart.ToShortDateString()); } if (_listMedicationPatReconcile[i].DateStop.Year < 1880) { row.Cells.Add(""); } else { row.Cells.Add(_listMedicationPatReconcile[i].DateStop.ToShortDateString()); } if (_listMedicationPatReconcile[i].IsNew) { if (_listMedicationPatReconcile[i].MedDescript == null) { row.Cells.Add(""); } else { row.Cells.Add(_listMedicationPatReconcile[i].MedDescript); } } else { Medication med = Medications.GetMedication(_listMedicationPatReconcile[i].MedicationNum); if (med.MedName == null) { row.Cells.Add(""); } else { row.Cells.Add(med.MedName); } } if (_listMedicationPatReconcile[i].PatNote == null) { row.Cells.Add(""); } else { row.Cells.Add(_listMedicationPatReconcile[i].PatNote); } row.Cells.Add(_listMedicationPatReconcile[i].IsNew?"X":""); gridMedReconcile.ListGridRows.Add(row); } gridMedReconcile.EndUpdate(); }