public async void GetAllSymptoms()
        {
            SymptomService symptomService = new SymptomService(new SymptomsDao());

            ServiceResponse <List <Dictionary <string, string> > > response = await symptomService.getSymptoms();

            bool expected = true;
            bool actual   = false;

            if (response.Data.Count != 0)
            {
                actual = true;
            }

            Assert.Equal(expected, actual);
        }
Пример #2
0
 public SymptomController()
 {
     symptomService = new SymptomService(new SymptomsDao());
 }
Пример #3
0
        //按钮:文档输出
        private void Output_Document(object sender, RoutedEventArgs e)
        {
            Microsoft.Win32.SaveFileDialog sfd = new Microsoft.Win32.SaveFileDialog
            {
                Filter = LanguageUtils.ConvertLanguage("Excel表格(*.xlsx)|*.xlsx", "Excel Sheet (*.xlsx)|*.xlsx")
            };
            //设置默认文件类型显示顺序
            sfd.FilterIndex = 1;
            //保存对话框是否记忆上次打开的目录
            sfd.RestoreDirectory = true;

            if (selectUser != null)
            {
                if (is_signinformationrecord.IsChecked == true)
                {
                    sfd.FileName = selectUser.User_Name + "-" + LanguageUtils.GetCurrentLanuageStrByKey("SubjectInfoView.VitalHistory") + "-" + DateTime.Now.ToString("yyyyMMddHHmm") + ".xlsx";
                }
                if (is_trainingrecord.IsChecked == true)
                {
                    sfd.FileName = selectUser.User_Name + "-" + LanguageUtils.GetCurrentLanuageStrByKey("SubjectInfoView.TrainingHistory") + "-" + DateTime.Now.ToString("yyyyMMddHHmm") + ".xlsx";
                }
                if (is_physicalevaluation.IsChecked == true)
                {
                    sfd.FileName = selectUser.User_Name + "-" + LanguageUtils.GetCurrentLanuageStrByKey("SubjectInfoView.PhysicalEvaluationHistory") + "-" + DateTime.Now.ToString("yyyyMMddHHmm") + ".xlsx";
                }
            }

            if (sfd.ShowDialog() == true)
            {
                //此处做你想做的事 ...=ofd.FileName;
                //获取当前
                try
                {
                    if (is_signinformationrecord.IsChecked == true)
                    {
                        //导出症状信息记录
                        if (selectUser != null)
                        {
                            //获取用户症状信息
                            List <SymptomInfo> lists = new SymptomService().GetByUserId(selectUser);
                            if (lists.Count > 0)
                            {
                                List <object> symptomInfoDtos = new List <object>();
                                foreach (SymptomInfo symptomInfo in lists)
                                {
                                    symptomInfoDtos.Add(new SymptomInfoExcelVO(symptomInfo));
                                }

                                //存放信息导出的列名
                                if (LanguageUtils.IsChainese())
                                {
                                    string[] colNames = { "训练日期", "血压(前)", "脉搏(前)", "心率(前)", "体温(前)", "血压(后)", "脉搏(后)", "心率(后)", "体温(后)", "身体倦怠", "腹泻", "摇晃", "心跳、气喘", "咳嗽、有痰", "发烧", "胸部、肚子痛", "没有食欲", "持续便秘", "感到头晕", "头痛", "其他", "没有相关症状", "是否参加", "水分摄取", "看护记录" };
                                    ExcelUtil.GenerateOrdinaryExcel(sfd.FileName.ToString(), selectUser, ExcelUtil.ToDataTable("症状信息记录", colNames, symptomInfoDtos));
                                }
                                else
                                {
                                    string[] colNames = { "Training date", "Blood pressure (front)", "Pulse (front)", "Heart rate (front)", "Body temperature (front)", "Blood pressure (after)", "Pulse (after)", "Heart rate (after)", "Body temperature (after)", "Physical exhaustion", "Diarrhea", "Shake", "Heartbeat, asthma", "Cough with phlegm", "Fever", "Chest and stomach pain", "No appetite", "Continuous constipation", "Feeling dizzy", "Headache", "Other", "No related symptoms", "Whether to participate", "Moisture intake", "Care record" };
                                    ExcelUtil.GenerateOrdinaryExcel(sfd.FileName.ToString(), selectUser, ExcelUtil.ToDataTable("Symptom information record", colNames, symptomInfoDtos));
                                }
                            }
                            else
                            {
                                MessageBoxX.Warning(LanguageUtils.ConvertLanguage("抱歉,没有数据", "Sorry, No Data!"));
                            }
                        }
                    }
                    else if (is_trainingrecord.IsChecked == true)
                    {
                        //导出训练记录
                        if (selectUser != null)
                        {
                            List <TrainComprehensive> lists = new ExcelService().ListTrainExcekVOByUserId(selectUser.Pk_User_Id);
                            if (lists.Count > 0)
                            {
                                List <object> excelLists = new List <object>();
                                foreach (TrainComprehensive trainComprehensive in lists)
                                {
                                    excelLists.Add(new TrainExcelVO(trainComprehensive));
                                }
                                //Console.WriteLine(lists.ToString());
                                //存放信息导出的列名
                                if (LanguageUtils.IsChainese())
                                {
                                    string[] colNames = { "实施日期", "使用器械", "组数", "组的个数", "组间隔休息时间", " 砝码", "移乘方法", "自觉运动强度", "时间(秒)", " 距离(mm)", "总工作量(J)", "热量(cal)", "指数", "已完成组数", "时机、姿势", "备忘", "注意点", "利用者感想" };
                                    ExcelUtil.GenerateOrdinaryExcel(sfd.FileName.ToString(), selectUser, ExcelUtil.ToDataTable("训练记录", colNames, excelLists));
                                }
                                else
                                {
                                    string[] colNames = { "Date", "Device name", "Groups", "Number", "Break time", " Weights", "Transfer method", "Conscious exercise intensity", "Time (seconds)", " Distance (mm)", "Total workload (J)", "Calories (cal)", "Index", "Completed groups", "Timing, posture", "Remark", "Be careful", "User feelings" };
                                    ExcelUtil.GenerateOrdinaryExcel(sfd.FileName.ToString(), selectUser, ExcelUtil.ToDataTable("Training record", colNames, excelLists));
                                }
                            }
                            else
                            {
                                MessageBoxX.Warning(LanguageUtils.ConvertLanguage("抱歉,没有数据", "Sorry, No Data!"));
                            }
                        }
                    }
                    else if (is_physicalevaluation.IsChecked == true)
                    {
                        //导出体力评价记录
                        if (selectUser != null)
                        {
                            List <PhysicalPower> lists = new ExcelService().ListPhysicalPowerExcelVO(selectUser.Pk_User_Id);
                            if (lists.Count > 0)
                            {
                                List <object> excelLists = new List <object>();
                                foreach (PhysicalPower physicalPower in lists)
                                {
                                    excelLists.Add(new PhysicaleExcelVO(physicalPower));
                                }

                                //存放信息导出的列名
                                if (LanguageUtils.IsChainese())
                                {
                                    string[] colNames = { "日期", "身高", "体重", "握力", "睁眼单脚站立", "功能性前伸", "坐姿体前屈", "time&up go", "5m步行-通常", "5m步行-最快", "10m步行", "6分钟步行", "2分钟踏步", "2分钟抬腿", "使用用者感想", "工作人员感想" };

                                    ExcelUtil.GenerateOrdinaryExcel(sfd.FileName.ToString(), selectUser,
                                                                    ExcelUtil.ToDataTable("体力评价记录", colNames, excelLists));
                                }
                                else
                                {
                                    string[] colNames = { "Date", "High", "Weight", "Grip", "Wink stand on one foot", "Functional reach", "Sitting body flexion", "time&up go", "5m walk - usually", "5m walk - fastest", "10m walk", "6 minutes walk", "2 String step", "2 minutes leg lift", "User experience", "Staff feelings" };

                                    ExcelUtil.GenerateOrdinaryExcel(sfd.FileName.ToString(), selectUser,
                                                                    ExcelUtil.ToDataTable("Physical Assessment Record", colNames, excelLists));
                                }
                            }
                            else
                            {
                                MessageBoxX.Warning(LanguageUtils.ConvertLanguage("抱歉,没有数据", "Sorry, No Data!"));
                            }
                        }
                    }
                }
                catch (IOException ex)
                {
                    MessageBoxX.Warning(LanguageUtils.ConvertLanguage("文件被占用,请先关闭文件", "The file is occupied. Please close the file first"));
                    return;
                }
                catch (Exception ex)
                {
                    Console.WriteLine("生成普通Excel异常");
                    return;
                }
            }
        }
