526 lines
22 KiB
C#
526 lines
22 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 AIMSModel;
|
|
using AIMSBLL;
|
|
using DCSoftDotfuscate;
|
|
using System.Net;
|
|
using AIMSExtension;
|
|
using DocumentManagement;
|
|
|
|
namespace AIMS.OperationAanesthesia
|
|
{
|
|
public partial class frmSelectPatientNew2 : Form
|
|
{
|
|
|
|
public int SelPatientId;
|
|
public int SelApplyId;
|
|
public bool isMainOpen = false;
|
|
public AIMS.OperationAanesthesia.frmAanesthesiaRecord tempfrmAnasRecord;
|
|
|
|
public frmSelectPatientNew2()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void frmSelectPatientNew2_Load(object sender, EventArgs e)
|
|
{
|
|
ControlExtension.GetOperationSiteRoom(labelSite, CboOperationSite, cboRoom,"手术室");
|
|
FillDgv();
|
|
|
|
this.cboRoom.SelectedIndexChanged += new System.EventHandler(this.cboRoom_SelectedIndexChanged);
|
|
this.CboOperationSite.SelectedIndexChanged += new System.EventHandler(this.CboOperationSite_SelectedIndexChanged);
|
|
}
|
|
|
|
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()
|
|
{
|
|
panel3.Controls.Clear();
|
|
panel2.Visible = false;
|
|
|
|
DataTable dt = new DataTable();
|
|
if (txtquery.Text.Trim() != "")
|
|
dt = SelectPatient.GetSelectPatientDataTable(txtquery.Text);
|
|
else
|
|
dt = SelectPatient.GetSelectPatientDataTable(DateTime.Parse(dtpSelectPatientTime.Value.ToString("yyyy-MM-dd").ToString()), cboRoom.SelectedValue.ToString());
|
|
|
|
DataTable dt2 = new DataTable();
|
|
if (txtquery.Text.Trim() != "")
|
|
dt2 = SelectPatient.GetRelieveLockingPatientDataTable(txtquery.Text);
|
|
else
|
|
dt2 = SelectPatient.GetRelieveLockingPatientDataTable(DateTime.Parse(dtpSelectPatientTime.Value.ToString("yyyy-MM-dd").ToString()), cboRoom.SelectedValue.ToString());
|
|
|
|
if (CboOperationSite.Visible == true && CboOperationSite.SelectedIndex > 0)
|
|
{
|
|
dt = AIMSExtension.PublicMethod.GetNewDataTable(dt, " OperationSite ='" + CboOperationSite.SelectedValue + "' ", "");
|
|
dt2 = AIMSExtension.PublicMethod.GetNewDataTable(dt2, " OperationSite ='" + CboOperationSite.SelectedValue + "' ", "");
|
|
}
|
|
|
|
List<string> list = new List<string>();
|
|
for (int i = 0; i < ControlExtension.SiteRooms.Count; i++)
|
|
{
|
|
foreach (DataRow dr in dt.Rows)
|
|
{
|
|
if (dr["OperationRoom"].ToString() == ControlExtension.SiteRooms[i].Name && !list.Contains(ControlExtension.SiteRooms[i].Name))
|
|
{
|
|
list.Add(ControlExtension.SiteRooms[i].Name);
|
|
}
|
|
}
|
|
|
|
foreach (DataRow dr in dt2.Rows)
|
|
{
|
|
if (dr["OperationRoom"].ToString() == ControlExtension.SiteRooms[i].Name && !list.Contains(ControlExtension.SiteRooms[i].Name))
|
|
{
|
|
list.Add(ControlExtension.SiteRooms[i].Name);
|
|
}
|
|
}
|
|
}
|
|
if (cboRoom.Text != "")
|
|
{
|
|
int i = 0, j = 0;
|
|
foreach (DataRow dr in dt.Rows)
|
|
{
|
|
if (dr["OperationRoom"].ToString() != cboRoom.Text) continue;
|
|
ucPatientCard uc = new ucPatientCard(dr);
|
|
uc.InRoom += Uc_InRoom;
|
|
uc.QxRoom += Uc_QxRoom;
|
|
uc.Clicks += Uc_Clicks;
|
|
uc.Location = new Point((uc.Width + 9) * j, (uc.Height + 10) * i + 30);
|
|
panel3.Controls.Add(uc);
|
|
j++;
|
|
if (j == 5)
|
|
{
|
|
i++;
|
|
j = 0;
|
|
}
|
|
}
|
|
|
|
foreach (DataRow dr in dt2.Rows)
|
|
{
|
|
if (dr["OperationRoom"].ToString() != cboRoom.Text) continue;
|
|
ucPatientCard uc = new ucPatientCard(dr);
|
|
uc.InRoom += Uc_InRoom;
|
|
uc.QxRoom += Uc_QxRoom;
|
|
uc.Clicks += Uc_Clicks;
|
|
uc.Location = new Point((uc.Width + 9) * j, (uc.Height + 10) * i + 30);
|
|
panel3.Controls.Add(uc);
|
|
j++;
|
|
if (j == 5)
|
|
{
|
|
i++;
|
|
j = 0;
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
for (int i = 0; i < list.Count; i++)
|
|
{
|
|
int j = 0;
|
|
int Pointx = 0;
|
|
foreach (DataRow dr in dt.Rows)
|
|
{
|
|
if (dr["OperationRoom"].ToString() != list[i]) continue;
|
|
ucPatientCard uc = new ucPatientCard(dr);
|
|
uc.InRoom += Uc_InRoom;
|
|
uc.QxRoom += Uc_QxRoom;
|
|
uc.Clicks += Uc_Clicks;
|
|
uc.Location = new Point((uc.Width + 9) * i, (uc.Height + 10) * j + 30);
|
|
panel3.Controls.Add(uc);
|
|
j++; Pointx = (uc.Width + 9) * i;
|
|
}
|
|
|
|
foreach (DataRow dr in dt2.Rows)
|
|
{
|
|
if (dr["OperationRoom"].ToString() != list[i]) continue;
|
|
ucPatientCard uc = new ucPatientCard(dr);
|
|
uc.InRoom += Uc_InRoom;
|
|
uc.QxRoom += Uc_QxRoom;
|
|
uc.Clicks += Uc_Clicks;
|
|
uc.Location = new Point((uc.Width + 9) * i, (uc.Height + 10) * j + 30);
|
|
panel3.Controls.Add(uc);
|
|
j++;
|
|
Pointx = (uc.Width + 9) * i;
|
|
}
|
|
|
|
if (Pointx > 0)
|
|
{
|
|
DevComponents.DotNetBar.Controls.Line line1 = new DevComponents.DotNetBar.Controls.Line();
|
|
line1.Location = new System.Drawing.Point(Pointx - 10, 0);
|
|
line1.DashStyle = System.Drawing.Drawing2D.DashStyle.DashDotDot;
|
|
line1.Size = new System.Drawing.Size(10, panel3.Height);
|
|
line1.ForeColor = Color.DarkGray;
|
|
line1.VerticalLine = true;
|
|
panel3.Controls.Add(line1);
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
|
|
public ucPatientCard SelUc;
|
|
|
|
private void Uc_Clicks(ucPatientCard uc, int PatientId, int applyId, DataRow dr)
|
|
{
|
|
SelPatientId = PatientId;
|
|
SelApplyId = applyId;
|
|
txtType.Text = dr["OperationType"].ToString();
|
|
txtNo.Text = dr["MdrecNo"].ToString();
|
|
txtname.Text = dr["PatientName"].ToString();
|
|
txtsex.Text = dr["sex"].ToString();
|
|
txtage.Text = dr["age"].ToString();
|
|
txtss.Text = dr["ApplyOperationInfoName"].ToString();
|
|
txtmzys.Text = dr["AnesthesiaDoctor"].ToString();
|
|
txttime.Text = dr["OrderOperationTime"].ToString();
|
|
txtdept.Text = dr["ApplyDepName"].ToString();
|
|
txtzdys.Text = dr["OperationDoctor"].ToString();
|
|
txths.Text = dr["InstrumentNurse"].ToString() + " " + dr["TourNurse"].ToString();
|
|
txtzd.Text = dr["ApplyDiagnoseInfoName"].ToString();
|
|
txtRoom.Text = dr["OperationRoom"].ToString();
|
|
txtRoom.Tag = dr["OperationRoomId"].ToString();
|
|
if (!txtType.Text.Contains("急")) txtType.ForeColor = Color.DarkGreen;
|
|
else txtType.ForeColor = Color.Red;
|
|
txtState.Text = dr["State"].ToString();
|
|
if (txtState.Text == "手术中" || txtState.Text == "手术结束" || txtState.Text == "停止手术")
|
|
{
|
|
label5.Text = "手术开始时间";
|
|
label23.Text = "术中诊断";
|
|
label25.Text = "实施手术";
|
|
}
|
|
else
|
|
{
|
|
label5.Text = "申请预约时间";
|
|
label23.Text = "术前诊断";
|
|
label25.Text = "拟施手术";
|
|
}
|
|
buttonX1.Text = uc.buttonX1.Text;
|
|
panel2.Visible = true;
|
|
SelUc = uc;
|
|
}
|
|
|
|
private void Uc_InRoom(ucPatientCard uc, int PatientId, int applyId)
|
|
{
|
|
string RoomStr = uc.Tag.ToString();
|
|
if (RoomStr == "")
|
|
{
|
|
frmSeleteRoom seleteRoom = new frmSeleteRoom();
|
|
seleteRoom.ShowDialog();
|
|
if (seleteRoom.RoomId != null)
|
|
{
|
|
RoomStr = seleteRoom.RoomId.ToString();
|
|
if (RoomStr != null && RoomStr != "")
|
|
{
|
|
OperationApply opeapply = BOperationApply.SelectSingle(applyId, RecursiveType.None, 0);
|
|
opeapply.State = 4;
|
|
opeapply.OperationRoomId = int.Parse(seleteRoom.RoomId);
|
|
opeapply.PlanOperationTime = dtpSelectPatientTime.Value;
|
|
opeapply.PlanOrder = BOperationApply.GetMaxPlanOrder(opeapply.PlanOperationTime.Value, opeapply.OperationRoomId.Value) + 1;
|
|
BOperationApply.Update(opeapply);
|
|
}
|
|
}
|
|
}
|
|
if (RoomStr == "") return;
|
|
SatrtOperation(uc, PatientId, applyId, int.Parse(RoomStr));
|
|
}
|
|
|
|
private void SatrtOperation(ucPatientCard uc, int PatientId, int applyId, int RoomId)
|
|
{
|
|
try
|
|
{
|
|
string State = uc.buttonX1.Text;
|
|
if (State == "转入术间")
|
|
{
|
|
OperationApply operA = BOperationApply.SelectSingle(applyId);
|
|
if (operA.State == 11)
|
|
{
|
|
MessageBox.Show("当前手术已停止 ,请确认后重新选择!", "系统提示");
|
|
FillDgv();
|
|
return;
|
|
}
|
|
if (operA.State == 6)
|
|
{
|
|
MessageBox.Show("当前手术已开始 ,请确认后重新选择!", "系统提示");
|
|
FillDgv();
|
|
return;
|
|
}
|
|
|
|
if (operA.OrderOperationTime.Value.Date != DateTime.Now.Date)// && operA.OrderOperationTime.Value.Hour < 20)
|
|
{
|
|
MessageBox.Show("该手术预约时间不是当前日期 ,请确认后重新选择!", "系统提示");
|
|
return;
|
|
}
|
|
DataTable dtOperationRecord = SelectPatient.GetTodayDoOpePatientDataTable(DateTime.Parse(dtpSelectPatientTime.Value.ToString("yyyy-MM-dd").ToString()));
|
|
foreach (DataRow row in dtOperationRecord.Rows)
|
|
{
|
|
if (row["OperationRoomId"].ToString() == operA.OperationRoomId.ToString())
|
|
{
|
|
MessageBox.Show("当前有未完成的手术占用手术间,请先选择解锁术中手术!", "系统提示");
|
|
return;
|
|
}
|
|
}
|
|
|
|
frmAanesthesiaRecord frmAnasRecord = null;
|
|
if (tempfrmAnasRecord != null && tempfrmAnasRecord._record != null)
|
|
{
|
|
frmAnasRecord = tempfrmAnasRecord;
|
|
frmAnasRecord.ClearRecordDate();
|
|
}
|
|
else
|
|
{
|
|
frmAnasRecord = new frmAanesthesiaRecord();
|
|
}
|
|
frmAnasRecord.PatientId = PatientId;
|
|
frmAnasRecord.ApplyId = applyId;
|
|
frmAnasRecord.NowRoom = AIMSBLL.BOperationRoom.SelectSingle(RoomId);
|
|
frmAnasRecord.State = AIMSExtension.EditState.ADD;
|
|
SelectPatient.UpdateApplyState(PatientId, applyId); //修改状态
|
|
|
|
uc.label2.Text = "手术中";
|
|
uc.label2.ForeColor = Color.Red;
|
|
uc.buttonX1.Text = "继续手术";
|
|
uc.buttonX2.Text = "取消手术";
|
|
uc.buttonX1.Visible = true;
|
|
uc.buttonX2.Visible = true;
|
|
uc.panelExMain.Style.BackColor1.Color = Color.OldLace;
|
|
|
|
if (isMainOpen == false)
|
|
{
|
|
frmAnasRecord.ShowDialog();
|
|
FillDgv();
|
|
}
|
|
else
|
|
{
|
|
this.Close();
|
|
}
|
|
|
|
}
|
|
else
|
|
{
|
|
frmAanesthesiaRecord frmAnasRecord = null;
|
|
if (tempfrmAnasRecord != null && tempfrmAnasRecord._record != null)
|
|
{
|
|
frmAnasRecord = tempfrmAnasRecord;
|
|
frmAnasRecord.ClearRecordDate();
|
|
}
|
|
else
|
|
{
|
|
frmAnasRecord = new frmAanesthesiaRecord();
|
|
}
|
|
frmAnasRecord.PatientId = PatientId;
|
|
frmAnasRecord.ApplyId = applyId;
|
|
frmAnasRecord.NowRoom = AIMSBLL.BOperationRoom.SelectSingle(RoomId);
|
|
if (State == "继续手术")
|
|
{
|
|
frmAnasRecord.State = AIMSExtension.EditState.EDIT;
|
|
}
|
|
else
|
|
{
|
|
frmAnasRecord.State = AIMSExtension.EditState.BROWSE;
|
|
}
|
|
|
|
if (isMainOpen == false)
|
|
{
|
|
frmAnasRecord.ShowDialog();
|
|
FillDgv();
|
|
}
|
|
else
|
|
{
|
|
this.Close();
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
AIMSExtension.PublicMethod.WriteLog(ex);
|
|
}
|
|
}
|
|
private void Uc_QxRoom(ucPatientCard uc, int RecorId, int PatientId, int applyId)
|
|
{
|
|
try
|
|
{
|
|
if (uc.buttonX2.Text == "取消手术")
|
|
{
|
|
if (BOperationRecord.GetDataCount(RecorId, PatientId, 1) > 0)
|
|
{
|
|
MessageBox.Show("清除数据在进行取消转入操作!");
|
|
return;
|
|
}
|
|
if (MessageBox.Show("确认要取消手术吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
|
{
|
|
try
|
|
{
|
|
HelperDB.DbHelperSQL.BeginTrans();
|
|
BOperationApply.UpdateApplyState(applyId, 4);
|
|
BOperationRecord.DeleteOperationRecordData(RecorId, PatientId, 1);
|
|
|
|
if (isMainOpen == false)
|
|
{
|
|
FillDgv();
|
|
}
|
|
else
|
|
{
|
|
this.Close();
|
|
}
|
|
}
|
|
catch
|
|
{
|
|
HelperDB.DbHelperSQL.RollbackTrans();
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (MessageBox.Show("确认要返回手术吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
|
{
|
|
try
|
|
{
|
|
HelperDB.DbHelperSQL.BeginTrans();
|
|
BOperationApply.UpdateApplyState(applyId, 6);
|
|
BOperationRecord.UpdateOpeState(PatientId, 1, 1, "");
|
|
BOperationRecord.DeleteEvent(PatientId, 8);
|
|
HelperDB.DbHelperSQL.CommitTrans();
|
|
|
|
frmAanesthesiaRecord frmAnasRecord = null;
|
|
if (tempfrmAnasRecord != null && tempfrmAnasRecord._record != null)
|
|
{
|
|
frmAnasRecord = tempfrmAnasRecord;
|
|
frmAnasRecord.ClearRecordDate();
|
|
}
|
|
else
|
|
{
|
|
frmAnasRecord = new frmAanesthesiaRecord();
|
|
}
|
|
frmAnasRecord.PatientId = PatientId;
|
|
frmAnasRecord.ApplyId = applyId;
|
|
frmAnasRecord.NowRoom = AIMSBLL.BOperationRoom.SelectSingle(int.Parse(uc.Tag.ToString()));
|
|
frmAnasRecord.State = AIMSExtension.EditState.EDIT;
|
|
|
|
frmAnasRecord._record = new OperationRecord();
|
|
frmAnasRecord._record.Id = PatientId;
|
|
|
|
if (isMainOpen == false)
|
|
{
|
|
frmAnasRecord.ShowDialog();
|
|
FillDgv();
|
|
}
|
|
else
|
|
{
|
|
//if (frmAnasRecord._record != null)
|
|
// frmAnasRecord.ClearRecordDate();
|
|
this.Close();
|
|
}
|
|
}
|
|
catch
|
|
{
|
|
HelperDB.DbHelperSQL.RollbackTrans();
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
AIMSExtension.PublicMethod.WriteLog(ex);
|
|
}
|
|
}
|
|
|
|
private void cboRoom_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
if (cboRoom.SelectedIndex > 0)
|
|
{
|
|
PublicMethod.SelectRoom = Convert.ToInt32(cboRoom.SelectedValue);
|
|
}
|
|
else
|
|
{
|
|
PublicMethod.SelectRoom = -1;
|
|
}
|
|
FillDgv();
|
|
}
|
|
|
|
private void buttonX1_Click(object sender, EventArgs e)
|
|
{
|
|
string RoomStr = txtRoom.Tag.ToString();
|
|
if (RoomStr == "")
|
|
{
|
|
frmSeleteRoom seleteRoom = new frmSeleteRoom();
|
|
seleteRoom.ShowDialog();
|
|
if (seleteRoom.RoomId != null)
|
|
{
|
|
RoomStr = seleteRoom.RoomId.ToString();
|
|
if (RoomStr != null && RoomStr != "")
|
|
{
|
|
OperationApply opeapply = BOperationApply.SelectSingle(SelApplyId, RecursiveType.None, 0);
|
|
opeapply.State = 4;
|
|
opeapply.OperationRoomId = int.Parse(seleteRoom.RoomId);
|
|
opeapply.PlanOperationTime = dtpSelectPatientTime.Value;
|
|
opeapply.PlanOrder = BOperationApply.GetMaxPlanOrder(opeapply.PlanOperationTime.Value, opeapply.OperationRoomId.Value) + 1;
|
|
BOperationApply.Update(opeapply);
|
|
}
|
|
}
|
|
}
|
|
if (RoomStr == "") return;
|
|
SatrtOperation(SelUc, SelPatientId, SelApplyId, (int.Parse(RoomStr)));
|
|
}
|
|
|
|
private void buttonX3_Click(object sender, EventArgs e)
|
|
{
|
|
AIMS.OperationFront.UI.frmOperationApplyDetail frmOperationApplyDetail = new AIMS.OperationFront.UI.frmOperationApplyDetail();
|
|
frmOperationApplyDetail.State = AIMSExtension.EditState.ADD;
|
|
frmOperationApplyDetail.ShowDialog();
|
|
}
|
|
|
|
private void btnQuery_Click(object sender, EventArgs e)
|
|
{
|
|
FillDgv();
|
|
}
|
|
|
|
private void buttonX2_Click(object sender, EventArgs e)
|
|
{
|
|
string RoomStr = txtRoom.Tag.ToString();
|
|
if (RoomStr != "")
|
|
{
|
|
frmSeleteRoom seleteRoom = new frmSeleteRoom();
|
|
seleteRoom.NowRoomId = RoomStr;
|
|
seleteRoom.ShowDialog();
|
|
RoomStr = seleteRoom.RoomId;
|
|
if (RoomStr != null && RoomStr != "")
|
|
{
|
|
txtRoom.Text = seleteRoom.RoomName;
|
|
txtRoom.Tag = int.Parse(RoomStr);
|
|
BOperationRecord.Update("RoomId=@RoomId where OperationApplyId=@id ", new AIMSModel.ParameterList("@RoomId", int.Parse(RoomStr), "@id", SelApplyId));
|
|
BOperationApply.UpdateApplyRoom(SelApplyId, int.Parse(RoomStr), DateTime.Parse(txttime.Text));
|
|
BOperationApply.UpdteOperationOrder(DateTime.Parse(txttime.Text), int.Parse(RoomStr));
|
|
FillDgv();
|
|
panel2.Visible = true;
|
|
MessageBox.Show("手术间切换成功!");
|
|
}
|
|
}
|
|
}
|
|
private void CboOperationSite_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
ControlExtension.SetOperationSiteRoom(CboOperationSite, cboRoom);
|
|
//FillDgv();
|
|
}
|
|
}
|
|
} |