Example #1
0
        public void Reactivations_GetReactivationList_PatientMarkedDoNotContact()
        {
            string  name    = MethodBase.GetCurrentMethod().Name;
            Clinic  clinic  = ClinicT.CreateClinic(name);
            long    provNum = ProviderT.CreateProvider(name);
            Patient pat     = PatientT.CreatePatient(name, provNum, clinic.ClinicNum, TestEmaiAddress, TestPatPhone, ContactMethod.Mail);
            //Patient has not been seen since further in the past than the ReactivationDaysPast preference.
            Procedure proc = ProcedureT.CreateProcedure(pat, "D0120", ProcStat.C, "", 50, procDate: DateTime.Now.AddYears(-3), provNum: provNum);   //3 year old proc
            //Patient has been contacted, and the ReactivationContactInterval has elapsed.
            Commlog comm = new Commlog()
            {
                PatNum         = pat.PatNum,
                CommDateTime   = DateTime.Now.AddYears(-1),
                CommType       = _reactivationCommLogType,
                Mode_          = CommItemMode.Email,
                SentOrReceived = CommSentOrReceived.Sent,
                CommSource     = CommItemSource.ApptReminder,
            };

            comm.CommlogNum = Commlogs.Insert(comm);
            //Patient has been marked "Do Not Contact"
            Reactivations.Insert(new Reactivation()
            {
                PatNum       = pat.PatNum,
                DoNotContact = true,
            });
            DateTime dateSince = DateTime.Today.AddDays(-PrefC.GetInt(PrefName.ReactivationDaysPast));
            DateTime dateStop  = dateSince.AddMonths(-36);
            //Confirm that the patient does not in the Reactivation List
            DataTable tbl = Reactivations.GetReactivationList(dateSince, dateStop, false, false, true, provNum, clinic.ClinicNum, 0, 0
                                                              , ReactivationListSort.LastContacted, RecallListShowNumberReminders.One);

            //No patients in the list
            Assert.AreEqual(0, tbl.Rows.Count);
        }
        private void butOK_Click(object sender, System.EventArgs e)
        {
            Def  selectedStatus  = comboStatus.GetSelected <Def>();       //Null when 'None' is selected.
            bool didStatusChange = (_reactivationCur.ReactivationStatus != (selectedStatus?.DefNum ?? 0));

            _reactivationCur.ReactivationStatus = selectedStatus == null?0:selectedStatus.DefNum;
            _reactivationCur.ReactivationNote   = textNote.Text;
            _reactivationCur.DoNotContact       = checkBoxDNC.Checked;
            if (_reactivationCur.IsNew)
            {
                Reactivations.Insert(_reactivationCur);
            }
            else
            {
                Reactivations.Update(_reactivationCur);
            }
            if (didStatusChange)
            {
                //If the reactivation status is changing, we need to create a reactivation commlog. Rather than repeating
                //this logic, return a different DialogResult and use that as an indicator to the parent window (currently only
                //FormRecallList) that it should create the commlog and do any other required logic.
                DialogResult = DialogResult.Yes;
            }
            else
            {
                //Status didn't change, we don't need to do anything special
                DialogResult = DialogResult.OK;
            }
        }
        private void FormReactivationEdit_Load(object sender, System.EventArgs e)
        {
            textPatName.Text = Patients.GetNameFL(_reactivationCur.PatNum);
            DateTime lastContacted = Reactivations.GetDateLastContacted(_reactivationCur.PatNum);

            textDateLastContacted.Text = lastContacted == DateTime.MinValue?"":lastContacted.ToString();
            comboStatus.Items.AddDefNone();
            comboStatus.Items.AddDefs(Defs.GetDefsForCategory(DefCat.RecallUnschedStatus));
            comboStatus.SetSelectedDefNum(_reactivationCur.ReactivationStatus);
            checkBoxDNC.Checked = _reactivationCur.DoNotContact;
        }
 private void butDelete_Click(object sender, System.EventArgs e)
 {
     if (!MsgBox.Show(this, MsgBoxButtons.YesNo, "Delete this Reactivation?"))
     {
         return;
     }
     if (!_reactivationCur.IsNew)
     {
         Reactivations.Delete(_reactivationCur.ReactivationNum);
     }
     _reactivationCur = null;
     DialogResult     = DialogResult.Abort;
 }