private void FillGrid() { RxDefList = RxDefs.Refresh(); gridMain.BeginUpdate(); gridMain.Columns.Clear(); ODGridColumn col = new ODGridColumn(Lan.g("TableRxSetup", "Drug"), 140); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TableRxSetup", "Sig"), 320); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TableRxSetup", "Disp"), 70); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TableRxSetup", "Refills"), 70); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TableRxSetup", "Notes"), 300); gridMain.Columns.Add(col); gridMain.Rows.Clear(); ODGridRow row; for (int i = 0; i < RxDefList.Length; i++) { row = new ODGridRow(); row.Cells.Add(RxDefList[i].Drug); row.Cells.Add(RxDefList[i].Sig); row.Cells.Add(RxDefList[i].Disp); row.Cells.Add(RxDefList[i].Refills); row.Cells.Add(RxDefList[i].Notes); gridMain.Rows.Add(row); } gridMain.EndUpdate(); }
private void butDelete_Click(object sender, EventArgs e) { if (!MsgBox.Show(this, true, "Delete this prescription template?")) { return; } RxDefs.Delete(RxDefCur); DialogResult = DialogResult.OK; }
private void butOK_Click(object sender, System.EventArgs e) { RxDefCur.Drug = textDrug.Text; RxDefCur.Sig = textSig.Text; RxDefCur.Disp = textDisp.Text; RxDefCur.Refills = textRefills.Text; RxDefCur.Notes = textNotes.Text; RxDefs.Update(RxDefCur); DialogResult = DialogResult.OK; }
private void FormRxDefEdit_FormClosing(object sender, FormClosingEventArgs e) { if (DialogResult == DialogResult.OK) { return; //close as normal } if (IsNew) { RxDefs.Delete(RxDefCur); } }
private void butAdd_Click(object sender, System.EventArgs e) { RxDef RxDefCur = new RxDef(); RxDefs.Insert(RxDefCur); //It gets deleted if user clicks cancel FormRxDefEdit FormE = new FormRxDefEdit(RxDefCur); FormE.IsNew = true; FormE.ShowDialog(); FillGrid(); }
private void butOK_Click(object sender, System.EventArgs e) { //RxCui is set when butRxNormSelect is clicked. RxDefCur.Drug = textDrug.Text; RxDefCur.Sig = textSig.Text; RxDefCur.Disp = textDisp.Text; RxDefCur.Refills = textRefills.Text; RxDefCur.Notes = textNotes.Text; RxDefCur.IsControlled = checkControlled.Checked; RxDefs.Update(RxDefCur); DialogResult = DialogResult.OK; }
private void FormRxSelect_Load(object sender, System.EventArgs e) { _arrayRxDefs = RxDefs.Refresh(); FillGrid(); if (PrefC.GetBool(PrefName.ShowFeatureEhr)) { //We cannot allow blank prescription when using EHR, because each prescription created in this window must have an RxCui. //If we allowed blank, we would not know where to pull the RxCui from. butBlank.Visible = false; labelInstructions.Text = Lan.g(this, "Please select a Prescription from the list."); } }
private void butAdd2_Click(object sender, System.EventArgs e) { if (gridMain.GetSelectedIndex() == -1) { MessageBox.Show(Lan.g(this, "Please select item first")); return; } RxDef RxDefCur = RxDefList[gridMain.GetSelectedIndex()].Copy(); RxDefs.Insert(RxDefCur); //Now it has a new id. It gets deleted if user clicks cancel. Alerts not copied. FormRxDefEdit FormE = new FormRxDefEdit(RxDefCur); FormE.IsNew = true; FormE.ShowDialog(); FillGrid(); }
private void FillGrid() { RxDefList = RxDefs.Refresh(); gridMain.BeginUpdate(); gridMain.Columns.Clear(); ODGridColumn col = new ODGridColumn(Lan.g("TableRxSetup", "Drug"), 140); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TableRxSetup", "Controlled"), 70, HorizontalAlignment.Center); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TableRxSetup", "Sig"), 250); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TableRxSetup", "Disp"), 70); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TableRxSetup", "Refills"), 70); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TableRxSetup", "Notes"), 300); gridMain.Columns.Add(col); gridMain.Rows.Clear(); ODGridRow row; for (int i = 0; i < RxDefList.Length; i++) { row = new ODGridRow(); row.Cells.Add(RxDefList[i].Drug); if (RxDefList[i].IsControlled) { row.Cells.Add("X"); } else { row.Cells.Add(""); } row.Cells.Add(RxDefList[i].Sig); row.Cells.Add(RxDefList[i].Disp); row.Cells.Add(RxDefList[i].Refills); row.Cells.Add(RxDefList[i].Notes); gridMain.Rows.Add(row); } gridMain.EndUpdate(); }
private void butOK_Click(object sender, System.EventArgs e) { //RxCui is set when butRxNormSelect is clicked. if (CultureInfo.CurrentCulture.Name.EndsWith("US") && RxDefCur.RxCui == 0) //United States { if (!MsgBox.Show(this, true, "Warning: RxNorm was not picked. " + "RxNorm uniquely identifies drugs in the United States and helps you keep your medications organized. " + "RxNorm is used to send information to and from eRx if you are using or plan to use eRx.\r\n" + "Click OK to continue without an RxNorm, or click Cancel to stay in this window.")) { return; } } RxDefCur.Drug = textDrug.Text; RxDefCur.Sig = textSig.Text; RxDefCur.Disp = textDisp.Text; RxDefCur.Refills = textRefills.Text; RxDefCur.Notes = textNotes.Text; RxDefCur.IsControlled = checkControlled.Checked; RxDefCur.IsProcRequired = checkProcRequired.Checked; RxDefs.Update(RxDefCur); DialogResult = DialogResult.OK; }
private void RxSelected() { if (gridMain.GetSelectedIndex() == -1) { //this should never happen return; } RxDef RxDefCur = (RxDef)gridMain.ListGridRows[gridMain.GetSelectedIndex()].Tag; if (PrefC.GetBool(PrefName.ShowFeatureEhr) && RxDefCur.RxCui == 0) { string strMsgText = Lan.g(this, "The selected prescription is missing an RxNorm") + ".\r\n" + Lan.g(this, "Prescriptions without RxNorms cannot be exported in EHR documents") + ".\r\n"; if (!Security.IsAuthorized(Permissions.RxEdit, true)) { //Show the message but don't allow to edit. Continue creating rx MessageBox.Show(strMsgText); } else if (MessageBox.Show(strMsgText + Lan.g(this, "Edit RxNorm in Rx Template?"), "", MessageBoxButtons.YesNo) == DialogResult.Yes) { FormRxDefEdit form = new FormRxDefEdit(RxDefCur); form.ShowDialog(); RxDefCur = RxDefs.GetOne(RxDefCur.RxDefNum); //FormRxDefEdit does not modify the RxDefCur object, so we must get the updated RxCui from the db. } } if (RxDefCur == null) //Can occur if the RxDef is deleted. Refresh list and fill grid { _arrayRxDefs = RxDefs.Refresh(); FillGrid(); return; } //Alert if (!RxAlertL.DisplayAlerts(PatCur.PatNum, RxDefCur.RxDefNum)) { return; } //User OK with alert RxPat RxPatCur = new RxPat(); RxPatCur.RxDate = DateTime.Today; RxPatCur.PatNum = PatCur.PatNum; RxPatCur.ClinicNum = PatCur.ClinicNum; RxPatCur.Drug = RxDefCur.Drug; RxPatCur.IsControlled = RxDefCur.IsControlled; if (PrefC.GetBool(PrefName.RxHasProc) && (Clinics.ClinicNum == 0 || Clinics.GetClinic(Clinics.ClinicNum).HasProcOnRx)) { RxPatCur.IsProcRequired = RxDefCur.IsProcRequired; } RxPatCur.Sig = RxDefCur.Sig; RxPatCur.Disp = RxDefCur.Disp; RxPatCur.Refills = RxDefCur.Refills; if (PrefC.GetBool(PrefName.RxSendNewToQueue)) { RxPatCur.SendStatus = RxSendStatus.InElectQueue; } else { RxPatCur.SendStatus = RxSendStatus.Unsent; } RxPatCur.PatientInstruction = RxDefCur.PatientInstruction; //Notes not copied: we don't want these kinds of notes cluttering things FormRxEdit FormE = new FormRxEdit(PatCur, RxPatCur); FormE.IsNew = true; FormE.ShowDialog(); if (FormE.DialogResult != DialogResult.OK) { return; } bool isProvOrder = false; if (Security.CurUser.ProvNum != 0) //The user who is currently logged in is a provider. { isProvOrder = true; } _medOrderNum = MedicationPats.InsertOrUpdateMedOrderForRx(RxPatCur, RxDefCur.RxCui, isProvOrder); //RxDefCur.RxCui can be 0. EhrMeasureEvent newMeasureEvent = new EhrMeasureEvent(); newMeasureEvent.DateTEvent = DateTime.Now; newMeasureEvent.EventType = EhrMeasureEventType.CPOE_MedOrdered; newMeasureEvent.PatNum = PatCur.PatNum; newMeasureEvent.MoreInfo = ""; newMeasureEvent.FKey = _medOrderNum; EhrMeasureEvents.Insert(newMeasureEvent); DialogResult = DialogResult.OK; }
private void butRefresh_Click(object sender, EventArgs e) { _arrayRxDefs = RxDefs.Refresh(); FillGrid(); }
private void RxSelected() { if (gridMain.GetSelectedIndex() == -1) { //this should never happen return; } RxDef RxDefCur = RxDefList[gridMain.GetSelectedIndex()]; if (PrefC.GetBool(PrefName.ShowFeatureEhr) && RxDefCur.RxCui == 0) { string strMsgText = Lan.g(this, "The selected prescription is missing an RxNorm") + ".\r\n" + Lan.g(this, "Prescriptions without RxNorms cannot be exported in EHR documents") + ".\r\n" + Lan.g(this, "Edit RxNorm in Rx Template?"); if (MsgBox.Show(this, true, strMsgText)) { FormRxDefEdit form = new FormRxDefEdit(RxDefCur); form.ShowDialog(); RxDefCur = RxDefs.GetOne(RxDefCur.RxDefNum); //FormRxDefEdit does not modify the RxDefCur object, so we must get the updated RxCui from the db. } } //Alert if (!RxAlertL.DisplayAlerts(PatCur.PatNum, RxDefCur.RxDefNum)) { return; } //User OK with alert RxPat RxPatCur = new RxPat(); RxPatCur.RxDate = DateTime.Today; RxPatCur.PatNum = PatCur.PatNum; RxPatCur.Drug = RxDefCur.Drug; RxPatCur.IsControlled = RxDefCur.IsControlled; RxPatCur.Sig = RxDefCur.Sig; RxPatCur.Disp = RxDefCur.Disp; RxPatCur.Refills = RxDefCur.Refills; if (PrefC.GetBool(PrefName.RxSendNewToQueue)) { RxPatCur.SendStatus = RxSendStatus.InElectQueue; } else { RxPatCur.SendStatus = RxSendStatus.Unsent; } //Notes not copied: we don't want these kinds of notes cluttering things FormRxEdit FormE = new FormRxEdit(PatCur, RxPatCur); FormE.IsNew = true; FormE.ShowDialog(); if (FormE.DialogResult != DialogResult.OK) { return; } bool isProvOrder = false; if (Security.CurUser.ProvNum != 0) //The user who is currently logged in is a provider. { isProvOrder = true; } _medOrderNum = MedicationPats.InsertOrUpdateMedOrderForRx(RxPatCur, RxDefCur.RxCui, isProvOrder); //RxDefCur.RxCui can be 0. EhrMeasureEvent newMeasureEvent = new EhrMeasureEvent(); newMeasureEvent.DateTEvent = DateTime.Now; newMeasureEvent.EventType = EhrMeasureEventType.CPOE_MedOrdered; newMeasureEvent.PatNum = PatCur.PatNum; newMeasureEvent.MoreInfo = ""; newMeasureEvent.FKey = _medOrderNum; EhrMeasureEvents.Insert(newMeasureEvent); DialogResult = DialogResult.OK; }