예제 #1
0
        private void FillData()
        {
            Referral referral = Referrals.GetReferral(RefAttachCur.ReferralNum);

            textName.Text        = referral.LName + ", " + referral.FName + " " + referral.MName;
            checkPatient.Checked = referral.PatNum > 0;
            textNotes.Text       = referral.Note;
            if (RefAttachCur.IsFrom)
            {
                radioFrom.Checked = true;
            }
            else
            {
                radioTo.Checked = true;
            }
            if (RefAttachCur.RefDate.CompareTo(new DateTime(1880, 1, 1)) < 0)
            {
                textRefDate.Text = "";
            }
            else
            {
                textRefDate.Text = RefAttachCur.RefDate.ToShortDateString();
            }
            textOrder.Text = RefAttachCur.ItemOrder.ToString();
        }
예제 #2
0
        private void FillData()
        {
            Referral referral = Referrals.GetReferral(RefAttachCur.ReferralNum);

            textName.Text          = referral.LName + ", " + referral.FName + " " + referral.MName;
            checkPatient.Checked   = referral.PatNum > 0;
            textReferralNotes.Text = referral.Note;
            if (RefAttachCur.IsFrom)
            {
                radioFrom.Checked = true;
            }
            else
            {
                radioTo.Checked = true;
            }
            if (RefAttachCur.RefDate.CompareTo(new DateTime(1880, 1, 1)) < 0)
            {
                textRefDate.Text = "";
            }
            else
            {
                textRefDate.Text = RefAttachCur.RefDate.ToShortDateString();
            }
            textOrder.Text = RefAttachCur.ItemOrder.ToString();
            comboRefToStatus.Items.Clear();
            for (int i = 0; i < Enum.GetNames(typeof(ReferralToStatus)).Length; i++)
            {
                comboRefToStatus.Items.Add(Lan.g("enumReferralToStatus", Enum.GetNames(typeof(ReferralToStatus))[i]));
                if ((int)RefAttachCur.RefToStatus == i)
                {
                    comboRefToStatus.SelectedIndex = i;
                }
            }
            textNote.Text = RefAttachCur.Note;
        }
예제 #3
0
        private void butSlip_Click(object sender, EventArgs e)
        {
            int idx = gridMain.GetSelectedIndex();

            if (idx == -1)
            {
                MsgBox.Show(this, "Please select a referral first");
                return;
            }
            Referral referral = Referrals.GetReferral(RefAttachList[idx].ReferralNum);
            SheetDef sheetDef;

            if (referral.Slip == 0)
            {
                sheetDef = SheetsInternal.GetSheetDef(SheetInternalType.ReferralSlip);
            }
            else
            {
                sheetDef = SheetDefs.GetSheetDef(referral.Slip);
            }
            Sheet sheet = SheetUtil.CreateSheet(sheetDef, PatNum);

            SheetParameter.SetParameter(sheet, "PatNum", PatNum);
            SheetParameter.SetParameter(sheet, "ReferralNum", referral.ReferralNum);
            SheetFiller.FillFields(sheet);
            SheetUtil.CalculateHeights(sheet, this.CreateGraphics());
            FormSheetFillEdit FormS = new FormSheetFillEdit(sheet);

            FormS.ShowDialog();
            //grid will not be refilled, so no need to reselect.
        }
예제 #4
0
        private void FillGrid()
        {
            RefAttachList = RefAttaches.RefreshFiltered(PatNum, checkShowAll.Checked, ProcNum);
            gridMain.BeginUpdate();
            gridMain.Columns.Clear();
            ODGridColumn col = new ODGridColumn(Lan.g("TableRefList", "From/To"), 50);

            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableRefList", "Name"), 120);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableRefList", "Date"), 70);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableRefList", "Status"), 90);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableRefList", "Proc"), 120);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableRefList", "Note"), 200);
            gridMain.Columns.Add(col);
            gridMain.Rows.Clear();
            ODGridRow row;

            //Referral referral;
            for (int i = 0; i < RefAttachList.Count; i++)
            {
                row = new ODGridRow();
                if (RefAttachList[i].IsFrom)
                {
                    row.Cells.Add(Lan.g(this, "From"));
                }
                else
                {
                    row.Cells.Add(Lan.g(this, "To"));
                }
                row.Cells.Add(Referrals.GetNameFL(RefAttachList[i].ReferralNum));
                //referral=ReferralL.GetReferral(RefAttachList[i].ReferralNum);
                if (RefAttachList[i].RefDate.Year < 1880)
                {
                    row.Cells.Add("");
                }
                else
                {
                    row.Cells.Add(RefAttachList[i].RefDate.ToShortDateString());
                }
                row.Cells.Add(Lan.g("enumReferralToStatus", RefAttachList[i].RefToStatus.ToString()));
                if (RefAttachList[i].ProcNum == 0)
                {
                    row.Cells.Add("");
                }
                else
                {
                    Procedure proc = Procedures.GetOneProc(RefAttachList[i].ProcNum, false);
                    string    str  = Procedures.GetDescription(proc);
                    row.Cells.Add(str);
                }
                row.Cells.Add(RefAttachList[i].Note);
                gridMain.Rows.Add(row);
            }
            gridMain.EndUpdate();
        }
