コード例 #1
0
 private void butPin_Click(object sender, System.EventArgs e)
 {
     if (odApptGrid.SelectedApptOther == null)
     {
         MsgBox.Show(this, "Please select appointment first.");
         return;
     }
     if (odApptGrid.IsSelectedApptOtherNull())
     {
         return;
     }
     if (PatRestrictionL.IsRestricted(_patCur.PatNum, PatRestrict.ApptSchedule))
     {
         return;
     }
     if (!AppointmentL.OKtoSendToPinboard(odApptGrid.SelectedApptOther, odApptGrid.ListApptOthers, this))           //Tag is AptNum
     {
         return;
     }
     ListAptNumsSelected.Add(odApptGrid.SelectedApptOther.AptNum);
     _otherResult = OtherResult.CopyToPinBoard;
     DialogResult = DialogResult.OK;
 }
コード例 #2
0
 private void butNew_Click(object sender, System.EventArgs e)
 {
     if (!Security.IsAuthorized(Permissions.AppointmentCreate))
     {
         return;
     }
     if (PatRestrictionL.IsRestricted(_patCur.PatNum, PatRestrict.ApptSchedule))
     {
         return;
     }
     if (AppointmentL.PromptForMerge(_patCur, out _patCur))
     {
         FillFamily();
         odApptGrid.PatCur = _patCur;
         odApptGrid.RefreshAppts();
         FormOpenDental.S_Contr_PatientSelected(_patCur, true, false);
     }
     if (_patCur != null && _patCur.PatStatus.In(PatientStatus.Archived, PatientStatus.Deceased))
     {
         MsgBox.Show(this, "Appointments cannot be scheduled for " + _patCur.PatStatus.ToString().ToLower() + " patients.");
         return;
     }
     MakeAppointment();
 }
コード例 #3
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;
        }
コード例 #4
0
        private void butNote_Click(object sender, EventArgs e)
        {
            if (!Security.IsAuthorized(Permissions.AppointmentCreate))
            {
                return;
            }
            if (PatRestrictionL.IsRestricted(_patCur.PatNum, PatRestrict.ApptSchedule))
            {
                return;
            }
            Appointment aptCur = new Appointment();

            aptCur.PatNum = _patCur.PatNum;
            if (_patCur.DateFirstVisit.Year < 1880 &&
                !Procedures.AreAnyComplete(_patCur.PatNum))                   //this only runs if firstVisit blank
            {
                aptCur.IsNewPatient = true;
            }
            aptCur.Pattern = "/X/";
            if (_patCur.PriProv == 0)
            {
                aptCur.ProvNum = PrefC.GetLong(PrefName.PracticeDefaultProv);
            }
            else
            {
                aptCur.ProvNum = _patCur.PriProv;
            }
            aptCur.ProvHyg    = _patCur.SecProv;
            aptCur.AptStatus  = ApptStatus.PtNote;
            aptCur.ClinicNum  = _patCur.ClinicNum;
            aptCur.TimeLocked = PrefC.GetBool(PrefName.AppointmentTimeIsLocked);
            if (IsInitialDoubleClick)             //initially double clicked on appt module
            {
                aptCur.AptDateTime = DateTimeClicked;
                aptCur.Op          = OpNumClicked;
            }
            else
            {
                //new appt will be placed on pinboard instead of specific time
            }
            try {
                if (!AppointmentL.IsSpecialtyMismatchAllowed(_patCur.PatNum, aptCur.ClinicNum))
                {
                    return;
                }
                Appointments.Insert(aptCur);
            }
            catch (ApplicationException ex) {
                MessageBox.Show(ex.Message);
                return;
            }
            FormApptEdit formApptEdit = new FormApptEdit(aptCur.AptNum);

            formApptEdit.IsNew = true;
            formApptEdit.ShowDialog();
            if (formApptEdit.DialogResult != DialogResult.OK)
            {
                return;
            }
            ListAptNumsSelected.Add(aptCur.AptNum);
            if (IsInitialDoubleClick)
            {
                _otherResult = OtherResult.CreateNew;
            }
            else
            {
                _otherResult = OtherResult.NewToPinBoard;
            }
            DialogResult = DialogResult.OK;
        }
