StableVersion4.3/HL_FristAidPlatform_Apoplexy/Form_CerebralHemorrhageGCS.cs

181 lines
7.1 KiB
C#
Raw Normal View History

2024-03-11 09:47:34 +08:00
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_CerebralHemorrhageGCS : 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;
#endregion 变量
public Form_CerebralHemorrhageGCS()
{
InitializeComponent();
}
private void Form_CerebralHemorrhageGCS_Load(object sender, EventArgs e)
{
timeControl_start.TimeValue = DateTime.Now.AddMonths(-1).ToString("yyyy-MM-dd");
timeControl_end.TimeValue = DateTime.Now.ToString("yyyy-MM-dd");
bing(curPage, Convert.ToDateTime(timeControl_start.TimeValue), Convert.ToDateTime(timeControl_end.TimeValue).AddDays(1));
}
private void button_CerebralHemorrhageGCS_Click(object sender, EventArgs e)
{
bing(curPage, Convert.ToDateTime(timeControl_start.TimeValue), Convert.ToDateTime(timeControl_end.TimeValue).AddDays(1));
}
public void bing(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_Apoplexy_CerebralHemorrhageGCSModel> list = DBHelpClass.GetList<T_Service_Apoplexy_CerebralHemorrhageGCSModel>
(string.Format("api/service/T_Service_Apoplexy_CerebralHemorrhageGCS/GetModelByHT?startTime={0}&endTime={1}&hospitalGuid={2}",
time1, time2, 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 = "已做GCS评分人数:" + list[i].gcsCount.ToString();
if (list[i].apoplexyCount != 0 && list[i].gcsCount != 0)
{
n = (double)list[i].gcsCount * 100 / (double)list[i].apoplexyCount;
}
labelControl2.Text = "GCS评分率:" + n.ToString("f0") + "%";//Math.Round((decimal)n, 0)
series1.Points.Add(new SeriesPoint("未做GCS评分人数" + "", new double[] { (double)(list[i].apoplexyCount - list[i].gcsCount) }));
series1.Points.Add(new SeriesPoint("已做GCS评分人数" + "", new double[] { (double)list[i].gcsCount }));
}
}
series1.Label.TextPattern = "{A}: {VP:p0}";
((PieSeriesLabel)series1.Label).Position = PieSeriesLabelPosition.TwoColumns;
((PieSeriesLabel)series1.Label).ResolveOverlappingMode = ResolveOverlappingMode.Default;
chartControl1.Series.AddRange(series1);
string Url1 = string.Format("api/service/T_Service_Apoplexy_CerebralHemorrhageGCS/GetListByHospitalGuid?pageIndex={0}&pageSize={1}&startTime={2}&endTime={3}&hospitalGuid={4}",
curPage, pageSize, time1, time2, Information.Hospital.GUID);
DataTable dt = DBHelpClass.Get(Url1);
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, "gcs评分率\r\n" + ex);
}
}
private void MyPagerEvents(int curPage, int pageSize)
{
this.curPage = curPage;
this.pageSize = pageSize;
bing(curPage, Convert.ToDateTime(timeControl_start.TimeValue), Convert.ToDateTime(timeControl_end.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();
}
}
}
public class T_Service_Apoplexy_CerebralHemorrhageGCSModel
{
public int apoplexyCount { get; set; }
public int gcsCount { get; set; }
}
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();
}
}
}