Ejemplo n.º 1
0
        public bool SaveRecord(string PatID, VisitData VData)
        {
            try
            {
                VisitData     vdata = DataPreprocess(VData);
                PatBasicInfor pt    = context.PatBasicInforSet.Find(PatID);
                pt.HeadacheFamilyMember = vdata.HFamilyMember;//个人信息相关保存
                pt.OtherFamilyDisease   = vdata.OFamilyDisease;
                ObjectMapper.CopyProperties(vdata.lifestyle, pt.Lifestyle);
                pt.PreviousDrug = vdata.PDrug;
                foreach (PreviousDrug pg in pt.PreviousDrug)
                {
                    pg.PatBasicInforId = PatID;
                    if (pg.DrugCategory != null && (pg.DayAmoutnPerM == null || pg.MonthTotalAmount == null))
                    {
                    }
                }
                if (vdata.Similarfamily == "有")
                {
                    pt.SimilarFamily = true;
                }
                else
                {
                    pt.SimilarFamily = false;
                }

                pt.PreviousExam = vdata.PExam;
                if (vdata.visitrecord != null)
                {
                    VisitRecord vr = new VisitRecord();//问诊记录信息保存
                    vr = vdata.visitrecord;
                    vr.MedicationAdvice = vdata.MAdvice;
                    vr.VisitDate        = System.DateTime.Now;
                    // vr.VisitDate = DateTime.Now.Date;
                    vr.PrimaryHeadachaOverView = vdata.PHeadacheOverview;
                    vr.GADQuestionaire         = vdata.GADquestionaire;
                    vr.DisabilityEvaluation    = vdata.Disabilityevaluation;
                    vr.PHQuestionaire          = vdata.PHquestionaire;
                    vr.SleepStatus             = vdata.Sleepstatus;
                    vr.PatBasicInforId         = PatID;
                    pt.VisitRecord.Add(vr);
                }
                context.SaveChanges();
                return(true);
            }
            catch (DbEntityValidationException dbEx)
            {
                foreach (var validationErrors in dbEx.EntityValidationErrors)
                {
                    foreach (var validationError in validationErrors.ValidationErrors)
                    {
                        Trace.TraceInformation("Property: {0} Error: {1}", validationError.PropertyName, validationError.ErrorMessage);
                    }
                }
                return(false);
            }
        }
Ejemplo n.º 2
0
        public bool UpdateRecord(string PatID, string VisitID, VisitData VData)
        {
            try
            {
                VisitData     vdata = DataPreprocess(VData);
                PatBasicInfor pt    = context.PatBasicInforSet.Find(PatID);
                pt.HeadacheFamilyMember = vdata.HFamilyMember;//个人信息相关保存
                pt.OtherFamilyDisease   = vdata.OFamilyDisease;
                ObjectMapper.CopyProperties(vdata.lifestyle, pt.Lifestyle);
                pt.PreviousDrug = vdata.PDrug;
                pt.PreviousExam = vdata.PExam;
                if (vdata.Similarfamily == "有")
                {
                    pt.SimilarFamily = true;
                }
                else
                {
                    pt.SimilarFamily = false;
                }
                if (vdata.visitrecord != null)
                {
                    IEnumerable <VisitRecord> record = from p in context.VisitRecordSet.ToList()
                                                       where (p.PatBasicInfor.Id == PatID) && (p.Id == int.Parse(VisitID))
                                                       select p;
                    VisitRecord vr = record.First();

                    ObjectMapper.CopyProperties(vdata.visitrecord, vr);
                    ObjectMapper.CopyProperties(vdata.PHeadacheOverview, vr.PrimaryHeadachaOverView);

                    ObjectMapper.CopyProperties(vdata.GADquestionaire, vr.GADQuestionaire);
                    ObjectMapper.CopyProperties(vdata.PHquestionaire, vr.PHQuestionaire);
                    ObjectMapper.CopyProperties(vdata.Disabilityevaluation, vr.DisabilityEvaluation);
                    ObjectMapper.CopyProperties(vdata.Sleepstatus, vr.SleepStatus);
                    vr.PrimaryHeadachaOverView.VisitRecord = vr;
                    vr.GADQuestionaire.VisitRecord         = vr;
                    vr.PHQuestionaire.VisitRecord          = vr;
                    vr.DisabilityEvaluation.VisitRecord    = vr;
                    vr.SleepStatus.VisitRecord             = vr;


                    vr.PatBasicInforId      = PatID;
                    vr.VisitDate            = DateTime.Now.Date;
                    context.Entry(vr).State = System.Data.EntityState.Modified;
                }
                context.SaveChanges();
                return(true);
            }
            catch (Exception e)
            {
                return(false);
            }
        }
