Exemple #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();
        }
Exemple #2
0
        private void gridMain_CellDoubleClick(object sender, ODGridClickEventArgs e)
        {
            FormRefAttachEdit FormRAE2 = new FormRefAttachEdit();

            FormRAE2.RefAttachCur = RefAttachList[e.Row];
            FormRAE2.ShowDialog();
            FillGrid();
        }
        private void gridMain_CellDoubleClick(object sender, ODGridClickEventArgs e)
        {
            FormRefAttachEdit FormRAE2  = new FormRefAttachEdit();
            RefAttach         refattach = RefAttachList[e.Row].Copy();

            FormRAE2.RefAttachCur = refattach;
            FormRAE2.ShowDialog();
            FillGrid();
            //reselect
            for (int i = 0; i < RefAttachList.Count; i++)
            {
                if (RefAttachList[i].RefAttachNum == refattach.RefAttachNum)
                {
                    gridMain.SetSelected(i, true);
                }
            }
        }
Exemple #4
0
        private void gridMain_CellDoubleClick(object sender, ODGridClickEventArgs e)
        {
            //This does not automatically select a retattch when in selection mode; it just lets user edit.
            FormRefAttachEdit FormRAE2  = new FormRefAttachEdit();
            RefAttach         refattach = RefAttachList[e.Row].Copy();

            FormRAE2.RefAttachCur = refattach;
            FormRAE2.ShowDialog();
            FillGrid();
            //reselect
            for (int i = 0; i < RefAttachList.Count; i++)
            {
                if (RefAttachList[i].RefAttachNum == refattach.RefAttachNum)
                {
                    gridMain.SetSelected(i, true);
                }
            }
        }
Exemple #5
0
		private void gridMain_CellDoubleClick(object sender,ODGridClickEventArgs e) {
			FormRefAttachEdit FormRAE2=new FormRefAttachEdit();
			RefAttach refattach=RefAttachList[e.Row].Copy();
			FormRAE2.RefAttachCur=refattach;
			FormRAE2.ShowDialog();
			FillGrid();
			//reselect
			for(int i=0;i<RefAttachList.Count;i++){
				if(RefAttachList[i].RefAttachNum==refattach.RefAttachNum) {
					gridMain.SetSelected(i,true);
				}
			}
		}
		private void gridMain_CellDoubleClick(object sender,ODGridClickEventArgs e) {
			//This does not automatically select a retattch when in selection mode; it just lets user edit.
			FormRefAttachEdit FormRAE2=new FormRefAttachEdit();
			RefAttach refattach=RefAttachList[e.Row].Copy();
			FormRAE2.RefAttachCur=refattach;
			FormRAE2.ShowDialog();
			FillGrid();
			//reselect
			for(int i=0;i<RefAttachList.Count;i++){
				if(RefAttachList[i].RefAttachNum==refattach.RefAttachNum) {
					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.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);
                }
            }
        }
Exemple #8
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);
				}
			}
		}