245 lines
10 KiB
C#
245 lines
10 KiB
C#
using DrawGraph;
|
|
using AIMS.OremrUserControl;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
using AIMSBLL;
|
|
using AIMSModel;
|
|
using static System.Windows.Forms.VisualStyles.VisualStyleElement.TaskbarClock;
|
|
|
|
namespace AIMS.OperationAanesthesia
|
|
{
|
|
public partial class frmRecoverPatient : Form
|
|
{
|
|
List<OperationRoom> rooms;
|
|
public frmRecoverPatient()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void frmRecoverPatientNew_Load(object sender, EventArgs e)
|
|
{
|
|
dgv.AllowUserToResizeColumns = false;
|
|
dgv.AllowUserToResizeRows = false;
|
|
dgv.AllowUserToAddRows = false;
|
|
dgv.AllowUserToDeleteRows = false;
|
|
dgv.BackgroundColor = System.Drawing.Color.Snow;
|
|
|
|
dgv.DataError += new DataGridViewDataErrorEventHandler(dgv_DataError);
|
|
|
|
rooms = BOperationRoom.GetOperationRooms("IsValid=1 and Site='恢复室'");
|
|
|
|
FillDgv();
|
|
dgv.ClearSelection();
|
|
}
|
|
|
|
|
|
|
|
void dgv_DataError(object sender, DataGridViewDataErrorEventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void btnNext_Click(object sender, EventArgs e)
|
|
{
|
|
dtpSelectPatientTime.Value = dtpSelectPatientTime.Value.AddDays(1);
|
|
}
|
|
private void btnFrontDay_Click(object sender, EventArgs e)
|
|
{
|
|
dtpSelectPatientTime.Value = dtpSelectPatientTime.Value.AddDays(-1);
|
|
}
|
|
|
|
private void dtpSelectPatientTime_ValueChanged(object sender, EventArgs e)
|
|
{
|
|
FillDgv();
|
|
}
|
|
|
|
private void FillDgv()
|
|
{
|
|
if (supTabPatient.SelectedTab.Name == "待复苏")
|
|
{
|
|
DateTime dateTime = DateTime.Parse(dtpSelectPatientTime.Value.ToString("yyyy-MM-dd").ToString());
|
|
dgv.Rows.Clear();
|
|
DataTable dt = SelectPatient.GetRecoverPatientDataTable(dateTime);
|
|
foreach (DataRow dr in dt.Rows)
|
|
{
|
|
dgv.Rows.Add(dr["Id"].ToString(),
|
|
dr["PatientId"].ToString(),
|
|
dr["ApplyId"].ToString(),
|
|
dr["OperationRoom"].ToString(),
|
|
//dr["MdrecNo"].ToString()+" "+
|
|
dr["PatientName"].ToString(),
|
|
DateTime.Parse(dr["OutRoomTime"].ToString()).ToString("MM-dd HH:mm"),
|
|
dr["OperationDoctor"].ToString(),
|
|
dr["AnesthesiaDoctor"].ToString()
|
|
);
|
|
}
|
|
|
|
panel3.Controls.Clear();
|
|
DataTable dt2 = SelectPatient.GetRecoverLockingPatientDataTable(dateTime);
|
|
|
|
int i = 0, j = 0;
|
|
foreach (OperationRoom room in rooms)
|
|
{
|
|
ucPatientRecoverCard uc = new ucPatientRecoverCard(room);
|
|
uc.InRoom += Uc_InRoom;
|
|
uc.Clicks += Uc_Clicks;
|
|
uc.Location = new Point((uc.Width + 9) * j, (uc.Height + 10) * i + 30);
|
|
foreach (DataRow dr in dt2.Rows)
|
|
{
|
|
if (dr["OperationRoom"].ToString() == uc.labelName.Text)
|
|
{
|
|
uc.SetucPatientRecoverCard(dr);
|
|
break;
|
|
}
|
|
}
|
|
panel3.Controls.Add(uc);
|
|
j++;
|
|
if (j == 4)
|
|
{
|
|
i++;
|
|
j = 0;
|
|
}
|
|
//防止显示全部卡顿
|
|
if (i >= 10) break;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
dgv2.Rows.Clear();
|
|
DataTable dtt = SelectPatient.GetRecoverPatientOutDataTable
|
|
(DateTime.Parse(dtpBeginTime.Value.ToString("yyyy-MM-dd 00:00:00").ToString()), DateTime.Parse(dtpEndTime.Value.ToString("yyyy-MM-dd 23:59:59").ToString()));
|
|
foreach (DataRow dr in dtt.Rows)
|
|
{
|
|
dgv2.Rows.Add(dr["Id"].ToString(),
|
|
dr["PatientId"].ToString(),
|
|
dr["ApplyId"].ToString(),
|
|
dr["OperationRoom"].ToString(),
|
|
//dr["MdrecNo"].ToString()+" "+
|
|
dr["PatientName"].ToString(),
|
|
DateTime.Parse(dr["OutRoomTime"].ToString()).ToString("MM-dd HH:mm"),
|
|
dr["OperationDoctor"].ToString(),
|
|
dr["AnesthesiaDoctor"].ToString()
|
|
);
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
private void dgv_CellContentClick(object sender, DataGridViewCellEventArgs e)
|
|
{
|
|
}
|
|
public int RecoverId = 2;
|
|
|
|
private void Uc_Clicks(ucPatientRecoverCard uc, DataRow dr)
|
|
{
|
|
//FillDgv();
|
|
}
|
|
private void Uc_InRoom(ucPatientRecoverCard uc, int PatientId, int applyId)
|
|
{
|
|
try
|
|
{
|
|
if (uc.buttonX1.Text == "转入复苏")
|
|
{
|
|
if (supTabPatient.SelectedTab.Name == "待复苏" && dgv.SelectedRows.Count > 0)
|
|
{
|
|
AIMS.OperationAanesthesia.frmAanesthesiaRecover frmAnasRecord = new OperationAanesthesia.frmAanesthesiaRecover();
|
|
frmAnasRecord.PatientId = int.Parse(dgv.SelectedRows[0].Cells["PatientIdColumn"].Value.ToString());
|
|
frmAnasRecord.ApplyId = int.Parse(dgv.SelectedRows[0].Cells["ApplyIdColumn"].Value.ToString());
|
|
frmAnasRecord.RecoverId = RecoverId;
|
|
frmAnasRecord.NowRoom = AIMSBLL.BOperationRoom.SelectSingle(int.Parse(uc.Tag.ToString()));
|
|
frmAnasRecord.State = AIMSExtension.EditState.ADD;
|
|
try
|
|
{
|
|
HelperDB.DbHelperSQL.BeginTrans();
|
|
BOperationApply.UpdateApplyState(frmAnasRecord.ApplyId, 7);// 7 麻醉恢复中
|
|
|
|
//增加入室事件
|
|
Events EventsObj = BEvents.GetModelByName("入室");
|
|
if (EventsObj.Name != null)
|
|
{
|
|
OperationRecord _record = null;
|
|
DateTime Time = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd HH:mm:00"));
|
|
BOperationRecord.SelectSingle(frmAnasRecord.PatientId , 1, ref _record);
|
|
if (_record != null && _record.OutRoomTime != null)
|
|
Time = DateTime.Parse(_record.OutRoomTime.Value.AddMinutes(1).ToString("yyyy-MM-dd HH:mm:00"));
|
|
|
|
FactEvents FactEventsObj = new FactEvents();
|
|
FactEventsObj.EventId = EventsObj.Id;
|
|
FactEventsObj.EventTypeId = 2;
|
|
FactEventsObj.EventBeginTime = Time;
|
|
FactEventsObj.EventEndTime = FactEventsObj.EventBeginTime;
|
|
FactEventsObj.IsContinue = 0;
|
|
FactEventsObj.PatientId = frmAnasRecord.PatientId;
|
|
FactEventsObj.OperatorNo = AIMSExtension.PublicMethod.OperatorNo;
|
|
FactEventsObj.OperatorName = AIMSExtension.PublicMethod.OperatorName;
|
|
FactEventsObj.OperateDate = AIMSExtension.PublicMethod.SystemDate();
|
|
|
|
BFactEvents.Add(FactEventsObj);
|
|
}
|
|
HelperDB.DbHelperSQL.CommitTrans();
|
|
}
|
|
catch
|
|
{
|
|
HelperDB.DbHelperSQL.RollbackTrans();
|
|
}
|
|
frmAnasRecord.ShowDialog();
|
|
FillDgv();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
AIMS.OperationAanesthesia.frmAanesthesiaRecover frmAnasRecord = new OperationAanesthesia.frmAanesthesiaRecover();
|
|
frmAnasRecord.PatientId = PatientId;
|
|
frmAnasRecord.ApplyId = applyId;
|
|
frmAnasRecord.NowRoom = AIMSBLL.BOperationRoom.SelectSingle(int.Parse(uc.Tag.ToString()));
|
|
frmAnasRecord.State = AIMSExtension.EditState.EDIT;
|
|
frmAnasRecord.ShowDialog();
|
|
FillDgv();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
AIMSExtension.PublicMethod.WriteLog(ex);
|
|
}
|
|
}
|
|
|
|
private void dgv2_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e)
|
|
{
|
|
int SelApplyId = int.Parse(dgv2.CurrentRow.Cells["ApplyIdColumn2"].Value.ToString());
|
|
int SelPatientId = int.Parse(dgv2.CurrentRow.Cells["PatientIdColumn2"].Value.ToString());
|
|
|
|
AIMS.OperationAanesthesia.frmAanesthesiaRecover frmAnasRecord = new OperationAanesthesia.frmAanesthesiaRecover();
|
|
frmAnasRecord.PatientId = SelPatientId;
|
|
frmAnasRecord.ApplyId = SelApplyId;
|
|
frmAnasRecord.State = AIMSExtension.EditState.BROWSE;
|
|
frmAnasRecord.ShowDialog();
|
|
}
|
|
|
|
private void supTabPatient_SelectedTabChanged(object sender, DevComponents.DotNetBar.SuperTabStripSelectedTabChangedEventArgs e)
|
|
{
|
|
if (supTabPatient.SelectedTab.Name == "待复苏")
|
|
{
|
|
panel2.Visible = true;
|
|
panel4.Visible = false;
|
|
}
|
|
else
|
|
{
|
|
panel4.Visible = true;
|
|
panel2.Visible = false;
|
|
FillDgv();
|
|
}
|
|
}
|
|
|
|
private void btnFind_Click(object sender, EventArgs e)
|
|
{
|
|
FillDgv();
|
|
}
|
|
}
|
|
}
|