예제 #5
0
        public static bool HideDef(ODGrid gridDefs, DefCatOptions selectedDefCatOpt)
        {
            if (gridDefs.GetSelectedIndex() == -1)
            {
                MsgBox.Show(_lanThis, "Please select item first,");
                return(false);
            }
            Def selectedDef = (Def)gridDefs.Rows[gridDefs.GetSelectedIndex()].Tag;

            //Warn the user if they are about to hide a billing type currently in use.
            if (selectedDefCatOpt.DefCat == DefCat.BillingTypes && Patients.IsBillingTypeInUse(selectedDef.DefNum))
            {
                if (!MsgBox.Show(_lanThis, MsgBoxButtons.OKCancel, "Warning: Billing type is currently in use by patients, insurance plans, or preferences."))
                {
                    return(false);
                }
            }
            if (selectedDef.Category == DefCat.ProviderSpecialties &&
                (Providers.IsSpecialtyInUse(selectedDef.DefNum) ||
                 Referrals.IsSpecialtyInUse(selectedDef.DefNum)))
            {
                MsgBox.Show(_lanThis, "You cannot hide a specialty if it is in use by a provider or a referral source.");
                return(false);
            }
            if (Defs.IsDefinitionInUse(selectedDef))
            {
                if (selectedDef.DefNum == PrefC.GetLong(PrefName.BrokenAppointmentAdjustmentType) ||
                    selectedDef.DefNum == PrefC.GetLong(PrefName.AppointmentTimeArrivedTrigger) ||
                    selectedDef.DefNum == PrefC.GetLong(PrefName.AppointmentTimeSeatedTrigger) ||
                    selectedDef.DefNum == PrefC.GetLong(PrefName.AppointmentTimeDismissedTrigger) ||
                    selectedDef.DefNum == PrefC.GetLong(PrefName.TreatPlanDiscountAdjustmentType) ||
                    selectedDef.DefNum == PrefC.GetLong(PrefName.BillingChargeAdjustmentType) ||
                    selectedDef.DefNum == PrefC.GetLong(PrefName.PracticeDefaultBillType) ||
                    selectedDef.DefNum == PrefC.GetLong(PrefName.FinanceChargeAdjustmentType))
                {
                    MsgBox.Show(_lanThis, "You cannot hide a definition if it is in use within Module Preferences.");
                    return(false);
                }
                else
                {
                    if (!MsgBox.Show(_lanThis, MsgBoxButtons.OKCancel, "Warning: This definition is currently in use within the program."))
                    {
                        return(false);
                    }
                }
            }
            //Stop users from hiding the last definition in categories that must have at least one def in them.
            if (Defs.IsHidable(selectedDef.Category))
            {
                List <Def> listDefsCurNotHidden = Defs.GetDefsForCategory(selectedDefCatOpt.DefCat, true);
                if (listDefsCurNotHidden.Count == 1)
                {
                    MsgBox.Show(_lanThis, "You cannot hide the last definition in this category.");
                    return(false);
                }
            }
            Defs.HideDef(selectedDef);
            return(true);
        }
예제 #6
0
        private void butOK_Click(object sender, System.EventArgs e)
        {
            string phone = textPhone1.Text + textPhone2.Text + textPhone3.Text;

            if (phone.Length > 0 && phone.Length < 10)
            {
                MessageBox.Show(Lan.g(this, "Invalid phone"));
                return;
            }
            RefCur.IsHidden       = checkHidden.Checked;
            RefCur.NotPerson      = checkNotPerson.Checked;
            RefCur.LName          = textLName.Text;
            RefCur.FName          = textFName.Text;
            RefCur.MName          = textMName.Text;
            RefCur.Title          = textTitle.Text;
            RefCur.Address        = textAddress.Text;
            RefCur.Address2       = textAddress2.Text;
            RefCur.City           = textCity.Text;
            RefCur.ST             = textST.Text;
            RefCur.Zip            = textZip.Text;
            RefCur.Telephone      = phone;
            RefCur.Phone2         = textOtherPhone.Text;
            RefCur.SSN            = textSSN.Text;
            RefCur.NationalProvID = textNationalProvID.Text;
            RefCur.EMail          = textEmail.Text;
            RefCur.Note           = textNotes.Text;
            //RefCur.UsingTIN already taken care of
            if (!IsPatient)
            {
                RefCur.Specialty = (DentalSpecialty)listSpecialty.SelectedIndex;
            }
            if (IsNew)
            {
                for (int i = 0; i < Referrals.List.Length; i++)
                {
                    if ((RefCur.LName + RefCur.FName)
                        == (Referrals.List[i].LName + Referrals.List[i].FName))
                    {
                        if (MessageBox.Show(Lan.g(this, "Referral of same name exists. Add anyway?"), ""
                                            , MessageBoxButtons.YesNo) != DialogResult.Yes)
                        {
                            DialogResult = DialogResult.Cancel;
                            return;
                        }
                        break;
                    }
                }
                Referrals.Insert(RefCur);
            }
            else
            {
                Referrals.Update(RefCur);
            }
            //
            Referrals.Refresh();
            //MessageBox.Show(RefCur.ReferralNum.ToString());
            DialogResult = DialogResult.OK;
        }