コード例 #5
0
        ///<summary>Creates a single recall appointment. If it's from a double click, then it will end up on that spot in the Appts module.  If not, it will end up on the pinboard with StringDateJumpTo as due date to jump to.  ListAptNumsSelected will contain the AptNum of the new appointment.</summary>
        public void MakeRecallAppointment()
        {
            List <InsSub>  listInsSubs  = InsSubs.RefreshForFam(_famCur);
            List <InsPlan> listInsPlans = InsPlans.RefreshForSubList(listInsSubs);
            Appointment    apt          = null;
            DateTime       dateTimeApt  = DateTime.MinValue;

            if (this.IsInitialDoubleClick)
            {
                dateTimeApt = DateTimeClicked;
            }
            try{
                apt = AppointmentL.CreateRecallApt(_patCur, listInsPlans, -1, listInsSubs, dateTimeApt);
            }
            catch (Exception ex) {
                MessageBox.Show(ex.Message);
                return;
            }
            DateTime datePrevious = apt.DateTStamp;

            ListAptNumsSelected.Add(apt.AptNum);
            if (IsInitialDoubleClick)
            {
                Appointment oldApt = apt.Copy();
                if (_patCur.AskToArriveEarly > 0)
                {
                    apt.DateTimeAskedToArrive = apt.AptDateTime.AddMinutes(-_patCur.AskToArriveEarly);
                    MessageBox.Show(Lan.g(this, "Ask patient to arrive") + " " + _patCur.AskToArriveEarly
                                    + " " + Lan.g(this, "minutes early at") + " " + apt.DateTimeAskedToArrive.ToShortTimeString() + ".");
                }
                apt.AptStatus = ApptStatus.Scheduled;
                apt.ClinicNum = _patCur.ClinicNum;
                apt.Op        = OpNumClicked;
                apt           = Appointments.AssignFieldsForOperatory(apt);
                //Use apt.ClinicNum because it was just set based on Op.ClinicNum in AssignFieldsForOperatory().
                if (!AppointmentL.IsSpecialtyMismatchAllowed(_patCur.PatNum, apt.ClinicNum))
                {
                    return;
                }
                Appointments.Update(apt, oldApt);
                _otherResult = OtherResult.CreateNew;
                SecurityLogs.MakeLogEntry(Permissions.AppointmentCreate, apt.PatNum, apt.AptDateTime.ToString(), apt.AptNum, datePrevious);
                //If there is an existing HL7 def enabled, send a SIU message if there is an outbound SIU message defined
                if (HL7Defs.IsExistingHL7Enabled())
                {
                    //S12 - New Appt Booking event
                    MessageHL7 messageHL7 = MessageConstructor.GenerateSIU(_patCur, _famCur.GetPatient(_patCur.Guarantor), EventTypeHL7.S12, apt);
                    //Will be null if there is no outbound SIU message defined, so do nothing
                    if (messageHL7 != null)
                    {
                        HL7Msg hl7Msg = new HL7Msg();
                        hl7Msg.AptNum    = apt.AptNum;
                        hl7Msg.HL7Status = HL7MessageStatus.OutPending;                      //it will be marked outSent by the HL7 service.
                        hl7Msg.MsgText   = messageHL7.ToString();
                        hl7Msg.PatNum    = _patCur.PatNum;
                        HL7Msgs.Insert(hl7Msg);
#if DEBUG
                        MessageBox.Show(this, messageHL7.ToString());
#endif
                    }
                }
                DialogResult = DialogResult.OK;
                return;
            }
            //not initialClick
            _otherResult = OtherResult.PinboardAndSearch;
            Recall recall = Recalls.GetRecallProphyOrPerio(_patCur.PatNum);          //shouldn't return null.
            if (recall.DateDue < DateTime.Today)
            {
                StringDateJumpTo = DateTime.Today.ToShortDateString();              //they are overdue
            }
            else
            {
                StringDateJumpTo = recall.DateDue.ToShortDateString();
            }
            //no securitylog entry needed here.  That will happen when it's dragged off pinboard.
            DialogResult = DialogResult.OK;
        }