Exemple #1
0
        ///<summary>Inserts, updates, or deletes database rows from the provided list of family PatNums back to the state of listNew.
        ///Must always pass in the list of family PatNums.</summary>
        public static void RevertChanges(List <Guardian> listNew, List <long> listFamPatNums)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                Meth.GetVoid(MethodBase.GetCurrentMethod(), listNew, listFamPatNums);              //never pass DB list through the web service
                return;
            }
            List <Guardian> listDB = listFamPatNums.SelectMany(x => Guardians.Refresh(x)).ToList();

            //Usually we don't like using a DB list for sync because of potential deletions of newer entries.  However I am leaving this function alone
            //because it would be a lot of work to rewrite FormPatientEdit to only undo the changes that this instance of the window specifically made.
            Crud.GuardianCrud.Sync(listNew, listDB);
        }
Exemple #2
0
        ///<summary>0=self or default,1=spouse or significant other,2=parent or guardian,3=child,4=other.
        ///Defaults to 4 - other if not able to determine pat relationship to guar.</summary>
        private static string gGetPatType(Patient guar, Patient pat)
        {
            string          retval        = "";
            List <Guardian> listGuardians = Guardians.Refresh(pat.PatNum);
            Guardian        guard         = listGuardians.Find(x => x.PatNumGuardian == guar.PatNum);

            if (guard != null)
            {
                switch (guard.Relationship)
                {
                case GuardianRelationship.Self:
                    retval = "0";                          //self
                    break;

                case GuardianRelationship.Spouse:
                case GuardianRelationship.LifePartner:
                    retval = "1";                          //spouse or significant other
                    break;

                case GuardianRelationship.Father:
                case GuardianRelationship.Stepfather:
                case GuardianRelationship.Mother:
                case GuardianRelationship.Stepmother:
                case GuardianRelationship.Parent:
                case GuardianRelationship.CareGiver:
                case GuardianRelationship.Guardian:
                    retval = "2";                          //parent or guardian
                    break;

                case GuardianRelationship.Child:
                case GuardianRelationship.Stepchild:
                case GuardianRelationship.FosterChild:
                    retval = "3";                          //child
                    break;

                case GuardianRelationship.Grandfather:
                case GuardianRelationship.Grandmother:
                case GuardianRelationship.Grandparent:
                case GuardianRelationship.Grandchild:
                case GuardianRelationship.Sitter:
                case GuardianRelationship.Brother:
                case GuardianRelationship.Other:
                case GuardianRelationship.Sibling:
                case GuardianRelationship.Sister:
                case GuardianRelationship.Friend:
                default:
                    retval = "4";                          //other
                    break;
                }
            }
            else
            {
                if (guar.PatNum == pat.PatNum)
                {
                    retval = "0";                  //self or default
                }
                else if (guar.Position == PatientPosition.Married && pat.Position == PatientPosition.Married)
                {
                    retval = "1";                  //spouse or significant other
                }
                else if (guar.Position == PatientPosition.Child && pat.Position != PatientPosition.Child)
                {
                    retval = "2";                  //pat is parent or guardian of guarantor child?? not likely to happen that the guarantor is the child, but just in case
                }
                else if (guar.Position != PatientPosition.Child && pat.Position == PatientPosition.Child)
                {
                    retval = "3";                  //pat is child of guar
                }
                else
                {
                    retval = "4";                  //can't determine relationship, default to other
                }
            }
            return(retval);
        }
Exemple #3
0
        ///<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);
        }