Beispiel #1
0
        }                              // Default constructor for serialization

        public ClincalObservation(PastMedicalHistory pmh)
        {
            owningPMH = pmh;
        }
Beispiel #2
0
        /**************************************************************************************************/
        private void LoadOrGetPMH()
        {
            if (pmh != null)
            {
                pmh.GeneticTests.ReleaseListeners(this);
            }

            pmh = SessionManager.Instance.GetSelectedRelative().PMH;

            pmh.GeneticTests.AddHandlersWithLoad(GeneticTestListChanged,
                                         GeneticTestListLoaded,
                                         GeneticTestChanged);
        }
Beispiel #3
0
 /**************************************************************************************************/
 private void SetNewRelativePMH(ListView lv, PastMedicalHistory pmh)
 {
     if (pmh != null)
     {
         if (lv.InvokeRequired)
         {
             lv.BeginInvoke(new NewRelativePmhCallback(SetNewRelativePMH), lv, pmh);
         }
         else
         {
             foreach (ListViewItem lvi in lv.Items)
             {
                 if (lvi.Tag != null)
                 {
                     Person p = (Person)(lvi.Tag);
                     if (pmh.RelativeOwningPMH != null)
                     {
                         if (p == pmh.RelativeOwningPMH)
                         {
                             lvi.SubItems[5].Text = pmh.GerSummaryText();
                             break;
                         }
                     }
                 }
             }
         }
     }
 }
