Beispiel #1
0
        public static ApptReminderRule CreateApptReminderRule(long clinicNum, ApptReminderType type, TimeSpan tsPrior,
                                                              bool isSendAll           = true, CommType priority1 = CommType.Preferred, CommType priority2 = CommType.Text, CommType priority3 = CommType.Email,
                                                              TimeSpan doNotSendWithin = default(TimeSpan), bool isAutoReplyEnabled = true)
        {
            ApptReminderRule clinicRule = ApptReminderRules.CreateDefaultReminderRule(type, clinicNum);

            clinicRule.TSPrior   = tsPrior;
            clinicRule.IsSendAll = isSendAll;
            clinicRule.SendOrder = string.Join(",", new List <CommType>()
            {
                priority1, priority2, priority3
            }.Select(x => ((int)x).ToString()).ToArray());
            clinicRule.DoNotSendWithin = doNotSendWithin;
            if (type == ApptReminderType.PatientPortalInvite && clinicNum > 0)
            {
                clinicRule.SendOrder = "2";              //Email only
                clinicRule.IsSendAll = false;
                if (ClinicPrefs.Upsert(PrefName.PatientPortalInviteEnabled, clinicNum, "1")
                    | ClinicPrefs.Upsert(PrefName.PatientPortalInviteUseDefaults, clinicNum, "0"))
                {
                    ClinicPrefs.RefreshCache();
                }
            }
            clinicRule.IsAutoReplyEnabled = isAutoReplyEnabled;
            ApptReminderRules.Insert(clinicRule);
            return(clinicRule);
        }
Beispiel #2
0
        /// <summary>Returns the list of replacement tags available for the passed in ApptReminderRuleType.</summary>
        public static List <string> GetAvailableTags(ApptReminderType type)
        {
            List <string> retVal = new List <string>()
            {
                "[NameF]",
                "[ApptTime]",
                "[ApptTimeAskedArrive]",
                "[ApptDate]",
                "[ClinicName]",
                "[ClinicPhone]",
                "[ProvName]",
                "[ProvAbbr]",
                "[PracticeName]",
                "[PracticePhone]"
            };

            if (type == ApptReminderType.ConfirmationFutureDay)
            {
                retVal.AddRange(new[] {
                    "[ConfirmCode]",
                    "[ConfirmURL]"
                });
            }
            else if (type == ApptReminderType.PatientPortalInvite)
            {
                retVal.AddRange(new[] {
                    "[UserName]",
                    "[Password]",
                    "[PatientPortalURL]"
                });
            }
            retVal.Sort();            //alphabetical
            return(retVal);
        }
        public void ApptReminderRules_IsShortCode_DefaultsAndClinicOverrides()
        {
            long clinicNum = 1;

            foreach (ShortCodeTypeFlag flag in Enum.GetValues(typeof(ShortCodeTypeFlag)).AsEnumerable <ShortCodeTypeFlag>()
                     .Where(x => x != ShortCodeTypeFlag.None))
            {
                ApptReminderType type = flag.GetAttributeOrDefault <ShortCodeAttribute>().ApptReminderType;
                //Set default clinic OFF for Short Codes for the corresponding ApptReminderType.
                ClinicPrefs.Upsert(PrefName.ShortCodeApptReminderTypes, 0, POut.Long(0));
                //Set clinicA OFF for Short Codes for the corresponding ApptReminderType.
                ClinicPrefs.Upsert(PrefName.ShortCodeApptReminderTypes, clinicNum, POut.Long(0));
                ClinicPrefs.RefreshCache();
                Assert.IsFalse(ApptReminderRules.IsShortCode(type, clinicNum));
                //Set clinicA ON for Short Codes for the corresponding ApptReminderType.
                ClinicPrefs.Upsert(PrefName.ShortCodeApptReminderTypes, clinicNum, POut.Long((long)flag));
                ClinicPrefs.RefreshCache();
                Assert.IsTrue(ApptReminderRules.IsShortCode(type, clinicNum));

                //Set default clinic ON for Short Codes for the corresponding ApptReminderType.
                ClinicPrefs.Upsert(PrefName.ShortCodeApptReminderTypes, 0, POut.Long((long)flag));
                //Set clinicA OFF for Short Codes for the corresponding ApptReminderType.
                ClinicPrefs.Upsert(PrefName.ShortCodeApptReminderTypes, clinicNum, POut.Long(0));
                ClinicPrefs.RefreshCache();
                Assert.IsTrue(ApptReminderRules.IsShortCode(type, clinicNum));
                //Set clinicA ON for Short Codes for the corresponding ApptReminderType.
                ClinicPrefs.Upsert(PrefName.ShortCodeApptReminderTypes, clinicNum, POut.Long((long)flag));
                ClinicPrefs.RefreshCache();
                Assert.IsTrue(ApptReminderRules.IsShortCode(type, clinicNum));
            }
        }
