예제 #1
0
        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;
        }
예제 #2
0
        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;
        }