Beispiel #1
0
        private void butAdd_Click(object sender, System.EventArgs e)
        {
            FormReferralSelect FormRS = new FormReferralSelect();

            FormRS.IsSelectionMode = true;
            FormRS.ShowDialog();
            if (FormRS.DialogResult != DialogResult.OK)
            {
                return;
            }
            FormRefAttachEdit FormRA = new FormRefAttachEdit();

            FormRA.RefAttachCur             = new RefAttach();
            FormRA.RefAttachCur.ReferralNum = FormRS.SelectedReferral.ReferralNum;
            FormRA.RefAttachCur.PatNum      = PatNum;
            FormRA.RefAttachCur.IsFrom      = true;
            FormRA.RefAttachCur.RefDate     = DateTime.Today;
            int order = 0;

            for (int i = 0; i < RefAttachList.Length; i++)
            {
                if (RefAttachList[i].ItemOrder > order)
                {
                    order = RefAttachList[i].ItemOrder;
                }
            }
            FormRA.RefAttachCur.ItemOrder = order + 1;
            FormRA.IsNew = true;
            FormRA.ShowDialog();
            if (FormRA.DialogResult != DialogResult.OK)
            {
                return;
            }
            FillGrid();
        }
        private void butAddCustom_Click(object sender, EventArgs e)
        {
            if (!Security.IsAuthorized(Permissions.RefAttachAdd))
            {
                return;
            }
            FormReferralSelect FormRS = new FormReferralSelect();

            FormRS.IsSelectionMode = true;
            FormRS.ShowDialog();
            if (FormRS.DialogResult != DialogResult.OK)
            {
                return;
            }
            RefAttach refattach = new RefAttach();

            refattach.ReferralNum        = FormRS.SelectedReferral.ReferralNum;
            refattach.PatNum             = PatNum;
            refattach.RefType            = ReferralType.RefCustom;
            refattach.RefDate            = DateTimeOD.Today;
            refattach.IsTransitionOfCare = false;
            refattach.ItemOrder          = RefAttachList.Select(x => x.ItemOrder + 1).OrderByDescending(x => x).FirstOrDefault();//Max+1 or 0
            RefAttaches.Insert(refattach);
            SecurityLogs.MakeLogEntry(Permissions.RefAttachAdd, PatNum, "Referred (custom) " + Referrals.GetNameFL(refattach.ReferralNum));
            FillGrid();
            for (int i = 0; i < RefAttachList.Count; i++)
            {
                if (RefAttachList[i].RefAttachNum == refattach.RefAttachNum)
                {
                    gridMain.SetSelected(i, true);
                    break;
                }
            }
        }
Beispiel #3
0
 private void butAddFrom_Click(object sender,System.EventArgs e)
 {
     FormReferralSelect FormRS=new FormReferralSelect();
     FormRS.IsSelectionMode=true;
     FormRS.ShowDialog();
     if(FormRS.DialogResult!=DialogResult.OK) {
         return;
     }
     RefAttach refattach=new RefAttach();
     refattach.ReferralNum=FormRS.SelectedReferral.ReferralNum;
     refattach.PatNum=PatNum;
     refattach.IsFrom=true;
     refattach.RefDate=DateTime.Today;
     if(FormRS.SelectedReferral.IsDoctor) {//whether using ehr or not
         //we're not going to ask.  That's stupid.
         //if(MsgBox.Show(this,MsgBoxButtons.YesNo,"Is this an incoming transition of care from another provider?")){
         refattach.IsTransitionOfCare=true;
     }
     int order=0;
     for(int i=0;i<RefAttachList.Count;i++) {
         if(RefAttachList[i].ItemOrder > order) {
             order=RefAttachList[i].ItemOrder;
         }
     }
     refattach.ItemOrder=order+1;
     RefAttaches.Insert(refattach);
     FillGrid();
     for(int i=0;i<RefAttachList.Count;i++){
         if(RefAttachList[i].RefAttachNum==refattach.RefAttachNum) {
             gridMain.SetSelected(i,true);
         }
     }
 }
Beispiel #4
0
        private void butChangeReferral_Click(object sender, EventArgs e)
        {
            FormReferralSelect FormRS = new FormReferralSelect();

            FormRS.IsSelectionMode = true;
            FormRS.ShowDialog();
            if (FormRS.DialogResult != DialogResult.OK)
            {
                return;
            }
            RefAttachCur.ReferralNum = FormRS.SelectedReferral.ReferralNum;
            FillData();
        }
        private void butChangeReferralFrom_Click(object sender, EventArgs e)
        {
            FormReferralSelect FormRS = new FormReferralSelect();

            FormRS.IsSelectionMode = true;
            if (FormRS.ShowDialog() == DialogResult.OK)
            {
                Referral selectedReferral = FormRS.SelectedReferral;
                _referralNumFrom          = selectedReferral.ReferralNum;
                textReferralNameFrom.Text = selectedReferral.LName + ", " + selectedReferral.FName;
                textTitleFrom.Text        = selectedReferral.Title;
                checkIsPersonFrom.Checked = !selectedReferral.NotPerson;
                checkIsDoctorFrom.Checked = selectedReferral.IsDoctor;
                CheckUIState();
            }
        }
Beispiel #6
0
        private void butAddFrom_Click(object sender, System.EventArgs e)
        {
            if (!Security.IsAuthorized(Permissions.RefAttachAdd))
            {
                return;
            }
            FormReferralSelect FormRS = new FormReferralSelect();

            FormRS.IsSelectionMode = true;
            FormRS.ShowDialog();
            if (FormRS.DialogResult != DialogResult.OK)
            {
                return;
            }
            RefAttach refattach = new RefAttach();

            refattach.ReferralNum = FormRS.SelectedReferral.ReferralNum;
            refattach.PatNum      = PatNum;
            refattach.IsFrom      = true;
            refattach.RefDate     = DateTimeOD.Today;
            if (FormRS.SelectedReferral.IsDoctor)             //whether using ehr or not
            //we're not going to ask.  That's stupid.
            //if(MsgBox.Show(this,MsgBoxButtons.YesNo,"Is this an incoming transition of care from another provider?")){
            {
                refattach.IsTransitionOfCare = true;
            }
            int order = 0;

            for (int i = 0; i < RefAttachList.Count; i++)
            {
                if (RefAttachList[i].ItemOrder > order)
                {
                    order = RefAttachList[i].ItemOrder;
                }
            }
            refattach.ItemOrder = order + 1;
            RefAttaches.Insert(refattach);
            SecurityLogs.MakeLogEntry(Permissions.RefAttachAdd, PatNum, "Referred From " + Referrals.GetNameFL(refattach.ReferralNum));
            FillGrid();
            for (int i = 0; i < RefAttachList.Count; i++)
            {
                if (RefAttachList[i].RefAttachNum == refattach.RefAttachNum)
                {
                    gridMain.SetSelected(i, true);
                }
            }
        }
Beispiel #7
0
        private void butAddTo_Click(object sender, EventArgs e)
        {
            if (!Security.IsAuthorized(Permissions.RefAttachAdd))
            {
                return;
            }
            FormReferralSelect FormRS = new FormReferralSelect();

            FormRS.IsSelectionMode = true;
            FormRS.ShowDialog();
            if (FormRS.DialogResult != DialogResult.OK)
            {
                return;
            }
            RefAttach refattach = new RefAttach();

            refattach.ReferralNum = FormRS.SelectedReferral.ReferralNum;
            refattach.PatNum      = PatNum;
            refattach.IsFrom      = false;
            refattach.RefDate     = DateTimeOD.Today;
            if (FormRS.SelectedReferral.IsDoctor)
            {
                refattach.IsTransitionOfCare = true;
            }
            int order = 0;

            for (int i = 0; i < RefAttachList.Count; i++)
            {
                if (RefAttachList[i].ItemOrder > order)
                {
                    order = RefAttachList[i].ItemOrder;
                }
            }
            refattach.ItemOrder = order + 1;
            refattach.ProcNum   = ProcNum;
            RefAttaches.Insert(refattach);
            SecurityLogs.MakeLogEntry(Permissions.RefAttachAdd, PatNum, "Referred To " + Referrals.GetNameFL(refattach.ReferralNum));
            FillGrid();
            for (int i = 0; i < RefAttachList.Count; i++)
            {
                if (RefAttachList[i].ReferralNum == refattach.ReferralNum)
                {
                    gridMain.SetSelected(i, true);
                }
            }
        }
Beispiel #8
0
        private void butAddTo_Click(object sender, EventArgs e)
        {
            FormReferralSelect FormRS = new FormReferralSelect();

            FormRS.IsSelectionMode = true;
            FormRS.ShowDialog();
            if (FormRS.DialogResult != DialogResult.OK)
            {
                return;
            }
            RefAttach refattach = new RefAttach();

            refattach.ReferralNum = FormRS.SelectedReferral.ReferralNum;
            refattach.PatNum      = PatNum;
            refattach.IsFrom      = false;
            refattach.RefDate     = DateTime.Today;
            if (FormRS.SelectedReferral.IsDoctor)
            {
                refattach.IsTransitionOfCare = true;
            }
            int order = 0;

            for (int i = 0; i < RefAttachList.Count; i++)
            {
                if (RefAttachList[i].ItemOrder > order)
                {
                    order = RefAttachList[i].ItemOrder;
                }
            }
            refattach.ItemOrder = order + 1;
            refattach.ProcNum   = ProcNum;
            RefAttaches.Insert(refattach);
            FillGrid();
            for (int i = 0; i < RefAttachList.Count; i++)
            {
                if (RefAttachList[i].ReferralNum == refattach.ReferralNum)
                {
                    gridMain.SetSelected(i, true);
                }
            }
        }
