using DevExpress.Utils; using DevExpress.Utils.Layout; using DevExpress.XtraCharts; using DevExpress.XtraEditors; using HL_FristAidPlatform_DTO; using HL_FristAidPlatform_Public; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace HL_FristAidPlatform_Trauma { public partial class Form_InspectionStaisics : XtraForm { public int type; public TablePanel tab; public Form_InspectionStaisics() { InitializeComponent(); } private void Form_InspectionStaisics_Load(object sender, EventArgs e) { time_starTime.TimeValue = DateTime.Now.AddMonths(-5).ToString(); time_endTime.TimeValue = DateTime.Now.ToString(); lbl_ct.BackColor = Color.FromArgb(0, 143, 255); lbl_ct.ForeColor = Color.White; lbl_chestx.BackColor = Color.FromArgb(232, 249, 225); lbl_chestx.ForeColor = Color.FromArgb(81, 90, 110); lbl_pelvis.BackColor = Color.FromArgb(232, 249, 225); lbl_pelvis.ForeColor = Color.FromArgb(81, 90, 110); lbl_fast.BackColor = Color.FromArgb(232, 249, 225); lbl_fast.ForeColor = Color.FromArgb(81, 90, 110); type = 0; GetInspectionStaisics(); GetTimeQualityControlModelStatics(); } private void simpleButton2_Click(object sender, EventArgs e) { GetInspectionStaisics(); GetTimeQualityControlModelStatics(); } public void GetInspectionStaisics() { if (string.IsNullOrEmpty(time_starTime.TimeValue)) { XtraMessageBox.Show("查询起始时间不能为空"); return; } if (string.IsNullOrEmpty(time_endTime.TimeValue)) { XtraMessageBox.Show("查询结束时间不能为空"); return; } chartControl1.Series.Clear(); chartControl1.Titles.Clear(); Series series1 = new Series("全身快速CT时间", ViewType.Spline); Series series2 = new Series("全身胸部X片时间", ViewType.Spline); Series series3 = new Series("全身骨盆X片时间", ViewType.Spline); Series series4 = new Series("FAST检查时间", ViewType.Spline); ChartTitle chartTitle1 = new ChartTitle(); chartTitle1.Text = "检验检查耗时统计"; chartControl1.Titles.Add(chartTitle1); List model = DBHelpClass.GetList(string.Format("api/service/T_Service_Trauma_MassiveDataStatistics/GetInspectionStaisics?hospitalGuid={0}&starTime={1}&endTime={2}", Information.Hospital.GUID, Convert.ToDateTime(time_starTime.TimeValue).ToString("yyyy-MM"), Convert.ToDateTime(time_endTime.TimeValue).ToString("yyyy-MM"))); if (model != null) { for (int j = 0; j < model.Count(); j++) { if (model[j].InspectionType == "1") { if (model[j].InspectionList.Count > 0) { for (int i = 0; i < model[j].InspectionList.Count; i++) { series1.Points.Add(new SeriesPoint(model[j].InspectionList[i].TimeDate, model[j].InspectionList[i].Number)); } } } if (model[j].InspectionType == "2") { if (model[j].InspectionList.Count > 0) { for (int i = 0; i < model[j].InspectionList.Count; i++) { series2.Points.Add(new SeriesPoint(model[j].InspectionList[i].TimeDate, model[j].InspectionList[i].Number)); } } } if (model[j].InspectionType == "3") { if (model[j].InspectionList.Count > 0) { for (int i = 0; i < model[j].InspectionList.Count; i++) { series3.Points.Add(new SeriesPoint(model[j].InspectionList[i].TimeDate, model[j].InspectionList[i].Number)); } } } if (model[j].InspectionType == "4") { if (model[j].InspectionList.Count > 0) { for (int i = 0; i < model[j].InspectionList.Count; i++) { series4.Points.Add(new SeriesPoint(model[j].InspectionList[i].TimeDate, model[j].InspectionList[i].Number)); } } } } } chartControl1.Series.AddRange(series1, series2, series3, series4); ((LineSeriesView)series1.View).MarkerVisibility = DefaultBoolean.True; ((LineSeriesView)series1.View).LineMarkerOptions.Kind = MarkerKind.Circle; ((LineSeriesView)series2.View).MarkerVisibility = DefaultBoolean.True; ((LineSeriesView)series2.View).LineMarkerOptions.Kind = MarkerKind.Circle; ((LineSeriesView)series3.View).MarkerVisibility = DefaultBoolean.True; ((LineSeriesView)series3.View).LineMarkerOptions.Kind = MarkerKind.Circle; ((LineSeriesView)series4.View).MarkerVisibility = DefaultBoolean.True; ((LineSeriesView)series4.View).LineMarkerOptions.Kind = MarkerKind.Circle; XYDiagram xyDia = chartControl1.Diagram as XYDiagram; xyDia.AxisX.DateTimeScaleOptions.ScaleMode = ScaleMode.Manual; xyDia.AxisX.DateTimeScaleOptions.MeasureUnit = DateTimeMeasureUnit.Month; //max = int.Parse(lst.Max(i => i.ToString())); //int tempone = max / 5; //int temptwo = max % 5; //if (temptwo == 0) //{ // max = tempone * 5; //} //else //{ // max = (tempone + 1) * 5; //} //xyDia.AxisY.WholeRange.MaxValue = max; //xyDia.AxisY.NumericScaleOptions.GridOffset = 0; //xyDia.AxisY.NumericScaleOptions.GridSpacing = max / 5; ((XYDiagram)(chartControl1.Diagram)).EnableAxisXScrolling = true;//启用横轴滚动条 } public void GetTimeQualityControlModelStatics() { if (string.IsNullOrEmpty(time_starTime.TimeValue)) { XtraMessageBox.Show("查询起始时间不能为空"); return; } if (string.IsNullOrEmpty(time_endTime.TimeValue)) { XtraMessageBox.Show("查询结束时间不能为空"); return; } //string hospitalGuid = "", string startTime = "", string endTime = "", int type = 0 List list = DBHelpClass.GetList(string.Format("api/service/T_Service_Trauma_MassiveDataStatistics/GetTimeQualityControlModelStatics?hospitalGuid={0}&startTime={1}&endTime={2}&type={3}", Information.Hospital.GUID, Convert.ToDateTime(time_starTime.TimeValue).ToString("yyyy-MM") + "-01", Convert.ToDateTime(time_endTime.TimeValue).AddMonths(1).AddDays(-1).ToString("yyyy-MM-dd"), 1)); if (list != null) { if (type == 0) { List ctList = new List(); ctList = list.Where(a => a.Name == "到达门/急诊至完成全身快速CT时间").ToList(); if (ctList.Count > 0) { ctList = ctList.OrderBy(i => i.Month).ToList(); CreateTabPanel(ctList.Count, ctList); } } if (type == 1) { List chenxList = new List(); chenxList = list.Where(a => a.Name == "到达门/急诊至全身胸部X片时间").ToList(); if (chenxList.Count > 0) { CreateTabPanel(chenxList.Count, chenxList); } } if (type == 2) { List pelvis = new List(); pelvis = list.Where(a => a.Name == "到达门/急诊至完成全身骨盆X片时间").ToList(); if (pelvis.Count > 0) { pelvis = pelvis.OrderBy(i => i.Month).ToList(); CreateTabPanel(pelvis.Count, pelvis); } } if (type == 3) { List fast = new List(); fast = list.Where(a => a.Name == "到达门/急诊至完成FAST检查时间").ToList(); if (fast.Count > 0) { fast = fast.OrderBy(i => i.Month).ToList(); CreateTabPanel(fast.Count, fast); } } } } private void lbl_ct_Click(object sender, EventArgs e) { lbl_ct.BackColor = Color.FromArgb(0, 143, 255); lbl_ct.ForeColor = Color.White; lbl_chestx.BackColor = Color.FromArgb(232, 249, 225); lbl_chestx.ForeColor = Color.FromArgb(81, 90, 110); lbl_pelvis.BackColor = Color.FromArgb(232, 249, 225); lbl_pelvis.ForeColor = Color.FromArgb(81, 90, 110); lbl_fast.BackColor = Color.FromArgb(232, 249, 225); lbl_fast.ForeColor = Color.FromArgb(81, 90, 110); type = 0; GetTimeQualityControlModelStatics(); } private void lbl_chestx_Click(object sender, EventArgs e) { lbl_chestx.BackColor = Color.FromArgb(0, 143, 255); lbl_chestx.ForeColor = Color.White; lbl_ct.BackColor = Color.FromArgb(232, 249, 225); lbl_ct.ForeColor = Color.FromArgb(81, 90, 110); lbl_pelvis.BackColor = Color.FromArgb(232, 249, 225); lbl_pelvis.ForeColor = Color.FromArgb(81, 90, 110); lbl_fast.BackColor = Color.FromArgb(232, 249, 225); lbl_fast.ForeColor = Color.FromArgb(81, 90, 110); type = 1; GetTimeQualityControlModelStatics(); } private void lbl_pelvis_Click(object sender, EventArgs e) { lbl_pelvis.BackColor = Color.FromArgb(0, 143, 255); lbl_pelvis.ForeColor = Color.White; lbl_ct.BackColor = Color.FromArgb(232, 249, 225); lbl_ct.ForeColor = Color.FromArgb(81, 90, 110); lbl_chestx.BackColor = Color.FromArgb(232, 249, 225); lbl_chestx.ForeColor = Color.FromArgb(81, 90, 110); lbl_fast.BackColor = Color.FromArgb(232, 249, 225); lbl_fast.ForeColor = Color.FromArgb(81, 90, 110); type = 2; GetTimeQualityControlModelStatics(); } private void lbl_fast_Click(object sender, EventArgs e) { lbl_fast.BackColor = Color.FromArgb(0, 143, 255); lbl_fast.ForeColor = Color.White; lbl_ct.BackColor = Color.FromArgb(232, 249, 225); lbl_ct.ForeColor = Color.FromArgb(81, 90, 110); lbl_chestx.BackColor = Color.FromArgb(232, 249, 225); lbl_chestx.ForeColor = Color.FromArgb(81, 90, 110); lbl_pelvis.BackColor = Color.FromArgb(232, 249, 225); lbl_pelvis.ForeColor = Color.FromArgb(81, 90, 110); type = 3; GetTimeQualityControlModelStatics(); } /// /// 创建动态表格 /// /// 数据条数 /// 数据 public void CreateTabPanel(int total, List list) { panel1.Controls.Clear(); int columnCount = 4; //列数 int rowCount = total;//行数 //if ((total % columnCount) > 0) rowCount++; tab = new TablePanel(); tab.Columns.Clear(); for (int i = 0; i < columnCount; i++) { tab.Columns.Add(new TablePanelColumn(TablePanelEntityStyle.Relative, 50)); } tab.Rows.Clear(); for (int i = 0; i < rowCount; i++) { tab.Rows.Add(new TablePanelRow(TablePanelEntityStyle.Absolute, 30)); } //tab.AutoScroll = true; tab.Dock = DockStyle.Top; tab.AutoSize = true; tab.BackColor = Color.White; tab.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder; for (int i = 0; i < rowCount; i++)//循环行 { LabelControl lbl1 = new LabelControl(); lbl1.Dock = DockStyle.Fill; lbl1.AutoSizeMode = LabelAutoSizeMode.None; lbl1.Appearance.TextOptions.HAlignment = HorzAlignment.Center; lbl1.ForeColor = Color.FromArgb(81, 90, 110); lbl1.Appearance.Font = new Font("Tahoma", 11); lbl1.Text = list[i].Month.Replace("-", "年") + "月"; tab.SetCell(lbl1, i, 0); LabelControl lbl2 = new LabelControl(); lbl2.Dock = DockStyle.Fill; lbl2.AutoSizeMode = LabelAutoSizeMode.None; lbl2.Appearance.TextOptions.HAlignment = HorzAlignment.Center; lbl2.ForeColor = Color.FromArgb(81, 90, 110); lbl2.Appearance.Font = new Font("Tahoma", 11); lbl2.Text = list[i].Max; tab.SetCell(lbl2, i, 1); LabelControl lbl3 = new LabelControl(); lbl3.Dock = DockStyle.Fill; lbl3.AutoSizeMode = LabelAutoSizeMode.None; lbl3.Appearance.TextOptions.HAlignment = HorzAlignment.Center; lbl3.ForeColor = Color.FromArgb(81, 90, 110); lbl3.Appearance.Font = new Font("Tahoma", 11); lbl3.Text = list[i].Min; tab.SetCell(lbl3, i, 2); LabelControl lbl4 = new LabelControl(); lbl4.Dock = DockStyle.Fill; lbl4.AutoSizeMode = LabelAutoSizeMode.None; lbl4.Appearance.TextOptions.HAlignment = HorzAlignment.Center; lbl4.ForeColor = Color.FromArgb(81, 90, 110); lbl4.Appearance.Font = new Font("Tahoma", 11); lbl4.Text = list[i].Middle; tab.SetCell(lbl4, i, 3); tab.Controls.AddRange(new Control[] { lbl1, lbl2, lbl3, lbl4 }); } panel1.Controls.Add(tab); } private void simpleButton5_Click(object sender, EventArgs e) { time_starTime.TimeValue = DateTime.Now.AddMonths(-2).ToString(); time_endTime.TimeValue = DateTime.Now.ToString(); GetInspectionStaisics(); GetTimeQualityControlModelStatics(); } private void simpleButton1_Click(object sender, EventArgs e) { time_starTime.TimeValue = DateTime.Now.AddMonths(-5).ToString(); time_endTime.TimeValue = DateTime.Now.ToString(); GetInspectionStaisics(); GetTimeQualityControlModelStatics(); } private void simpleButton4_Click(object sender, EventArgs e) { time_starTime.TimeValue = DateTime.Now.AddMonths(-11).ToString(); time_endTime.TimeValue = DateTime.Now.ToString(); GetInspectionStaisics(); GetTimeQualityControlModelStatics(); } } }