示例#1
0
        ///<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);
        }
示例#2
0
文件: Popups.cs 项目: nampn/ODental
        /// <summary>When a patient leaves a superfamily, this copies the superfamily level popups to be in both places. Takes pat leaving, and new superfamily. If newSuperFamily is 0, superfamily popups will not be copied from the old superfamily.</summary>
        public static void CopyForMovingSuperFamily(Patient pat, long newSuperFamily)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                Meth.GetVoid(MethodBase.GetCurrentMethod(), pat);
                return;
            }
            //Get a list of all popups for the super family
            string command = "SELECT * FROM popup "
                             + "WHERE PopupLevel = " + POut.Int((int)EnumPopupLevel.SuperFamily) + " "
                             + "AND PatNum IN (SELECT PatNum FROM patient WHERE SuperFamily = " + POut.Long(pat.SuperFamily) + ")";
            List <Popup> SuperFamilyPopups = Crud.PopupCrud.SelectMany(command);
            Popup        popup;

            for (int i = 0; i < SuperFamilyPopups.Count; i++)
            {
                popup = SuperFamilyPopups[i].Copy();
                if (popup.PatNum == pat.PatNum)               //if popup is on the patient who's leaving, copy to superfamily head of old superfamily.
                {
                    popup.PatNum = pat.SuperFamily;
                    if (newSuperFamily == 0)                   //If they are not going to a superfamily, delete the popup
                    {
                        Popups.DeleteObject(SuperFamilyPopups[i]);
                    }
                }
                else                         //if popup is on some other super family member, then copy to this patient.
                {
                    if (newSuperFamily != 0) //Only if they are moving to a superfamily.
                    {
                        popup.PatNum = pat.PatNum;
                    }
                }
                Popups.Insert(popup);                //changes the PK
            }
        }
示例#3
0
文件: Popups.cs 项目: nampn/ODental
        /// <summary>Copies all family level popups when a family member leaves a family. Copies from other family members to patient, and from patient to guarantor.</summary>
        public static void CopyForMovingFamilyMember(Patient pat)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                Meth.GetVoid(MethodBase.GetCurrentMethod(), pat);
                return;
            }
            //Get a list of all popups for the family
            string command = "SELECT * FROM popup "
                             + "WHERE PopupLevel = " + POut.Int((int)EnumPopupLevel.Family) + " "
                             + "AND PatNum IN (SELECT PatNum FROM patient WHERE Guarantor = " + POut.Long(pat.Guarantor) + ")";
            List <Popup> FamilyPopups = Crud.PopupCrud.SelectMany(command);
            Popup        popup;

            for (int i = 0; i < FamilyPopups.Count; i++)
            {
                popup = FamilyPopups[i].Copy();
                if (popup.PatNum == pat.PatNum)               //if popup is on the patient who's leaving, copy to guarantor of old family.
                {
                    popup.PatNum = pat.Guarantor;
                }
                else                  //if popup is on some other family member, then copy to this patient.
                {
                    popup.PatNum = pat.PatNum;
                }
                Popups.Insert(popup);                //changes the PK
            }
        }
