741 lines
30 KiB
C#
741 lines
30 KiB
C#
using HelperDB;
|
||
using Newtonsoft.Json;
|
||
using AIMSExtension;
|
||
using System;
|
||
using System.Collections.Generic;
|
||
using System.Data;
|
||
using System.Linq;
|
||
using System.Windows.Forms;
|
||
|
||
namespace DrawGraph
|
||
{
|
||
|
||
[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 SelectDictValue aSyncSelectDict = null;
|
||
public override void Bind()
|
||
{
|
||
init();
|
||
aSyncSelectDict = SelectDictValue.CreateInstance();
|
||
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());
|
||
}
|
||
SetBMI();
|
||
#endregion
|
||
List<PackObjBase> ables = PackManage.ListPob.Where<PackObjBase>(s => s is AbleEditPackObj).ToList<PackObjBase>();
|
||
foreach (PackObjBase pack in ables)
|
||
{
|
||
AbleEditPackObj ableEdit = pack as AbleEditPackObj;
|
||
|
||
if (ableEdit != null)
|
||
{
|
||
if (ableEdit.ControlType == EControlType.RadioButtonList)
|
||
{
|
||
ableEdit.IsVisible = true;
|
||
Panel pan = ableEdit.CControl as Panel;
|
||
if (pan != null)
|
||
{
|
||
foreach (Control conl in pan.Controls)
|
||
{
|
||
CheckBox chBox = conl as CheckBox;
|
||
if (chBox != null)
|
||
{
|
||
chBox.CheckedChanged -= new EventHandler(txt_Leave);
|
||
chBox.CheckedChanged += new EventHandler(txt_Leave);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
SetAbleEditView(ableEdit);
|
||
}
|
||
}
|
||
}
|
||
|
||
public void SetBMI(bool IsUpdate = false)
|
||
{
|
||
if (myOpeRecord.Height != null && myOpeRecord.Height != "" && myOpeRecord.Weight != null && myOpeRecord.Weight != "" && myOpeRecord.Height != "卧床" && myOpeRecord.Weight != "卧床")
|
||
{
|
||
double Weight = 0;
|
||
bool isNum = double.TryParse(myOpeRecord.Weight, out Weight);
|
||
double Height = 0;
|
||
bool isNum2 = double.TryParse(myOpeRecord.Height, out Height);
|
||
if (isNum == true && isNum2 == true && Height != 0 && Weight != 0)
|
||
{
|
||
double hei = Height / 100;
|
||
double wei = Weight;
|
||
double BMI = wei / hei / hei;
|
||
myOpeRecord.BMI = Math.Floor(BMI).ToString();
|
||
template.SetObjValue(myOpeRecord, "OperationRecord.BMI", myOpeRecord.BMI.ToString(), myOpeRecord.BMI.ToString(), IsUpdate);
|
||
}
|
||
else
|
||
{
|
||
myOpeRecord.BMI = "";
|
||
template.SetObjValue(myOpeRecord, "OperationRecord.BMI", myOpeRecord.BMI.ToString(), myOpeRecord.BMI.ToString(), IsUpdate);
|
||
}
|
||
}
|
||
}
|
||
/// <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.RadioButtonList:
|
||
ableEdit.IsVisible = true;
|
||
foreach (Control conl in ableEdit.CControl.Controls)
|
||
{
|
||
string spanT = span.Clone().ToString();
|
||
if (ableEdit.DfArrangement == EIsBool.True)
|
||
{
|
||
if (spanT.Length - conl.Text.Length >= conl.Text.Length)
|
||
{
|
||
spanT = spanT.Remove(spanT.Length - conl.Text.Length, conl.Text.Length);
|
||
}
|
||
}
|
||
CheckBox radio = conl as CheckBox;
|
||
if (radio.Checked)
|
||
{
|
||
text += "☑" + conl.Text + spanT;
|
||
value = conl.Text;
|
||
}
|
||
else
|
||
{
|
||
text += "□" + conl.Text + spanT;
|
||
}
|
||
}
|
||
template.SetObjValue(OpeRecord, ableEdit.ClassDataSourceName, text, value);
|
||
break;
|
||
case EControlType.Directory:
|
||
value = ableEdit.PackValue;
|
||
text = DBManage.GetDictionaryValuesById(ableEdit.PackValue, ableEdit.ControlTitleText);
|
||
//设置属性的值
|
||
template.SetObjValue(OpeRecord, ableEdit.ClassDataSourceName, text, value);
|
||
break;
|
||
default:
|
||
text = ableEdit.CControl.Text;
|
||
value = ableEdit.CControl.Text;
|
||
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)
|
||
{
|
||
if (aEdit.ControlType == EControlType.RadioButtonList)
|
||
aEdit.IsVisible = true;
|
||
else
|
||
aEdit.IsVisible = false;
|
||
}
|
||
}
|
||
SelectDictValue.Hidden();
|
||
//这句话很重要,只操作自己管理器里的组件
|
||
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;
|
||
aEdit1S.CControl.MouseDown -= new MouseEventHandler(CControl_MouseDown);
|
||
aEdit1S.CControl.KeyUp -= new KeyEventHandler(CControl_KeyUp);
|
||
aEdit1S.CControl.TextChanged -= new EventHandler(CControl_TextChanged);
|
||
aEdit1S.CControl.KeyPress -= new KeyPressEventHandler(CControl_KeyPress); ;
|
||
//根据数据源名称进行不同的事件处理
|
||
switch (aEdit1.ClassDataSourceName)
|
||
{
|
||
case "OperationRecord.Height":
|
||
((TextBox)conl).BorderStyle = BorderStyle.Fixed3D;
|
||
((TextBox)conl).Focus();
|
||
((TextBox)conl).Select(((TextBox)conl).Text.Length, 1);
|
||
conl.Leave += new EventHandler(txt_Leave);
|
||
break;
|
||
case "OperationRecord.Weight": //体重
|
||
((TextBox)conl).BorderStyle = BorderStyle.Fixed3D;
|
||
((TextBox)conl).Focus();
|
||
((TextBox)conl).Select(((TextBox)conl).Text.Length, 1);
|
||
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.OperationPositionId": //手术体位
|
||
TYZD_Click(aEdit1, e);
|
||
break;
|
||
case "OperationRecord.SpecialCase": //特殊情况
|
||
((TextBox)conl).BorderStyle = BorderStyle.Fixed3D;
|
||
((TextBox)conl).Focus();
|
||
((TextBox)conl).Select(((TextBox)conl).Text.Length, 1);
|
||
conl.Leave += new EventHandler(txt_Leave);
|
||
conl.DoubleClick += Conl_DoubleClick;
|
||
break;
|
||
case "OperationRecord.BloodType": //血型
|
||
TYZD_Click(aEdit1, e);
|
||
break;
|
||
case "OperationRecord.Applydiagnose": //手术诊断
|
||
opeDisease_Click(aEdit1, e);
|
||
break;
|
||
case "OperationRecord.Applyoperation": //手术诊断
|
||
ope_Click(aEdit1, e);
|
||
break;
|
||
case "OperationRecord.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)
|
||
{
|
||
SelDict(sender, e, ableEdit.ControlTitleText, isRadio);
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
AIMSExtension.PublicMethod.WriteLog(ex);
|
||
}
|
||
}
|
||
private void SelDict(AbleEditPackObj sender, EventArgs e, string _DictType, bool isRadio = false)
|
||
{
|
||
AbleEditPackObj ableEdit = sender;
|
||
if (ableEdit == null) return;
|
||
|
||
ableEdit.CControl.MouseDown -= new MouseEventHandler(CControl_MouseDown);
|
||
ableEdit.CControl.MouseDown += new MouseEventHandler(CControl_MouseDown);
|
||
ableEdit.CControl.KeyUp -= new KeyEventHandler(CControl_KeyUp);
|
||
ableEdit.CControl.KeyUp += new KeyEventHandler(CControl_KeyUp);
|
||
ableEdit.CControl.KeyPress -= new KeyPressEventHandler(CControl_KeyPress);
|
||
ableEdit.CControl.KeyPress += new KeyPressEventHandler(CControl_KeyPress);
|
||
SelectDictValue.ChageText = "";
|
||
if (myOpeRecord != null)
|
||
{
|
||
Control conl = sender.CControl;
|
||
if (conl is TextBox)
|
||
{
|
||
((TextBox)conl).BorderStyle = BorderStyle.Fixed3D;
|
||
((TextBox)conl).Focus();
|
||
if (sender.PackValue != null && sender.PackValue.Trim() != "" && isRadio == false)
|
||
{
|
||
if (((TextBox)conl).Text.LastIndexOf(',') != sender.PackText.Length)
|
||
((TextBox)conl).Text = ((TextBox)conl).Text + ",";
|
||
}
|
||
((TextBox)conl).Select(((TextBox)conl).Text.Length, 1);
|
||
}
|
||
ableEdit.CControl.TextChanged -= new EventHandler(CControl_TextChanged);
|
||
ableEdit.CControl.TextChanged += new EventHandler(CControl_TextChanged);
|
||
aSyncSelectDict.Show(template, OpeRecord, sender, _DictType, isRadio);
|
||
}
|
||
}
|
||
|
||
|
||
private void CControl_TextChanged(object sender, EventArgs e)
|
||
{
|
||
if (myOpeRecord != null)
|
||
{
|
||
Control conl = sender as Control;
|
||
aSyncSelectDict.ShowSel(conl, OpeRecord);
|
||
}
|
||
}
|
||
private void CControl_KeyUp(object sender, KeyEventArgs e)
|
||
{
|
||
if (myOpeRecord != null)
|
||
{
|
||
Control conl = sender as Control;
|
||
if (e.KeyCode == Keys.Delete || e.KeyCode == Keys.Back)
|
||
{
|
||
if (conl.Text != SelectDictValue.Value && SelectDictValue.ChageText == "")
|
||
{
|
||
aSyncSelectDict.DelSel(conl, OpeRecord);
|
||
SelectDictValue.ChageText = "";
|
||
}
|
||
}
|
||
else if (e.KeyCode == Keys.Down)
|
||
{
|
||
if (SelectDictValue.dgvZd.CurrentRow.Index + 1 != SelectDictValue.dgvZd.Rows.Count - 1)
|
||
{
|
||
SelectDictValue.dgvZd.CurrentCell = SelectDictValue.dgvZd.Rows[SelectDictValue.dgvZd.CurrentRow.Index + 1].Cells[1];
|
||
}
|
||
}
|
||
else if (e.KeyCode == Keys.Up)
|
||
{
|
||
if (SelectDictValue.dgvZd.CurrentRow.Index != 0)
|
||
{
|
||
SelectDictValue.dgvZd.CurrentCell = SelectDictValue.dgvZd.Rows[SelectDictValue.dgvZd.CurrentRow.Index - 1].Cells[1];
|
||
}
|
||
}
|
||
}
|
||
}
|
||
private void CControl_KeyPress(object sender, KeyPressEventArgs e)
|
||
{
|
||
if (e.KeyChar.ToString() == "\r")
|
||
{
|
||
if (SelectDictValue.dgvZd.SelectedRows.Count > 0)
|
||
{
|
||
SelectDictValue.SetContent(SelectDictValue.dgvZd.SelectedRows[0].Index);
|
||
}
|
||
}
|
||
}
|
||
private void CControl_MouseDown(object sender, MouseEventArgs e)
|
||
{
|
||
if (myOpeRecord != null)
|
||
{
|
||
TextBox conl = sender as TextBox;
|
||
string leftStr = conl.Text.Substring(0, conl.SelectionStart);
|
||
string rightStr = conl.Text.Substring(conl.SelectionStart, conl.Text.Length - conl.SelectionStart);
|
||
int startIndex = 0;
|
||
int endLength = conl.Text.Length;
|
||
|
||
if (leftStr.Contains(","))
|
||
{
|
||
int beginindex = leftStr.LastIndexOf(',');
|
||
startIndex = beginindex + 1;
|
||
if (rightStr.Contains(","))
|
||
{
|
||
endLength = rightStr.IndexOf(",") + (leftStr.Length - beginindex);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
if (rightStr.Contains(","))
|
||
{
|
||
endLength = rightStr.IndexOf(",") + leftStr.Length + 1;
|
||
}
|
||
}
|
||
conl.Select(startIndex, endLength);
|
||
|
||
}
|
||
}
|
||
|
||
private void ope_Click(AbleEditPackObj sender, EventArgs e)
|
||
{
|
||
AbleEditPackObj ableEdit = sender;
|
||
if (ableEdit == null) return;
|
||
try
|
||
{
|
||
if (myOpeRecord != null)
|
||
{
|
||
SelDict(sender, e, ableEdit.ControlTitleText);
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
AIMSExtension.PublicMethod.WriteLog(ex);
|
||
}
|
||
}
|
||
private void opeDisease_Click(AbleEditPackObj sender, EventArgs e)
|
||
{
|
||
AbleEditPackObj ableEdit = sender;
|
||
if (ableEdit == null) return;
|
||
try
|
||
{
|
||
if (myOpeRecord != null)
|
||
{
|
||
SelDict(sender, e, ableEdit.ControlTitleText);
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
AIMSExtension.PublicMethod.WriteLog(ex);
|
||
}
|
||
}
|
||
private void Anaes_Click(AbleEditPackObj sender, EventArgs e)
|
||
{
|
||
AbleEditPackObj ableEdit = sender;
|
||
if (ableEdit == null) return;
|
||
try
|
||
{
|
||
if (myOpeRecord != null)
|
||
{
|
||
SelDict(sender, e, ableEdit.ControlTitleText);
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
AIMSExtension.PublicMethod.WriteLog(ex);
|
||
}
|
||
}
|
||
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)
|
||
if (ableEdit.ControlType == EControlType.RadioButtonList)
|
||
{
|
||
ableEdit.IsVisible = true;
|
||
//SetAbleEditView(ableEdit,true);
|
||
if (sender is CheckBox)
|
||
if ((sender as CheckBox).Checked == true)
|
||
{
|
||
foreach (CheckBox chk in (sender as CheckBox).Parent.Controls)
|
||
{
|
||
chk.CheckedChanged -= new EventHandler(txt_Leave);
|
||
if (chk != sender)
|
||
{
|
||
chk.Checked = false;
|
||
}
|
||
chk.CheckedChanged += new EventHandler(txt_Leave);
|
||
}
|
||
}
|
||
}
|
||
bool updateOk = true;
|
||
|
||
string text = "";
|
||
string value = "";
|
||
if (!updateOk)
|
||
{
|
||
if (ableEdit.ControlType == EControlType.RadioButtonList)
|
||
ableEdit.IsVisible = true;
|
||
else
|
||
ableEdit.IsVisible = !ableEdit.IsVisible;
|
||
}
|
||
else
|
||
{
|
||
if (ableEdit.ControlType == EControlType.RadioButtonList)
|
||
{
|
||
//设置属性的值
|
||
ableEdit.IsVisible = true;
|
||
foreach (Control conl in ableEdit.CControl.Controls)
|
||
{
|
||
string spanT = "";
|
||
if (ableEdit.DfArrangement == EIsBool.True)
|
||
{
|
||
if (spanT.Length - conl.Text.Length >= conl.Text.Length)
|
||
{
|
||
spanT = spanT.Remove(spanT.Length - conl.Text.Length, conl.Text.Length);
|
||
}
|
||
}
|
||
CheckBox radio = conl as CheckBox;
|
||
if (radio.Checked)
|
||
{
|
||
text += "☑" + conl.Text + spanT;
|
||
value = conl.Text;
|
||
}
|
||
else
|
||
{
|
||
text += "□" + conl.Text + spanT;
|
||
}
|
||
}
|
||
template.SetObjValue(OpeRecord, ableEdit.ClassDataSourceName, text, value, true);
|
||
}
|
||
else
|
||
{
|
||
text = control.Text.Trim();
|
||
value = control.Text.Trim();
|
||
//设置属性的值
|
||
ableEdit.IsVisible = !ableEdit.IsVisible;
|
||
template.SetObjValue(OpeRecord, DataSourceName, text, value, true);
|
||
((TextBox)control).BorderStyle = BorderStyle.None;
|
||
if (DataSourceName == "OperationRecord.Height" || DataSourceName == "OperationRecord.Weight")
|
||
{
|
||
SetBMI(true);
|
||
}
|
||
|
||
}
|
||
////设置属性的值
|
||
//ableEdit.IsVisible = !ableEdit.IsVisible;
|
||
//template.SetObjValue(OpeRecord, DataSourceName, text, value, true);
|
||
//((TextBox)control).BorderStyle = BorderStyle.None;
|
||
//if (DataSourceName == "OperationRecord.Height" || DataSourceName == "OperationRecord.Weight")
|
||
//{
|
||
// SetBMI(true);
|
||
//}
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
//写日志
|
||
PublicMethod.WriteLog(ex);
|
||
}
|
||
finally
|
||
{
|
||
}
|
||
}
|
||
#endregion
|
||
//得到当前页数
|
||
private void GetcurrentPage()
|
||
{
|
||
DateTime EndTime = OperationRecord.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;
|
||
}
|
||
//设置打印模式,组件不显示
|
||
public override void setPrint(bool isVisible)
|
||
{
|
||
//预览状态时所可编辑组件的组件隐藏
|
||
List<PackObjBase> ables = PackManage.ListPob.Where<PackObjBase>(s => s is AbleEditPackObj).ToList<PackObjBase>();
|
||
foreach (PackObjBase pack1 in ables)
|
||
{
|
||
AbleEditPackObj ableEdit = pack1 as AbleEditPackObj;
|
||
|
||
if (ableEdit.ControlType == EControlType.RadioButtonList)
|
||
if (ableEdit != null)
|
||
{
|
||
ableEdit.IsVisible = isVisible;
|
||
if (isVisible == true)
|
||
{
|
||
ableEdit.IsViewBoard = EIsBool.True;
|
||
|
||
}
|
||
else
|
||
{
|
||
ableEdit.IsViewBoard = EIsBool.False;
|
||
ableEdit.Draw();
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|