289 lines
12 KiB
C#
289 lines
12 KiB
C#
using DevExpress.XtraCharts;
|
|
using DevExpress.XtraEditors;
|
|
using DevExpress.XtraGrid;
|
|
using DevExpress.XtraGrid.Views.Grid;
|
|
using DevExpress.XtraPrinting;
|
|
using HL_FristAidPlatform_DTO;
|
|
using HL_FristAidPlatform_Print;
|
|
using HL_FristAidPlatform_Public;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Drawing;
|
|
using System.Drawing.Printing;
|
|
using System.Windows.Forms;
|
|
using static HL_FristAidPlatform_Public.TimeControl;
|
|
|
|
namespace HL_FristAidPlatform_Apoplexy
|
|
{
|
|
public partial class Form_HazardClassification : XtraForm
|
|
{
|
|
/// <summary>
|
|
/// 分组类型 0 月 1年
|
|
/// </summary>
|
|
public int type;
|
|
|
|
public Form_HazardClassification()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void Form_HazardClassification_Load(object sender, EventArgs e)
|
|
{
|
|
DateTime dt = DateTime.Now;
|
|
time_starTime.TimeValue = dt.AddDays(-((int)dt.Day - 1)).ToString();
|
|
time_endTime.TimeValue = dt.AddMonths(1).AddDays(-dt.AddMonths(1).Day).ToString();
|
|
GetHazardClassification();
|
|
GetHazardClassificationList();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 本月
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void simpleButton5_Click(object sender, EventArgs e)
|
|
{
|
|
DateTime dt = DateTime.Now;
|
|
time_starTime.TimeValue = dt.AddDays(-((int)dt.Day - 1)).ToString();
|
|
time_endTime.TimeValue = dt.AddMonths(1).AddDays(-dt.AddMonths(1).Day).ToString();
|
|
GetHazardClassification();
|
|
GetHazardClassificationList();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 上一月
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void simpleButton1_Click(object sender, EventArgs e)
|
|
{
|
|
DateTime dt = DateTime.Now.AddMonths(-1);
|
|
time_starTime.TimeValue = dt.AddDays(-((int)dt.Day - 1)).ToString();
|
|
time_endTime.TimeValue = dt.AddMonths(1).AddDays(-dt.AddMonths(1).Day).ToString();
|
|
GetHazardClassification();
|
|
GetHazardClassificationList();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 上一年
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void simpleButton4_Click(object sender, EventArgs e)
|
|
{
|
|
DateTime dt = DateTime.Now.AddYears(-1);
|
|
time_starTime.TimeValue = dt.AddDays(-((int)dt.DayOfYear - 1)).ToString();
|
|
time_endTime.TimeValue = dt.AddYears(1).AddDays(-dt.AddYears(1).DayOfYear).ToString();
|
|
GetHazardClassification();
|
|
GetHazardClassificationList();
|
|
}
|
|
|
|
private void simpleButton2_Click(object sender, EventArgs e)
|
|
{
|
|
GetHazardClassification();
|
|
GetHazardClassificationList();
|
|
}
|
|
|
|
public void GetHazardClassification()
|
|
{
|
|
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("中危", ViewType.Bar);
|
|
Series series2 = new Series("高危", ViewType.Bar);
|
|
Series series3 = new Series("低危", ViewType.Bar);
|
|
ChartTitle chartTitle1 = new ChartTitle();
|
|
chartTitle1.Text = "";
|
|
chartControl1.Titles.Add(chartTitle1);
|
|
string startTime = "";
|
|
string endTime = "";
|
|
if (type == 1)
|
|
{
|
|
startTime = Convert.ToDateTime(time_starTime.TimeValue).ToString("yyyy");
|
|
endTime = Convert.ToDateTime(time_endTime.TimeValue).ToString("yyyy");
|
|
}
|
|
else
|
|
{
|
|
startTime = Convert.ToDateTime(time_starTime.TimeValue).ToString("yyyy-MM");
|
|
endTime = Convert.ToDateTime(time_endTime.TimeValue).ToString("yyyy-MM");
|
|
}
|
|
List<StatisicsDTO> list = DBHelpClass.GetList<StatisicsDTO>(string.Format("api/service/T_Service_Apoplexy_Statistics/GetHazardClassification?hospitalGuid={0}&startTime={1}&endTime={2}", Information.Hospital.GUID, startTime, endTime));
|
|
if (list != null && list.Count > 0)
|
|
{
|
|
for (int i = 0; i < list.Count; i++)
|
|
{
|
|
if (list[i].TypeName == "中危")
|
|
{
|
|
for (int j = 0; j < list[i].GradeInfos.Count; j++)
|
|
{
|
|
series1.Points.Add(new SeriesPoint(list[i].GradeInfos[j].TimeDate, list[i].GradeInfos[j].Number));
|
|
}
|
|
}
|
|
if (list[i].TypeName == "高危")
|
|
{
|
|
for (int j = 0; j < list[i].GradeInfos.Count; j++)
|
|
{
|
|
series2.Points.Add(new SeriesPoint(list[i].GradeInfos[j].TimeDate, list[i].GradeInfos[j].Number));
|
|
}
|
|
}
|
|
if (list[i].TypeName == "低危")
|
|
{
|
|
for (int j = 0; j < list[i].GradeInfos.Count; j++)
|
|
{
|
|
series3.Points.Add(new SeriesPoint(list[i].GradeInfos[j].TimeDate, list[i].GradeInfos[j].Number));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
BarSeriesView bsv = (BarSeriesView)series1.View;
|
|
bsv.BarWidth = 0.5;
|
|
BarSeriesView bsv1 = (BarSeriesView)series2.View;
|
|
bsv1.BarWidth = 0.5;
|
|
BarSeriesView bsv2 = (BarSeriesView)series3.View;
|
|
bsv2.BarWidth = 0.5;
|
|
chartControl1.Series.AddRange(new Series[] { series3, series1, series2 });
|
|
XYDiagram xyDia = chartControl1.Diagram as XYDiagram;
|
|
xyDia.AxisX.DateTimeScaleOptions.ScaleMode = ScaleMode.Manual;
|
|
if (type == 0)
|
|
xyDia.AxisX.DateTimeScaleOptions.MeasureUnit = DateTimeMeasureUnit.Month;
|
|
if (type == 1)
|
|
xyDia.AxisX.DateTimeScaleOptions.MeasureUnit = DateTimeMeasureUnit.Year;
|
|
((XYDiagram)(chartControl1.Diagram)).EnableAxisXScrolling = true;//启用横轴滚动条
|
|
}
|
|
|
|
public void GetHazardClassificationList()
|
|
{
|
|
if (string.IsNullOrEmpty(time_starTime.TimeValue))
|
|
{
|
|
XtraMessageBox.Show("查询起始时间不能为空");
|
|
return;
|
|
}
|
|
if (string.IsNullOrEmpty(time_endTime.TimeValue))
|
|
{
|
|
XtraMessageBox.Show("查询结束时间不能为空");
|
|
return;
|
|
}
|
|
string startTime = "";
|
|
string endTime = "";
|
|
if (type == 1)
|
|
{
|
|
startTime = Convert.ToDateTime(time_starTime.TimeValue).ToString("yyyy");
|
|
endTime = Convert.ToDateTime(time_endTime.TimeValue).ToString("yyyy");
|
|
}
|
|
else
|
|
{
|
|
startTime = Convert.ToDateTime(time_starTime.TimeValue).ToString("yyyy-MM");
|
|
endTime = Convert.ToDateTime(time_endTime.TimeValue).ToString("yyyy-MM");
|
|
}
|
|
List<HazardClassificationDTO> list = DBHelpClass.GetList<HazardClassificationDTO>(string.Format("api/service/T_Service_Apoplexy_Statistics/GetHazardClassificationList?hospitalGuid={0}&startTime={1}&endTime={2}", Information.Hospital.GUID, startTime, endTime));
|
|
gridControl1.DataSource = list;
|
|
}
|
|
|
|
private void radi_month_Click(object sender, EventArgs e)
|
|
{
|
|
time_starTime.FormatString_Date = DateFormat.yyyyMMdd;
|
|
time_endTime.FormatString_Date = DateFormat.yyyyMMdd;
|
|
}
|
|
|
|
private void radio_year_Click(object sender, EventArgs e)
|
|
{
|
|
DateTime dt;
|
|
if (!string.IsNullOrEmpty(time_starTime.TimeValue))
|
|
{
|
|
dt = Convert.ToDateTime(time_starTime.TimeValue);
|
|
time_starTime.TimeValue = dt.AddDays(-((int)dt.DayOfYear - 1)).ToString();
|
|
}
|
|
if (!string.IsNullOrEmpty(time_endTime.TimeValue))
|
|
{
|
|
dt = Convert.ToDateTime(time_endTime.TimeValue);
|
|
time_endTime.TimeValue = dt.AddYears(1).AddDays(-dt.AddYears(1).DayOfYear).ToString();
|
|
}
|
|
}
|
|
|
|
private void time_starTime_TimeValueChanged(object sender, EventArgs e)
|
|
{
|
|
if (!string.IsNullOrEmpty(time_starTime.TimeValue) && type == 0)
|
|
time_starTime.FormatString_Date = DateFormat.yyyyMMdd;
|
|
if (!string.IsNullOrEmpty(time_starTime.TimeValue) && type == 1)
|
|
{
|
|
DateTime dt = Convert.ToDateTime(time_starTime.TimeValue);
|
|
time_starTime.TimeValue = dt.AddDays(-((int)dt.DayOfYear - 1)).ToString();
|
|
}
|
|
}
|
|
|
|
private void time_endTime_TimeValueChanged(object sender, EventArgs e)
|
|
{
|
|
if (!string.IsNullOrEmpty(time_endTime.TimeValue) && type == 0)
|
|
time_endTime.FormatString_Date = DateFormat.yyyyMMdd;
|
|
if (!string.IsNullOrEmpty(time_endTime.TimeValue) && type == 1)
|
|
{
|
|
DateTime dt = Convert.ToDateTime(time_endTime.TimeValue);
|
|
time_endTime.TimeValue = dt.AddDays(-((int)dt.DayOfYear - 1)).ToString();
|
|
}
|
|
}
|
|
|
|
private void simpleButton7_Click(object sender, EventArgs e)
|
|
{
|
|
chartControl1.Dock = DockStyle.None;
|
|
chartControl1.Width = 1000;
|
|
PrintChart printClass = new PrintChart(chartControl1);
|
|
printClass.LandScape = true;
|
|
printClass.PaperKind = PaperKind.A4;
|
|
printClass.PrintHeader = "危 险 分 级 趋 势 图 表";
|
|
printClass.LoadPageSetting(60);
|
|
printClass.Preview();
|
|
chartControl1.Dock = DockStyle.Fill;
|
|
}
|
|
|
|
private void simpleButton6_Click(object sender, EventArgs e)
|
|
{
|
|
PrintChart printClass = new PrintChart(gridControl1);
|
|
printClass.LandScape = true;
|
|
printClass.PaperKind = PaperKind.A4;
|
|
printClass.PrintHeader = "危 险 分 级 统 计 表";
|
|
printClass.LoadPageSetting(60);
|
|
printClass.Preview();
|
|
}
|
|
|
|
private void lbl_month_Click(object sender, EventArgs e)
|
|
{
|
|
type = 0;
|
|
lbl_month.BackColor = Color.FromArgb(25, 190, 107);
|
|
lbl_year.BackColor = Color.FromArgb(128, 134, 149);
|
|
GetHazardClassification();
|
|
GetHazardClassificationList();
|
|
}
|
|
|
|
private void lbl_year_Click(object sender, EventArgs e)
|
|
{
|
|
type = 1;
|
|
lbl_year.BackColor = Color.FromArgb(25, 190, 107);
|
|
lbl_month.BackColor = Color.FromArgb(128, 134, 149);
|
|
GetHazardClassification();
|
|
GetHazardClassificationList();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 本年
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void simpleButton3_Click(object sender, EventArgs e)
|
|
{
|
|
DateTime dt = DateTime.Now;
|
|
time_starTime.TimeValue = dt.AddDays(-((int)dt.DayOfYear - 1)).ToString();
|
|
time_endTime.TimeValue = dt.AddYears(1).AddDays(-dt.AddYears(1).DayOfYear).ToString();
|
|
GetHazardClassification();
|
|
GetHazardClassificationList();
|
|
}
|
|
}
|
|
} |