Beispiel #4
0
        /// <summary>Returns the list of replacement tags available for the Aggregate Templates for the passed in ApptReminderRuleType.</summary>
        public static List <string> GetAvailableAggTags(ApptReminderType type)
        {
            List <string> retVal = GetAvailableTags(type);

            retVal.Add("[Appts]");            //[Appts] is used for child nodes
            retVal.Sort();
            return(retVal);
        }
Beispiel #5
0
        ///<summary>Determines if this clinic is set to use Short Codes for this ApptReminderType.</summary>
        private static bool IsUsingShortCodesForType(ApptReminderType type, long clinicNum)
        {
            //ClinicPrefs.GetLong() returns 0 if pref not found.
            List <ApptReminderType> listUsingShortCodes = ((ShortCodeTypeFlag)ClinicPrefs.GetLong(PrefName.ShortCodeApptReminderTypes, clinicNum))
                                                          .GetFlags()
                                                          .Select(x => x.GetAttributeOrDefault <ShortCodeAttribute>().ApptReminderType).ToList();

            return(type.In(listUsingShortCodes));
        }
Beispiel #6
0
        public static ApptReminderRule CreateDefaultReminderRule(ApptReminderType ruleType, long clinicNum = 0, bool isBeforeAppointment = true)
        {
            switch (ruleType)
            {
            case ApptReminderType.Reminder:
                return(new ApptReminderRule()
                {
                    ClinicNum = clinicNum,                          //works with practice too because _listClinics[0] is a spoofed "Practice/Defaults" clinic with ClinicNum=0
                    TypeCur = ApptReminderType.Reminder,
                    TSPrior = TimeSpan.FromHours(3),
                    TemplateSMS = "Appointment Reminder: [NameF] is scheduled for [ApptTime] on [ApptDate] at [ClinicName]. If you have questions call [ClinicPhone].", //default message
                    TemplateEmail = "[NameF] is scheduled for [ApptTime] on [ApptDate] at [OfficeName]. If you have questions, call [OfficePhone].",                    //default message
                    TemplateEmailSubject = "Appointment Reminder",                                                                                                      //default subject
                    TemplateSMSAggShared = "Appointment Reminder:\n[Appts]\nIf you have questions call [ClinicPhone].",
                    TemplateSMSAggPerAppt = "[NameF] is scheduled for [ApptTime] on [ApptDate] at [ClinicName].",
                    TemplateEmailSubjAggShared = "Appointment Reminder",
                    TemplateEmailAggShared = "[Appts]\nIf you have questions, call [OfficePhone].",
                    TemplateEmailAggPerAppt = "[NameF] is scheduled for [ApptTime] on [ApptDate] at [ClinicName].",
                    //SendOrder="0,1,2" //part of ctor
                });

            case ApptReminderType.ConfirmationFutureDay:
                return(new ApptReminderRule()
                {
                    ClinicNum = clinicNum,                          //works with practice too because _listClinics[0] is a spoofed "Practice/Defaults" clinic with ClinicNum=0
                    TypeCur = ApptReminderType.ConfirmationFutureDay,
                    TSPrior = TimeSpan.FromDays(7),
                    TemplateSMS = "[NameF] is scheduled for [ApptTime] on [ApptDate] at [OfficeName]. Reply [ConfirmCode] to confirm or call [OfficePhone].",  //default message
                    TemplateEmail = "[NameF] is scheduled for [ApptTime] on [ApptDate] at [OfficeName]. Click [ConfirmURL] to confirm or call [OfficePhone].", //default message
                    TemplateEmailSubject = "Appointment Confirmation",                                                                                         //default subject
                    TemplateSMSAggShared = "[Appts]\nReply [ConfirmCode] to confirm or call [OfficePhone].",
                    TemplateSMSAggPerAppt = "[NameF] is scheduled for [ApptTime] on [ApptDate] at [ClinicName].",
                    TemplateEmailSubjAggShared = "Appointment Confirmation",
                    TemplateEmailAggShared = "[Appts]\nClick [ConfirmURL] to confirm or call [OfficePhone].",
                    TemplateEmailAggPerAppt = "[NameF] is scheduled for [ApptTime] on [ApptDate] at [ClinicName].",
                    //SendOrder="0,1,2" //part of ctor
                    DoNotSendWithin = TimeSpan.FromDays(1).Add(TimeSpan.FromHours(10)),
                });

            case ApptReminderType.PatientPortalInvite:
                if (isBeforeAppointment)
                {
                    return(new ApptReminderRule()
                    {
                        ClinicNum = clinicNum,
                        TypeCur = ApptReminderType.PatientPortalInvite,
                        TSPrior = TimeSpan.FromDays(7),
                        TemplateEmail = @"[NameF],
			
In preparation for your upcoming dental appointment at [OfficeName], we invite you to log in to our Patient Portal. " + @"
There you can view your scheduled appointments, view your treatment plan, send a message to your provider, and view your account balance. " + @"
Visit [PatientPortalURL] and use this temporary user name and password to log in:

User name: [UserName]
Password: [Password]

If you have any questions, please give us a call at [OfficePhone], and we would be happy to answer any of your questions.",
                        TemplateEmailSubject = "Patient Portal Invitation",
                        TemplateEmailSubjAggShared = "Patient Portal Invitation",
                        TemplateEmailAggShared = @"[NameF],
			
In preparation for your upcoming dental appointments at [OfficeName], we invite you to log in to our Patient Portal. " + @"
There you can view your scheduled appointments, view your treatment plan, send a message to your provider, and view your account balance. " + @"
Visit [PatientPortalURL] and use these temporary user names and passwords to log in:

[Credentials]
If you have any questions, please give us a call at [OfficePhone], and we would be happy to answer any of your questions.",
                        TemplateEmailAggPerAppt = @"[NameF]
User name: [UserName]
Password: [Password]
",
                        SendOrder = "2"                               //Email only
                    });
                }
                else                          //Same day
                {
                    return(new ApptReminderRule()
                    {
                        ClinicNum = clinicNum,
                        TypeCur = ApptReminderType.PatientPortalInvite,
                        TSPrior = new TimeSpan(-1, 0, 0),                            //Send 1 hour after the appointment
                        TemplateEmail = @"[NameF],
			
Thank you for coming in to visit [OfficeName] today. As a follow up to your appointment, we invite you to log in to our Patient Portal. " + @"
There you can view your scheduled appointments, view your treatment plan, send a message to your provider, and view your account balance. " + @"
Visit [PatientPortalURL] and use this temporary user name and password to log in:

User name: [UserName]
Password: [Password]

If you have any questions, please give us a call at [OfficePhone], and we would be happy to answer any of your questions.",
                        TemplateEmailSubject = "Patient Portal Invitation",
                        TemplateEmailSubjAggShared = "Patient Portal Invitation",
                        TemplateEmailAggShared = @"[NameF],
			
Thank you for coming in to visit [OfficeName] today. As a follow up to your appointment, we invite you to log in to our Patient Portal. " + @"
There you can view your scheduled appointments, view your treatment plan, send a message to your provider, and view your account balance. " + @"
Visit [PatientPortalURL] and use these temporary user names and passwords to log in:

[Credentials]
If you have any questions, please give us a call at [OfficePhone], and we would be happy to answer any of your questions.",
                        TemplateEmailAggPerAppt = @"[NameF]
User name: [UserName]
Password: [Password]
",
                        SendOrder = "2"                               //Email only
                    });
                }
            }
            return(null);
        }
