private void gridMain_CellDoubleClick(object sender, ODGridClickEventArgs e)
        {
            object objCur = gridMain.Rows[e.Row].Tag;

            //gridMain is filled with assessments, interventions, and/or medications
            if (objCur.GetType().Name == "EhrMeasureEvent")
            {
                //if assessment, we will allow them to change the DateTEvent, but not the status or more info box
                FormEhrMeasureEventEdit FormM = new FormEhrMeasureEventEdit();
                FormM.MeasCur = (EhrMeasureEvent)objCur;
                FormM.ShowDialog();
            }
            if (objCur.GetType().Name == "Intervention")
            {
                FormInterventionEdit FormI = new FormInterventionEdit();
                FormI.InterventionCur = (Intervention)objCur;
                FormI.IsAllTypes      = false;
                FormI.IsSelectionMode = false;
                FormI.ShowDialog();
            }
            if (objCur.GetType().Name == "MedicationPat")
            {
                FormMedPat FormMP = new FormMedPat();
                FormMP.MedicationPatCur = (MedicationPat)objCur;
                FormMP.IsNew            = false;
                FormMP.ShowDialog();
            }
            FillGrid();
        }
Example #2
0
        private void butAdd_Click(object sender, EventArgs e)
        {
            //select medication from list.  Additional meds can be added to the list from within that dlg
            FormMedications FormM = new FormMedications();

            FormM.IsSelectionMode = true;
            FormM.ShowDialog();
            if (FormM.DialogResult != DialogResult.OK)
            {
                return;
            }
            MedicationPat MedicationPatCur = new MedicationPat();

            MedicationPatCur.PatNum        = PatCur.PatNum;
            MedicationPatCur.MedicationNum = FormM.SelectedMedicationNum;
            MedicationPatCur.ProvNum       = PatCur.PriProv;
            FormMedPat FormMP = new FormMedPat();

            FormMP.MedicationPatCur = MedicationPatCur;
            FormMP.IsNew            = true;
            FormMP.ShowDialog();
            if (FormMP.DialogResult != DialogResult.OK)
            {
                return;
            }
            FillMeds();
        }
        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();
        }
Example #4
0
        private void gridMeds_CellDoubleClick(object sender, ODGridClickEventArgs e)
        {
            FormMedPat FormMP = new FormMedPat();

            FormMP.MedicationPatCur = medList[e.Row];
            FormMP.ShowDialog();
            FillMeds();
        }
Example #5
0
        private void gridMain_CellDoubleClick(object sender, ODGridClickEventArgs e)
        {
            object objCur = gridMain.Rows[e.Row].Tag;

            if (objCur.GetType().Name == "Intervention")           //grid can contain MedicationPat or Intervention objects, launch appropriate window
            {
                FormInterventionEdit FormInt = new FormInterventionEdit();
                FormInt.InterventionCur = (Intervention)objCur;
                FormInt.IsAllTypes      = false;
                FormInt.IsSelectionMode = false;
                FormInt.ShowDialog();
            }
            if (objCur.GetType().Name == "MedicationPat")
            {
                FormMedPat FormMP = new FormMedPat();
                FormMP.MedicationPatCur = (MedicationPat)objCur;
                FormMP.IsNew            = false;
                FormMP.ShowDialog();
            }
            FillGrid();
        }
