Esempio n. 1
0
        public void BindInfomation(string patientId, DateTime Date, EvaluateActionEnum ActionEnum, PrintOutputInfo Info)
        {
            var list = ((from od in MySession.Query<EvaluteDetail>()
                        where od.PatientID == patientId && od.ActionId == Convert.ToInt32(ActionEnum) && od.EvaluteDetailDate > Date && od.EvaluteDetailDate < Date.AddDays(1)
                        select od).OrderByDescending(x=>x.EvaluteDetailDate).Take(3).ToList());

            //Protrusive.
            int count = 0;
            float ExplosiveForceAVGSUM = 0;
            float EnduranceAVGSUM = 0;
            float LaborIndexAVGSUM = 0;

            if (list != null && list.Count() > 0)
            {
                count = list.Count();

                double[] ExplosiveForceNums = new double[count];
                double[] EnduranceNums = new double[count];
                double[] LaborIndexNums = new double[count];

                for (int i = 0; i < count; i++)
                {
                    if (i == 0)
                    {
                        Info.ExplosiveForceFirst = list.ToList()[i].MaxV.ToString(("#0.00"));
                        Info.EnduranceFirst = list.ToList()[i].LastValue.ToString(("#0.00"));
                        Info.LaborIndexFirst = ((list.ToList()[i].FatigueIndex) * 100).ToString(("#0.00"));
                        Info.IntervalValue = list.ToList()[i].Interval.ToString();

                    }
                    else if (i == 1)
                    {
                        Info.ExplosiveForceSecond = list.ToList()[i].MaxV.ToString(("#0.00"));
                        Info.EnduranceSecond = list.ToList()[i].LastValue.ToString(("#0.00"));
                        Info.LaborIndexSecond = ((list.ToList()[i].FatigueIndex) * 100).ToString(("#0.00"));
                    }
                    else if(i==2)
                    {
                        Info.ExplosiveForceThird = list.ToList()[i].MaxV.ToString(("#0.00"));
                        Info.EnduranceThird = list.ToList()[i].LastValue.ToString(("#0.00"));
                        Info.LaborIndexThird = ((list.ToList()[i].FatigueIndex) * 100).ToString(("#0.00"));
                    }

                    ExplosiveForceAVGSUM += list.ToList()[i].MaxV;
                    EnduranceAVGSUM += list.ToList()[i].LastValue;
                    LaborIndexAVGSUM += (list.ToList()[i].FatigueIndex) * 100;

                    ExplosiveForceNums[i] = list.ToList()[i].MaxV;
                    EnduranceNums[i] = list.ToList()[i].LastValue;
                    LaborIndexNums[i] = (list.ToList()[i].FatigueIndex) * 100;
                }

                #region 平均值

                Info.ExplosiveForceAVG = Convert.ToDecimal(ExplosiveForceAVGSUM / count).ToString(("#0.00"));
                Info.EnduranceAVG = Convert.ToDecimal(EnduranceAVGSUM / count).ToString(("#0.00"));
                Info.LaborIndexAVG = Convert.ToDecimal(LaborIndexAVGSUM / count).ToString(("#0.00"));

                #endregion

                #region 标准差
                Info.ExplosiveForceSD = GetSD(ExplosiveForceNums, Info.ExplosiveForceAVG, count).ToString();
                Info.EnduranceSD = GetSD(EnduranceNums, Info.EnduranceAVG, count).ToString();
                Info.LaborIndexSD = GetSD(LaborIndexNums, Info.LaborIndexAVG, count).ToString();
                #endregion

                #region 标准值
                
                #endregion
               

                #region 时间
                Info.FitTime = Convert.ToDateTime(list.ToList()[0].EvaluteDetailDate).ToString("yyyy-MM-dd");
                #endregion

            }

        }
        private static void SetDataPoints(Chart chart1, List<EvaluteDetail> allData,EvaluateActionEnum action,string name)
        {
            var data = (from ad in allData
                       where ad.ActionId == (int)action
                        select ad).OrderBy(x => x.EvaluteDetailDate).ToList();

            DataSeries ds = new DataSeries();
            ds.RenderAs = RenderAs.Line;
            SolidColorBrush brush = new SolidColorBrush(Colors.Red);
            ds.Color = brush;
            ds.Name = name;
            foreach (var item in data)
            {
                DataPoint dp = new DataPoint();
                dp.YValue = Convert.ToDouble(item.MaxV);
                dp.AxisXLabel = item.EvaluteDetailDate.ToString("yyyy-MM-dd");
                ds.DataPoints.Add(dp);
            }
            chart1.Series.Add(ds);
        }
 private static string GetROM(List<EvaluteDetail> list,EvaluateActionEnum Enum,string dt)
 {
     var obj1 = from od in list
                where od.ActionId == (int)Enum&&od.EvaluteDate.ToString("yyyy-MM-dd")==dt
                group od by new { od.ActionId, od.EvaluteDate } into p
                select new
                {
                    p.Key.ActionId,
                    maxvalue = p.Max(x => x.MaxV),
                    p.Key.EvaluteDate
                };
     Demo d = new Demo();
     foreach (var obj in obj1)
     {
         d.ActionID = obj.ActionId.ToString();
         d.Key = obj.EvaluteDate.ToString();
         d.Value = obj.maxvalue.ToString();
     }
     if (d.Value != ""&&d.Value!=null)
     {
         return d.Value;
     }
     else
     {
         return "N/A";
     }
 }
        public void DoEvaluateAction(EvaluateActionEnum evaluateActionEnum, EvaluateModeEnum evaluateMode)
        {
            Reset();
            startTicks = DateTime.Now.Ticks;

            LumbarRobotController.RobotController.ControlCommand.PauseCmd();
            Thread.Sleep(10);
            LumbarRobotController.RobotController.ControlCommand.PauseCmd();
            Thread.Sleep(10);

            if (evaluateAction == null)
            {
                evaluateAction = new EvaluateAction();
                evaluateAction.SetForce += new SetForceHandler(action_SetForce);
                evaluateAction.StartAction += new EventHandler(action_StartAction);
                evaluateAction.StopAction += new EventHandler(action_StopAction);
            }

            evaluateAction.Mode = ModeEnum.Evaluation;
            if (evaluateActionEnum == EvaluateActionEnum.RotationRangeLeft || evaluateActionEnum == EvaluateActionEnum.RotationRangeRight
                || evaluateActionEnum == EvaluateActionEnum.RotationStrengthLeft || evaluateActionEnum == EvaluateActionEnum.RotationStrengthRigth)
            {

                evaluateAction.Action = ActionEnum.Rotation;
            }
            else
            {
                evaluateAction.Action = ActionEnum.ProtrusiveOrBend;
            }
            currentControl = evaluateAction;

            if (currentControl != null)
            {
                evaluateAction.EvaluateActionValue = evaluateActionEnum;
                evaluateAction.EvaluateMode = evaluateMode;
                evaluateAction.Controller = this;
                evaluateAction.Start();
            }
        }