예제 #7
0
 private void FillTable()
 {
     Referrals.Refresh();
     AList = new ArrayList();
     if (!checkHidden.Checked)
     {
         for (int i = 0; i < Referrals.List.Length; i++)
         {
             if (!Referrals.List[i].IsHidden)
             {
                 AList.Add(Referrals.List[i]);
             }
         }
     }
     else
     {
         for (int i = 0; i < Referrals.List.Length; i++)
         {
             AList.Add(Referrals.List[i]);
         }
     }
     tbRefSelect.ResetRows(AList.Count);
     tbRefSelect.SetGridColor(Color.Gray);
     tbRefSelect.SetBackGColor(Color.White);
     for (int i = 0; i < AList.Count; i++)
     {
         tbRefSelect.Cell[0, i] = ((Referral)(AList[i])).LName;
         tbRefSelect.Cell[1, i] = ((Referral)(AList[i])).FName;
         if (((Referral)(AList[i])).MName != "")
         {
             tbRefSelect.Cell[2, i] = ((Referral)(AList[i])).MName.Substring(0, 1).ToUpper();
         }
         tbRefSelect.Cell[3, i] = ((Referral)(AList[i])).Title;
         if (((Referral)(AList[i])).PatNum == 0 && !((Referral)(AList[i])).NotPerson)
         {
             tbRefSelect.Cell[4, i]
                 = Lan.g("enumDentalSpecialty", ((DentalSpecialty)(((Referral)(AList[i])).Specialty)).ToString());
         }
         if (((Referral)(AList[i])).PatNum > 0)
         {
             tbRefSelect.Cell[5, i] = "X";
         }
         else
         {
             tbRefSelect.Cell[5, i] = "";
         }
         tbRefSelect.Cell[6, i] = ((Referral)(AList[i])).Note;
         if (((Referral)(AList[i])).IsHidden)
         {
             tbRefSelect.SetTextColorRow(i, SystemColors.GrayText);
         }
     }
     tbRefSelect.LayoutTables();
     //if(tbRefSelect.SelectedRow!=-1){
     //  tbRefSelect.ColorRow(tbRefSelect.SelectedRow,Color.Silver);
     //}
 }
예제 #8
0
        ///<summary>Helper method that replaces the message with all of the Message Replacements available for ProgramLinks.</summary>
        private static string ReplaceHelper(string message, Patient pat)
        {
            string retVal = message;

            retVal = Patients.ReplacePatient(retVal, pat);
            retVal = Patients.ReplaceGuarantor(retVal, pat);
            retVal = Referrals.ReplaceRefProvider(retVal, pat);
            return(retVal);
        }
예제 #9
0
        ///<summary>Attemmpts to get a referral.
        ///Returns null and shows a MsgBox if there was an error.</summary>
        public static Referral GetReferral(long referralNum, bool isMsgShown = true)
        {
            Referral referral;

            if (!Referrals.TryGetReferral(referralNum, out referral) && isMsgShown)            //Failed to retrieve referral
            {
                ShowReferralErrorMsg();
            }
            return(referral);
        }
예제 #10
0
        private void butAdd_Click(object sender, System.EventArgs e)
        {
            Referral refCur        = new Referral();
            bool     referralIsNew = true;

            if (MsgBox.Show(this, MsgBoxButtons.YesNo, "Is the referral source an existing patient?"))
            {
                FormPatientSelect FormPS = new FormPatientSelect();
                FormPS.SelectionModeOnly = true;
                FormPS.ShowDialog();
                if (FormPS.DialogResult != DialogResult.OK)
                {
                    return;
                }
                refCur.PatNum = FormPS.SelectedPatNum;
                Referral referral = Referrals.GetFirstOrDefault(x => x.PatNum == FormPS.SelectedPatNum);
                if (referral != null)
                {
                    refCur        = referral;
                    referralIsNew = false;
                }
            }
            FormReferralEdit FormRE2 = new FormReferralEdit(refCur);          //the ReferralNum must be added here

            FormRE2.IsNew = referralIsNew;
            FormRE2.ShowDialog();
            if (FormRE2.DialogResult == DialogResult.Cancel)
            {
                return;
            }
            if (IsSelectionMode)
            {
                if (IsDoctorSelectionMode && !FormRE2.RefCur.IsDoctor)
                {
                    MsgBox.Show(this, "Please select a doctor referral.");
                    gridMain.SetSelected(false);                    //Remove selection to prevent caching issue on OK click.  This line is an attempted fix.
                    FillTable();
                    return;
                }
                SelectedReferral = FormRE2.RefCur;
                DialogResult     = DialogResult.OK;
                return;
            }
            else
            {
                FillTable();
                for (int i = 0; i < listRef.Count; i++)
                {
                    if (listRef[i].ReferralNum == FormRE2.RefCur.ReferralNum)
                    {
                        gridMain.SetSelected(i, true);
                    }
                }
            }
        }