Example #6
0
        ///<summary>This can happen when clicking in the grid, or when the form is Shown.  The latter would happen after user unknowingly exited ehr in order to use FormMedPat.  Popping back to the Orders window makes the experience seamless.  This can be recursive if the user edits a series of medicationpats.</summary>
        private void LaunchOrdersWindow()
        {
            FormEhrMedicalOrders FormOrd = new FormEhrMedicalOrders();

            FormOrd._patCur = PatCur;
            FormOrd.ShowDialog();
            //if(FormOrd.DialogResult!=DialogResult.OK) {//There is no ok button
            //	return;
            //}

            /*not currently used, but might be if we let users generate Rx from med order.
             * if(FormOrd.LaunchRx) {
             *      if(FormOrd.LaunchRxNum==0) {
             *              ResultOnClosing=EhrFormResult.RxSelect;
             *      }
             *      else {
             *              ResultOnClosing=EhrFormResult.RxEdit;
             *              LaunchRxNum=FormOrd.LaunchRxNum;
             *      }
             *      Close();
             * }
             * else*/
            if (FormOrd.LaunchMedicationPat)
            {
                //if(FormOrd.LaunchMedicationPatNum==0) {
                //	ResultOnClosing=EhrFormResult.MedicationPatNew;//This cannot happen unless a provider is logged in with a valid ehr key
                //}
                //else {
                FormMedPat FormMP = new FormMedPat();
                FormMP.MedicationPatCur = MedicationPats.GetOne(FormOrd.LaunchMedicationPatNum);
                FormMP.ShowDialog();
                //ResultOnClosing=EhrFormResult.MedicationPatEdit;
                //LaunchMedicationPatNum=FormOrd.LaunchMedicationPatNum;
                //}
                //Close();
                //}
                //else {
                FillGridMu();
            }
        }
Example #7
0
 private void butAdd_Click(object sender,EventArgs e)
 {
     //select medication from list.  Additional meds can be added to the list from within that dlg
     FormMedications FormM=new FormMedications();
     FormM.IsSelectionMode=true;
     FormM.ShowDialog();
     if(FormM.DialogResult!=DialogResult.OK) {
         return;
     }
     MedicationPat MedicationPatCur=new MedicationPat();
     MedicationPatCur.PatNum=PatCur.PatNum;
     MedicationPatCur.MedicationNum=FormM.SelectedMedicationNum;
     MedicationPatCur.ProvNum=PatCur.PriProv;
     FormMedPat FormMP=new FormMedPat();
     FormMP.MedicationPatCur=MedicationPatCur;
     FormMP.IsNew=true;
     FormMP.ShowDialog();
     if(FormMP.DialogResult!=DialogResult.OK) {
         return;
     }
     FillMeds();
 }
        private void gridInterventions_CellDoubleClick(object sender, ODGridClickEventArgs e)
        {
            Object objCur = gridInterventions.Rows[e.Row].Tag;

            //the intervention grid will be filled with Interventions and MedicationPats, load form accordingly
            if (objCur is Intervention)
            {
                FormInterventionEdit FormI = new FormInterventionEdit();
                FormI.InterventionCur       = (Intervention)objCur;
                FormI.IsAllTypes            = false;
                FormI.IsSelectionMode       = false;
                FormI.InterventionCur.IsNew = false;
                FormI.ShowDialog();
            }
            else if (objCur is MedicationPat)
            {
                FormMedPat FormMP = new FormMedPat();
                FormMP.MedicationPatCur = (MedicationPat)objCur;
                FormMP.IsNew            = false;
                FormMP.ShowDialog();
            }
            FillGridInterventions();
        }
Example #9
0
		private void gridMeds_CellDoubleClick(object sender,ODGridClickEventArgs e) {
			FormMedPat FormMP=new FormMedPat();
			FormMP.MedicationPatCur=medList[e.Row];
			FormMP.ShowDialog();
			if(FormMP.DialogResult==DialogResult.OK 
				&& CDSPermissions.GetForUser(Security.CurUser.UserNum).ShowCDS 
				&& CDSPermissions.GetForUser(Security.CurUser.UserNum).MedicationCDS) 
			{
				FormCDSIntervention FormCDSI=new FormCDSIntervention();
				FormCDSI.ListCDSI=EhrTriggers.TriggerMatch(Medications.GetMedication(FormMP.MedicationPatCur.MedicationNum),PatCur);
				FormCDSI.ShowIfRequired(false);
			}
			FillMeds();
		}
