StableVersion4.3/HL_FristAidPlatform_Apoplexy/Form_Toast.cs

189 lines
7.1 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using DevExpress.XtraCharts;
using DevExpress.XtraEditors;
using HL_FristAidPlatform_Public;
using System;
using System.Collections.Generic;
using System.Data;
using System.Windows.Forms;
namespace HL_FristAidPlatform_Apoplexy
{
public partial class Form_Toast : XtraForm
{
#region 变量
/// <summary>
/// 当前页
/// </summary>
private int curPage = 1;
/// <summary>
/// 所有记录条数
/// </summary>
public int totalNumber = 0;
/// <summary>
/// 每页大小
/// </summary>
private int pageSize = 28;
/// <summary>
///Guid
/// </summary>
private string Guid;
/// <summary>
/// systemModuleID
/// </summary>
private long systemModuleID = 3;
#endregion 变量
public Form_Toast()
{
InitializeComponent();
}
private void Form_Toast_Load(object sender, EventArgs e)
{
timeControl1.TimeValue = DateTime.Now.AddMonths(-1).ToString("yyyy-MM-dd");
timeControl2.TimeValue = DateTime.Now.ToString("yyyy-MM-dd");
toastbing(curPage, Convert.ToDateTime(timeControl1.TimeValue), Convert.ToDateTime(timeControl2.TimeValue).AddDays(1));
}
private void button_Toast_Click(object sender, EventArgs e)
{
toastbing(curPage, Convert.ToDateTime(timeControl1.TimeValue), Convert.ToDateTime(timeControl2.TimeValue).AddDays(1));
}
public void toastbing(int curPage, DateTime time1, DateTime time2)
{
try
{
if (!string.IsNullOrEmpty(time1.ToString()) && !string.IsNullOrEmpty(time2.ToString()) && Convert.ToDateTime(time1) < Convert.ToDateTime(time2))
{
List<T_Service_PatientTOASTModel> list = DBHelpClass.GetList<T_Service_PatientTOASTModel>
(string.Format("api/service/T_Service_Patient/GetModelBySystemModuleIDANDHospitalGuid?startTime={0}&endTime={1}&systemModuleID={2}&hospitalGuid={3}",
time1, time2, systemModuleID, Information.Hospital.GUID));
chartControl1.Series.Clear();
Series series1 = new Series("", ViewType.Pie);
series1.Points.Clear();
if (list != null && list.Count > 0)
{
double n = 0;
for (int i = 0; i < list.Count; i++)
{
labelControl4.Text = "卒中患者总人数:" + list[i].apoplexyCount.ToString();
labelControl3.Text = "已做Toast分型人数:" + list[i].toastCount.ToString();
if (list[i].apoplexyCount != 0 && list[i].toastCount != 0)
{
n = list[i].toastCount * 100 / list[i].apoplexyCount;
}
labelControl2.Text = "Toast分型评估率:" + n.ToString("f0") + "%";
series1.Points.Add(new SeriesPoint("未做Toast分型人数" + "", new double[] { (double)(list[i].apoplexyCount - list[i].toastCount) }));
series1.Points.Add(new SeriesPoint("已做Toast分型人数" + "", new double[] { (double)list[i].toastCount }));
}
}
series1.Label.TextPattern = "{A}: {VP:p0}";
((PieSeriesLabel)series1.Label).Position = PieSeriesLabelPosition.TwoColumns;
((PieSeriesLabel)series1.Label).ResolveOverlappingMode = ResolveOverlappingMode.Default;
chartControl1.Series.AddRange(series1);
string Url = string.Format("api/service/T_Service_Patient/GetListByHospitalGuid?pageIndex={0}&pageSize={1}&startTime={2}&endTime={3}&hospitalGuid={4}",
curPage, pageSize, time1, time2, Information.Hospital.GUID);
DataTable dt = DBHelpClass.Get(Url);
if (dt != null)
{
gridControl1.DataSource = dt;
totalNumber = DBHelpClass.TotalNumber;
userControlForPage1.RefreshPager(pageSize, totalNumber, curPage);//更新分页控件显示。
}
}
else
{
XtraMessageBox.Show("请选择正确的时间!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}
catch (Exception ex)
{
PublicClass.WriteErrorLog(this.Text, "toast分型评估率\r\n" + ex);
}
}
private void MyPagerEvents(int curPage, int pageSize)
{
this.curPage = curPage;
this.pageSize = pageSize;
toastbing(curPage, Convert.ToDateTime(timeControl1.TimeValue), Convert.ToDateTime(timeControl2.TimeValue));
}
public void ExportEvents(bool singlePage)//单页,所有
{
}
private void userControlForPage1_myPagerEvents(int curPage, int pageSize)
{
userControlForPage1.myPagerEvents += MyPagerEvents;
}
private void userControlForPage1_exportEvents(bool singlePage)
{
userControlForPage1.exportEvents += ExportEvents;
}
private void gridView1_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e)
{
if (e.Column.FieldName == "Gender")
{
if (e.Value != null)
{
switch (e.Value.ToString().Trim())
{
case "1":
e.DisplayText = "男";
break;
case "2":
e.DisplayText = "女";
break;
default:
e.DisplayText = "未知";
break;
}
}
}
}
private void gridView1_DoubleClick(object sender, EventArgs e)
{
if (gridView1.DataRowCount > 0)
{
int selectRow = gridView1.GetSelectedRows()[0];
Guid = gridView1.GetRowCellValue(selectRow, "GUID").ToString();
if (Guid != null)
{
Form_PatientDetail fpd = new Form_PatientDetail(Guid, "1");
fpd.WindowState = FormWindowState.Maximized;
fpd.Show();
}
}
}
private void gridView1_CustomDrawRowIndicator(object sender, DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventArgs e)
{
if (e.Info.IsRowIndicator && e.RowHandle >= 0)
e.Info.DisplayText = (e.RowHandle + 1).ToString();
}
}
public class T_Service_PatientTOASTModel
{
public int apoplexyCount { get; set; }
public int toastCount { get; set; }
}
}