Ejemplo n.º 1
0
        public Patient GetDashBoardDataByPerson(int numPatient, float height, float weight)
        {
            Patient p = new Patient();

            laboratoryTests = new LaboratoryTests();
            foodReport      = new FoodReport();
            DBservices ds = new DBservices();
            //List<Patient> patients = ds.GetPatients();



            List <LaboratoryTests> labratoryTestList = laboratoryTests.GetLab(numPatient);
            List <FoodReport>      foodReportList    = foodReport.GetFoodReportByPatienty(numPatient);
            double bmi = weight / (height * height);

            bmi   = Math.Round(bmi, 4);
            p.BMI = bmi;

            CalcUserStatus(labratoryTestList.FirstOrDefault(), foodReportList, p.BMI, p);


            //DashBoardVM dvm = new DashBoardVM();
            //dvm.Patients = patients;
            return(p);
        }
Ejemplo n.º 2
0
        private void CalcUserStatus(LaboratoryTests laboratoryTests,
                                    List <FoodReport> foodReportList, double _bmi, Patient p)
        {
            int    bloodeGrade = CalcAvgBloodeTest(laboratoryTests);//max of 25 points
            double foodGrade   = CalcAvgFoodReport(foodReportList);
            int    bmiGrade    = CalcAvgBMI(_bmi);

            p.Status = new StatusGrades(bmiGrade, bloodeGrade, foodGrade);
        }
Ejemplo n.º 3
0
        private int CalcAvgBloodeTest(LaboratoryTests laboratoryTests)
        {
            if (laboratoryTests == null)
            {
                return(0);
            }
            LabRange        lr        = new LabRange();
            List <LabRange> labRanges = lr.GetLabRange();

            int      bloodeGrade  = 0;
            LabRange Albumin      = labRanges.FirstOrDefault(x => x.Name == "Albumin");
            LabRange Cholesterol  = labRanges.FirstOrDefault(x => x.Name == "Cholesterol");
            LabRange ProteinTotal = labRanges.FirstOrDefault(x => x.Name == "ProteinTotal");
            LabRange CRP          = labRanges.FirstOrDefault(x => x.Name == "CRP");
            LabRange Lymphocytes  = labRanges.FirstOrDefault(x => x.Name == "Lymphocytes");

            if (laboratoryTests.Albumin >= Albumin.MinP && laboratoryTests.Albumin <= Albumin.MaxP)
            {
                bloodeGrade += 5;
            }
            if (laboratoryTests.Cholesterol >= Cholesterol.MinP && laboratoryTests.Cholesterol <= Cholesterol.MaxP)
            {
                bloodeGrade += 5;
            }
            if (laboratoryTests.ProteinTotal >= ProteinTotal.MinP && laboratoryTests.ProteinTotal <= ProteinTotal.MaxP)
            {
                bloodeGrade += 5;
            }
            if (laboratoryTests.Crp >= CRP.MinP && laboratoryTests.Crp <= CRP.MaxP)
            {
                bloodeGrade += 5;
            }
            if (laboratoryTests.Lymphocytes >= Lymphocytes.MinP && laboratoryTests.Lymphocytes <= Lymphocytes.MaxP)
            {
                bloodeGrade += 5;
            }
            return(bloodeGrade);
        }
Ejemplo n.º 4
0
        public DashBoardVM GetDashBoardData()
        {
            laboratoryTests = new LaboratoryTests();
            foodReport      = new FoodReport();
            DBservices ds = new DBservices();
            //List<Patient> patients = ds.GetPatients();
            List <Patient> patients = ds.GetPatientsforSmart();

            foreach (Patient p in patients)
            {
                List <LaboratoryTests> labratoryTestList = laboratoryTests.GetLab(p.NumPatient);
                List <FoodReport>      foodReportList    = foodReport.GetFoodReportByPatienty(p.NumPatient);
                double bmi = p.Weight / (p.Height * p.Height);
                bmi   = Math.Round(bmi, 4);
                p.BMI = bmi;

                CalcUserStatus(labratoryTestList.FirstOrDefault(), foodReportList, p.BMI, p);
            }

            DashBoardVM dvm = new DashBoardVM();

            dvm.Patients = patients;
            return(dvm);
        }