private Dictionary <string, string> GetMsgNoticInfo() { Dictionary <string, string> msg_dict = new Dictionary <string, string>(); try { QueryParams queryParams = new QueryParams(); queryParams.AddQueryDefines("OperDept", ExtendAppContext.Current.OperDeptCode); queryParams.AddQueryDefines("Type", 2); DataTable NoticMsgTable = DataOperator.HttpWebApi <DataResult>(ApiUrlEnum.GetNoticeMsgData, queryParams).ToDataTable(); if (NoticMsgTable.Rows.Count > 0) { foreach (DataRow dr in NoticMsgTable.Rows) { if (!msg_dict.ContainsKey(dr["ID"].ToString())) { msg_dict.Add(dr["ID"].ToString(), dr["MSG"].ToString() + "," + dr["COUNTS"].ToString()); } } } } catch (Exception ex) { ExceptionHandler.Handle(ex); } return(msg_dict); }
/// <summary> /// 初始化加载大屏控件 /// </summary> private void InitialScreenControl() { XtraUserControl userCtr = null; try { //if (ExtendAppContext.Current.ShowScreenNo > 1) { this.Left = System.Windows.Forms.Screen.AllScreens[ExtendAppContext.Current.ScreenIndex].Bounds.Left; this.Top = System.Windows.Forms.Screen.AllScreens[ExtendAppContext.Current.ScreenIndex].Bounds.Top; } QueryParams queryParams = new QueryParams(); queryParams.AddQueryDefines("ScreenNo", OperationEnum.Equal, ExtendAppContext.Current.CurntScreenNo); DataTable screenDictData = DataOperator.HttpWebApi <DataResult>(ApiUrlEnum.GetScreenDict, queryParams).ToDataTable(); if (screenDictData != null && screenDictData.Rows.Count > 0) { string typeName = screenDictData.Rows[0]["SCREEN_TYPE"].ToString(); ExtendAppContext.Current.ScreenLabel = screenDictData.Rows[0]["SCREEN_LABEL"].ToString(); bool isFullScreen = screenDictData.Rows[0]["FULL_SCREEN"].ToString() == "1"; int width = int.Parse(screenDictData.Rows[0]["SCREEN_WIDTH"].ToString()); int height = int.Parse(screenDictData.Rows[0]["SCREEN_HEIGHT"].ToString()); if (isFullScreen) { this.WindowState = FormWindowState.Maximized; } else { this.Width = width; this.Height = height; } ExtendAppContext.Current.CurntScreentType = ScreenTypeHelper.GetScreenTypeByName(typeName); TransMessageManager.Instance.OpenConnection(); } else { //new frmMessageBox().Show("未获取到当前大屏的配置信息,请完成大屏配置后重新登录。", "大屏提示", MessageBoxButtons.OK, MessageBoxIcon.Information, 0); AutoClosedMsgBox.Show("未获取到当前大屏的配置信息,请完成大屏配置后重新登录。", "大屏提示", 0, MessageBoxButtons.OK, MessageBoxIcon.Information); Environment.Exit(0); } } catch (Exception ex) { ExceptionHandler.Handle(ex); } switch (ExtendAppContext.Current.CurntScreentType) { case ScreenType.OperScheduleScreen: userCtr = new OperScheduleScreen(); (userCtr as OperScheduleScreen).parentDoubleClick += new EventHandler(MainScreenFrm_DoubleClick); break; case ScreenType.FamilyWaitScreen: userCtr = new FamilyWaitScreen(); (userCtr as FamilyWaitScreen).parentDoubleClick += new EventHandler(MainScreenFrm_DoubleClick); break; } userCtr.Parent = this; userCtr.Dock = DockStyle.Fill; }
private int UpdateMsgDataTable(string id, int count) { int ret = -1; try { QueryParams queryParams = new QueryParams(); queryParams.AddQueryDefines("ID", id); queryParams.AddQueryDefines("COUNTS", count); ret = DataOperator.HttpWebApi <int>(ApiUrlEnum.UpdateNoticeMsgData, queryParams); } catch (Exception ex) { ExceptionHandler.Handle(ex); } return(ret); }
/// <summary> /// 获取接台列字典 /// </summary> /// <param name="areaWidth"></param> /// <returns></returns> public static Dictionary <string, double> GetSeqColumnList(double areaWidth) { Dictionary <string, double> colsWidthDict = new Dictionary <string, double>(); try { QueryParams queryParams = new QueryParams(); queryParams.AddQueryDefines("ScreenNo", ExtendAppContext.Current.CurntScreenNo); //获取显示字段的数据 ExtendAppContext.Current.FieldData = DataOperator.HttpWebApi <DataResult>(ApiUrlEnum.GetScreenFieldsData, queryParams).ToDataTable(); ExtendAppContext.Current.FieldData.DefaultView.RowFilter = "SEQ_SHOW = 1"; ExtendAppContext.Current.SeqFieldData = ExtendAppContext.Current.FieldData.DefaultView.ToTable(); int TotalPercent = 0; double dev = 0; foreach (DataRow dr in ExtendAppContext.Current.SeqFieldData.Rows) { if (!colsWidthDict.ContainsKey(dr["CAPTION"].ToString())) { colsWidthDict.Add(dr["CAPTION"].ToString(), int.Parse(dr["COL_PERCENT"].ToString())); TotalPercent += int.Parse(dr["COL_PERCENT"].ToString()); } } if (TotalPercent != 100 && TotalPercent != 0) { dev = (double)TotalPercent / 100; } double accutPercent = 0; colsWidthDict = new Dictionary <string, double>(); for (int i = 0; i < ExtendAppContext.Current.SeqFieldData.Rows.Count; i++) { DataRow row = ExtendAppContext.Current.SeqFieldData.Rows[i]; double curntPercent = 0; if (!colsWidthDict.ContainsKey(row["CAPTION"].ToString())) { if (i == ExtendAppContext.Current.SeqFieldData.Rows.Count - 1) { curntPercent = double.Parse((100 - accutPercent).ToString()); } else { curntPercent = double.Parse(row["COL_PERCENT"].ToString()) / dev; } colsWidthDict.Add(row["CAPTION"].ToString(), curntPercent / 100 * areaWidth); accutPercent += curntPercent; } } } catch (Exception ex) { ExceptionHandler.Handle(ex); } return(colsWidthDict); }
/// <summary> /// 获取分页信息 /// </summary> private void GetPageInfo() { try { QueryParams queryParams = new QueryParams(); queryParams.AddQueryDefines("OperDept", ExtendAppContext.Current.OperDeptCode); string roomFilter = ""; if (!ExtendAppContext.Current.OperRoomFilter.Equals("*")) { string[] rooms = ExtendAppContext.Current.OperRoomFilter.Split(','); roomFilter = "("; foreach (string room in rooms) { roomFilter += "'" + room + "'" + ","; } roomFilter = roomFilter.TrimEnd(','); roomFilter += ")"; } //获取大屏常规视图中的数据 viewOperList = DataOperator.HttpWebApi <DataResult>(ApiUrlEnum.GetScreenViewNormal, queryParams).ToDataTable(); if (!string.IsNullOrEmpty(roomFilter)) { viewOperList.DefaultView.RowFilter = "OPERATING_ROOM_NO IN " + roomFilter; viewOperList = viewOperList.DefaultView.ToTable(); } if (ExtendAppContext.Current.IsPrivate) { foreach (DataRow dr in viewOperList.Rows) { if (!dr.IsNull("NAME") && !string.IsNullOrEmpty(dr["NAME"].ToString())) { string PatName = dr["NAME"].ToString(); dr["NAME"] = PatName.Substring(0, 1) + "*" + PatName.Substring(PatName.Length - 1, 1); } } } int dataRows = viewOperList.Rows.Count; int temp = dataRows / ExtendAppContext.Current.RowCount; if (temp * ExtendAppContext.Current.RowCount < dataRows) { temp += 1; } TotalPage = temp == 0 ? 1 : temp; CurntPageIndex = 0; } catch (Exception ex) { ExceptionHandler.Handle(ex); } }
private void InitialScreenConfig() { try { QueryParams queryParams = new QueryParams(); queryParams.AddQueryDefines("ScreenNo", OperationEnum.Equal, ExtendAppContext.Current.CurntScreenNo); DataTable screenConfigDT = DataOperator.HttpWebApi <DataResult>(ApiUrlEnum.GetScreenConfig, queryParams).ToDataTable(); if (screenConfigDT.Rows.Count == 0) { //new frmMessageBox().Show("未获取到当前大屏的配置信息,请完成大屏配置后重新登录。", "大屏提示", MessageBoxButtons.OK, MessageBoxIcon.Information, 0); AutoClosedMsgBox.Show("未获取到当前大屏的配置信息,请完成大屏配置后重新登录。", "大屏提示", 0, MessageBoxButtons.OK, MessageBoxIcon.Information); Environment.Exit(0); } else { DataRow dr = screenConfigDT.Rows[0]; ExtendAppContext.Current.OperDeptCode = dr["OPER_DEPT_CODE"].ToString(); ExtendAppContext.Current.OperRoomFilter = dr["OPERROOM_FILTER"].ToString(); ExtendAppContext.Current.RefreshTime = int.Parse(dr["REFRESH_TIME"].ToString()); ExtendAppContext.Current.RowCount = int.Parse(dr["ROW_COUNT"].ToString()); ExtendAppContext.Current.IsBroadCast = int.Parse(dr["VOICE_BROADCAST"].ToString()) == 1; ExtendAppContext.Current.SeqMode = dr["SHOW_MODE"].ToString().Equals("Sequence"); ExtendAppContext.Current.MarkSpec = int.Parse(dr["MARK_SPEC"].ToString()) == 1; ExtendAppContext.Current.IsTV = int.Parse(dr["SHOW_TV"].ToString()) == 1; ExtendAppContext.Current.IsPrivate = int.Parse(dr["PROTECT_PRIVATE"].ToString()) == 1; ExtendAppContext.Current.SkinName = dr["SKIN"].ToString(); //获取静态播报信息列表 DataTable staticMsgTable = DataOperator.HttpWebApi <DataResult>(ApiUrlEnum.GetValidMsgData, queryParams).ToDataTable(); List <string> staticListMsg = new List <string>(); if (staticMsgTable != null && staticMsgTable.Rows.Count > 0) { foreach (DataRow row in staticMsgTable.Rows) { if (!row.IsNull("MSG_CONTENT") && !string.IsNullOrEmpty(row["MSG_CONTENT"].ToString())) { staticListMsg.Add(row["MSG_CONTENT"].ToString()); } } ExtendAppContext.Current.StaticMsgList = staticListMsg; } } } catch (Exception ex) { ExceptionHandler.Handle(ex); } }
/// <summary> /// 获取列字典,包含列名和宽度 /// 每次登录只需要加载一次 /// </summary> /// <returns></returns> public static Dictionary <string, double> GetNormalColumnList(double areaWidth) { Dictionary <string, double> colsWidthDict = new Dictionary <string, double>(); try { QueryParams queryParams = new QueryParams(); queryParams.AddQueryDefines("ScreenNo", ExtendAppContext.Current.CurntScreenNo); //获取显示字段的数据 ExtendAppContext.Current.FieldData = DataOperator.HttpWebApi <DataResult>(ApiUrlEnum.GetScreenFieldsData, queryParams).ToDataTable(); foreach (DataRow dr in ExtendAppContext.Current.FieldData.Rows) { if (!colsWidthDict.ContainsKey(dr["CAPTION"].ToString())) { colsWidthDict.Add(dr["CAPTION"].ToString(), double.Parse(dr["COL_PERCENT"].ToString()) / 100 * areaWidth); } } } catch (Exception ex) { ExceptionHandler.Handle(ex); } return(colsWidthDict); }
private void msgTimer_Tick(object sender, EventArgs e) { try { //显示的字数长度 int length = (int)((msgStartX - msgCurntX) / (msgStep * 4)); if (ExtendAppContext.Current.StaticMsgList == null) { ExtendAppContext.Current.StaticMsgList = new List <string>(); ExtendAppContext.Current.StaticMsgList.Add("暂无公告信息。"); } string msg = ""; //非紧急公告,即静态公告 if (!isEmgrcMsg) { if (msgIndex == ExtendAppContext.Current.StaticMsgList.Count) { msgIndex = 0; msgCurntX = msgStartX; } msg = ExtendAppContext.Current.StaticMsgList[msgIndex]; //修正起始位置偏移的问题 while ((length <= msg.Length) && (this.CreateGraphics().MeasureString(msg.Substring(0, length), MsgFont).Width < (msgStartX - msgCurntX))) { length++; } if (length > ExtendAppContext.Current.StaticMsgList[msgIndex].Length) { length = ExtendAppContext.Current.StaticMsgList[msgIndex].Length; } //截取需要显示的字符串 curntMsg = ExtendAppContext.Current.StaticMsgList[msgIndex].Substring(0, length); } else { //修正起始位置偏移的问题 while ((length <= noticeMsg.Length) && (this.CreateGraphics().MeasureString(noticeMsg.Substring(0, length), MsgFont).Width < (msgStartX - msgCurntX))) { length++; } if (length > noticeMsg.Length) { length = noticeMsg.Length; } //截取需要显示的字符串 curntMsg = noticeMsg.Substring(0, length); } //计算需要显示的字符长度 int msgLength = (int)this.CreateGraphics().MeasureString(curntMsg, MsgFont).Width; if (msgCurntX + msgLength > 0) { screenBottomPnl.Refresh(); msgCurntX -= msgStep; } //转完一圈,重新获取公告信息 if (msgCurntX + msgLength <= 0) { //msgTimer.Stop(); if (!isEmgrcMsg) { //重新获取静态播报信息列表 QueryParams queryParams = new QueryParams(); queryParams.AddQueryDefines("ScreenNo", OperationEnum.Equal, ExtendAppContext.Current.CurntScreenNo); DataTable staticMsgTable = DataOperator.HttpWebApi <DataResult>(ApiUrlEnum.GetValidMsgData, queryParams).ToDataTable(); List <string> staticListMsg = new List <string>(); if (staticMsgTable != null && staticMsgTable.Rows.Count > 0) { foreach (DataRow row in staticMsgTable.Rows) { if (!row.IsNull("MSG_CONTENT") && !string.IsNullOrEmpty(row["MSG_CONTENT"].ToString())) { staticListMsg.Add(row["MSG_CONTENT"].ToString()); } } ExtendAppContext.Current.StaticMsgList = staticListMsg; } msgIndex++; } // Dictionary<string, string> noticeMsgDict = GetMsgNoticInfo(); if (noticeMsgDict != null && noticeMsgDict.Count > 0 && ExtendAppContext.Current.IsBroadCast) { isEmgrcMsg = true; foreach (KeyValuePair <string, string> kvp in noticeMsgDict) { string[] Info_Count = kvp.Value.Split(',');//通告信息,播报次数 string msgID = kvp.Key; noticeMsg = Info_Count[0]; int count = Convert.ToInt32(Info_Count[1]); SpFlags = DotNetSpeech.SpeechVoiceSpeakFlags.SVSFlagsAsync; Voice = new SpVoice(); Voice.Rate = -4; Voice.Speak(noticeMsg, SpFlags); //Voice.WaitUntilDone(System.Threading.Timeout.Infinite); //可播报次数-1 count -= 1; //更新剩余可播报次数 UpdateMsgDataTable(msgID, count); if (count == 0) { noticeMsgDict.Remove(msgID); } else { noticeMsgDict[msgID] = noticeMsg + "," + count; } break;//一次只播一条 } } else { isEmgrcMsg = false; } msgCurntX = msgStartX; //msgTimer.Start(); } } catch (Exception ex) { ExceptionHandler.Handle(ex); } }
/// <summary> /// 获取分页信息 /// </summary> private void GetPageInfo() { try { QueryParams queryParams = new QueryParams(); queryParams.AddQueryDefines("OperDept", ExtendAppContext.Current.OperDeptCode); string roomFilter = ""; if (!ExtendAppContext.Current.OperRoomFilter.Equals("*")) { string[] rooms = ExtendAppContext.Current.OperRoomFilter.Split(','); roomFilter = "("; foreach (string room in rooms) { roomFilter += "'" + room + "'" + ","; } roomFilter = roomFilter.TrimEnd(','); roomFilter += ")"; } //获取大屏常规视图中的数据 viewOperList = DataOperator.HttpWebApi <DataResult>(ApiUrlEnum.GetScreenViewNormal, queryParams).ToDataTable(); if (!ExtendAppContext.Current.SeqMode) { if (!string.IsNullOrEmpty(roomFilter)) { viewOperList.DefaultView.RowFilter = "OPERATING_ROOM_NO IN " + roomFilter; viewOperList = viewOperList.DefaultView.ToTable(); } int dataRows = viewOperList.Rows.Count; int temp = dataRows / ExtendAppContext.Current.RowCount; if (temp * ExtendAppContext.Current.RowCount < dataRows) { temp += 1; } TotalPage = temp == 0 ? 1 : temp; CurntPageIndex = 0; } else { //获取手术间字典表数据 operRoomDictDT = DataOperator.HttpWebApi <DataResult>(ApiUrlEnum.GetOperRoomDict, queryParams).ToDataTable(); if (!string.IsNullOrEmpty(roomFilter)) { operRoomDictDT.DefaultView.RowFilter = "ROOM_NO IN " + roomFilter; operRoomDictDT = operRoomDictDT.DefaultView.ToTable(); } int dataRows = operRoomDictDT.Rows.Count; int temp = dataRows / ExtendAppContext.Current.RowCount; if (temp * ExtendAppContext.Current.RowCount < dataRows) { temp += 1; } TotalPage = temp; CurntPageIndex = 0; } //获取已完成和未完成的手术例数统计 DataTable todayOperData = DataOperator.HttpWebApi <DataResult>(ApiUrlEnum.GetTodayInfo, queryParams).ToDataTable(); DataRow[] rows = todayOperData.Select(" OPER_STATUS_CODE >= 35 "); finishStr = "已完成{0}台"; totalStr = "共{0}台"; finishStr = string.Format(finishStr, rows.Length.ToString()); totalStr = string.Format(totalStr, todayOperData.Rows.Count.ToString()); normalPnlTop.Refresh(); } catch (Exception ex) { ExceptionHandler.Handle(ex); } }