예제 #11
0
        private void butEdit_Click(object sender, System.EventArgs e)
        {
            Referral referral = Referrals.GetReferral(RefAttachCur.ReferralNum);
            //if(referral.PatNum > 0){//moved to inside the class
            //	FormRE.IsPatient=true;
            //}
            FormReferralEdit FormRE = new FormReferralEdit(referral);

            FormRE.ShowDialog();
            Referrals.Refresh();
            FillData();
        }
 private void FillRefs()
 {
     Referrals.Refresh();
     listRef.Items.Clear();
     for (int i = 0; i < Referrals.List.Length; i++)
     {
         listRef.Items.Add(Referrals.List[i].LName + ", " + Referrals.List[i].FName);
         if (ClaimCur.ReferringProv == Referrals.List[i].ReferralNum)
         {
             listRef.SelectedIndex = i;
         }
     }
 }
예제 #13
0
        private void FillData()
        {
            Referral referral = Referrals.GetReferral(RefAttachCur.ReferralNum);

            textName.Text          = referral.GetNameFL();
            labelPatient.Visible   = referral.PatNum > 0;
            textReferralNotes.Text = referral.Note;
            if (RefAttachCur.IsFrom)
            {
                listFromTo.SelectedIndex = 0;
            }
            else
            {
                listFromTo.SelectedIndex = 1;
            }
            if (RefAttachCur.RefDate.Year < 1880)
            {
                textRefDate.Text = "";
            }
            else
            {
                textRefDate.Text = RefAttachCur.RefDate.ToShortDateString();
            }
            textOrder.Text = RefAttachCur.ItemOrder.ToString();
            comboRefToStatus.Items.Clear();
            for (int i = 0; i < Enum.GetNames(typeof(ReferralToStatus)).Length; i++)
            {
                comboRefToStatus.Items.Add(Lan.g("enumReferralToStatus", Enum.GetNames(typeof(ReferralToStatus))[i]));
                if ((int)RefAttachCur.RefToStatus == i)
                {
                    comboRefToStatus.SelectedIndex = i;
                }
            }
            textNote.Text = RefAttachCur.Note;
            checkIsTransitionOfCare.Checked = RefAttachCur.IsTransitionOfCare;
            textProc.Text = "";
            if (RefAttachCur.ProcNum != 0)
            {
                Procedure proc = Procedures.GetOneProc(RefAttachCur.ProcNum, false);
                textProc.Text = Procedures.GetDescription(proc);
            }
            if (RefAttachCur.DateProcComplete.Year < 1880)
            {
                textDateProcCompleted.Text = "";
            }
            else
            {
                textDateProcCompleted.Text = RefAttachCur.DateProcComplete.ToShortDateString();
            }
        }
예제 #14
0
        private void butEdit_Click(object sender, System.EventArgs e)
        {
            try{
                SaveData();
            }
            catch (ApplicationException ex) {
                MessageBox.Show(ex.Message);
                return;
            }
            Referral         referral = Referrals.GetReferral(RefAttachCur.ReferralNum);
            FormReferralEdit FormRE   = new FormReferralEdit(referral);

            FormRE.ShowDialog();
            Referrals.Refresh();
            FillData();
        }
예제 #15
0
        private void FillGrid()
        {
            RefAttachList = RefAttaches.Refresh(PatNum);
            gridMain.BeginUpdate();
            gridMain.Columns.Clear();
            ODGridColumn col = new ODGridColumn(Lan.g("TableRefList", "From/To"), 50);

            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableRefList", "Name"), 120);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableRefList", "Date"), 70);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableRefList", "Status"), 80);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableRefList", "Note"), 200);
            gridMain.Columns.Add(col);
            gridMain.Rows.Clear();
            ODGridRow row;

            //Referral referral;
            for (int i = 0; i < RefAttachList.Length; i++)
            {
                row = new ODGridRow();
                if (RefAttachList[i].IsFrom)
                {
                    row.Cells.Add(Lan.g(this, "From"));
                }
                else
                {
                    row.Cells.Add(Lan.g(this, "To"));
                }
                row.Cells.Add(Referrals.GetNameFL(RefAttachList[i].ReferralNum));
                //referral=Referrals.GetReferral(RefAttachList[i].ReferralNum);
                if (RefAttachList[i].RefDate.Year < 1880)
                {
                    row.Cells.Add("");
                }
                else
                {
                    row.Cells.Add(RefAttachList[i].RefDate.ToShortDateString());
                }
                row.Cells.Add(Lan.g("enumReferralToStatus", RefAttachList[i].RefToStatus.ToString()));
                row.Cells.Add(RefAttachList[i].Note);
                gridMain.Rows.Add(row);
            }
            gridMain.EndUpdate();
        }
