///<summary>The values returned are sent to the webserver.</summary> public static List <Recallm> GetMultRecallms(List <long> recallNums) { List <Recall> recallList = Recalls.GetMultRecalls(recallNums); List <Recallm> recallmList = ConvertListToM(recallList); return(recallmList); }
///<summary>Gets up to 30 days of open time slots based on the RecallType passed in. ///Open time slots are found by looping through operatories flagged for Web Sched and finding openings that can hold the RecallType. ///The RecallType passed in must be a valid recall type. ///Providers passed in will be the only providers considered when looking for available time slots. ///Passing in a null clinic will only consider operatories with clinics set to 0 (unassigned). ///The timeslots on and between the Start and End dates passed in will be considered and potentially returned as available. ///Optionally pass in a recall object in order to consider all other recalls due for the patient. This will potentially affect the time pattern. ///Throws exceptions.</summary> public static List <TimeSlot> GetAvailableWebSchedTimeSlots(RecallType recallType, List <Provider> listProviders, Clinic clinic , DateTime dateStart, DateTime dateEnd, Recall recallCur = null) { //No need to check RemotingRole; no call to db. if (recallType == null) //Validate that recallType is not null. { throw new ODException(Lans.g("WebSched", "The recall appointment you are trying to schedule is no longer available.") + "\r\n" + Lans.g("WebSched", "Please call us to schedule your appointment.")); } //Get all the Operatories that are flagged for Web Sched. List <Operatory> listOperatories = Operatories.GetOpsForWebSched(); if (listOperatories.Count < 1) //This is very possible for offices that aren't set up the way that we expect them to be. { throw new ODException(Lans.g("WebSched", "There are no operatories set up for Web Sched.") + "\r\n" + Lans.g("WebSched", "Please call us to schedule your appointment."), ODException.ErrorCodes.NoOperatoriesSetup); } List <long> listProvNums = listProviders.Select(x => x.ProvNum).Distinct().ToList(); List <Schedule> listSchedules = Schedules.GetSchedulesAndBlockoutsForWebSched(listProvNums, dateStart, dateEnd, true , (clinic == null) ? 0 : clinic.ClinicNum); string timePatternRecall = recallType.TimePattern; //Apparently scheduling this one recall can potentially schedule a bunch of other recalls at the same time. //We need to potentially bloat our time pattern based on the other recalls that are due for this specific patient. if (recallCur != null) { Patient patCur = Patients.GetLim(recallCur.PatNum); List <Recall> listRecalls = Recalls.GetList(recallCur.PatNum); timePatternRecall = Recalls.GetRecallTimePattern(recallCur, listRecalls, patCur, new List <string>()); } string timePatternAppointment = RecallTypes.ConvertTimePattern(timePatternRecall); return(GetTimeSlotsForRange(dateStart, dateEnd, timePatternAppointment, listProvNums, listOperatories, listSchedules, clinic)); }
///<summary>Gets most of the data necessary to fill the static text fields.</summary> public static StaticTextData GetStaticTextData(Patient pat, Family fam, List <long> listProcCodeNums) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { return(Meth.GetObject <StaticTextData>(MethodBase.GetCurrentMethod(), pat, fam, listProcCodeNums)); } StaticTextData data = new StaticTextData(); data.PatNote = PatientNotes.Refresh(pat.PatNum, pat.Guarantor); data.ListRefAttaches = RefAttaches.Refresh(pat.PatNum); data.ListSubs = InsSubs.RefreshForFam(fam); data.ListPlans = InsPlans.RefreshForSubList(data.ListSubs); data.ListPatPlans = PatPlans.Refresh(pat.PatNum); data.ListBenefits = Benefits.Refresh(data.ListPatPlans, data.ListSubs); data.HistList = ClaimProcs.GetHistList(pat.PatNum, data.ListBenefits, data.ListPatPlans, data.ListPlans, DateTime.Today, data.ListSubs); data.ListTreatPlans = TreatPlans.Refresh(pat.PatNum); data.ListRecallsForFam = Recalls.GetList(fam.ListPats.Select(x => x.PatNum).ToList()); data.ListAppts = Appointments.GetListForPat(pat.PatNum); data.ListFutureApptsForFam = Appointments.GetFutureSchedApts(fam.ListPats.Select(x => x.PatNum).ToList()); data.ListDiseases = Diseases.Refresh(pat.PatNum, true); data.ListAllergies = Allergies.GetAll(pat.PatNum, false); data.ListMedicationPats = MedicationPats.Refresh(pat.PatNum, false); data.ListFamPopups = Popups.GetForFamily(pat); data.ListProceduresSome = Procedures.RefreshForProcCodeNums(pat.PatNum, listProcCodeNums); return(data); }
///<summary></summary> public static Recall CreateRecall(long patNum, long recallTypeNum, DateTime dateDue, Interval recallInterval, long recallStatus = 0 , DateTime dateScheduled = new DateTime(), DateTime dateDueCalc = new DateTime(), DateTime datePrevious = new DateTime()) { Recall recall = new Recall(); recall.DateDue = dateDue; recall.DateDueCalc = dateDueCalc; recall.DatePrevious = datePrevious; recall.DateScheduled = dateScheduled; recall.PatNum = patNum; recall.RecallInterval = recallInterval; recall.RecallStatus = recallStatus; recall.RecallTypeNum = recallTypeNum; Recalls.Insert(recall); return(recall); }
///<summary>Follows the format of the Recall addrTable, used in the RecallList to duplicate functionality for mailing/emailing patients.</summary> public static DataTable GetAddrTable(List <Patient> listPats, List <Patient> listGuars, bool groupFamilies, ReactivationListSort sortBy) { DataTable table = Recalls.GetAddrTableStructure(); List <Patient> listPatsOrGuars = listPats; //Default to the list of patients passed in. //Utilize listGuars if groupFamilies is true so that family members do not get their own row. if (groupFamilies) { //This makes it so that we only return one family address even if the user has passed in every single member of the family. listPatsOrGuars = listGuars.FindAll(x => x.PatNum.In(listPats.Select(y => y.Guarantor))); } foreach (Patient pat in listPatsOrGuars) { Patient patCur = pat; //Always the guarantor if grouping by family, otherwise a selected patient. Patient guar = listGuars.FirstOrDefault(x => x.PatNum == pat.Guarantor); //Only include Patients that were selected, rather than all family members. List <Patient> listSelectedPatsInFam = listPats.Where(x => x.Guarantor == guar.PatNum).ToList(); if (listSelectedPatsInFam.Count == 1) //Selected patient may not be the guarantor. //So use first selected patient because this will result in an individual postcard, which should show the selected patient's name, not the //name of the guarantor. { patCur = listSelectedPatsInFam.First(); } DataRow row = table.NewRow(); row["address"] = patCur.Address + (!string.IsNullOrWhiteSpace(patCur.Address2)?Environment.NewLine + patCur.Address2:""); row["City"] = patCur.City; row["clinicNum"] = patCur.ClinicNum; row["dateDue"] = DateTime.MinValue; //This isn't used for reactivations, but it's here keep the table the same as recall addrTable row["email"] = patCur.Email; row["emailPatNum"] = patCur.PatNum; row["famList"] = listSelectedPatsInFam.Count > 1 ? string.Join(",", listSelectedPatsInFam.Select(x => x.FName)) : ""; row["guarLName"] = guar.LName; row["numberOfReminders"] = Reactivations.GetNumReminders(patCur.PatNum); row["patientNameF"] = patCur.GetNameFirstOrPreferred(); row["patientNameFL"] = patCur.GetNameFLnoPref(); row["patNums"] = patCur.PatNum; row["State"] = patCur.State; row["Zip"] = patCur.Zip; table.Rows.Add(row); } return(table); }
///<summary>Gets up to 30 days of open time slots based on the RecallType passed in. ///Open time slots are found by looping through operatories flagged for Web Sched and finding openings that can hold the RecallType. ///The RecallType passed in must be a valid recall type. ///Providers passed in will be the only providers considered when looking for available time slots. ///Passing in a null clinic will only consider operatories with clinics set to 0 (unassigned). ///The timeslots on and between the Start and End dates passed in will be considered and potentially returned as available. ///Optionally pass in a recall object in order to consider all other recalls due for the patient. This will potentially affect the time pattern. ///Throws exceptions.</summary> public static List <TimeSlot> GetAvailableWebSchedTimeSlots(RecallType recallType, List <Provider> listProviders, Clinic clinic , DateTime dateStart, DateTime dateEnd, Recall recallCur = null, Logger.IWriteLine log = null) { //No need to check RemotingRole; no call to db. if (recallType == null) //Validate that recallType is not null. { throw new ODException(Lans.g("WebSched", "The recall appointment you are trying to schedule is no longer available.") + "\r\n" + Lans.g("WebSched", "Please call us to schedule your appointment.")); } //Get all the Operatories that are flagged for Web Sched. List <Operatory> listOperatories = Operatories.GetOpsForWebSched(); if (listOperatories.Count < 1) //This is very possible for offices that aren't set up the way that we expect them to be. { throw new ODException(Lans.g("WebSched", "There are no operatories set up for Web Sched.") + "\r\n" + Lans.g("WebSched", "Please call us to schedule your appointment."), ODException.ErrorCodes.NoOperatoriesSetup); } log?.WriteLine("listOperatories:\r\n\t" + string.Join(",\r\n\t", listOperatories.Select(x => x.OperatoryNum + " - " + x.Abbrev)), LogLevel.Verbose); List <long> listProvNums = listProviders.Select(x => x.ProvNum).Distinct().ToList(); List <Schedule> listSchedules = Schedules.GetSchedulesAndBlockoutsForWebSched(listProvNums, dateStart, dateEnd, true , (clinic == null) ? 0 : clinic.ClinicNum, log); log?.WriteLine("listSchedules:\r\n\t" + string.Join(",\r\n\t", listSchedules.Select(x => x.ScheduleNum + " - " + x.SchedDate + " " + x.StartTime)) , LogLevel.Verbose); string timePatternRecall = recallType.TimePattern; //Apparently scheduling this one recall can potentially schedule a bunch of other recalls at the same time. //We need to potentially bloat our time pattern based on the other recalls that are due for this specific patient. if (recallCur != null) { Patient patCur = Patients.GetPat(recallCur.PatNum); List <Recall> listRecalls = Recalls.GetList(recallCur.PatNum); timePatternRecall = Recalls.GetRecallTimePattern(recallCur, listRecalls, patCur, new List <string>()); } string timePatternAppointment = RecallTypes.ConvertTimePattern(timePatternRecall); return(GetTimeSlotsForRange(dateStart, dateEnd, timePatternAppointment, listProvNums, listOperatories, listSchedules, clinic, log: log, isDoubleBookingAllowed: PrefC.GetInt(PrefName.WebSchedRecallDoubleBooking) == 0));//is double booking allowed according to the preference }
///<summary>Gets up to 30 days of open time slots based on the recall passed in. ///Open time slots are found by looping through operatories flagged for Web Sched and finding openings that can hold the recall. ///The amount of time required to be considered "available" is dictated by the RecallType associated to the recall passed in. ///Throws exceptions.</summary> public static List <TimeSlot> GetAvailableWebSchedTimeSlots(long recallNum, DateTime dateStart, DateTime dateEnd, long provNum = 0, bool allowOtherProv = true) { //No need to check RemotingRole; no call to db. Clinic clinic = Clinics.GetClinicForRecall(recallNum); Recall recall = Recalls.GetRecall(recallNum); if (recall == null) { throw new ODException(Lans.g("WebSched", "The recall appointment you are trying to schedule is no longer available.") + "\r\n" + Lans.g("WebSched", "Please call us to schedule your appointment.")); } List <Provider> listProviders = Providers.GetProvidersForWebSched(recall.PatNum); if (provNum > 0 && !allowOtherProv) { listProviders = listProviders.FindAll(x => x.ProvNum == provNum); } RecallType recallType = RecallTypes.GetFirstOrDefault(x => x.RecallTypeNum == recall.RecallTypeNum); return(GetAvailableWebSchedTimeSlots(recallType, listProviders, clinic, dateStart, dateEnd, recall)); }
///<summary>Gets up to 30 days of open time slots based on the recall passed in. ///Open time slots are found by looping through operatories flagged for Web Sched and finding openings that can hold the recall. ///The amount of time required to be considered "available" is dictated by the RecallType associated to the recall passed in. ///Throws exceptions.</summary> public static List <TimeSlot> GetAvailableWebSchedTimeSlots(long recallNum, DateTime dateStart, DateTime dateEnd, long provNum = 0, bool allowOtherProv = true, Logger.IWriteLine log = null) { //No need to check RemotingRole; no call to db. Clinic clinic = Clinics.GetClinicForRecall(recallNum); Recall recall = Recalls.GetRecall(recallNum); if (recall == null) { throw new ODException(Lans.g("WebSched", "The recall appointment you are trying to schedule is no longer available.") + "\r\n" + Lans.g("WebSched", "Please call us to schedule your appointment.")); } List <Provider> listProviders = Providers.GetProvidersForWebSched(recall.PatNum, clinic?.ClinicNum ?? 0); if (provNum > 0 && !allowOtherProv) { listProviders = listProviders.FindAll(x => x.ProvNum == provNum); } log?.WriteLine("listProviders:\r\n\t" + string.Join(",\r\n\t", listProviders.Select(x => x.ProvNum + " - " + x.Abbr)), LogLevel.Verbose); RecallType recallType = RecallTypes.GetFirstOrDefault(x => x.RecallTypeNum == recall.RecallTypeNum); return(GetAvailableWebSchedTimeSlots(recallType, listProviders, clinic, dateStart, dateEnd, recall, log)); }
///<summary>The values returned are sent to the webserver.</summary> public static List <long> GetChangedSinceRecallNums(DateTime changedSince) { return(Recalls.GetChangedSinceRecallNums(changedSince)); }
public override void Init() { try { //Create spells _q = new Spell.Active(SpellSlot.Q); _w = new Spell.Skillshot(SpellSlot.W, 1500, SkillShotType.Linear, 600, 3300, 60) { MinimumHitChance = HitChance.Medium, AllowedCollisionCount = 0 }; _e = new Spell.Skillshot(SpellSlot.E, 900, SkillShotType.Circular, 1200, 1750, 100); _r = new Spell.Skillshot(SpellSlot.R, 3000, SkillShotType.Linear, 600, 1700, 140) { MinimumHitChance = HitChance.Medium }; try { #region Create menu //Combo Menu Settings MainMenu.ComboKeys(); MainMenu.ComboManaManager(false, true, false, false, 0, 40, 0, 0); //Lane Clear Menu Settings MainMenu.LaneKeys(useW: false, useE: false, useR: false); MainMenu.Lane.Add("lane.mana", new Slider("Minimum {0}% mana to laneclear with Q", 80)); //Jungle Clear Menu Settings MainMenu.JungleKeys(useE: false, useR: false); MainMenu.JungleManaManager(false, true, false, false, 0, 40, 0, 0); //Harras Menu Settings MainMenu.HarassKeys(useR: false); MainMenu.HarassManaManager(false, true, false, false, 0, 40, 0, 0); //Killsteal Menu MainMenu.KsKeys(false, useW: false, useE: false); //Misc Menu MainMenu.MiscMenu(); MainMenu.Misc.Add("misc.farmQAARange", new CheckBox("Use Q when minion out of AA range")); MainMenu.Misc.Add("misc.teleportE", new CheckBox("Use E on teleport position")); MainMenu.Misc.Add("misc.spellcastE", new CheckBox("Use E OnProcessSpellCast")); MainMenu.Misc.Add("misc.enemyTurretR", new CheckBox("Don't use R under enemy turret")); //Draw Menu MainMenu.DrawKeys(false, useR: false); MainMenu.DamageIndicator(false, "Ultimate (R) damage"); Value.Init(); #endregion } catch (Exception e) { Console.WriteLine(e); Chat.Print( "<font color='#23ADDB'>Marksman AIO:</font><font color='#E81A0C'> an error ocurred. (Code MENU)</font>"); } } catch (Exception e) { Console.WriteLine(e); Chat.Print( "<font color='#23ADDB'>Marksman AIO:</font><font color='#E81A0C'> an error ocurred. (Code 503)</font>"); } try { DamageIndicator.DamageToUnit = DamageInidicatorDmg; Game.OnTick += OnTick; Drawing.OnDraw += OnDraw; Orbwalker.OnPreAttack += OnPreAttack; Obj_AI_Base.OnProcessSpellCast += OnProcessSpellCast; Chat.Print("Jinx Loaded!", Color.Chartreuse); } catch (Exception e) { Console.WriteLine(e); Chat.Print( "<font color='#23ADDB'>Marksman AIO:</font><font color='#E81A0C'> an error ocurred. (Code INIT)</font>"); } foreach (var hero in ObjectManager.Get <AIHeroClient>()) { Recalls.Add(new Recall(hero, RecallStatus.Inactive)); } }
///<summary>Gets the data necessary to load the Family Module.</summary> public static LoadData GetLoadData(long patNum, bool doCreateSecLog) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { return(Meth.GetObject <LoadData>(MethodBase.GetCurrentMethod(), patNum, doCreateSecLog)); } LoadData data = new LoadData(); data.Fam = Patients.GetFamily(patNum); data.Pat = data.Fam.GetPatient(patNum); data.ListPatPlans = PatPlans.Refresh(patNum); if (!PatPlans.IsPatPlanListValid(data.ListPatPlans)) //PatPlans had invalid references and need to be refreshed. { data.ListPatPlans = PatPlans.Refresh(patNum); } data.PatNote = PatientNotes.Refresh(patNum, data.Pat.Guarantor); data.ListInsSubs = InsSubs.RefreshForFam(data.Fam); data.ListInsPlans = InsPlans.RefreshForSubList(data.ListInsSubs); data.ListBenefits = Benefits.Refresh(data.ListPatPlans, data.ListInsSubs); data.ListRecalls = Recalls.GetList(data.Fam.ListPats.Select(x => x.PatNum).ToList()); data.ArrPatFields = PatFields.Refresh(patNum); data.SuperFamilyMembers = Patients.GetBySuperFamily(data.Pat.SuperFamily); data.SuperFamilyGuarantors = Patients.GetSuperFamilyGuarantors(data.Pat.SuperFamily); data.DictCloneSpecialities = Patients.GetClonesAndSpecialties(patNum); data.PatPict = Documents.GetPatPictFromDb(patNum); data.HasPatPict = (data.PatPict == null ? YN.No : YN.Yes); List <DisplayField> listDisplayFields = DisplayFields.GetForCategory(DisplayFieldCategory.PatientInformation); foreach (DisplayField field in listDisplayFields) { switch (field.InternalName) { case "Guardians": data.ListGuardians = Guardians.Refresh(patNum); break; case "Pat Restrictions": data.ListPatRestricts = PatRestrictions.GetAllForPat(patNum); break; case "Payor Types": data.PayorTypeDesc = PayorTypes.GetCurrentDescription(patNum); break; case "PatFields": data.ListPatFieldDefLinks = FieldDefLinks.GetForLocation(FieldLocations.Family); break; case "References": data.ListCustRefEntries = CustRefEntries.GetEntryListForCustomer(patNum); break; case "Referrals": data.ListRefAttaches = RefAttaches.Refresh(patNum); break; case "ResponsParty": if (data.Pat.ResponsParty != 0) { data.ResponsibleParty = Patients.GetLim(data.Pat.ResponsParty); } break; } } if (data.Pat.DiscountPlanNum != 0) { data.DiscountPlan = DiscountPlans.GetPlan(data.Pat.DiscountPlanNum); } data.ListMergeLinks = PatientLinks.GetLinks(data.Fam.ListPats.Select(x => x.PatNum).ToList(), PatientLinkType.Merge); if (doCreateSecLog) { SecurityLogs.MakeLogEntry(Permissions.FamilyModule, patNum, ""); } return(data); }
///<summary>Helper method so that we do not have to duplicate code. The length of toothValues must match the length of chartOrigVals.</summary> private static void ProcessScreenChartHelper(long patNum, List <string> toothValues, ScreenChartType chartType, long provNum, long sheetNum , List <string> chartOrigVals) { //No need to check RemotingRole; no call to db. for (int i = 0; i < toothValues.Count; i++) //toothValues is in the order from low to high tooth number in the chart { if (!toothValues[i].Contains("S")) //No sealant, nothing to do. { continue; } //Logic to determine if the "S" changed surfaces or was erased between the time the toothchart was opened and when it was submitted. string[] newSurfaces = toothValues[i].Split(','); string[] origSurfaces = chartOrigVals[i].Split(','); bool isDiff = false; for (int j = 0; j < origSurfaces.Length; j++) //Both arrays have the same length unless the chart doesn't exist in the original. { if ((newSurfaces[j] == "S" && origSurfaces[j] != "S") || (newSurfaces[j] != "S" && origSurfaces[j] == "S")) //"S" changed surfaces or was removed. { isDiff = true; break; } } //If there is no difference don't make any duplicates. We don't care if they changed a surface from N to PS for example, only S surfaces are important. if (!isDiff) { continue; //All the "S" surfaces are the same. } string surf = ""; int toothNum = 0; bool isMolar = false; bool isRight = false; bool isLing = false; string tooth = ""; #region Parse ScreenChart FieldValues if (i <= 1) //Top left quadrant of toothchart { toothNum = i + 2; isMolar = true; isRight = true; isLing = true; } else if (i > 1 && i <= 3) //Top middle-left quadrant of toothchart { toothNum = i + 2; isMolar = false; isRight = true; isLing = true; } else if (i > 3 && i <= 5) //Top middle-right quadrant of toothchart { toothNum = i + 8; isMolar = false; isRight = false; isLing = true; } else if (i > 5 && i <= 7) //Top right quadrant of toothchart { toothNum = i + 8; isMolar = true; isRight = false; isLing = true; } else if (i > 7 && i <= 9) //Lower right quadrant of toothchart { toothNum = i + 10; isMolar = true; isRight = false; isLing = false; } else if (i > 9 && i <= 11) //Lower middle-right quadrant of toothchart { toothNum = i + 10; isMolar = false; isRight = false; isLing = false; } else if (i > 11 && i <= 13) //Lower middle-left quadrant of toothchart { toothNum = i + 16; isMolar = false; isRight = true; isLing = false; } else if (i > 13) //Lower left quadrant of toothchart { toothNum = i + 16; isMolar = true; isRight = true; isLing = false; } if (isMolar) { if (isRight) { if (newSurfaces[0] == "S") { surf += "D"; } if (newSurfaces[1] == "S") { surf += "M"; } } else //Is Left side { if (newSurfaces[0] == "S") { surf += "M"; } if (newSurfaces[1] == "S") { surf += "D"; } } if (isLing && newSurfaces[2] == "S") { surf += "L"; } if (!isLing && newSurfaces[2] == "S") { surf += "B"; } } else //Front teeth, only look at 3rd surface position in control as that's the only one the user can see. { if (newSurfaces[2] == "S") { surf = "O"; //NOTE: Not sure what surface to enter here... This is just a placeholder for now until we figure it out... } } if (toothNum != 0) { tooth = toothNum.ToString(); } #endregion Parse Toothchart FieldValues surf = Tooth.SurfTidyForDisplay(surf, tooth); if (chartType == ScreenChartType.TP) //Create TP'd sealant procs if they don't already exist for this patient. { if (Procedures.GetProcForPatByToothSurfStat(patNum, toothNum, surf, ProcStat.TP) != null) { continue; } Procedure proc = Procedures.CreateProcForPatNum(patNum, ProcedureCodes.GetCodeNum("D1351"), surf, tooth, ProcStat.TP, provNum); if (proc != null) { SecurityLogs.MakeLogEntry(Permissions.ProcEdit, patNum, "D1351 " + Lans.g("Screens", "treatment planned during screening with tooth") + " " + proc.ToothNum.ToString() + " " + Lans.g("Screens", "and surface") + " " + proc.Surf); } } else if (chartType == ScreenChartType.C) { Procedure proc = Procedures.GetProcForPatByToothSurfStat(patNum, toothNum, surf, ProcStat.TP); if (proc == null) //A TP procedure does not already exist. { proc = Procedures.CreateProcForPatNum(patNum, ProcedureCodes.GetCodeNum("D1351"), surf, tooth, ProcStat.C, provNum); } else //TP proc already exists, set it complete. { Procedure procOld = proc.Copy(); proc.ProcStatus = ProcStat.C; proc.DateEntryC = DateTime.Now; Procedures.Update(proc, procOld); } if (proc != null) { SecurityLogs.MakeLogEntry(Permissions.ProcComplCreate, patNum, "D1351 " + Lans.g("Screens", "set complete during screening with tooth") + " " + proc.ToothNum.ToString() + " " + Lans.g("Screens", "and surface") + " " + proc.Surf); } } } if (chartType == ScreenChartType.C) { Recalls.Synch(patNum); } }
///<summary>Runs the required queries to populate the necessary StaticTextData fields corresponding to staticTextDependencies.</summary> private void LoadData(StaticTextFieldDependency staticTextDependencies, Patient pat, Family fam, List <long> listProcCodeNums) { bool isMiddleTier = (RemotingClient.RemotingRole == RemotingRole.ServerWeb); System.Diagnostics.Stopwatch timer = null; if (ODBuild.IsDebug()) { timer = new System.Diagnostics.Stopwatch(); timer.Start(); } if (staticTextDependencies.HasFlag(StaticTextFieldDependency.Pat)) { //patient should already be loaded. } if (fam == null && staticTextDependencies.HasFlag(StaticTextFieldDependency.Fam)) { fam = Patients.GetFamily(pat.PatNum); } if (PatNote == null) { if (staticTextDependencies.HasFlag(StaticTextFieldDependency.PatNote)) { PatNote = PatientNotes.Refresh(pat.PatNum, pat.Guarantor); } else { PatNote = new PatientNote(); } } bool IsQueryNeeded <T>(ref List <T> list, StaticTextFieldDependency dependency) { if (list == null || (isMiddleTier && list.Count == 0)) //Middle Tier deserializes null lists to empty lists. { if (staticTextDependencies.HasFlag(dependency)) { return(true); } else { list = new List <T>(); } } return(false); } if (IsQueryNeeded(ref ListRefAttaches, StaticTextFieldDependency.ListRefAttaches)) { ListRefAttaches = RefAttaches.Refresh(pat.PatNum); } if (IsQueryNeeded(ref ListInsSubs, StaticTextFieldDependency.ListInsSubs)) { ListInsSubs = InsSubs.RefreshForFam(fam); } if (IsQueryNeeded(ref ListInsPlans, StaticTextFieldDependency.ListInsPlans)) { ListInsPlans = InsPlans.RefreshForSubList(ListInsSubs); } if (IsQueryNeeded(ref ListPatPlans, StaticTextFieldDependency.ListPatPlans)) { ListPatPlans = PatPlans.Refresh(pat.PatNum); } if (IsQueryNeeded(ref ListBenefits, StaticTextFieldDependency.ListBenefits)) { ListBenefits = Benefits.Refresh(ListPatPlans, ListInsSubs); } if (IsQueryNeeded(ref HistList, StaticTextFieldDependency.HistList)) { HistList = ClaimProcs.GetHistList(pat.PatNum, ListBenefits, ListPatPlans, ListInsPlans, DateTime.Today, ListInsSubs); } if (IsQueryNeeded(ref ListTreatPlans, StaticTextFieldDependency.ListTreatPlans)) { ListTreatPlans = TreatPlans.Refresh(pat.PatNum); } if (IsQueryNeeded(ref ListRecallsForFam, StaticTextFieldDependency.ListRecallsForFam)) { ListRecallsForFam = Recalls.GetList(fam.ListPats.Select(x => x.PatNum).ToList()); } if (IsQueryNeeded(ref ListAppts, StaticTextFieldDependency.ListAppts)) { ListAppts = Appointments.GetListForPat(pat.PatNum); } if (IsQueryNeeded(ref ListFutureApptsForFam, StaticTextFieldDependency.ListFutureApptsForFam)) { ListFutureApptsForFam = Appointments.GetFutureSchedApts(fam.ListPats.Select(x => x.PatNum).ToList()); } if (IsQueryNeeded(ref ListDiseases, StaticTextFieldDependency.ListDiseases)) { ListDiseases = Diseases.Refresh(pat.PatNum, true); } if (IsQueryNeeded(ref ListAllergies, StaticTextFieldDependency.ListAllergies)) { ListAllergies = Allergies.GetAll(pat.PatNum, false); } if (IsQueryNeeded(ref ListMedicationPats, StaticTextFieldDependency.ListMedicationPats)) { ListMedicationPats = MedicationPats.Refresh(pat.PatNum, false); } if (IsQueryNeeded(ref ListFamPopups, StaticTextFieldDependency.ListFamPopups)) { ListFamPopups = Popups.GetForFamily(pat); } if (IsQueryNeeded(ref ListProceduresSome, StaticTextFieldDependency.ListProceduresSome)) { ListProceduresSome = Procedures.RefreshForProcCodeNums(pat.PatNum, listProcCodeNums); } if (IsQueryNeeded(ref ListProceduresPat, StaticTextFieldDependency.ListProceduresPat)) { ListProceduresPat = Procedures.Refresh(pat.PatNum); } if (IsQueryNeeded(ref ListPlannedAppts, StaticTextFieldDependency.ListPlannedAppts)) { ListPlannedAppts = new List <PlannedAppt>(); PlannedAppt plannedAppt = PlannedAppts.GetOneOrderedByItemOrder(pat.PatNum); if (plannedAppt != null) { ListPlannedAppts.Add(plannedAppt); } } if (ODBuild.IsDebug()) { timer.Stop(); Console.WriteLine("Static text field query time (ms): " + timer.ElapsedMilliseconds); } }
///<summary>Gets the list of patients that need to be on the reactivation list based on the passed in filters.</summary> public static DataTable GetReactivationList(DateTime dateSince, DateTime dateStop, bool groupFamilies, bool showDoNotContact, bool isInactiveIncluded , long provNum, long clinicNum, long siteNum, long billingType, ReactivationListSort sortBy, RecallListShowNumberReminders showReactivations) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { return(Meth.GetTable(MethodBase.GetCurrentMethod(), dateSince, dateStop, groupFamilies, showDoNotContact, isInactiveIncluded, provNum, clinicNum , siteNum, billingType, sortBy, showReactivations)); } //Get information we will need to do the query List <long> listReactCommLogTypeDefNums = Defs.GetDefsForCategory(DefCat.CommLogTypes, isShort: true) .FindAll(x => CommItemTypeAuto.REACT.GetDescription(useShortVersionIfAvailable: true).Equals(x.ItemValue)).Select(x => x.DefNum).ToList(); int contactInterval = PrefC.GetInt(PrefName.ReactivationContactInterval); List <PatientStatus> listPatStatuses = new List <PatientStatus>() { PatientStatus.Patient, PatientStatus.Prospective }; if (isInactiveIncluded) { listPatStatuses.Add(PatientStatus.Inactive); } string strPatStatuses = string.Join(",", listPatStatuses.Select(x => POut.Int((int)x))); //Get the raw set of patients who should be on the reactivation list string cmd = $@"SELECT pat.PatNum, pat.LName, pat.FName, pat.MiddleI, pat.Preferred, pat.Guarantor, pat.PatStatus, pat.Birthdate, pat.PriProv, COALESCE(billingtype.ItemName,'') AS BillingType, pat.ClinicNum, pat.SiteNum, pat.PreferRecallMethod, '' AS ContactMethod, pat.HmPhone, pat.WirelessPhone, pat.WkPhone, {(groupFamilies?"COALESCE(guarantor.Email,pat.Email,'') AS Email,":"pat.Email,")} MAX(proc.ProcDate) AS DateLastProc, COALESCE(comm.DateLastContacted,'') AS DateLastContacted, COALESCE(comm.ContactedCount,0) AS ContactedCount, COALESCE(react.ReactivationNum,0) AS ReactivationNum, COALESCE(react.ReactivationStatus,0) AS ReactivationStatus, COALESCE(react.DoNotContact,0) as DoNotContact, react.ReactivationNote, guarantor.PatNum as GuarNum, guarantor.LName as GuarLName, guarantor.FName as GuarFName FROM patient pat INNER JOIN procedurelog proc ON pat.PatNum=proc.PatNum AND proc.ProcStatus={POut.Int((int)ProcStat.C)} LEFT JOIN appointment appt ON pat.PatNum=appt.PatNum AND appt.AptDateTime >= {DbHelper.Curdate()} LEFT JOIN ( SELECT commlog.PatNum, MAX(commlog.CommDateTime) AS DateLastContacted, COUNT(*) AS ContactedCount FROM commlog WHERE commlog.CommType IN ({string.Join(",",listReactCommLogTypeDefNums)}) GROUP BY commlog.PatNum ) comm ON pat.PatNum=comm.PatNum LEFT JOIN reactivation react ON pat.PatNum=react.PatNum LEFT JOIN definition billingtype ON pat.BillingType=billingtype.DefNum INNER JOIN patient guarantor ON pat.Guarantor=guarantor.PatNum WHERE pat.PatStatus IN ({strPatStatuses}) " ; cmd += provNum > 0?" AND pat.PriProv=" + POut.Long(provNum):""; cmd += clinicNum > -1?" AND pat.ClinicNum=" + POut.Long(clinicNum):""; //might still want to get the 0 clinic pats cmd += siteNum > 0?" AND pat.SiteNum=" + POut.Long(siteNum):""; cmd += billingType > 0?" AND pat.BillingType=" + POut.Long(billingType):""; cmd += showDoNotContact?"":" AND (react.DoNotContact IS NULL OR react.DoNotContact=0)"; cmd += contactInterval > -1?" AND (comm.DateLastContacted IS NULL OR comm.DateLastContacted <= " + POut.DateT(DateTime.Today.AddDays(-contactInterval)) + ") ":""; //set number of contact attempts int maxReminds = PrefC.GetInt(PrefName.ReactivationCountContactMax); if (showReactivations == RecallListShowNumberReminders.SixPlus) { cmd += " AND ContactedCount>=6 "; //don't need to look at pref this only shows in UI if the prefvalue allows it } else if (showReactivations == RecallListShowNumberReminders.Zero) { cmd += " AND (comm.ContactedCount=0 OR comm.ContactedCount IS NULL) "; } else if (showReactivations != RecallListShowNumberReminders.All) { int filter = (int)showReactivations - 1; //if the contactmax pref is not -1 or 0, and the contactmax is smaller than the requested filter, replace the filter with the contactmax cmd += " AND comm.ContactedCount=" + POut.Int((maxReminds > 0 && maxReminds < filter)?maxReminds:filter) + " "; } else if (showReactivations == RecallListShowNumberReminders.All) //get all but filter on the contactmax { cmd += " AND (comm.ContactedCount < " + POut.Int(maxReminds) + " OR comm.ContactedCount IS NULL) "; } cmd += $@" GROUP BY pat.PatNum HAVING MAX(proc.ProcDate) < {POut.Date(dateSince)} AND MAX(proc.ProcDate) >= {POut.Date(dateStop)} AND MIN(appt.AptDateTime) IS NULL " ; //set the sort by switch (sortBy) { case ReactivationListSort.Alphabetical: cmd += " ORDER BY " + (groupFamilies?"guarantor.LName,guarantor.FName,pat.FName":"pat.LName,pat.FName"); break; case ReactivationListSort.BillingType: cmd += " ORDER BY billingtype.ItemName,DateLastContacted" + (groupFamilies?",guarantor.LName,guarantor.FName":""); break; case ReactivationListSort.LastContacted: cmd += " ORDER BY IF(comm.DateLastContacted='' OR comm.DateLastContacted IS NULL,1,0),comm.DateLastContacted" + (groupFamilies?",guarantor.LName,guarantor.FName":""); break; case ReactivationListSort.LastSeen: cmd += " ORDER BY MAX(proc.ProcDate)"; break; } DataTable dtReturn = Db.GetTable(cmd); foreach (DataRow row in dtReturn.Rows) { //FOR REVIEW: currently, we are displaying PreferRecallMethod, which is what RecallList also does. Just want to make sure we don't want to use PreferContactMethod row["ContactMethod"] = Recalls.GetContactFromMethod(PIn.Enum <ContactMethod>(row["PreferRecallMethod"].ToString()), groupFamilies , row["HmPhone"].ToString(), row["WkPhone"].ToString(), row["WirelessPhone"].ToString(), row["Email"].ToString() //guarEmail queried as Email , row["Email"].ToString()); //Pat.Email is also "Email" } return(dtReturn); }