Beispiel #9
0
 private void butAddTo_Click(object sender,EventArgs e)
 {
     FormReferralSelect FormRS=new FormReferralSelect();
     FormRS.IsSelectionMode=true;
     FormRS.ShowDialog();
     if(FormRS.DialogResult!=DialogResult.OK) {
         return;
     }
     RefAttach refattach=new RefAttach();
     refattach.ReferralNum=FormRS.SelectedReferral.ReferralNum;
     refattach.PatNum=PatNum;
     refattach.IsFrom=false;
     refattach.RefDate=DateTime.Today;
     if(FormRS.SelectedReferral.IsDoctor) {
         refattach.IsTransitionOfCare=true;
     }
     int order=0;
     for(int i=0;i<RefAttachList.Count;i++) {
         if(RefAttachList[i].ItemOrder > order) {
             order=RefAttachList[i].ItemOrder;
         }
     }
     refattach.ItemOrder=order+1;
     refattach.ProcNum=ProcNum;
     RefAttaches.Insert(refattach);
     FillGrid();
     for(int i=0;i<RefAttachList.Count;i++) {
         if(RefAttachList[i].ReferralNum==refattach.ReferralNum) {
             gridMain.SetSelected(i,true);
         }
     }
 }
		private void butAddTo_Click(object sender,EventArgs e) {
			if(!Security.IsAuthorized(Permissions.RefAttachAdd)) {
				return;
			}
			FormReferralSelect FormRS=new FormReferralSelect();
			FormRS.IsSelectionMode=true;
			FormRS.ShowDialog();
			if(FormRS.DialogResult!=DialogResult.OK) {
				return;
			}
			RefAttach refattach=new RefAttach();
			refattach.ReferralNum=FormRS.SelectedReferral.ReferralNum;
			refattach.PatNum=PatNum;
			refattach.IsFrom=false;
			refattach.RefDate=DateTimeOD.Today;
			if(FormRS.SelectedReferral.IsDoctor) {
				refattach.IsTransitionOfCare=true;
			}
			int order=0;
			for(int i=0;i<RefAttachList.Count;i++) {
				if(RefAttachList[i].ItemOrder > order) {
					order=RefAttachList[i].ItemOrder;
				}
			}
			refattach.ItemOrder=order+1;
			refattach.ProcNum=ProcNum;
			RefAttaches.Insert(refattach);
			SecurityLogs.MakeLogEntry(Permissions.RefAttachAdd,PatNum,"Referred To "+Referrals.GetNameFL(refattach.ReferralNum));
			FillGrid();
			for(int i=0;i<RefAttachList.Count;i++) {
				if(RefAttachList[i].ReferralNum==refattach.ReferralNum) {
					gridMain.SetSelected(i,true);
				}
			}
		}
		private void butReferralSelect_Click(object sender,EventArgs e) {
			FormReferralSelect FormR=new FormReferralSelect();
			FormR.IsSelectionMode=true;
			FormR.ShowDialog();
			if(FormR.DialogResult!=DialogResult.OK) {
				return;
			}
			ClaimCur.ReferringProv=FormR.SelectedReferral.ReferralNum;
			textRefProv.Text=Referrals.GetNameLF(FormR.SelectedReferral.ReferralNum);
			butReferralEdit.Enabled=true;
		}