Example #10
0
 private void Tool_EHR_Click(bool onLoadShowOrders)
 {
     #if EHRTEST
         //so we can step through for debugging.
     /*
         EhrQuarterlyKey keyThisQ=EhrQuarterlyKeys.GetKeyThisQuarter();
         if(keyThisQ==null) {
             MessageBox.Show("No quarterly key entered for this quarter.");
             return;
         }
         if(!((FormEHR)FormOpenDental.FormEHR).QuarterlyKeyIsValid((DateTime.Today.Year-2000).ToString(),EhrQuarterlyKeys.MonthToQuarter(DateTime.Today.Month).ToString(),
             PrefC.GetString(PrefName.PracticeTitle),keyThisQ.KeyValue)) {
             MessageBox.Show("Invalid quarterly key.");
             return;
         }
     */
         ((FormEHR)FormOpenDental.FormEHR).PatNum=PatCur.PatNum;
         ((FormEHR)FormOpenDental.FormEHR).OnShowLaunchOrders=onLoadShowOrders;
         ((FormEHR)FormOpenDental.FormEHR).ShowDialog();
         if(((FormEHR)FormOpenDental.FormEHR).ResultOnClosing==EhrFormResult.None) {
             //return;
         }
         if(((FormEHR)FormOpenDental.FormEHR).ResultOnClosing==EhrFormResult.RxEdit) {
             FormRxEdit FormRXE=new FormRxEdit(PatCur,RxPats.GetRx(((FormEHR)FormOpenDental.FormEHR).LaunchRxNum));
             FormRXE.ShowDialog();
             ModuleSelected(PatCur.PatNum);
             Tool_EHR_Click(false);//recursive.  The only way out of the loop is EhrFormResult.None.
         }
         else if(((FormEHR)FormOpenDental.FormEHR).ResultOnClosing==EhrFormResult.RxSelect) {
             FormRxSelect FormRS=new FormRxSelect(PatCur);
             FormRS.ShowDialog();
             ModuleSelected(PatCur.PatNum);
             Tool_EHR_Click(false);
         }
         else if(((FormEHR)FormOpenDental.FormEHR).ResultOnClosing==EhrFormResult.Medical) {
             FormMedical formM=new FormMedical(PatientNoteCur,PatCur);
             formM.ShowDialog();
             ModuleSelected(PatCur.PatNum);
             Tool_EHR_Click(false);
         }
         else if(((FormEHR)FormOpenDental.FormEHR).ResultOnClosing==EhrFormResult.PatientEdit) {
             FormPatientEdit formP=new FormPatientEdit(PatCur,FamCur);
             formP.ShowDialog();
             ModuleSelected(PatCur.PatNum);
             Tool_EHR_Click(false);
         }
         else if(((FormEHR)FormOpenDental.FormEHR).ResultOnClosing==EhrFormResult.Online) {
             FormEhrOnlineAccess formO=new FormEhrOnlineAccess();
             formO.PatCur=PatCur;
             formO.ShowDialog();
             ModuleSelected(PatCur.PatNum);
             Tool_EHR_Click(false);
         }
         else if(((FormEHR)FormOpenDental.FormEHR).ResultOnClosing==EhrFormResult.MedReconcile) {
             FormMedicationReconcile FormMR=new FormMedicationReconcile();
             FormMR.PatCur=PatCur;
             FormMR.ShowDialog();
             ModuleSelected(PatCur.PatNum);
             Tool_EHR_Click(false);
         }
         else if(((FormEHR)FormOpenDental.FormEHR).ResultOnClosing==EhrFormResult.Referrals) {
             FormReferralsPatient formRP=new FormReferralsPatient();
             formRP.PatNum=PatCur.PatNum;
             formRP.ShowDialog();
             ModuleSelected(PatCur.PatNum);
             Tool_EHR_Click(false);
         }
         else if(((FormEHR)FormOpenDental.FormEHR).ResultOnClosing==EhrFormResult.MedicationPatEdit) {
             FormMedPat formMP=new FormMedPat();
             formMP.MedicationPatCur=MedicationPats.GetOne(((FormEHR)FormOpenDental.FormEHR).LaunchMedicationPatNum);
             formMP.ShowDialog();
             ModuleSelected(PatCur.PatNum);
             Tool_EHR_Click(true);
         }
         else if(((FormEHR)FormOpenDental.FormEHR).ResultOnClosing==EhrFormResult.MedicationPatNew) {
             //This cannot happen unless a provider is logged in with a valid ehr key
             FormMedications FormM=new FormMedications();
             FormM.IsSelectionMode=true;
             FormM.ShowDialog();
             if(FormM.DialogResult==DialogResult.OK) {
                 Medication med=Medications.GetMedicationFromDb(FormM.SelectedMedicationNum);
                 if(med.RxCui==0 //if the med has no Cui, it won't trigger an alert
                     || RxAlertL.DisplayAlerts(PatCur.PatNum,med.RxCui,0))//user sees alert and wants to continue
                 {
                     MedicationPat medicationPat=new MedicationPat();
                     medicationPat.PatNum=PatCur.PatNum;
                     medicationPat.MedicationNum=FormM.SelectedMedicationNum;
                     medicationPat.ProvNum=Security.CurUser.ProvNum;
                     medicationPat.DateStart=DateTime.Today;
                     FormMedPat FormMP=new FormMedPat();
                     FormMP.MedicationPatCur=medicationPat;
                     FormMP.IsNew=true;
                     FormMP.IsNewMedOrder=true;
                     FormMP.ShowDialog();
                     if(FormMP.DialogResult==DialogResult.OK) {
                         ModuleSelected(PatCur.PatNum);
                     }
                 }
             }
             Tool_EHR_Click(true);
         }
     #else
         Type type=FormOpenDental.AssemblyEHR.GetType("EHR.FormEHR");//namespace.class
         object[] args;
         EhrQuarterlyKey keyThisQ=EhrQuarterlyKeys.GetKeyThisQuarter();
         if(keyThisQ==null) {
             MessageBox.Show("No quarterly key entered for this quarter.");
             return;
         }
         args=new object[] { (DateTime.Today.Year-2000).ToString(),EhrQuarterlyKeys.MonthToQuarter(DateTime.Today.Month).ToString(),
             PrefC.GetString(PrefName.PracticeTitle),keyThisQ.KeyValue };
         if(!(bool)type.InvokeMember("QuarterlyKeyIsValid",System.Reflection.BindingFlags.InvokeMethod,null,FormOpenDental.FormEHR,args)) {
             MessageBox.Show("Invalid quarterly key.");
             return;
         }
         args=new object[] {PatCur.PatNum};
         type.InvokeMember("PatNum",System.Reflection.BindingFlags.SetField,null,FormOpenDental.FormEHR,args);
         type.InvokeMember("ShowDialog",System.Reflection.BindingFlags.InvokeMethod,null,FormOpenDental.FormEHR,null);
         if(((EhrFormResult)type.InvokeMember("ResultOnClosing",System.Reflection.BindingFlags.GetField,null,FormOpenDental.FormEHR,null))==EhrFormResult.None) {
             return;
         }
         if(((EhrFormResult)type.InvokeMember("ResultOnClosing",System.Reflection.BindingFlags.GetField,null,FormOpenDental.FormEHR,null))==EhrFormResult.RxEdit) {
             long launchRxNum=(long)type.InvokeMember("LaunchRxNum",System.Reflection.BindingFlags.GetField,null,FormOpenDental.FormEHR,null);
             FormRxEdit FormRXE=new FormRxEdit(PatCur,RxPats.GetRx(launchRxNum));
             FormRXE.ShowDialog();
             ModuleSelected(PatCur.PatNum);
             Tool_EHR_Click(false);
         }
         else if(((EhrFormResult)type.InvokeMember("ResultOnClosing",System.Reflection.BindingFlags.GetField,null,FormOpenDental.FormEHR,null))==EhrFormResult.RxSelect) {
             FormRxSelect FormRS=new FormRxSelect(PatCur);
             FormRS.ShowDialog();
             ModuleSelected(PatCur.PatNum);
             Tool_EHR_Click(false);
         }
         else if(((EhrFormResult)type.InvokeMember("ResultOnClosing",System.Reflection.BindingFlags.GetField,null,FormOpenDental.FormEHR,null))==EhrFormResult.Medical) {
             FormMedical formM=new FormMedical(PatientNoteCur,PatCur);
             formM.ShowDialog();
             ModuleSelected(PatCur.PatNum);
             Tool_EHR_Click(false);
         }
         else if(((EhrFormResult)type.InvokeMember("ResultOnClosing",System.Reflection.BindingFlags.GetField,null,FormOpenDental.FormEHR,null))==EhrFormResult.PatientEdit) {
             FormPatientEdit formP=new FormPatientEdit(PatCur,FamCur);
             formP.ShowDialog();
             ModuleSelected(PatCur.PatNum);
             Tool_EHR_Click(false);
         }
         else if(((EhrFormResult)type.InvokeMember("ResultOnClosing",System.Reflection.BindingFlags.GetField,null,FormOpenDental.FormEHR,null))==EhrFormResult.Online) {
             FormEhrOnlineAccess formO=new FormEhrOnlineAccess();
             formO.PatCur=PatCur;
             formO.ShowDialog();
             ModuleSelected(PatCur.PatNum);
             Tool_EHR_Click(false);
         }
         else if(((EhrFormResult)type.InvokeMember("ResultOnClosing",System.Reflection.BindingFlags.GetField,null,FormOpenDental.FormEHR,null))==EhrFormResult.MedReconcile) {
             FormMedicationReconcile FormMR=new FormMedicationReconcile();
             FormMR.PatCur=PatCur;
             FormMR.ShowDialog();
             ModuleSelected(PatCur.PatNum);
             Tool_EHR_Click(false);
         }
         else if(((EhrFormResult)type.InvokeMember("ResultOnClosing",System.Reflection.BindingFlags.GetField,null,FormOpenDental.FormEHR,null))==EhrFormResult.Referrals) {
             FormReferralsPatient formRP=new FormReferralsPatient();
             formRP.PatNum=PatCur.PatNum;
             formRP.ShowDialog();
             ModuleSelected(PatCur.PatNum);
             Tool_EHR_Click(false);
         }
         else if(((EhrFormResult)type.InvokeMember("ResultOnClosing",System.Reflection.BindingFlags.GetField,null,FormOpenDental.FormEHR,null))==EhrFormResult.MedicationPatEdit) {
             long medicationPatNum=(long)type.InvokeMember("LaunchMedicationPatNum",System.Reflection.BindingFlags.GetField,null,FormOpenDental.FormEHR,null);
             FormMedPat formMP=new FormMedPat();
             formMP.MedicationPatCur=MedicationPats.GetOne(medicationPatNum);
             formMP.ShowDialog();
             ModuleSelected(PatCur.PatNum);
             Tool_EHR_Click(true);
         }
         else if(((EhrFormResult)type.InvokeMember("ResultOnClosing",System.Reflection.BindingFlags.GetField,null,FormOpenDental.FormEHR,null))==EhrFormResult.MedicationPatNew) {
             //This cannot happen unless a provider is logged in with a valid ehr key
             FormMedications FormM=new FormMedications();
             FormM.IsSelectionMode=true;
             FormM.ShowDialog();
             if(FormM.DialogResult==DialogResult.OK) {
                 Medication med=Medications.GetMedicationFromDb(FormM.SelectedMedicationNum);
                 if(med.RxCui==0 //if the med has no Cui, it won't trigger an alert
                     || RxAlertL.DisplayAlerts(PatCur.PatNum,med.RxCui,0))//user sees alert and wants to continue
                 {
                     MedicationPat medicationPat=new MedicationPat();
                     medicationPat.PatNum=PatCur.PatNum;
                     medicationPat.MedicationNum=FormM.SelectedMedicationNum;
                     medicationPat.ProvNum=Security.CurUser.ProvNum;
                     FormMedPat FormMP=new FormMedPat();
                     FormMP.MedicationPatCur=medicationPat;
                     FormMP.IsNew=true;
                     FormMP.ShowDialog();
                     if(FormMP.DialogResult==DialogResult.OK) {
                         ModuleSelected(PatCur.PatNum);
                     }
                 }
             }
             Tool_EHR_Click(true);
         }
     #endif
 }
		private void gridMain_CellDoubleClick(object sender,ODGridClickEventArgs e) {
			object objCur=gridMain.Rows[e.Row].Tag;
			if(objCur.GetType().Name=="Intervention") {//grid can contain MedicationPat or Intervention objects, launch appropriate window
				FormInterventionEdit FormInt=new FormInterventionEdit();
				FormInt.InterventionCur=(Intervention)objCur;
				FormInt.IsAllTypes=false;
				FormInt.IsSelectionMode=false;
				FormInt.ShowDialog();
			}
			if(objCur.GetType().Name=="MedicationPat") {
				FormMedPat FormMP=new FormMedPat();
				FormMP.MedicationPatCur=(MedicationPat)objCur;
				FormMP.IsNew=false;
				FormMP.ShowDialog();
			}
			FillGrid();
		}
