/// <summary>Returns a dictionary of adjustments of a given adjustment type and for the given pats such that the key is the patNum. /// Every patNum given will exist as key with a list in the returned dictonary. /// Only considers adjs where AdjDate is strictly less than the given maxAdjDate.</summary> public static SerializableDictionary <long, List <Adjustment> > GetAdjustForPatsByType(List <long> listPatNums, long adjType, DateTime maxAdjDate) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { return(Meth.GetObject <SerializableDictionary <long, List <Adjustment> > >(MethodBase.GetCurrentMethod(), listPatNums, adjType, maxAdjDate)); } if (listPatNums == null || listPatNums.Count == 0) { return(new SerializableDictionary <long, List <Adjustment> >()); } string queryBrokenApts = "SELECT * FROM adjustment " + "WHERE PatNum IN (" + string.Join(",", listPatNums) + ") " + "AND AdjType=" + POut.Long(adjType) + " " + "AND " + DbHelper.DateTConditionColumn("AdjDate", ConditionOperator.LessThan, maxAdjDate); List <Adjustment> listAdjs = Crud.AdjustmentCrud.SelectMany(queryBrokenApts); SerializableDictionary <long, List <Adjustment> > retVal = new SerializableDictionary <long, List <Adjustment> >(); foreach (long patNum in listPatNums) { retVal[patNum] = listAdjs.FindAll(x => x.PatNum == patNum); } return(retVal); }
///<summary>Gets a list of aptNums for one day in the schedule for a given set of providers and clinics. Will be for all clinics and/or all provs ///if the corresponding list is null or empty.</summary> public static List <long> GetRouting(DateTime date, List <long> listProvNums, List <long> listClinicNums) { if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { return(Meth.GetObject <List <long> >(MethodBase.GetCurrentMethod(), date, listProvNums, listClinicNums)); } //Excluding PtNote and PtNoteCompleted per Nathan and Arna, see job 1064 string command = "SELECT AptNum FROM appointment " + "WHERE " + DbHelper.DateTConditionColumn("AptDateTime", ConditionOperator.Equals, date) + " " + "AND AptStatus NOT IN (" + POut.Int((int)ApptStatus.UnschedList) + "," + POut.Int((int)ApptStatus.Planned) + "," + POut.Int((int)ApptStatus.PtNote) + "," + POut.Int((int)ApptStatus.PtNoteCompleted) + ") "; if (listProvNums != null && listProvNums.Count > 0) { command += "AND (ProvNum IN (" + string.Join(",", listProvNums) + ") OR ProvHyg IN (" + string.Join(",", listProvNums) + ")) "; } if (listClinicNums != null && listClinicNums.Count > 0) { command += "AND ClinicNum IN (" + string.Join(",", listClinicNums) + ") "; } command += "ORDER BY AptDateTime"; return(ReportsComplex.RunFuncOnReportServer(() => Db.GetListLong(command))); }