Beispiel #4
0
        public List<ViewModels.FamilyHistoryRelative> GetFamilyHistoryRelative(string unitnum, int apptid)
        {
            string assignedBy = "";

            if (SessionManager.Instance.ActiveUser != null)
            {
                if (string.IsNullOrEmpty(SessionManager.Instance.ActiveUser.ToString()) == false)
                {
                    assignedBy = SessionManager.Instance.ActiveUser.ToString();

                }
            }
            string _userlogin = SessionManager.Instance.ActiveUser.userLogin;
            SessionManager.Instance.SetActivePatient(unitnum, apptid);
            SessionManager.Instance.GetActivePatient().BackgroundLoadWork();
            RiskApps3.Model.PatientRecord.Patient proband = SessionManager.Instance.GetActivePatient();

            RiskApps3.Model.PatientRecord.PastMedicalHistory pmh = new RiskApps3.Model.PatientRecord.PastMedicalHistory(proband);
            RiskApps3.Model.PatientRecord.FHx.FamilyHistory FHX = new RiskApps3.Model.PatientRecord.FHx.FamilyHistory(proband)  ;

            proband.FHx.BackgroundListLoad();

            /*
            RiskApps3.Model.PatientRecord.Person relative1 = new RiskApps3.Model.PatientRecord.Person(proband.FHx);
            relative1.BackgroundLoadWork();
             */

            //RiskApps3.Model.PatientRecord.FHx.FamilyHistory proband = SessionManager.Instance.GetActivePatient().FHx;

            List<ViewModels.FamilyHistoryRelative> lst = new List<VM.FamilyHistoryRelative>();

            //foreach (Person p in proband.FHx.Relatives)
            //foreach (Person p in FHX.Relatives)
            foreach (Person p in proband.FHx.Relatives)
            {

                ViewModels.FamilyHistoryRelative obj = new ViewModels.FamilyHistoryRelative();

                //Person relative = p;
                relative = p;

                obj.Relationship = "";

               // pmh = relative.PMH;

                if (string.IsNullOrEmpty(relative.bloodline) || relative.relationship.ToLower() == "mother" || relative.relationship.ToLower() == "father")
                {
                    if (relative.relationship.ToLower() != "other")
                        obj.Relationship = relative.relationship;
                }
                else
                {
                    if (relative.bloodline.ToLower() != "unknown" && relative.bloodline.ToLower() != "both")
                        obj.Relationship = relative.bloodline + " " + relative.relationship;
                    else
                        obj.Relationship = relative.relationship;
                }

                if (obj.Relationship.Length == 0)
                {
                    if (!string.IsNullOrEmpty(relative.relationshipOther))
                    {
                        obj.Relationship = relative.relationshipOther;
                    }
                }

                obj.RelativeAge = relative.age;

                obj.VitalStatus = relative.vitalStatus;

                obj.RelativeId = relative.relativeID;
                relative.PMH.BackgroundLoadWork();
                pmh = relative.PMH;

                obj.DeleteFlag = SetDeleteButtonFlag(relative);

                for (int i = 0; i < pmh.Observations.Count; i++)
                {
                    ClincalObservation co = (ClincalObservation)pmh.Observations[i];
                    switch (i)
                    {
                        case 0:

                            obj.FirstDx = co.disease;
                            obj.FirstAgeOnset= co.ageDiagnosis;

                            break;
                        case 1:
                           obj.SecondDx = co.disease;
                            obj.SecondAgeOnset= co.ageDiagnosis;
                            break;
                        case 2:
                           obj.ThirdDx = co.disease;
                            obj.ThirdAgeOnset= co.ageDiagnosis;
                            break;
                        default:
                            break;
                    }
                }

                /**/
                lst.Add(obj);

            }

            return lst;
        }

        public List<VM.Tasks> GetTasks(int InstitutionId, string unitnum)
        {
            if (InstitutionId != null)
            {
                _institutionId = InstitutionId;
                //SetUserSession();
                Patient p = new Patient();
                p.unitnum = unitnum;
                var list = new TaskList(p);
                list.BackgroundListLoad();
                return list.FromRATaskList();
            }

            return new List<VM.Tasks>();
        }

        /// <summary>
        /// for loading Test patient page
        /// </summary>
        /// <returns></returns>
        public VM.TestPatient LoadCreateTestPatients()
        {
            VM.TestPatient tp = new VM.TestPatient();
            TestPatientManager Tpm = new TestPatientManager();
            tp.Surveys = Tpm.GetSurveys();
            tp.Clinics = GetClinicList();
            tp.InitateTestPatients = Tpm.InitiateTestPatients();

            return tp;
        }

        /// <summary>
        /// To Show Risk Score on Click of Run Risk Models Button. It calculates Risk Score
        /// </summary>
        /// <param name="apptid">Appointment Id</param>
        /// <param name="MRN">MRN Number</param>
        /// <returns></returns>
        public VM.RiskScore RiskCalculateAndRunAutomation(int apptid, string MRN)
        {
            Patient proband = CalculateRiskAndRunAutomation(apptid, MRN);
            proband.RP.LoadFullObject();
            VM.RiskScore RS = RiskScoreMapper.ToRiskScore(proband.RP);
            RS.ApptId = apptid;
            RS.MRN = MRN;
            return RS;
        }

        /// <summary>
        ///To show Risk Score on Click of Risk Calculation  
        /// </summary>
        /// <param name="apptid">Appointment Id</param>
        /// <param name="MRN">MRN Number</param>
        /// <returns>Risk Score Model</returns>
        public VM.RiskScore RiskScore(int apptid, string MRN)
        {
            SessionManager.Instance.SetActivePatient(MRN, apptid);
            Patient proband = SessionManager.Instance.GetActivePatient();
            proband.RP.LoadFullObject();
            VM.RiskScore RS = RiskScoreMapper.ToRiskScore(proband.RP);
            RS.ApptId = apptid;
            RS.MRN = MRN;
            return RS;
        }

        /// <summary>
        /// To do process of Run Automation Documents
        /// </summary>
        /// <param name="InstitutionId">Institution Id</param>
        /// <param name="apptid">Appointment Id</param>
        /// <param name="MRN">MRN Number</param>
        /// <returns></returns>
        public FileInfo RunAutomationDocuments(int InstitutionId, int apptid, string MRN)
        {
            Patient proband = CalculateRiskAndRunAutomation(apptid, MRN);
            return proband.file;
        }

        /// <summary>
        /// To Save Appointments
        /// </summary>
        /// <param name="Appt">Appointment Object to Save</param>
        /// <param name="InstitutionId">Institution Id</param>
        public void SaveAppointments(VM.Appointment Appt, int InstitutionId)
        {
            SaveAppointments(Appt);
            UpdateMarkAsComplete(Appt, InstitutionId);
        }

        public string SaveImage(string base64, int _institutionId, string _userlogin, int apptid, string PedigreeImageSavePath)
        {
            string _ImagePath = string.Empty;
            using (System.IO.MemoryStream ms = new System.IO.MemoryStream(Convert.FromBase64String(base64)))
            {
                using (Bitmap bm2 = new Bitmap(ms))
                {

                    //  PedigreeImagePath = System.Web.Serv
                    string _ImageName = _institutionId.ToString() + "_" + _userlogin + "_" + apptid.ToString() + ".png";

                    bm2.Save(PedigreeImageSavePath + _ImageName);
                    _ImagePath = _ImageName;
                }
            }

            return _ImagePath;
        }

        public void SaveSurvey(string unitnum, int apptid, ViewModels.FamilyHistoryRelative obj , int type )
        {
            SessionManager.Instance.SetActivePatient(unitnum, apptid);
            SessionManager.Instance.GetActivePatient().BackgroundLoadWork();
            RiskApps3.Model.PatientRecord.Patient proband = SessionManager.Instance.GetActivePatient();
            proband.FHx.BackgroundListLoad();

            if (type == 0)
            {

                AddRelative(proband, obj);
            }
            else if (type == 1)
            {
                EditSurvey(proband, obj);

            }
            else
            {
                DeleteSurvey(proband, obj);
            }
        }

        public bool SetDeleteButtonFlag(Person relative)
        {
            bool retval = true;

            if (relative == null)
                return false ;

            if (relative.relativeID < 8)
            {
                retval = false;
            }
            else
            {
                foreach (Person p in relative.owningFHx)
                {
                    if (p.motherID == relative.relativeID || p.fatherID == relative.relativeID)
                    {
                        retval = false;
                        break;
                    }
                }
            }

            return retval;
        }

        public string ShowPedigreeImage(int _institutionId, string unitnum, int apptid, string PedigreeImageSavePath)
        {
            int Width = 625;
            int Height = 625;
            string _ImagePath = string.Empty;
            string assignedBy = "";

            if (SessionManager.Instance.ActiveUser != null)
            {
                if (string.IsNullOrEmpty(SessionManager.Instance.ActiveUser.ToString()) == false)
                {
                    assignedBy = SessionManager.Instance.ActiveUser.ToString();

                }
            }
            string _userlogin = SessionManager.Instance.ActiveUser.userLogin;
            SessionManager.Instance.SetActivePatient(unitnum, apptid);

            RiskApps3.Model.PatientRecord.Patient proband = SessionManager.Instance.GetActivePatient();    // TODO:  Check this!!

            PedigreeGenerator pg = new PedigreeGenerator(Width, Height, proband);
            Bitmap bmp;
            if (proband != null)
            {
                bmp = pg.GeneratePedigreeImage(proband);
            }
            else
            {
                bmp = pg.GeneratePedigreeImage();
            }
            System.IO.MemoryStream stream = new System.IO.MemoryStream();
            bmp.Save(stream, System.Drawing.Imaging.ImageFormat.Png);
            var base64Data = Convert.ToBase64String(stream.ToArray());
            /*
            _ImagePath = SaveImage(base64Data, _institutionId, _userlogin, apptid, PedigreeImageSavePath);
               return _ImagePath;
            */
            return base64Data;
        }