Example #12
0
		private void butAdd_Click(object sender, System.EventArgs e) {
			//select medication from list.  Additional meds can be added to the list from within that dlg
			FormMedications FormM=new FormMedications();
			FormM.IsSelectionMode=true;
			FormM.ShowDialog();
			if(FormM.DialogResult!=DialogResult.OK){
				return;
			} 
			if(CDSPermissions.GetForUser(Security.CurUser.UserNum).ShowCDS && CDSPermissions.GetForUser(Security.CurUser.UserNum).MedicationCDS) {
				FormCDSIntervention FormCDSI=new FormCDSIntervention();
				FormCDSI.ListCDSI=EhrTriggers.TriggerMatch(Medications.GetMedication(FormM.SelectedMedicationNum),PatCur);
				FormCDSI.ShowIfRequired();
				if(FormCDSI.DialogResult==DialogResult.Abort) {
					return;//do not add medication
				}
			}
			MedicationPat MedicationPatCur=new MedicationPat();
			MedicationPatCur.PatNum=PatCur.PatNum;
			MedicationPatCur.MedicationNum=FormM.SelectedMedicationNum;
			MedicationPatCur.RxCui=Medications.GetMedication(FormM.SelectedMedicationNum).RxCui;
			MedicationPatCur.ProvNum=PatCur.PriProv;
			FormMedPat FormMP=new FormMedPat();
			FormMP.MedicationPatCur=MedicationPatCur;
			FormMP.IsNew=true;
			FormMP.ShowDialog();
			if(FormMP.DialogResult!=DialogResult.OK){
				return;
			}
			FillMeds();
		}
