//上传 private void UploadBtn_Click(object sender, RoutedEventArgs e) { if (System.Windows.MessageBox.Show("是否上传检测记录?", "提示", MessageBoxButton.OKCancel) == MessageBoxResult.OK) { string activityId = Uid; List <StudentCheckData> studentCheckDatas = dbUtill.GetUploadDatasByActivityId(activityId); if (studentCheckDatas.Count > 0) { MyCustomControlLibrary.MMessageBox.ShowLoading(MyCustomControlLibrary.MMessageBox.LoadType.Circle, "正在上传", new Point(0, 0), new Size(0, 0), "", System.Windows.Controls.Orientation.Vertical, "#ffffff", 3); string url = dbUtill.GetImageUrl(); string uploadUrl = ConfigurationManager.AppSettings["UploadUrl"]; string schoolId = ConfigurationManager.AppSettings["schoolId"]; Activity activity = dbUtill.GetActivitieInfoByID(ActivityId); foreach (StudentCheckData student in studentCheckDatas) { string res = dbUtill.GetStudentInfoByStudentId(student.studentId); string studentName = dbUtill.GetStudentNameByID(student.studentId); string[] resArray = res.Split(','); string gradeName = resArray[1]; string className = resArray[0]; string path = @url + "\\" + ActivityName + "\\" + gradeName + "\\" + className + "\\" + student.studentId + "_" + studentName + ".jpg"; if (!File.Exists(path)) { ImageInfo imageInfo = CommonUtill.ImageFileInfo(path); if (student.jsonContent.Trim().Length > 1) { string param = "{\"student_educode\":\"" + student.NID + "\",\"activity_code\":\"" + activityId + "\",\"student_number\":\"" + student.studentId + "\",\"image\":[{\"image_size\":" + imageInfo.image_size + ",\"image_code\":" + imageInfo.image_code + ",\"fileName\":" + imageInfo.fileName + ",\"image_time\":" + imageInfo.image_time + "}],\"target_code\":\"7\", \"school_code\": \"" + schoolId + "\",\"datas\": { \"age\": " + student.studentAge + ",\"height\": " + student.studentHeight + ",\"checkDate\": \"" + student.checkDate + "\",\"checkResult\":\"" + student.jsonContent + "\"}},\"activityName\": \"" + activity.ActivityName + "\",\"activityDate\": \"" + activity.activityDate + "\"}"; string Res = requestUtill.PostRequestClient(uploadUrl, param); } } else { rp.checkData = student; rp.CreateMC780_boy(); ImageInfo imageInfo = CommonUtill.ImageFileInfo(path); if (student.jsonContent.Trim().Length > 1) { string param = "{\"student_educode\":\"" + student.NID + "\",\"activity_code\":\"" + activityId + "\",\"student_number\":\"" + student.studentId + "\",\"image\":[{\"image_size\":" + imageInfo.image_size + ",\"image_code\":" + imageInfo.image_code + ",\"fileName\":" + imageInfo.fileName + ",\"image_time\":" + imageInfo.image_time + "}],\"target_code\":\"7\", \"school_code\": \"" + schoolId + "\",\"datas\": { \"age\": " + student.studentAge + ",\"height\": " + student.studentHeight + ",\"checkDate\": \"" + student.checkDate + "\",\"checkResult\":\"" + student.jsonContent + "\"}},\"activityName\": \"" + activity.ActivityName + "\",\"activityDate\": \"" + activity.activityDate + "\"}"; string Res = requestUtill.PostRequestClient(uploadUrl, param); Console.WriteLine(Res); } } } MyCustomControlLibrary.MMessageBox.MClosed(); System.Windows.MessageBox.Show("上传完毕", "提示"); } else { System.Windows.MessageBox.Show("该活动不存在已检测的数据,请检测后再试", "提示"); } } }
private void Pd_PrintPage(object sender, PrintPageEventArgs e) { Font font = new Font("宋体", 11f); Font font1 = new Font("宋体", 8f); Font font2 = new Font("宋体", 9f); Dictionary <string, string> dic = checkDataUtill.GetDicByBackStr(checkData.jsonContent); Image image = Image.FromFile(@"Resources/780_boy.jpg"); int num = 0x317; int num1 = 0x45f; e.Graphics.DrawImage(image, 0, 0, num1, num); string studentName = dbUtill.GetStudentNameByID(checkData.studentId); try { e.Graphics.DrawString(studentName, font, Brushes.Black, new Point(75, 73)); //姓名 e.Graphics.DrawString(dic["AG"], font, Brushes.Black, new Point(200, 73)); //年龄 e.Graphics.DrawString(dic["Da"], new Font("宋体", 11f), Brushes.Black, new Point(300, 73)); //日期 string sex = dic["GE"]; if (sex.Equals("0")) { e.Graphics.DrawString("√", font, Brushes.Black, new Point(477, 73)); //性别 } else { e.Graphics.DrawString("√", font, Brushes.Black, new Point(513, 73)); // } e.Graphics.DrawString(checkData.studentId, new Font("宋体", 11f), Brushes.Black, new Point(75, 103)); //Id e.Graphics.DrawString(dic["Pt"], font, Brushes.Black, new Point(240, 103)); //着衣重量 e.Graphics.DrawString(dic["Hm"], font, Brushes.Black, new Point(334, 104)); //身高 string bodytype = dic["Bt"]; if (bodytype.Equals("0")) { e.Graphics.DrawString("√", font, Brushes.Black, new Point(440, 105)); //身体类型 } else { e.Graphics.DrawString("√", font, Brushes.Black, new Point(465, 105)); } e.Graphics.DrawString(dic["Wk"], font, Brushes.Black, new Point(80, 195)); //体重 e.Graphics.DrawString(dic["FW"], font, Brushes.Black, new Point(80, 220)); //体脂率 e.Graphics.DrawString(dic["fW"], font, Brushes.Black, new Point(80, 248)); //体脂量 e.Graphics.DrawString(dic["MW"], font, Brushes.Black, new Point(80, 273)); //去脂体重 e.Graphics.DrawString(dic["wW"], font, Brushes.Black, new Point(80, 298)); //体水份量 e.Graphics.DrawString(dic["MI"], font, Brushes.Black, new Point(80, 325)); //BMI //参考值 e.Graphics.DrawString("30.22~38.11", font1, Brushes.Black, new Point(152, 198)); //体重 e.Graphics.DrawString("10~25.9", font1, Brushes.Black, new Point(152, 223)); //体脂率 e.Graphics.DrawString("2.84~8.95", font1, Brushes.Black, new Point(152, 248)); //体脂量 e.Graphics.DrawString("27.38~29.16", font1, Brushes.Black, new System.Drawing.Point(152, 273)); //去脂体重 e.Graphics.DrawString("17.1~18.525", font1, Brushes.Black, new Point(152, 298)); //体水份量 e.Graphics.DrawString("13.6~18.6", font1, Brushes.Black, new System.Drawing.Point(152, 322)); //BMI // e.Graphics.DrawString(dic["mW"], font, Brushes.Black, new Point(130, 367)); //肌肉量 e.Graphics.DrawString(dic["bW"], font, Brushes.Black, new Point(130, 405)); //推定骨量 e.Graphics.DrawString(dic["rB"] + "Kcal", font, Brushes.Black, new Point(79, 450)); // 基础代谢率 e.Graphics.DrawString(dic["MI"], font, Brushes.Black, new Point(79, 500)); // 肥胖指数 double bmi = double.Parse(dic["MI"]); int bmi_i = (int)bmi; int b = 10 * (bmi_i - 16); Rectangle rectangle = new Rectangle(125, 495, 80 + b, 10); e.Graphics.FillRectangle(Brushes.Black, rectangle); e.Graphics.DrawString(dic["ml"], font1, Brushes.Black, new Point(60, 630)); //左上肢 e.Graphics.DrawString(dic["mr"], font1, Brushes.Black, new Point(220, 630)); //BMI e.Graphics.DrawString(dic["mL"], font1, Brushes.Black, new Point(60, 710)); //BMI e.Graphics.DrawString(dic["mR"], font1, Brushes.Black, new Point(220, 710)); //BMI e.Graphics.DrawString(dic["mT"], font1, Brushes.Black, new System.Drawing.Point(185, 680)); //BMI //肌肉平衡 e.Graphics.DrawString(dic["mr"], font1, Brushes.Black, new System.Drawing.Point(330, 400)); //左上肢 e.Graphics.DrawString(dic["Mr"], font1, Brushes.Black, new Point(495, 400)); //BMI e.Graphics.DrawString(dic["mR"], font1, Brushes.Black, new Point(330, 498)); //BMI e.Graphics.DrawString(dic["MR"], font1, Brushes.Black, new System.Drawing.Point(495, 498)); //BMI //各部分脂肪 e.Graphics.DrawString(dic["Fr"], font1, Brushes.Black, new Point(514, 625)); //右上肢 e.Graphics.DrawString(dic["fr"], font1, Brushes.Black, new Point(514, 635)); // e.Graphics.DrawString(dic["Fl"], font1, Brushes.Black, new Point(336, 625)); //左上肢 e.Graphics.DrawString(dic["fl"], font1, Brushes.Black, new Point(340, 635)); // e.Graphics.DrawString(dic["FR"], font1, Brushes.Black, new Point(518, 715)); //右下肢 e.Graphics.DrawString(dic["fR"], font1, Brushes.Black, new Point(518, 725)); // e.Graphics.DrawString(dic["FL"], font1, Brushes.Black, new Point(336, 710)); //左下肢 e.Graphics.DrawString(dic["fL"], font1, Brushes.Black, new Point(340, 720)); // e.Graphics.DrawString(dic["FT"], font1, Brushes.Black, new Point(515, 680)); //躯干部 e.Graphics.DrawString(dic["fT"], font1, Brushes.Black, new Point(515, 690)); // // e.Graphics.DrawString(dic["fW"], font1, Brushes.Black, new Point(380, 178)); //体脂量 e.Graphics.DrawString(dic["bW"], font1, Brushes.Black, new Point(440, 178)); //推定骨量 e.Graphics.DrawString(dic["Wk"], font1, Brushes.Black, new Point(320, 330)); //体重 e.Graphics.DrawString(dic["MW"], font1, Brushes.Black, new Point(380, 330)); //非脂肪量 e.Graphics.DrawString(dic["mW"], font1, Brushes.Black, new Point(440, 330)); //肌肉量 e.Graphics.DrawString(dic["wW"], font1, Brushes.Black, new Point(500, 330)); //体水份量 int age = int.Parse(dic["AG"]); double weight = double.Parse(dic["Wk"]) * 3.2; double height = double.Parse(dic["Hm"]) * 2.15; int weight1 = Convert.ToInt32(weight); int height1 = Convert.ToInt32(height); if (sex.Equals("0")) { e.Graphics.DrawString("•", font, Brushes.Red, new Point(590 + age * 11, 512 - weight1)); // e.Graphics.DrawString("体重", font, Brushes.Black, new Point(593 + age * 11, 505 - weight1)); //体重 e.Graphics.DrawString(dic["Wk"], font, Brushes.Black, new Point(625 + age * 11, 505 - weight1)); //体重 e.Graphics.DrawString("•", font, Brushes.Blue, new Point(590 + age * 11, 512 - height1)); e.Graphics.DrawString("身高", font, Brushes.Black, new Point(593 + age * 11, 505 - height1)); // e.Graphics.DrawString(dic["Hm"], font, Brushes.Black, new Point(625 + age * 11, 505 - height1)); // } else { e.Graphics.DrawString("•", font, Brushes.Red, new Point(851 + age * 11, 512 - weight1)); e.Graphics.DrawString("体重", font, Brushes.Black, new Point(854 + age * 11, 505 - weight1)); //体重 e.Graphics.DrawString(dic["Wk"], font, Brushes.Black, new Point(886 + age * 11, 505 - weight1)); //体重 e.Graphics.DrawString("•", font, Brushes.Blue, new Point(851 + age * 11, 512 - height1)); e.Graphics.DrawString("身高", font, Brushes.Black, new Point(854 + age * 11, 505 - height1)); //身高 e.Graphics.DrawString(dic["Hm"], font, Brushes.Black, new Point(886 + age * 11, 505 - height1)); // } //建议 Comment comment = dbUtill.GetComment(); if (bmi < 18.5) { e.Graphics.DrawString(comment.low, font2, Brushes.Black, new Point(575, 610)); } else if (bmi < 22.5) { e.Graphics.DrawString(comment.mid, font2, Brushes.Black, new Point(575, 610)); } else { e.Graphics.DrawString(comment.hight, font2, Brushes.Black, new Point(575, 610)); } } catch (Exception ex) { Console.Write(ex.Message); } CreateMC780_boy(); }