using Newtonsoft.Json; using AIMSExtension; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows.Forms; namespace DrawGraph { public class RemarkManage : AreaManageBase { public RectangleFramePackObj remarkPpack; public RectangleFramePackObj OutputManagePpack; public LinePackObj H3pack; public LinePackObj H4pack; public LinePackObj H5pack; public LinePackObj H6pack; /// /// 当前手术对象 /// private OperationRecord myOpeRecord = null; #region 初始化备注区域 public RemarkManage() { } public RemarkManage(object _operationRecor, ZedGraphControl _zedControl, TemplateManage _template, string _name) : base(_operationRecor, _zedControl, _template, _name) { init(); } public void init() { //自己要用的手术对象 myOpeRecord = OpeRecord as OperationRecord; } /// /// 初始画的后置方法 /// public override void FollowUpMethod() { H3pack = template.GetPackObjectOTag("RemarkManage_LinePackObj_4"); H4pack = template.GetPackObjectOTag("RemarkManage_LinePackObj_5"); H5pack = template.GetPackObjectOTag("RemarkManage_LinePackObj_8"); H6pack = template.GetPackObjectOTag("RemarkManage_LinePackObj_9"); remarkPpack = template.GetPackObjectOTag("RemarkManage_RectangleFramePackObj_2"); OutputManagePpack = template.GetPackObjectOTag("OutputManage_RectangleFramePackObj_10"); } #endregion #region 重写的事件 /// /// 鼠标点击画板 /// /// /// public override void MouseDown(ZedGraphControl sender, MouseEventArgs e) { //if (e.Button == System.Windows.Forms.MouseButtons.Left) //{ // MessageBox.Show(this.GetType().Name + "is Click Left Button"); //} } public override void MouseMove(ZedGraphControl sender, MouseEventArgs e) { } public override void MouseUp(ZedGraphControl sender, MouseEventArgs e) { } public override void MouseDoubleClick(ZedGraphControl sender, MouseEventArgs e) { } public override void KeyUp(ZedGraphControl sender, KeyEventArgs e) { } #endregion 重写的事件结束 public override void Bind() { init(); DrawRemarkDate(); } #region 画备注内容 /// /// 画备注内容 /// public void DrawRemarkDate() { List PunctureAndIntubatio = new List(); string punStr = ""; int remarkRowscount = 12; remarkRowscount = Convert.ToInt32((remarkPpack.RealEndY - remarkPpack.RealY) / 0.0125) + 1; if (H3pack == null) return; double x = H3pack.RealX; int remarkRow = 0; int AllRemarkRow = 0; float fontsize = 6.3f; int fontlength = 40; try { myOpeRecord.ClearEventstr(ZedControl); try { //计算备注行数 if (myOpeRecord.EventListstr != null || myOpeRecord.DrugsListstr != null) { int count = 0; if (myOpeRecord.EventListstr != null && myOpeRecord.EventListstr.Count > 0) count = count + myOpeRecord.EventListstr.Count + 1; if (myOpeRecord.OpeRecordInfo != null && OutputManagePpack == null)//&& pageCount == 1 { if (myOpeRecord.OpeRecordInfo.PunctureSite != null || myOpeRecord.OpeRecordInfo.NeedleNumber != null || myOpeRecord.OpeRecordInfo.NeedleDirection != null || myOpeRecord.OpeRecordInfo.PuncturePosition != null || myOpeRecord.OpeRecordInfo.ConduitDepth != null) count = count + 3; //神经阻滞 if (myOpeRecord.OpeRecordInfo.NeuroPlexusAround != null || myOpeRecord.OpeRecordInfo.BrachialPlexus != null) count = count + 3; if (myOpeRecord.OpeRecordInfo.VenipunctureDeep != null || myOpeRecord.OpeRecordInfo.VenipunctureCenter != null) count = count + 3; if (myOpeRecord.OpeRecordInfo.AnesthesiaPlane != null || myOpeRecord.OpeRecordInfo.AnesthesiaEffect != null || myOpeRecord.OpeRecordInfo.SpecialSituation != null) count = count + 1; } if (myOpeRecord.DrugsListstr != null && myOpeRecord.DrugsListstr.Count > 0) count = count + myOpeRecord.DrugsListstr.Count + 2; count = count + 2; if (count >= (remarkRowscount * 3)) { remarkRowscount = count / 3 + 1; } if (remarkRowscount >= 13) { fontsize = fontsize - 0.5f; fontlength = 49; } if (remarkRowscount >= 14) { fontsize = fontsize - 0.55f; fontlength = 52; } if (remarkRowscount >= 15) { fontsize = fontsize - 0.6f; fontlength = 54; } if (remarkRowscount >= 16) { fontsize = fontsize - 0.75f; fontlength = 57; } if (remarkRowscount >= 19) { fontsize = fontsize - 0.8f; fontlength = 66; } } } catch (Exception ex) { PublicMethod.WriteLog(ex); } //事件备注 SetRemarkInfo(myOpeRecord.EventListstr, remarkRowscount, ref x, ref remarkRow, ref AllRemarkRow, fontsize, ref fontlength); //用药备注 SetRemarkInfo(myOpeRecord.DrugsListstr, remarkRowscount, ref x, ref remarkRow, ref AllRemarkRow, fontsize, ref fontlength); //液体备注 SetRemarkInfo(myOpeRecord.SapsListstr, remarkRowscount, ref x, ref remarkRow, ref AllRemarkRow, fontsize, ref fontlength); //出量备注 SetRemarkInfo(myOpeRecord.OutsListstr, remarkRowscount, ref x, ref remarkRow, ref AllRemarkRow, fontsize, ref fontlength); //术后镇痛药备注 if (myOpeRecord.currentPage == myOpeRecord.pageCount) SetRemarkInfo(myOpeRecord.AfterDrugsListstr, remarkRowscount, ref x, ref remarkRow, ref AllRemarkRow, fontsize, ref fontlength); //手术信息备注 if (myOpeRecord.OpeRecordInfo != null && OutputManagePpack == null) { //穿刺点1 if (myOpeRecord.OpeRecordInfo.PunctureSite != null || myOpeRecord.OpeRecordInfo.NeedleNumber != null || myOpeRecord.OpeRecordInfo.NeedleDirection != null || myOpeRecord.OpeRecordInfo.PuncturePosition != null || myOpeRecord.OpeRecordInfo.ConduitDepth != null) { PunctureAndIntubatio = new List(); PunctureAndIntubatio.Add("【穿刺点1】"); punStr = ""; if (myOpeRecord.OpeRecordInfo.PunctureSite != "") punStr += " 穿刺部位:" + myOpeRecord.OpeRecordInfo.PunctureSite; if (myOpeRecord.OpeRecordInfo.NeedleNumber != "") punStr += " 针号:" + myOpeRecord.OpeRecordInfo.NeedleNumber; if (myOpeRecord.OpeRecordInfo.NeedleDirection != "") punStr += " 针向:" + myOpeRecord.OpeRecordInfo.NeedleDirection; if (punStr.Trim() != "") PunctureAndIntubatio.Add(punStr); if (myOpeRecord.OpeRecordInfo.PuncturePosition != "") punStr = " 穿刺体位:" + myOpeRecord.OpeRecordInfo.PuncturePosition; if (myOpeRecord.OpeRecordInfo.ConduitDepth != "") punStr += " 导管进入:" + myOpeRecord.OpeRecordInfo.ConduitDepth + "cm"; if (punStr.Trim() != "") PunctureAndIntubatio.Add(punStr); SetRemarkInfo(PunctureAndIntubatio, remarkRowscount, ref x, ref remarkRow, ref AllRemarkRow, fontsize, ref fontlength); } //穿刺点2 if (myOpeRecord.OpeRecordInfo.PunctureSite2 != null || myOpeRecord.OpeRecordInfo.NeedleNumber2 != null || myOpeRecord.OpeRecordInfo.NeedleDirection2 != null || myOpeRecord.OpeRecordInfo.PuncturePosition2 != null || myOpeRecord.OpeRecordInfo.ConduitDepth2 != null) { PunctureAndIntubatio = new List(); PunctureAndIntubatio.Add("【穿刺点2】"); punStr = ""; if (myOpeRecord.OpeRecordInfo.PunctureSite2 != "") punStr += " 穿刺部位:" + myOpeRecord.OpeRecordInfo.PunctureSite2; if (myOpeRecord.OpeRecordInfo.NeedleNumber2 != "") punStr += " 针号:" + myOpeRecord.OpeRecordInfo.NeedleNumber2; if (myOpeRecord.OpeRecordInfo.NeedleDirection2 != "") punStr += " 针向:" + myOpeRecord.OpeRecordInfo.NeedleDirection2; if (punStr.Trim() != "") PunctureAndIntubatio.Add(punStr); if (myOpeRecord.OpeRecordInfo.PuncturePosition2 != "") punStr = " 穿刺体位:" + myOpeRecord.OpeRecordInfo.PuncturePosition2; if (myOpeRecord.OpeRecordInfo.ConduitDepth2 != "") punStr += " 导管进入:" + myOpeRecord.OpeRecordInfo.ConduitDepth2 + "cm"; if (punStr.Trim() != "") PunctureAndIntubatio.Add(punStr); SetRemarkInfo(PunctureAndIntubatio, remarkRowscount, ref x, ref remarkRow, ref AllRemarkRow, fontsize, ref fontlength); } //插管 if (myOpeRecord.OpeRecordInfo.IntubateMode != null || myOpeRecord.OpeRecordInfo.IntubateType != null || myOpeRecord.OpeRecordInfo.IntubatePosition != null || myOpeRecord.OpeRecordInfo.IntubatePath != null || myOpeRecord.OpeRecordInfo.IntubateOther != null) { PunctureAndIntubatio = new List(); PunctureAndIntubatio.Add("【插管/喉罩】"); punStr = myOpeRecord.OpeRecordInfo.IntubateMode + " " + myOpeRecord.OpeRecordInfo.IntubateType; if (myOpeRecord.OpeRecordInfo.IntubateNumber != "") punStr += " 管号:" + myOpeRecord.OpeRecordInfo.IntubateNumber + "#"; if (myOpeRecord.OpeRecordInfo.IntubateDepth != "") punStr += " 深度:" + myOpeRecord.OpeRecordInfo.IntubateDepth + "cm"; if (punStr.Trim() != "") PunctureAndIntubatio.Add(punStr); punStr = " " + myOpeRecord.OpeRecordInfo.IntubatePosition.Trim(); punStr += " " + myOpeRecord.OpeRecordInfo.AnaesthesiaMode; punStr += " " + myOpeRecord.OpeRecordInfo.IntubatePath; punStr += " " + myOpeRecord.OpeRecordInfo.IntubateOther; string jing = ""; if (myOpeRecord.OpeRecordInfo.NeuroPlexusShallow != null) { jing = myOpeRecord.OpeRecordInfo.NeuroPlexusShallow; } punStr += " " + jing; if (punStr.Trim() != "") PunctureAndIntubatio.Add(punStr); SetRemarkInfo(PunctureAndIntubatio, remarkRowscount, ref x, ref remarkRow, ref AllRemarkRow, fontsize, ref fontlength); } //神经阻滞 if (myOpeRecord.OpeRecordInfo.NeuroPlexusAround != null || myOpeRecord.OpeRecordInfo.BrachialPlexus != null) { PunctureAndIntubatio = new List(); PunctureAndIntubatio.Add("【神经阻滞】"); string NeuroPlexusAround = myOpeRecord.OpeRecordInfo.NeuroPlexusAround; if (myOpeRecord.OpeRecordInfo.BrachialPlexus != null && myOpeRecord.OpeRecordInfo.BrachialPlexus != "") PunctureAndIntubatio.Add(myOpeRecord.OpeRecordInfo.BrachialPlexus + " " + NeuroPlexusAround);//"【神经阻滞部位】 " + SetRemarkInfo(PunctureAndIntubatio, remarkRowscount, ref x, ref remarkRow, ref AllRemarkRow, fontsize, ref fontlength); } //穿刺信息 if (myOpeRecord.OpeRecordInfo.VenipunctureType != null) { PunctureAndIntubatio = new List(); PunctureAndIntubatio.Add("【穿刺信息】"); string PuncturePosition = ""; if (myOpeRecord.OpeRecordInfo.VenipunctureDeep != null && myOpeRecord.OpeRecordInfo.VenipunctureDeep != "") { PuncturePosition = "动脉穿刺 " + myOpeRecord.OpeRecordInfo.VenipunctureDeep; PunctureAndIntubatio.Add(PuncturePosition); } string PunctureSite = ""; if (myOpeRecord.OpeRecordInfo.VenipunctureCenter != null && myOpeRecord.OpeRecordInfo.VenipunctureCenter != "") { PunctureSite = "中心静脉穿刺 " + myOpeRecord.OpeRecordInfo.VenipunctureCenter; PunctureAndIntubatio.Add(PunctureSite); } if (PunctureAndIntubatio.Count > 0) SetRemarkInfo(PunctureAndIntubatio, remarkRowscount, ref x, ref remarkRow, ref AllRemarkRow, fontsize, ref fontlength); } //麻醉情况 if (myOpeRecord.OpeRecordInfo.AnesthesiaPlane != null || myOpeRecord.OpeRecordInfo.AnesthesiaEffect != null || myOpeRecord.OpeRecordInfo.SpecialSituation != null) { PunctureAndIntubatio = new List(); PunctureAndIntubatio.Add("【麻醉情况】"); punStr = ""; if (myOpeRecord.OpeRecordInfo.AnesthesiaPlane != null && myOpeRecord.OpeRecordInfo.AnesthesiaPlane != "") punStr += " 麻醉平面:" + myOpeRecord.OpeRecordInfo.AnesthesiaPlane; if (myOpeRecord.OpeRecordInfo.AnesthesiaEffect != null) punStr += " 麻醉效果: " + myOpeRecord.OpeRecordInfo.AnesthesiaEffect; if (punStr.Trim() != "") PunctureAndIntubatio.Add(punStr); if (myOpeRecord.OpeRecordInfo.SpecialSituation != null && myOpeRecord.OpeRecordInfo.SpecialSituation != "") PunctureAndIntubatio.Add(" 手术结束患者情况: " + myOpeRecord.OpeRecordInfo.SpecialSituation); SetRemarkInfo(PunctureAndIntubatio, remarkRowscount, ref x, ref remarkRow, ref AllRemarkRow, fontsize, ref fontlength); } //cboSteward评分 if (myOpeRecord.OpeRecordInfo.StewardNumber != null || myOpeRecord.OpeRecordInfo.StewardSober != null || myOpeRecord.OpeRecordInfo.StewardLimbActivity != null) { PunctureAndIntubatio = new List(); PunctureAndIntubatio.Add("【Steward评分】"); punStr = ""; if (myOpeRecord.OpeRecordInfo.StewardSober != null && myOpeRecord.OpeRecordInfo.StewardSober != "") punStr += " 清醒程度:" + myOpeRecord.OpeRecordInfo.StewardSober + "分"; //if (punStr.Trim() != "") PunctureAndIntubatio.Add(punStr); //punStr = ""; if (myOpeRecord.OpeRecordInfo.StewardBreathing != null && myOpeRecord.OpeRecordInfo.StewardBreathing != "") punStr += " 呼吸通道顺畅程度: " + myOpeRecord.OpeRecordInfo.StewardBreathing + "分"; //if (punStr.Trim() != "") PunctureAndIntubatio.Add(punStr); //punStr = ""; if (myOpeRecord.OpeRecordInfo.StewardLimbActivity != null && myOpeRecord.OpeRecordInfo.StewardLimbActivity != "") punStr += " 肢体活动度: " + myOpeRecord.OpeRecordInfo.StewardLimbActivity + "分"; if (punStr.Trim() != "") PunctureAndIntubatio.Add(punStr); if (myOpeRecord.OpeRecordInfo.StewardNumber != null && myOpeRecord.OpeRecordInfo.StewardNumber != "") PunctureAndIntubatio.Add(" Steward总评分: " + myOpeRecord.OpeRecordInfo.StewardNumber + "分"); SetRemarkInfo(PunctureAndIntubatio, remarkRowscount, ref x, ref remarkRow, ref AllRemarkRow, fontsize, ref fontlength); } } } catch (Exception ex) { PublicMethod.WriteLog(ex); } } private void SetRemarkInfo(List PunctureAndIntubatios, int remarkRowscount, ref double x, ref int remarkRow, ref int AllRemarkRow, float fontsize, ref int fontlength) { if (AllRemarkRow > (remarkRowscount * 3)) return; double lastIndex = remarkPpack.RealEndY; double y = remarkPpack.RealY + getYPositionByListIndex(remarkRow, remarkPpack.RealY, lastIndex, remarkRowscount); if (PunctureAndIntubatios != null && PunctureAndIntubatios.Count > 1) { foreach (string item in PunctureAndIntubatios) { List PunStr = stringformat(item, fontlength); for (int m = 0; m < PunStr.Count; m++) { if (PunStr[m] == null) continue; y = remarkPpack.RealY + getYPositionByListIndex(remarkRow, remarkPpack.RealY, lastIndex, remarkRowscount); if (PunStr[m] == null || PunStr[m].Trim() == "") break; ZUtil.DrawText(PunStr[m], x, y, ZedControl, fontsize, "RemarkRow" + AllRemarkRow); SelRemarkLastRow(remarkRowscount, ref x, ref remarkRow, ref AllRemarkRow, ref fontlength); } } if (remarkRow != 0) SelRemarkLastRow(remarkRowscount, ref x, ref remarkRow, ref AllRemarkRow, ref fontlength); } } private void SelRemarkLastRow(int remarkRowscount, ref double x, ref int remarkRow, ref int AllRemarkRow, ref int fontlength) { remarkRow++; AllRemarkRow++; if (AllRemarkRow == remarkRowscount) { x = H4pack.RealX; remarkRow = 0; } else if (AllRemarkRow == (remarkRowscount * 2)) { x = H5pack.RealX; remarkRow = 0; } else if (AllRemarkRow == (remarkRowscount * 3) && H6pack != null) { x = H6pack.RealX; remarkRow = 0; } } #endregion public static List stringformat(string str, int n) { /// ///格式化字符串长度,超出部分显示省略号,区分汉字跟字母。汉字2个字节,字母数字一个字节 /// List strList = new List(); string temp = string.Empty; if (System.Text.Encoding.Default.GetByteCount(str) <= n)//如果长度比需要的长度n小,返回原字符串 { strList.Add(str); } else { int t = 0; char[] q = str.ToCharArray(); for (int i = 0; i <= q.Length; i++) { if (t > n) { strList.Add(temp); temp = ""; t = 0; } if (i == q.Length)// - 1 { strList.Add(temp); break; } //判断是否汉字: if ((int)q[i] >= 0x4E00 && (int)q[i] <= 0x9FA5) { temp += q[i]; t += 2; } //判断半角如下: else if (q[i].ToString().Length == Encoding.Default.GetByteCount(q[i].ToString())) { temp += q[i]; t++; } //判断全角如下: else if (2 * q[i].ToString().Length == Encoding.Default.GetByteCount(q[i].ToString())) { temp += q[i]; t += 2; } else { temp += q[i]; t++; } } } return strList; } /// /// 根据顶部加药序号,确定加药的纵向位置(以1为单位) /// /// /// public double getYPositionByListIndex(double index, double yTop, double yBottom, int rowCount) { double heightT = ZedControl.Height * (yBottom - yTop); double setpTemp = heightT / rowCount; //求一格在实际高度中的百分比 double bfb = (setpTemp / heightT); //两线之间度*百分比得到一格的百分比高度 double ygBFB = (yBottom - yTop) * bfb; double y = ygBFB * index; return y; } /// /// 响应可编辑区域的点击事件 /// /// /// public override void editAr_Click(object sender, EventArgs e) { try { //传过来的数据是不是可编辑的 AbleEditPackObj aEdit1S = sender as AbleEditPackObj; if (aEdit1S == null) return; //先把所有WINFORM组件隐藏 foreach (PackObjBase pack in PackManage.ListPob) { AbleEditPackObj aEdit = pack as AbleEditPackObj; if (aEdit != null) { aEdit.IsVisible = false; } } //这句话很重要,只操作自己管理器里的组件 AbleEditPackObj aEdit1 = PackManage.ListPob.FirstOrDefault(s => s.PackTag == aEdit1S.PackTag) as AbleEditPackObj; //指定的组件显示 if (aEdit1 != null) { aEdit1.IsVisible = !aEdit1.IsVisible; Control conl = aEdit1.CControl; conl.Leave -= new EventHandler(txt_Leave); conl.DoubleClick -= Conl_DoubleClick; //根据数据源名称进行不同的事件处理 switch (aEdit1.ClassDataSourceName) { case "OperationRecord.Remark": //特殊情况 //TYZD_Click(aEdit1, e); conl.Leave += new EventHandler(txt_Leave); conl.DoubleClick += Conl_DoubleClick; break; } } } catch (Exception exp) { MessageBox.Show(exp.Message); } finally { } } private void Conl_DoubleClick(object sender, EventArgs e) { //frmSelectDictionary fsd = new frmSelectDictionary(); //fsd._control = sender as TextBox; //fsd._dictionaryName = "特殊情况"; //fsd.isRadio = false; //fsd.isShowText = true; //fsd.ShowDialog(); } private void txt_Leave(object sender, EventArgs e) { Control control = (Control)sender; if (control == null) return; AbleEditPackObj ableEdit = control.Tag as AbleEditPackObj; if (ableEdit == null) return; try { string DataSourceName = ableEdit.ClassDataSourceName; Console.WriteLine(DataSourceName); //拿到数据源(格式:OperationRecord.PatientRef.Bed) bool updateOk = true; string text = control.Text.Trim(); string value = control.Text.Trim(); if (!updateOk) { ableEdit.IsVisible = !ableEdit.IsVisible; } else { //设置属性的值 ableEdit.IsVisible = !ableEdit.IsVisible; template.SetObjValue(OpeRecord, DataSourceName, text, value, true); } } catch (Exception) { } finally { } } public static string getNumber(int number) { try { string str = "①②③④⑤⑥⑦⑧⑨⑩⑪⑫⑬⑭⑮"; if (number >= 15) str = "①②③④⑤⑥⑦⑧⑨⑩⑪⑫⑬⑭⑮⑯⑰⑱⑲⑳㉑㉒㉓㉔㉕㉖㉗㉘㉙㉚㉛㉜㉝㉞㉟㊱㊲㊳㊴㊵㊶㊷㊸㊹㊺㊻㊼㊽㊾㊿"; str = str.Substring(number, 1); return str; } catch (Exception) { return number.ToString() + ":"; } } } }