Beispiel #12
0
        private void gridMu_CellClick(object sender, ODGridClickEventArgs e)
        {
            FormMedical FormMed;

            if (e.Col == 3)
            {
                switch (listMu[e.Row].MeasureType)
                {
                case EhrMeasureType.ProblemList:
                    FormMed = new FormMedical(PatNotCur, PatCur, "tabProblems");
                    FormMed.ShowDialog();
                    FillGridMu();
                    break;

                case EhrMeasureType.MedicationList:
                    FormMed = new FormMedical(PatNotCur, PatCur, "tabMedications");
                    FormMed.ShowDialog();
                    FillGridMu();
                    break;

                case EhrMeasureType.AllergyList:
                    FormMed = new FormMedical(PatNotCur, PatCur, "tabAllergies");
                    FormMed.ShowDialog();
                    FillGridMu();
                    break;

                case EhrMeasureType.Demographics:
                    FormPatientEdit FormPatEdit = new FormPatientEdit(PatCur, PatFamCur);
                    FormPatEdit.ShowDialog();
                    FillGridMu();
                    break;

                case EhrMeasureType.Education:
                    FormEhrEduResourcesPat FormEDUPat = new FormEhrEduResourcesPat();
                    FormEDUPat.patCur = PatCur;
                    FormEDUPat.ShowDialog();
                    FillGridMu();
                    break;

                case EhrMeasureType.TimelyAccess:
                case EhrMeasureType.ElectronicCopyAccess:
                    FormPatientPortal FormPatPort = new FormPatientPortal(PatCur);
                    FormPatPort.ShowDialog();
                    FillGridMu();
                    break;

                case EhrMeasureType.ProvOrderEntry:
                case EhrMeasureType.CPOE_MedOrdersOnly:
                case EhrMeasureType.CPOE_PreviouslyOrdered:
                    //LaunchOrdersWindow();
                    break;

                case EhrMeasureType.Rx:
                    //no action available
                    break;

                case EhrMeasureType.VitalSigns:
                case EhrMeasureType.VitalSignsBMIOnly:
                case EhrMeasureType.VitalSignsBPOnly:
                case EhrMeasureType.VitalSigns2014:
                    FormMed = new FormMedical(PatNotCur, PatCur, "tabVitalSigns");
                    FormMed.ShowDialog();
                    FillGridMu();
                    break;

                case EhrMeasureType.Smoking:
                    FormMed = new FormMedical(PatNotCur, PatCur, "tabTobaccoUse");
                    FormMed.ShowDialog();
                    FillGridMu();
                    break;

                case EhrMeasureType.Lab:
                    if (DataConnection.DBtype == DatabaseType.Oracle)
                    {
                        MsgBox.Show(this, "Labs not supported with Oracle");
                        break;
                    }
                    FormEhrLabOrders FormLP = new FormEhrLabOrders();
                    FormLP.PatCur = PatCur;
                    FormLP.ShowDialog();
                    FillGridMu();
                    break;

                case EhrMeasureType.ElectronicCopy:
                    if (listMu[e.Row].Action == "Provide elect copy to Pt")
                    {
                        FormEhrElectronicCopy FormE = new FormEhrElectronicCopy();
                        FormE.PatCur = PatCur;
                        FormE.ShowDialog();
                        FillGridMu();
                    }
                    break;

                case EhrMeasureType.ClinicalSummaries:
                    FormEhrClinicalSummary FormCS = new FormEhrClinicalSummary();
                    FormCS.PatCur = PatCur;
                    FormCS.ShowDialog();
                    FillGridMu();
                    break;

                case EhrMeasureType.Reminders:
                    FormEhrReminders FormRem = new FormEhrReminders();
                    FormRem.PatCur = PatCur;
                    FormRem.ShowDialog();
                    FillGridMu();
                    break;

                case EhrMeasureType.MedReconcile:
                    int compare = EhrMeasures.CompareReferralsToReconciles(PatNum);
                    if (compare == 1 || compare == 0)                         //Referral count is less than reconcile count or both are zero.
                    {
                        FormReferralSelect FormRS = new FormReferralSelect();
                        FormRS.IsDoctorSelectionMode = true;
                        FormRS.IsSelectionMode       = true;
                        FormRS.ShowDialog();
                        if (FormRS.DialogResult != DialogResult.OK)
                        {
                            return;
                        }
                        List <RefAttach> RefAttachList = RefAttaches.RefreshFiltered(PatNum, false, 0);
                        RefAttach        refattach     = new RefAttach();
                        refattach.ReferralNum = FormRS.SelectedReferral.ReferralNum;
                        refattach.PatNum      = PatNum;
                        refattach.RefType     = ReferralType.RefFrom;
                        refattach.RefDate     = DateTimeOD.Today;
                        if (FormRS.SelectedReferral.IsDoctor)                                 //whether using ehr or not
                        {
                            refattach.IsTransitionOfCare = true;
                        }
                        int order = 0;
                        for (int i = 0; i < RefAttachList.Count; i++)
                        {
                            if (RefAttachList[i].ItemOrder > order)
                            {
                                order = RefAttachList[i].ItemOrder;
                            }
                        }
                        refattach.ItemOrder = order + 1;
                        RefAttaches.Insert(refattach);
                        SecurityLogs.MakeLogEntry(Permissions.RefAttachAdd, PatNum, "Referred From " + Referrals.GetNameFL(refattach.ReferralNum));
                    }
                    else if (compare == -1)                           //The referral count is greater than the reconcile count.
                    //So we do not need to show the referral window, we just need to reconcile below.
                    {
                    }
                    FormEhrSummaryOfCare FormMedRec = new FormEhrSummaryOfCare();
                    FormMedRec.PatCur = PatCur;
                    FormMedRec.ShowDialog();
                    FillGridMu();
                    break;

                case EhrMeasureType.SummaryOfCare:
                    FormEhrSummaryOfCare FormSoC = new FormEhrSummaryOfCare();
                    FormSoC.PatCur = PatCur;
                    FormSoC.ShowDialog();
                    FillGridMu();
                    break;

                case EhrMeasureType.SummaryOfCareElectronic:
                    FormEhrSummaryOfCare FormSoCE = new FormEhrSummaryOfCare();
                    FormSoCE.PatCur = PatCur;
                    FormSoCE.ShowDialog();
                    FillGridMu();
                    break;

                case EhrMeasureType.SecureMessaging:
                    if (PrefC.GetInt(PrefName.MeaningfulUseTwo) == 2)                           /*Modified Stage 2*/
                    {
                        FormWebMailMessageEdit FormWMME = new FormWebMailMessageEdit(PatCur.PatNum);
                        FormWMME.ShowDialog();
                        FillGridMu();
                    }
                    break;

                case EhrMeasureType.FamilyHistory:
                    FormMed = new FormMedical(PatNotCur, PatCur, "tabFamHealthHist");
                    FormMed.ShowDialog();
                    FillGridMu();
                    break;

                case EhrMeasureType.ElectronicNote:
                    //Sign a Note
                    break;

                case EhrMeasureType.CPOE_RadiologyOrdersOnly:
                case EhrMeasureType.CPOE_LabOrdersOnly:
                    if (DataConnection.DBtype == DatabaseType.Oracle)
                    {
                        MsgBox.Show(this, "Labs not supported with Oracle");
                        break;
                    }
                    FormEhrLabOrders FormLab = new FormEhrLabOrders();
                    FormLab.PatCur = PatCur;
                    FormLab.ShowDialog();
                    FillGridMu();
                    break;

                case EhrMeasureType.LabImages:
                    if (DataConnection.DBtype == DatabaseType.Oracle)
                    {
                        MsgBox.Show(this, "Labs not supported with Oracle");
                        break;
                    }
                    FormEhrLabOrders FormLO = new FormEhrLabOrders();
                    FormLO.PatCur = PatCur;
                    FormLO.ShowDialog();
                    FillGridMu();
                    break;

                case EhrMeasureType.DrugDrugInteractChecking:
                    EhrMeasureEvent measureEventDDIC = new EhrMeasureEvent();
                    measureEventDDIC.DateTEvent = DateTime.Now;
                    measureEventDDIC.EventType  = EhrMeasureEventType.DrugDrugInteractChecking;
                    measureEventDDIC.MoreInfo   = EhrMeasureEvents.GetLatestInfoByType(EhrMeasureEventType.DrugDrugInteractChecking);
                    measureEventDDIC.IsNew      = true;
                    FormEhrMeasureEventEdit FormDDIC = new FormEhrMeasureEventEdit(measureEventDDIC);
                    FormDDIC.MeasureDescript = "Explain how you have enabled Drug-Drug Interaction Checking";
                    FormDDIC.ShowDialog();
                    if (FormDDIC.DialogResult == DialogResult.OK)
                    {
                        FillGridMu();
                    }
                    break;

                case EhrMeasureType.DrugFormularyChecking:
                    EhrMeasureEvent measureEventDFC = new EhrMeasureEvent();
                    measureEventDFC.DateTEvent = DateTime.Now;
                    measureEventDFC.EventType  = EhrMeasureEventType.DrugFormularyChecking;
                    measureEventDFC.MoreInfo   = EhrMeasureEvents.GetLatestInfoByType(EhrMeasureEventType.DrugFormularyChecking);
                    measureEventDFC.IsNew      = true;
                    FormEhrMeasureEventEdit FormDFC = new FormEhrMeasureEventEdit(measureEventDFC);
                    FormDFC.MeasureDescript = "Explain how you have enabled Drug Formulary Checks";
                    FormDFC.ShowDialog();
                    if (FormDFC.DialogResult == DialogResult.OK)
                    {
                        FillGridMu();
                    }
                    break;

                case EhrMeasureType.ProtectElectHealthInfo:
                    EhrMeasureEvent measureEventPEHI = new EhrMeasureEvent();
                    measureEventPEHI.DateTEvent = DateTime.Now;
                    measureEventPEHI.EventType  = EhrMeasureEventType.ProtectElectHealthInfo;
                    measureEventPEHI.MoreInfo   = EhrMeasureEvents.GetLatestInfoByType(EhrMeasureEventType.ProtectElectHealthInfo);
                    measureEventPEHI.IsNew      = true;
                    FormEhrMeasureEventEdit FormPEHI = new FormEhrMeasureEventEdit(measureEventPEHI);
                    FormPEHI.MeasureDescript = "Have you performed your security risk analysis?  Explain.";
                    FormPEHI.ShowDialog();
                    if (FormPEHI.DialogResult == DialogResult.OK)
                    {
                        FillGridMu();
                    }
                    break;

                case EhrMeasureType.ImmunizationRegistries:
                    EhrMeasureEvent measureEventIR = new EhrMeasureEvent();
                    measureEventIR.DateTEvent = DateTime.Now;
                    measureEventIR.EventType  = EhrMeasureEventType.ImmunizationRegistries;
                    measureEventIR.MoreInfo   = EhrMeasureEvents.GetLatestInfoByType(EhrMeasureEventType.ImmunizationRegistries);
                    measureEventIR.IsNew      = true;
                    FormEhrMeasureEventEdit FormIR = new FormEhrMeasureEventEdit(measureEventIR);
                    FormIR.MeasureDescript = "Check with your state agency for guidance and recommendations.  Usually excluded.  Explain.";
                    FormIR.ShowDialog();
                    if (FormIR.DialogResult == DialogResult.OK)
                    {
                        FillGridMu();
                    }
                    break;

                case EhrMeasureType.SyndromicSurveillance:
                    EhrMeasureEvent measureEventSS = new EhrMeasureEvent();
                    measureEventSS.DateTEvent = DateTime.Now;
                    measureEventSS.EventType  = EhrMeasureEventType.SyndromicSurveillance;
                    measureEventSS.MoreInfo   = EhrMeasureEvents.GetLatestInfoByType(EhrMeasureEventType.SyndromicSurveillance);
                    measureEventSS.IsNew      = true;
                    FormEhrMeasureEventEdit FormSS = new FormEhrMeasureEventEdit(measureEventSS);
                    FormSS.MeasureDescript = "Check with your state agency for guidance and recommendations.  Usually excluded.  Explain.";
                    FormSS.ShowDialog();
                    if (FormSS.DialogResult == DialogResult.OK)
                    {
                        FillGridMu();
                    }
                    break;

                case EhrMeasureType.PatientList:
                    FormPatListEHR2014 FormPL = new FormPatListEHR2014();
                    FormPL.ShowDialog();
                    FillGridMu();
                    break;

                case EhrMeasureType.ClinicalInterventionRules:
                    FormCdsTriggers FormET = new FormCdsTriggers();
                    FormET.ShowDialog();
                    FillGridMu();
                    break;
                }
            }
            if (e.Col == 4)
            {
                switch (listMu[e.Row].MeasureType)
                {
                case EhrMeasureType.MedReconcile:
                    int compare = EhrMeasures.CompareReferralsToReconciles(PatNum);
                    if (compare == 1 || compare == 0)
                    {
                        FormReferralSelect FormRS = new FormReferralSelect();
                        FormRS.IsDoctorSelectionMode = true;
                        FormRS.IsSelectionMode       = true;
                        FormRS.ShowDialog();
                        if (FormRS.DialogResult == DialogResult.OK)
                        {
                            List <RefAttach> RefAttachList = RefAttaches.RefreshFiltered(PatNum, false, 0);
                            RefAttach        refattach     = new RefAttach();
                            refattach.ReferralNum = FormRS.SelectedReferral.ReferralNum;
                            refattach.PatNum      = PatNum;
                            refattach.RefType     = ReferralType.RefFrom;
                            refattach.RefDate     = DateTimeOD.Today;
                            if (FormRS.SelectedReferral.IsDoctor)                                     //whether using ehr or not
                            //we're not going to ask.  That's stupid.
                            //if(MsgBox.Show(this,MsgBoxButtons.YesNo,"Is this an incoming transition of care from another provider?")){
                            {
                                refattach.IsTransitionOfCare = true;
                            }
                            int order = 0;
                            for (int i = 0; i < RefAttachList.Count; i++)
                            {
                                if (RefAttachList[i].ItemOrder > order)
                                {
                                    order = RefAttachList[i].ItemOrder;
                                }
                            }
                            refattach.ItemOrder = order + 1;
                            RefAttaches.Insert(refattach);
                            SecurityLogs.MakeLogEntry(Permissions.RefAttachAdd, PatNum, "Referred From " + Referrals.GetNameFL(refattach.ReferralNum));
                            FormMedicationReconcile FormMedRec = new FormMedicationReconcile();
                            FormMedRec.PatCur = PatCur;
                            FormMedRec.ShowDialog();
                        }
                    }
                    else if (compare == -1)
                    {
                        FormMedicationReconcile FormMedRec = new FormMedicationReconcile();
                        FormMedRec.PatCur = PatCur;
                        FormMedRec.ShowDialog();
                    }
                    FillGridMu();
                    //ResultOnClosing=EhrFormResult.Referrals;
                    //Close();
                    break;

                case EhrMeasureType.SummaryOfCare:
                case EhrMeasureType.SummaryOfCareElectronic:
                    FormReferralsPatient FormRefSum = new FormReferralsPatient();
                    FormRefSum.PatNum = PatCur.PatNum;
                    FormRefSum.ShowDialog();
                    FillGridMu();
                    //ResultOnClosing=EhrFormResult.Referrals;
                    //Close();
                    break;

                case EhrMeasureType.Lab:
                    //Redundant now that everything is done from one window
                    break;

                case EhrMeasureType.CPOE_RadiologyOrdersOnly:
                    if (DataConnection.DBtype == DatabaseType.Oracle)
                    {
                        MsgBox.Show(this, "Labs not supported with Oracle");
                        break;
                    }
                    //As of v15.4 we started storing radiology orders at the procedure level by flagging the procedure itself as IsCpoe.
                    //Show the radiology order window which will be the best way for the provider to mark "radiology orders" as CPOE.
                    FormRadOrderList FormROL = new FormRadOrderList(Security.CurUser);
                    FormROL.ShowDialog();                            //Do not use a non-modal window in this case due to needing to refresh the grid after closing.
                    //FormEhrLabOrders FormRad=new FormEhrLabOrders();
                    //FormRad.PatCur=PatCur;
                    //FormRad.ShowDialog();
                    FillGridMu();
                    break;
                }
            }
        }
