Ejemplo n.º 1
0
        ///<summary>Gets most of the data needed to load the active treatment plan.</summary>
        ///<param name="doFillHistList">If false, then LoadActiveTPData.HistList will be null.</param>
        public static LoadActiveTPData GetLoadActiveTpData(Patient pat, long treatPlanNum, List <Benefit> listBenefits, List <PatPlan> listPatPlans,
                                                           List <InsPlan> listInsPlans, DateTime dateTimeTP, List <InsSub> listInsSubs, bool doFillHistList, bool isTreatPlanSortByTooth,
                                                           List <SubstitutionLink> listSubstLinks)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)           //Remoting role check here to reduce round-trips to the server.
            {
                return(Meth.GetObject <LoadActiveTPData>(MethodBase.GetCurrentMethod(), pat, treatPlanNum, listBenefits, listPatPlans, listInsPlans, dateTimeTP,
                                                         listInsSubs, doFillHistList, isTreatPlanSortByTooth, listSubstLinks));
            }
            LoadActiveTPData data = new LoadActiveTPData();

            data.ListTreatPlanAttaches = TreatPlanAttaches.GetAllForTreatPlan(treatPlanNum);
            List <Procedure> listProcs = Procedures.GetManyProc(data.ListTreatPlanAttaches.Select(x => x.ProcNum).ToList(), false);

            data.listProcForTP = Procedures.SortListByTreatPlanPriority(listProcs.FindAll(x => x.ProcStatus == ProcStat.TP || x.ProcStatus == ProcStat.TPi)
                                                                        , isTreatPlanSortByTooth, data.ListTreatPlanAttaches).ToList();
            //One thing to watch out for here is that we must be absolutely sure to include all claimprocs for the procedures listed,
            //regardless of status.  Needed for Procedures.ComputeEstimates.  This should be fine.
            data.ClaimProcList = ClaimProcs.RefreshForTP(pat.PatNum);
            if (doFillHistList)
            {
                data.HistList = ClaimProcs.GetHistList(pat.PatNum, listBenefits, listPatPlans, listInsPlans, -1, dateTimeTP, listInsSubs);
            }
            List <ProcedureCode> listProcedureCodes = new List <ProcedureCode>();

            foreach (Procedure procedure in listProcs)
            {
                listProcedureCodes.Add(ProcedureCodes.GetProcCode(procedure.CodeNum));
            }
            data.ListFees = Fees.GetListFromObjects(listProcedureCodes, listProcs.Select(x => x.MedicalCode).ToList(), listProcs.Select(x => x.ProvNum).ToList(),
                                                    pat.PriProv, pat.SecProv, pat.FeeSched, listInsPlans, listProcs.Select(x => x.ClinicNum).ToList(), null,//appts can be null because provs already set
                                                    listSubstLinks, pat.DiscountPlanNum);
            return(data);
        }
Ejemplo n.º 2
0
        ///<summary>Adds procedures to the appointment.</summary>
        ///<returns>First item of tuple is the newly added procedures. Second item is all procedures for the appointment.</returns>
        public static ODTuple <List <Procedure>, List <Procedure> > QuickAddProcs(Appointment apt, Patient pat, List <string> listProcCodesToAdd, long provNum,
                                                                                  long provHyg, List <InsSub> SubList, List <InsPlan> listInsPlans, List <PatPlan> listPatPlans, List <Benefit> listBenefits)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetObject <ODTuple <List <Procedure>, List <Procedure> > >(MethodBase.GetCurrentMethod(), apt, pat, listProcCodesToAdd, provNum,
                                                                                       provHyg, SubList, listInsPlans, listPatPlans, listBenefits));
            }
            Procedures.SetDateFirstVisit(apt.AptDateTime.Date, 1, pat);
            List <ClaimProc>     ClaimProcList      = ClaimProcs.Refresh(apt.PatNum);
            List <ProcedureCode> listProcedureCodes = new List <ProcedureCode>();

            foreach (string procCode in listProcCodesToAdd)
            {
                listProcedureCodes.Add(ProcedureCodes.GetProcCode(procCode));
            }
            List <long> listProvNumsTreat = new List <long>();

            listProvNumsTreat.Add(provNum);
            listProvNumsTreat.Add(provHyg);                                                          //these were both passed in
            List <SubstitutionLink> listSubstLinks = SubstitutionLinks.GetAllForPlans(listInsPlans); //not available in FormApptEdit
            List <Fee> listFees = Fees.GetListFromObjects(listProcedureCodes, null,                  //no procs to pull medicalCodes from
                                                          listProvNumsTreat, pat.PriProv, pat.SecProv, pat.FeeSched,
                                                          listInsPlans, new List <long>()
            {
                apt.ClinicNum
            }, null,                                                              //procNums for appt already handled above
                                                          listSubstLinks, pat.DiscountPlanNum);
            //null,listProvNumsTreat,listProcedureCodes.Select(x=>x.ProvNumDefault).ToList(),
            //pat.PriProv,pat.SecProv,pat.FeeSched,listInsPlans,new List<long>(){apt.ClinicNum},listProcCodesToAdd,null);//procnums for appt already handled above
            List <Procedure> listAddedProcs = new List <Procedure>();
            //Make a copy of apt with provNum and provHyg, in order to maintain behavior of this method prior to using Procedures.ConstructProcedureForAppt
            //provNum and provHyg are sent in and are the selected provs in FormApptEdit, which may be different than the current provs on apt
            Appointment aptCur = apt.Copy();

            aptCur.ProvNum = provNum;
            aptCur.ProvHyg = provHyg;
            foreach (string procCode in listProcCodesToAdd)
            {
                ProcedureCode procCodeCur = ProcedureCodes.GetProcCode(procCode);
                Procedure     proc        = Procedures.ConstructProcedureForAppt(procCodeCur.CodeNum, aptCur, pat, listPatPlans, listInsPlans, SubList, listFees);
                Procedures.Insert(proc);                //recall synch not required
                Procedures.ComputeEstimates(proc, pat.PatNum, ref ClaimProcList, true, listInsPlans, listPatPlans, listBenefits,
                                            null, null, true,
                                            pat.Age, SubList,
                                            null, false, false, listSubstLinks, false,
                                            listFees);
                listAddedProcs.Add(proc);
            }
            return(new ODTuple <List <Procedure>, List <Procedure> >(listAddedProcs, Procedures.GetProcsForApptEdit(apt)));
        }