예제 #16
0
 private void butDelete_Click(object sender, EventArgs e)
 {
     if (IsNew)
     {
         DialogResult = DialogResult.Cancel;
         return;
     }
     if (!MsgBox.Show(this, MsgBoxButtons.OKCancel, "Delete?"))
     {
         return;
     }
     if (RefAttaches.IsReferralAttached(RefCur.ReferralNum))
     {
         MsgBox.Show(this, "Cannot delete Referral because it is attached to patients");
         return;
     }
     Referrals.Delete(RefCur);
     DialogResult = DialogResult.OK;
 }
예제 #17
0
		///<summary></summary>
		public static string ReplaceTemplateFields(string templateText,Patient pat,Appointment aptNext,Clinic clinic) {
			//patient information
			templateText=Patients.ReplacePatient(templateText,pat);
			//Guarantor Information
			templateText=Patients.ReplaceGuarantor(templateText,pat);
			//Family Information
			templateText=Family.ReplaceFamily(templateText,pat);
			//Next Scheduled Appointment Information
			templateText=Appointments.ReplaceAppointment(templateText,aptNext); //handles null nextApts.
			//Currently Logged in User Information
			templateText=FormMessageReplacements.ReplaceUser(templateText,Security.CurUser);
			//Clinic Information
			templateText=Clinics.ReplaceOffice(templateText,clinic);
			//Misc Information
			templateText=FormMessageReplacements.ReplaceMisc(templateText);
			//Referral Information
			templateText=Referrals.ReplaceRefProvider(templateText,pat);
			//Recall Information
			return Recalls.ReplaceRecall(templateText,pat);
		}
예제 #18
0
        private void butEditReferral_Click(object sender, EventArgs e)
        {
            try{
                DataToCur();
            }
            catch (ApplicationException ex) {
                MessageBox.Show(ex.Message);
                return;
            }
            Referral referral = ReferralL.GetReferral(RefAttachCur.ReferralNum);

            if (referral == null)
            {
                return;
            }
            FormReferralEdit FormRE = new FormReferralEdit(referral);

            FormRE.ShowDialog();
            Referrals.RefreshCache();
            FillData();
        }
예제 #19
0
        private void butDelete_Click(object sender, System.EventArgs e)
        {
            if (tbRefSelect.SelectedRow == -1)
            {
                return;
            }
            Referral RefCur = (Referral)AList[tbRefSelect.SelectedRow];

            if (RefAttaches.IsReferralAttached(RefCur.ReferralNum))
            {
                MessageBox.Show(Lan.g(this, "Cannot delete Referral because it is attached to patients"));
                return;
            }
            if (!MsgBox.Show(this, true, "Delete Referral?"))
            {
                return;
            }
            Referrals.Delete(RefCur);
            tbRefSelect.SelectedRow = -1;
            FillTable();
        }
예제 #20
0
 private void FormCommunications_Load(object sender, EventArgs e)
 {
     ReferralCur = Referrals.GetReferralForPat(PatCur.PatNum);
     if (ReferralCur == null)
     {
         butLetterSimpleRef.Enabled = false;
         butLabelRef.Enabled        = false;
         butEmailRef.Enabled        = false;
     }
     else
     {
         textReferral.Text = Referrals.GetNameFL(ReferralCur.ReferralNum);
         if (ReferralCur.EMail == "")
         {
             butEmailRef.Enabled = false;
         }
     }
     if (PatCur.Email == "")
     {
         butEmail.Enabled = false;
     }
 }
예제 #21
0
        ///<summary>Pass in all the refattaches for the patient.  This funtion finds the first referral from a Dr and returns that Dr's name.  Used in specialty practices.  Function is only used right now in the Dr. Ceph bridge.</summary>
        public static string GetReferringDr(RefAttach[] attachList)
        {
            if (attachList.Length == 0)
            {
                return("");
            }
            if (!attachList[0].IsFrom)
            {
                return("");
            }
            Referral referral = Referrals.GetReferral(attachList[0].ReferralNum);

            if (referral.PatNum != 0)
            {
                return("");
            }
            string retVal = referral.FName + " " + referral.MName + " " + referral.LName;

            if (referral.Title != "")
            {
                retVal += ", " + referral.Title;
            }
            return(retVal);
        }