Ejemplo n.º 3
0
        public List <tableData> GetPatforView(List <PatBasicInfor> Patlist)
        {
            List <tableData> dataset = new List <tableData>();
            var count = Patlist.Count;

            for (int i = 0; i < count; i++)
            {
                tableData rd = new tableData();
                rd.Name            = Patlist[i].Name;
                rd.Sex             = Patlist[i].Sex;
                rd.Age             = Patlist[i].Age;
                rd.ListID          = Convert.ToString(i + 1);
                rd.PatBasicInforId = Patlist[i].Id;
                var record = from p in container.VisitRecordSet.ToList()
                             where (p.PatBasicInfor.Id == Patlist[i].Id)
                             select p;
                var num = record.Count();

                if (num != 0)
                {
                    VisitRecord vt = record.First();
                    rd.Date = vt.VisitDate.ToString("yyyy-MM-dd");
                    if (vt.DiagnosisResult1 != null || vt.DiagnosisResult2 != null || vt.DiagnosisResult3 != null)
                    {
                        if (vt.DiagnosisResult1.Contains("慢性每日头痛"))
                        {
                            var style = vt.DiagnosisResult1.Split(new Char[] { ':' });
                            if (style.Length > 1)
                            {
                                rd.HeadacheStyle = style[1];
                            }
                            else
                            {
                                rd.HeadacheStyle = vt.DiagnosisResult1 + vt.DiagnosisResult2 + vt.DiagnosisResult3;
                            }
                        }
                        else
                        {
                            rd.HeadacheStyle = vt.DiagnosisResult1 + vt.DiagnosisResult2 + vt.DiagnosisResult3;
                        }
                    }
                }
                dataset.Add(rd);
            }
            return(dataset);
        }
Ejemplo n.º 4
0
        public tableData GetPatinfo(PatBasicInfor pat)
        {
            tableData rd = new tableData();

            rd.Name = pat.Name;
            rd.Sex  = pat.Sex;
            rd.Age  = pat.Age;
            //rd.ListID = Convert.ToString(i + 1);
            rd.PatBasicInforId = pat.Id;
            var record = from p in container.VisitRecordSet.ToList()
                         where (p.PatBasicInfor.Id == pat.Id)
                         select p;
            var num = record.Count();

            if (num != 0)
            {
                VisitRecord vt = record.First();
                rd.Date = vt.VisitDate.ToString("yyyy-MM-dd");
                if (vt.DiagnosisResult1 != null || vt.DiagnosisResult2 != null || vt.DiagnosisResult3 != null)
                {
                    if (vt.DiagnosisResult1.Contains("慢性每日头痛"))
                    {
                        var style = vt.DiagnosisResult1.Split(new Char[] { ':' });
                        if (style.Length > 1)
                        {
                            rd.HeadacheStyle = style[1];
                        }
                        else
                        {
                            rd.HeadacheStyle = vt.DiagnosisResult1 + vt.DiagnosisResult2 + vt.DiagnosisResult3;
                        }
                    }
                    else
                    {
                        rd.HeadacheStyle = vt.DiagnosisResult1 + vt.DiagnosisResult2 + vt.DiagnosisResult3;
                    }
                }
            }
            return(rd);
        }