Пример #4
0
        /// <summary>
        /// 刷新右下角frame
        /// </summary>
        /// 给frame加入数据
        private void Refresh_RecordFrame_Action()
        {
            User user = selectUser;

            if (user == null)
            {
                //MessageBox.Show("请选择用户");
                return;
            }

            if (user.User_Name != "" && user.User_Name != null)
            {
                if (is_signinformationrecord.IsChecked == true)
                {
                    List <SymptomInfo>    symptomInfos    = new SymptomService().GetByUserId(user);
                    List <SymptomInfoDTO> symptomInfoDtos = new List <SymptomInfoDTO>();
                    foreach (SymptomInfo symptomInfo in symptomInfos)
                    {
                        symptomInfoDtos.Add(new SymptomInfoDTO(symptomInfo));
                    }

                    //展示在frame
                    SignInformationRecord_Frame signInformationRecordFrame = new SignInformationRecord_Frame();//(SignInformationRecord_Frame)o;
                    signInformationRecordFrame.SignInformationRecord.ItemsSource = symptomInfoDtos;
                    record.Content = signInformationRecordFrame;
                }
                else if (is_trainingrecord.IsChecked == true)
                {
//                    Dictionary<int, List<TrainDTO>> dic = new TrainService().getTrainDTOByUser(user);
                    Dictionary <int, List <TrainDTO> > dic   = new TrainService().getTrainDTOByUserA(user);
                    TrainingRecord_Frame trainingRecordFrame = new TrainingRecord_Frame();
                    List <TrainDTO>      trainDtos           = new List <TrainDTO>();
                    dic.TryGetValue((int)DeviceType.X01, out trainDtos);
                    trainingRecordFrame.TrainingRecord1.ItemsSource = trainDtos;
                    dic.TryGetValue((int)DeviceType.X05, out trainDtos);
                    trainingRecordFrame.TrainingRecord2.ItemsSource = trainDtos;
                    dic.TryGetValue((int)DeviceType.X04, out trainDtos);
                    trainingRecordFrame.TrainingRecord3.ItemsSource = trainDtos;
                    dic.TryGetValue((int)DeviceType.X03, out trainDtos);
                    trainingRecordFrame.TrainingRecord4.ItemsSource = trainDtos;
                    dic.TryGetValue((int)DeviceType.X06, out trainDtos);
                    trainingRecordFrame.TrainingRecord5.ItemsSource = trainDtos;
                    dic.TryGetValue((int)DeviceType.X02, out trainDtos);
                    trainingRecordFrame.TrainingRecord6.ItemsSource = trainDtos;

                    record.Content = trainingRecordFrame;
                }
                else if (is_physicalevaluation.IsChecked == true)
                {
                    List <PhysicalPower> physicalPowers = new PhysicaleValuationService().GetByUserId(user);
                    List <PhysicaleDTO>  physicaleDTOs  = new List <PhysicaleDTO>();
                    foreach (PhysicalPower physicalPower in physicalPowers)
                    {
                        PhysicaleDTO physicaleDTO = new PhysicaleDTO(physicalPower);
                        //为空,说明有可能是不符合格式的数据
                        if (physicaleDTO.ID != null)
                        {
                            physicaleDTOs.Add(physicaleDTO);
                        }
                    }

                    //展示在frame
                    PhysicaleValuation_Frame physicaleValuation_Frame = new PhysicaleValuation_Frame();
                    physicaleValuation_Frame.PhysicaleValuation.ItemsSource = physicaleDTOs;
                    record.Content = physicaleValuation_Frame;
                }
            }
        }