StableVersion4.3/HL_FristAidPlatform_Apoplexy/sum.cs

218 lines
8.8 KiB
C#
Raw Permalink 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.Windows.Forms;
namespace HL_FristAidPlatform_Apoplexy
{
public partial class sum : XtraForm
{
public string startTime;
public string endTime;
public string aczlType;
public int reportingStatus;
//public DataTable dt;
public sum()
{
InitializeComponent();
}
private void sum_Load(object sender, EventArgs e)
{
timeControl1.TimeValue = DateTime.Now.AddMonths(-6).ToString("yyyy-MM-dd");
timeControl2.TimeValue = DateTime.Now.ToString("yyyy-MM-dd");
GetRS60(Convert.ToDateTime(timeControl1.TimeValue), Convert.ToDateTime(timeControl2.TimeValue).AddDays(1), Information.Hospital.GUID);
GetRSZLDNTList(Convert.ToDateTime(timeControl1.TimeValue), Convert.ToDateTime(timeControl2.TimeValue).AddDays(1), Information.Hospital.GUID);
}
private void simpleButton1_Click(object sender, EventArgs e)
{
startTime = timeControl1.TimeValue;
endTime = timeControl2.TimeValue;
GetRS60(Convert.ToDateTime(startTime), Convert.ToDateTime(endTime).AddDays(1), Information.Hospital.GUID);
GetRSZLDNTList(Convert.ToDateTime(startTime), Convert.ToDateTime(endTime).AddDays(1), Information.Hospital.GUID);
}
public void GetRS60(DateTime startT, DateTime endT, string hospitalGuid)
{
try
{
int type = 0;
if (radio_DNT60.Checked == true)
type = 0;
if (radio_DNT35.Checked == true)
type = 1;
chartControl1.Series.Clear();
chartControl1.Titles.Clear();
Series series1= new Series("脑梗死患者静脉溶栓的DNT合格比例", ViewType.Pie);
//series1.Points.Clear();
ChartTitle chartTitle2 = new ChartTitle();
if (type == 1)
{
chartTitle2.Text = "脑梗死患者静脉溶栓的DNT时间小于35分钟";
}
if (type == 0)
{
chartTitle2.Text = "脑梗死患者静脉溶栓的DNT时间小于60分钟";
}
chartControl1.Titles.Add(chartTitle2);
string Url = string.Format("/api/service/T_Service_Apoplexy_Statistics/GetRSZLDNT?startTime={0}&endTime={1}&hospitalGuid={2}&type={3}", startT, endT, hospitalGuid, type);
List<rs60DNT> list = DBHelpClass.GetList<rs60DNT>(Url);
if (list != null)
{
for (int i = 0; i < list.Count; i++)
{
series1.Points.Add(new SeriesPoint("不合格数" + " " + list[i].rsCount.ToString() + "个", new double[] { Convert.ToInt32(list[i].rsCount.ToString()) }));
series1.Points.Add(new SeriesPoint("合格数" + " " + list[i].rs60.ToString() + "个", new double[] { Convert.ToInt32(list[i].rs60.ToString()) }));
}
}
series1.Label.TextPattern = "{A}: {VP:p0}";
((PieSeriesLabel)series1.Label).Position = PieSeriesLabelPosition.TwoColumns;
((PieSeriesLabel)series1.Label).ResolveOverlappingMode = ResolveOverlappingMode.Default;
chartControl1.Series.Add(series1);
}
catch (Exception ex)
{
PublicClass.WriteErrorLog(this.Text, "获取脑梗死患者静脉溶栓小于60分钟统计数据\r\n" + ex);
}
}
public void GetRSZLDNTList(DateTime startT, DateTime endT, string hospitalGuid)
{
try
{
int type = 0;
if (radio_DNT60.Checked == true)
type = 0;
if (radio_DNT35.Checked == true)
type = 1;
string Url = string.Format("/api/service/T_Service_Apoplexy_Statistics/GetRSZLDNTList?startTime={0}&endTime={1}&hospitalGuid={2}&type={3}", startT, endT, hospitalGuid, type);
List<rs60upDNTList> list = DBHelpClass.GetList<rs60upDNTList>(Url);
if (list != null)
{
gridControl1.DataSource = list;
}
}
catch (Exception ex)
{
PublicClass.WriteErrorLog(this.Text, "获取脑梗死患者静脉溶栓大于60分钟统计数据列表\r\n" + ex);
}
}
public class rs60DNT
{
public int rsCount { get; set; }
public int rs60 { get; set; }
}
public class rs60upDNTList
{
public long ID { get; set; }
public string GUID { get; set; }
public string Name { get; set; }
public string RSDNT { get; set; }
public int Gender { get; set; }
public string acZLType { get; set; }
public int ReportingStatus { get; set; }
public DateTime? CreationDate { get; set; }
}
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 gridControl1_DoubleClick(object sender, EventArgs e)
{
try
{
ShowDetail();
}
catch (Exception ex)
{
PublicClass.WriteErrorLog(this.Text, "DNT时间大于60分钟查看患者详情\r\n" + ex);
}
}
private void ShowDetail()
{
if (gridView1.DataRowCount > 0)
{
int selectRow = gridView1.GetSelectedRows()[0];
long PatientID = PublicClass.ToInt64(gridView1.GetRowCellValue(selectRow, "ID").ToString(), 0);
string GUID = gridView1.GetRowCellValue(selectRow, "GUID").ToString();
//string HospitalGuid = gridView1.GetRowCellValue(selectRow, "HospitalGuid").ToString();
string aczlType = gridView1.GetRowCellValue(selectRow, "acZLType").ToString();
int reportingStatus = int.Parse(gridView1.GetRowCellValue(selectRow, "ReportingStatus").ToString());
string dntsum = "1";
if (PatientID > 0)
{
//string _patientGuid = "", long _patientWristStrap = 0, string _aczlType = "", int _reportingStatus = 0
Form_PatientDetail detail = new Form_PatientDetail(GUID, dntsum);
detail.WindowState = FormWindowState.Maximized;
detail.Owner = this;
detail.Show();
//detail.ShowDialog();
//loading.HideMessage();
}
}
}
private void radio_DNT60_CheckedChanged(object sender, EventArgs e)
{
if (radio_DNT60.Checked == true)
{
gridView1.GroupPanelText = "脑梗死患者静脉溶栓的DNT时间大于60分钟";
GetRS60(Convert.ToDateTime(startTime), Convert.ToDateTime(endTime).AddDays(1), Information.Hospital.GUID);
GetRSZLDNTList(Convert.ToDateTime(startTime), Convert.ToDateTime(endTime).AddDays(1), Information.Hospital.GUID);
}
}
private void radio_DNT35_CheckedChanged(object sender, EventArgs e)
{
if (radio_DNT35.Checked == true)
{
gridView1.GroupPanelText = "脑梗死患者静脉溶栓的DNT时间大于35分钟";
GetRS60(Convert.ToDateTime(startTime), Convert.ToDateTime(endTime).AddDays(1), Information.Hospital.GUID);
GetRSZLDNTList(Convert.ToDateTime(startTime), Convert.ToDateTime(endTime).AddDays(1), Information.Hospital.GUID);
}
}
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();
}
}
}