Ejemplo n.º 5
0
        public ReportData ViewDetail(string PatID, string RecordID)
        {
            ReportData    rdata = new ReportData();
            PatBasicInfor pt    = context.PatBasicInforSet.Find(PatID);

            rdata.Name      = pt.Name;
            rdata.Age       = pt.Age;
            rdata.Sex       = pt.Sex;
            rdata.Address   = pt.Address;
            rdata.Education = pt.Education;
            rdata.Job       = pt.Job;
            rdata.Phone     = pt.Phone;
            rdata.Weight    = pt.Weight;
            rdata.Height    = pt.Height;
            if (pt.SimilarFamily != null)
            {
                if (pt.SimilarFamily == true)
                {
                    rdata.SimilarFamily = true;
                }
                else
                {
                    rdata.SimilarFamily = false;
                }
            }

            if (pt.Lifestyle != null)
            {
                rdata.patlifestyle.SmokeState = pt.Lifestyle.SmokeState;
                rdata.patlifestyle.SmokeYear  = pt.Lifestyle.SmokeYear;

                rdata.patlifestyle.DrinkState = pt.Lifestyle.DrinkState;

                rdata.patlifestyle.DrinkYear     = pt.Lifestyle.DrinkYear;
                rdata.patlifestyle.TeaPerDay     = pt.Lifestyle.TeaPerDay;
                rdata.patlifestyle.CoffePerDay   = pt.Lifestyle.CoffePerDay;
                rdata.patlifestyle.ExerciseOften = pt.Lifestyle.ExerciseOften;
            }

            //if (pt.SimilarFamily!=null)
            //{
            //    rdata.SimilarFamily = pt.SimilarFamily;
            //}
            foreach (HeadacheFamilyMember hfmember in pt.HeadacheFamilyMember)
            {
                rdata.Hfamilymember.Add(hfmember.Person);
            }
            foreach (OtherFamilyDisease ofdisease in pt.OtherFamilyDisease)
            {
                rdata.Ofamilydisease.Add(ofdisease.DiseaseName);
            }
            foreach (PreviousDrug pdrug in pt.PreviousDrug)
            {
                PDrug pd = new PDrug();
                ObjectMapper.CopyProperties(pdrug, pd);
                rdata.previousdrug.Add(pd);
            }
            foreach (PreviousExam pexam in pt.PreviousExam)
            {
                Exam exam = new Exam();
                ObjectMapper.CopyProperties(pexam, exam);
                rdata.previousexam.Add(exam);
            }
            if (RecordID != "")
            {
                var record = from p in context.VisitRecordSet.ToList()
                             where (p.PatBasicInfor.Id == PatID) && (p.Id == int.Parse(RecordID))
                             select p;
                VisitRecord vr = record.First();
                if (vr != null)
                {
                    rdata.VisitDate         = vr.VisitDate;
                    rdata.CDSSDiagnosis1    = vr.CDSSDiagnosis1;
                    rdata.CDSSDiagnosis2    = vr.CDSSDiagnosis2;
                    rdata.CDSSDiagnosis3    = vr.CDSSDiagnosis3;
                    rdata.DiagnosisResult1  = vr.DiagnosisResult1;
                    rdata.DiagnosisResult2  = vr.DiagnosisResult2;
                    rdata.DiagnosisResult3  = vr.DiagnosisResult3;
                    rdata.Prescription      = vr.Prescription;
                    rdata.ChiefComplaint    = vr.ChiefComplaint;
                    rdata.PreviousDiagnosis = vr.PreviousDiagnosis;
                    rdata.PrescriptionNote  = vr.PrescriptionNote;
                    foreach (SecondaryHeadacheSymptom ss in vr.SecondaryHeadacheSymptom)
                    {
                        rdata.secondaryheadachesymptom.Add(ss.Symptom);
                    }
                    foreach (MedicationAdvice madvice in vr.MedicationAdvice)
                    {
                        HMedicine hmedicine = new HMedicine();
                        hmedicine.DrugApplication = madvice.DrugApplication;
                        hmedicine.DrugCategory    = madvice.DrugCategory;
                        hmedicine.DrugName        = madvice.DrugName;
                        hmedicine.DrugDose        = madvice.DrugDose;
                        hmedicine.DrugDoseUnit    = madvice.DrugDoseUnit;
                        rdata.medicationadvice.Add(hmedicine);
                    }

                    if (vr.PrimaryHeadachaOverView != null)
                    {
                        rdata.headacheoverview.HeadacheType   = vr.PrimaryHeadachaOverView.HeadacheType;
                        rdata.headacheoverview.HeadacheDegree = vr.PrimaryHeadachaOverView.HeadacheDegree;
                        rdata.headacheoverview.HeadcheTime    = vr.PrimaryHeadachaOverView.HeadcheTime;
                        rdata.headacheoverview.HeacheTimeUnit = vr.PrimaryHeadachaOverView.HeacheTimeUnit;

                        rdata.headacheoverview.FrequencyPerMonth = vr.PrimaryHeadachaOverView.FrequencyPerMonth;
                        rdata.headacheoverview.OnsetFixedPeriod  = vr.PrimaryHeadachaOverView.OnsetFixedPeriod;

                        rdata.headacheoverview.OnsetDate          = vr.PrimaryHeadachaOverView.OnsetDate;
                        rdata.headacheoverview.OnsetAmount        = vr.PrimaryHeadachaOverView.OnsetAmount;
                        rdata.headacheoverview.DailyAggravation   = vr.PrimaryHeadachaOverView.DailyAggravation;
                        rdata.headacheoverview.FirstOnsetContinue = vr.PrimaryHeadachaOverView.FirstOnsetContinue;

                        foreach (HeadachePlace hp in vr.PrimaryHeadachaOverView.HeadachePlace)
                        {
                            string strPlace = hp.Position + hp.SpecificPlace;
                            rdata.headacheplace.Add(strPlace);
                        }
                        foreach (HeadacheProdrome hprodrome in vr.PrimaryHeadachaOverView.HeadacheProdrome)
                        {
                            rdata.headacheprodrome.Add(hprodrome.Prodrome);
                        }
                        foreach (MitigatingFactors mfactors in vr.PrimaryHeadachaOverView.MitigatingFactors)
                        {
                            rdata.mitigatingfactors.Add(mfactors.FactorName);
                        }
                        foreach (HeadacheAccompany haccompay in vr.PrimaryHeadachaOverView.HeadacheAccompany)
                        {
                            rdata.headacheaccompany.Add(haccompay.Symptom);
                        }
                        foreach (PrecipitatingFactor pfactor in vr.PrimaryHeadachaOverView.PrecipitatingFactor)
                        {
                            Factor f = new Factor();
                            f.FName   = pfactor.FactorName;
                            f.FDetail = pfactor.FactorDetail;
                            rdata.precipitatingfactor.Add(f);
                        }
                        foreach (PremonitorySymptom psymptom in vr.PrimaryHeadachaOverView.PremonitorySymptom)
                        {
                            rdata.premonitorsymptom.Add(psymptom.Symptom);
                        }
                    }

                    //add 2013/7/23
                    if (vr.GADQuestionaire != null)
                    {
                        ObjectMapper.CopyProperties(vr.GADQuestionaire, rdata.gdaquestionaire);
                    }
                    if (vr.PHQuestionaire != null)
                    {
                        ObjectMapper.CopyProperties(vr.PHQuestionaire, rdata.phquestionaire);
                    }
                    if (vr.SleepStatus != null)
                    {
                        ObjectMapper.CopyProperties(vr.SleepStatus, rdata.sleepconditon);
                    }
                    if (vr.DisabilityEvaluation != null)
                    {
                        ObjectMapper.CopyProperties(vr.DisabilityEvaluation, rdata.disablityevaluation);
                    }
                }
            }
            else
            {
                rdata.VisitDate = DateTime.Now.Date;
                rdata.headacheoverview.OnsetDate = DateTime.Now.Date;
            }
            return(rdata);
        }