Beispiel #5
0
        }                        // Default constructor for serialization

        public GeneticTest(PastMedicalHistory pmh)
        {
            owningPMH          = pmh;
            GeneticTestResults = new List <GeneticTestResult>();
        }
Beispiel #6
0
        public void DeleteSurvey(RiskApps3.Model.PatientRecord.Patient proband, ViewModels.FamilyHistoryRelative obj)
        {
            RiskApps3.Model.PatientRecord.PastMedicalHistory pmh = new RiskApps3.Model.PatientRecord.PastMedicalHistory(proband);
            Person per = proband.FHx.Relatives.Where(p => p.relativeID == obj.RelativeId).FirstOrDefault();

            HraModelChangedEventArgs args = new HraModelChangedEventArgs(null);
            args.Delete = true;
            args.updatedMembers.Add(per.GetMemberByName("relativeID")); // Edit And save
            args.updatedMembers.Add(per.GetMemberByName("relationship"));
            args.updatedMembers.Add(per.GetMemberByName("bloodline"));
            args.updatedMembers.Add(per.GetMemberByName("motherID"));
            args.updatedMembers.Add(per.GetMemberByName("fatherID"));
            args.updatedMembers.Add(per.GetMemberByName("gender"));
            args.updatedMembers.Add(per.GetMemberByName("vitalStatus"));
            args.updatedMembers.Add(per.GetMemberByName("twinID"));
            args.updatedMembers.Add(per.GetMemberByName("x_position"));
            args.updatedMembers.Add(per.GetMemberByName("y_position"));
            args.updatedMembers.Add(per.GetMemberByName("x_norm"));
            args.updatedMembers.Add(per.GetMemberByName("y_norm"));
            args.updatedMembers.Add(per.GetMemberByName("pedigreeGroup"));
            args.updatedMembers.Add(per.GetMemberByName("consanguineousSpouseID"));
            per.BackgroundPersistWork(args);
        }