Beispiel #13
0
 private void gridMain_CellDoubleClick(object sender,ODGridClickEventArgs e)
 {
     if(e.Col!=3) {
         return;
     }
     if(rows[e.Row].IsSeparator) {
         return;
     }
     if(!IsEditable(rows[e.Row])){
         return;
     }
     if(rows[e.Row].FieldName=="referredFrom") {
         FormReferralSelect formRS=new FormReferralSelect();
         formRS.IsSelectionMode=true;
         formRS.ShowDialog();
         if(formRS.DialogResult!=DialogResult.OK) {
             return;
         }
         Referral referralSelected=formRS.SelectedReferral;
         rows[e.Row].DoImport=true;
         rows[e.Row].IsFlaggedImp=false;
         rows[e.Row].ImpValDisplay=referralSelected.GetNameFL();
         rows[e.Row].ImpValObj=referralSelected;
     }
     else if(rows[e.Row].ObjType==typeof(string)) {
         InputBox inputbox=new InputBox(rows[e.Row].FieldName);
         inputbox.textResult.Text=rows[e.Row].ImpValDisplay;
         inputbox.ShowDialog();
         if(inputbox.DialogResult!=DialogResult.OK) {
             return;
         }
         if(rows[e.Row].FieldName=="addressAndHmPhoneIsSameEntireFamily") {
             if(inputbox.textResult.Text==""){
                 AddressSameForFam=false;
             }
             else if(inputbox.textResult.Text!="X") {
                 AddressSameForFam=true;
             }
             else{
                 MsgBox.Show(this,"The only allowed values are X or blank.");
                 return;
             }
         }
         if(rows[e.Row].OldValDisplay==inputbox.textResult.Text) {//value is now same as original
             rows[e.Row].DoImport=false;
         }
         else {
             rows[e.Row].DoImport=true;
         }
         rows[e.Row].ImpValDisplay=inputbox.textResult.Text;
         rows[e.Row].ImpValObj=inputbox.textResult.Text;
     }
     /*else if(rows[e.Row].ObjType.IsGenericType){//==typeof(Nullable)) {
         Type underlyingT=Nullable.GetUnderlyingType(rows[e.Row].ObjType);
         FormSheetImportEnumPicker formEnum=new FormSheetImportEnumPicker(rows[e.Row].FieldName);
         formEnum.ShowClearButton=true;
         for(int i=0;i<Enum.GetNames(underlyingT).Length;i++) {
             formEnum.comboResult.Items.Add(Enum.GetNames(underlyingT)[i]);
             if(rows[e.Row].ImpValObj!=null && i==(int)rows[e.Row].ImpValObj) {
                 formEnum.comboResult.SelectedIndex=i;
             }
         }
         formEnum.ShowDialog();
         if(formEnum.DialogResult==DialogResult.OK) {
             int selectedI=formEnum.comboResult.SelectedIndex;
             if(rows[e.Row].ImpValObj==null) {//was initially null
                 if(selectedI!=-1) {//an item was selected
                     rows[e.Row].ImpValObj=Enum.ToObject(underlyingT,selectedI);
                     rows[e.Row].ImpValDisplay=rows[e.Row].ImpValObj.ToString();
                 }
             }
             else {//was not initially null
                 if((int)rows[e.Row].ImpValObj!=selectedI) {//value was changed.
                     if(selectedI==-1){
                         rows[e.Row].ImpValObj=null;
                         rows[e.Row].ImpValDisplay="";
                     }
                     else{
                         rows[e.Row].ImpValObj=Enum.ToObject(underlyingT,selectedI);
                         rows[e.Row].ImpValDisplay=rows[e.Row].ImpValObj.ToString();
                     }
                 }
             }
             if(patPlanList.Count>0) {
                 rows[e.Row].DoImport=false;//can't change an existing plan from here.
             }
             else if(selectedI==-1) {
                 if(rows[e.Row].OldValObj==null){
                     rows[e.Row].DoImport=false;//no change
                 }
                 else{
                     rows[e.Row].DoImport=true;
                 }
             }
             else if((int)rows[e.Row].ImpValObj==(int)rows[e.Row].OldValObj) {//it's the old setting for the patient, whether or not they actually changed it.
                 rows[e.Row].DoImport=false;//so no need to import
             }
             else {
                 rows[e.Row].DoImport=true;
             }
         }
     }*/
     else if(rows[e.Row].ObjType.IsEnum) {
         //Note.  This only works for zero-indexed enums.
         FormSheetImportEnumPicker formEnum=new FormSheetImportEnumPicker(rows[e.Row].FieldName);
         for(int i=0;i<Enum.GetNames(rows[e.Row].ObjType).Length;i++) {
             formEnum.comboResult.Items.Add(Enum.GetNames(rows[e.Row].ObjType)[i]);
             if(rows[e.Row].ImpValObj!=null && i==(int)rows[e.Row].ImpValObj) {
                 formEnum.comboResult.SelectedIndex=i;
             }
         }
         formEnum.ShowDialog();
         if(formEnum.DialogResult==DialogResult.OK) {
             int selectedI=formEnum.comboResult.SelectedIndex;
             if(rows[e.Row].ImpValObj==null) {//was initially null
                 if(selectedI!=-1) {//an item was selected
                     rows[e.Row].ImpValObj=Enum.ToObject(rows[e.Row].ObjType,selectedI);
                     rows[e.Row].ImpValDisplay=rows[e.Row].ImpValObj.ToString();
                 }
             }
             else {//was not initially null
                 if((int)rows[e.Row].ImpValObj!=selectedI) {//value was changed.
                     //There's no way for the user to set it to null, so we do not need to test that
                     rows[e.Row].ImpValObj=Enum.ToObject(rows[e.Row].ObjType,selectedI);
                     rows[e.Row].ImpValDisplay=rows[e.Row].ImpValObj.ToString();
                 }
             }
             if(selectedI==-1) {
                 rows[e.Row].DoImport=false;//impossible to import a null
             }
             else if((int)rows[e.Row].ImpValObj==(int)rows[e.Row].OldValObj) {//it's the old setting for the patient, whether or not they actually changed it.
                 rows[e.Row].DoImport=false;//so no need to import
             }
             else {
                 rows[e.Row].DoImport=true;
             }
         }
     }
     else if(rows[e.Row].ObjType==typeof(DateTime)) {//this is only for one field so far: Birthdate
         InputBox inputbox=new InputBox(rows[e.Row].FieldName);
         inputbox.textResult.Text=rows[e.Row].ImpValDisplay;
         inputbox.ShowDialog();
         if(inputbox.DialogResult!=DialogResult.OK) {
             return;
         }
         DateTime enteredDate;
         if(inputbox.textResult.Text=="") {
             enteredDate=DateTime.MinValue;
             rows[e.Row].ImpValObj=enteredDate;
             rows[e.Row].ImpValDisplay="";
         }
         else {
             try {
                 enteredDate=DateTime.Parse(inputbox.textResult.Text);
             }
             catch {
                 MsgBox.Show(this,"Invalid date");
                 return;
             }
             if(enteredDate.Year<1880 || enteredDate.Year>2050) {
                 MsgBox.Show(this,"Invalid date");
                 return;
             }
             rows[e.Row].ImpValObj=enteredDate;
             rows[e.Row].ImpValDisplay=enteredDate.ToShortDateString();
         }
         if(rows[e.Row].ImpValDisplay==rows[e.Row].OldValDisplay) {//value is now same as original
             rows[e.Row].DoImport=false;
         }
         else {
             rows[e.Row].DoImport=true;
         }
     }
     FillGrid();
 }
