117 lines
4.6 KiB
C#
117 lines
4.6 KiB
C#
using DevExpress.XtraCharts;
|
|
using DevExpress.XtraEditors;
|
|
using HL_FristAidPlatform_DTO;
|
|
using HL_FristAidPlatform_Public;
|
|
using System;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Windows.Forms;
|
|
|
|
namespace HL_FristAidPlatform_Apoplexy
|
|
{
|
|
public partial class Form_AverageHospitalizationRate : XtraForm
|
|
{
|
|
DateTime dt = DateTime.Now;
|
|
public Form_AverageHospitalizationRate()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
private void Form_ThrombolysisIntracranialHemorrhageRate_Load(object sender, EventArgs e)
|
|
{
|
|
time_starTime.TimeValue = dt.Year + "-01".ToString();
|
|
time_endTime.TimeValue = dt.Year + "-12".ToString();
|
|
BindData();
|
|
}
|
|
private void BindData()
|
|
{
|
|
try
|
|
{
|
|
string startTime = "";
|
|
string endTime = "";
|
|
if (!string.IsNullOrEmpty(time_starTime.TimeValue.ToString()) && !string.IsNullOrEmpty(time_endTime.TimeValue.ToString()))
|
|
{
|
|
startTime = Convert.ToDateTime(time_starTime.TimeValue).ToString("yyyy-MM");
|
|
endTime = Convert.ToDateTime(time_endTime.TimeValue).ToString("yyyy-MM");
|
|
}
|
|
var tuple = DBHelpClass.GetList<DictionaryModel>(string.Format("api/service/T_Service_Apoplexy_ThrombolysisRate/GetAverageHospitalizationRate?startTime={0}&endTime={1}&type={2}", startTime, endTime, 1));
|
|
DataTable data = new DataTable("table1");
|
|
data.Columns.Add("Name", typeof(string));
|
|
data.Columns.Add("Value", typeof(double));
|
|
int max = 0;
|
|
if (tuple != null)
|
|
{
|
|
foreach (var item in tuple)
|
|
{
|
|
if (!string.IsNullOrEmpty(item.valueText))
|
|
{
|
|
if (double.Parse(item.valueText) > max)
|
|
max = (int)double.Parse(item.valueText);
|
|
}
|
|
data.Rows.Add(item.name, item.valueText);
|
|
}
|
|
chartControl1.Series["Series 1"].ValueDataMembers[0] = "Value";
|
|
chartControl1.Series["Series 1"].ArgumentDataMember = "Name";
|
|
chartControl1.Series[0].DataSource = data;
|
|
}
|
|
|
|
//调整柱状图柱体宽度
|
|
BarSeriesView bsv = (BarSeriesView)chartControl1.Series["Series 1"].View;
|
|
bsv.BarWidth = 0.2;
|
|
|
|
XYDiagram xyDia = chartControl1.Diagram as XYDiagram;
|
|
xyDia.AxisX.DateTimeScaleOptions.ScaleMode = ScaleMode.Manual;
|
|
|
|
int tempone = max / 5;
|
|
int temptwo = max % 5;
|
|
if (temptwo == 0)
|
|
{
|
|
max = tempone * 5;
|
|
}
|
|
else
|
|
{
|
|
max = (tempone + 1) * 5;
|
|
}
|
|
if (max == 0)
|
|
max = 10;
|
|
xyDia.AxisY.WholeRange.MaxValue = max;
|
|
xyDia.AxisY.NumericScaleOptions.GridOffset = 0;
|
|
xyDia.AxisY.NumericScaleOptions.GridSpacing = max / 5;
|
|
}
|
|
catch (Exception)
|
|
{
|
|
|
|
throw;
|
|
}
|
|
|
|
}
|
|
|
|
private void sButton_ThisMonth_Click(object sender, EventArgs e)
|
|
{
|
|
sButton_ThisMonth.Appearance.BackColor = Color.FromArgb(43, 133, 228);
|
|
sButton_ThisYear.Appearance.BackColor = Color.FromArgb(114, 165, 231);
|
|
sButton_Query.Appearance.BackColor = Color.FromArgb(114, 165, 231);
|
|
time_starTime.TimeValue = dt.AddYears(-1).Year + "-01".ToString();
|
|
time_endTime.TimeValue = dt.AddYears(-1).Year + "-12".ToString();
|
|
BindData();
|
|
}
|
|
|
|
private void sButton_ThisYear_Click(object sender, EventArgs e)
|
|
{
|
|
sButton_ThisYear.Appearance.BackColor = Color.FromArgb(43, 133, 228);
|
|
sButton_ThisMonth.Appearance.BackColor = Color.FromArgb(114, 165, 231);
|
|
sButton_Query.Appearance.BackColor = Color.FromArgb(114, 165, 231);
|
|
time_starTime.TimeValue = dt.Year + "-01".ToString();
|
|
time_endTime.TimeValue = dt.Year + "-12".ToString();
|
|
BindData();
|
|
}
|
|
|
|
private void sButton_Query_Click(object sender, EventArgs e)
|
|
{
|
|
sButton_Query.Appearance.BackColor = Color.FromArgb(43, 133, 228);
|
|
sButton_ThisMonth.Appearance.BackColor = Color.FromArgb(114, 165, 231);
|
|
sButton_ThisYear.Appearance.BackColor = Color.FromArgb(114, 165, 231);
|
|
BindData();
|
|
}
|
|
}
|
|
}
|