Beispiel #7
0
        public void EditSurvey(RiskApps3.Model.PatientRecord.Patient proband, ViewModels.FamilyHistoryRelative obj)
        {
            RiskApps3.Model.PatientRecord.PastMedicalHistory pmh = new RiskApps3.Model.PatientRecord.PastMedicalHistory(proband);
            Person per = proband.FHx.Relatives.Where(p => p.relativeID == obj.RelativeId).FirstOrDefault();
            per.vitalStatus = obj.VitalStatus;
            per.relationship = obj.Relationship;
            per.age = obj.RelativeAge;
            HraModelChangedEventArgs args = new HraModelChangedEventArgs(null);
            args.updatedMembers.Add(per.GetMemberByName("vitalStatus"));
            //args.updatedMembers.Add(per.GetMemberByName("relationship"));
            args.updatedMembers.Add(per.GetMemberByName("age"));
            per.BackgroundPersistWork(args);

            relative = per;

            relative.PMH.BackgroundLoadWork();
            pmh = relative.PMH;

            SessionManager.Instance.MetaData.Diseases.BackgroundListLoad();

            relative.PMH.BackgroundLoadWork();

            for (int i = 0; i < 3; i++)
            {

                ClincalObservation co = new ClincalObservation();

                if (i < pmh.Observations.Count)
                {

                    co = (ClincalObservation)pmh.Observations[i];

                }

                switch (i)
                {
                    case 0:
                        if (co.instanceID != 0)
                        {
                            co.disease = obj.FirstDx;
                            co.ageDiagnosis = obj.FirstAgeOnset;
                            co.SetDiseaseDetails();
                            HraModelChangedEventArgs args1 = new HraModelChangedEventArgs(null);
                            args1.updatedMembers.Add(co.GetMemberByName("disease"));
                            args1.updatedMembers.Add(co.GetMemberByName("ageDiagnosis"));
                            co.BackgroundPersistWork(args1);
                        }
                        else
                        {

                            ClincalObservation co1 = new ClincalObservation(pmh);
                            co1.disease = obj.FirstDx;
                            co1.ageDiagnosis = obj.FirstAgeOnset;
                            co1.SetDiseaseDetails();
                            HraModelChangedEventArgs args1 = new HraModelChangedEventArgs(null);
                            args1.updatedMembers.Add(co1.GetMemberByName("disease"));

                            args1.updatedMembers.Add(co1.GetMemberByName("ageDiagnosis"));

                            co1.BackgroundPersistWork(args1);

                            pmh.Observations.AddToList(co1, args1);

                        }

                        break;
                    case 1:
                        if (co.instanceID != 0)
                        {
                            co.disease = obj.SecondDx;
                            co.ageDiagnosis = obj.SecondAgeOnset;
                            co.SetDiseaseDetails();
                            HraModelChangedEventArgs args1 = new HraModelChangedEventArgs(null);
                            args1.updatedMembers.Add(co.GetMemberByName("disease"));
                            args1.updatedMembers.Add(co.GetMemberByName("ageDiagnosis"));
                            co.BackgroundPersistWork(args1);
                        }
                        else
                        {

                            ClincalObservation co1 = new ClincalObservation(pmh);
                            co1.disease = obj.SecondDx;
                            co1.ageDiagnosis = obj.SecondAgeOnset;
                            co1.SetDiseaseDetails();
                            HraModelChangedEventArgs args1 = new HraModelChangedEventArgs(null);
                            args1.updatedMembers.Add(co1.GetMemberByName("disease"));

                            args1.updatedMembers.Add(co1.GetMemberByName("ageDiagnosis"));

                            co1.BackgroundPersistWork(args1);

                            pmh.Observations.AddToList(co1, args1);

                        }
                        break;
                    case 2:
                        if (co.instanceID != 0)
                        {
                            co.disease = obj.ThirdDx;
                            co.ageDiagnosis = obj.ThirdAgeOnset;
                            co.SetDiseaseDetails();
                            HraModelChangedEventArgs args1 = new HraModelChangedEventArgs(null);
                            args1.updatedMembers.Add(co.GetMemberByName("disease"));
                            args1.updatedMembers.Add(co.GetMemberByName("ageDiagnosis"));
                            co.BackgroundPersistWork(args1);
                        }
                        else
                        {

                            ClincalObservation co1 = new ClincalObservation(pmh);
                            co1.disease = obj.ThirdDx;
                            co1.ageDiagnosis = obj.ThirdAgeOnset;
                            co1.SetDiseaseDetails();
                            HraModelChangedEventArgs args1 = new HraModelChangedEventArgs(null);
                            args1.updatedMembers.Add(co1.GetMemberByName("disease"));

                            args1.updatedMembers.Add(co1.GetMemberByName("ageDiagnosis"));

                            co1.BackgroundPersistWork(args1);

                            pmh.Observations.AddToList(co1, args1);

                        }
                        break;
                    default:
                        break;
                }

            }
        }
