AIMS/AIMS/OperationFront/frmOperationApply.cs
2023-03-14 19:05:29 +08:00

226 lines
9.1 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 AIMSBLL;
using AIMSExtension;
using AIMSModel;
using DevComponents.DotNetBar;
using DevComponents.DotNetBar.Controls;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Security.Policy;
using System.Text;
using System.Windows.Forms;
namespace AIMS.OperationFront.UI
{
public partial class frmOperationApply : Form
{
public frmOperationApply()
{
InitializeComponent();
}
public SysConfig sysPass = BSysConfig.SelectSingle(" name='手术申请审核功能' ", null);
private void frmOperationApply_Load_1(object sender, EventArgs e)
{
dgv.AutoGenerateColumns = false;
dgv.BackgroundColor = System.Drawing.Color.Snow;
if (sysPass.IsValid == 1 && sysPass.Value == "1")
{ toolStripSeparator4.Visible = true; tsbAuditing.Visible = true; }
else
{ toolStripSeparator4.Visible = false; tsbAuditing.Visible = false; }
dtpBegInDate.Value = DateTime.Parse(dtpBegInDate.Value.ToString("yyyy-MM-dd"));
dtpEndDate.Value = DateTime.Parse(dtpEndDate.Value.ToString("yyyy-MM-dd")).AddDays(4);
List<Department> list = new List<Department>();
list = BDepartment.GetDepartmentAllList();
list.Insert(0, new Department
{
Id = -1,
Name = "全部科室"
});
cboDepartment.DataSource = list;
cboDepartment.DisplayMember = "Name";
cboDepartment.ValueMember = "Id";
cboDepartment.SelectedIndex = -1;
cboDepartment.Text = "全部科室";
if (AIMSExtension.PublicMethod.RoleId == 5)
cboDepartment.Text = BDepartment.GetModel(AIMSExtension.PublicMethod.DepId).Name;
LoadDataRescue();
}
private System.Windows.Forms.Timer timerLoadRescue;
public void LoadDataRescue()
{
timerLoadRescue = new System.Windows.Forms.Timer();
timerLoadRescue.Enabled = true;//调试时设置为FALSE
timerLoadRescue.Interval = 100;
timerLoadRescue.Tick -= timerLoadRescue_Tick;
timerLoadRescue.Tick += timerLoadRescue_Tick;
timerLoadRescue.Start();
}
private void timerLoadRescue_Tick(object sender, EventArgs e)
{
timerLoadRescue.Dispose();
btnFind_Click(null, null);
}
private void tsbAdd_Click(object sender, EventArgs e)
{
frmOperationApplyDetail frmOperationApplyDetail = new frmOperationApplyDetail();
frmOperationApplyDetail.State = AIMSExtension.EditState.ADD;
frmOperationApplyDetail.FormClosed += new FormClosedEventHandler(frmOperationApplyDetail_FormClosed);
frmOperationApplyDetail.ShowDialog();
}
private void tsbExit_Click_1(object sender, EventArgs e)
{
Close();
}
private void tsbModify_Click(object sender, EventArgs e)
{
if (dgv.Rows.Count > 0)
{
//if (dgv.CurrentRow.Cells["StateColumn"].Value.ToString() == "已申请")
//{
frmOperationApplyDetail frmOperationApplyDetail = new frmOperationApplyDetail();
frmOperationApplyDetail.State = AIMSExtension.EditState.EDIT;
frmOperationApplyDetail.EditApplyId = int.Parse(dgv.CurrentRow.Cells["ApplyId"].Value.ToString());
frmOperationApplyDetail.FormClosed += new FormClosedEventHandler(frmOperationApplyDetail_FormClosed);
frmOperationApplyDetail.ShowDialog();
//}
}
}
void frmOperationApplyDetail_FormClosed(object sender, FormClosedEventArgs e)
{
}
private void btnFind_Click(object sender, EventArgs e)
{
DataTable dt = BOperationApply.GetOperationFrontDataTable(dtpBegInDate.Value.ToString("yyyy-MM-dd 00:00:00"), dtpEndDate.Value.ToString("yyyy-MM-dd 23:59:59"));
string dept = "";
if (cboDepartment.Text != "" && cboDepartment.Text != "全部科室")
{
dept = " and ApplyDepName LIKE '%" + cboDepartment.Text + "%' ";
}
DataTable Newdt = new DataTable();
if (CHK10.Checked)
{
Newdt = AIMSExtension.PublicMethod.GetNewDataTable(dt, " StateId=10 " + dept + "AND MdrecNo LIKE '%" + txtMdrecNo.Text.Trim() + "%'", "OrderOperationTime");
}
else
{
Newdt = AIMSExtension.PublicMethod.GetNewDataTable(dt, " StateId>0 " + dept + "AND MdrecNo LIKE '%" + txtMdrecNo.Text.Trim() + "%'", "OrderOperationTime");
}
dgv.DataSource = Newdt;
for (int i = 0; i < dgv.Rows.Count; i++)
{
if (dgv.Rows[i].Cells["OperationTypeColumn"].Value.ToString() == "急诊")
{
dgv.Rows[i].DefaultCellStyle.BackColor = Color.Red;
}
}
}
private void dgv_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
{
Rectangle rectangle = new Rectangle(e.RowBounds.Location.X,
e.RowBounds.Location.Y,
dgv.RowHeadersWidth - 4,
e.RowBounds.Height);
TextRenderer.DrawText(e.Graphics, (e.RowIndex + 1).ToString(),
dgv.RowHeadersDefaultCellStyle.Font,
rectangle,
dgv.RowHeadersDefaultCellStyle.ForeColor,
TextFormatFlags.VerticalCenter | TextFormatFlags.Right);
}
private void tsbSet_Click(object sender, EventArgs e)
{
}
private void tsbAuditing_Click(object sender, EventArgs e)
{
if (dgv.RowCount > 0)
{
if (MessageBox.Show("您确定要审核?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
try
{
for (int i = 0; i < dgv.Rows.Count; i++)
{
if (bool.Parse(this.dgv.Rows[i].Cells["CheckBoxColumn"].EditedFormattedValue.ToString()))
{
int ApplyId = int.Parse(dgv.Rows[i].Cells["ApplyId"].Value.ToString());
if (dgv.Rows[i].Cells["OperationTypeColumn"].Value.ToString() == "特急")
{
BOperationApply.UpdatePlanOperationTime(ApplyId, AIMSExtension.PublicMethod.SystemDate().ToString(), 1, 4); //状态4 已排程
}
else
{
BOperationApply.UpdateVerifyTime(ApplyId, AIMSExtension.PublicMethod.SystemDate().ToString(), AIMSExtension.PublicMethod.OperatorNo);
}
}
}
btnFind_Click(null, null);
MessageBox.Show("审核通过!");
}
catch (Exception ex)
{
MessageBox.Show("审核失败!" + ex.Message);
}
}
}
}
private void tsbDelete_Click(object sender, EventArgs e)
{
if (dgv.Rows.Count > 0)
{
int ApplyId = int.Parse(dgv.CurrentRow.Cells["ApplyId"].Value.ToString());
string MdrecNo = dgv.CurrentRow.Cells["MdrecNoColumn"].Value.ToString();
string PatientName = dgv.CurrentRow.Cells["PatientNameColumn"].Value.ToString();
bool isDelete = false;
if (AIMSExtension.PublicMethod.RoleId == 7 || AIMSExtension.PublicMethod.RoleId == 1 || AIMSExtension.PublicMethod.RoleId == 10)
{
isDelete = true;
}
if (isDelete == true)
if (MessageBox.Show("您确定要作废 (住院号:" + MdrecNo + " 患者姓名:" + PatientName + ")", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
try
{
BOperationApply.UpdateApplyState(ApplyId, 11);
MessageBox.Show("作废成功!");
btnFind_Click(null, null);
}
catch (Exception ex)
{
MessageBox.Show("作废失败!" + ex.Message);
}
}
}
}
private void toolStripButton1_Click(object sender, EventArgs e)
{
if (dgv.Rows.Count > 0)
{
int selApply = int.Parse(dgv.CurrentRow.Cells["ApplyId"].Value.ToString());
EMRExtension.OpenEMRS(0, selApply);
}
}
}
}