示例#4
0
        /// <summary>When a patient leaves a superfamily, this copies the superfamily level popups to be in both places. Takes pat leaving, and new superfamily. If newSuperFamily is 0, superfamily popups will not be copied from the old superfamily.</summary>
        public static void CopyForMovingSuperFamily(Patient pat, long newSuperFamily)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                Meth.GetVoid(MethodBase.GetCurrentMethod(), pat, newSuperFamily);
                return;
            }
            //Get a list of all popups for the super family
            string command = "SELECT * FROM popup "
                             + "WHERE PopupLevel = " + POut.Int((int)EnumPopupLevel.SuperFamily) + " "
                             + "AND PatNum IN (SELECT PatNum FROM patient WHERE SuperFamily = " + POut.Long(pat.SuperFamily) + ")"
                             + "AND PopupNumArchive = 0 ";
            //This includes all the archived ones as well
            List <Popup> SuperFamilyPopups = Crud.PopupCrud.SelectMany(command);
            Popup        popupCur;

            for (int i = 0; i < SuperFamilyPopups.Count; i++)
            {
                popupCur = SuperFamilyPopups[i].Copy();
                if (popupCur.PatNum == pat.PatNum)               //if popup is on the patient who's leaving, copy to superfamily head of old superfamily.
                {
                    popupCur.PatNum = pat.SuperFamily;
                    if (newSuperFamily == 0)                   //If they are not going to a superfamily, set popup to family level
                    {
                        string commandUpdateFam = "UPDATE popup "
                                                  + "SET PopupLevel = " + POut.Int((int)EnumPopupLevel.Family) + " "
                                                  + "WHERE PopupNum = " + POut.Long(popupCur.PopupNum);
                        Db.NonQ(commandUpdateFam);
                    }
                }
                else                  //if popup is on some other super family member, then copy to this patient.
                {
                    popupCur.PatNum = pat.PatNum;
                    if (newSuperFamily == 0)                   //If they are not going to a superfamily, set popup to family level
                    {
                        popupCur.PopupLevel = EnumPopupLevel.Family;
                    }
                }
                DateTime oldDate = popupCur.DateTimeEntry;
                long     newPk   = Popups.Insert(popupCur);        //changes the PK
                //Update the DateTimeEntry on the copy to correctly reflect when the original popup was created.
                EditPopupDate(oldDate, newPk);
                //Now we need to copy all of the archives of the original popup to point to the copy.
                List <Popup> archivePopups = GetArchivesForPopup(SuperFamilyPopups[i].PopupNum);
                Popup        popupArchive;
                for (int j = 0; j < archivePopups.Count; j++)
                {
                    popupArchive = archivePopups[j].Copy();
                    popupArchive.PopupNumArchive = newPk;
                    DateTime oldArchiveDate = popupArchive.DateTimeEntry;
                    long     newArchivePk   = Popups.Insert(popupArchive);            //changes the PK
                    EditPopupDate(oldArchiveDate, newArchivePk);
                }
            }
        }
示例#5
0
        /// <summary>Copies all family level popups when a family member leaves a family. Copies from other family members to patient, and from patient to guarantor.</summary>
        public static void CopyForMovingFamilyMember(Patient pat)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                Meth.GetVoid(MethodBase.GetCurrentMethod(), pat);
                return;
            }
            //Get a list of all popups for the family
            string command = "SELECT * FROM popup "
                             + "WHERE PopupLevel = " + POut.Int((int)EnumPopupLevel.Family) + " "
                             + "AND PatNum IN (SELECT PatNum FROM patient WHERE Guarantor = " + POut.Long(pat.Guarantor) + ")"
                             + "AND PopupNumArchive = 0 ";
            List <Popup> FamilyPopups = Crud.PopupCrud.SelectMany(command);
            Popup        popupCur;

            for (int i = 0; i < FamilyPopups.Count; i++)
            {
                popupCur = FamilyPopups[i].Copy();
                if (popupCur.PatNum == pat.PatNum)               //if popup is on the patient who's leaving, copy to guarantor of old family.
                {
                    popupCur.PatNum = pat.Guarantor;
                }
                else                  //if popup is on some other family member, then copy to this patient.
                {
                    popupCur.PatNum = pat.PatNum;
                }
                DateTime oldDate = popupCur.DateTimeEntry;
                long     newPk   = Popups.Insert(popupCur);        //changes the PK
                EditPopupDate(oldDate, newPk);
                List <Popup> archivePopups = GetArchivesForPopup(FamilyPopups[i].PopupNum);
                Popup        popupArchive;
                for (int j = 0; j < archivePopups.Count; j++)
                {
                    popupArchive = archivePopups[j].Copy();
                    if (popupArchive.PatNum == pat.PatNum)                   //if popup is on the patient who's leaving, copy to guarantor of old family.
                    {
                        popupArchive.PatNum = pat.Guarantor;
                    }
                    else                      //if popup is on some other family member, then copy to this patient.
                    {
                        popupArchive.PatNum = pat.PatNum;
                    }
                    popupArchive.PopupNumArchive = newPk;
                    DateTime oldArchiveDate = popupArchive.DateTimeEntry;
                    long     newArchivePk   = Popups.Insert(popupArchive);            //changes the PK
                    EditPopupDate(oldArchiveDate, newArchivePk);
                }
            }
        }
示例#6
0
        ///<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);
            }
        }