AIMS/AIMSEntity/AreaManage/BaseInfoBottomManage.cs
2022-08-23 21:12:59 +08:00

412 lines
18 KiB
C#
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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 BaseInfoBottomManage : AreaManageBase
{
private OperationRecord myOpeRecord = null;
public BaseInfoBottomManage() { }
public BaseInfoBottomManage(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)
{
//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)
{
}
public override void Bind()
{
init();
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.DiagnoseRemark != null && myOpeRecord.DiagnoseRemark != "")
{
string text = DocumentEntityMethod.GetDictionaryValuesById(myOpeRecord.Diagnose, "诊断");
//设置属性的值
text = text + (" (" + myOpeRecord.DiagnoseRemark + ")");
template.SetObjValue(myOpeRecord, "OperationRecord.Diagnose", text, myOpeRecord.Diagnose.ToString());
}
if (myOpeRecord.OPerationRemark != null && myOpeRecord.OPerationRemark != "")
{
string text = DocumentEntityMethod.GetDictionaryValuesById(myOpeRecord.Operation, "手术");
//设置属性的值
text = text + (" (" + myOpeRecord.OPerationRemark + ")");
template.SetObjValue(myOpeRecord, "OperationRecord.Operation", text, myOpeRecord.Operation.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;
}
}
}
#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);
//根据数据源名称进行不同的事件处理
switch (aEdit1.ClassDataSourceName)
{
case "OperationRecord.OperationAnalgesiaMode":
TYZD_Click(aEdit1, e);
break;
case "OperationRecord.AnaesthesiaMethodId":
Anaes_Click(aEdit1, e);
break;
case "OperationRecord.AnesthesiaDoctor": //麻醉医生
Worker_Click(aEdit1, e, 2);
break;
case "OperationRecord.ExtracorporealCirculation": //麻醉医生
Workerqm_Click(aEdit1, e, 2);
break;
case "OperationRecord.OperationDoctor":
Worker_Click(aEdit1, e, 0);
break;
case "OperationRecord.InstrumentNurse":
Worker_Click(aEdit1, e, 1);
break;
case "OperationRecord.Assistant1":
Worker_Click(aEdit1, e, 0);
break;
case "OperationRecord.TourNurse":
Worker_Click(aEdit1, e, 1);
break;
case "OperationRecord.Diagnose": //手术诊断
opeDisease_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
{
}
}
#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.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.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.DiagnoseRemark", fsi.txtRemark.Text, fsi.txtRemark.Text, 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.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.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.OPerationRemark", frmso.txtRemark.Text, frmso.txtRemark.Text, true);
}
}
catch (Exception exp)
{
}
}
private void Worker_Click(AbleEditPackObj sender, EventArgs e, int _workersType)
{
AbleEditPackObj ableEdit = sender;
if (ableEdit == null) return;
try
{
if (myOpeRecord != null)
{
//frmSelectWorkers_New fsw = new frmSelectWorkers_New();
//fsw._controlName = new KeyValuePair<string, string>(ableEdit.PackValue, ableEdit.PackText);
//fsw._workersType = _workersType;
//fsw.isRadio = false;
//fsw.isAddItem = false;
//fsw.ShowDialog();
//ableEdit.PackValue = fsw._controlName.Key.ToString();
//ableEdit.PackText = fsw._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 Workerqm_Click(AbleEditPackObj sender, EventArgs e, int _workersType)
{
AbleEditPackObj ableEdit = sender;
if (ableEdit == null) return;
try
{
if (myOpeRecord != null)
{
//KeyValuePair<string, string> _controlName = new KeyValuePair<string, string>(ableEdit.PackValue, ableEdit.PackText);
//KeyValuePair<string, string> keyValuePairs = PublicToZed.SelectWorker(ableEdit.PackTag, _controlName, _workersType, PublicMethod.Operator.DepartmentId.Value, true);
//ableEdit.PackValue = keyValuePairs.Key.ToString();
//ableEdit.PackText = keyValuePairs.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 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 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)
{
//写日志
}
finally
{
}
}
#endregion
}
}