AIMS/AIMSControls/OperationAanesthesia/frmInstrumentRecord3.cs
2023-08-29 15:44:47 +08:00

2262 lines
102 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

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 AIMS.DocManager;
using AIMS.OperationFront.UI;
using AIMS.OremrUserControl;
using AIMS.PublicUI.UI;
using AIMSBLL;
using AIMSExtension;
using AIMSModel;
using DCSoft.Writer;
using DCSoft.Writer.Data;
using DCSoft.Writer.Dom;
using DevComponents.Editors.DateTimeAdv;
using DocumentManagement;
using DrawGraph;
using HelperDB;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Reflection;
using System.Windows.Forms;
using System.Xml;
namespace AIMS.OperationAanesthesia
{
public partial class frmInstrumentRecord3 : Form
{
#region
public OperationRecord _record;
public AIMSModel.OperationRoom NowRoom;
private DataTable _appliance;
private DataTable _appliance2;
private List<ApplianceUseType> _applianceUseType;
private List<ApplianceUseType> _applianceUseType2;
public int PatientId = 0;
public int ApplyId = 0;
public int RecoverId = 1;
private System.Windows.Forms.Timer timerGetTextCollectorData;
public AIMSExtension.EditState State;
public bool isReadOnly = false;
public List<string> QXList;
//模板Model
private PrintTemplate TModel = new PrintTemplate();
private PrintTemplate TModel2 = new PrintTemplate();
//文档Model
private PrintDocument DModel = new PrintDocument();
private PrintDocument DModel2 = new PrintDocument();
//患者Id
public PatientRecord Patient = new PatientRecord();
//容器tab
//public TabItem Tb;
//文档事件
private EventCodeCompilerBill codeCompiler;
private string strClick, strContentChanged;
public frmInstrumentRecord3()
{
InitializeComponent();
#region
this.picInRoom.BackgroundImage = global::AIMSControls.Properties.Resources.;
this.picOpeBegin.BackgroundImage = global::AIMSControls.Properties.Resources.;
this.picOpeEnd.BackgroundImage = global::AIMSControls.Properties.Resources.;
this.picOutRoom.BackgroundImage = global::AIMSControls.Properties.Resources.;
#endregion
}
private void frmAnasRecordInstrument_Load(object sender, EventArgs e)
{
labOperatorName.Text = "(" + AIMSExtension.PublicMethod.OperatorNo + ")" + " " + AIMSExtension.PublicMethod.OperatorName;
if (NowRoom != null) lblRoom.Text = NowRoom.Name;
//this.MaximizeBox = false;
//this.MinimizeBox = false;
if (PublicMethod.OperatorNo == "admin" || PublicMethod.RoleName.Contains("护士收费记录"))
{
btnChage.Visible = true;
}
if (PublicMethod.OperatorNo == "admin" || PublicMethod.RoleName.Contains("数据中心"))
{
btnsjzx.Visible = true;
}
if (PublicMethod.OperatorNo == "admin" || PublicMethod.RoleName.Contains("大屏通知"))
{
btndptz.Visible = true;
}
if (PublicMethod.HospitalName.Contains("漳浦天福"))
{
QXList = new List<string>() {
"1","2","3","4","5","6","7","8","9","10","11","12","13","14","15"
};
}
else
{
QXList = new List<string>() {
"1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","61","62","63",
"21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","64","65","66",
"41","42","43","44","45","46","47","48","49","50","51","52","53","54","55","56","57","58","59","60","67","68","69"
};
}
//myEditControl初始化
myEditControl.MoveFocusHotKey = MoveFocusHotKeys.Tab;
myEditControl.HeaderFooterReadonly = true;
myEditControl.CommandControler = this.writerCommandControler1;
writerCommandControler1.Start();
//表单视图模式
myEditControl.FormView = DCSoft.Writer.Controls.FormViewMode.Strict;
//加载知识库
//DocumentDAL.LoadKBLibaray();
myEditControl.ExecuteCommand("LoadKBLibrary", false, DocumentDAL.Lib);
// 注册自定义的输入域下拉列表提供者
myEditControl.AppHost.Services.AddService(
typeof(IListItemsProvider),
new MyListItemsProvider());
//// 设置文档处于调试模式
//myEditControl.DocumentOptions.BehaviorOptions.DebugMode = true;
//myEditControl.DocumentOptions.BehaviorOptions.InsertCommentBindingUserTrack = true;
//启用逻辑删除、权限控制
myEditControl.Document.Options.SecurityOptions.EnablePermission = true;
myEditControl.Document.Options.SecurityOptions.EnableLogicDelete = true;
myEditControl.Document.Options.SecurityOptions.ShowLogicDeletedContent = true;
myEditControl.Document.Options.SecurityOptions.ShowPermissionMark = true;
myEditControl.Document.Options.SecurityOptions.ShowPermissionTip = true;
//myEditControl2初始化
myEditControl2.MoveFocusHotKey = MoveFocusHotKeys.Tab;
myEditControl2.HeaderFooterReadonly = true;
myEditControl2.CommandControler = this.writerCommandControler1;
writerCommandControler1.Start();
//表单视图模式
myEditControl2.FormView = DCSoft.Writer.Controls.FormViewMode.Strict;
//加载知识库
//DocumentDAL.LoadKBLibaray();
myEditControl2.ExecuteCommand("LoadKBLibrary", false, DocumentDAL.Lib);
// 注册自定义的输入域下拉列表提供者
myEditControl2.AppHost.Services.AddService(
typeof(IListItemsProvider),
new MyListItemsProvider());
//// 设置文档处于调试模式
//myEditControl2.DocumentOptions.BehaviorOptions.DebugMode = true;
//myEditControl2.DocumentOptions.BehaviorOptions.InsertCommentBindingUserTrack = true;
//启用逻辑删除、权限控制
myEditControl2.Document.Options.SecurityOptions.EnablePermission = true;
myEditControl2.Document.Options.SecurityOptions.EnableLogicDelete = true;
myEditControl2.Document.Options.SecurityOptions.ShowLogicDeletedContent = true;
myEditControl2.Document.Options.SecurityOptions.ShowPermissionMark = true;
myEditControl2.Document.Options.SecurityOptions.ShowPermissionTip = true;
LoadAnesRescue();
}
#endregion
#region
/// <summary>
/// 手术特殊事件时间点处理事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public void txtDateTime_MouseDown(object sender, MouseEventArgs e)
{
if (PatientId == 0) return;
DateTimeInput tb = sender as DateTimeInput;
if (_record != null && _record.OutRoomTime != null)
{
if ((tb.Name == "txtBG" || tb.Name == "txtCG") && tb.Text.Trim() == "")
{
return;
}
}
if (tb.Text.Trim() == "" && tb.CustomFormat == " ")
{
tb.BackColor = Color.White;
SetPic(sender);
}
else
{
tb.CustomFormat = "HH:mm";
tb.ButtonDropDown.Visible = true;
}
}
private void txtDateTime_LostFocus(object sender, EventArgs e)
{
if (PatientId == 0) return;
DateTimeInput tb = sender as DateTimeInput;
if (tb.CustomFormat == "HH:mm")
{
if (tb.Name == "txtInRoom" || tb.Name == "txtOutRoom")
{
tb.CustomFormat = "MM-dd HH:mm";
}
tb.ButtonDropDown.Visible = false;
}
if (tb.Text.Trim() != "" && tb.Value.ToString() != tb.Tag.ToString())
{
try
{
SetPic(sender, tb.Value);
tb.BackColor = Color.White;
}
catch (Exception)
{
tb.Focus();
tb.Value = DateTime.Parse(tb.Tag.ToString());
return;
}
}
else
{
if (tb.Tag != null && tb.Tag.ToString() != "")
tb.Value = DateTime.Parse(tb.Tag.ToString());
}
}
private void dateTimePicker_KeyUp(object sender, KeyEventArgs e)
{
if (PatientId == 0) return;
DateTimeInput dtpak = (DateTimeInput)sender;
if (e.KeyCode == Keys.Delete || e.KeyCode == Keys.Back)
{
if (dtpak.CustomFormat != " " && dtpak.Tag != null)
{
try
{
SetPic((DateTimeInput)sender);
}
catch (Exception)
{
return;
}
}
}
}
/// <summary>
/// 特殊事件触发时设置图片
/// </summary>
/// <param name="obj">显示时间的控件</param>
private void SetPic(Object obj)
{
DrawGraph.FactEvents Inevent = null;
DateTimeInput tb = obj as DateTimeInput;
DateTime nowtime = DateTime.Now;// getOpeMaxTime();
DateTime curTimeTemp = new DateTime(nowtime.Year, nowtime.Month, nowtime.Day, nowtime.Hour, nowtime.Minute, 0);
InsertOrUpdateEventTime(0, "txtInRoom", "入室", tb, curTimeTemp, ref Inevent);
curTimeTemp = curTimeTemp.AddSeconds(2);
InsertOrUpdateEventTime(0, "txtOperationBegin", "手术开始", tb, curTimeTemp, ref Inevent);
curTimeTemp = curTimeTemp.AddSeconds(2);
InsertOrUpdateEventTime(0, "txtOperationEnd", "手术结束", tb, curTimeTemp, ref Inevent);
curTimeTemp = curTimeTemp.AddSeconds(2);
InsertOrUpdateEventTime(0, "txtOutRoom", "出室", tb, curTimeTemp, ref Inevent);
if (Inevent != null)
{
_record.FactEventsList.Add(Inevent);
ReviewEvent();
PublicMethod.WriteLog(Inevent.EventName, _record.PatientId.Value, 1, "护理");
}
}
/// <summary>
/// 特殊事件触发时设置图片
/// </summary>
/// <param name="obj">显示时间的控件</param>
private void SetPic(Object obj, DateTime curTimeTemp)
{
DrawGraph.FactEvents Inevent = null;
DateTimeInput tb = obj as DateTimeInput;
curTimeTemp = new DateTime(curTimeTemp.Year, curTimeTemp.Month, curTimeTemp.Day, curTimeTemp.Hour, curTimeTemp.Minute, 0);
InsertOrUpdateEventTime(1, "txtInRoom", "入室", tb, curTimeTemp, ref Inevent);
curTimeTemp = curTimeTemp.AddSeconds(2);
InsertOrUpdateEventTime(1, "txtOperationBegin", "手术开始", tb, curTimeTemp, ref Inevent);
curTimeTemp = curTimeTemp.AddSeconds(2);
InsertOrUpdateEventTime(1, "txtOperationEnd", "手术结束", tb, curTimeTemp, ref Inevent);
curTimeTemp = curTimeTemp.AddSeconds(2);
InsertOrUpdateEventTime(1, "txtOutRoom", "出室", tb, curTimeTemp, ref Inevent);
if (Inevent != null)
{
ReviewEvent();
PublicMethod.WriteLog("修改" + Inevent.EventName, _record.PatientId.Value, 1, "护理");
}
}
/// <summary>
/// 特殊事件触发时设置图片
/// </summary>
/// <param name="obj">显示时间的控件</param>
private void SetPic(DateTimeInput obj)
{
DrawGraph.FactEvents Inevent = null;
DateTimeInput tb = obj as DateTimeInput;
if (_record.StateName == "手术中")
{
DeleteEventTime("txtOperationBegin", "手术开始", tb, ref Inevent);
DeleteEventTime("txtOperationEnd", "手术结束", tb, ref Inevent);
DeleteEventTime("txtBG", "拔管", tb, ref Inevent);
}
else
{
MessageBox.Show("选择的事件不可删除 只可修改!");
}
if (Inevent != null)
{
tb.ButtonDropDown.Visible = false;
_record.FactEventsList.Remove(Inevent);
ReviewEvent();
PublicMethod.WriteLog("删除" + Inevent.EventName, _record.PatientId.Value, 1, "护理");
}
}
/// <summary>
/// 判断控件对应的事件 删除事件
/// </summary>
/// <param name="EventTxtName">事件对应的控件名称</param>
/// <param name="EventName">事件名称</param>
/// <param name="tb">控件</param>
private void DeleteEventTime(string EventTxtName, string EventName, DateTimeInput tb, ref DrawGraph.FactEvents Inevent)
{
if (tb.Name.Equals(EventTxtName))
{
List<DrawGraph.FactEvents> list = _record.FactEventsList.Where(c => c.EventName == EventName).ToList();
if (list.Count <= 0) return;
Inevent = list[0];
if (EventName == "入室" || EventName == "出室")
{
//PublicMethod.ShowMessage("该事件为主要事件 不可删除 只可修改!!");
tb.Value = Inevent.EventBeginTime.Value;
Inevent = null;
return;
}
BFactEvents.DeleteById(Inevent.Id.ToString());
tb.CustomFormat = " ";
tb.Value = DateTime.Now;
tb.Tag = null;
if (Inevent != null && Inevent.EventName == "手术开始")
{
_record.OperationBeginTime = null;
this.picOpeBegin.BackgroundImage = global::AIMSControls.Properties.Resources.;
BOperationRecord.Update(" OperationBeginTime=null where Id=@id ", new AIMSModel.ParameterList("@id", _record.Id));
}
if (Inevent != null && Inevent.EventName == "手术结束")
{
_record.OperationEndTime = null;
this.picOpeEnd.BackgroundImage = global::AIMSControls.Properties.Resources.;
BOperationRecord.Update(" OperationEndTime=null where Id=@id ", new AIMSModel.ParameterList("@id", _record.Id));
}
}
}
/// <summary>
/// 判断控件对应的事件 插入事件
/// </summary>
/// <param name="state">0插入 1更新</param>
/// <param name="EventTxtName">事件对应的控件名称</param>
/// <param name="EventName">事件名称</param>
/// <param name="EventTime">事件对应的对象时间</param>
/// <param name="tb">控件</param>
/// <param name="curTimeTemp">事件时间</param>
/// <param name="Inevent">事件对象</param>
private void InsertOrUpdateEventTime(int state, string EventTxtName, string EventName, DateTimeInput tb, DateTime curTimeTemp, ref DrawGraph.FactEvents Inevent)
{
if (tb.Name.Equals(EventTxtName))
{
string messing = "";
bool timeistrue = true;
timeistrue = BOperationRecord.IfTimeisTrue(true, _record, EventName, curTimeTemp, ref messing);
if (_record.StateName != null && _record.StateName != "手术中")
{
if (messing != "")
{
MessageBox.Show(messing);
}
}
else
{ timeistrue = true; }
if (EventName == "出室" && _record.StateName == "手术中" && state == 0)
{
if (GetOpeState(ref messing) == false)
{
if (messing != "") MessageBox.Show(messing, "系统提示");
if (messing == "请与手术信息选择手术分级!" || messing == "请与手术信息选择手术切口!")
btnOperationInfo_Click(null, null);
return;
}
}
if (timeistrue == false)
{
if (tb.Tag != null) tb.Value = DateTime.Parse(tb.Tag.ToString());
return;
}
if (EventName == "出室" && curTimeTemp.ToString("yyyy-MM-dd HH:mm") == _record.lastPageBegin.ToString("yyyy-MM-dd HH:mm"))
{
curTimeTemp = _record.lastPageBegin;
}
if (state != 1)
{
Inevent = BFactEvents.Insert(PatientId, EventName, curTimeTemp, curTimeTemp, RecoverId);
}
else
{
updateEventTime(EventName, curTimeTemp, ref Inevent);
}
tb.Value = curTimeTemp;
tb.Tag = curTimeTemp;
if (Inevent != null && Inevent.EventName == "入室" && _record.InRoomTime != Inevent.EventBeginTime)
{
_record.InRoomTime = Inevent.EventBeginTime;
this.picInRoom.BackgroundImage = global::AIMSControls.Properties.Resources._select;
BOperationRecord.Update("InRoomTime=@InRoom where Id=@id ", new AIMSModel.ParameterList("@InRoom", _record.InRoomTime.Value.ToString("yyyy-MM-dd HH:mm:ss"), "@id", _record.Id));
}
if (Inevent != null && Inevent.EventName == "手术开始" && _record.OperationBeginTime != Inevent.EventBeginTime)
{
_record.OperationBeginTime = Inevent.EventBeginTime;
this.picOpeBegin.BackgroundImage = global::AIMSControls.Properties.Resources._select;
BOperationRecord.Update("OperationBeginTime=@OperationBegin where Id=@id ", new AIMSModel.ParameterList("@OperationBegin", _record.OperationBeginTime.Value.ToString("yyyy-MM-dd HH:mm:ss"), "@id", _record.Id));
}
if (Inevent != null && Inevent.EventName == "手术结束" && _record.OperationEndTime != Inevent.EventBeginTime)
{
_record.OperationEndTime = Inevent.EventBeginTime;
this.picOpeEnd.BackgroundImage = global::AIMSControls.Properties.Resources._select;
BOperationRecord.Update("OperationEndTime=@OperationEnd where Id=@id ", new AIMSModel.ParameterList("@OperationEnd", _record.OperationEndTime.Value.ToString("yyyy-MM-dd HH:mm:ss"), "@id", _record.Id));
}
if (Inevent != null && Inevent.EventName == "出室" && _record.OutRoomTime != Inevent.EventBeginTime)
{
_record.OutRoomTime = Inevent.EventBeginTime;
this.picOutRoom.BackgroundImage = global::AIMSControls.Properties.Resources._select;
BOperationRecord.Update("OutRoomTime=@OutRoom where Id=@id ", new AIMSModel.ParameterList("@OutRoom", _record.OutRoomTime.Value.ToString("yyyy-MM-dd HH:mm:ss"), "@id", _record.Id));
}
}
}
/// <summary>
/// 修改事件时间
/// </summary>
/// <param name="eventName"></param>
/// <param name="dt"></param>
public void updateEventTime(string eventName, DateTime dt, ref DrawGraph.FactEvents elist)
{
List<DrawGraph.FactEvents> list = _record.FactEventsList.Where(c => c.EventName == eventName).ToList();
if (list.Count <= 0) return;
elist = list[0];
if (elist.EventBeginTime != dt)
{
elist.EventBeginTime = dt;
elist.EventEndTime = dt;
BFactEvents.Update("EventBeginTime=@EventBeginTime,EventEndTime=@EventEndTime where id=@id ", new AIMSModel.ParameterList("@EventBeginTime", elist.EventBeginTime, "@EventEndTime", elist.EventEndTime, "@id", elist.Id));
}
}
#endregion
#region
private void panel8_Scroll(object sender, ScrollEventArgs e)
{
//templateManage.SetPYL();
}
private void plRefresh_Click(object sender, EventArgs e)
{
if (PatientId == 0) return;
//刷新到当前页
ReviewEvent();
}
#endregion
#region
private void btnSelectPatient_Click(object sender, EventArgs e)
{
OperationAanesthesia.frmSelectPatientGoodsBill3 frmSelectPatient = new frmSelectPatientGoodsBill3();
frmSelectPatient.isMainOpen = true;
frmSelectPatient.tempfrmAnasRecord = this;
frmSelectPatient.FormClosed += new FormClosedEventHandler(frmSelectPatient_FormClosed);
frmSelectPatient.ShowDialog();
}
void frmSelectPatient_FormClosed(object sender, FormClosedEventArgs e)
{
LoadAnesRescue();
}
//private System.Windows.Forms.Timer timerLoadAnesRescue;
public void LoadAnesRescue()
{
//timerLoadAnesRescue = new System.Windows.Forms.Timer(components);
//timerLoadAnesRescue.Enabled = true;//调试时设置为FALSE
//timerLoadAnesRescue.Interval = 300;
//timerLoadAnesRescue.Tick -= TimerLoadAnesRescue_Tick;
//timerLoadAnesRescue.Tick += TimerLoadAnesRescue_Tick;
//timerLoadAnesRescue.Start();
TimerLoadAnesRescue_Tick(null, null);
}
private void TimerLoadAnesRescue_Tick(object sender, EventArgs e)
{
//timerLoadAnesRescue.Dispose();
if (PatientId > 0 && State == AIMSExtension.EditState.ADD)
{
try
{
HelperDB.DbHelperSQL.BeginTrans();
_record = new OperationRecord();
_record.OperationApplyId = ApplyId;
_record.PatientId = PatientId;
_record.RecoverId = RecoverId;
_record.Id = BOperationRecord.AddTitleTime(PatientId, ApplyId, RecoverId, 1, DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd HH:mm:00")), NowRoom.Id.Value);
SelectPatient.UpdateApplyState(PatientId, ApplyId); //修改状态
HelperDB.DbHelperSQL.CommitTrans();
ClearTimeText();
btnSelectPatient.Enabled = false;
_record = BOperationRecord.getRecord(_record, -1, 2);
Patient = PatientRecord.GetPatientRecord(PatientId);
DModel = DocumentDAL.GetDocumentbyName("介入手术室清点器械记录单", Patient.PatientId);
LoadDocumentGoodsBill();
DModel2 = DocumentDAL.GetDocumentbyName("介入手术护理记录单", Patient.PatientId);
LoadDocumentGoodsBill2();
PublicMethod.WriteLog("入手术间", _record.PatientId.Value, 1, "护理");
StartTimer();
}
catch
{
HelperDB.DbHelperSQL.RollbackTrans();
}
}
else if (PatientId > 0 && State == AIMSExtension.EditState.EDIT)
{
_record = new OperationRecord();
btnSelectPatient.Enabled = false; //清空记录点并重新加载
ClearTimeText();
_record = BOperationRecord.getRecord(_record, -1, 2);
Patient = PatientRecord.GetPatientRecord(PatientId);
DModel = DocumentDAL.GetDocumentbyName("介入手术室清点器械记录单", Patient.PatientId);
LoadDocumentGoodsBill();
DModel2 = DocumentDAL.GetDocumentbyName("介入手术护理记录单", Patient.PatientId);
LoadDocumentGoodsBill2();
StartTimer();
}
else if (PatientId > 0 && State == AIMSExtension.EditState.BROWSE)
{
_record = new OperationRecord();
btnSelectPatient.Enabled = true;
btnCancelOperation.Enabled = false;
btnCancelIn.Enabled = false;
ClearTimeText();
_record = BOperationRecord.getRecord(_record, -1, 2);
Patient = PatientRecord.GetPatientRecord(PatientId);
DModel = DocumentDAL.GetDocumentbyName("介入手术室清点器械记录单", Patient.PatientId);
LoadDocumentGoodsBill();
DModel2 = DocumentDAL.GetDocumentbyName("介入手术护理记录单", Patient.PatientId);
LoadDocumentGoodsBill2();
StartTimer();
}
if (_record.InstrumentList != null && _record.InstrumentList.Id != null && _record.InstrumentList.ApplianceUseType != null)
{
LoadOperationGoodsBillRecord();
}
else
{
FirstbtnEnter();
}
codeCompiler.IsLoad = true;
plRefresh_Click(null, null);
if (_record.MedicalRecord != null && _record.MedicalRecord != "")
{
btnOperationInfo.Enabled = false;
btnOutputLiquids.Enabled = false;
btnDrug.Enabled = false;
btnAddEvents.Enabled = false;
button6.Enabled = false;
btnBloodGasAnalysis.Enabled = false;
txtInRoom.Enabled = false;
txtOperationBegin.Enabled = false;
txtOperationEnd.Enabled = false;
txtOutRoom.Enabled = false;
isReadOnly = true;
}
txtInRoom.MouseDown += new MouseEventHandler(txtDateTime_MouseDown);
txtOutRoom.MouseDown += new MouseEventHandler(txtDateTime_MouseDown);
txtOperationBegin.MouseDown += new MouseEventHandler(txtDateTime_MouseDown);
txtOperationEnd.MouseDown += new MouseEventHandler(txtDateTime_MouseDown);
txtOperationBegin.KeyUp += new KeyEventHandler(dateTimePicker_KeyUp);
txtOperationEnd.KeyUp += new KeyEventHandler(dateTimePicker_KeyUp);
txtInRoom.LostFocus += new EventHandler(txtDateTime_LostFocus);
txtOutRoom.LostFocus += new EventHandler(txtDateTime_LostFocus);
txtOperationBegin.LostFocus += new EventHandler(txtDateTime_LostFocus);
txtOperationEnd.LostFocus += new EventHandler(txtDateTime_LostFocus);
}
private void btnOperationInfo_Click(object sender, EventArgs e)
{
if (PatientId != 0)
{
AIMS.OperationAanesthesia.frmOperationInfoNew2 frmOperationInfo = new frmOperationInfoNew2();
frmOperationInfo._record = _record;
//frmOperationInfo.FormClosed += new FormClosedEventHandler(plRefresh_Click);
frmOperationInfo.ShowDialog();
}
else
{
MessageBox.Show("请选择患者");
}
}
private void btnDrug_Click(object sender, EventArgs e)
{
if (PatientId != 0)
{
PublicUI.UI.frmFactDrugNew frmFactDrug = new PublicUI.UI.frmFactDrugNew();
frmFactDrug._record = _record;
frmFactDrug.DrugTypeId = RecoverId; // 事件类型 1 麻醉单事件 2 麻醉恢复单
frmFactDrug.FormClosed += new FormClosedEventHandler(frmFactEventsNew_FormClosed);
frmFactDrug.ShowDialog();
}
else
{
MessageBox.Show("请选择患者");
}
}
private void btnAddEvents_Click(object sender, EventArgs e)
{
if (PatientId != 0)
{
PublicUI.UI.frmFactEventsNew frmFactEventsNew = new PublicUI.UI.frmFactEventsNew();
frmFactEventsNew._record = _record;
frmFactEventsNew.EventTypeId = RecoverId; // 事件类型 1 麻醉单事件 2 麻醉恢复单
frmFactEventsNew.EventParam += ReferEventDrugs;
frmFactEventsNew.ShowDialog();
}
else
{
MessageBox.Show("请选择患者");
}
}
private void btnOutputLiquids_Click(object sender, EventArgs e)
{
if (PatientId != 0)
{
PublicUI.UI.frmFactOutputLiquidsNew frmFactOutputLiquids = new PublicUI.UI.frmFactOutputLiquidsNew();
frmFactOutputLiquids._record = _record;
frmFactOutputLiquids.OutputLiquidTypeId = RecoverId; // 事件类型 1 麻醉单事件 2 麻醉恢复单
frmFactOutputLiquids.FormClosed += new FormClosedEventHandler(frmFactEventsNew_FormClosed);
frmFactOutputLiquids.ShowDialog();
}
else
{
MessageBox.Show("请选择患者");
}
}
private void button6_Click(object sender, EventArgs e)
{
frmAanesthesiaQuality frmAnaseDataQuality = new frmAanesthesiaQuality();
frmAnaseDataQuality._record = _record;
frmAnaseDataQuality.ShowDialog();
}
void frmFactEventsNew_FormClosed(object sender, FormClosedEventArgs e)
{
plRefresh_Click(null, null);
}
private void btnCancelOperation_Click(object sender, EventArgs e)
{
if (PatientId == 0)
{
MessageBox.Show("请选择患者!");
return;
}
if (BOperationRecord.GetDataCount(_record.Id.Value, PatientId, RecoverId) > 0)
{
MessageBox.Show("清除数据在进行作废手术操作!");
return;
}
if (MessageBox.Show("确认要停止手术吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
try
{
HelperDB.DbHelperSQL.BeginTrans();
BOperationApply.UpdateApplyState(ApplyId, 11);
//BOperationRecord.DeleteOperationRecordData(PatientId, RecoverId);
BOperationRecord.UpdateState(PatientId, 1, 5);
HelperDB.DbHelperSQL.CommitTrans();
//ClearData();
this.Close();
}
catch
{
HelperDB.DbHelperSQL.RollbackTrans();
}
}
}
private void btnCancelIn_Click(object sender, EventArgs e)
{
if (PatientId == 0)
{
MessageBox.Show("请选择患者!");
return;
}
if (BOperationRecord.GetDataCount(_record.Id.Value, PatientId, RecoverId) > 0)
{
MessageBox.Show("清除数据在进行取消转入操作!");
return;
}
if (MessageBox.Show("确认要取消转入吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
try
{
HelperDB.DbHelperSQL.BeginTrans();
BOperationApply.UpdateApplyState(ApplyId, 5);
BOperationRecord.DeleteOperationRecordData(_record.Id.Value, PatientId, RecoverId);
HelperDB.DbHelperSQL.CommitTrans();
PublicMethod.WriteLog("取消转入", _record.PatientId.Value, 0, "护理");
DisposeTimer();
//ClearData();
this.Close();
}
catch
{
HelperDB.DbHelperSQL.RollbackTrans();
}
}
}
private void btnTemplate_Click(object sender, EventArgs e)
{
if (_applianceUseType == null)
_applianceUseType = new List<ApplianceUseType>();
frmSelectApplianceUseType ReturnApply = new frmSelectApplianceUseType();
ReturnApply._SelectApplianceUseType = _applianceUseType;
ReturnApply.IsRedio = false;
ReturnApply.IsLoadOne = false;
DialogResult ddr = ReturnApply.ShowDialog();
_appliance = ReturnApply._appliance;
if (ddr == System.Windows.Forms.DialogResult.OK && _appliance != null && _applianceUseType.Count > 1)
{
Incount = 9;
FullUcControlsToPanel(QXList, _appliance, _record.InstrumentList, ref i1, ref j1);
for (int nulli = Incount; nulli < QXList.Count; nulli++)
{
var BillText = myEditControl.Document.Fields.ToArray().Where(x => x is XTextInputFieldElement
&& (x as XTextInputFieldElement).Name == QXList[nulli]).FirstOrDefault();
if (BillText != null && BillText.Text != "")
{
BillText.Text = "";
BillText.FormulaValue = "";
BillText.InnerText = "";
var BillText2 = myEditControl.Document.Fields.ToArray().Where(x => x is XTextInputFieldElement
&& (x as XTextInputFieldElement).Name == QXList[nulli] + "A").FirstOrDefault();
if (BillText2 != null && BillText2.Text != "")
{
BillText2.Text = "";
BillText2.FormulaValue = "";
BillText2.InnerText = "";
}
var BillText3 = myEditControl.Document.Fields.ToArray().Where(x => x is XTextInputFieldElement
&& (x as XTextInputFieldElement).Name == QXList[nulli] + "B").FirstOrDefault();
if (BillText3 != null && BillText3.Text != "")
{
BillText3.Text = "";
BillText3.FormulaValue = "";
BillText3.InnerText = "";
}
var BillText4 = myEditControl.Document.Fields.ToArray().Where(x => x is XTextInputFieldElement
&& (x as XTextInputFieldElement).Name == QXList[nulli] + "C").FirstOrDefault();
if (BillText4 != null && BillText4.Text != "")
{
BillText4.Text = "";
BillText4.FormulaValue = "";
BillText4.InnerText = "";
}
var BillText5 = myEditControl.Document.Fields.ToArray().Where(x => x is XTextInputFieldElement
&& (x as XTextInputFieldElement).Name == QXList[nulli] + "D").FirstOrDefault();
if (BillText5 != null && BillText5.Text != "")
{
BillText5.Text = "";
BillText5.FormulaValue = "";
BillText5.InnerText = "";
}
}
}
myEditControl.Document.EditorRefreshView();
}
}
private void tsbExePlan_Click(object sender, EventArgs e)
{
if (PatientId == 0)
{
MessageBox.Show("请先选择患者!");
return;
}
if (_record.Applydiagnose == null || _record.Applydiagnose == "")
{
MessageBox.Show("请选择诊断后再填写文书!", "系统提示");
ModifyApply_Click(null, null);
return;
}
PatientRecord patient = PatientRecord.GetPatientRecord(PatientId);
frmDocument frmDocument = new frmDocument(patient);
frmDocument.StartPosition = FormStartPosition.CenterScreen;
frmDocument.WindowState = FormWindowState.Maximized;
frmDocument.ShowDialog();
}
void toolStripMenuItem2_Click(object sender, EventArgs e)
{
}
private void btnBloodGasAnalysis_Click(object sender, EventArgs e)
{
if (PatientId != 0)
{
frmBloodGasAnalysisNew frmFactBloodGasAnalysis = new frmBloodGasAnalysisNew();
frmFactBloodGasAnalysis._record = _record;
//frmFactBloodGasAnalysis.zgcAnaesRecord = zgcAnaesRecord;
frmFactBloodGasAnalysis.FormClosed += new FormClosedEventHandler(frmFactEventsNew_FormClosed);
frmFactBloodGasAnalysis.ShowDialog();
}
else
{
MessageBox.Show("请选择患者");
}
}
#endregion
#region
public string szy;//舒张压
public string ssy;//收缩压
public DateTime? LastRespMonitorDataTime;
private void timerGetTextCollectorData_Tick(object sender, EventArgs e)
{
try
{
if (((TimeSpan)(DateTime.Now - _record.lastPageBegin)).TotalHours > 24 || NowRoom == null) return;
if (_record != null && _record.OutRoomTime != null && DateTime.Now > _record.OutRoomTime) return;
ShowMonitorDataToRight();
}
catch (Exception ex)
{
PublicMethod.WriteLog(ex);
}
}
private BackgroundWorker backgroundWorker1;
public void ShowMonitorDataToRight()
{
this.backgroundWorker1 = new BackgroundWorker();
this.backgroundWorker1.WorkerReportsProgress = true;
this.backgroundWorker1.WorkerSupportsCancellation = true;
this.backgroundWorker1.DoWork += new DoWorkEventHandler(this.backgroundWorker1_DoWork);
this.backgroundWorker1.RunWorkerCompleted += new RunWorkerCompletedEventHandler(this.backgroundWorker1_RunWorkerCompleted);
this.backgroundWorker1.RunWorkerAsync();
}
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
{
BackgroundWorker worker = sender as BackgroundWorker;
List<DeviceCacheData> lists = DeviceCacheData.Select(" IPAddress='" + NowRoom.Ip + "' and UpdateTime>='" + DateTime.Now.AddSeconds(-3000) + "'");
e.Result = lists;
}
private void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
List<DeviceCacheData> lists = e.Result as List<DeviceCacheData>;
if (lists != null && lists.Count > 0)
{
DeviceCacheData deviceCacheData = lists[0];
NowPhysioData nowPhysioData = JsonConvert.DeserializeObject<NowPhysioData>(deviceCacheData.JsonData);
if (nowPhysioData.HR != null && nowPhysioData.HR.ToString() != string.Empty && nowPhysioData.HR.ToString() != "NaN" && nowPhysioData.HR.ToString() != "NULL")
{
double value = Double.Parse(nowPhysioData.HR.ToString());
lblHR.Text = value <= 0 ? "- -" : value.ToString();
}
if (nowPhysioData.Resp != null && nowPhysioData.Resp.ToString() != string.Empty && nowPhysioData.Resp.ToString() != "NaN" && nowPhysioData.Resp.ToString() != "NULL")
{
double value = Double.Parse(nowPhysioData.Resp.ToString());
lblRESP.Text = value <= 0 ? "- -" : value.ToString();
}
if (nowPhysioData.SPO2 != null && nowPhysioData.SPO2.ToString() != string.Empty && nowPhysioData.SPO2.ToString() != "NaN" && nowPhysioData.SPO2.ToString() != "NULL")
{
double value = Double.Parse(nowPhysioData.SPO2.ToString());
lblSpo2.Text = value <= 0 ? "- -" : value.ToString();
}
if (nowPhysioData.PR != null && nowPhysioData.PR.ToString() != string.Empty && nowPhysioData.PR.ToString() != "NaN" && nowPhysioData.PR.ToString() != "NULL")
{
double value = Double.Parse(nowPhysioData.PR.ToString());
lblPR.Text = value <= 0 ? "- -" : value.ToString();
}
if (nowPhysioData.Dia != null && nowPhysioData.Dia.ToString() != string.Empty && nowPhysioData.Dia.ToString() != "NaN" && nowPhysioData.Dia.ToString() != "NULL")
{
double value = Double.Parse(nowPhysioData.Dia.ToString());
szy = value <= 0 ? "" : value.ToString();
}
if (nowPhysioData.Sys != null && nowPhysioData.Sys.ToString() != string.Empty && nowPhysioData.Sys.ToString() != "NaN" && nowPhysioData.Sys.ToString() != "NULL")
{
double value = Double.Parse(nowPhysioData.Sys.ToString());
ssy = value <= 0 ? "" : value.ToString();
}
if (nowPhysioData.Dia_H != null && nowPhysioData.Dia_H.ToString() != string.Empty && nowPhysioData.Dia_H.ToString() != "NaN" && nowPhysioData.Dia_H.ToString() != "NULL")
{
double value = Double.Parse(nowPhysioData.Dia_H.ToString());
szy = value <= 0 ? "" : value.ToString();
}
if (nowPhysioData.Sys_H != null && nowPhysioData.Sys_H.ToString() != string.Empty && nowPhysioData.Sys_H.ToString() != "NaN" && nowPhysioData.Sys_H.ToString() != "NULL")
{
double value = Double.Parse(nowPhysioData.Sys_H.ToString());
ssy = value <= 0 ? "" : value.ToString();
}
string szyssy = ssy + "/" + szy;
if (szyssy != "/")
lblDia.Text = szyssy;
}
else
{
lblHR.Text = "--";
lblRESP.Text = "--";
lblSpo2.Text = "--";
lblPR.Text = "--";
lblDia.Text = "---/---";
lblHR.ForeColor = Color.Green;
lblRESP.ForeColor = Color.DarkOrange;
lblSpo2.ForeColor = Color.Cyan;
lblPR.ForeColor = Color.Green;
lblDia.ForeColor = Color.Red;
}
}
private void StartTimer()
{
if (timerGetTextCollectorData == null)
timerGetTextCollectorData = new System.Windows.Forms.Timer(components);
timerGetTextCollectorData.Enabled = true;//调试时设置为FALSE
timerGetTextCollectorData.Interval = 2000;
timerGetTextCollectorData.Tick -= new System.EventHandler(timerGetTextCollectorData_Tick);
timerGetTextCollectorData.Tick += new System.EventHandler(timerGetTextCollectorData_Tick);
timerGetTextCollectorData.Start();
}
private void DisposeTimer()
{
if (timerGetTextCollectorData != null)
{
timerGetTextCollectorData.Enabled = false;
timerGetTextCollectorData.Stop();
}
}
#endregion
#region
private void ReviewEvent()
{
_record = BOperationRecord.getRecord(_record, PatientId, RecoverId);
Patient = PatientRecord.GetPatientRecord(PatientId);
try
{
if (superTabMain.SelectedTab.Name == "spTabQXQDD")
{
if (PatientId != 0)
{
reDrawEvent();
//患者基本信息二次赋值
var query = from XTextElement in myEditControl.Document.Fields.ToArray()
where XTextElement is XTextInputFieldElement
&& (XTextElement as XTextInputFieldElement).FieldSettings != null
&& (XTextElement as XTextInputFieldElement).FieldSettings.EditStyle != InputFieldEditStyle.Date
&& (XTextElement as XTextInputFieldElement).FieldSettings.ListSource != null
select XTextElement as XTextInputFieldElement;
DataRow[] dr = DocumentDAL.GetReflectionList("V_OperationRecordALL").Select("KB_SEQ <> '' and Reload=1");
var p = typeof(PatientRecord).GetProperties();
for (int i = 0; i < dr.Count(); i++)
{
var name = dr[i].ItemArray[0].ToString();
var value = dr[i].ItemArray[1].ToString();
XTextInputFieldElement element = query.Where(x => x.FieldSettings.ListSource.SourceName == value).FirstOrDefault();
PropertyInfo info = p.Where(px => px.Name == name).FirstOrDefault();
if (element != null)
{
if (value == "KB20180604142714558" && element.Text != "") continue;
if (element != null && info != null)
{
element.Text = info.GetValue(Patient, null).ToString();
}
}
}
}
}
else
{
if (PatientId != 0)
{
//患者基本信息二次赋值
var query = from XTextElement in myEditControl2.Document.Fields.ToArray()
where XTextElement is XTextInputFieldElement
&& (XTextElement as XTextInputFieldElement).FieldSettings != null
&& (XTextElement as XTextInputFieldElement).FieldSettings.EditStyle != InputFieldEditStyle.Date
&& (XTextElement as XTextInputFieldElement).FieldSettings.ListSource != null
select XTextElement as XTextInputFieldElement;
DataRow[] dr = DocumentDAL.GetReflectionList("V_OperationRecordALL").Select("KB_SEQ <> '' and Reload=1");
var p = typeof(PatientRecord).GetProperties();
for (int i = 0; i < dr.Count(); i++)
{
var name = dr[i].ItemArray[0].ToString();
var value = dr[i].ItemArray[1].ToString();
XTextInputFieldElement element = query.Where(x => x.FieldSettings.ListSource.SourceName == value).FirstOrDefault();
PropertyInfo info = p.Where(px => px.Name == name).FirstOrDefault();
if (element != null)
{
if (value == "KB20180604142714558" && element.Text != "") continue;
if (element != null && info != null)
{
element.Text = info.GetValue(Patient, null).ToString();
}
}
}
}
}
}
catch (Exception ex)
{
PublicMethod.WriteLog(ex);
}
}
private void reDrawEvent()
{
ClearTimeText();
if (_record.InRoomTime != null)
{
txtInRoom.CustomFormat = "MM-dd HH:mm";
txtInRoom.ButtonDropDown.Visible = false;
txtInRoom.Tag = _record.InRoomTime.Value;
txtInRoom.Value = _record.InRoomTime.Value;
this.picInRoom.BackgroundImage = global::AIMSControls.Properties.Resources._select;
}
if (_record.OperationBeginTime != null)
{
txtOperationBegin.CustomFormat = "HH:mm";
txtOperationBegin.ButtonDropDown.Visible = false;
txtOperationBegin.Tag = _record.OperationBeginTime.Value;
txtOperationBegin.Value = _record.OperationBeginTime.Value;
this.picOpeBegin.BackgroundImage = global::AIMSControls.Properties.Resources._select;
}
if (_record.OperationEndTime != null)
{
txtOperationEnd.CustomFormat = "HH:mm";
txtOperationEnd.ButtonDropDown.Visible = false;
txtOperationEnd.Tag = _record.OperationEndTime.Value;
txtOperationEnd.Value = _record.OperationEndTime.Value;
this.picOpeEnd.BackgroundImage = global::AIMSControls.Properties.Resources._select;
}
if (_record.OutRoomTime != null)
{
txtOutRoom.CustomFormat = "MM-dd HH:mm";
txtOutRoom.ButtonDropDown.Visible = false;
txtOutRoom.Tag = _record.OutRoomTime.Value;
txtOutRoom.Value = _record.OutRoomTime.Value;
this.picOutRoom.BackgroundImage = global::AIMSControls.Properties.Resources._select;
}
//回写时间数据到文书
if (_record.OutRoomTime != null && _record.StateName == "手术中")
{
txtOutRoom.CustomFormat = "MM-dd HH:mm";
txtOutRoom.ButtonDropDown.Visible = false;
txtOutRoom.Tag = _record.OutRoomTime.Value;
txtOutRoom.Value = _record.OutRoomTime.Value;
EndOperationOutRoom();
}
}
public void ReferEventDrugs()
{
if (txtInRoom.Value != _record.InRoomTime)
{
_record.pageCount = 0;
ReviewEvent();
}
else
{
plRefresh_Click(null, null);
}
}
private void ClearTimeText()
{
txtInRoom.CustomFormat = " ";
txtOperationBegin.CustomFormat = " ";
txtOperationEnd.CustomFormat = " ";
txtOutRoom.CustomFormat = " ";
txtInRoom.Tag = null;
txtOperationBegin.Tag = null;
txtOperationEnd.Tag = null;
txtOutRoom.Tag = null;
txtInRoom.Text = "";
txtOperationBegin.Text = "";
txtOperationEnd.Text = "";
txtOutRoom.Text = "";
this.picInRoom.BackgroundImage = global::AIMSControls.Properties.Resources.;
this.picOpeBegin.BackgroundImage = global::AIMSControls.Properties.Resources.;
this.picOpeEnd.BackgroundImage = global::AIMSControls.Properties.Resources.;
this.picOutRoom.BackgroundImage = global::AIMSControls.Properties.Resources.;
}
/// <summary>
/// 出室方法
/// </summary>
private void EndOperationOutRoom()
{
if (_record == null || _record.StateName != "手术中") return;
try
{
//CloseOtherFrom();
//保存持续加药未结束药品
foreach (FactDrug temp in _record.FactDrugList)
{
if (temp.IsContinue == 1 && temp.DrugBeginTime == temp.DrugEndTime)
{
temp.DrugEndTime = _record.OutRoomTime.Value;
temp.OperatorNo = PublicMethod.OperatorNo;
temp.OperatorName = PublicMethod.OperatorName;
temp.OperateDate = DateTime.Now;
BFactDrug.Update(temp);
}
}
//保存持续事件未结束事件
foreach (FactEvents temp in _record.FactEventsList)
{
if (temp.IsContinue == 1 && temp.EventBeginTime == temp.EventEndTime)
{
temp.EventEndTime = _record.OutRoomTime;
temp.OperatorNo = PublicMethod.OperatorNo;
temp.OperatorName = PublicMethod.OperatorName;
temp.OperateDate = DateTime.Now;
BFactEvents.Update(temp);
}
}
_record.StateName = "手术结束";
BOperationApply.UpdateApplyState(ApplyId, 8);
BOperationRecord.UpdateState(PatientId, 1, 2);
//PublicMethod.WriteLog("结束转出手术: " + _record.Id);
//TipBox.Hidden(true);
State = AIMSExtension.EditState.BROWSE;
btnCancelOperation.Enabled = false;
btnCancelIn.Enabled = false;
btnSelectPatient.Enabled = true;
DisposeTimer();
//ReviewEvent();
}
catch (Exception exp)
{
PublicMethod.WriteLog(exp, "");
}
}
/// <summary>
/// 出室状态
/// </summary>
/// <param name="message"></param>
/// <returns></returns>
private bool GetOpeState(ref string message)
{
bool isTrue = true;
if (_record.OpeRecordInfo.OperationLevel == null || _record.OpeRecordInfo.OperationLevel.ToString().Trim() == "")
{
message = "请与手术信息选择手术分级!";
isTrue = false;
}
if (_record.OpeRecordInfo.OperationCut == null || _record.OpeRecordInfo.OperationCut.ToString().Trim() == "")
{
message = "请与手术信息选择手术切口!";
isTrue = false;
}
if (_record.OperationDoctor == null || _record.OperationDoctor.Trim() == "")
{
message = "请添加手术医师!";
isTrue = false;
}
return isTrue;
}
public void ClearRecordDate()
{
_applianceUseType = null;
_applianceUseType2 = null;
panel8.VerticalScroll.Value = 0;
//清空记录点并重新加载
ClearTimeText();
//关闭采集的服务
DisposeTimer();
lblHR.Text = "--";
lblRESP.Text = "--";
lblSpo2.Text = "--";
lblPR.Text = "--";
lblDia.Text = "---/---";
lblHR.ForeColor = Color.Green;
lblRESP.ForeColor = Color.DarkOrange;
lblSpo2.ForeColor = Color.Cyan;
lblPR.ForeColor = Color.Green;
lblDia.ForeColor = Color.Red;
//txtRemark.Text = "";
//txtInstrumentNurse.Text = "";
//txtTourNurse.Text = "";
//txtOperationDoctor.Text = "";
_record = null;
}
private void ModifyApply_Click(object sender, EventArgs e)
{
if (PatientId == 0) return;
frmOperationApplyDetail frm = new frmOperationApplyDetail();
frm.State = AIMSExtension.EditState.EDIT;
frm.EditApplyId = ApplyId;
frm.tsbExit.Visible = true;
frm.tsbCancel.Visible = false;
frm.FormClosed += (s, er) =>
{
ReviewEvent();
};
//frm.FormBorderStyle = FormBorderStyle.None; // 无边框
//frm.TopLevel = false;
//frm.Dock = DockStyle.Fill;
//panel8.Controls.Add(frm);
frm.Show();
frm.Focus();
frm.BringToFront();
}
#endregion
#region
private void btndptz_Click(object sender, EventArgs e)
{
frmNoticeLargeScreen fnc = new frmNoticeLargeScreen();
if (_record != null)
{
fnc.lblName.Text = _record.Name;
fnc.textBox2.Focus();
fnc.groupBox1.Visible = false;
}
fnc.ShowDialog();
}
private void btnsbwh_Click(object sender, EventArgs e)
{
frmInstrumentRegistration frm = new frmInstrumentRegistration();
frm.Show();
}
private void btnsjzx_Click(object sender, EventArgs e)
{
if (_record != null)
{
EMRExtension.OpenEMRS(_record.PatientId.Value, _record.OperationApplyId.Value);
}
}
#endregion
#region
#region
private void LoadOperationGoodsBillRecord()
{
if (_record.InstrumentList != null && _record.InstrumentList.Id != null)
{
if (_record.InstrumentList.ApplianceUseType != null && _record.InstrumentList.ApplianceUseType != "") _applianceUseType = BApplianceUseType.Select(" id in (" + _record.InstrumentList.ApplianceUseType + ")", null, RecursiveType.None, 0);
if (_applianceUseType == null || _applianceUseType.Count == 0)
{
_applianceUseType = new List<ApplianceUseType>();
_appliance = BAppliance.GetApplianiceByIds("");
}
else
{
DataTable newDataTable = null;
_appliance = BAppliance.GetApplianiceNumberByIds(_applianceUseType[0].TheApplianceId, _applianceUseType[0].ApplianceNumber);
newDataTable = _appliance.Clone();
foreach (ApplianceUseType item in _applianceUseType)
{
DataTable dt = BAppliance.GetApplianiceNumberByIds(item.TheApplianceId, item.ApplianceNumber);
object[] obj = new object[newDataTable.Columns.Count];
//添加DataTable1的数据
for (int i = 0; i < dt.Rows.Count; i++)
{
dt.Rows[i].ItemArray.CopyTo(obj, 0);
newDataTable.Rows.Add(obj);
}
}
_appliance = newDataTable;
}
//if (_appliance != null)
//FullUcControlsToPanel(panelQXList, _appliance, _record.InstrumentList, ref i1, ref j1);
}
}
private void LoadOperationGoodsBillRecord2()
{
if (_record.InstrumentList2 != null && _record.InstrumentList2.Id != null)
{
if (_record.InstrumentList2.ApplianceUseType != null && _record.InstrumentList2.ApplianceUseType != "") _applianceUseType2 = BApplianceUseType.Select(" id in (" + _record.InstrumentList2.ApplianceUseType + ")", null, RecursiveType.None, 0);
if (_applianceUseType2 == null || _applianceUseType2.Count == 0)
{
_applianceUseType2 = new List<ApplianceUseType>();
_appliance2 = BAppliance.GetApplianiceByIds("");
}
else
{
DataTable newDataTable = null;
_appliance2 = BAppliance.GetApplianiceNumberByIds(_applianceUseType2[0].TheApplianceId, _applianceUseType2[0].ApplianceNumber);
newDataTable = _appliance2.Clone();
foreach (ApplianceUseType item in _applianceUseType2)
{
DataTable dt = BAppliance.GetApplianiceNumberByIds(item.TheApplianceId, item.ApplianceNumber);
object[] obj = new object[newDataTable.Columns.Count];
//添加DataTable1的数据
for (int i = 0; i < dt.Rows.Count; i++)
{
dt.Rows[i].ItemArray.CopyTo(obj, 0);
newDataTable.Rows.Add(obj);
}
}
_appliance2 = newDataTable;
}
//if (_appliance2 != null)
// FullUcControlsToPanel(panelQXList2, _appliance2, _record.InstrumentList2, ref i2, ref j2);
}
}
#endregion
#region
private void FirstbtnEnter()
{
if (_applianceUseType == null)
{
_applianceUseType = new List<ApplianceUseType>();
ApplianceUseType _nowApplianceUseType = BApplianceUseType.SelectSingle(1, RecursiveType.None, 0);
_applianceUseType.Add(_nowApplianceUseType);
DataTable newDataTable = null;
if (_applianceUseType.Count > 0) _appliance = BAppliance.GetApplianiceNumberByIds(_applianceUseType[0].TheApplianceId, _applianceUseType[0].ApplianceNumber);
newDataTable = _appliance.Clone();
foreach (ApplianceUseType item in _applianceUseType)
{
if (item.TheApplianceId != null && item.TheApplianceId != "")
{
DataTable dt = BAppliance.GetApplianiceNumberByIds(item.TheApplianceId, item.ApplianceNumber);
object[] obj = new object[newDataTable.Columns.Count];
//添加DataTable1的数据
for (int i = 0; i < dt.Rows.Count; i++)
{
dt.Rows[i].ItemArray.CopyTo(obj, 0);
newDataTable.Rows.Add(obj);
}
}
}
_appliance = newDataTable;
FullUcControlsToPanel(QXList, _appliance, _record.InstrumentList, ref i1, ref j1);
}
}
#endregion
#region
int i1 = 0, j1 = 0;
//int i2 = 0, j2 = 0;
int Incount = 0;
int IncRowsount = 25;
/// <summary>
/// 加载物品控件到指定的Panel
/// </summary>
/// <param name="panel">指定的Panel</param>
/// <param name="dt">物品数据表</param>
private void FullUcControlsToPanel(List<string> panel, DataTable dt, OperationRecordInstrumentList Instrument, ref int i, ref int j)
{
foreach (DataRow dr in dt.Rows)
{
if (Incount >= QXList.Count)
break;
var BillText = myEditControl.Document.Fields.ToArray().Where(x => x is XTextInputFieldElement
&& (x as XTextInputFieldElement).Name == QXList[Incount]).FirstOrDefault();
if (BillText != null)
{
BillText.OuterText = dr["Id"].ToString();
BillText.Text = dr["Name"].ToString();
BillText.FormulaValue = dr["Name"].ToString();
BillText.InnerText = dr["Name"].ToString();
string ApplianceNumber = dr["ApplianceNumber"].ToString();
}
Incount++;
j++;
if (j == IncRowsount)
{
j = 0;
i++;
}
}
}
private void button1_Click(object sender, EventArgs e)
{
for (int nulli = 0; nulli < 10; nulli++)
{
var BillText = myEditControl.Document.Fields.ToArray().Where(x => x is XTextInputFieldElement
&& (x as XTextInputFieldElement).Name == QXList[nulli]).FirstOrDefault();
if (BillText != null)
{
var BillText2 = myEditControl.Document.Fields.ToArray().Where(x => x is XTextInputFieldElement
&& (x as XTextInputFieldElement).Name == QXList[nulli] + "A").FirstOrDefault();
if (BillText2 != null && BillText2.Text != "")
{
BillText2.Text = "0";
BillText2.FormulaValue = "0";
BillText2.InnerText = "0";
}
var BillText3 = myEditControl.Document.Fields.ToArray().Where(x => x is XTextInputFieldElement
&& (x as XTextInputFieldElement).Name == QXList[nulli] + "B").FirstOrDefault();
if (BillText3 != null && BillText3.Text != "")
{
BillText3.Text = "0";
BillText3.FormulaValue = "0";
BillText3.InnerText = "0";
}
var BillText4 = myEditControl.Document.Fields.ToArray().Where(x => x is XTextInputFieldElement
&& (x as XTextInputFieldElement).Name == QXList[nulli] + "C").FirstOrDefault();
if (BillText4 != null && BillText4.Text != "")
{
BillText4.Text = "0";
BillText4.FormulaValue = "0";
BillText4.InnerText = "0";
}
var BillText5 = myEditControl.Document.Fields.ToArray().Where(x => x is XTextInputFieldElement
&& (x as XTextInputFieldElement).Name == QXList[nulli] + "D").FirstOrDefault();
if (BillText5 != null && BillText5.Text != "")
{
BillText5.Text = "0";
BillText5.FormulaValue = "0";
BillText5.InnerText = "0";
}
}
}
for (int nulli = 9; nulli < QXList.Count; nulli++)
{
var BillText = myEditControl.Document.Fields.ToArray().Where(x => x is XTextInputFieldElement
&& (x as XTextInputFieldElement).Name == QXList[nulli]).FirstOrDefault();
if (BillText != null)
{
BillText.Text = "";
BillText.FormulaValue = "";
BillText.InnerText = "";
var BillText2 = myEditControl.Document.Fields.ToArray().Where(x => x is XTextInputFieldElement
&& (x as XTextInputFieldElement).Name == QXList[nulli] + "A").FirstOrDefault();
if (BillText2 != null && BillText2.Text != "")
{
BillText2.Text = "";
BillText2.FormulaValue = "";
BillText2.InnerText = "";
}
var BillText3 = myEditControl.Document.Fields.ToArray().Where(x => x is XTextInputFieldElement
&& (x as XTextInputFieldElement).Name == QXList[nulli] + "B").FirstOrDefault();
if (BillText3 != null && BillText3.Text != "")
{
BillText3.Text = "";
BillText3.FormulaValue = "";
BillText3.InnerText = "";
}
var BillText4 = myEditControl.Document.Fields.ToArray().Where(x => x is XTextInputFieldElement
&& (x as XTextInputFieldElement).Name == QXList[nulli] + "C").FirstOrDefault();
if (BillText4 != null && BillText4.Text != "")
{
BillText4.Text = "";
BillText4.FormulaValue = "";
BillText4.InnerText = "";
}
var BillText5 = myEditControl.Document.Fields.ToArray().Where(x => x is XTextInputFieldElement
&& (x as XTextInputFieldElement).Name == QXList[nulli] + "D").FirstOrDefault();
if (BillText5 != null && BillText5.Text != "")
{
BillText5.Text = "";
BillText5.FormulaValue = "";
BillText5.InnerText = "";
}
}
}
}
private void Uc_SelectTextBoxEvent(object uc, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
SendKeys.Send("{TAB}");
}
else if (e.KeyCode == Keys.Up)
{
if (((uc as TextBox).Parent).TabIndex == 1) return;
foreach (Control item in ((uc as TextBox).Parent).Parent.Controls)
{
if (item is UCOperationGoodsBill5 && item.TabIndex == ((uc as TextBox).Parent).TabIndex - 1)
{
foreach (Control citem in item.Controls)
{
if (citem.TabIndex == ((uc as TextBox).TabIndex))
{
citem.Focus();
break;
}
}
break;
}
}
}
else if (e.KeyCode == Keys.Left)
{
//MessageBox.Show(((uc as TextBox).TabIndex - 1).ToString());
foreach (Control item in ((uc as TextBox).Parent).Controls)
{
if (item.TabIndex == ((uc as TextBox).TabIndex - 1))
{
item.Focus();
break;
}
}
}
else if (e.KeyCode == Keys.Right)
{
SendKeys.Send("{TAB}");
}
else if (e.KeyCode == Keys.Down)
{
if (((uc as TextBox).Parent).TabIndex == 50) return;
foreach (Control item in ((uc as TextBox).Parent).Parent.Controls)
{
if (item is UCOperationGoodsBill5 && item.TabIndex == ((uc as TextBox).Parent).TabIndex + 1)
{
foreach (Control citem in item.Controls)
{
if (citem.TabIndex == ((uc as TextBox).TabIndex))
{
citem.Focus();
break;
}
}
break;
}
}
}
}
#endregion
#region
private void PanelSave_Click(object sender, EventArgs e)
{
if (superTabMain.SelectedTab.Name == "spTabQXQDD")
{
SaveInstrument(sender);
ReviewEvent();
new frmMessageBox().Show();
}
else
{
SaveInstrument2(sender);
ReviewEvent();
new frmMessageBox().Show();
}
new frmMessageBox().Show();
}
private void SaveInstrument(object sender)
{
btnSelectPatient.Focus();
try
{
ValueValidateResultList listR = myEditControl.Document.ValueValidate();
string vMsg = "";
foreach (var item in listR)
{
vMsg += item.Message + System.Environment.NewLine;
}
if (vMsg.Length > 0)
{
throw new Exception(vMsg);
}
//model赋值
DModel.XmlFile = myEditControl.Document.XMLText;
DModel.PatientId = this.Patient.PatientId;
DModel.OperatorNo = AIMSExtension.PublicMethod.OperatorNo;
XmlDocument doc = new XmlDocument();
XmlElement rootNode = doc.CreateElement("Root");
doc.AppendChild(rootNode);
var query = from XTextElement in myEditControl.Document.Fields.ToArray()
where (XTextElement is XTextInputFieldElement && (XTextElement as XTextInputFieldElement).ToolTip != "")
|| XTextElement is XTextCheckBoxElement && ((XTextElement as XTextCheckBoxElement).ToolTip != "")
select XTextElement;
foreach (var element in query)
{
XmlElement itemNode = doc.CreateElement("Item");
if (element is XTextInputFieldElement)
{
itemNode.SetAttribute("Name", (element as XTextInputFieldElement).ToolTip);
itemNode.InnerText = element.Text;
rootNode.AppendChild(itemNode);
}
else if (element is XTextCheckBoxElement)
{
itemNode.SetAttribute("Name", (element as XTextCheckBoxElement).ToolTip);
itemNode.SetAttribute("Checked", ((XTextCheckBoxElement)element).Checked == true ? "1" : "0");
itemNode.InnerText = (element as XTextCheckBoxElement).Value;
rootNode.AppendChild(itemNode);
}
}
DModel.XmlStatic = doc.OuterXml;
if (DModel.Id > 0)
{
DocumentDAL.UpdatePrintDocument(this.DModel);
//MessageBox.Show("修改成功!");
}
else
{
DocumentDAL.InsertPrintDocument(this.DModel);
//new frmMessageBox().Show();
}
myEditControl.Document.Modified = false;
_record.InstrumentList.OperationRecordId = this._record.Id;
if (_applianceUseType != null)
{
List<int> list = new List<int>();
foreach (ApplianceUseType item in _applianceUseType)
{
list.Add(item.Id.Value);
}
_record.InstrumentList.ApplianceUseType = string.Join(",", list.ToArray());
}
_record.InstrumentList.TagPicture = "";// Convert.ToBase64String(PublicToDoument.ImageToBytes(pictureBox1.Image));
_record.InstrumentList.JsonTextData = "";// PublicToDoument.SerializeControl(panel18, _record, new List<string> ());
var diagnose = myEditControl.Document.Fields.ToArray().Where(x => x.ID == "KB20180604142254986").FirstOrDefault();
if (diagnose != null && diagnose.Text != "" && diagnose.Text != Patient.ApplyDiagnoseInfoName)
{
//_record.InstrumentList.Remark = diagnose.Text;
DBManage.AddApplyDiagnose(_record, GetDiagnoseId(diagnose.Text));
}
var operation = myEditControl.Document.Fields.ToArray().Where(x => x.ID == "KB20180604142607822").FirstOrDefault();
if (operation != null && operation.Text != "" && operation.Text != Patient.OperationInfoName)
{
_record.InstrumentList.Remark = operation.Text;
DBManage.AddOperation(_record, GetOperationId(operation.Text));
}
var OperationSite = myEditControl.Document.Fields.ToArray().Where(x => x.ID == "KB20230326230037766").FirstOrDefault();
if (OperationSite != null && OperationSite.Text != "")
{
DBManage.AddOperationSite(_record, GetOperationSiteId(OperationSite.Text));
}
var TourNurse = myEditControl.Document.Fields.ToArray().Where(x => x.ID == "KB20211213195424058").FirstOrDefault();//7
if (TourNurse != null && TourNurse.Text != "" && TourNurse.Text != Patient.TourNurse)
{
DBManage.AddPerson(_record, GetPersonId(TourNurse.Text), 7);
}
var InstrumentNurse = myEditControl.Document.Fields.ToArray().Where(x => x.ID == "KB20221028190620022").FirstOrDefault();//6
if (InstrumentNurse != null && InstrumentNurse.Text != "" && InstrumentNurse.Text != Patient.InstrumentNurse)
{
DBManage.AddPerson(_record, GetPersonId(InstrumentNurse.Text), 6);
}
_record.InstrumentList.OperatorNo = PublicMethod.OperatorNo;
_record.InstrumentList.OperatorName = PublicMethod.OperatorName;
_record.InstrumentList.OperateDate = DateTime.Now;
if (_record.InstrumentList.Id == null || _record.InstrumentList.Id == 0)
{
_record.InstrumentList.Id = BOperationRecordInstrumentList.Insert(_record.InstrumentList);
}
else
{
BOperationRecordInstrumentList.Update(_record.InstrumentList);
}
}
catch (Exception ex)
{
PublicMethod.WriteLog(ex);
}
}
private void SaveInstrument2(object sender)
{
btnSelectPatient.Focus();
try
{
ValueValidateResultList listR = myEditControl2.Document.ValueValidate();
string vMsg = "";
foreach (var item in listR)
{
vMsg += item.Message + System.Environment.NewLine;
}
if (vMsg.Length > 0)
{
throw new Exception(vMsg);
}
//model赋值
DModel2.XmlFile = myEditControl2.Document.XMLText;
DModel2.PatientId = this.Patient.PatientId;
DModel2.OperatorNo = AIMSExtension.PublicMethod.OperatorNo;
XmlDocument doc = new XmlDocument();
XmlElement rootNode = doc.CreateElement("Root");
doc.AppendChild(rootNode);
var query = from XTextElement in myEditControl2.Document.Fields.ToArray()
where (XTextElement is XTextInputFieldElement && (XTextElement as XTextInputFieldElement).ToolTip != "")
|| XTextElement is XTextCheckBoxElement && ((XTextElement as XTextCheckBoxElement).ToolTip != "")
select XTextElement;
foreach (var element in query)
{
XmlElement itemNode = doc.CreateElement("Item");
if (element is XTextInputFieldElement)
{
itemNode.SetAttribute("Name", (element as XTextInputFieldElement).ToolTip);
itemNode.InnerText = element.Text;
rootNode.AppendChild(itemNode);
}
else if (element is XTextCheckBoxElement)
{
itemNode.SetAttribute("Name", (element as XTextCheckBoxElement).ToolTip);
itemNode.SetAttribute("Checked", ((XTextCheckBoxElement)element).Checked == true ? "1" : "0");
itemNode.InnerText = (element as XTextCheckBoxElement).Value;
rootNode.AppendChild(itemNode);
}
}
DModel2.XmlStatic = doc.OuterXml;
if (DModel2.Id > 0)
{
DocumentDAL.UpdatePrintDocument(this.DModel2);
//MessageBox.Show("修改成功!");
}
else
{
DocumentDAL.InsertPrintDocument(this.DModel2);
//new frmMessageBox().Show();
}
myEditControl2.Document.Modified = false;
_record.InstrumentList.OperationRecordId = this._record.Id;
if (_applianceUseType != null)
{
List<int> list = new List<int>();
foreach (ApplianceUseType item in _applianceUseType)
{
list.Add(item.Id.Value);
}
_record.InstrumentList.ApplianceUseType = string.Join(",", list.ToArray());
}
_record.InstrumentList.TagPicture = "";// Convert.ToBase64String(PublicToDoument.ImageToBytes(pictureBox1.Image));
_record.InstrumentList.JsonTextData = "";// PublicToDoument.SerializeControl(panel18, _record, new List<string> ());
var diagnose = myEditControl2.Document.Fields.ToArray().Where(x => x.ID == "KB20180604142254986").FirstOrDefault();
if (diagnose != null && diagnose.Text != "" && diagnose.Text != Patient.ApplyDiagnoseInfoName)
{
//_record.InstrumentList.Remark = diagnose.Text;
DBManage.AddApplyDiagnose(_record, GetDiagnoseId(diagnose.Text));
}
var operation = myEditControl2.Document.Fields.ToArray().Where(x => x.ID == "KB20180604142607822").FirstOrDefault();
if (operation != null && operation.Text != "" && operation.Text != Patient.OperationInfoName)
{
_record.InstrumentList.Remark = operation.Text;
DBManage.AddOperation(_record, GetOperationId(operation.Text));
}
var OperationSite = myEditControl2.Document.Fields.ToArray().Where(x => x.ID == "KB20230326230037766").FirstOrDefault();
if (OperationSite != null && OperationSite.Text != "")
{
DBManage.AddOperationSite(_record, GetOperationSiteId(OperationSite.Text));
}
var TourNurse = myEditControl2.Document.Fields.ToArray().Where(x => x.ID == "KB20211213195424058").FirstOrDefault();//7
if (TourNurse != null && TourNurse.Text != "" && TourNurse.Text != Patient.TourNurse)
{
DBManage.AddPerson(_record, GetPersonId(TourNurse.Text), 7);
}
var InstrumentNurse = myEditControl2.Document.Fields.ToArray().Where(x => x.ID == "KB20221028190620022").FirstOrDefault();//6
if (InstrumentNurse != null && InstrumentNurse.Text != "" && InstrumentNurse.Text != Patient.InstrumentNurse)
{
DBManage.AddPerson(_record, GetPersonId(InstrumentNurse.Text), 6);
}
_record.InstrumentList.OperatorNo = PublicMethod.OperatorNo;
_record.InstrumentList.OperatorName = PublicMethod.OperatorName;
_record.InstrumentList.OperateDate = DateTime.Now;
if (_record.InstrumentList.Id == null || _record.InstrumentList.Id == 0)
{
_record.InstrumentList.Id = BOperationRecordInstrumentList.Insert(_record.InstrumentList);
}
else
{
BOperationRecordInstrumentList.Update(_record.InstrumentList);
}
}
catch (Exception ex)
{
PublicMethod.WriteLog(ex);
}
}
private void superTabMain_SelectedTabChanged(object sender, DevComponents.DotNetBar.SuperTabStripSelectedTabChangedEventArgs e)
{
ReviewEvent();
}
private string GetOperationId(string namestr)
{
List<string> result = new List<string>();
List<string> names = new List<string>();
if (namestr.Contains(","))
{
names = namestr.Split(',').ToList();
}
else if (namestr.Contains(""))
{
names = namestr.Split('').ToList();
}
else if (namestr.Contains("+"))
{
names = namestr.Split('+').ToList();
}
else
{
names.Add(namestr);
}
foreach (var name in names)
{
DataTable dt = DBHelper.GetDataTable("select * from Operation where Name ='" + name + "'");
if (dt.Rows.Count == 0)
{
DBHelper.ExecNonQuery(string.Concat(new Object[]{
"insert into Operation(ICDCode,Name,HelpCode,IsValid,UseRate,OperatorNo,[OperatorName],OperateDate) values('','"+name+"','"+PublicMethod.GetFirstLetter(name)+"',1,1,'admin','系统管理员','"+DateTime.Now+"')"}));
}
dt = DBHelper.GetDataTable("select * from Operation where Name ='" + name + "'");
if (dt.Rows.Count > 0)
{
for (int j = 0; j < dt.Rows.Count; j++)
{
result.Add(dt.Rows[0]["Id"].ToString());
}
}
}
return string.Join(",", result.ToArray());
}
private string GetDiagnoseId(string namestr)
{
List<string> result = new List<string>();
List<string> names = new List<string>();
if (namestr.Contains(","))
{
names = namestr.Split(',').ToList();
}
else if (namestr.Contains(""))
{
names = namestr.Split('').ToList();
}
else if (namestr.Contains("+"))
{
names = namestr.Split('+').ToList();
}
else
{
names.Add(namestr);
}
foreach (var name in names)
{
DataTable dt = DBHelper.GetDataTable("select * from Disease where Name ='" + name + "'");
if (dt.Rows.Count == 0)
{
DBHelper.ExecNonQuery(string.Concat(new Object[]{
"insert into Disease(ICDCode,Name,[HelpCode],UseRate,IsValid,[OperatorNo],[OperatorName],OperateDate) values('','"+name+"','"+PublicMethod.GetFirstLetter(name)+"',1,1,'admin','系统管理员','"+DateTime.Now+"')"}));
}
dt = DBHelper.GetDataTable("select * from Disease where Name ='" + name + "'");
if (dt.Rows.Count > 0)
{
for (int j = 0; j < dt.Rows.Count; j++)
{
result.Add(dt.Rows[0]["Id"].ToString());
}
}
}
return string.Join(",", result.ToArray());
}
private string GetOperationSiteId(string namestr)
{
List<string> result = new List<string>();
List<string> names = new List<string>();
if (namestr.Contains(","))
{
names = namestr.Split(',').ToList();
}
else if (namestr.Contains(""))
{
names = namestr.Split('').ToList();
}
else if (namestr.Contains("+"))
{
names = namestr.Split('+').ToList();
}
else
{
names.Add(namestr);
}
foreach (var name in names)
{
DataTable dt = DBHelper.GetDataTable("select * from OperationBodyPosition where Name ='" + name + "'");
if (dt.Rows.Count == 0)
{
DBHelper.ExecNonQuery(string.Concat(new Object[]{
"insert into OperationBodyPosition( [Name], [HelpCode], [Explain], [PositionOrder], [IsValid], [OperatorNo], [OperatorName], [OperateDate]) values('"+name+"','"+PublicMethod.GetFirstLetter(name)+"','',1,1,'admin','系统管理员','"+DateTime.Now+"')"}));
dt = DBHelper.GetDataTable("select * from OperationBodyPosition where Name ='" + name + "'");
}
if (dt.Rows.Count > 0)
{
for (int j = 0; j < dt.Rows.Count; j++)
{
result.Add(dt.Rows[0]["Id"].ToString());
}
}
}
return string.Join(",", result.ToArray());
}
private string GetPersonId(string namestr)
{
List<string> result = new List<string>();
List<string> names = new List<string>();
if (namestr.Contains(","))
{
names = namestr.Split(',').ToList();
}
else if (namestr.Contains(""))
{
names = namestr.Split('').ToList();
}
else if (namestr.Contains("+"))
{
names = namestr.Split('+').ToList();
}
else
{
names.Add(namestr);
}
foreach (var name in names)
{
DataTable dt = DBHelper.GetDataTable("select * from Person where Name ='" + name + "' and PersonType='手术室护士' and isvalid=1");
if (dt.Rows.Count > 0)
{
for (int j = 0; j < dt.Rows.Count; j++)
{
result.Add(dt.Rows[0]["Id"].ToString());
}
}
}
return string.Join(",", result.ToArray());
}
#endregion
#endregion
#region
private void plPrintBrowse_Click(object sender, EventArgs e)
{
if (_record == null || _record.Id == 0) return;
plPrintBrowse.Select();
if (superTabMain.SelectedTab.Name == "spTabQXQDD")
{
SaveInstrument(sender);
myEditControl.ExecuteCommand("FilePrintPreview", true, null);
}
else
{
SaveInstrument2(sender);
myEditControl2.ExecuteCommand("FilePrintPreview", true, null);
}
plRefresh_Click(null, null);
}
private void button9_Click(object sender, EventArgs e)
{
TextBoxAddEventSources(QXList, @"/");
}
private void TextBoxAddEventSources(List<string> _panel, string TextValue)
{
var BillText = myEditControl.Document.Fields.ToArray().ToList();
foreach (var item in BillText)
{
if (item.Text == "")
item.Text = TextValue;
}
}
private void btnChage_Click(object sender, EventArgs e)
{
if (_record != null)
{
EMRExtension.OpenFeesRecord(_record, "护士");
}
}
private void button10_Click(object sender, EventArgs e)
{
frmSafetyExamine frmSafety = new frmSafetyExamine();
frmSafety.PatientId = PatientId;
frmSafety.Show();
}
private void frmAnasRecordInstrument_VisibleChanged(object sender, EventArgs e)
{
if (this.Visible == false)
{
panel8.VerticalScroll.Value = 0;
//if (templateManage != null)
// templateManage.SetPYL();
if (_record != null && _record.StateName == "手术中" && State != AIMSExtension.EditState.BROWSE)
{
DisposeTimer();
}
}
else
{
if (_record != null && _record.StateName == "手术中" && State != AIMSExtension.EditState.BROWSE)
{
StartTimer();
}
}
}
private void plPrint_Click(object sender, EventArgs e)
{
if (_record == null || _record.Id == 0) return;
plPrint.Select();
try
{
if (superTabMain.SelectedTab.Name == "spTabQXQDD")
{
SaveInstrument(sender);
myEditControl.ExecuteCommand("FilePrint", false, null);
plRefresh_Click(null, null);
ControlExtension.UPDocument(Patient.PatientId, Patient.ApplyId, DModel.Id, 3, DModel.TemplateId.ToString(), DModel.XmlFileName);
new frmMessageBox("打印完成!").Show();
}
else
{
SaveInstrument2(sender);
myEditControl2.ExecuteCommand("FilePrint", false, null);
plRefresh_Click(null, null);
ControlExtension.UPDocument(Patient.PatientId, Patient.ApplyId, DModel2.Id, 3, DModel2.TemplateId.ToString(), DModel2.XmlFileName);
new frmMessageBox("打印完成!").Show();
}
}
catch (Exception exp)
{
PublicMethod.WriteLog(exp, "");
}
}
#endregion
#region
private void LoadDocumentGoodsBill()
{
if (DModel.Id > 0)
{
//加载文档
DModel = DocumentDAL.GetDocumentbyId(DModel.Id);
myEditControl.LoadDocumentFromString(DModel.XmlFile, "xml");
//患者基本信息二次赋值
var query = from XTextElement in myEditControl.Document.Fields.ToArray()
where XTextElement is XTextInputFieldElement
&& (XTextElement as XTextInputFieldElement).FieldSettings != null
&& (XTextElement as XTextInputFieldElement).FieldSettings.EditStyle != InputFieldEditStyle.Date
&& (XTextElement as XTextInputFieldElement).FieldSettings.ListSource != null
select XTextElement as XTextInputFieldElement;
DataRow[] dr = DocumentDAL.GetReflectionList("V_OperationRecordALL").Select("KB_SEQ <> '' and Reload=1");
var p = typeof(PatientRecord).GetProperties();
for (int i = 0; i < dr.Count(); i++)
{
var name = dr[i].ItemArray[0].ToString();
var value = dr[i].ItemArray[1].ToString();
XTextInputFieldElement element = query.Where(x => x.FieldSettings.ListSource.SourceName == value).FirstOrDefault();
PropertyInfo info = p.Where(px => px.Name == name).FirstOrDefault();
if (element != null && info != null)
{
if (value == "KB20180604142714558" && element.Text != "") continue;
else
element.Text = info.GetValue(Patient, null).ToString();
}
}
}
else
{
//无文档则加载模板
TModel = DocumentDAL.GetTemplatebyId(DModel.TemplateId);
if (TModel.XmlFile == null || TModel.XmlFile.Trim().Equals(string.Empty))
{
myEditControl.ExecuteCommand("FileNew", true, null);
}
else
{
myEditControl.LoadDocumentFromString(TModel.XmlFile, "xml");
}
DModel.XmlFileName = TModel.XmlFileName;
DModel.TemplateId = TModel.Id;
//患者基本信息赋值
var query = from XTextElement in myEditControl.Document.Fields.ToArray()
where XTextElement is XTextInputFieldElement
&& (XTextElement as XTextInputFieldElement).FieldSettings != null
&& (XTextElement as XTextInputFieldElement).FieldSettings.EditStyle != InputFieldEditStyle.Date
&& (XTextElement as XTextInputFieldElement).FieldSettings.ListSource != null
select XTextElement as XTextInputFieldElement;
DataRow[] dr = DocumentDAL.GetReflectionList("V_OperationRecordALL").Select("KB_SEQ <> ''");
var p = typeof(PatientRecord).GetProperties();
for (int i = 0; i < dr.Count(); i++)
{
var name = dr[i].ItemArray[0].ToString();
var value = dr[i].ItemArray[1].ToString();
XTextInputFieldElement element = query.Where(x => x.FieldSettings.ListSource.SourceName == value).FirstOrDefault();
if (element != null)
{
PropertyInfo info = p.Where(px => px.Name == name).FirstOrDefault();
if (value == "KB20180604142714558" && element.Text != "") continue;
if (element != null && info != null)
{
element.Text = info.GetValue(Patient, null).ToString();
}
}
}
DocumentExtension.SetDocumentDefaultValue(TModel.XmlFileName, myEditControl.Document, Patient);
}
string xmlStatic = DocumentDAL.GetEventXml(DModel.TemplateId);
if (xmlStatic != string.Empty)
{
XmlDocument doc = new XmlDocument();
doc.LoadXml(xmlStatic);
strClick = doc.GetElementsByTagName("ClickEvent")[0].InnerText;
strContentChanged = doc.GetElementsByTagName("ContentChangedEnvent")[0].InnerText;
}
codeCompiler = new EventCodeCompilerBill(ref this.myEditControl, strClick, strContentChanged, QXList);
//文档用户信息
myEditControl.UserLoginByParameter(
AIMSExtension.PublicMethod.OperatorNo,
AIMSExtension.PublicMethod.OperatorName,
AIMSExtension.PublicMethod.PermissionLevel);
//隐藏痕迹先
myEditControl.ExecuteCommand(StandardCommandNames.CleanViewMode, false, true);
}
private void LoadDocumentGoodsBill2()
{
if (DModel2.Id > 0)
{
//加载文档
DModel2 = DocumentDAL.GetDocumentbyId(DModel2.Id);
myEditControl2.LoadDocumentFromString(DModel2.XmlFile, "xml");
//患者基本信息二次赋值
var query = from XTextElement in myEditControl2.Document.Fields.ToArray()
where XTextElement is XTextInputFieldElement
&& (XTextElement as XTextInputFieldElement).FieldSettings != null
&& (XTextElement as XTextInputFieldElement).FieldSettings.EditStyle != InputFieldEditStyle.Date
&& (XTextElement as XTextInputFieldElement).FieldSettings.ListSource != null
select XTextElement as XTextInputFieldElement;
DataRow[] dr = DocumentDAL.GetReflectionList("V_OperationRecordALL").Select("KB_SEQ <> '' and Reload=1");
var p = typeof(PatientRecord).GetProperties();
for (int i = 0; i < dr.Count(); i++)
{
var name = dr[i].ItemArray[0].ToString();
var value = dr[i].ItemArray[1].ToString();
XTextInputFieldElement element = query.Where(x => x.FieldSettings.ListSource.SourceName == value).FirstOrDefault();
PropertyInfo info = p.Where(px => px.Name == name).FirstOrDefault();
if (element != null && info != null)
{
if (value == "KB20180604142714558" && element.Text != "") continue;
else
element.Text = info.GetValue(Patient, null).ToString();
}
}
}
else
{
//无文档则加载模板
TModel2 = DocumentDAL.GetTemplatebyId(DModel2.TemplateId);
if (TModel2.XmlFile == null || TModel2.XmlFile.Trim().Equals(string.Empty))
{
myEditControl2.ExecuteCommand("FileNew", true, null);
}
else
{
myEditControl2.LoadDocumentFromString(TModel2.XmlFile, "xml");
}
DModel2.XmlFileName = TModel2.XmlFileName;
DModel2.TemplateId = TModel2.Id;
//患者基本信息赋值
var query = from XTextElement in myEditControl2.Document.Fields.ToArray()
where XTextElement is XTextInputFieldElement
&& (XTextElement as XTextInputFieldElement).FieldSettings != null
&& (XTextElement as XTextInputFieldElement).FieldSettings.EditStyle != InputFieldEditStyle.Date
&& (XTextElement as XTextInputFieldElement).FieldSettings.ListSource != null
select XTextElement as XTextInputFieldElement;
DataRow[] dr = DocumentDAL.GetReflectionList("V_OperationRecordALL").Select("KB_SEQ <> ''");
var p = typeof(PatientRecord).GetProperties();
for (int i = 0; i < dr.Count(); i++)
{
var name = dr[i].ItemArray[0].ToString();
var value = dr[i].ItemArray[1].ToString();
XTextInputFieldElement element = query.Where(x => x.FieldSettings.ListSource.SourceName == value).FirstOrDefault();
if (element != null)
{
PropertyInfo info = p.Where(px => px.Name == name).FirstOrDefault();
if (value == "KB20180604142714558" && element.Text != "") continue;
if (element != null && info != null)
{
element.Text = info.GetValue(Patient, null).ToString();
}
}
}
DocumentExtension.SetDocumentDefaultValue(TModel2.XmlFileName, myEditControl2.Document, Patient);
}
string xmlStatic = DocumentDAL.GetEventXml(DModel2.TemplateId);
if (xmlStatic != string.Empty)
{
XmlDocument doc = new XmlDocument();
doc.LoadXml(xmlStatic);
strClick = doc.GetElementsByTagName("ClickEvent")[0].InnerText;
strContentChanged = doc.GetElementsByTagName("ContentChangedEnvent")[0].InnerText;
}
codeCompiler = new EventCodeCompilerBill(ref this.myEditControl2, strClick, strContentChanged, QXList);
//文档用户信息
myEditControl2.UserLoginByParameter(
AIMSExtension.PublicMethod.OperatorNo,
AIMSExtension.PublicMethod.OperatorName,
AIMSExtension.PublicMethod.PermissionLevel);
//隐藏痕迹先
myEditControl2.ExecuteCommand(StandardCommandNames.CleanViewMode, false, true);
}
#endregion
}
}