1001 lines
42 KiB
C#
1001 lines
42 KiB
C#
using DevExpress.XtraCharts;
|
||
using DevExpress.XtraEditors;
|
||
using DevExpress.XtraGrid.Views.Grid;
|
||
using HL_FristAidPlatform_DTO;
|
||
using HL_FristAidPlatform_MultiSystemPublic;
|
||
using HL_FristAidPlatform_Public;
|
||
using System;
|
||
using System.Collections.Generic;
|
||
using System.Data;
|
||
using System.Drawing;
|
||
using System.Linq;
|
||
using System.Threading;
|
||
using System.Windows.Forms;
|
||
|
||
namespace HL_FristAidPlatform_ChestPain
|
||
{
|
||
public partial class Form_Index : XtraForm
|
||
{
|
||
#region 变量
|
||
/// <summary>
|
||
/// 患者源
|
||
/// </summary>
|
||
private DataTable PatientDiagnosisDT = new DataTable();
|
||
|
||
/// <summary>
|
||
/// 当前问题的正确答案
|
||
/// </summary>
|
||
private string Cur_RightAnswer = string.Empty;
|
||
|
||
/// <summary>
|
||
/// 档案问题答案集合(文字)
|
||
/// </summary>
|
||
private string Cur_AnswerStr = string.Empty;
|
||
/// <summary>
|
||
/// 需随访患者是否弹窗提醒
|
||
/// </summary>
|
||
private int flag = 0;
|
||
/// <summary>
|
||
/// 需随访患者
|
||
/// </summary>
|
||
private string followUpRemindNeed = "近期需随访患者:";
|
||
#endregion 变量
|
||
|
||
System.Timers.Timer t = new System.Timers.Timer(100000);//实例化Timer类,设置间隔时间为10000毫秒;
|
||
|
||
public DataTable ResultDT;
|
||
public Form_Index()
|
||
{
|
||
InitializeComponent();
|
||
}
|
||
|
||
/// <summary>
|
||
/// 加载
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
private void Form_Index_Load(object sender, EventArgs e)
|
||
{
|
||
try
|
||
{
|
||
//GetPatientDiagnosis();
|
||
//数量统计
|
||
GetChestPainPatientNum();
|
||
//近6个月数据饼状图
|
||
GetChestPainPatientTrendChart();
|
||
//近6个月柱状图数据
|
||
GetChestPainPatientHistogram();
|
||
|
||
BindNotice();
|
||
GetIllessLeve();
|
||
BindMeeting();
|
||
//BindData();
|
||
GetFollowUpDate();
|
||
//t.Elapsed += new System.Timers.ElapsedEventHandler(Execute);//到达时间的时候执行事件;
|
||
//t.AutoReset = true;//设置是执行一次(false)还是一直执行(true);
|
||
//t.Enabled = true;//是否执行System.Timers.Timer.Elapsed事件;
|
||
//t.Start();
|
||
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
|
||
//throw ex;
|
||
}
|
||
}
|
||
|
||
|
||
public void Execute(object source, System.Timers.ElapsedEventArgs e)
|
||
{
|
||
t.Stop(); //先关闭定时器
|
||
BeginInvoke(new ThreadStart(delegate ()
|
||
{
|
||
string Url = string.Format("api/service/T_Service_NoticeReceiving/getNoticeAndReadState?pageIndex={0}&pageSize={1}&UserID={2}", 1, 20, Information.User.ID);
|
||
ResultDT = DBHelpClass.Get(Url);
|
||
grid_Notice.DataSource = ResultDT;
|
||
//GetPatientDiagnosis();
|
||
BindMeeting();
|
||
}));
|
||
t.Start(); //执行完毕后再开启器
|
||
}
|
||
|
||
/// <summary>
|
||
/// 绑定数据
|
||
/// </summary>
|
||
private void BindData()
|
||
{
|
||
BeginInvoke(new ThreadStart(delegate ()
|
||
{
|
||
//界面加载完毕 读取数据并且绑定控件
|
||
//GetPatientDiagnosis();
|
||
BindNotice();
|
||
GetIllessLeve();
|
||
//BindQuestion();
|
||
BindMeeting();
|
||
}));
|
||
}
|
||
|
||
#region 统计图绘制——新
|
||
/// <summary>
|
||
/// 数量数据渲染
|
||
/// </summary>
|
||
private void GetChestPainPatientNum()
|
||
{
|
||
ChestPainPatientNumDTO model = DBHelpClass.GetDateModel<ChestPainPatientNumDTO>(string.Format("api/service/T_Service_ChestPain_Statistics/GetChestPainPatientNum?hospitalGuid={0}", Information.Hospital.GUID));
|
||
|
||
if (model != null)
|
||
{
|
||
simpleLabelItem_Today.Text = model.ToDayCount + "";
|
||
simpleLabelItem_Week.Text = model.WeekCount + "";
|
||
simpleLabelItem_Month.Text = model.MonthCount + "";
|
||
simpleLabelItem_Total.Text = model.SixMonthCount + "";
|
||
lbl_TotalCount.Text = model.TotalCount + "";
|
||
}
|
||
|
||
|
||
}
|
||
|
||
|
||
/// <summary>
|
||
/// 饼图数据渲染
|
||
/// </summary>
|
||
private void GetChestPainPatientTrendChart()
|
||
{
|
||
List<KeyNumber> list = DBHelpClass.GetList<KeyNumber>(string.Format("api/service/T_Service_ChestPain_Statistics/GetChestPainPatientTrendChart?hospitalGuid={0}", Information.Hospital.GUID));
|
||
|
||
chart_Pie.Series.Clear();
|
||
chart_Pie.Titles.Clear();
|
||
int sum = 0;
|
||
Series series2 = new Series("近6个月胸痛病种分布图(合计 " + sum + " 例)", ViewType.Pie);
|
||
for (int i = 0; i < list.Count(); i++)
|
||
{
|
||
sum += list[i].Value;
|
||
series2.Points.Add(new SeriesPoint(list[i].Key + ":" + list[i].Value + " 例", list[i].Value));
|
||
}
|
||
ChartTitle chartTitle2 = new ChartTitle();
|
||
chartTitle2.Text = "近6个月胸痛病种分布图(合计 " + sum + " 例)";
|
||
chart_Pie.Titles.Add(chartTitle2);
|
||
((PiePointOptions)series2.PointOptions).PercentOptions.ValueAsPercent = false;
|
||
((PiePointOptions)series2.PointOptions).ValueNumericOptions.Format = NumericFormat.Number;
|
||
//series2.LegendPointOptions.PointView = PointView.ArgumentAndValues;
|
||
//series2.LegendPointOptions.Pattern = "{A}: {VP:P2}";
|
||
series2.Label.TextPattern = "{A}: {VP:p2}";
|
||
chart_Pie.Series.AddRange(new Series[] { series2 });
|
||
|
||
}
|
||
|
||
/// <summary>
|
||
/// 柱状图数据渲染
|
||
/// </summary>
|
||
private void GetChestPainPatientHistogram()
|
||
{
|
||
List<MonthKeyValueDTO> listModel = DBHelpClass.GetList<MonthKeyValueDTO>(string.Format("api/service/T_Service_ChestPain_Statistics/GetChestPainPatientHistogram?hospitalGuid={0}", Information.Hospital.GUID));
|
||
|
||
chart_Line.Series.Clear();
|
||
chart_Line.Titles.Clear();
|
||
Series series1 = new Series("STEMI", ViewType.Bar);
|
||
Series series2 = new Series("NSTEMI", ViewType.Bar);
|
||
Series series3 = new Series("UA", ViewType.Bar);
|
||
Series series4 = new Series("主动脉夹层", ViewType.Bar);
|
||
Series series5 = new Series("肺动脉栓塞", ViewType.Bar);
|
||
Series series6 = new Series("非ACS心源性胸痛", ViewType.Bar);
|
||
Series series7 = new Series("其它非心源性胸痛", ViewType.Bar);
|
||
Series series8 = new Series("待查", ViewType.Bar);
|
||
Series series9 = new Series("未诊断", ViewType.Bar);
|
||
Series series10 = new Series("总数", ViewType.Line);
|
||
|
||
ChartTitle chartTitle1 = new ChartTitle();
|
||
chartTitle1.Text = "近六月胸痛患者趋势图";
|
||
chart_Line.Titles.Add(chartTitle1);
|
||
|
||
int max = 0;
|
||
if (listModel != null && listModel.Count > 0)
|
||
{
|
||
int sum = 0;
|
||
for (int i = 0; i < listModel.Count(); i++)
|
||
{
|
||
sum = 0;
|
||
for (int j = 0; j < listModel[i].list.Count(); j++)
|
||
{
|
||
sum += listModel[i].list[j].Value;
|
||
}
|
||
if (sum > max)
|
||
max = sum;
|
||
series1.Points.Add(new SeriesPoint(listModel[i].Month, listModel[i].list[0].Value));
|
||
series2.Points.Add(new SeriesPoint(listModel[i].Month, listModel[i].list[1].Value));
|
||
series3.Points.Add(new SeriesPoint(listModel[i].Month, listModel[i].list[2].Value));
|
||
series4.Points.Add(new SeriesPoint(listModel[i].Month, listModel[i].list[3].Value));
|
||
series5.Points.Add(new SeriesPoint(listModel[i].Month, listModel[i].list[4].Value));
|
||
series6.Points.Add(new SeriesPoint(listModel[i].Month, listModel[i].list[5].Value));
|
||
series7.Points.Add(new SeriesPoint(listModel[i].Month, listModel[i].list[6].Value));
|
||
series8.Points.Add(new SeriesPoint(listModel[i].Month, listModel[i].list[7].Value));
|
||
series9.Points.Add(new SeriesPoint(listModel[i].Month, listModel[i].list[8].Value));
|
||
|
||
series10.Points.Add(new SeriesPoint(listModel[i].Month, sum));
|
||
|
||
}
|
||
}
|
||
|
||
BarSeriesView bsv = (BarSeriesView)series1.View;
|
||
bsv.BarWidth = 0.25;
|
||
BarSeriesView bsv1 = (BarSeriesView)series2.View;
|
||
bsv1.BarWidth = 0.25;
|
||
BarSeriesView bsv2 = (BarSeriesView)series3.View;
|
||
bsv2.BarWidth = 0.25;
|
||
BarSeriesView bsv3 = (BarSeriesView)series4.View;
|
||
bsv3.BarWidth = 0.25;
|
||
BarSeriesView bsv4 = (BarSeriesView)series5.View;
|
||
bsv4.BarWidth = 0.25;
|
||
BarSeriesView bsv5 = (BarSeriesView)series6.View;
|
||
bsv5.BarWidth = 0.25;
|
||
BarSeriesView bsv6 = (BarSeriesView)series7.View;
|
||
bsv6.BarWidth = 0.25;
|
||
BarSeriesView bsv7 = (BarSeriesView)series8.View;
|
||
bsv7.BarWidth = 0.25;
|
||
BarSeriesView bsv8 = (BarSeriesView)series9.View;
|
||
bsv8.BarWidth = 0.25;
|
||
|
||
series10.LabelsVisibility = DevExpress.Utils.DefaultBoolean.True;
|
||
chart_Line.Series.AddRange(new Series[] { series1, series2, series3, series4, series5, series6, series7, series8, series9, series10 });
|
||
XYDiagram xyDia = chart_Line.Diagram as XYDiagram;
|
||
xyDia.AxisX.DateTimeScaleOptions.ScaleMode = ScaleMode.Manual;
|
||
xyDia.AxisX.DateTimeScaleOptions.MeasureUnit = DateTimeMeasureUnit.Month;
|
||
|
||
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;
|
||
|
||
((XYDiagram)(chart_Line.Diagram)).EnableAxisXScrolling = true;//启用横轴滚动条
|
||
}
|
||
|
||
|
||
|
||
#endregion
|
||
|
||
|
||
#region 统计图绘制
|
||
/// <summary>
|
||
/// 获取患者档案数据
|
||
/// </summary>
|
||
private void GetPatientDiagnosis()
|
||
{
|
||
try
|
||
{
|
||
string strParameter = string.Empty;
|
||
|
||
//没有所有院区权限 只获取当前院区数据
|
||
if (!PublicHelp.IsHaveAllDistrictRight(Information.User.ID))
|
||
{
|
||
strParameter += "&hospitalGuid=" + Information.Hospital.GUID;
|
||
}
|
||
|
||
string NowTime = DateTime.Now.ToString("yyyy-MM-dd") + " 23:59:59";
|
||
|
||
string Url = string.Format("api/service/T_Service_ChestPain_Statistics/GetPatientDiagnosis?systemModuleID={0}&startTime={1}&endTime={2}", PublicClassForDataBase.Config10001, "", NowTime, strParameter);
|
||
PatientDiagnosisDT = DBHelpClass.GetJsonText(Url);
|
||
|
||
if (PatientDiagnosisDT != null && PatientDiagnosisDT.Rows.Count > 0)
|
||
{
|
||
string Today_StartTime = DateTime.Now.Date.ToString("yyyy-MM-dd");
|
||
string Today_EndTime = DateTime.Now.Date.ToString("yyyy-MM-dd");
|
||
simpleLabelItem_Today.Text = CountForTime(PatientDiagnosisDT, Today_StartTime, Today_EndTime);
|
||
|
||
//string Week_StartTime = DateTime.Now.AddDays(Convert.ToDouble((0 - Convert.ToInt16(DateTime.Now.DayOfWeek)))).ToString("yyyy-MM-dd");
|
||
//string Week_EndTime = DateTime.Now.AddDays(Convert.ToDouble((6 - Convert.ToInt16(DateTime.Now.DayOfWeek)))).ToString("yyyy-MM-dd");
|
||
|
||
DateTime nowTime = DateTime.Now;
|
||
#region 获取本周第一天
|
||
int weeknow = Convert.ToInt32(nowTime.DayOfWeek);
|
||
weeknow = (weeknow == 0 ? (7 - 1) : (weeknow - 1));
|
||
int daydiff = (-1) * weeknow;
|
||
//本周第一天
|
||
string Week_StartTime = nowTime.AddDays(daydiff).ToString("yyyy-MM-dd");
|
||
#endregion
|
||
|
||
#region 获取本周最后一天
|
||
int lastWeekDay = Convert.ToInt32(nowTime.DayOfWeek);
|
||
lastWeekDay = lastWeekDay == 0 ? (7 - lastWeekDay) : lastWeekDay;
|
||
int lastWeekDiff = (7 - lastWeekDay);
|
||
//本周最后一天
|
||
string Week_EndTime = nowTime.AddDays(lastWeekDiff).ToString("yyyy-MM-dd");
|
||
#endregion
|
||
simpleLabelItem_Week.Text = CountForTime(PatientDiagnosisDT, Week_StartTime, Week_EndTime);
|
||
|
||
//string Month_StartTime = DateTime.Now.AddDays(1 - DateTime.Now.Day).Date.ToString("yyyy-MM-dd");
|
||
//string Month_EndTime = DateTime.Now.AddDays(1 - DateTime.Now.Day).Date.AddMonths(1).AddDays(-1).ToString("yyyy-MM-dd");
|
||
//获取当前月的第一天
|
||
string Month_StartTime = new DateTime(nowTime.Year, nowTime.Month, 1).ToString("yyyy-MM-dd");
|
||
DateTime d1 = new DateTime(nowTime.Year, nowTime.Month, 1);
|
||
//获取当前月的最后一天
|
||
string Month_EndTime = d1.AddMonths(1).AddDays(-1).ToString("yyyy-MM-dd");
|
||
simpleLabelItem_Month.Text = CountForTime(PatientDiagnosisDT, Month_StartTime, Month_EndTime);
|
||
simpleLabelItem_Total.Text = PatientDiagnosisDT.Rows.Count.ToString();
|
||
lbl_TotalCount.Text = PatientDiagnosisDT.Rows.Count.ToString();
|
||
//DrawPieChart(PatientDiagnosisDT);
|
||
//DrawLineChart(PatientDiagnosisDT);
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
PublicClass.WriteErrorLog(this.Text, "获取患者档案元数据:\r\n" + ex);
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 计算区间内数量
|
||
/// </summary>
|
||
/// <param name="dataTable">数据源</param>
|
||
/// <param name="startTime">开始时间</param>
|
||
/// <param name="endTime">结束时间</param>
|
||
/// <returns></returns>
|
||
private string CountForTime(DataTable dataTable, string startTime, string endTime)
|
||
{
|
||
string Count = "0";
|
||
if (dataTable != null)
|
||
{
|
||
DataRow[] DataRow_Config = dataTable.Select(string.Format("RegisterTime_ForDay>='{0}' and RegisterTime_ForDay<='{1}'", startTime, endTime));
|
||
if (DataRow_Config.Length > 0)
|
||
{
|
||
Count = DataRow_Config.Length.ToString();
|
||
}
|
||
}
|
||
return Count;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 绘制饼状图
|
||
/// </summary>
|
||
/// <param name="dataTable">数据源</param>
|
||
private void DrawPieChart(DataTable dataTable)
|
||
{
|
||
try
|
||
{
|
||
if (dataTable != null)
|
||
{
|
||
DataTable data = new DataTable();
|
||
data.Columns.Add("Name", typeof(string));
|
||
data.Columns.Add("Value", typeof(int));
|
||
|
||
var query = from t in dataTable.AsEnumerable()
|
||
group t by new { t1 = t.Field<string>("Diagnosis") } into m
|
||
select new
|
||
{
|
||
name = m.Key.t1,
|
||
count = m.Count()
|
||
};
|
||
|
||
foreach (var item in query.ToList())
|
||
{
|
||
data.Rows.Add(item.name, item.count);
|
||
}
|
||
|
||
chart_Pie.Series["Series1"].ValueDataMembers[0] = "Value";
|
||
chart_Pie.Series["Series1"].ArgumentDataMember = "Name";
|
||
chart_Pie.Series["Series1"].DataSource = data;
|
||
|
||
//横标题设置
|
||
chart_Pie.Titles.Clear(); //先清除以前的标题
|
||
ChartTitle titles = new ChartTitle();//声明标题
|
||
titles.TextColor = System.Drawing.Color.Black;//颜色
|
||
titles.Indent = 1;//设置距离 值越小柱状图就越大
|
||
//titles.Font = new Font("Tahoma", 9, FontStyle.Regular);//设置字体
|
||
titles.Dock = ChartTitleDockStyle.Top;//设置对齐方式
|
||
titles.Indent = 0;
|
||
// titles.Alignment = StringAlignment.Center;//居中对齐
|
||
titles.Text = "近6个月胸痛病种分布图(合计:" + dataTable.Rows.Count + "例)";//名称
|
||
chart_Pie.Titles.Add(titles);
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
PublicClass.WriteErrorLog(this.Text, "绘制饼状图:\r\n" + ex);
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 绘制趋势图
|
||
/// </summary>
|
||
/// <param name="dataTable">数据源</param>
|
||
private void DrawLineChart(DataTable dataTable)
|
||
{
|
||
try
|
||
{
|
||
if (dataTable != null)
|
||
{
|
||
DataTable dataTableCopy = new DataTable();
|
||
dataTableCopy = dataTable.Clone();
|
||
|
||
DataTable dataLine = new DataTable("table1");
|
||
dataLine.Columns.Add("Name", typeof(DateTime));
|
||
dataLine.Columns.Add("Value", typeof(int));
|
||
|
||
DataTable data = new DataTable("table2");
|
||
data.Columns.Add("Year", typeof(DateTime));
|
||
data.Columns.Add("Name", typeof(string));
|
||
data.Columns.Add("Value", typeof(int));
|
||
|
||
var date = from t in dataTable.AsEnumerable()
|
||
group t by new { t1 = t.Field<string>("RegisterTime") } into m
|
||
select new
|
||
{
|
||
month = m.Key
|
||
};
|
||
|
||
foreach (var month in date)
|
||
{
|
||
int monthCount = 0;
|
||
var query = from t in dataTable.AsEnumerable()
|
||
where t.Field<string>("RegisterTime") == month.month.t1.ToString()
|
||
group t by new { t1 = t.Field<string>("Diagnosis") } into m
|
||
select new
|
||
{
|
||
name = m.Key.t1,
|
||
count = m.Count()
|
||
};
|
||
foreach (var item in query.ToList())
|
||
{
|
||
monthCount += item.count;
|
||
data.Rows.Add(month.month.t1.ToString(), item.name, item.count);
|
||
}
|
||
dataLine.Rows.Add(month.month.t1.ToString(), monthCount);
|
||
}
|
||
chart_Line.Series["本月总数"].ValueDataMembers[0] = "Value";
|
||
chart_Line.Series["本月总数"].ArgumentDataMember = "Name";
|
||
chart_Line.Series["本月总数"].DataSource = dataLine;
|
||
|
||
chart_Line.SeriesDataMember = "Name";
|
||
chart_Line.SeriesTemplate.ArgumentDataMember = "Year";
|
||
chart_Line.SeriesTemplate.ValueDataMembers.AddRange(new string[] { "Value" });
|
||
chart_Line.DataSource = data;
|
||
chart_Line.Legend.Direction = LegendDirection.LeftToRight;
|
||
chart_Line.Legend.AlignmentHorizontal = LegendAlignmentHorizontal.Center;
|
||
chart_Line.Legend.AlignmentVertical = LegendAlignmentVertical.BottomOutside;
|
||
XYDiagram diagram = chart_Line.Diagram as XYDiagram;
|
||
diagram.AxisX.DateTimeScaleOptions.GridAlignment = DateTimeGridAlignment.Month;
|
||
diagram.AxisX.DateTimeScaleOptions.MeasureUnit = DateTimeMeasureUnit.Month;
|
||
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
PublicClass.WriteErrorLog(this.Text, "绘制趋势图:\r\n" + ex);
|
||
}
|
||
}
|
||
#endregion 统计图绘制
|
||
|
||
#region 每日一题
|
||
/// <summary>
|
||
/// 绑定每日一题
|
||
/// </summary>
|
||
private void BindQuestion()
|
||
{
|
||
try
|
||
{
|
||
if (PublicHelp.IsConnectNetwork())
|
||
{
|
||
string Url = string.Format("api/base/T_Base_Question?id={0}", 1);
|
||
|
||
ClientFactory<string> httpClient = new HttpClientFactory<string>();
|
||
Client<string> client = httpClient.VisitFactory();
|
||
|
||
//访问
|
||
DataTable ResultDT = client.Get(Url, Enumerate.Platform.首辰健康, out int i);
|
||
|
||
if (ResultDT != null && ResultDT.Rows.Count > 0)
|
||
{
|
||
lbl_Question_Think.Text = ResultDT.Rows[0]["Question_Think"].ToString();
|
||
//绑定答案
|
||
BindAnswer(ResultDT.Rows[0]["GUID"].ToString(), ResultDT.Rows[0]["Question_Type"].ToString(), ResultDT.Rows[0]["Question_Content"].ToString());
|
||
}
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
PublicClass.WriteErrorLog(this.Text, "绑定每日一题:\r\n" + ex);
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 绑定每日一题答案
|
||
/// </summary>
|
||
/// <param name="question_GUID">问题GUID</param>
|
||
/// <param name="question_Type">问题类型</param>
|
||
/// <param name="question_Content">问题内容</param>
|
||
private void BindAnswer(string question_GUID, string question_Type, string question_Content)
|
||
{
|
||
try
|
||
{
|
||
string Url = string.Format("api/base/T_Base_Answer/GetByQuestionGuid?questionGuid={0}", question_GUID);
|
||
|
||
ClientFactory<string> httpClient = new HttpClientFactory<string>();
|
||
Client<string> client = httpClient.VisitFactory();
|
||
|
||
//访问
|
||
DataTable ResultDT = client.Get(Url, Enumerate.Platform.首辰健康, out int i);
|
||
if (ResultDT != null && ResultDT.Rows.Count > 0)
|
||
{
|
||
//问题类型1:单选题;2:多选题;3:问答题;4:拓展题;
|
||
switch (question_Type)
|
||
{
|
||
case "1":
|
||
lbl_Question_Title.Text = "(单选题)" + question_Content;
|
||
PublicClass.BindRadioGroupData(radioGroup_Answer, ResultDT, "Answer_Content", "GUID");
|
||
radioGroup_Answer.Visible = true;
|
||
checkedListBox_Answer.Visible = false;
|
||
txt_Answer.Visible = false;
|
||
break;
|
||
case "2":
|
||
lbl_Question_Title.Text = "(多选题)" + question_Content;
|
||
PublicClass.BindCheckedListBoxControlDataSource(checkedListBox_Answer, ResultDT, "Answer_Content", "GUID");
|
||
radioGroup_Answer.Visible = false;
|
||
checkedListBox_Answer.Visible = true;
|
||
txt_Answer.Visible = false;
|
||
break;
|
||
case "3":
|
||
lbl_Question_Title.Text = "(问答题)" + question_Content;
|
||
radioGroup_Answer.Visible = false;
|
||
checkedListBox_Answer.Visible = false;
|
||
txt_Answer.Visible = true;
|
||
break;
|
||
case "4":
|
||
lbl_Question_Title.Text = "(拓展题)" + question_Content;
|
||
radioGroup_Answer.Visible = false;
|
||
checkedListBox_Answer.Visible = false;
|
||
txt_Answer.Visible = true;
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
|
||
foreach (DataRow item in ResultDT.Rows)
|
||
{
|
||
Cur_AnswerStr += item["Answer_Content"] + "\r\n";
|
||
int Is_Right = PublicClass.ToInt32(item["Is_Right"], 0);
|
||
//正确答案
|
||
if (Is_Right == 1)
|
||
{
|
||
Cur_RightAnswer += item["Answer_Rise"] + ",";
|
||
}
|
||
}
|
||
|
||
//正确答案
|
||
if (!string.IsNullOrEmpty(Cur_RightAnswer))
|
||
{
|
||
Cur_RightAnswer = "正确答案:" + Cur_RightAnswer.Substring(0, Cur_RightAnswer.Length - 1);
|
||
}
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
PublicClass.WriteErrorLog(this.Text, "绑定每日一题答案:\r\n" + ex);
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 正确答案
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
private void lbl_Question_RightAnswer_Click(object sender, EventArgs e)
|
||
{
|
||
if (lbl_Question_RightAnswer.Text == "点击显示正确答案")
|
||
{
|
||
lbl_Question_RightAnswer.Text = Cur_RightAnswer;
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 复制题目
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
private void TSM_Copy_Question_Click(object sender, EventArgs e)
|
||
{
|
||
try
|
||
{
|
||
Clipboard.SetDataObject(lbl_Question_Title.Text + "\r\n" + Cur_AnswerStr + "\r\n" + lbl_Question_Think.Text);
|
||
XtraMessageBox.Show("复制题目内容成功!您可以(Ctrl+V)粘贴到你需要的位置!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
PublicClass.WriteErrorLog(this.Text, "复制题目:\r\n" + ex);
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 复制题目和答案
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
private void TSM_Copy_Question_Answer_Click(object sender, EventArgs e)
|
||
{
|
||
try
|
||
{
|
||
Clipboard.SetDataObject(lbl_Question_Title.Text + "\r\n" + Cur_AnswerStr + "\r\n" + lbl_Question_Think.Text + "\r\n" + Cur_RightAnswer);
|
||
XtraMessageBox.Show("复制题目内容与答案成功!您可以(Ctrl+V)粘贴到你需要的位置!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
PublicClass.WriteErrorLog(this.Text, "复制题目:\r\n" + ex);
|
||
}
|
||
}
|
||
#endregion 每日一题
|
||
|
||
#region 消息列表
|
||
/// <summary>
|
||
/// 绑定最新消息
|
||
/// </summary>
|
||
private void BindNotice()
|
||
{
|
||
try
|
||
{
|
||
grid_Notice.DataSource = null;
|
||
string Url = string.Format("api/service/T_Service_NoticeReceiving/getNoticeAndReadState?pageIndex={0}&pageSize={1}&UserID={2}", 1, 20, Information.User.ID);
|
||
ResultDT = DBHelpClass.Get(Url);
|
||
grid_Notice.DataSource = ResultDT;
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
PublicClass.WriteErrorLog(this.Text, "绑定最新消息:\r\n" + ex);
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 消息列表 绘制行号
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
private void grv_Notice_CustomDrawRowIndicator(object sender, DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventArgs e)
|
||
{
|
||
if (e.Info.IsRowIndicator && e.RowHandle > -1)
|
||
{
|
||
e.Info.DisplayText = (e.RowHandle + 1).ToString();
|
||
}
|
||
}
|
||
|
||
|
||
#endregion 消息列表
|
||
|
||
#region 会议提醒
|
||
/// <summary>
|
||
/// 绑定会议提醒
|
||
/// </summary>
|
||
private void BindMeeting()
|
||
{
|
||
try
|
||
{
|
||
string Url = $"api/service/T_Service_Meeting/GetList?hospitalGuid={Information.Hospital.GUID}&systemModuleID={Information.SystemModuleInfo.ID}&type=-1&topNumber=10";
|
||
|
||
DataTable ResultDT = DBHelpClass.GetJsonText(Url);
|
||
grid_Meeting.DataSource = ResultDT;
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
PublicClass.WriteErrorLog(this.Text, "绑定会议提醒:\r\n" + ex);
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 查看更多会议信息
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
private void link_ShowMore_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
|
||
{
|
||
Form_MeetingList frm = new Form_MeetingList();
|
||
frm.MdiParent = this.MdiParent;
|
||
frm.Show();
|
||
}
|
||
|
||
/// <summary>
|
||
/// 自定义显示列
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
private void grv_Meeting_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e)
|
||
{
|
||
//SpecifiedDay 倒计时
|
||
if (e.Column.FieldName == "SpecifiedDay")
|
||
{
|
||
int value = PublicClass.ToInt32(e.Value, 0);
|
||
|
||
if (value == 9999)
|
||
{
|
||
e.DisplayText = "已召开";
|
||
}
|
||
else
|
||
{
|
||
e.DisplayText = value + "天";
|
||
}
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 双击会议列表
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
private void grid_Meeting_MouseDoubleClick(object sender, MouseEventArgs e)
|
||
{
|
||
if (grv_Meeting.DataRowCount > 0)
|
||
{
|
||
int selectRow = grv_Meeting.GetSelectedRows()[0];
|
||
long MeetingID = PublicClass.ToInt64(grv_Meeting.GetRowCellValue(selectRow, "ID"), 0);
|
||
|
||
Form_Meeting_Detail frm = new Form_Meeting_Detail(MeetingID);
|
||
frm.ShowDialog();
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 颜色绘制
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
private void grv_Meeting_RowCellStyle(object sender, DevExpress.XtraGrid.Views.Grid.RowCellStyleEventArgs e)
|
||
{
|
||
GridView View = sender as GridView;
|
||
|
||
//预归档日期倒计时
|
||
if (e.Column.FieldName == "SpecifiedDay")
|
||
{
|
||
int cellValue = PublicClass.ToInt32(e.CellValue, 0);
|
||
|
||
//小于0天的红色提醒
|
||
if (cellValue < 0)
|
||
{
|
||
e.Appearance.ForeColor = Color.Red;
|
||
}
|
||
//最近七天内黄色显示
|
||
else if (cellValue >= 0 && cellValue <= 7)
|
||
{
|
||
e.Appearance.ForeColor = Color.YellowGreen;//字体颜色
|
||
}
|
||
}
|
||
}
|
||
#endregion 会议提醒
|
||
|
||
/// <summary>
|
||
/// 通知消息已读未读判断
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
private void grv_Notice_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e)
|
||
{
|
||
if (e.Column.FieldName == "ReadState")
|
||
{
|
||
string value = e.Value.ToString();
|
||
string str = "";
|
||
if (!string.IsNullOrEmpty(value))
|
||
{
|
||
if (value.Contains("0"))
|
||
{
|
||
str = "未读";
|
||
}
|
||
if (value.Contains("1"))
|
||
{
|
||
str = "已读";
|
||
}
|
||
}
|
||
e.DisplayText = str;
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 未读列表颜色
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
private void grv_Notice_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e)
|
||
{
|
||
if (e.Column.FieldName == "ReadState")
|
||
{
|
||
string ReadState = grv_Notice.GetRowCellValue(e.RowHandle, "ReadState").ToString();
|
||
if (ReadState == "0")
|
||
{
|
||
Font font = new System.Drawing.Font("", 9, FontStyle.Bold);
|
||
e.Appearance.ForeColor = Color.Red;
|
||
e.Appearance.Font = font;//字体加粗
|
||
}
|
||
if (ReadState == "1")
|
||
{
|
||
e.Appearance.ForeColor = Color.Green;
|
||
}
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 双击阅读状态变为已读
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
private void grv_Notice_DoubleClick(object sender, EventArgs e)
|
||
{
|
||
if (grv_Notice.DataRowCount > 0)
|
||
{
|
||
int selectRow = grv_Notice.GetSelectedRows()[0];
|
||
string ID = grv_Notice.GetRowCellValue(selectRow, "ID").ToString();
|
||
string ReadState = grv_Notice.GetRowCellValue(selectRow, "ReadState").ToString();
|
||
if (ReadState == "0")
|
||
{
|
||
string Url1 = string.Format("api/service/T_Service_NoticeReceiving/getReadStateByNoticeID?NoticeID={0}", ID);
|
||
DataTable dt = DBHelpClass.Get(Url1);
|
||
if (dt.Rows.Count > 0)
|
||
{
|
||
string TotalReading = dt.Rows[0]["TotalReading"].ToString();
|
||
string FirstReadingTime = dt.Rows[0]["FirstReadingTime"].ToString();
|
||
string UserID = dt.Rows[0]["UserID"].ToString();
|
||
string NoticeID = dt.Rows[0]["NoticeID"].ToString();
|
||
string Url = string.Format("api/service/T_Service_NoticeReceiving/UpdateReadState");
|
||
List<T_Service_NoticeReceivingDTO> list = new List<T_Service_NoticeReceivingDTO>();
|
||
T_Service_NoticeReceivingDTO nrd = new T_Service_NoticeReceivingDTO();
|
||
if (!string.IsNullOrEmpty(FirstReadingTime))
|
||
{
|
||
nrd.FirstReadingTime = FirstReadingTime;
|
||
}
|
||
else
|
||
{
|
||
nrd.FirstReadingTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||
}
|
||
nrd.ReadState = 1;
|
||
if (!string.IsNullOrEmpty(TotalReading))
|
||
{
|
||
nrd.TotalReading = Convert.ToInt32(TotalReading) + 1;
|
||
}
|
||
else
|
||
{
|
||
nrd.TotalReading = 1;
|
||
}
|
||
if (!string.IsNullOrEmpty(NoticeID))
|
||
{
|
||
nrd.NoticeID = Convert.ToInt32(NoticeID);
|
||
}
|
||
if (!string.IsNullOrEmpty(UserID))
|
||
{
|
||
nrd.UserID = Convert.ToInt32(UserID);
|
||
}
|
||
list.Add(nrd);
|
||
//初始化两个工厂
|
||
ClientFactory<T_Service_NoticeReceivingDTO> httpClient = new HttpClientFactory<T_Service_NoticeReceivingDTO>();
|
||
Client<T_Service_NoticeReceivingDTO> client = httpClient.VisitFactory();
|
||
ListEntity<T_Service_NoticeReceivingDTO> t = client.Post(Url, list);
|
||
if (!t.Success)
|
||
{
|
||
return;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
this.BindData();
|
||
}
|
||
|
||
#region 病情程度统计
|
||
public void GetIllessLeve()
|
||
{
|
||
|
||
chartControl1.Series.Clear();
|
||
chartControl1.Titles.Clear();
|
||
Series series1 = new Series("濒危", ViewType.Bar);
|
||
Series series2 = new Series("危重", ViewType.Bar);
|
||
Series series3 = new Series("急症", ViewType.Bar);
|
||
Series series4 = new Series("非急症", ViewType.Bar);
|
||
Series series5 = new Series("已死亡", ViewType.Bar);
|
||
ChartTitle chartTitle1 = new ChartTitle();
|
||
chartTitle1.Text = "近六月病情程度趋势";
|
||
chartControl1.Titles.Add(chartTitle1);
|
||
IllnessLevelDTO model = DBHelpClass.GetDateModel<IllnessLevelDTO>(string.Format("api/service/T_Service_IllnessLevel/GetIllnessLevelStatistics?hospitalGuid={0}&systemModuleID={1}&startTime={2}&endTime={3}&flag={4}", Information.Hospital.GUID, long.Parse(PublicClassForDataBase.Config10001), DateTime.Now.AddMonths(-5).ToString(), DateTime.Now.ToString(), 0));
|
||
int max = 0;
|
||
if (model != null)
|
||
{
|
||
if (model.monthvalue != null && model.monthvalue.Count() > 0)
|
||
for (int j = 0; j < model.monthvalue.Count(); j++)
|
||
{
|
||
for (int i = 0; i < model.monthvalue.Count; i++)
|
||
{
|
||
if (max < model.monthvalue[i].Endangered)
|
||
{
|
||
max = model.monthvalue[i].Endangered;
|
||
}
|
||
if (max < model.monthvalue[i].Critical)
|
||
{
|
||
max = model.monthvalue[i].Critical;
|
||
}
|
||
if (max < model.monthvalue[i].Emergencycase)
|
||
{
|
||
max = model.monthvalue[i].Emergencycase;
|
||
}
|
||
if (max < model.monthvalue[i].NoEmergencycase)
|
||
{
|
||
max = model.monthvalue[i].NoEmergencycase;
|
||
}
|
||
if (max < model.monthvalue[i].Dead)
|
||
{
|
||
max = model.monthvalue[i].Dead;
|
||
}
|
||
series1.Points.Add(new SeriesPoint(model.monthvalue[i].Month, model.monthvalue[i].Endangered));
|
||
series2.Points.Add(new SeriesPoint(model.monthvalue[i].Month, model.monthvalue[i].Critical));
|
||
series3.Points.Add(new SeriesPoint(model.monthvalue[i].Month, model.monthvalue[i].Emergencycase));
|
||
series4.Points.Add(new SeriesPoint(model.monthvalue[i].Month, model.monthvalue[i].NoEmergencycase));
|
||
series5.Points.Add(new SeriesPoint(model.monthvalue[i].Month, model.monthvalue[i].Dead));
|
||
}
|
||
}
|
||
}
|
||
|
||
BarSeriesView bsv = (BarSeriesView)series1.View;
|
||
bsv.BarWidth = 0.2;
|
||
BarSeriesView bsv1 = (BarSeriesView)series2.View;
|
||
bsv1.BarWidth = 0.2;
|
||
BarSeriesView bsv2 = (BarSeriesView)series2.View;
|
||
bsv2.BarWidth = 0.2;
|
||
BarSeriesView bsv3 = (BarSeriesView)series2.View;
|
||
bsv3.BarWidth = 0.2;
|
||
BarSeriesView bsv4 = (BarSeriesView)series2.View;
|
||
bsv4.BarWidth = 0.2;
|
||
chartControl1.Series.AddRange(new Series[] { series1, series2, series3, series4, series5 });
|
||
XYDiagram xyDia = chartControl1.Diagram as XYDiagram;
|
||
xyDia.AxisX.DateTimeScaleOptions.ScaleMode = ScaleMode.Manual;
|
||
xyDia.AxisX.DateTimeScaleOptions.MeasureUnit = DateTimeMeasureUnit.Month;
|
||
|
||
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.WholeRange.Auto = false;
|
||
xyDia.AxisY.NumericScaleOptions.GridOffset = 0;
|
||
xyDia.AxisY.NumericScaleOptions.GridSpacing = max / 5;
|
||
|
||
|
||
((XYDiagram)(chartControl1.Diagram)).EnableAxisXScrolling = true;//启用横轴滚动条
|
||
}
|
||
#endregion
|
||
|
||
public void GetFollowUpDate()
|
||
{
|
||
string Url = string.Format("api/service/T_Service_ChestPain_FollowUpInfo/GetChestPainFollowUpList1?hospitalGuid={0}", Information.Hospital.GUID);
|
||
List<KeyValue> keyValuelist = DBHelpClass.GetList<KeyValue>(Url);
|
||
if (flag == 0)
|
||
{
|
||
if (keyValuelist != null && keyValuelist.Count > 0)
|
||
{
|
||
for (int i = 0; i < keyValuelist.Count; i++)
|
||
{
|
||
followUpRemindNeed += keyValuelist[i].Key + ";";
|
||
}
|
||
flag = 1;
|
||
//弹窗提醒需随访患者
|
||
if (followUpRemindNeed != "近期需随访患者:")
|
||
{
|
||
Form_Followupremind followupremind = new Form_Followupremind(followUpRemindNeed);
|
||
followupremind.TopMost = true;
|
||
followupremind.Location = new Point(SystemInformation.PrimaryMonitorSize.Width / 2 - 200, SystemInformation.PrimaryMonitorSize.Height / 2 - 150);
|
||
followupremind.Show();
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
}
|
||
}
|
||
|