Example #13
0
		private void gridMeds_CellDoubleClick(object sender,ODGridClickEventArgs e) {
			FormMedPat FormMP=new FormMedPat();
			FormMP.MedicationPatCur=medList[e.Row];
			FormMP.ShowDialog();
			if(FormMP.DialogResult==DialogResult.OK 
				&& FormMP.MedicationPatCur!=null //Can get be null if the user removed the medication from the patient.
				&& CDSPermissions.GetForUser(Security.CurUser.UserNum).ShowCDS 
				&& CDSPermissions.GetForUser(Security.CurUser.UserNum).MedicationCDS) 
			{
				object triggerObject=null;
				if(FormMP.MedicationPatCur.MedicationNum > 0) {//0 indicats the med is from NewCrop.
					triggerObject=Medications.GetMedication(FormMP.MedicationPatCur.MedicationNum);
				}
				else if(FormMP.MedicationPatCur.RxCui > 0) {//Meds from NewCrop might have a valid RxNorm.
					triggerObject=RxNorms.GetByRxCUI(FormMP.MedicationPatCur.RxCui.ToString());
				}
				if(triggerObject!=null) {
					FormCDSIntervention FormCDSI=new FormCDSIntervention();
					FormCDSI.ListCDSI=EhrTriggers.TriggerMatch(triggerObject,PatCur);
					FormCDSI.ShowIfRequired(false);
				}
			}
			FillMeds();
		}
		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;
				Description=gridMain.Rows[gridMain.GetSelectedIndex()].Cells[2].Text;
			}
			//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") {
				//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.Refresh();//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;
			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;
		}
