using DevExpress.XtraCharts; using DevExpress.XtraEditors; 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 SC_FristAidPlatform_ChestPainUnit { public partial class ChestPainUnitFMCTOECGAVG : XtraForm { public int flag; public string startTime = ""; public string endTime = ""; int i = 0; public ChestPainUnitFMCTOECGAVG() { InitializeComponent(); } private void ChestPainUnitFMCTOECGAVG_Load(object sender, EventArgs e) { timeControl1.TimeValue = DateTime.Now.AddMonths(-12).ToString("yyyy-MM-dd"); timeControl2.TimeValue = DateTime.Now.ToString("yyyy-MM-dd"); GetFMCTOECGAVG(); } private void simpleButton1_Click(object sender, EventArgs e) { GetFMCTOECGAVG(); } public void GetFMCTOECGAVG() { try { chartControl1.Series.Clear(); chartControl1.Titles.Clear(); ChartTitle titles = new ChartTitle(); titles.Text = "首次医疗接触到首份心电图平均耗时"; titles.TextColor = Color.FromArgb(23, 35, 61); titles.Indent = 1; titles.Font = new Font("微软雅黑", 16, FontStyle.Regular); titles.Dock = ChartTitleDockStyle.Top; titles.Indent = 0; titles.Alignment = StringAlignment.Center; chartControl1.Titles.Add(titles); List lst = DBHelpClass.GetList(string.Format("api/service/ChestPainUnit/GetFMCTOECGAVG?hospitalGuid={0}&startTime={1}&endTime={2}", Information.Hospital.GUID, timeControl1.TimeValue, timeControl2.TimeValue)); chartControl1.Series.Clear(); Series series1 = new Series("平均耗时", ViewType.Spline); if (flag == 1) { series1 = new Series("平均耗时", ViewType.Bar); } series1.Points.Clear(); if (lst != null && lst.Count > 0) { for (int i = 0; i < lst.Count; i++) { series1.Points.Add(new SeriesPoint(lst[i].Month, lst[i].AVGTime)); } chartControl1.Series.AddRange(series1); XYDiagram xyDia = chartControl1.Diagram as XYDiagram; xyDia.AxisX.DateTimeScaleOptions.ScaleMode = ScaleMode.Manual; xyDia.AxisX.DateTimeScaleOptions.MeasureUnit = DateTimeMeasureUnit.Month; ((XYDiagram)(chartControl1.Diagram)).EnableAxisXScrolling = true;//启用横轴滚动条 // gridControl1.DataSource=lst. } List QRlst = DBHelpClass.GetList(string.Format("api/service/ChestPainUnit/GetFMCTOECGAVGList?hospitalGuid={0}&startTime={1}&endTime={2}", Information.Hospital.GUID, timeControl1.TimeValue, timeControl2.TimeValue)); gridControl1.DataSource = QRlst; } catch (Exception ex) { throw ex; } } private void simpleButton_ThisMonth_Click(object sender, EventArgs e) { timeControl1.TimeValue = DateTime.Now.AddMonths(-2).ToString("yyyy-MM-dd"); timeControl2.TimeValue = DateTime.Now.ToString("yyyy-MM-dd"); GetFMCTOECGAVG(); } private void simpleButton2_Click(object sender, EventArgs e) { timeControl1.TimeValue = DateTime.Now.AddMonths(-5).ToString("yyyy-MM-dd"); timeControl2.TimeValue = DateTime.Now.ToString("yyyy-MM-dd"); GetFMCTOECGAVG(); } private void simpleButton3_Click(object sender, EventArgs e) { timeControl1.TimeValue = DateTime.Now.AddMonths(-11).ToString("yyyy-MM-dd"); timeControl2.TimeValue = DateTime.Now.ToString("yyyy-MM-dd"); GetFMCTOECGAVG(); } private void simpleButton_all_Click(object sender, EventArgs e) { timeControl1.TimeValue = "1970-01-01"; timeControl2.TimeValue = DateTime.Now.ToString("yyyy-MM-dd"); GetFMCTOECGAVG(); } private void radioButton1_CheckedChanged(object sender, EventArgs e) { flag = 0; GetFMCTOECGAVG(); } private void radioButton2_CheckedChanged(object sender, EventArgs e) { flag = 1; GetFMCTOECGAVG(); } public class DateTimeAVGModel { /// /// 月份 /// public string Month { get; set; } /// /// 平均用时 /// public int AVGTime { get; set; } } /// /// 质控报表模型 /// public class QCReportModel { /// /// 月份 /// public string Month { get; set; } /// /// 平均耗时 /// public string AVGTime { get; set; } /// /// 最大值 /// public string MaxMum { get; set; } /// /// 最小值 /// public string MinMum { get; set; } /// /// 合格个数 /// public string QualifiedCount { get; set; } } } }