AIMS/AIMSControls/OperationAfter/frmOperationManage.cs
2023-08-21 08:28:12 +08:00

627 lines
27 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.OperationAanesthesia;
using AIMSBLL;
using AIMSExtension;
using AIMSModel;
using DevComponents.DotNetBar.Controls;
using Microsoft.Office.Interop.Excel;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Windows.Forms;
namespace AIMS.OperationAfter.UI
{
public partial class frmOperationManage : Form
{
public frmOperationManage()
{
InitializeComponent();
}
public SysConfig exportConfig;
public string DataGridViewPath = "";
public List<Department> listNew = new List<Department>();
public List<Department> listOnit = new List<Department>();
private void frmOperationManage_Load(object sender, EventArgs e)
{
//1.系统管理员 7.麻醉主任 8.麻醉护士 9.麻醉医生
if ("1,7,8,9".Contains(AIMSExtension.PublicMethod.RoleId.ToString()))
{
tsbReviewApply.Visible = true;
toolStripSeparator1.Visible = true;
}
if (PublicMethod.HospitalName.Contains("漳浦天福"))
{
label16.Visible = true;
cboOperationGroup.Visible = true;
this.dataGridViewTextBoxColumn7.Visible = true;
}
dgv.AutoGenerateColumns = false;
dgv.BackgroundColor = System.Drawing.Color.Snow;
ControlExtension.SetDgvAttribute(dgv);
DataGridViewPath = GetControlPath(dgv);
exportConfig = BSysConfig.SelectSingle(" Note='" + DataGridViewPath + "' and (Extend1 = null or Extend1='" + PublicMethod.RoleId + "')", null, RecursiveType.None, 0);//
if (exportConfig != null)
ConfigDataGridView(exportConfig);
listOnit = BDepartment.GetDepartmentAllListBYSql("");
listOnit.Insert(0, new Department() { Id = -1, Name = "全部科室" });
this.cboDept.Items.AddRange(listOnit.ToArray());
cboDept.ValueMember = "Id";
cboDept.DisplayMember = "Name";
cboDept.SelectedIndex = -1;
if (cboOperationGroup.Visible == true)
{
System.Data.DataTable OperationGroups = BDepartment.GetOperationGroups();
cboOperationGroup.DataSource = OperationGroups;
cboOperationGroup.DisplayMember = "Names";
cboOperationGroup.ValueMember = "Names";
cboOperationGroup.SelectedIndex = -1;
}
dtpBegInDate.Value = DateTime.Parse(dtpBegInDate.Value.ToString("yyyy-MM-dd"));
dtpEndDate.Value = DateTime.Parse(dtpEndDate.Value.ToString("yyyy-MM-dd")).AddDays(4);
tokenEditor1.Tokens.Add(new DevComponents.DotNetBar.Controls.EditToken("1,2,3,4,5,6,7,8,9,10,11", "全部"));
tokenEditor1.Tokens.Add(new DevComponents.DotNetBar.Controls.EditToken("1,2,3", "待排程"));
tokenEditor1.Tokens.Add(new DevComponents.DotNetBar.Controls.EditToken("4,5", "已排程"));
tokenEditor1.Tokens.Add(new DevComponents.DotNetBar.Controls.EditToken("6,7", "手术中"));
tokenEditor1.Tokens.Add(new DevComponents.DotNetBar.Controls.EditToken("8,9", "手术结束"));
tokenEditor1.Tokens.Add(new DevComponents.DotNetBar.Controls.EditToken("10,11", "手术停止"));
tokenEditor1.SelectedTokens.Add(tokenEditor1.Tokens[0]);
List<OperationRoom> rooms = BOperationRoom.GetOperationRooms("IsValid=1 and Site<>'恢复室'");
foreach (var item in rooms)
{
tokenEditor2.Tokens.Add(new DevComponents.DotNetBar.Controls.EditToken(item.Id.ToString(), item.Name));
}
List<AnaesthesiaMethod> Anaes = BAnaesthesiaMethod.Select(" IsValid=1 Order by UseRate asc", null);
foreach (var item in Anaes)
{
tokenEditor3.Tokens.Add(new DevComponents.DotNetBar.Controls.EditToken(item.Id.ToString(), item.Name));
}
BindBasicDictionaryToComboBox(txtASALevel, "ASA分级");
BindBasicDictionaryToComboBox(txtOperationCut, "手术切口");
List<OperationLevel> basicDictionary = BOperationLevel.Select();
basicDictionary.Insert(0, new OperationLevel() { Id = -1, Name = "" });
cboOperationLevel.DataSource = basicDictionary;
cboOperationLevel.DisplayMember = "Name";
cboOperationLevel.ValueMember = "Id";
cboOperationLevel.SelectedIndex = -1;
ControlExtension.GetOperationSite(labelSite, CboOperationSite);
LoadDataRescue();
}
private System.Windows.Forms.Timer timerLoadRescue;
public void LoadDataRescue()
{
timerLoadRescue = new System.Windows.Forms.Timer();
timerLoadRescue.Enabled = true;//调试时设置为FALSE
timerLoadRescue.Interval = 300;
timerLoadRescue.Tick -= timerLoadRescue_Tick;
timerLoadRescue.Tick += timerLoadRescue_Tick;
timerLoadRescue.Start();
}
private void timerLoadRescue_Tick(object sender, EventArgs e)
{
timerLoadRescue.Enabled=false;
btnFind_Click(null, null);
}
/// <summary>
/// 绑定基础表项目数据 到 ComboBox
/// </summary>
/// <param name="loadCbo"></param>
/// <param name="setDataName"></param>
public static void BindBasicDictionaryToComboBox(ComboBox loadCbo, string setDataName)
{
BasicDictionary basicDictionary = BBasicDictionary.GetBasicDictionaryByName(setDataName);
if (basicDictionary == null) return;
basicDictionary.SubItem.Insert(0, new BasicDictionary() { Id = -1, Name = "" });
loadCbo.DataSource = basicDictionary.SubItem;
loadCbo.DisplayMember = "Name";
loadCbo.ValueMember = "Id";
loadCbo.SelectedIndex = -1;
}
private void btnFind_Click(object sender, EventArgs e)
{
string Department = cboDept.Text;
if (Department == "全部科室")
{
Department = "";
}
string OperationGroup = cboOperationGroup.Text;
string state = "";
for (int i = 0; i < tokenEditor1.SelectedTokens.Count; i++)
{
var item = tokenEditor1.SelectedTokens[i];
if (i == tokenEditor1.SelectedTokens.Count - 1)
state += item.Value;
else
state += item.Value + ",";
}
string Room = "";
for (int i = 0; i < tokenEditor2.SelectedTokens.Count; i++)
{
var item = tokenEditor2.SelectedTokens[i];
if (i == tokenEditor2.SelectedTokens.Count - 1)
Room += item.Value;
else
Room += item.Value + ",";
}
string Anaes = "";
for (int i = 0; i < tokenEditor3.SelectedTokens.Count; i++)
{
var item = tokenEditor3.SelectedTokens[i];
if (i == tokenEditor3.SelectedTokens.Count - 1)
Anaes += item.Value;
else
Anaes += item.Value + ",";
}
string type = "";
if (cmbOpeType.Text != "")
type = cmbOpeType.Text;
string type1 = "";
if (cmbPatType.Text != "")
type = cmbPatType.Text;
string inNO = txtArchivesNo.Text;
string name = txtName.Text;
string cut = txtOperationCut.Text;
string level = cboOperationLevel.Text;
string asa = txtASALevel.Text;
System.Data.DataTable dt = BOperationApply.GetOperationDoingDataTable(dtpBegInDate.Value.ToString("yyyy-MM-dd"), dtpEndDate.Value.AddDays(1).ToString("yyyy-MM-dd"));
string Where = " (RecoverId is null or RecoverId=1 ) ";
if (state != "")
Where += " and StateId IN (" + state + ") ";
if (Department != "")
Where += " and PatientDept LIKE '%" + Department + "%' ";
if (OperationGroup != "")
Where += " and OperationGroup LIKE '%" + OperationGroup + "%' ";
if (Room != "")
Where += " and OperationRoomId IN (" + Room + ") ";
if (Anaes != "")
Where += " and AnaesthesiaMethodId = '" + Anaes + "' ";
if (type != "")
Where += " and OperationType='" + type + "' ";
if (type1 != "")
Where += " and PatientType='" + type1 + "' ";
if (cut != "")
Where += " and OperationCut='" + cut + "' ";
if (asa != "")
Where += " and ASALevelName='" + asa + "' ";
if (level != "")
Where += " and OperationLevel='" + level + "' ";
if (inNO != "")
Where += " and (MdrecNo LIKE '%" + inNO + "%' or PatientName LIKE '%" + inNO + "%' ) ";
if (name != "")
Where += " and (OperationDoctor LIKE '%" + name + "%' or Assistant LIKE '%" + name + "%' or AnesthesiaDoctor LIKE '%" + name + "%' or InstrumentNurse LIKE '%" + name + "%' or TourNurse LIKE '%" + name + "%' ) ";
if (AgeBegin.Value != 0 || AgeEnd.Value != 100)
{
Where += " and (AgeNum >=" + AgeBegin.Value + " and AgeNum <=" + AgeEnd.Value + ") ";
}
if (cboIsNotPlanReturnOperation.Checked == true)
Where += " and IsNotPlanReturnOperation ='是' ";
if (txtOperation.Text != "")
Where += " and (ApplyOperationInfoName LIKE '%" + txtOperation.Text + "%' or OperationInfoName LIKE '%" + txtOperation.Text + "%' ) ";
if (CboOperationSite.Visible == true && CboOperationSite.SelectedIndex > 0)
Where += " and OperationSite='" + CboOperationSite.SelectedValue + "' ";
System.Data.DataTable dataTable = AIMSExtension.PublicMethod.GetNewDataTable(dt, Where, "");
foreach (DataRow item in dataTable.Rows)
{
if (item["StateId"].ToString() != "10" && item["StateId"].ToString() != "10")
{
item["Remark"] = "";
item["OperatorName"] = "";
}
if (item["RoomHourTimeSpan"].ToString() != "")
{
double RoomHourTimeSpan = 0;
bool isNum = double.TryParse(item["RoomHourTimeSpan"].ToString(), out RoomHourTimeSpan);
if (isNum)
{
item["RoomHourTimeSpan"] = Math.Round(RoomHourTimeSpan, 1).ToString();
}
}
if (item["OperationHourTimeSpan"].ToString() != "")
{
double OperationHourTimeSpan = 0;
bool isNum = double.TryParse(item["OperationHourTimeSpan"].ToString(), out OperationHourTimeSpan);
if (isNum)
{
item["OperationHourTimeSpan"] = Math.Round(OperationHourTimeSpan, 1).ToString();
}
}
if (item["AnaesthesiaHourTimeSpan"].ToString() != "")
{
double AnaesthesiaHourTimeSpan = 0;
bool isNum = double.TryParse(item["AnaesthesiaHourTimeSpan"].ToString(), out AnaesthesiaHourTimeSpan);
if (isNum)
{
item["AnaesthesiaHourTimeSpan"] = Math.Round(AnaesthesiaHourTimeSpan, 1).ToString();
}
}
}
dgv.DataSource = dataTable;
List<string> list = new List<string>() { "麻醉复苏中", "手术结束", "麻醉复苏结束" };
List<string> list2 = new List<string>() { "退回", "作废" };
for (int i = 0; i < dgv.Rows.Count; i++)
{
if (dgv.Rows[i].Cells["StateColumn"].Value.ToString() == "手术中")
{
dgv.Rows[i].DefaultCellStyle.BackColor = Color.LemonChiffon;
}
else if (list.Contains(dgv.Rows[i].Cells["StateColumn"].Value.ToString()))
{
dgv.Rows[i].DefaultCellStyle.BackColor = Color.LightGreen;
}
else if (list2.Contains(dgv.Rows[i].Cells["StateColumn"].Value.ToString()))
{
dgv.Rows[i].DefaultCellStyle.BackColor = Color.Red;
}
}
dgv.ClearSelection();
}
private void tsbExportExcel_Click(object sender, EventArgs e)
{
//DataToExcel(dgv);
KillAllExcel();
ExprotExcel2();
}
private Microsoft.Office.Interop.Excel.Application myExcel = null;
private void ExprotExcel2(bool isPrint = false)
{
//自定义表头
string title = "查询管理数据";
if (dataGridViewSetting != null) title = dataGridViewSetting.Title;
//是否横向
bool xlLandscape = true;
if (dataGridViewSetting != null && dataGridViewSetting.Landscape == false) xlLandscape = false;
//主体字体大小
int BodySize = 9;
if (dataGridViewSetting != null && dataGridViewSetting.FontSize > 0) BodySize = dataGridViewSetting.FontSize;
myExcel = new Microsoft.Office.Interop.Excel.Application();
this.Cursor = Cursors.WaitCursor;
//保存文化环境
System.Globalization.CultureInfo CurrentCI = System.Threading.Thread.CurrentThread.CurrentCulture;
System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US");
Workbook workbookData = myExcel.Workbooks.Add(Missing.Value);
Worksheet xlSheet = (Microsoft.Office.Interop.Excel.Worksheet)workbookData.Worksheets[1];
xlSheet.Name = title;
if (isPrint == false)
myExcel.Visible = true;
myExcel.Cells[1, 1] = title;//默认的就是在sheet1里面的。
WorksheetClass wsClass = new WorksheetClass();
Dictionary<int, string> Columns = new Dictionary<int, string>();
//填充标题
for (int i = 0; i < dgv.Columns.Count; i++)
{
if (dataGridViewSetting != null)
{
foreach (var item in dataGridViewSetting.Exports)
{
if (dgv.Columns[i].Name == item.Name)
{
if (item.IsPrint == true)
{
Columns.Add(i, dgv.Columns[i].HeaderText);
continue;
}
}
}
}
else
{
if (dgv.Columns[i].Visible == true)
Columns.Add(i, dgv.Columns[i].HeaderText);
}
}
List<KeyValuePair<int, string>> ColumnsStr = Columns.ToList();
for (int i = 0; i < ColumnsStr.Count; i++)
{
myExcel.Cells[2, i + 1] = ColumnsStr[i].Value;
if (dataGridViewSetting != null)
{
foreach (var item in dataGridViewSetting.Exports)
{
if (ColumnsStr[i].Value == item.Text)
{
xlSheet.get_Range(xlSheet.Cells[2, i + 1], xlSheet.Cells[2, i + 1]).ColumnWidth = item.PrintWidth;//列宽
}
}
}
else
{
xlSheet.get_Range(xlSheet.Cells[2, i + 1], xlSheet.Cells[2, i + 1]).ColumnWidth = 5;//列宽
}
}
//获得数据表的值
int RowCount = dgv.Rows.Count;
int colCount = ColumnsStr.Count;
//设置填充单元格样式
xlSheet.get_Range(xlSheet.Cells[2, 1], xlSheet.Cells[RowCount + 2, colCount]).Borders.LineStyle = XlLineStyle.xlContinuous;//边框的样式
object[,] objData = new object[RowCount, colCount];
//将DataTable里的值填充到对象数组中
for (int i = 0; i < RowCount; i++)
{
for (int j = 0; j < colCount; j++)
{
if (dgv.Columns[ColumnsStr[j].Key].Name == "序号" || dgv.Columns[ColumnsStr[j].Key].Name == "ApplyId")
objData[i, j] = i + 1;
else if (dgv.Rows[i].Cells[ColumnsStr[j].Key].Value != null)
objData[i, j] = dgv.Rows[i].Cells[ColumnsStr[j].Key].Value.ToString();
}
System.Windows.Forms.Application.DoEvents();
}
//将对象数组的值赋值给Excel
Range range = xlSheet.get_Range(xlSheet.Cells[3, 1], xlSheet.Cells[RowCount + 2, colCount]);
range.Value2 = objData;
//xlSheet.get_Range(xlSheet.Cells[2, 1], xlSheet.Cells[RowCount + 2, colCount]).Font.Size = BodySize;//字体大小
//设置主标题单元格的样式
xlSheet.get_Range(xlSheet.Cells[1, 1], xlSheet.Cells[1, colCount]).MergeCells = true;//合并单元格
xlSheet.get_Range(xlSheet.Cells[1, 1], xlSheet.Cells[1, colCount]).HorizontalAlignment = XlHAlign.xlHAlignCenter;//水平对齐方式
xlSheet.get_Range(xlSheet.Cells[1, 1], xlSheet.Cells[1, colCount]).VerticalAlignment = XlVAlign.xlVAlignBottom;//垂直对齐方式
xlSheet.get_Range(xlSheet.Cells[1, 1], xlSheet.Cells[1, colCount]).Font.Bold = true;//字体加粗
xlSheet.get_Range(xlSheet.Cells[1, 1], xlSheet.Cells[1, colCount]).Font.ColorIndex = 0;//字体颜色
//xlSheet.get_Range(xlSheet.Cells[1, 1], xlSheet.Cells[1, colCount]).Font.Italic = true;//是否斜体
xlSheet.get_Range(xlSheet.Cells[1, 1], xlSheet.Cells[1, colCount]).Font.Size = 22;//字体大小
xlSheet.get_Range(xlSheet.Cells[1, 1], xlSheet.Cells[1, colCount]).Borders.LineStyle = XlLineStyle.xlContinuous;//边框样式
xlSheet.get_Range(xlSheet.Cells[1, 1], xlSheet.Cells[1, colCount]).RowHeight = 33.75;//行高
//设置标题单元格样式
xlSheet.get_Range(xlSheet.Cells[2, 1], xlSheet.Cells[2, colCount]).RowHeight = 22.75;//行高
if (xlLandscape == true)
xlSheet.PageSetup.Orientation = XlPageOrientation.xlLandscape;//页面方向为横向
//复苏文化环境
System.Threading.Thread.CurrentThread.CurrentCulture = CurrentCI;
try
{
if (isPrint == true)
xlSheet.PrintOutEx();
//myExcel.Save(@"D:a.xls");
//myExcel.Quit();
this.Cursor = Cursors.Default;
//MessageBox.Show("导出成功!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
}
finally
{
if (isPrint == true)
{
//释放资源
System.Runtime.InteropServices.Marshal.ReleaseComObject(xlSheet);
System.Runtime.InteropServices.Marshal.ReleaseComObject(workbookData);
System.Runtime.InteropServices.Marshal.ReleaseComObject(range);
System.Runtime.InteropServices.Marshal.ReleaseComObject(myExcel);
GC.Collect();
range = null;
xlSheet = null;
workbookData = null;
myExcel = null;
KillAllExcel();
}
}
}
private void KillAllExcel()
{
List<Process> excelProcess = GetExcelProcesses();
for (int i = 0; i < excelProcess.Count; i++)
{
excelProcess[i].Kill();
}
}
private List<Process> GetExcelProcesses()
{
Process[] processes = Process.GetProcesses();
List<Process> excelProcesses = new List<Process>();
for (int i = 0; i < processes.Length; i++)
{
if (processes[i].ProcessName.ToUpper() == "EXCEL")
excelProcesses.Add(processes[i]);
}
return excelProcesses;
}
private void tsbStopOperation_Click(object sender, EventArgs e)
{
if (dgv.Rows.Count > 0)
{
OperationFront.UI.frmStopOperation frmStopOperation = new OperationFront.UI.frmStopOperation();
frmStopOperation.ApplyIdList.Add(int.Parse(dgv.CurrentRow.Cells["ApplyId"].EditedFormattedValue.ToString()));
frmStopOperation.FormClosed += new FormClosedEventHandler(frmStopOperation_FormClosed);
frmStopOperation.ShowDialog();
}
}
void frmStopOperation_FormClosed(object sender, FormClosedEventArgs e)
{
btnFind_Click(null, null);
}
private void tsbReviewApply_Click(object sender, EventArgs e)
{
int SelApplyId = int.Parse(dgv.CurrentRow.Cells["ApplyId"].Value.ToString());
if (SelApplyId != 0)
{
OperationApply apply = BOperationApply.GetModel(SelApplyId);
frmAanesthesiaRecord frmAnasRecord = new frmAanesthesiaRecord();
frmAnasRecord.PatientId = apply.OrisPatientId.Value;
frmAnasRecord.ApplyId = apply.Id.Value;
frmAnasRecord.State = AIMSExtension.EditState.BROWSE;
frmAnasRecord.Show();
}
}
void frmOperationApplyDetail_FormClosed(object sender, FormClosedEventArgs e)
{
btnFind_Click(null, null);
}
private void tsbPrint_Click(object sender, EventArgs e)
{
if (dgv.Rows.Count < 1 || dgv.Rows.Count < 1)
{
MessageBox.Show("没有记录请查询到数据后再导出数据到Excel");
return;
}
KillAllExcel();
ExprotExcel2(true);
}
private void dgv_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
{
System.Drawing.Rectangle rectangle = new System.Drawing.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 tspSetting_Click(object sender, EventArgs e)
{
frmExportConfig formDataGridViewConfig = new frmExportConfig(dgv, exportConfig, DataGridViewPath, this.Text);
if (formDataGridViewConfig.ShowDialog() == DialogResult.OK)
{
exportConfig = formDataGridViewConfig.exportConfig;
ConfigDataGridView(formDataGridViewConfig.exportConfig);
}
}
public ExportConfig dataGridViewSetting;
private void ConfigDataGridView(SysConfig exportConfig)
{
try
{
dataGridViewSetting = JsonConvert.DeserializeObject<ExportConfig>(exportConfig.Value);
foreach (DataGridViewColumn column in dgv.Columns)
{
foreach (var item in dataGridViewSetting.Exports)
{
if (column.Name == "序号" || column.Name == "ApplyId")
{
column.Visible = false;
}
else if (column.Name == item.Name)
{
column.Visible = item.IsVisible;
column.Width = item.Width;
}
}
}
}
catch (Exception ex)
{
PublicMethod.WriteLog(ex);
}
}
private static string GetControlPath(Control control)
{
StringBuilder controlPathStringBuilder = new StringBuilder();
controlPathStringBuilder.Append(control.Name);
while (control.Parent != null)
{
control = control.Parent;
controlPathStringBuilder.Append("." + control.Name);
}
return controlPathStringBuilder.ToString();
}
private void toolStripButton1_Click(object sender, EventArgs e)
{
int SelApplyId = int.Parse(dgv.CurrentRow.Cells["ApplyId"].Value.ToString());
if (SelApplyId != 0)
{
frmPatientStateTree frmas = new frmPatientStateTree();
frmas.ApplyId = SelApplyId;
frmas.ShowDialog();
}
}
private void cboDept_TextUpdate(object sender, EventArgs e)
{
//清空combobox
this.cboDept.Items.Clear();
//清空listNew
listNew.Clear();
//遍历全部备查数据
listNew = BDepartment.GetDepartmentAllListBYSql(" and (HelpCode like '%" + cboDept.Text + "%' or Name like '%" + cboDept.Text + "%' ) ");
if (cboDept.Text.Trim() == "" || listNew == null || listNew.Count <= 0)
{
listNew = BDepartment.GetDepartmentAllListBYSql("");
listNew.Insert(0, new Department() { Id = -1, Name = "全部科室" });
}
//combobox添加已经查到的关键词
this.cboDept.Items.AddRange(listNew.ToArray());
//设置光标位置,否则光标位置始终保持在第一列,造成输入关键词的倒序排列
this.cboDept.SelectionStart = this.cboDept.Text.Length;
//保持鼠标指针原来状态,有时候鼠标指针会被下拉框覆盖,所以要进行一次设置。
Cursor = Cursors.Default;
//自动弹出下拉框
if (cboDept.Text.Trim() != "") this.cboDept.DroppedDown = true;
}
private void cboDept_SelectedIndexChanged(object sender, EventArgs e)
{
int _deptId = -1;
if (cboDept.SelectedIndex >= 0 && cboDept.Text != "全部科室" && cboDept.SelectedItem != null)
{
try
{
Department dt = cboDept.SelectedItem as Department;
if (dt != null)
_deptId = dt.Id.Value;
else
_deptId = BDepartment.GetModelName(cboDept.Text).Id.Value;
}
catch (Exception)
{
_deptId = BDepartment.GetModelName(cboDept.Text).Id.Value;
}
}
}
}
}