예제 #22
0
        private void pd_PrintPageReferral(object sender, System.Drawing.Printing.PrintPageEventArgs e)
        {
            float    xPos = 25;
            float    yPos = 10;
            Graphics g    = e.Graphics;

            g.TranslateTransform(100, 0);
            g.RotateTransform(90);
            Font  mainFont = new Font(FontFamily.GenericSansSerif, 12);
            float lineH    = e.Graphics.MeasureString("any", mainFont).Height;

            g.DrawString(Referrals.GetNameFL(ReferralCur.ReferralNum), mainFont, Brushes.Black, xPos, yPos);
            yPos += lineH;
            g.DrawString(ReferralCur.Address, mainFont, Brushes.Black, xPos, yPos);
            yPos += lineH;
            if (ReferralCur.Address2 != "")
            {
                g.DrawString(ReferralCur.Address2, mainFont, Brushes.Black, xPos, yPos);
                yPos += lineH;
            }
            g.DrawString(ReferralCur.City + ", " + ReferralCur.ST + "  " + ReferralCur.Zip
                         , mainFont, Brushes.Black, xPos, yPos);
            //e.HasMorePages=false;
        }
예제 #23
0
        private void FillTable()
        {
            Referrals.RefreshCache();
            listRef = Referrals.GetDeepCopy();
            if (!checkHidden.Checked)
            {
                listRef.RemoveAll(x => x.IsHidden);
            }
            if (!checkShowPat.Checked)
            {
                listRef.RemoveAll(x => x.PatNum > 0);
            }
            if (!checkShowDoctor.Checked)
            {
                listRef.RemoveAll(x => x.IsDoctor);
            }
            if (!checkShowOther.Checked)
            {
                listRef.RemoveAll(x => x.PatNum == 0 && !x.IsDoctor);
            }
            if (checkPreferred.Checked)
            {
                listRef.RemoveAll(x => !x.IsPreferred);
            }
            if (!string.IsNullOrWhiteSpace(textSearch.Text))
            {
                string[] searchTokens = textSearch.Text.ToLower().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
                listRef.RemoveAll(x => searchTokens.Any(y => !x.FName.ToLower().Contains(y) && !x.LName.ToLower().Contains(y)));
            }
            int  scrollValue    = gridMain.ScrollValue;
            long selectedRefNum = -1;

            if (gridMain.GetSelectedIndex() > -1)
            {
                selectedRefNum = ((Referral)gridMain.Rows[gridMain.GetSelectedIndex()].Tag).ReferralNum;
            }
            gridMain.BeginUpdate();
            gridMain.Columns.Clear();
            gridMain.Columns.Add(new ODGridColumn(Lan.g("TableSelectRefferal", "LastName"), 150));
            gridMain.Columns.Add(new ODGridColumn(Lan.g("TableSelectRefferal", "FirstName"), 80));
            gridMain.Columns.Add(new ODGridColumn(Lan.g("TableSelectRefferal", "MI"), 30));
            gridMain.Columns.Add(new ODGridColumn(Lan.g("TableSelectRefferal", "Title"), 70));
            gridMain.Columns.Add(new ODGridColumn(Lan.g("TableSelectRefferal", "Specialty"), 60));
            gridMain.Columns.Add(new ODGridColumn(Lan.g("TableSelectRefferal", "Patient"), 45));
            gridMain.Columns.Add(new ODGridColumn(Lan.g("TableSelectRefferal", "Note"), 250));
            gridMain.Rows.Clear();
            ODGridRow row;
            int       indexSelectedRef = -1;

            foreach (Referral refCur in listRef)
            {
                row = new ODGridRow();
                row.Cells.Add(refCur.LName);
                row.Cells.Add(refCur.FName);
                row.Cells.Add(refCur.MName.Left(1).ToUpper());                //Left(1) will return empty string if MName is null or empty string, so ToUpper is null safe
                row.Cells.Add(refCur.Title);
                row.Cells.Add(refCur.IsDoctor?Lan.g("enumDentalSpecialty", Defs.GetName(DefCat.ProviderSpecialties, refCur.Specialty)):"");
                row.Cells.Add(refCur.PatNum > 0?"X":"");
                row.Cells.Add(refCur.Note);
                if (refCur.IsHidden)
                {
                    row.ColorText = Color.Gray;
                }
                row.Tag = refCur;
                gridMain.Rows.Add(row);
                if (refCur.ReferralNum == selectedRefNum)
                {
                    indexSelectedRef = gridMain.Rows.Count - 1;
                }
            }
            gridMain.EndUpdate();
            if (indexSelectedRef > -1)
            {
                gridMain.SetSelected(indexSelectedRef, true);
            }
            gridMain.ScrollValue  = scrollValue;
            labelResultCount.Text = gridMain.Rows.Count.ToString() + Lan.g(this, " results found");
        }
