400 lines
16 KiB
C#
400 lines
16 KiB
C#
using System;
|
||
using System.Collections.Generic;
|
||
using System.ComponentModel;
|
||
using System.Data;
|
||
using System.Drawing;
|
||
using System.Linq;
|
||
using System.Text;
|
||
using System.Windows.Forms;
|
||
|
||
namespace AIMS.OperationAfter.UI
|
||
{
|
||
public partial class frmCommonLargeScreen : Form
|
||
{
|
||
|
||
private DateTime dtpBeginDate;
|
||
private DateTime dtpEndDate;
|
||
private int dSum = 0; //数据表的总记录
|
||
private int startRecond; //起始记录
|
||
private int endRecond = 0; //结束记录
|
||
private int PageSum = 10; //每页显示的记录数
|
||
private int countPage = 0; //总页数
|
||
private int currentPage = 0; //当前页
|
||
private DataTable dts;
|
||
|
||
#region 配置文件的属性
|
||
|
||
private string fontSize = "24px";
|
||
private string fontFamily = "黑体";
|
||
private string bodyBgColor = "#000000";
|
||
private string titleBgColor = "#62D377";
|
||
private string titleColBgColor = "#2D9131";
|
||
private string rowOddBgColor = "#000000";
|
||
private string rowEvenBgColor = "#000000";
|
||
private string opeBeforColor = "DodgerBlue";
|
||
//private string opeInColor = "red";
|
||
private string opeInColor = "yellow";
|
||
private string opeAfterColor = "rgb(32, 218, 112)";
|
||
private string opeInColor1 = "Orange";
|
||
private string opeAfterColor1 = "Wheat";
|
||
private string defaultColor = "LightSkyBlue"; //1
|
||
private string PatientNames = "";
|
||
|
||
#endregion
|
||
protected override bool ProcessCmdKey(ref System.Windows.Forms.Message msg, System.Windows.Forms.Keys keyData)
|
||
{
|
||
int WM_KEYDOWN = 256;
|
||
int WM_SYSKEYDOWN = 260;
|
||
if (msg.Msg == WM_KEYDOWN | msg.Msg == WM_SYSKEYDOWN)
|
||
{
|
||
switch (keyData)
|
||
{
|
||
case Keys.Escape:
|
||
timer1.Stop();
|
||
timer1.Dispose();
|
||
timer1.Enabled = false;
|
||
this.Close();//esc关闭窗体
|
||
break;
|
||
}
|
||
}
|
||
return false;
|
||
}
|
||
private string body = "";
|
||
public frmCommonLargeScreen()
|
||
{
|
||
InitializeComponent();
|
||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
|
||
}
|
||
|
||
private void frmCommonLargeScreen_Load(object sender, EventArgs e)
|
||
{
|
||
//设置显示信息的开始和结束时间
|
||
setViewTeim();
|
||
//启动时钟
|
||
setButton(false);
|
||
|
||
#region 加载配置文件
|
||
|
||
try
|
||
{
|
||
//OpeTime = "5";
|
||
//fontFamily = xmlOpe.GetNode(0, path, "fontFamily");
|
||
//PageSum = int.Parse(xmlOpe.GetNode(0, path, "pageSum").ToString());
|
||
//fontSize = xmlOpe.GetNode(0, path, "fontSize");
|
||
//bodyBgColor = xmlOpe.GetNode(0, path, "bodyBgColor");
|
||
//titleBgColor = xmlOpe.GetNode(0, path, "titleBgColor");
|
||
//titleColBgColor = xmlOpe.GetNode(0, path, "titleColBgColor");
|
||
//bottomBgColor = xmlOpe.GetNode(0, path, "bottomBgColor");
|
||
//rowOddBgColor = xmlOpe.GetNode(0, path, "rowOddBgColor");
|
||
//rowEvenBgColor = xmlOpe.GetNode(0, path, "rowEvenBgColor");
|
||
//opeBeforColor = xmlOpe.GetNode(0, path, "opeBeforColor");
|
||
//opeInColor = xmlOpe.GetNode(0, path, "opeInColor");
|
||
//opeAfterColor = xmlOpe.GetNode(0, path, "opeAfterColor");
|
||
//defaultColor = xmlOpe.GetNode(0, path, "defaultColor");
|
||
//PatientNames = xmlOpe.GetNode(0, path, "PatientName");
|
||
}
|
||
catch (Exception )
|
||
{
|
||
MessageBox.Show("加载配置文件失败,使用默认配置");
|
||
}
|
||
|
||
#endregion
|
||
|
||
GetPageSum();
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获取通知档的内容
|
||
/// </summary>
|
||
private void GetT_Inform()
|
||
{
|
||
string messige = "";// PublicMethod.getMessige();
|
||
if (messige.Trim() == "") return;
|
||
body += "<script language='javascript'> setInterval(someFunction, 20000);function someFunction() {window.location.reload();}</script>";
|
||
body += " <div style='position: absolute;top: 50%;left: 50%;width: 1000px;height: 50px;margin-top: -25px; margin-left:-500px; background-color:#000;font: bold 48px/50px Verdana, Geneva, sans-serif; '>";
|
||
body += "<marquee direction='left' scrollamount='12' style='font: 48px/50px Verdana, Geneva, sans-serif; color:#d808d6'>";
|
||
body += messige + " </marquee></div></body>";
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获取每页显示的内容
|
||
/// </summary>
|
||
private void GetPageSum()
|
||
{
|
||
try
|
||
{
|
||
dts =new DataTable (); //PublicMethod.GetPlanNoticeNew(dtpBeginDate, dtpEndDate, OpeTime == "" ? "5" : OpeTime);
|
||
//总记录数
|
||
dSum = dts.Rows.Count;
|
||
countPage = GetPageCount();
|
||
currentPage = 1;
|
||
|
||
//首先判断数据库中的记录数是否大于每一屏显示的数 chengxg@yahoo.cn;
|
||
|
||
LoadWaitNurseOpe(currentPage);
|
||
|
||
}
|
||
catch (Exception )
|
||
{
|
||
//MessageBox.Show("加载大屏公告信息失败");
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 加载所有手术状态为“术前、术中、”的申请信息
|
||
/// </summary>
|
||
/// <param name="m"></param>
|
||
/// <param name="n"></param>
|
||
private void LoadWaitNurseOpe(int curPage)
|
||
{
|
||
|
||
//每次去查询时,要更新一下记录总数,RecondSum,每一页显示的记录数为,PageSum ,
|
||
body = "";
|
||
///创建表
|
||
createTable();
|
||
//创建表头
|
||
insertTitle();
|
||
///创建列名
|
||
string[] colsName = { "科室", "姓名", "手术间", "手术时间", "状态" };
|
||
string[] colsWidth = { "20%", "20%", "15%", "20%", "25%" };
|
||
insertCols(colsName, colsWidth);
|
||
|
||
curPage -= 1;
|
||
startRecond = curPage * PageSum;
|
||
endRecond = startRecond + PageSum;
|
||
try
|
||
{
|
||
//状态vchrOpeStatus 手术间vchrOperatingRoomName 时间BeginTime 姓名vchrPatientName
|
||
//手术名称vchrOperationName术者 麻醉者 器械 巡回
|
||
string tdRows = "";
|
||
for (int i = startRecond; i < endRecond; i++)
|
||
{
|
||
string tdRow = "<tr>";
|
||
if (i >= dSum)
|
||
{
|
||
tdRow += "<td colspan='9'> </td>";
|
||
}
|
||
else
|
||
{
|
||
string intApplyID = dts.Rows[i]["OperationApplyId"].ToString();
|
||
string vchrOpeStatus = "";// PublicMethod.GetOpeStatus(dts.Rows[i]);
|
||
if (vchrOpeStatus == "") continue;
|
||
string OperationRoom = dts.Rows[i]["SqOperationRoom"].ToString();// dts.Rows[i]["SZOperationRoom"].ToString() == "" ? dts.Rows[i]["SqOperationRoom"].ToString() : dts.Rows[i]["SZOperationRoom"].ToString();
|
||
string vchrFactBeginTime = "";
|
||
#region 内容的着色设置
|
||
|
||
string rowStyle = "";
|
||
if (i % 2 == 0)
|
||
{
|
||
rowStyle = "bgcolor='" + rowEvenBgColor + "' align=left valie=middle style='border-bottom:1px solid #629069;font-size:" + fontSize + ";font-weight:bold; vertical-align: middle;font-family:\"" + fontFamily + "\"; ";
|
||
}
|
||
else
|
||
{
|
||
rowStyle = "bgcolor='" + rowOddBgColor + "' align=left valie=middle style='border-bottom:1px solid #629069;font-size:" + fontSize + ";font-weight:bold; vertical-align: middle;font-family:\"" + fontFamily + "\"; ";
|
||
}
|
||
switch (vchrOpeStatus)
|
||
{
|
||
case "等待手术":
|
||
rowStyle += " color:" + defaultColor + ";'";
|
||
break;
|
||
case "术前准备":
|
||
rowStyle += " color:" + opeBeforColor + ";'"; //2
|
||
break;
|
||
case "手术进行中":
|
||
rowStyle += " color:" + opeInColor + ";'"; //3
|
||
break;
|
||
case "术后恢复":
|
||
rowStyle += " color:" + opeAfterColor + ";'"; //4
|
||
break;
|
||
case "转入复苏室":
|
||
OperationRoom = dts.Rows[i]["PACUBed"].ToString();
|
||
rowStyle += " color:" + opeInColor1 + ";'"; //6
|
||
break;
|
||
case "离开手术室":
|
||
rowStyle += " color:" + opeAfterColor1 + ";'"; //57
|
||
break;
|
||
case "离开恢复室":
|
||
OperationRoom = dts.Rows[i]["PACUBed"].ToString();
|
||
rowStyle += " color:" + opeAfterColor1 + ";'"; //57
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
|
||
#endregion
|
||
|
||
vchrFactBeginTime = dts.Rows[i]["OperationBeginTime"].ToString();// == "" ? dts.Rows[i]["OrderOperationTime"].ToString() : dts.Rows[i]["InRoomTime"].ToString();
|
||
if (vchrFactBeginTime.Trim().ToString() != "")
|
||
{
|
||
vchrFactBeginTime = Convert.ToDateTime(vchrFactBeginTime).ToString("HH:mm");
|
||
}
|
||
else vchrFactBeginTime = "- -";
|
||
tdRow += "<td align='center' " + rowStyle + ">" + dts.Rows[i]["DepartmentName"] + "</td>";
|
||
string PatientName = "";
|
||
if (PatientNames == "")
|
||
{
|
||
PatientName = dts.Rows[i]["PatientName"].ToString();
|
||
}
|
||
else
|
||
{
|
||
string name = dts.Rows[i]["PatientName"].ToString().Length < 2 ? "" : dts.Rows[i]["PatientName"].ToString().Substring(2);
|
||
PatientName = dts.Rows[i]["PatientName"].ToString().Substring(0, 1) + PatientNames + name;
|
||
}
|
||
tdRow += "<td align='center' " + rowStyle + "> " + PatientName + "</td>";
|
||
tdRow += "<td align='center' " + rowStyle + "> " + OperationRoom + "</td>";
|
||
tdRow += "<td align='center' " + rowStyle + "> " + vchrFactBeginTime + " </td>";
|
||
tdRow += "<td align='center' " + rowStyle + ">" + vchrOpeStatus + "</td>";
|
||
}
|
||
tdRow += "</tr>";
|
||
tdRows += tdRow;
|
||
}
|
||
viewRemark();
|
||
body = tdRows == "" ? body : body.Replace("{rows}", tdRows);
|
||
//插入底部
|
||
insertBottom();
|
||
webBrowser1.DocumentText = body;
|
||
}
|
||
catch (Exception )
|
||
{
|
||
}
|
||
}
|
||
|
||
#region 创建大屏公告列表
|
||
|
||
private void createTable()
|
||
{
|
||
|
||
body = "<body style='margin:0;' bgcolor='" + bodyBgColor + "'>";
|
||
body += "<table border=0 width='100%' height='100%' cellpadding=0 cellspacing=0>";
|
||
body += "{title}";
|
||
body += "{columens}";
|
||
body += "{rows}";
|
||
body += "</table></body>";
|
||
|
||
}
|
||
|
||
|
||
/// <summary>
|
||
/// 插入表头
|
||
/// </summary>
|
||
private void insertTitle()
|
||
{
|
||
string titleStr = "";
|
||
titleStr += "<tr style='background:black;color:white;margin-bottom:6px;font-size:40px;font-weight:bold;font-family:\"" + fontFamily + "\";'>";
|
||
titleStr += "<td colspan='10' align='center' valign='middle' height='10%' style='padding:6px;'>";
|
||
titleStr += "<DIV style='left:10px; top: 22px; position: absolute;color:" + titleBgColor + ";font-size:" + fontSize + ";'>";
|
||
titleStr += "</DIV>患者家属等候区<DIV style='left: 10px; top: 22px; position: absolute;color:" + titleBgColor + ";font-size:" + fontSize + ";'>" +DateTime.Now.ToString("yyyy-MM-dd HH:mm") + "</DIV><div style='right: 10px; top: 22px; position: absolute;color:" + titleBgColor + ";font-size:" + fontSize + ";'>(第" + currentPage + "屏/共" + countPage + "屏)</div> </TD></tr>";
|
||
body = body.Replace("{title}", titleStr);
|
||
}
|
||
|
||
|
||
/// <summary>
|
||
/// 显示备注
|
||
/// </summary>
|
||
private void viewRemark()
|
||
{
|
||
GetT_Inform();
|
||
}
|
||
|
||
private void insertCols(string[] colNames, string[] colWidths)
|
||
{
|
||
string colString = "";
|
||
string colContent = "";
|
||
colString += "<tr style='background:" + titleColBgColor + ";color:white;margin-bottom:6px;font-size:" +
|
||
fontSize + ";font-weight:bold;font-family:\"" + fontFamily + "\";'>{td}</tr>";
|
||
for (int i = 0; i < colNames.Length; i++)
|
||
{
|
||
colContent += "<td width = '" + colWidths[i] +
|
||
"%' align='center' valign='middle' height='5%' style='padding:6px;'>" + colNames[i] +
|
||
"</td>";
|
||
}
|
||
colString = colString.Replace("{td}", colContent);
|
||
body = body.Replace("{columens}", colString);
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region //计算总页数
|
||
|
||
public int GetPageCount()
|
||
{
|
||
if (PageSum == 0)
|
||
PageSum = 10; //每页显示的记录条数为"0",则默认为"20"
|
||
if (dSum % PageSum == 0)
|
||
return (dSum / PageSum);
|
||
else
|
||
return (dSum / PageSum) + 1;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 插入表底部
|
||
/// </summary>
|
||
private void insertBottom()
|
||
{
|
||
string bottomStr = "";
|
||
bottomStr += "<tr>";
|
||
bottomStr += "<td colspan='10' align='center' valign='middle' id='bottom1'></td>";
|
||
bottomStr += "</tr>";
|
||
body = body.Replace("{Bootom}", bottomStr);
|
||
}
|
||
|
||
#endregion
|
||
|
||
private void timer1_Tick(object sender, EventArgs e)
|
||
{
|
||
//下一页
|
||
button2_Click(null, null);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 下一页
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
private void button2_Click(object sender, EventArgs e)
|
||
{
|
||
if (currentPage >= countPage)
|
||
{
|
||
setViewTeim();
|
||
GetPageSum();
|
||
}
|
||
else
|
||
{
|
||
currentPage += 1;
|
||
LoadWaitNurseOpe(currentPage);
|
||
}
|
||
}
|
||
|
||
|
||
private void frmOpeRoomPlanNotice_Resize(object sender, EventArgs e)
|
||
{
|
||
//内容的控件的高度
|
||
webBrowser1.Height = this.ClientRectangle.Height;
|
||
}
|
||
|
||
private void setButton(bool b)
|
||
{
|
||
if (b)
|
||
{
|
||
timer1.Stop();
|
||
}
|
||
else
|
||
{
|
||
timer1.Start();
|
||
}
|
||
}
|
||
|
||
private void frmOpeRoomPlanNotice_FormClosing(object sender, FormClosingEventArgs e)
|
||
{
|
||
setButton(true);
|
||
}
|
||
|
||
private void setViewTeim()
|
||
{
|
||
|
||
dtpBeginDate = DateTime.Now.Date.AddSeconds(1);
|
||
dtpEndDate = DateTime.Now.Date.AddHours(23).AddMinutes(59).AddSeconds(59);
|
||
}
|
||
}
|
||
}
|