Ejemplo n.º 6
0
        public bool DeleteRecord(string PatID, string RecordID)
        {
            try
            {
                var record = from p in context.VisitRecordSet.ToList()
                             where (p.PatBasicInfor.Id == PatID) && (p.Id == int.Parse(RecordID))
                             select p;
                VisitRecord r = record.First();
                if (r.PrimaryHeadachaOverView != null)
                {
                    while (r.PrimaryHeadachaOverView.HeadachePlace.Count != 0)
                    {
                        context.HeadachePlaceSet.Remove(r.PrimaryHeadachaOverView.HeadachePlace.First());
                    }
                    while (r.PrimaryHeadachaOverView.HeadacheAccompany.Count != 0)
                    {
                        context.HeadacheAccompanySet.Remove(r.PrimaryHeadachaOverView.HeadacheAccompany.First());
                    }
                    while (r.PrimaryHeadachaOverView.HeadacheProdrome.Count != 0)
                    {
                        context.HeadacheProdromeSet.Remove(r.PrimaryHeadachaOverView.HeadacheProdrome.First());
                    }
                    while (r.PrimaryHeadachaOverView.PrecipitatingFactor.Count != 0)
                    {
                        context.PrecipitatingFactorSet.Remove(r.PrimaryHeadachaOverView.PrecipitatingFactor.First());
                    }
                    while (r.PrimaryHeadachaOverView.MitigatingFactors.Count != 0)
                    {
                        context.MitigatingFactorsSet.Remove(r.PrimaryHeadachaOverView.MitigatingFactors.First());
                    }
                    context.PrimaryHeadacheOverViewSet.Remove(r.PrimaryHeadachaOverView);
                }


                while (r.MedicationAdvice.Count != 0)
                {
                    context.MedicationAdviceSet.Remove(r.MedicationAdvice.FirstOrDefault());
                }

                while (r.SecondaryHeadacheSymptom.Count != 0)
                {
                    context.SecondaryHeadacheSymptomSet.Remove(r.SecondaryHeadacheSymptom.FirstOrDefault());
                }
                //add 2013/7/23
                if (r.GADQuestionaire != null)
                {
                    context.GADQuestionaireSet.Remove(r.GADQuestionaire);
                }
                if (r.GADQuestionaire != null)
                {
                    context.GADQuestionaireSet.Remove(r.GADQuestionaire);
                }
                if (r.PHQuestionaire != null)
                {
                    context.PHQuestionaireSet.Remove(r.PHQuestionaire);
                }
                if (r.SleepStatus != null)
                {
                    context.SleepStatusSet.Remove(r.SleepStatus);
                }
                if (r.DisabilityEvaluation != null)
                {
                    context.DisabilityEvaluationSet.Remove(r.DisabilityEvaluation);
                }
                // visitrecord 内容删除
                context.VisitRecordSet.Remove(r);
                context.SaveChanges();
                return(true);
            }
            catch (System.Exception e)
            {
                return(false);
            }
        }