Beispiel #14
0
 private void butChangeReferral_Click(object sender,EventArgs e)
 {
     FormReferralSelect FormRS=new FormReferralSelect();
     FormRS.IsSelectionMode=true;
     FormRS.ShowDialog();
     if(FormRS.DialogResult!=DialogResult.OK) {
         return;
     }
     RefAttachCur.ReferralNum=FormRS.SelectedReferral.ReferralNum;
     FillData();
 }
		private void gridMain_CellDoubleClick(object sender,ODGridClickEventArgs e) {
			if(e.Col!=3) {
				return;
			}
			if(Rows[e.Row].IsSeparator) {
				return;
			}
			if(!IsEditable(Rows[e.Row])){
				return;
			}
			if(Rows[e.Row].FieldName=="referredFrom") {
				FormReferralSelect formRS=new FormReferralSelect();
				formRS.IsSelectionMode=true;
				formRS.ShowDialog();
				if(formRS.DialogResult!=DialogResult.OK) {
					return;
				}
				Referral referralSelected=formRS.SelectedReferral;
				Rows[e.Row].DoImport=true;
				Rows[e.Row].IsFlaggedImp=false;
				Rows[e.Row].ImpValDisplay=referralSelected.GetNameFL();
				Rows[e.Row].ImpValObj=referralSelected;
			}
			#region string
			else if(Rows[e.Row].ObjType==typeof(string)) {
				InputBox inputbox=new InputBox(Rows[e.Row].FieldName);
				inputbox.textResult.Text=Rows[e.Row].ImpValDisplay;
				inputbox.ShowDialog();
				if(inputbox.DialogResult!=DialogResult.OK) {
					return;
				}
				if(Rows[e.Row].FieldName=="addressAndHmPhoneIsSameEntireFamily") {
					if(inputbox.textResult.Text=="") {
						AddressSameForFam=false;
					}
					else if(inputbox.textResult.Text!="X") {
						AddressSameForFam=true;
					}
					else {
						MsgBox.Show(this,"The only allowed values are X or blank.");
						return;
					}
				}
				if(Rows[e.Row].OldValDisplay==inputbox.textResult.Text) {//value is now same as original
					Rows[e.Row].DoImport=false;
				}
				else {
					Rows[e.Row].DoImport=true;
				}
				Rows[e.Row].ImpValDisplay=inputbox.textResult.Text;
				Rows[e.Row].ImpValObj=inputbox.textResult.Text;
			}
			#endregion
			#region Enum
			else if(Rows[e.Row].ObjType.IsEnum) {
				//Note.  This only works for zero-indexed enums.
				FormSheetImportEnumPicker formEnum=new FormSheetImportEnumPicker(Rows[e.Row].FieldName);
				for(int i=0;i<Enum.GetNames(Rows[e.Row].ObjType).Length;i++) {
					formEnum.listResult.Items.Add(Enum.GetNames(Rows[e.Row].ObjType)[i]);
					if(Rows[e.Row].ImpValObj!=null && i==(int)Rows[e.Row].ImpValObj) {
						formEnum.listResult.SelectedIndex=i;
					}
				}
				formEnum.ShowDialog();
				if(formEnum.DialogResult==DialogResult.OK) {
					int selectedI=formEnum.listResult.SelectedIndex;
					if(Rows[e.Row].ImpValObj==null) {//was initially null
						if(selectedI!=-1) {//an item was selected
							Rows[e.Row].ImpValObj=Enum.ToObject(Rows[e.Row].ObjType,selectedI);
							Rows[e.Row].ImpValDisplay=Rows[e.Row].ImpValObj.ToString();
						}
					}
					else {//was not initially null
						if((int)Rows[e.Row].ImpValObj!=selectedI) {//value was changed.
							//There's no way for the user to set it to null, so we do not need to test that
							Rows[e.Row].ImpValObj=Enum.ToObject(Rows[e.Row].ObjType,selectedI);
							Rows[e.Row].ImpValDisplay=Rows[e.Row].ImpValObj.ToString();
						}
					}
					if(selectedI==-1) {
						Rows[e.Row].DoImport=false;//impossible to import a null
					}
					else if(Rows[e.Row].OldValObj!=null && (int)Rows[e.Row].ImpValObj==(int)Rows[e.Row].OldValObj) {//it's the old setting for the patient, whether or not they actually changed it.
						Rows[e.Row].DoImport=false;//so no need to import
					}
					else {
						Rows[e.Row].DoImport=true;
					}
				}
			}
			#endregion
			#region DateTime
			else if(Rows[e.Row].ObjType==typeof(DateTime)) {//this is only for one field so far: Birthdate
				InputBox inputbox=new InputBox(Rows[e.Row].FieldName);
				inputbox.textResult.Text=Rows[e.Row].ImpValDisplay;
				inputbox.ShowDialog();
				if(inputbox.DialogResult!=DialogResult.OK) {
					return;
				}
				DateTime enteredDate;
				if(inputbox.textResult.Text=="") {
					enteredDate=DateTime.MinValue;
					Rows[e.Row].ImpValObj=enteredDate;
					Rows[e.Row].ImpValDisplay="";
				}
				else {
					try {
						enteredDate=DateTime.Parse(inputbox.textResult.Text);
					}
					catch {
						MsgBox.Show(this,"Invalid date");
						return;
					}
					if(enteredDate.Year<1880 || enteredDate.Year>2050) {
						MsgBox.Show(this,"Invalid date");
						return;
					}
					Rows[e.Row].ImpValObj=enteredDate;
					Rows[e.Row].ImpValDisplay=enteredDate.ToShortDateString();
				}
				if(Rows[e.Row].ImpValDisplay==Rows[e.Row].OldValDisplay) {//value is now same as original
					Rows[e.Row].DoImport=false;
				}
				else {
					Rows[e.Row].DoImport=true;
				}
			}
			#endregion
			#region Medication, Allergy or Disease
			else if(Rows[e.Row].ObjType==typeof(MedicationPat)
				|| Rows[e.Row].ObjType==typeof(Allergy)
				|| Rows[e.Row].ObjType==typeof(Disease)) 
			{
				//User entered medications will have a MedicationNum as the ImpValObj.
				if(Rows[e.Row].ImpValObj.GetType()==typeof(long)) {
					FormMedications FormM=new FormMedications();
					FormM.IsSelectionMode=true;
					FormM.textSearch.Text=Rows[e.Row].FieldName;
					FormM.ShowDialog();
					if(FormM.DialogResult!=DialogResult.OK) {
						return;
					}
					Rows[e.Row].ImpValDisplay="Y";
					Rows[e.Row].ImpValObj=FormM.SelectedMedicationNum;
					string descript=Medications.GetDescription(FormM.SelectedMedicationNum);
					Rows[e.Row].FieldDisplay=descript;
					((SheetField)Rows[e.Row].NewValObj).FieldValue=descript;
					Rows[e.Row].NewValDisplay="Y";
					Rows[e.Row].DoImport=true;
					Rows[e.Row].IsFlaggedImp=false;
				}
				else {
					FormSheetImportEnumPicker FormIEP=new FormSheetImportEnumPicker(Rows[e.Row].FieldName);
					for(int i=0;i<Enum.GetNames(typeof(YN)).Length;i++) {
						FormIEP.listResult.Items.Add(Enum.GetNames(typeof(YN))[i]);
					}
					FormIEP.listResult.SelectedIndex=0;//Unknown
					if(Rows[e.Row].ImpValDisplay=="Y") {
						FormIEP.listResult.SelectedIndex=1;
					}
					if(Rows[e.Row].ImpValDisplay=="N") {
						FormIEP.listResult.SelectedIndex=2;
					}
					FormIEP.ShowDialog();
					if(FormIEP.DialogResult!=DialogResult.OK) {
						return;
					}
					int selectedI=FormIEP.listResult.SelectedIndex;
					switch(selectedI) {
						case 0:
							Rows[e.Row].ImpValDisplay="";
							break;
						case 1:
							Rows[e.Row].ImpValDisplay="Y";
							break;
						case 2:
							Rows[e.Row].ImpValDisplay="N";
							break;
					}
					if(Rows[e.Row].OldValDisplay==Rows[e.Row].ImpValDisplay) {//value is now same as original
						Rows[e.Row].DoImport=false;
					}
					else {
						Rows[e.Row].DoImport=true;
					}
					if(selectedI==-1 || selectedI==0) {
						Rows[e.Row].DoImport=false;
					}
				}
			}
			#endregion
			#region Subscriber
			else if(Rows[e.Row].ObjType==typeof(Patient)) {
				Patient subscriber=new Patient();
				FormSubscriberSelect FormSS=new FormSubscriberSelect(Fam);
				FormSS.ShowDialog();
				if(FormSS.DialogResult!=DialogResult.OK) {
					return;
				}
				subscriber=Patients.GetPat(FormSS.SelectedPatNum);
				if(subscriber==null) {
					return;//Should never happen but is a possibility.
				}
				//Use GetNameFirst() because this is how OldValDisplay is displayed.
				string patName=Patients.GetNameFirst(subscriber.FName,subscriber.Preferred);
				if(Rows[e.Row].OldValDisplay==patName) {
					Rows[e.Row].DoImport=false;
				}
				else {
					Rows[e.Row].DoImport=true;
				}
				Rows[e.Row].ImpValDisplay=patName;
				Rows[e.Row].ImpValObj=subscriber;
			}
			#endregion
			#region Carrier
			else if(Rows[e.Row].ObjType==typeof(Carrier)) {
				//Change both carrier rows at the same time.
				string insStr="ins1";
				if(Rows[e.Row].FieldName.StartsWith("ins2")) {
					insStr="ins2";
				}
				SheetImportRow carrierNameRow=GetImportRowByFieldName(insStr+"CarrierName");
				SheetImportRow carrierPhoneRow=GetImportRowByFieldName(insStr+"CarrierPhone");
				Carrier carrier=new Carrier();
				FormCarriers FormC=new FormCarriers();
				FormC.IsSelectMode=true;
				if(carrierNameRow!=null) {
					FormC.textCarrier.Text=carrierNameRow.NewValDisplay;
				}
				if(carrierPhoneRow!=null) {
					FormC.textPhone.Text=carrierPhoneRow.NewValDisplay;
				}
				FormC.ShowDialog();
				if(FormC.DialogResult!=DialogResult.OK) {
					return;
				}
				carrier=FormC.SelectedCarrier;
				//Check for nulls because the name AND phone rows might not both be on the sheet.
				if(carrierNameRow!=null) {
					if(carrierNameRow.OldValDisplay==carrier.CarrierName) {
						carrierNameRow.DoImport=false;
					}
					else {
						carrierNameRow.DoImport=true;
					}
					carrierNameRow.ImpValDisplay=carrier.CarrierName;
					carrierNameRow.ImpValObj=carrier;
				}
				if(carrierPhoneRow!=null) {
					if(carrierPhoneRow.OldValDisplay==carrier.Phone) {
						carrierPhoneRow.DoImport=false;
					}
					else {
						carrierPhoneRow.DoImport=true;
					}
					carrierPhoneRow.ImpValDisplay=carrier.Phone;
					carrierPhoneRow.ImpValObj=carrier;
				}
			}
			#endregion
			FillGrid();
		}