Example #15
0
		private void gridMain_CellDoubleClick(object sender,ODGridClickEventArgs e) {
			object objCur=gridMain.Rows[e.Row].Tag;
			//gridMain is filled with assessments, interventions, and/or medications
			if(objCur.GetType().Name=="EhrMeasureEvent") {
				//if assessment, we will allow them to change the DateTEvent, but not the status or more info box
				FormEhrMeasureEventEdit FormM=new FormEhrMeasureEventEdit((EhrMeasureEvent)objCur);
				FormM.ShowDialog();
			}
			if(objCur.GetType().Name=="Intervention") {
				FormInterventionEdit FormI=new FormInterventionEdit();
				FormI.InterventionCur=(Intervention)objCur;
				FormI.IsAllTypes=false;
				FormI.IsSelectionMode=false;
				FormI.ShowDialog();
			}
			if(objCur.GetType().Name=="MedicationPat") {
				FormMedPat FormMP=new FormMedPat();
				FormMP.MedicationPatCur=(MedicationPat)objCur;
				FormMP.IsNew=false;
				FormMP.ShowDialog();
			}
			FillGrid();
		}
Example #16
0
		///<summary>This can happen when clicking in the grid, or when the form is Shown.  The latter would happen after user unknowingly exited ehr in order to use FormMedPat.  Popping back to the Orders window makes the experience seamless.  This can be recursive if the user edits a series of medicationpats.</summary>
		private void LaunchOrdersWindow() {
			FormEhrMedicalOrders FormOrd = new FormEhrMedicalOrders();
			FormOrd._patCur=PatCur;
			FormOrd.ShowDialog();
			//if(FormOrd.DialogResult!=DialogResult.OK) {//There is no ok button
			//	return;
			//}
			/*not currently used, but might be if we let users generate Rx from med order.
			if(FormOrd.LaunchRx) {
				if(FormOrd.LaunchRxNum==0) {
					ResultOnClosing=EhrFormResult.RxSelect;
				}
				else {
					ResultOnClosing=EhrFormResult.RxEdit;
					LaunchRxNum=FormOrd.LaunchRxNum;
				}
				Close();
			}
			else*/
			if(FormOrd.LaunchMedicationPat) {
				//if(FormOrd.LaunchMedicationPatNum==0) {
				//	ResultOnClosing=EhrFormResult.MedicationPatNew;//This cannot happen unless a provider is logged in with a valid ehr key
				//}
				//else {
				FormMedPat FormMP=new FormMedPat();
				FormMP.MedicationPatCur=MedicationPats.GetOne(FormOrd.LaunchMedicationPatNum);
				FormMP.ShowDialog();
					//ResultOnClosing=EhrFormResult.MedicationPatEdit;
					//LaunchMedicationPatNum=FormOrd.LaunchMedicationPatNum;
				//}
				//Close();
			//}
			//else {
				FillGridMu();
			}
		}
Example #17
0
        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;
        }
Example #18
0
		private void gridMeds_CellDoubleClick(object sender,ODGridClickEventArgs e) {
			FormMedPat FormMP=new FormMedPat();
			FormMP.MedicationPatCur=medList[e.Row];
			FormMP.ShowDialog();
			FillMeds();
		}