You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
387 lines
13 KiB
387 lines
13 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Drawing;
|
|
using System.Runtime.InteropServices;
|
|
using System.Windows.Forms;
|
|
using DevExpress.XtraNavBar;
|
|
using NPOI.SS.Formula.PTG;
|
|
using PEIS.Base;
|
|
using PEIS.Model;
|
|
using PEIS.Properties;
|
|
using PEIS.Utils;
|
|
using PEIS.View.Base;
|
|
using PEIS.View.Enrollment;
|
|
using PEIS.View.EReport;
|
|
using PEIS.View.Exam;
|
|
using PEIS.View.Setting;
|
|
using PEIS.View.Statistics;
|
|
|
|
namespace PEIS.View
|
|
{
|
|
public partial class MainForm : Form
|
|
{
|
|
//调用API函数 添加引用using System.Runtime.InteropServices;
|
|
[DllImport("user32.dll")]
|
|
public static extern bool ReleaseCapture();
|
|
|
|
[DllImport("user32.dll")]
|
|
public static extern bool SendMessage(IntPtr hwnd, int wMsg, int wParam, int lParam);
|
|
|
|
private static bool _isCloseMainForm = false;
|
|
// 是否显示进度条
|
|
private static bool _isShowStepViewer = false;
|
|
|
|
public MainForm()
|
|
{
|
|
InitializeComponent();
|
|
Load += MainForm_Load;
|
|
PnlButton.MouseDown += PnlButton_MouseDown;
|
|
LblLogo.MouseDown += PnlButton_MouseDown;
|
|
LblTitle.MouseDown += PnlButton_MouseDown;
|
|
|
|
PnlButton.DoubleClick += PbMax_Click;
|
|
PbMax.Click += PbMax_Click;
|
|
|
|
PbMin.Click += (s, e) => WindowState = FormWindowState.Minimized;
|
|
PbClose.Click += PbClose_Click;
|
|
|
|
BtnReg.Click += BtnReg_Click;
|
|
BtnPart.Click += BtnPart_Click;
|
|
BtnTotal.Click += BtnTotal_Click;
|
|
BtnReport.Click += BtnReport_Click;
|
|
BtnStatistics.Click += BtnStatistics_Click;
|
|
BtnSetting.Click += BtnSetting_Click;
|
|
// 子页面切换隐藏左侧导航菜单
|
|
XtmmMain.SelectedPageChanged += XtmmMain_SelectedPageChanged;
|
|
// 体检登记子菜单
|
|
NbiEnrollmentPerson.LinkClicked += (s, e) => AddTab("NbiEnrollmentPerson", e.Link.Item);
|
|
NbiEnrollmentOrg.LinkClicked += (s, e) => AddTab("NbiEnrollmentOrg", e.Link.Item);
|
|
NbiBaseOrg.LinkClicked += (s, e) => AddTab("NbiBaseOrg", e.Link.Item);
|
|
NbiBasePerson.LinkClicked += (s, e) => AddTab("NbiBasePerson", e.Link.Item);
|
|
// 个人体检报告
|
|
NbiPReport.LinkClicked += (s, e) => AddTab("NbiPReport", e.Link.Item);
|
|
// 团体体检报告
|
|
NbiTReport.LinkClicked += (s, e) => AddTab("NbiTReport", e.Link.Item);
|
|
// 系统设置
|
|
NbiFeeItem.LinkClicked += (s, e) => AddTab("NbiFeeItem", e.Link.Item);
|
|
NbiPackage.LinkClicked += (s, e) => AddTab("NbiPackage", e.Link.Item);
|
|
NbiConclusion.LinkClicked += (s, e) => AddTab("NbiConclusion", e.Link.Item);
|
|
NbiDept.LinkClicked += (s, e) => AddTab("NbiDept", e.Link.Item);
|
|
// 人次统计表
|
|
NbiPeopleCount.LinkClicked += (s, e) => AddTab("NbiPeopleCount", e.Link.Item);
|
|
// 权限管理
|
|
NbiPermission.LinkClicked += (s, e) => AddTab("NbiPermission", e.Link.Item);
|
|
|
|
//CacheDataModel.CacheData();
|
|
|
|
// 科室分检医师登录 只显示科室分检菜单
|
|
var userModel = new UserModel();
|
|
var isShow = userModel.IsPeidDept();
|
|
BtnReg.Visible = isShow;
|
|
BtnPart.Visible = true;
|
|
BtnTotal.Visible = isShow;
|
|
BtnReport.Visible = isShow;
|
|
BtnStatistics.Visible = isShow;
|
|
BtnSetting.Visible = isShow;
|
|
|
|
// lblStep.Text = $@"当前操作员:{Global.currentUser.Name}";
|
|
|
|
stepViewer2.Eid = null;
|
|
FormClosing += TipsFormClosing;
|
|
if (!_isShowStepViewer)
|
|
{
|
|
stepViewer2.Visible = false;
|
|
panelFooter.Visible = false;
|
|
lblStep.Visible = false;
|
|
panelFooter.Height=5;
|
|
}
|
|
}
|
|
private void UpdateStepViewerEid(long? eid)
|
|
{
|
|
if (!_isShowStepViewer)
|
|
{
|
|
return;
|
|
}
|
|
panelFooter.Visible = true;
|
|
// lblStep.Text = eid==null ? "" : eid+" 体检完成情况:";
|
|
stepViewer2.Eid = eid;
|
|
Console.WriteLine("stepViewer2.Invalidate()");
|
|
stepViewer2.Invalidate();
|
|
}
|
|
private void PbMax_Click(object sender, EventArgs e)
|
|
{
|
|
this.WindowState = this.WindowState == FormWindowState.Maximized ? FormWindowState.Normal : FormWindowState.Maximized;
|
|
}
|
|
|
|
private const int HtLeft = 10;
|
|
private const int HtRight = 11;
|
|
private const int HtTop = 12;
|
|
private const int HtTopLeft = 13;
|
|
private const int HtTopRight = 14;
|
|
private const int HtBottom = 15;
|
|
private const int HtBottomLeft = 0x10;
|
|
private const int HtBottomRight = 17;
|
|
|
|
protected override void WndProc(ref Message m)
|
|
{
|
|
switch (m.Msg)
|
|
{
|
|
case 0x0084:
|
|
base.WndProc(ref m);
|
|
Point vPoint = new Point((int)m.LParam & 0xFFFF,
|
|
(int)m.LParam >> 16 & 0xFFFF);
|
|
vPoint = PointToClient(vPoint);
|
|
if (vPoint.X <= 5)
|
|
if (vPoint.Y <= 5)
|
|
m.Result = (IntPtr)HtTopLeft;
|
|
else if (vPoint.Y >= ClientSize.Height - 5)
|
|
m.Result = (IntPtr)HtBottomLeft;
|
|
else m.Result = (IntPtr)HtLeft;
|
|
else if (vPoint.X >= ClientSize.Width - 5)
|
|
if (vPoint.Y <= 5)
|
|
m.Result = (IntPtr)HtTopRight;
|
|
else if (vPoint.Y >= ClientSize.Height - 5)
|
|
m.Result = (IntPtr)HtBottomRight;
|
|
else m.Result = (IntPtr)HtRight;
|
|
else if (vPoint.Y <= 5)
|
|
m.Result = (IntPtr)HtTop;
|
|
else if (vPoint.Y >= ClientSize.Height - 5)
|
|
m.Result = (IntPtr)HtBottom;
|
|
break;
|
|
|
|
case 0x0201://鼠标左键按下的消息
|
|
m.Msg = 0x00A1;//更改消息为非客户区按下鼠标
|
|
m.LParam = IntPtr.Zero;//默认值
|
|
m.WParam = new IntPtr(2);//鼠标放在标题栏内
|
|
base.WndProc(ref m);
|
|
break;
|
|
|
|
default:
|
|
base.WndProc(ref m);
|
|
break;
|
|
}
|
|
}
|
|
|
|
private void BtnSetting_Click(object sender, EventArgs e)
|
|
{
|
|
var userModel = new UserModel();
|
|
if (!userModel.IsPeidDept())
|
|
{
|
|
MessageBox.Show(@"权限不足!");
|
|
return;
|
|
}
|
|
NbgSetting.Expanded = true;
|
|
NbcMain.Visible = true;
|
|
}
|
|
|
|
private void BtnReport_Click(object sender, EventArgs e)
|
|
{
|
|
NbgReport.Expanded = true;
|
|
NbcMain.Visible = true;
|
|
}
|
|
|
|
private void BtnReg_Click(object sender, EventArgs e)
|
|
{
|
|
var userModel = new UserModel();
|
|
if (!userModel.IsPeidDept())
|
|
{
|
|
MessageBox.Show(@"权限不足!");
|
|
return;
|
|
}
|
|
|
|
NbgReg.Expanded = true;
|
|
NbcMain.Visible = true;
|
|
}
|
|
|
|
private void PnlButton_MouseDown(object sender, MouseEventArgs e)
|
|
{
|
|
if (e.Clicks != 1) return;
|
|
//窗体移动
|
|
if (e.Button != MouseButtons.Left) return;
|
|
ReleaseCapture(); //释放鼠标捕捉
|
|
//发送左键点击的消息至该窗体(标题栏)
|
|
SendMessage(this.Handle, 0xA1, 0x02, 0);
|
|
}
|
|
|
|
private void MainForm_Load(object sender, EventArgs e)
|
|
{
|
|
MaximizedBounds = Screen.PrimaryScreen.WorkingArea;
|
|
// 在窗体加载时将窗体最大化
|
|
this.WindowState = FormWindowState.Maximized;
|
|
}
|
|
|
|
private void PbClose_Click(object sender, EventArgs e)
|
|
{
|
|
_isCloseMainForm = true;
|
|
Close();
|
|
}
|
|
|
|
private void TipsFormClosing(object sender, FormClosingEventArgs e)
|
|
{
|
|
if (_isCloseMainForm)
|
|
{
|
|
e.Cancel = false;
|
|
return;
|
|
}
|
|
var result = MessageBox.Show(@"确认关闭窗体吗?", @"关闭确认", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
|
|
|
|
if (result == DialogResult.Cancel)
|
|
{
|
|
e.Cancel = true; // 取消窗体关闭操作
|
|
}
|
|
}
|
|
|
|
private bool isNeedShowPanelFooter = true;
|
|
private void AddTab(string flag, NavBarItem item)
|
|
{
|
|
var tabForm = CreateFormByFlag(flag);
|
|
if (tabForm == null) return;
|
|
tabForm.MdiParent = this;
|
|
tabForm.Text = item.Caption;
|
|
tabForm.FormClosing += TipsFormClosing;
|
|
XtmmMain.Pages[tabForm].Image = item.LargeImage;
|
|
if (isNeedShowPanelFooter )
|
|
panelFooter.Visible = true;
|
|
tabForm.Show();
|
|
}
|
|
|
|
private ViewBase CreateFormByFlag(string flag)
|
|
{
|
|
switch (flag)
|
|
{
|
|
case "NbiEnrollmentPerson":
|
|
var PersonForm = new EnrollmentPersonForm();
|
|
PersonForm.SelectedPatientEvent += UpdateStepViewerEid;
|
|
|
|
isNeedShowPanelFooter = true;
|
|
return PersonForm;
|
|
|
|
case "NbiEnrollmentOrg":
|
|
var EnrollmentOrgForm = new EnrollmentOrgForm();
|
|
EnrollmentOrgForm.SelectedPatientEvent += UpdateStepViewerEid;
|
|
isNeedShowPanelFooter = true;
|
|
return EnrollmentOrgForm;
|
|
|
|
case "NbiFeeItem":
|
|
return new FeeItemForm();
|
|
|
|
case "NbiPackage":
|
|
return new PackForm();
|
|
|
|
case "NbiDept":
|
|
return new DeptForm();
|
|
|
|
case "NbiBaseOrg":
|
|
return new OrgForm();
|
|
|
|
case "NbiBasePerson":
|
|
return new PersonForm();
|
|
|
|
case "NbiPReport":
|
|
return new PersonReportForm();
|
|
|
|
case "NbiTReport":
|
|
return new TeamReportForm();
|
|
|
|
case "NbiConclusion":
|
|
return new ConclusionForm();
|
|
|
|
case "NbiPermission":
|
|
return new PermissionForm();
|
|
|
|
default:
|
|
return null;
|
|
}
|
|
}
|
|
|
|
#region Exam
|
|
|
|
/// <summary>
|
|
/// 科室分检
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void BtnPart_Click(object sender, EventArgs e)
|
|
{
|
|
//隐藏左侧导航菜单
|
|
NbcMain.Visible = false;
|
|
var form = new PartForm
|
|
{
|
|
MdiParent = this,
|
|
Text = @"科室分检"
|
|
};
|
|
isNeedShowPanelFooter = true;
|
|
panelFooter.Visible = true;
|
|
XtmmMain.Pages[form].Image = Resources.分检页面;
|
|
form.SelectedPatientEvent += UpdateStepViewerEid;
|
|
form.Show();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 总检管理
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void BtnTotal_Click(object sender, EventArgs e)
|
|
{
|
|
//隐藏左侧导航菜单
|
|
NbcMain.Visible = false;
|
|
var form = new TotalForm
|
|
{
|
|
MdiParent = this,
|
|
Text = @"总检管理"
|
|
};
|
|
isNeedShowPanelFooter = true;
|
|
panelFooter.Visible = true;
|
|
XtmmMain.Pages[form].Image = Resources.总检页面;
|
|
form.SelectedPatientEvent += UpdateStepViewerEid;
|
|
form.Show();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 子页面切换隐藏左侧导航菜单
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void XtmmMain_SelectedPageChanged(object sender, EventArgs e)
|
|
{
|
|
// 获取当前选定的页面
|
|
if (XtmmMain.SelectedPage == null) return;
|
|
var currentTabPage = XtmmMain.SelectedPage;
|
|
NbcMain.Visible = (currentTabPage.Text != "科室分检" && currentTabPage.Text != "总检管理" && currentTabPage.Text != "查询统计");
|
|
}
|
|
|
|
#endregion Exam
|
|
|
|
#region 统计
|
|
|
|
private void BtnStatistics_Click(object sender, EventArgs e)
|
|
{
|
|
//隐藏左侧导航菜单
|
|
NbcMain.Visible = false;
|
|
var form = new StatisticalReportForm()
|
|
{
|
|
MdiParent = this,
|
|
Text = @"查询统计"
|
|
};
|
|
XtmmMain.Pages[form].Image = Resources.体检登记;
|
|
form.Show();
|
|
}
|
|
|
|
#endregion 统计
|
|
|
|
private void BtnStatistics_Click_1(object sender, EventArgs e)
|
|
{
|
|
isNeedShowPanelFooter = false;
|
|
if (panelFooter.Visible)
|
|
panelFooter.Visible = false;
|
|
}
|
|
|
|
private void BtnSetting_Click_1(object sender, EventArgs e)
|
|
{
|
|
isNeedShowPanelFooter = false;
|
|
if (panelFooter.Visible)
|
|
panelFooter.Visible = false;
|
|
}
|
|
}
|
|
} |