Beispiel #16
0
		private void gridMu_CellClick(object sender,ODGridClickEventArgs e) {
			FormMedical FormMed;
			if(e.Col==3) {
				switch(listMu[e.Row].MeasureType) {
					case EhrMeasureType.ProblemList:
						FormMed=new FormMedical(PatNotCur,PatCur);
						FormMed.ShowDialog();
						FillGridMu();
						//ResultOnClosing=EhrFormResult.Medical;
						//Close();
						break;
					case EhrMeasureType.MedicationList:
						FormMed=new FormMedical(PatNotCur,PatCur);
						FormMed.ShowDialog();
						FillGridMu();
						//ResultOnClosing=EhrFormResult.Medical;
						//Close();
						break;
					case EhrMeasureType.AllergyList:
						FormMed=new FormMedical(PatNotCur,PatCur);
						FormMed.ShowDialog();
						FillGridMu();
						//ResultOnClosing=EhrFormResult.Medical;
						//Close();
						break;
					case EhrMeasureType.Demographics:
						FormPatientEdit FormPatEdit=new FormPatientEdit(PatCur, PatFamCur);
						FormPatEdit.ShowDialog();
						FillGridMu();
						//ResultOnClosing=EhrFormResult.PatientEdit;
						//Close();
						break;
					case EhrMeasureType.Education:
						FormEhrEduResourcesPat FormEDUPat = new FormEhrEduResourcesPat();
						FormEDUPat.patCur=PatCur;
						FormEDUPat.ShowDialog();
						FillGridMu();
						break;
					case EhrMeasureType.TimelyAccess:
					case EhrMeasureType.ElectronicCopyAccess:
						FormPatientPortal FormPatPort=new FormPatientPortal();
						FormPatPort.PatCur=PatCur;
						FormPatPort.ShowDialog();
						FillGridMu();
						//ResultOnClosing=EhrFormResult.Online;
						//Close();
						break;
					case EhrMeasureType.ProvOrderEntry:
					case EhrMeasureType.CPOE_MedOrdersOnly:
					case EhrMeasureType.CPOE_PreviouslyOrdered:
						//LaunchOrdersWindow();
						break;
					case EhrMeasureType.Rx:
						//no action available
						break;
					case EhrMeasureType.VitalSigns:
					case EhrMeasureType.VitalSignsBMIOnly:
					case EhrMeasureType.VitalSignsBPOnly:
					case EhrMeasureType.VitalSigns2014:
						FormVitalsigns FormVital=new FormVitalsigns();
						FormVital.PatNum=PatNum;
						FormVital.ShowDialog();
						FillGridMu();
						break;
					case EhrMeasureType.Smoking:
						FormEhrPatientSmoking FormPS=new FormEhrPatientSmoking();
						FormPS.PatCur=PatCur;
						FormPS.ShowDialog();
						PatCur=Patients.GetPat(PatNum);
						FillGridMu();
						break;
					case EhrMeasureType.Lab:
						if(DataConnection.DBtype==DatabaseType.Oracle) {
							MsgBox.Show(this,"Labs not supported with Oracle");
							break;
						}
						FormEhrLabOrders FormLP=new FormEhrLabOrders();
						FormLP.PatCur=PatCur;
						FormLP.ShowDialog();
						FillGridMu();
						break;
					case EhrMeasureType.ElectronicCopy:
						if(listMu[e.Row].Action=="Provide elect copy to Pt") {
							FormEhrElectronicCopy FormE=new FormEhrElectronicCopy();
							FormE.PatCur=PatCur;
							FormE.ShowDialog();
							FillGridMu();
						}
						break;
					case EhrMeasureType.ClinicalSummaries:
						FormEhrClinicalSummary FormCS=new FormEhrClinicalSummary();
						FormCS.PatCur=PatCur;
						FormCS.ShowDialog();
						FillGridMu();
						break;
					case EhrMeasureType.Reminders:
						FormEhrReminders FormRem = new FormEhrReminders();
						FormRem.PatCur=PatCur;
						FormRem.ShowDialog();
						FillGridMu();
						break;
					case EhrMeasureType.MedReconcile:
						int compare=EhrMeasures.CompareReferralsToReconciles(PatNum);
						if(compare==1 || compare==0) {//Referral count is less than reconcile count or both are zero.
							FormReferralSelect FormRS=new FormReferralSelect();
							FormRS.IsDoctorSelectionMode=true;
							FormRS.IsSelectionMode=true;
							FormRS.ShowDialog();
							if(FormRS.DialogResult!=DialogResult.OK) {
								return;
							}
							List<RefAttach> RefAttachList=RefAttaches.RefreshFiltered(PatNum,false,0);
							RefAttach refattach=new RefAttach();
							refattach.ReferralNum=FormRS.SelectedReferral.ReferralNum;
							refattach.PatNum=PatNum;
							refattach.IsFrom=true;
							refattach.RefDate=DateTimeOD.Today;
							if(FormRS.SelectedReferral.IsDoctor) {//whether using ehr or not
								refattach.IsTransitionOfCare=true;
							}
							int order=0;
							for(int i=0;i<RefAttachList.Count;i++) {
								if(RefAttachList[i].ItemOrder > order) {
									order=RefAttachList[i].ItemOrder;
								}
							}
							refattach.ItemOrder=order+1;
							RefAttaches.Insert(refattach);
							SecurityLogs.MakeLogEntry(Permissions.RefAttachAdd,PatNum,"Referred From "+Referrals.GetNameFL(refattach.ReferralNum));
						}
						else if(compare==-1) {//The referral count is greater than the reconcile count.
							//So we do not need to show the referral window, we just need to reconcile below.
						}
						FormEhrSummaryOfCare FormMedRec=new FormEhrSummaryOfCare();
						FormMedRec.PatCur=PatCur;
						FormMedRec.ShowDialog();
						FillGridMu();
						//ResultOnClosing=EhrFormResult.MedReconcile;
						//Close();
						break;
					case EhrMeasureType.SummaryOfCare:
						FormEhrSummaryOfCare FormSoC=new FormEhrSummaryOfCare();
						FormSoC.PatCur=PatCur;
						FormSoC.ShowDialog();
						FillGridMu();
						break;
					case EhrMeasureType.SummaryOfCareElectronic:
						FormEhrSummaryOfCare FormSoCE=new FormEhrSummaryOfCare();
						FormSoCE.PatCur=PatCur;
						FormSoCE.ShowDialog();
						FillGridMu();
						break;
					case EhrMeasureType.SecureMessaging:
						//Patient Sent
						break;
					case EhrMeasureType.FamilyHistory:
						FormMed=new FormMedical(PatNotCur,PatCur);
						FormMed.ShowDialog();
						FillGridMu();
						break;
					case EhrMeasureType.ElectronicNote:
						//Sign a Note
						break;
					case EhrMeasureType.CPOE_LabOrdersOnly:
						if(DataConnection.DBtype==DatabaseType.Oracle) {
							MsgBox.Show(this,"Labs not supported with Oracle");
							break;
						}
						FormEhrLabOrders FormLab=new FormEhrLabOrders();
						FormLab.PatCur=PatCur;
						FormLab.ShowDialog();
						FillGridMu();
						break;
					case EhrMeasureType.CPOE_RadiologyOrdersOnly:
						if(DataConnection.DBtype==DatabaseType.Oracle) {
							MsgBox.Show(this,"Labs not supported with Oracle");
							break;
						}
						FormEhrLabOrders FormRad=new FormEhrLabOrders();
						FormRad.PatCur=PatCur;
						FormRad.ShowDialog();
						FillGridMu();
						break;
					case EhrMeasureType.LabImages:
						if(DataConnection.DBtype==DatabaseType.Oracle) {
							MsgBox.Show(this,"Labs not supported with Oracle");
							break;
						}
						FormEhrLabOrders FormLO=new FormEhrLabOrders();
						FormLO.PatCur=PatCur;
						FormLO.ShowDialog();
						FillGridMu();
						break;
				}
			}
			if(e.Col==4) {
				switch(listMu[e.Row].MeasureType) {
					case EhrMeasureType.MedReconcile:
						int compare=EhrMeasures.CompareReferralsToReconciles(PatNum);
						if(compare==1 || compare==0) {
							FormReferralSelect FormRS=new FormReferralSelect();
							FormRS.IsDoctorSelectionMode=true;
							FormRS.IsSelectionMode=true;
							FormRS.ShowDialog();
							if(FormRS.DialogResult==DialogResult.OK) {
								List<RefAttach> RefAttachList=RefAttaches.RefreshFiltered(PatNum,false,0);
								RefAttach refattach=new RefAttach();
								refattach.ReferralNum=FormRS.SelectedReferral.ReferralNum;
								refattach.PatNum=PatNum;
								refattach.IsFrom=true;
								refattach.RefDate=DateTimeOD.Today;
								if(FormRS.SelectedReferral.IsDoctor) {//whether using ehr or not
									//we're not going to ask.  That's stupid.
									//if(MsgBox.Show(this,MsgBoxButtons.YesNo,"Is this an incoming transition of care from another provider?")){
									refattach.IsTransitionOfCare=true;
								}
								int order=0;
								for(int i=0;i<RefAttachList.Count;i++) {
									if(RefAttachList[i].ItemOrder > order) {
										order=RefAttachList[i].ItemOrder;
									}
								}
								refattach.ItemOrder=order+1;
								RefAttaches.Insert(refattach);
								SecurityLogs.MakeLogEntry(Permissions.RefAttachAdd,PatNum,"Referred From "+Referrals.GetNameFL(refattach.ReferralNum));
								FormMedicationReconcile FormMedRec=new FormMedicationReconcile();
								FormMedRec.PatCur=PatCur;
								FormMedRec.ShowDialog();
							}
						}
						else if(compare==-1) {
							FormMedicationReconcile FormMedRec=new FormMedicationReconcile();
							FormMedRec.PatCur=PatCur;
							FormMedRec.ShowDialog();
						}
						FillGridMu();
						//ResultOnClosing=EhrFormResult.Referrals;
						//Close();
						break;
					case EhrMeasureType.SummaryOfCare:
					case EhrMeasureType.SummaryOfCareElectronic:
						FormReferralsPatient FormRefSum=new FormReferralsPatient();
						FormRefSum.PatNum=PatCur.PatNum;
						FormRefSum.ShowDialog();
						FillGridMu();
						//ResultOnClosing=EhrFormResult.Referrals;
						//Close();
						break;
					case EhrMeasureType.Lab:
						//Redundant now that everything is done from one window
						break;
				}
			}
		}
        private void butAddTo_Click(object sender, EventArgs e)
        {
            if (!Security.IsAuthorized(Permissions.RefAttachAdd))
            {
                return;
            }
            FormReferralSelect FormRS = new FormReferralSelect();

            FormRS.IsSelectionMode = true;
            FormRS.ShowDialog();
            if (FormRS.DialogResult != DialogResult.OK)
            {
                return;
            }
            RefAttach refattach = new RefAttach();

            refattach.ReferralNum        = FormRS.SelectedReferral.ReferralNum;
            refattach.PatNum             = PatNum;
            refattach.RefType            = ReferralType.RefTo;
            refattach.RefDate            = DateTimeOD.Today;
            refattach.IsTransitionOfCare = FormRS.SelectedReferral.IsDoctor;
            refattach.ItemOrder          = RefAttachList.Select(x => x.ItemOrder + 1).OrderByDescending(x => x).FirstOrDefault();//Max+1 or 0
            refattach.ProcNum            = ProcNum;
            //We want to help EHR users meet their measures.  Therefore, we are going to make an educated guess as to who is making this referral.
            //We are doing this for non-EHR users as well because we think it might be nice automation.
            long provNumLastAppt = Appointments.GetProvNumFromLastApptForPat(PatNum);

            if (Security.CurUser.ProvNum != 0)
            {
                refattach.ProvNum = Security.CurUser.ProvNum;
            }
            else if (provNumLastAppt != 0)
            {
                refattach.ProvNum = provNumLastAppt;
            }
            else
            {
                refattach.ProvNum = Patients.GetProvNum(PatNum);
            }
            RefAttaches.Insert(refattach);
            SecurityLogs.MakeLogEntry(Permissions.RefAttachAdd, PatNum, "Referred To " + Referrals.GetNameFL(refattach.ReferralNum));
            if (PrefC.GetBool(PrefName.AutomaticSummaryOfCareWebmail))
            {
                FormRefAttachEdit FormRAE = new FormRefAttachEdit();
                FormRAE.RefAttachCur = refattach;
                FormRAE.ShowDialog();
                //In order to help offices meet EHR Summary of Care measure 1 of Core Measure 15 of 17, we are going to send a summary of care to the patient portal behind the scenes.
                //We can send the summary of care to the patient instead of to the Dr. because of the following point in the Additional Information section of the Core Measure:
                //"The EP can send an electronic or paper copy of the summary care record directly to the next provider or can provide it to the patient to deliver to the next provider, if the patient can reasonably expected to do so and meet Measure 1."
                //We will only send the summary of care if the ref attach is a TO referral and is a transition of care.
                if (FormRAE.DialogResult == DialogResult.OK && refattach.RefType == ReferralType.RefTo && refattach.IsTransitionOfCare)
                {
                    try {
                        //This is like FormEhrClinicalSummary.butSendToPortal_Click such that the email gets treated like a web mail.
                        Patient PatCur = Patients.GetPat(PatNum);
                        string  strCcdValidationErrors = EhrCCD.ValidateSettings();
                        if (strCcdValidationErrors != "")
                        {
                            throw new Exception();
                        }
                        strCcdValidationErrors = EhrCCD.ValidatePatient(PatCur);
                        if (strCcdValidationErrors != "")
                        {
                            throw new Exception();
                        }
                        Provider prov = null;
                        if (Security.CurUser.ProvNum != 0)
                        {
                            prov = Providers.GetProv(Security.CurUser.ProvNum);
                        }
                        else
                        {
                            prov = Providers.GetProv(PatCur.PriProv);
                        }
                        EmailMessage msgWebMail = new EmailMessage();                //New mail object
                        msgWebMail.FromAddress    = prov.GetFormalName();            //Adding from address
                        msgWebMail.ToAddress      = PatCur.GetNameFL();              //Adding to address
                        msgWebMail.PatNum         = PatCur.PatNum;                   //Adding patient number
                        msgWebMail.SentOrReceived = EmailSentOrReceived.WebMailSent; //Setting to sent
                        msgWebMail.ProvNumWebMail = prov.ProvNum;                    //Adding provider number
                        msgWebMail.Subject        = "Referral To " + FormRS.SelectedReferral.GetNameFL();
                        msgWebMail.BodyText       =
                            "You have been referred to another provider.  Your summary of care is attached.\r\n"
                            + "You may give a copy of this summary of care to the referred provider if desired.\r\n"
                            + "The contact information for the doctor you are being referred to is as follows:\r\n"
                            + "\r\n";
                        //Here we provide the same information that would go out on a Referral Slip.
                        //When the user prints a Referral Slip, the doctor referred to information is included and contains the doctor's name, address, and phone.
                        msgWebMail.BodyText += "Name: " + FormRS.SelectedReferral.GetNameFL() + "\r\n";
                        if (FormRS.SelectedReferral.Address.Trim() != "")
                        {
                            msgWebMail.BodyText += "Address: " + FormRS.SelectedReferral.Address.Trim() + "\r\n";
                            if (FormRS.SelectedReferral.Address2.Trim() != "")
                            {
                                msgWebMail.BodyText += "\t" + FormRS.SelectedReferral.Address2.Trim() + "\r\n";
                            }
                            msgWebMail.BodyText += "\t" + FormRS.SelectedReferral.City + " " + FormRS.SelectedReferral.ST + " " + FormRS.SelectedReferral.Zip + "\r\n";
                        }
                        if (FormRS.SelectedReferral.Telephone != "")
                        {
                            msgWebMail.BodyText += "Phone: (" + FormRS.SelectedReferral.Telephone.Substring(0, 3) + ")" + FormRS.SelectedReferral.Telephone.Substring(3, 3) + "-" + FormRS.SelectedReferral.Telephone.Substring(6) + "\r\n";
                        }
                        msgWebMail.BodyText +=
                            "\r\n"
                            + "To view the Summary of Care for the referral to this provider:\r\n"
                            + "1) Download all attachments to the same folder.  Do not rename the files.\r\n"
                            + "2) Open the ccd.xml file in an internet browser.";
                        msgWebMail.MsgDateTime = DateTime.Now;                      //Message time is now
                        msgWebMail.PatNumSubj  = PatCur.PatNum;                     //Subject of the message is current patient
                        string ccd = "";
                        Cursor = Cursors.WaitCursor;
                        ccd    = EhrCCD.GenerateSummaryOfCare(Patients.GetPat(PatNum));                                                           //Create summary of care, can throw exceptions but they're caught below
                        msgWebMail.Attachments.Add(EmailAttaches.CreateAttach("ccd.xml", Encoding.UTF8.GetBytes(ccd)));                           //Create summary of care attachment, can throw exceptions but caught below
                        msgWebMail.Attachments.Add(EmailAttaches.CreateAttach("ccd.xsl", Encoding.UTF8.GetBytes(FormEHR.GetEhrResource("CCD")))); //Create xsl attachment, can throw exceptions
                        EmailMessages.Insert(msgWebMail);                                                                                         //Insert mail into DB for patient portal
                        EhrMeasureEvent newMeasureEvent = new EhrMeasureEvent();
                        newMeasureEvent.DateTEvent = DateTime.Now;
                        newMeasureEvent.EventType  = EhrMeasureEventType.SummaryOfCareProvidedToDr;
                        newMeasureEvent.PatNum     = PatCur.PatNum;
                        newMeasureEvent.FKey       = FormRAE.RefAttachCur.RefAttachNum;                //Can be 0 if user didn't pick a referral for some reason.
                        EhrMeasureEvents.Insert(newMeasureEvent);
                    }
                    catch {
                        //We are just trying to be helpful so it doesn't really matter if something failed above.
                        //They can simply go to the EHR dashboard and send the summary of care manually like they always have.  They will get detailed validation errors there.
                        MsgBox.Show(this, "There was a problem automatically sending a summary of care.  Please go to the EHR dashboard to send a summary of care to meet the summary of care core measure.");
                    }
                }
            }
            Cursor = Cursors.Default;
            FillGrid();
            for (int i = 0; i < RefAttachList.Count; i++)
            {
                if (RefAttachList[i].ReferralNum == refattach.ReferralNum)
                {
                    gridMain.SetSelected(i, true);
                }
            }
        }