예제 #24
0
        private void FillGrid()
        {
            RefAttachList = RefAttaches.RefreshFiltered(PatNum, true, 0);
            string referralDescript = DisplayFields.GetForCategory(DisplayFieldCategory.PatientInformation)
                                      .FirstOrDefault(x => x.InternalName == "Referrals")?.Description;

            if (string.IsNullOrWhiteSpace(referralDescript))             //either not displaying the Referral field or no description entered, default to 'Referral (other)'
            {
                referralDescript = Lan.g(this, "Referral (other)");
            }
            gridMain.BeginUpdate();
            gridMain.ListGridColumns.Clear();
            gridMain.ListGridColumns.Add(new GridColumn(Lan.g("TableRefList", "Referral Type"), 85));
            gridMain.ListGridColumns.Add(new GridColumn(Lan.g("TableRefList", "Name"), 120));
            gridMain.ListGridColumns.Add(new GridColumn(Lan.g("TableRefList", "Date"), 65));
            gridMain.ListGridColumns.Add(new GridColumn(Lan.g("TableRefList", "Status"), 70));
            gridMain.ListGridColumns.Add(new GridColumn(Lan.g("TableRefList", "Proc"), 120));
            gridMain.ListGridColumns.Add(new GridColumn(Lan.g("TableRefList", "Note"), 170));
            gridMain.ListGridColumns.Add(new GridColumn(Lan.g("TableRefList", "Email"), 190));
            gridMain.ListGridRows.Clear();
            bool          hasInvalidRef = false;
            GridRow       row;
            List <string> listRefTypeNames = new List <string>()
            {
                Lan.g(this, "To"), Lan.g(this, "From"), referralDescript
            };

            for (int i = 0; i < RefAttachList.Count; i++)
            {
                RefAttach refAttachCur = RefAttachList[i];
                if (ProcNum != 0 && !checkShowAll.Checked &&
                    ProcNum != refAttachCur.ProcNum)
                {
                    continue;
                }
                row = new GridRow();
                row.Cells.Add(listRefTypeNames[(int)refAttachCur.RefType]);
                row.Cells.Add(Referrals.GetNameFL(refAttachCur.ReferralNum));
                if (refAttachCur.RefDate.Year < 1880)
                {
                    row.Cells.Add("");
                }
                else
                {
                    row.Cells.Add(refAttachCur.RefDate.ToShortDateString());
                }
                row.Cells.Add(Lan.g("enumReferralToStatus", refAttachCur.RefToStatus.ToString()));
                if (refAttachCur.ProcNum == 0)
                {
                    row.Cells.Add("");
                }
                else
                {
                    Procedure proc = Procedures.GetOneProc(refAttachCur.ProcNum, false);
                    string    str  = Procedures.GetDescription(proc);
                    row.Cells.Add(str);
                }
                row.Cells.Add(refAttachCur.Note);
                Referral referral = ReferralL.GetReferral(refAttachCur.ReferralNum, false);
                if (referral == null)
                {
                    hasInvalidRef = true;
                    continue;
                }
                row.Cells.Add(referral.EMail);
                row.Tag = refAttachCur;
                gridMain.ListGridRows.Add(row);
            }
            if (hasInvalidRef)
            {
                ReferralL.ShowReferralErrorMsg();
            }
            gridMain.EndUpdate();
            for (int i = 0; i < RefAttachList.Count; i++)
            {
                if (RefAttachList[i].RefAttachNum == DefaultRefAttachNum)
                {
                    gridMain.SetSelected(i, true);
                    break;
                }
            }
        }