Ejemplo n.º 7
0
        public bool SaveRecord(string PatID, VisitData VData)
        {
            try
            {
                VisitData vdata = DataPreprocess(VData);
                PatBasicInfor pt = context.PatBasicInforSet.Find(PatID);
                pt.HeadacheFamilyMember = vdata.HFamilyMember;//个人信息相关保存
                pt.OtherFamilyDisease = vdata.OFamilyDisease;
                ObjectMapper.CopyProperties(vdata.lifestyle, pt.Lifestyle);
                pt.PreviousDrug = vdata.PDrug;
                if (vdata.Similarfamily == "有")
                {
                    pt.SimilarFamily = true;
                }
                else
                {
                    pt.SimilarFamily = false;
                }

                pt.PreviousExam = vdata.PExam;
                if (vdata.visitrecord != null)
                {

                    VisitRecord vr = new VisitRecord();//问诊记录信息保存
                    vr = vdata.visitrecord;
                    vr.VisitDate = DateTime.Now.Date;
                    vr.PrimaryHeadachaOverView = vdata.PHeadacheOverview;
                    vr.PatBasicInforId = PatID;
                    pt.VisitRecord.Add(vr);
                }
                context.SaveChanges();
                return true;
            }
            catch (DbEntityValidationException dbEx)
            {
                foreach (var validationErrors in dbEx.EntityValidationErrors)
                {
                    foreach (var validationError in validationErrors.ValidationErrors)
                    {
                        Trace.TraceInformation("Property: {0} Error: {1}", validationError.PropertyName, validationError.ErrorMessage);
                    }
                }
                return false;
            }
        }