Beispiel #18
0
 private void menuItemReferrals_Click(object sender, System.EventArgs e)
 {
     FormReferralSelect FormRS=new FormReferralSelect();
     FormRS.ShowDialog();
 }
Beispiel #19
0
		private void butAddTo_Click(object sender,EventArgs e) {
			if(!Security.IsAuthorized(Permissions.RefAttachAdd)) {
				return;
			}
			FormReferralSelect FormRS=new FormReferralSelect();
			FormRS.IsSelectionMode=true;
			FormRS.ShowDialog();
			if(FormRS.DialogResult!=DialogResult.OK) {
				return;
			}
			RefAttach refattach=new RefAttach();
			refattach.ReferralNum=FormRS.SelectedReferral.ReferralNum;
			refattach.PatNum=PatNum;
			refattach.IsFrom=false;
			refattach.RefDate=DateTimeOD.Today;
			if(FormRS.SelectedReferral.IsDoctor) {
				refattach.IsTransitionOfCare=true;
			}
			int order=0;
			for(int i=0;i<RefAttachList.Count;i++) {
				if(RefAttachList[i].ItemOrder > order) {
					order=RefAttachList[i].ItemOrder;
				}
			}
			refattach.ItemOrder=order+1;
			refattach.ProcNum=ProcNum;
			//We want to help EHR users meet their measures.  Therefore, we are going to make an educated guess as to who is making this referral.
			//We are doing this for non-EHR users as well because we think it might be nice automation.
			long provNumLastAppt=Appointments.GetProvNumFromLastApptForPat(PatNum);
			if(Security.CurUser.ProvNum!=0) {
				refattach.ProvNum=Security.CurUser.ProvNum;
			}
			else if(provNumLastAppt!=0) {
				refattach.ProvNum=provNumLastAppt;
			}
			else {
				refattach.ProvNum=Patients.GetPat(PatNum).PriProv;
			}
			RefAttaches.Insert(refattach);
			SecurityLogs.MakeLogEntry(Permissions.RefAttachAdd,PatNum,"Referred To "+Referrals.GetNameFL(refattach.ReferralNum));
			if(PrefC.GetBool(PrefName.ShowFeatureEhr)) {
				FormRefAttachEdit FormRAE=new FormRefAttachEdit();
				FormRAE.RefAttachCur=refattach;
				FormRAE.ShowDialog();
				//In order to help offices meet EHR Summary of Care measure 1 of Core Measure 15 of 17, we are going to send a summary of care to the patient portal behind the scenes.
				//We can send the summary of care to the patient instead of to the Dr. because of the following point in the Additional Information section of the Core Measure:
				//"The EP can send an electronic or paper copy of the summary care record directly to the next provider or can provide it to the patient to deliver to the next provider, if the patient can reasonably expected to do so and meet Measure 1."
				//We will only send the summary of care if the ref attach is a TO referral and is a transition of care.
				if(FormRAE.DialogResult==DialogResult.OK && !refattach.IsFrom && refattach.IsTransitionOfCare) {
					try {
						//This is like FormEhrClinicalSummary.butSendToPortal_Click such that the email gets treated like a web mail.
						Patient PatCur=Patients.GetPat(PatNum);
						string strCcdValidationErrors=EhrCCD.ValidateSettings();
						if(strCcdValidationErrors!="") {
							throw new Exception();
						}
						strCcdValidationErrors=EhrCCD.ValidatePatient(PatCur);
						if(strCcdValidationErrors!="") {
							throw new Exception();
						}
						Provider prov=null;
						if(Security.CurUser.ProvNum!=0) {
							prov=Providers.GetProv(Security.CurUser.ProvNum);
						}
						else {
							prov=Providers.GetProv(PatCur.PriProv);
						}
						EmailMessage msgWebMail=new EmailMessage();//New mail object				
						msgWebMail.FromAddress=prov.GetFormalName();//Adding from address
						msgWebMail.ToAddress=PatCur.GetNameFL();//Adding to address
						msgWebMail.PatNum=PatCur.PatNum;//Adding patient number
						msgWebMail.SentOrReceived=EmailSentOrReceived.WebMailSent;//Setting to sent
						msgWebMail.ProvNumWebMail=prov.ProvNum;//Adding provider number
						msgWebMail.Subject="Referral To "+FormRS.SelectedReferral.GetNameFL();
						msgWebMail.BodyText=
							"You have been referred to another provider.  Your summary of care is attached.\r\n"
							+"You may give a copy of this summary of care to the referred provider if desired.\r\n"
							+"The contact information for the doctor you are being referred to is as follows:\r\n"
							+"\r\n";
						//Here we provide the same information that would go out on a Referral Slip.
						//When the user prints a Referral Slip, the doctor referred to information is included and contains the doctor's name, address, and phone.
						msgWebMail.BodyText+="Name: "+FormRS.SelectedReferral.GetNameFL()+"\r\n";
						if(FormRS.SelectedReferral.Address.Trim()!="") {
							msgWebMail.BodyText+="Address: "+FormRS.SelectedReferral.Address.Trim()+"\r\n";
							if(FormRS.SelectedReferral.Address2.Trim()!="") {
								msgWebMail.BodyText+="\t"+FormRS.SelectedReferral.Address2.Trim()+"\r\n";
							}
							msgWebMail.BodyText+="\t"+FormRS.SelectedReferral.City+" "+FormRS.SelectedReferral.ST+" "+FormRS.SelectedReferral.Zip+"\r\n";
						}
						if(FormRS.SelectedReferral.Telephone!="") {
							msgWebMail.BodyText+="Phone: ("+FormRS.SelectedReferral.Telephone.Substring(0,3)+")"+FormRS.SelectedReferral.Telephone.Substring(3,3)+"-"+FormRS.SelectedReferral.Telephone.Substring(6)+"\r\n";
						}
						msgWebMail.BodyText+=
							"\r\n"
							+"To view the Summary of Care for the referral to this provider:\r\n"
							+"1) Download all attachments to the same folder.  Do not rename the files.\r\n"
							+"2) Open the ccd.xml file in an internet browser.";
						msgWebMail.MsgDateTime=DateTime.Now;//Message time is now
						msgWebMail.PatNumSubj=PatCur.PatNum;//Subject of the message is current patient
						string ccd="";
						Cursor=Cursors.WaitCursor;
						ccd=EhrCCD.GenerateSummaryOfCare(Patients.GetPat(PatNum));//Create summary of care, can throw exceptions but they're caught below
						msgWebMail.Attachments.Add(EmailAttaches.CreateAttach("ccd.xml",Encoding.UTF8.GetBytes(ccd)));//Create summary of care attachment, can throw exceptions but caught below
						msgWebMail.Attachments.Add(EmailAttaches.CreateAttach("ccd.xsl",Encoding.UTF8.GetBytes(FormEHR.GetEhrResource("CCD"))));//Create xsl attachment, can throw exceptions
						EmailMessages.Insert(msgWebMail);//Insert mail into DB for patient portal
						EhrMeasureEvent newMeasureEvent=new EhrMeasureEvent();
						newMeasureEvent.DateTEvent=DateTime.Now;
						newMeasureEvent.EventType=EhrMeasureEventType.SummaryOfCareProvidedToDr;
						newMeasureEvent.PatNum=PatCur.PatNum;
						newMeasureEvent.FKey=FormRAE.RefAttachCur.RefAttachNum;//Can be 0 if user didn't pick a referral for some reason.
						EhrMeasureEvents.Insert(newMeasureEvent);
					}
					catch {
						//We are just trying to be helpful so it doesn't really matter if something failed above. 
						//They can simply go to the EHR dashboard and send the summary of care manually like they always have.  They will get detailed validation errors there.
						MsgBox.Show(this,Lan.g(this,"There was a problem automatically sending a summary of care.  Please go to the EHR dashboard to send a summary of care to meet the summary of care core measure."));
					}
				}
			}
			Cursor=Cursors.Default;
			FillGrid();
			for(int i=0;i<RefAttachList.Count;i++) {
				if(RefAttachList[i].ReferralNum==refattach.ReferralNum) {
					gridMain.SetSelected(i,true);
				}
			}
		}