Beispiel #7
0
 ///<summary>Determines if an ApptReminderType uses Short Codes for a clinic.  True if either the clinic is configured to use Short Codes for this
 ///rule type, or the default clinic is configured to use Short Codes for this rule type.  Short Codes are configured by HQ, whereas setting a
 ///clinic to use practice default rules is done by the user.</summary>
 public static bool IsShortCode(ApptReminderType type, long clinicNum)
 {
     return(IsUsingShortCodesForType(type, clinicNum) || IsUsingShortCodesForType(type, 0));
 }
Beispiel #8
0
        public static ApptReminderRule CreateDefaultReminderRule(ApptReminderType ruleType, long clinicNum = 0, bool isBeforeAppointment = true)
        {
            ApptReminderRule rule = null;

            switch (ruleType)
            {
            case ApptReminderType.Reminder:
                rule = new ApptReminderRule()
                {
                    ClinicNum                  = clinicNum,         //works with practice too because _listClinics[0] is a spoofed "Practice/Defaults" clinic with ClinicNum=0
                    TypeCur                    = ApptReminderType.Reminder,
                    TSPrior                    = TimeSpan.FromHours(3),
                    TemplateSMS                = "Appointment Reminder: [NameF] is scheduled for [ApptTime] on [ApptDate] at [ClinicName]. If you have questions call [ClinicPhone].", //default message
                    TemplateEmail              = @"[NameF],

Your appointment is scheduled for [ApptTime] on [ApptDate] at [OfficeName]. If you have questions, call <a href=""tel:[OfficePhone]"">[OfficePhone]</a>.",
                    TemplateEmailSubject       = "Appointment Reminder",                                                                                                               //default subject
                    TemplateSMSAggShared       = "Appointment Reminder:\n[Appts]\nIf you have questions call [ClinicPhone].",
                    TemplateSMSAggPerAppt      = "[NameF] is scheduled for [ApptTime] on [ApptDate] at [ClinicName].",
                    TemplateEmailSubjAggShared = "Appointment Reminder",
                    TemplateEmailAggShared     = @"[Appts]
If you have questions, call <a href=""tel:[OfficePhone]"">[OfficePhone]</a>.",
                    TemplateEmailAggPerAppt    = "[NameF] is scheduled for [ApptTime] on [ApptDate] at [ClinicName].",
                    //SendOrder="0,1,2" //part of ctor
                };
                break;

            case ApptReminderType.ConfirmationFutureDay:
                rule = new ApptReminderRule()
                {
                    ClinicNum     = clinicNum,                      //works with practice too because _listClinics[0] is a spoofed "Practice/Defaults" clinic with ClinicNum=0
                    TypeCur       = ApptReminderType.ConfirmationFutureDay,
                    TSPrior       = TimeSpan.FromDays(7),
                    TemplateSMS   = "[NameF] is scheduled for [ApptTime] on [ApptDate] at [OfficeName]. Reply [ConfirmCode] to confirm or call [OfficePhone].",                        //default message
                    TemplateEmail = @"[NameF], 

Your appointment is scheduled for [ApptTime] on [ApptDate] at [OfficeName]. Click <a href=""[ConfirmURL]"">[ConfirmURL]</a> to confirm " +
                                    @"or call <a href=""tel:[OfficePhone]"">[OfficePhone]</a>.",
                    TemplateEmailSubject       = "Appointment Confirmation",                    //default subject
                    TemplateSMSAggShared       = "[Appts]\nReply [ConfirmCode] to confirm or call [OfficePhone].",
                    TemplateSMSAggPerAppt      = "[NameF] is scheduled for [ApptTime] on [ApptDate] at [ClinicName].",
                    TemplateEmailSubjAggShared = "Appointment Confirmation",
                    TemplateEmailAggShared     = @"[Appts]
Click <a href=""[ConfirmURL]"">[ConfirmURL]</a> to confirm or call <a href=""tel:[OfficePhone]"">[OfficePhone]</a>.",
                    TemplateEmailAggPerAppt    = "[NameF] is scheduled for [ApptTime] on [ApptDate] at [ClinicName].",
                    //SendOrder="0,1,2" //part of ctor
                    DoNotSendWithin      = TimeSpan.FromDays(1).Add(TimeSpan.FromHours(10)),
                    TemplateAutoReply    = "Thank you for confirming your appointment with [OfficeName].  We look forward to seeing you.",
                    TemplateAutoReplyAgg = "Thank you for confirming your appointments with [OfficeName].  We look forward to seeing you",
                    IsAutoReplyEnabled   = true,
                };
                break;

            case ApptReminderType.PatientPortalInvite:
                if (isBeforeAppointment)
                {
                    rule = new ApptReminderRule()
                    {
                        ClinicNum                  = clinicNum,
                        TypeCur                    = ApptReminderType.PatientPortalInvite,
                        TSPrior                    = TimeSpan.FromDays(7),
                        TemplateEmail              = @"[NameF],
			
In preparation for your upcoming dental appointment at [OfficeName], we invite you to log in to our Patient Portal. " + @"
There you can view your scheduled appointments, view your treatment plan, send a message to your provider, and view your account balance. " + @"
Visit our <a href=""[PatientPortalURL]"">Patient Portal</a> and use this temporary user name and password to log in:

User name: [UserName]
Password: [Password]

If you have any questions, please give us a call at <a href=""tel:[OfficePhone]"">[OfficePhone]</a>, and we would be happy to answer any of your questions.",
                        TemplateEmailSubject       = "Patient Portal Invitation",
                        TemplateEmailSubjAggShared = "Patient Portal Invitation",
                        TemplateEmailAggShared     = @"[NameF],
			
In preparation for your upcoming dental appointments at [OfficeName], we invite you to log in to our Patient Portal. " + @"
There you can view your scheduled appointments, view your treatment plan, send a message to your provider, and view your account balance. " + @"
Visit our <a href=""[PatientPortalURL]"">Patient Portal</a> and use these temporary user names and passwords to log in:

[Credentials]
If you have any questions, please give us a call at <a href=""tel:[OfficePhone]"">[OfficePhone]</a>, and we would be happy to answer any of your questions.",
                        TemplateEmailAggPerAppt    = @"[NameF]
User name: [UserName]
Password: [Password]
",
                        SendOrder                  = "2"              //Email only
                    };
                    break;
                }
                else                          //Same day
                {
                    rule = new ApptReminderRule()
                    {
                        ClinicNum                  = clinicNum,
                        TypeCur                    = ApptReminderType.PatientPortalInvite,
                        TSPrior                    = new TimeSpan(-1, 0, 0),         //Send 1 hour after the appointment
                        TemplateEmail              = @"[NameF],
			
Thank you for coming in to visit [OfficeName] today. As a follow up to your appointment, we invite you to log in to our Patient Portal. " + @"
There you can view your scheduled appointments, view your treatment plan, send a message to your provider, and view your account balance. " + @"
Visit <a href=""[PatientPortalURL]"">Patient Portal</a> and use this temporary user name and password to log in:

User name: [UserName]
Password: [Password]

If you have any questions, please give us a call at <a href=""tel:[OfficePhone]"">[OfficePhone]</a>, and we would be happy to answer any of your questions.",
                        TemplateEmailSubject       = "Patient Portal Invitation",
                        TemplateEmailSubjAggShared = "Patient Portal Invitation",
                        TemplateEmailAggShared     = @"[NameF],
			
Thank you for coming in to visit [OfficeName] today. As a follow up to your appointment, we invite you to log in to our Patient Portal. " + @"
There you can view your scheduled appointments, view your treatment plan, send a message to your provider, and view your account balance. " + @"
Visit <a href=""[PatientPortalURL]"">Patient Portal</a> and use these temporary user names and passwords to log in:

[Credentials]
If you have any questions, please give us a call at <a href=""tel:[OfficePhone]"">[OfficePhone]</a>, and we would be happy to answer any of your questions.",
                        TemplateEmailAggPerAppt    = @"[NameF]
User name: [UserName]
Password: [Password]
",
                        SendOrder                  = "2"              //Email only
                    };
                    break;
                }

            case ApptReminderType.ScheduleThankYou:
                rule = new ApptReminderRule()
                {
                    ClinicNum                  = clinicNum,                                                                          //works with practice too because _listClinics[0] is a spoofed "Practice/Defaults" clinic with ClinicNum=0
                    TypeCur                    = ApptReminderType.ScheduleThankYou,
                    TSPrior                    = new TimeSpan(-1, 0, 0),                                                             //default to send thank you 1 hour after creating appointment.
                    TemplateSMS                = "[NameF], thank you for scheduling with [OfficeName] on [ApptDate] at [ApptTime].", //default message
                    TemplateEmail              = @"[NameF],

Thank you for scheduling your appointment with [OfficeName] on [ApptDate] at [ApptTime]. If you have questions, call <a href=""tel:[OfficePhone]"">[OfficePhone]</a>.",
                    TemplateEmailSubject       = "Appointment Thank You",                                                            //default subject
                    TemplateSMSAggShared       = "Thank you for scheduling these appointments: [Appts]",
                    TemplateSMSAggPerAppt      = "[NameF] for [ApptTime] on [ApptDate] at [ClinicName]",
                    TemplateEmailSubjAggShared = "Appointment Thank You",
                    TemplateEmailAggShared     = @"Thank you for scheduling these appointments: [Appts]
If you have questions, call <a href=""tel:[OfficePhone]"">[OfficePhone]</a>.",
                    TemplateEmailAggPerAppt    = "[NameF] is scheduled for [ApptTime] on [ApptDate] at [ClinicName].",
                    //SendOrder="0,1,2" //part of ctor
                    DoNotSendWithin = new TimeSpan(2, 0, 0),                        //Do not send within 2 hours of appointment.AptDateTime.
                };
                break;
            }
            if (PrefC.GetBool(PrefName.EmailDisclaimerIsOn))
            {
                rule.TemplateEmail          += "\r\n\r\n\r\n[EmailDisclaimer]";
                rule.TemplateEmailAggShared += "\r\n\r\n\r\n[EmailDisclaimer]";
            }
            return(rule);
        }