Esempio n. 1
0
        private void SendPinboard_Click()
        {
            if (grid.SelectedIndices.Length == 0)
            {
                MsgBox.Show("Please select an appointment first.");
                return;
            }
            _listAptSelected.Clear();
            int patsRestricted = 0;

            for (int i = 0; i < grid.SelectedIndices.Length; i++)
            {
                if (PatRestrictionL.IsRestricted(_listUnschedApt[grid.SelectedIndices[i]].PatNum, PatRestrict.ApptSchedule, true))
                {
                    patsRestricted++;
                    continue;
                }
                _listAptSelected.Add(_listUnschedApt[grid.SelectedIndices[i]].AptNum);
            }
            if (patsRestricted > 0)
            {
                if (_listAptSelected.Count == 0)
                {
                    MsgBox.Show("All selected appointments have been skipped due to patient restriction "
                                + PatRestrictions.GetPatRestrictDesc(PatRestrict.ApptSchedule) + ".");
                    return;
                }
                MessageBox.Show("Appointments skipped due to patient restriction " + PatRestrictions.GetPatRestrictDesc(PatRestrict.ApptSchedule)
                                + ": " + patsRestricted + ".");
            }
            GotoModule.PinToAppt(_listAptSelected, 0);           //This will send all appointments in _listAptSelected to the pinboard, and will select the patient attached to the last appointment in _listAptSelected.
        }
Esempio n. 2
0
        ///<summary>Creates appointments for each patient in _famCur.  MsgBox informs user of anyone skipped.  StringDateJumpTo will contain the due date (of the last family member) to jump to.  ListAptNumsSelected will contain the AptNums of the new appointments on the pinboard.</summary>
        public void MakeRecallFamily()
        {
            List <Recall>  listPatRecalls;
            List <InsPlan> listInsPlans;
            List <InsSub>  listInsSubs;
            Appointment    apt = null;
            Recall         recall;
            int            countAlreadySched           = 0;
            int            countNoRecalls              = 0;
            int            countPatsRestricted         = 0;
            int            countPatsArchivedOrDeceased = 0;

            for (int i = 0; i < _famCur.ListPats.Length; i++)
            {
                Patient patCur = _famCur.ListPats[i];
                if (PatRestrictionL.IsRestricted(patCur.PatNum, PatRestrict.ApptSchedule, true))
                {
                    countPatsRestricted++;
                    continue;
                }
                if (patCur.PatStatus.In(PatientStatus.Archived, PatientStatus.Deceased))
                {
                    countPatsArchivedOrDeceased++;
                    continue;
                }
                listPatRecalls = Recalls.GetList(patCur.PatNum);              //get the recall for this pt
                //Check to see if the special type recall is disabled or already scheduled.  This is also done in AppointmentL.CreateRecallApt() below so I'm
                //	not sure why we do it here.
                List <Recall> listRecalls = listPatRecalls.FindAll(x => x.RecallTypeNum == RecallTypes.PerioType || x.RecallTypeNum == RecallTypes.ProphyType);
                if (listRecalls.Count == 0 || listRecalls.Exists(x => x.IsDisabled))
                {
                    countNoRecalls++;
                    continue;
                }
                if (listRecalls.Exists(x => x.DateScheduled.Year > 1880))
                {
                    countAlreadySched++;
                    continue;
                }
                listInsSubs  = InsSubs.RefreshForFam(_famCur);
                listInsPlans = InsPlans.RefreshForSubList(listInsSubs);
                try {
                    apt = AppointmentL.CreateRecallApt(patCur, listInsPlans, -1, listInsSubs);
                }
                catch (Exception ex) {
                    ex.DoNothing();
                    continue;
                }
                ListAptNumsSelected.Add(apt.AptNum);
                _otherResult = OtherResult.PinboardAndSearch;
                recall       = Recalls.GetRecallProphyOrPerio(patCur.PatNum);        //should not return null
                if (recall.DateDue < DateTime.Today)
                {
                    StringDateJumpTo = DateTime.Today.ToShortDateString();                  //they are overdue
                }
                else
                {
                    StringDateJumpTo = recall.DateDue.ToShortDateString();
                }
                //Log will be made when appointment dragged off of the pinboard.
                //SecurityLogs.MakeLogEntry(Permissions.AppointmentCreate,apt.PatNum,apt.AptDateTime.ToString(),apt.AptNum);
            }
            List <string> listUserMsgs = new List <string>();

            if (countPatsRestricted > 0)
            {
                listUserMsgs.Add(Lan.g(this, "Family members skipped due to patient restriction") + " "
                                 + PatRestrictions.GetPatRestrictDesc(PatRestrict.ApptSchedule) + ": " + countPatsRestricted + ".");
            }
            if (countNoRecalls > 0)
            {
                listUserMsgs.Add(Lan.g(this, "Family members skipped because recall disabled") + ": " + countNoRecalls + ".");
            }
            if (countAlreadySched > 0)
            {
                listUserMsgs.Add(Lan.g(this, "Family members skipped because already scheduled") + ": " + countAlreadySched + ".");
            }
            if (countPatsArchivedOrDeceased > 0)
            {
                listUserMsgs.Add(Lan.g(this, "Family members skipped because status is archived or deceased") + ": " + countPatsArchivedOrDeceased + ".");
            }
            if (ListAptNumsSelected.Count == 0)
            {
                listUserMsgs.Add(Lan.g(this, "There are no recall appointments to schedule."));
            }
            if (listUserMsgs.Count > 0)
            {
                MessageBox.Show(string.Join("\r\n", listUserMsgs));
                if (ListAptNumsSelected.Count == 0)
                {
                    return;
                }
            }
            DialogResult = DialogResult.OK;
        }
Esempio n. 3
0
 ///<summary>Checks for an existing patrestriction for the specified patient and PatRestrictType. If one exists returns true.
 ///boolean to suppress or show message. If suppress message is false, will display msgbox.</summary>
 public static bool IsRestricted(long patNum, PatRestrict patRestrictType, bool suppressMessage = false)
 {
     if (PatRestrictions.IsRestricted(patNum, patRestrictType))
     {
         if (!suppressMessage)
         {
             MessageBox.Show(Lans.g("PatRestrictions", "Not allowed due to patient restriction") + "\r\n" + PatRestrictions.GetPatRestrictDesc(patRestrictType));
         }
         return(true);
     }
     else
     {
         return(false);
     }
 }