545 lines
		
	
	
		
			22 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			545 lines
		
	
	
		
			22 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
| using DrawGraph;
 | ||
| using DrawGraph.AreaManage;
 | ||
| using DrawGraph.BoardPack;
 | ||
| using DrawGraph.GUtil;
 | ||
| using Newtonsoft.Json;
 | ||
| using PublicBusi;
 | ||
| using System;
 | ||
| using System.Collections.Generic;
 | ||
| using System.Linq;
 | ||
| using System.Windows.Forms;
 | ||
| 
 | ||
| namespace AIMS.EF
 | ||
| {
 | ||
| 
 | ||
|     [Serializable, JsonObject(MemberSerialization.OptOut)]
 | ||
|     public class BaseInfoTopManage : AreaManageBase
 | ||
|     {
 | ||
|         private OperationRecord myOpeRecord = null;
 | ||
|         public BaseInfoTopManage()
 | ||
|         {
 | ||
|             //自己要用的手术对象
 | ||
|             myOpeRecord = null;
 | ||
|         }
 | ||
|         public BaseInfoTopManage(object _operationRecor, ZedGraphControl _zedControl, TemplateManage _template, string _name) : base(_operationRecor, _zedControl, _template, _name)
 | ||
|         {
 | ||
|             init();
 | ||
|         }
 | ||
|         public void init()
 | ||
|         {
 | ||
|             //自己要用的手术对象
 | ||
|             myOpeRecord = OpeRecord as OperationRecord;
 | ||
|         }
 | ||
| 
 | ||
|         #region 重写的事件
 | ||
|         /// <summary>
 | ||
|         /// 鼠标点击画板
 | ||
|         /// </summary>
 | ||
|         /// <param name="sender"></param>
 | ||
|         /// <param name="e"></param>
 | ||
|         public override void MouseDown(ZedGraphControl sender, MouseEventArgs e)
 | ||
|         {
 | ||
|         }
 | ||
|         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)
 | ||
|         {
 | ||
|         }
 | ||
| 
 | ||
|         public override void Bind()
 | ||
|         {
 | ||
|             init();
 | ||
|             //myOpeRecord.clearAddObj(ZedControl);
 | ||
|             setPageTime(myOpeRecord.InRoomTime.Value);
 | ||
|             setXAxisTime(ZedControl.GraphPane, myOpeRecord.pageBegin, EVERY_PAGE_TIME_SPAN);
 | ||
|             GetcurrentPage();
 | ||
| 
 | ||
|             #region 单独赋值绑定 
 | ||
|             if (myOpeRecord.InRoomTime != null)
 | ||
|             {
 | ||
|                 template.SetObjValue(myOpeRecord, "OperationRecord.InRoomTime", myOpeRecord.InRoomTime.Value.ToString("yyyy-MM-dd"), myOpeRecord.InRoomTime.ToString());
 | ||
|             }
 | ||
|             if (myOpeRecord.currentPage != 0)
 | ||
|             {
 | ||
|                 template.SetObjValue(myOpeRecord, "OperationRecord.currentPage", myOpeRecord.currentPage.ToString(), myOpeRecord.currentPage.ToString());
 | ||
|             }
 | ||
|             if (myOpeRecord.pageCount != 0)
 | ||
|             {
 | ||
|                 template.SetObjValue(myOpeRecord, "OperationRecord.pageCount", myOpeRecord.pageCount.ToString(), myOpeRecord.pageCount.ToString());
 | ||
|             }
 | ||
|             #endregion
 | ||
|             List<PackObjBase> ables = PackManage.ListPob.Where<PackObjBase>(s => s is AbleEditPackObj).ToList<PackObjBase>();
 | ||
|             foreach (PackObjBase pack in ables)
 | ||
|             {
 | ||
|                 AbleEditPackObj ableEdit = pack as AbleEditPackObj;
 | ||
|                 SetAbleEditView(ableEdit);
 | ||
|             }
 | ||
| 
 | ||
|             //if (myOpeRecord.PatientRef.Weight != null)
 | ||
|             //{
 | ||
|             //    template.SetObjValue(myOpeRecord, "OperationRecord.PatientRef.Weight", Convert.ToInt32(myOpeRecord.PatientRef.Weight).ToString(), myOpeRecord.PatientRef.Weight.ToString());
 | ||
|             //}
 | ||
|             //if (myOpeRecord.PatientRef.Height != null)
 | ||
|             //{
 | ||
|             //    template.SetObjValue(myOpeRecord, "OperationRecord.PatientRef.Height", Convert.ToInt32(myOpeRecord.PatientRef.Height).ToString(), myOpeRecord.PatientRef.Height.ToString());
 | ||
|             //}
 | ||
|             if (myOpeRecord.Fasting == 0)
 | ||
|             {
 | ||
|                 template.SetObjValue(myOpeRecord, "OperationRecord.Fasting", "否", myOpeRecord.Fasting.ToString());
 | ||
|             }
 | ||
|             if (myOpeRecord.Fasting == 1)
 | ||
|             {
 | ||
|                 template.SetObjValue(myOpeRecord, "OperationRecord.Fasting", "是", myOpeRecord.Fasting.ToString());
 | ||
|             }
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         /// 设置可编辑组件的显示样式
 | ||
|         /// </summary>
 | ||
|         /// <param name="ableEdit"></param>
 | ||
|         private void SetAbleEditView(AbleEditPackObj ableEdit)
 | ||
|         {
 | ||
|             string span = "";
 | ||
|             double spanSum = Math.Round((float)(ableEdit.OneUnitCount / 12));
 | ||
|             for (int i = 0; i < spanSum; i++)
 | ||
|             {
 | ||
|                 span += " ";
 | ||
|             }
 | ||
|             string text = "", value = "";
 | ||
|             if (ableEdit != null)
 | ||
|             {
 | ||
|                 switch (ableEdit.ControlType)
 | ||
|                 {
 | ||
|                     case EControlType.Directory:
 | ||
|                         value = ableEdit.PackValue;
 | ||
|                         text = DocumentEntityMethod.GetDictionaryValuesById(ableEdit.PackValue, ableEdit.ControlTitleText);
 | ||
|                         //设置属性的值
 | ||
|                         template.SetObjValue(OpeRecord, ableEdit.ClassDataSourceName, text, value);
 | ||
|                         break;
 | ||
|                     default:
 | ||
|                         break;
 | ||
|                 }
 | ||
|             }
 | ||
|         }
 | ||
| 
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// 初始画的后置方法
 | ||
|         /// </summary>
 | ||
|         public override void FollowUpMethod()
 | ||
|         {
 | ||
|             init();
 | ||
| 
 | ||
|         }
 | ||
|         #endregion 重写的事件结束
 | ||
| 
 | ||
| 
 | ||
|         #region 初始化时间轴
 | ||
|         /// <summary>
 | ||
|         /// 设置页面的开始时间和结束时间
 | ||
|         /// </summary>
 | ||
|         /// <param name="_operationRecord">手术信息对象</param>
 | ||
|         private void setPageTime(DateTime begin)
 | ||
|         {
 | ||
|             if (myOpeRecord.pageCount == 0)
 | ||
|             {
 | ||
|                 myOpeRecord.pageCount = 1;
 | ||
|                 myOpeRecord.sharpBegin = getSharpTime(begin);
 | ||
|                 myOpeRecord.pageBegin = getPageBegin(begin, collectInterval, ref EVERY_PAGE_TIME_SPAN);
 | ||
|                 myOpeRecord.lastPageBegin = myOpeRecord.pageBegin.AddHours(EVERY_PAGE_TIME_SPAN / 60);
 | ||
|             }
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         /// 根据采集间隔,确定页面时间跨度和页面开始时间
 | ||
|         /// </summary>
 | ||
|         /// <param name="curTime">给定时间(文本)</param>
 | ||
|         /// <param name="collectInterval">采集间隔(分钟)</param>
 | ||
|         /// <param name="timeSpan">页面时间跨度</param>
 | ||
|         /// <returns>页面显示的开始时间</returns>
 | ||
|         private DateTime getPageBegin(DateTime dt, double collectInterval, ref double timeSpan)
 | ||
|         {
 | ||
|             try
 | ||
|             {
 | ||
|                 DateTime pageBegin = dt.Date.AddHours(dt.Hour);
 | ||
|                 int ci = (int)(collectInterval * 60);
 | ||
|                 if (ci <= 30)
 | ||
|                 {
 | ||
|                     if (dt.Minute >= 30)
 | ||
|                     {
 | ||
|                         pageBegin = pageBegin.AddMinutes(30);
 | ||
|                     }
 | ||
|                     timeSpan = 30;
 | ||
|                 }
 | ||
|                 else if (ci <= 60)
 | ||
|                 {
 | ||
|                     timeSpan = 60;
 | ||
|                 }
 | ||
|                 else
 | ||
|                 {
 | ||
|                     timeSpan = 240;
 | ||
|                     TimeSpan ts = pageBegin - myOpeRecord.sharpBegin;
 | ||
|                     int h = ts.Hours;
 | ||
|                     h /= 4;
 | ||
|                     pageBegin = myOpeRecord.sharpBegin.AddHours(h * 4);
 | ||
|                 }
 | ||
|                 return pageBegin;
 | ||
|             }
 | ||
|             catch (Exception exp)
 | ||
|             {
 | ||
|                 throw exp;
 | ||
|             }
 | ||
|         }
 | ||
|         /// <summary>
 | ||
|         /// 获取系统的整点时刻
 | ||
|         /// </summary>
 | ||
|         /// <returns></returns>
 | ||
|         private DateTime getSharpTime(DateTime dt)
 | ||
|         {
 | ||
|             int ci = (int)dt.Minute;
 | ||
| 
 | ||
|             if (ci >= 50)
 | ||
|             {
 | ||
|                 dt = DateTime.Parse(dt.ToString("yyyy-MM-dd HH:50:00"));
 | ||
|             }
 | ||
|             else if (ci >= 40)
 | ||
|             {
 | ||
|                 dt = DateTime.Parse(dt.ToString("yyyy-MM-dd HH:40:00"));
 | ||
|             }
 | ||
|             else if (ci >= 30)
 | ||
|             {
 | ||
|                 dt = DateTime.Parse(dt.ToString("yyyy-MM-dd HH:30:00"));
 | ||
|             }
 | ||
|             else if (ci >= 20)
 | ||
|             {
 | ||
|                 dt = DateTime.Parse(dt.ToString("yyyy-MM-dd HH:20:00"));
 | ||
|             }
 | ||
|             else if (ci >= 10)
 | ||
|             {
 | ||
|                 dt = DateTime.Parse(dt.ToString("yyyy-MM-dd HH:10:00"));
 | ||
|             }
 | ||
|             else if (ci < 10)
 | ||
|             {
 | ||
|                 dt = DateTime.Parse(dt.ToString("yyyy-MM-dd HH:00:00"));
 | ||
|             }
 | ||
|             //if (ci >= 30)
 | ||
|             //{
 | ||
|             //    dt = DateTime.Parse(dt.ToString("yyyy-MM-dd HH:30:00")); 
 | ||
|             //}
 | ||
|             //else if (ci < 30)
 | ||
|             //{
 | ||
|             //    dt = DateTime.Parse(dt.ToString("yyyy-MM-dd HH:00:00"));
 | ||
|             //}
 | ||
|             return dt;
 | ||
|         }
 | ||
|         private void setXAxisTime(GraphPane myPane, DateTime begin, double pageSpan)
 | ||
|         {
 | ||
|             myPane.XAxis.Scale.Min = new XDate(begin);
 | ||
|             myPane.X2Axis.Scale.Min = myPane.XAxis.Scale.Min;
 | ||
|             myPane.XAxis.Scale.Max = new XDate(begin.AddMinutes(pageSpan));
 | ||
|             myPane.X2Axis.Scale.Max = myPane.XAxis.Scale.Max;
 | ||
|         }
 | ||
|         #endregion
 | ||
| 
 | ||
|         /// <summary>
 | ||
|         /// 响应可编辑区域的点击事件
 | ||
|         /// </summary>
 | ||
|         /// <param name="sender"></param>
 | ||
|         /// <param name="e"></param>
 | ||
|         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<PackObjBase>(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.PatientRef.Height":
 | ||
|                             conl.Leave += new EventHandler(txt_Leave);
 | ||
|                             break;
 | ||
|                         case "OperationRecord.PatientRef.Weight": //体重
 | ||
|                             conl.Leave += new EventHandler(txt_Leave);
 | ||
|                             break;
 | ||
|                         case "OperationRecord.PatientRef.BloodType": 
 | ||
|                             conl.Leave += new EventHandler(txt_Leave);
 | ||
|                             break;
 | ||
|                         case "OperationRecord.AnaesthesiaMethodId":
 | ||
|                             Anaes_Click(aEdit1, e);
 | ||
|                             break;
 | ||
|                         case "OperationRecord.ASALevel": //ASA分级
 | ||
|                             TYZD_Click(aEdit1, e, true);
 | ||
|                             break;
 | ||
|                         case "OperationRecord.OperationSiteId": //手术体位
 | ||
|                             TYZD_Click(aEdit1, e);
 | ||
|                             break;
 | ||
|                         case "OperationRecord.Fasting": //术前禁食
 | ||
|                             conl.Leave += new EventHandler(txt_Leave);
 | ||
|                             break;
 | ||
|                         case "OperationRecord.SpecialCase": //特殊情况
 | ||
|                             //TYZD_Click(aEdit1, e);
 | ||
|                             conl.Leave += new EventHandler(txt_Leave);
 | ||
|                             conl.DoubleClick += Conl_DoubleClick;
 | ||
|                             break;
 | ||
|                         case "OperationRecord.AnalgesiaModeMessage": 
 | ||
|                             conl.Leave += new EventHandler(txt_Leave); 
 | ||
|                             break;
 | ||
|                         case "OperationRecord.OperationApplyRef.Diagnose": //手术诊断
 | ||
| 
 | ||
|                             opeDisease_Click(aEdit1, e);
 | ||
|                             break;
 | ||
|                         case "OperationRecord.OperationApplyRef.Operation": //手术名称
 | ||
|                             ope_Click(aEdit1, e);
 | ||
|                             break;
 | ||
|                             //default:
 | ||
|                             //    //在此处写日志
 | ||
|                             //    aEdit1.IsVisible = !aEdit1.IsVisible;
 | ||
|                             //    MessageBox.Show("没找到-" + aEdit1.ClassDataSourceName + "-属性的事件");
 | ||
|                             //    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();
 | ||
|         }
 | ||
| 
 | ||
|         #region 可编辑区域响应事件
 | ||
|         //通用字典分组窗体打开
 | ||
|         private void TYZD_Click(AbleEditPackObj sender, EventArgs e, bool isRadio = false)
 | ||
|         {
 | ||
|             AbleEditPackObj ableEdit = sender;
 | ||
|             if (ableEdit == null) return;
 | ||
|             try
 | ||
|             {
 | ||
|                 if (myOpeRecord != null)
 | ||
|                 {
 | ||
|                     ////默认是字典
 | ||
|                     //frmSelectDictionary fsd = new frmSelectDictionary();
 | ||
|                     //fsd._controlName = new KeyValuePair<string, string>(ableEdit.PackValue, ableEdit.PackText);
 | ||
|                     //fsd._dictionaryName = ableEdit.ControlTitleText;
 | ||
|                     //fsd.isRadio = isRadio;
 | ||
|                     //fsd.isAddItem = false;
 | ||
|                     //fsd.ShowDialog();
 | ||
|                     //ableEdit.PackValue = fsd._controlName.Key.ToString();
 | ||
|                     //ableEdit.PackText = fsd._controlName.Value.ToString();
 | ||
| 
 | ||
|                     //string value = ableEdit.PackValue;
 | ||
|                     //string text = DocumentEntityMethod.GetDictionaryValuesById(ableEdit.PackValue, ableEdit.ControlTitleText);
 | ||
|                     ////设置属性的值
 | ||
|                     //ableEdit.IsVisible = !ableEdit.IsVisible;
 | ||
|                     //template.SetObjValue(OpeRecord, ableEdit.ClassDataSourceName, text, value, true);
 | ||
|                 }
 | ||
|             }
 | ||
|             catch (Exception exp)
 | ||
|             {
 | ||
|             }
 | ||
|         }
 | ||
|         private void opeDisease_Click(AbleEditPackObj sender, EventArgs e)
 | ||
|         {
 | ||
|             AbleEditPackObj ableEdit = sender;
 | ||
|             if (ableEdit == null) return;
 | ||
|             try
 | ||
|             {
 | ||
|                 if (myOpeRecord != null)
 | ||
|                 {
 | ||
|                     //frmSelectDisease fsi = new frmSelectDisease();
 | ||
|                     //fsi._controlName = new KeyValuePair<string, string>(ableEdit.PackValue, ableEdit.PackText);
 | ||
|                     //fsi.txtRemark.Text = myOpeRecord.OperationApplyRef.DiagnoseRemark;
 | ||
|                     //fsi.ShowDialog();
 | ||
|                     //ableEdit.PackValue = fsi._controlName.Key.ToString();
 | ||
|                     //ableEdit.PackText = fsi._controlName.Value.ToString();
 | ||
|                     //string value = ableEdit.PackValue;
 | ||
|                     //string text = DocumentEntityMethod.GetDictionaryValuesById(ableEdit.PackValue, ableEdit.ControlTitleText);
 | ||
|                     //myOpeRecord.OperationApplyRef.DiagnoseRemark = fsi.txtRemark.Text;
 | ||
|                     ////设置属性的值
 | ||
|                     //if (fsi.txtRemark.Text.Trim() != "")
 | ||
|                     //    text = text + (" (" + fsi.txtRemark.Text + ")");
 | ||
|                     //ableEdit.IsVisible = !ableEdit.IsVisible;
 | ||
|                     //template.SetObjValue(OpeRecord, ableEdit.ClassDataSourceName, text, value, true);
 | ||
|                     //template.SetObjValue(OpeRecord, "myOpeRecord.OperationApplyRef.DiagnoseRemark", fsi.txtRemark.Text, fsi.txtRemark.Text, true);
 | ||
|                 }
 | ||
|             }
 | ||
|             catch (Exception exp)
 | ||
|             {
 | ||
|             }
 | ||
|         }
 | ||
|         private void Anaes_Click(AbleEditPackObj sender, EventArgs e)
 | ||
|         {
 | ||
|             AbleEditPackObj ableEdit = sender;
 | ||
|             if (ableEdit == null) return;
 | ||
|             try
 | ||
|             {
 | ||
|                 if (myOpeRecord != null)
 | ||
|                 {
 | ||
|                     //frmSelectAnaesthesiaMethod fsi = new frmSelectAnaesthesiaMethod();
 | ||
|                     //fsi._controlName = new KeyValuePair<string, string>(ableEdit.PackValue, ableEdit.PackText);
 | ||
|                     //fsi._formName = this.Name;
 | ||
|                     //fsi._operationRecord = myOpeRecord;
 | ||
|                     //fsi.ShowDialog();
 | ||
|                     //ableEdit.PackValue = fsi._controlName.Key.ToString();
 | ||
|                     //ableEdit.PackText = fsi._controlName.Value.ToString();
 | ||
|                     //string value = ableEdit.PackValue;
 | ||
|                     //string text = DocumentEntityMethod.GetDictionaryValuesById(ableEdit.PackValue, ableEdit.ControlTitleText);
 | ||
|                     ////设置属性的值
 | ||
|                     //ableEdit.IsVisible = !ableEdit.IsVisible;
 | ||
|                     //template.SetObjValue(OpeRecord, ableEdit.ClassDataSourceName, text, value, true);
 | ||
|                 }
 | ||
|             }
 | ||
|             catch (Exception exp)
 | ||
|             {
 | ||
|             }
 | ||
|         }
 | ||
|         private void ope_Click(AbleEditPackObj sender, EventArgs e)
 | ||
|         {
 | ||
|             AbleEditPackObj ableEdit = sender;
 | ||
|             if (ableEdit == null) return;
 | ||
|             try
 | ||
|             {
 | ||
|                 if (myOpeRecord != null)
 | ||
|                 {
 | ||
| 
 | ||
|                     //frmSelectOperations frmso = new frmSelectOperations();
 | ||
|                     //frmso._controlName = new KeyValuePair<string, string>(ableEdit.PackValue, ableEdit.PackText);
 | ||
|                     //frmso.txtRemark.Text = myOpeRecord.OperationApplyRef.OPerationRemark;
 | ||
|                     //frmso.ShowDialog();
 | ||
|                     //ableEdit.PackValue = frmso._controlName.Key.ToString();
 | ||
|                     //ableEdit.PackText = frmso._controlName.Value.ToString();
 | ||
| 
 | ||
|                     //string value = ableEdit.PackValue;
 | ||
|                     //string text = DocumentEntityMethod.GetDictionaryValuesById(ableEdit.PackValue, ableEdit.ControlTitleText);
 | ||
|                     //myOpeRecord.OperationApplyRef.OPerationRemark = frmso.txtRemark.Text;
 | ||
|                     ////设置属性的值
 | ||
|                     //if (frmso.txtRemark.Text.Trim() != "")
 | ||
|                     //    text = text + (" (" + frmso.txtRemark.Text + ")");
 | ||
|                     //ableEdit.IsVisible = !ableEdit.IsVisible;
 | ||
|                     //template.SetObjValue(OpeRecord, ableEdit.ClassDataSourceName, text, value, true);
 | ||
|                     //template.SetObjValue(OpeRecord, "myOpeRecord.OperationApplyRef.OPerationRemark", frmso.txtRemark.Text, frmso.txtRemark.Text, true);
 | ||
|                 }
 | ||
|             }
 | ||
|             catch (Exception exp)
 | ||
|             {
 | ||
|             }
 | ||
|         }
 | ||
| 
 | ||
|         public string UpdateInformation(string colunm, TextBox value, int STATE)
 | ||
|         {
 | ||
|             if (value.Text == "")
 | ||
|             {
 | ||
|                 //BOperationRecord.Update(colunm + "= null where Id=@id", new ParameterList("@id", myOpeRecord.Id));
 | ||
|                 return null;
 | ||
|             }
 | ||
|             else
 | ||
|             {
 | ||
|                 //BOperationRecord.Update(colunm + "=@colunmvalue where Id=@id", new ParameterList("@colunmvalue", STATE == 0 ? value.Text.ToString() : value.Tag.ToString(), "@id", _operationRecord.Id));
 | ||
|                 return STATE == 0 ? value.Text.ToString() : value.Tag.ToString();
 | ||
|             }
 | ||
|         }
 | ||
|         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
 | ||
|                 {
 | ||
|                     if (DataSourceName == "OperationRecord.Fasting")
 | ||
|                     {
 | ||
|                         foreach (Control conl in control.Controls)
 | ||
|                         {
 | ||
|                             CheckBox chBox = conl as CheckBox;
 | ||
|                             if (chBox.Checked)
 | ||
|                             {
 | ||
|                                 text = "是";
 | ||
|                                 value = "1";
 | ||
|                             }
 | ||
|                             else
 | ||
|                             {
 | ||
|                                 text = "否";
 | ||
|                                 value = "0";
 | ||
|                             }
 | ||
|                         }
 | ||
|                     }
 | ||
| 
 | ||
|                     //设置属性的值
 | ||
|                     ableEdit.IsVisible = !ableEdit.IsVisible;
 | ||
|                     template.SetObjValue(OpeRecord, DataSourceName, text, value, true);
 | ||
|                 }
 | ||
|             }
 | ||
|             catch (Exception ex)
 | ||
|             {
 | ||
|                 throw;
 | ||
|             }
 | ||
|             finally
 | ||
|             {
 | ||
|             }
 | ||
|         }
 | ||
|         #endregion
 | ||
|         //得到当前页数
 | ||
|         private void GetcurrentPage()
 | ||
|         {
 | ||
|             DateTime EndTime = DateTime.Now;// BOperationRecord.getOpeMaxTime(myOpeRecord);
 | ||
|             EndTime = DateTime.Parse(EndTime.ToString("yyyy-MM-dd HH:mm"));
 | ||
|             TimeSpan tsp = (TimeSpan)(EndTime - myOpeRecord.sharpBegin);
 | ||
|             double db = tsp.TotalHours / 4;
 | ||
|             if (db == ((int)tsp.TotalHours / 4))
 | ||
|                 myOpeRecord.currentPage = (int)db;
 | ||
|             else
 | ||
|                 myOpeRecord.currentPage = (int)db + 1;
 | ||
|             if (myOpeRecord.currentPage == 0) myOpeRecord.currentPage = 1;
 | ||
|         }
 | ||
|     }
 | ||
| }
 |