예제 #25
0
        private void butPrint_Click(object sender, EventArgs e)
        {
            if (!TryToSaveData())
            {
                return;
            }
            SheetCur = Sheets.GetSheet(SheetCur.SheetNum);
            //whether this is a new sheet, or one pulled from the database,
            //it will have the extra parameter we are looking for.
            //A new sheet will also have a PatNum parameter which we will ignore.
            FormSheetOutputFormat FormS = new FormSheetOutputFormat();

            if (SheetCur.SheetType == SheetTypeEnum.ReferralSlip ||
                SheetCur.SheetType == SheetTypeEnum.ReferralLetter)
            {
                FormS.PaperCopies = 2;
            }
            else
            {
                FormS.PaperCopies = 1;
            }
            if (SheetCur.PatNum != 0 &&
                SheetCur.SheetType != SheetTypeEnum.DepositSlip)
            {
                Patient pat = Patients.GetPat(SheetCur.PatNum);
                if (SheetCur.SheetType == SheetTypeEnum.LabSlip)
                {
                    FormS.IsForLab = true;                  //Changes label to "E-mail to Lab:"
                }
                else if (pat.Email != "")
                {
                    FormS.EmailPatOrLabAddress = pat.Email;
                    //No need to email to a patient for sheet types: LabelPatient (0), LabelCarrier (1), LabelReferral (2), ReferralSlip (3), LabelAppointment (4), Rx (5), Consent (6), ReferralLetter (8), ExamSheet (13), DepositSlip (14)
                    //The data is too private to email unencrypted for sheet types: PatientForm (9), RoutingSlip (10), MedicalHistory (11), LabSlip (12)
                    //A patient might want email for the following sheet types and the data is not very private: PatientLetter (7)
                    if (SheetCur.SheetType == SheetTypeEnum.PatientLetter)
                    {
                        //This just defines the default selection. The user can manually change selections in FormSheetOutputFormat.
                        FormS.EmailPatOrLab = true;
                        FormS.PaperCopies--;
                    }
                }
            }
            Referral referral = null;

            if (SheetCur.SheetType == SheetTypeEnum.ReferralSlip ||
                SheetCur.SheetType == SheetTypeEnum.ReferralLetter)
            {
                FormS.Email2Visible = true;
                SheetParameter parameter = SheetParameter.GetParamByName(SheetCur.Parameters, "ReferralNum");
                if (parameter == null)              //it can be null sometimes because of old bug in db.
                {
                    FormS.Email2Visible = false;    //prevents trying to attach email to nonexistent referral.
                }
                else
                {
                    long referralNum = PIn.Long(parameter.ParamValue.ToString());
                    referral = Referrals.GetReferral(referralNum);
                    if (referral.EMail != "")
                    {
                        FormS.Email2Address = referral.EMail;
                        FormS.Email2        = true;
                        FormS.PaperCopies--;
                    }
                }
            }
            else
            {
                FormS.Email2Visible = false;
            }
            FormS.ShowDialog();
            if (FormS.DialogResult != DialogResult.OK)
            {
                return;
            }
            if (FormS.PaperCopies > 0)
            {
                SheetPrinting.Print(SheetCur, FormS.PaperCopies, RxIsControlled);
            }
            EmailMessage message;
            Random       rnd        = new Random();
            string       attachPath = EmailMessages.GetEmailAttachPath();
            string       fileName;
            string       filePathAndName;
            EmailAddress emailAddress;
            Patient      patCur = Patients.GetPat(SheetCur.PatNum);

            if (patCur == null)
            {
                emailAddress = EmailAddresses.GetByClinic(0);
            }
            else
            {
                emailAddress = EmailAddresses.GetByClinic(patCur.ClinicNum);
            }
            //Graphics g=this.CreateGraphics();
            if (FormS.EmailPatOrLab)
            {
                fileName        = DateTime.Now.ToString("yyyyMMdd") + "_" + DateTime.Now.TimeOfDay.Ticks.ToString() + rnd.Next(1000).ToString() + ".pdf";
                filePathAndName = ODFileUtils.CombinePaths(attachPath, fileName);
                SheetPrinting.CreatePdf(SheetCur, filePathAndName);
                //Process.Start(filePathAndName);
                message             = new EmailMessage();
                message.PatNum      = SheetCur.PatNum;
                message.ToAddress   = FormS.EmailPatOrLabAddress;
                message.FromAddress = emailAddress.SenderAddress;              //Can be blank just as it could with the old pref.
                message.Subject     = SheetCur.Description.ToString();         //this could be improved
                EmailAttach attach        = new EmailAttach();
                string      shortFileName = Regex.Replace(SheetCur.Description.ToString(), @"[^\w'@-_()&]", "");
                attach.DisplayedFileName = shortFileName + ".pdf";
                attach.ActualFileName    = fileName;
                message.Attachments.Add(attach);
                FormEmailMessageEdit FormE = new FormEmailMessageEdit(message);
                FormE.IsNew = true;
                FormE.ShowDialog();
            }
            if ((SheetCur.SheetType == SheetTypeEnum.ReferralSlip ||
                 SheetCur.SheetType == SheetTypeEnum.ReferralLetter) &&
                FormS.Email2)
            {
                //email referral
                fileName        = DateTime.Now.ToString("yyyyMMdd") + "_" + DateTime.Now.TimeOfDay.Ticks.ToString() + rnd.Next(1000).ToString() + ".pdf";
                filePathAndName = ODFileUtils.CombinePaths(attachPath, fileName);
                SheetPrinting.CreatePdf(SheetCur, filePathAndName);
                //Process.Start(filePathAndName);
                message             = new EmailMessage();
                message.PatNum      = SheetCur.PatNum;
                message.ToAddress   = FormS.Email2Address;
                message.FromAddress = emailAddress.SenderAddress;                                         //Can be blank just as it could with the old pref.
                message.Subject     = Lan.g(this, "RE: ") + Patients.GetLim(SheetCur.PatNum).GetNameLF(); //works even if patnum invalid
                //SheetCur.Description.ToString()+" to "+Referrals.GetNameFL(referral.ReferralNum);//this could be improved
                EmailAttach attach        = new EmailAttach();
                string      shortFileName = Regex.Replace(SheetCur.Description.ToString(), @"[^\w,'@-_()&]", "");
                attach.DisplayedFileName = shortFileName + ".pdf";
                attach.ActualFileName    = fileName;
                message.Attachments.Add(attach);
                FormEmailMessageEdit FormE = new FormEmailMessageEdit(message);
                FormE.IsNew = true;
                FormE.ShowDialog();
            }
            //g.Dispose();
            DialogResult = DialogResult.OK;
        }
예제 #26
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);
                }
            }
        }
예제 #27
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);
                }
            }
        }
예제 #28
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.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);
                }
            }
        }
예제 #29
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;
                }
            }
        }
예제 #30
0
        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;
                }
            }
        }