Ejemplo n.º 8
0
        public bool DeleteRecord(string PatID, string RecordID)
        {
            try
            {
                var record = from p in context.VisitRecordSet.ToList()
                             where (p.PatBasicInfor.Id == PatID) && (p.Id == int.Parse(RecordID))
                             select p;
                VisitRecord r = record.First();
                if (r.PrimaryHeadachaOverView != null)
                {
                    while (r.PrimaryHeadachaOverView.HeadachePlace.Count != 0)
                    {
                        context.HeadachePlaceSet.Remove(r.PrimaryHeadachaOverView.HeadachePlace.First());
                    }
                    while (r.PrimaryHeadachaOverView.HeadacheAccompany.Count != 0)
                    {
                        context.HeadacheAccompanySet.Remove(r.PrimaryHeadachaOverView.HeadacheAccompany.First());
                    }
                    while (r.PrimaryHeadachaOverView.HeadacheProdrome.Count != 0)
                    {
                        context.HeadacheProdromeSet.Remove(r.PrimaryHeadachaOverView.HeadacheProdrome.First());
                    }
                    while (r.PrimaryHeadachaOverView.PrecipitatingFactor.Count != 0)
                    {
                        context.PrecipitatingFactorSet.Remove(r.PrimaryHeadachaOverView.PrecipitatingFactor.First());
                    }
                    while (r.PrimaryHeadachaOverView.MitigatingFactors.Count != 0)
                    {
                        context.MitigatingFactorsSet.Remove(r.PrimaryHeadachaOverView.MitigatingFactors.First());
                    }
                    while (r.PrimaryHeadachaOverView.PremonitorySymptom.Count != 0)
                    {
                        context.PremonitorySymptom集.Remove(r.PrimaryHeadachaOverView.PremonitorySymptom.First());
                    }
                    context.PrimaryHeadacheOverViewSet.Remove(r.PrimaryHeadachaOverView);
                }


                while (r.MedicationAdvice.Count != 0)
                {
                    context.MedicationAdviceSet.Remove(r.MedicationAdvice.FirstOrDefault());
                }

                while (r.SecondaryHeadacheSymptom.Count != 0)
                {
                    context.SecondaryHeadacheSymptomSet.Remove(r.SecondaryHeadacheSymptom.FirstOrDefault());
                }
                //add 2013/7/23
                if (r.GADQuestionaire != null)
                {
                    context.GADQuestionaireSet.Remove(r.GADQuestionaire);
                }
                if (r.GADQuestionaire != null)
                {
                    context.GADQuestionaireSet.Remove(r.GADQuestionaire);
                }
                if (r.PHQuestionaire != null)
                {
                    context.PHQuestionaireSet.Remove(r.PHQuestionaire);
                }
                if (r.SleepStatus != null)
                {
                    context.SleepStatusSet.Remove(r.SleepStatus);
                }
                if (r.DisabilityEvaluation != null)
                {
                    context.DisabilityEvaluationSet.Remove(r.DisabilityEvaluation);
                }
                // visitrecord 内容删除
                context.VisitRecordSet.Remove(r);
                context.SaveChanges();
                return(true);
            }
            catch (DbEntityValidationException dbEx)
            {
                foreach (var validationErrors in dbEx.EntityValidationErrors)
                {
                    foreach (var validationError in validationErrors.ValidationErrors)
                    {
                        Trace.TraceInformation("Property: {0} Error: {1}", validationError.PropertyName, validationError.ErrorMessage);
                    }
                }
                return(false);
            }
        }