Beispiel #8
0
 public GeneticTest(PastMedicalHistory pmh)
 {
     owningPMH = pmh;
     GeneticTestResults = new List<GeneticTestResult>();
 }
        /**************************************************************************************************/
        private void LoadOrGetPMHHx()
        {
            //  get active patinet object from session manager
            PMHHx = SessionManager.Instance.GetActivePatient().PMH;

            if (PMHHx != null)
            {
                PMHHx.AddHandlersWithLoad(PMHHxChanged, PMHHxLoaded, PMHHxItemChanged);
                //PMHHx.AddHandlersWithLoad(PMHHxChanged, PMHHxLoaded, null);
            }
        }
Beispiel #10
0
        /**************************************************************************************************/
        private void LoadOrGetPMH()
        {
            if (pmh != null)
            {
                pmh.Observations.ReleaseListeners(this);
            }

            pmh = SessionManager.Instance.GetSelectedRelative().PMH;

            pmh.Observations.AddHandlersWithLoad(ClinicalObservationListChanged,
                             ClinicalObservationListLoaded,
                             ClinicalObservationChanged);
        }
Beispiel #11
0
 /**************************************************************************************************/
 // This way of creating a person is used to create relatives in the family history
 public Person(FamilyHistory fhx)
 {
     owningFHx = fhx;
     Nationality = new NationalityList(this);
     Ethnicity = new EthnicBackground(this);
     PMH = new PastMedicalHistory(this);
     RP = new RiskProfile(this);
 }
Beispiel #12
0
 /**************************************************************************************************/
 //  This way of creating the person is used to create the patient
 public Person()
 {
     Ethnicity = new EthnicBackground(this);
     Nationality = new NationalityList(this);
     PMH = new PastMedicalHistory(this);
     RP = new RiskProfile(this);
 }
Beispiel #13
0
 public ClincalObservation(PastMedicalHistory pmh)
 {
     owningPMH = pmh;
 }
        /**************************************************************************************************/
        private void LoadOrGetPMH()
        {
            if (pmh != null)
            {
                pmh.Observations.ReleaseListeners(this);
            }

            pmh = relative.PMH;

            pmh.Observations.AddHandlersWithLoad(ClinicalObservationListChanged,
                             ClinicalObservationListLoaded,
                             ClinicalObservationChanged);
        }