Ejemplo n.º 9
0
        public bool UpdateRecord(string PatID, string VisitID, VisitData VData)
        {
            try
            {
                VisitData     vdata = DataPreprocess(VData);
                PatBasicInfor pt    = context.PatBasicInforSet.Find(PatID);
                pt.HeadacheFamilyMember = vdata.HFamilyMember;//个人信息相关保存
                pt.OtherFamilyDisease   = vdata.OFamilyDisease;
                ObjectMapper.CopyProperties(vdata.lifestyle, pt.Lifestyle);
                pt.PreviousDrug = vdata.PDrug;//需要看一下,这里的Pdrug有没有数据
                foreach (PreviousDrug pg in pt.PreviousDrug)
                {
                    pg.PatBasicInforId = PatID;
                }
                pt.PreviousExam = vdata.PExam;
                if (vdata.Similarfamily == "有")
                {
                    pt.SimilarFamily = true;
                }
                else
                {
                    pt.SimilarFamily = false;
                }
                if (vdata.visitrecord != null)
                {
                    IEnumerable <VisitRecord> record = from p in context.VisitRecordSet.ToList()
                                                       where (p.PatBasicInfor.Id == PatID) && (p.Id == int.Parse(VisitID))
                                                       select p;
                    VisitRecord vr = record.First();

                    ObjectMapper.CopyProperties(vdata.visitrecord, vr);
                    ObjectMapper.CopyProperties(vdata.PHeadacheOverview, vr.PrimaryHeadachaOverView);

                    ObjectMapper.CopyProperties(vdata.GADquestionaire, vr.GADQuestionaire);
                    ObjectMapper.CopyProperties(vdata.PHquestionaire, vr.PHQuestionaire);
                    ObjectMapper.CopyProperties(vdata.Disabilityevaluation, vr.DisabilityEvaluation);
                    ObjectMapper.CopyProperties(vdata.Sleepstatus, vr.SleepStatus);
                    vr.PrimaryHeadachaOverView.VisitRecord = vr;
                    vr.GADQuestionaire.VisitRecord         = vr;
                    vr.PHQuestionaire.VisitRecord          = vr;
                    vr.DisabilityEvaluation.VisitRecord    = vr;
                    vr.SleepStatus.VisitRecord             = vr;


                    vr.PatBasicInforId = PatID;
                    vr.VisitDate       = System.DateTime.Now;
                    //vr.VisitDate = DateTime.Now.Date;
                    //System.DateTime.Now.ToString("G");
                    context.Entry(vr).State = System.Data.EntityState.Modified;
                }
                context.SaveChanges();
                return(true);
            }
            catch (DbEntityValidationException dbEx)
            {
                foreach (var validationErrors in dbEx.EntityValidationErrors)
                {
                    foreach (var validationError in validationErrors.ValidationErrors)
                    {
                        Trace.TraceInformation("Property: {0} Error: {1}", validationError.PropertyName, validationError.ErrorMessage);
                    }
                }
                return(false);
            }
            //catch (Exception e)
            //{
            //    return false;
            //}
        }