增加项目报告打印功能和一些优化

1.检查报告增加右键菜单打印功能
2.其他报告增加右键菜单打印和删除功能
3.修复个人报告的批量预览功能
4.团队登记人员列表刷新逻辑优化
5.分检添加结论词逻辑优化
dhzzyy
LiJiaWen 2 weeks ago
parent 9e2e95a0eb
commit fbb010d3a7
  1. 1
      PEIS/PEIS.csproj
  2. 10
      PEIS/Properties/Resources.Designer.cs
  3. 3
      PEIS/Properties/Resources.resx
  4. BIN
      PEIS/Resources/打印.png
  5. 146
      PEIS/Utils/ReportHelper.cs
  6. 3
      PEIS/View/Enrollment/EnrollmentOrgForm.cs
  7. 52
      PEIS/View/Exam/PartForm.Designer.cs
  8. 136
      PEIS/View/Exam/PartForm.cs
  9. 6
      PEIS/View/Exam/PartForm.resx

@ -827,6 +827,7 @@
<None Include="Resources\团队报告.png" />
<None Include="Resources\删除1.png" />
<None Include="Resources\刷新 %281%29.png" />
<None Include="Resources\打印.png" />
<Content Include="Update\Update.exe">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>

@ -390,6 +390,16 @@ namespace PEIS.Properties {
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap {
get {
object obj = ResourceManager.GetObject("打印", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>

@ -247,4 +247,7 @@
<data name="刷新 (1)" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\刷新 (1).png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="打印" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\打印.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

@ -113,7 +113,7 @@ namespace PEIS.Utils
/// </summary>
/// <param name="eid">体检号</param>
/// <returns></returns>
public static FastReport.Report GetReport(Int64 eid, String paramFile = null)
public static FastReport.Report GetReport(Int64 eid, String paramFile = null, FastReport.Report combineReport = null)
{
try
{
@ -130,19 +130,19 @@ namespace PEIS.Utils
switch (string.IsNullOrEmpty(paramFile) ? fileName : paramFile)
{
case "Children.frx":
return EasyReport(patient, eid, filePath);
return EasyReport(patient, eid, filePath, combineReport);
case "Student.frx":
return EasyReport(patient, eid, filePath);
return EasyReport(patient, eid, filePath, combineReport);
case "Teacher.frx":
return EasyReport(patient, eid, filePath);
return EasyReport(patient, eid, filePath, combineReport);
case "Work.frx":
return EasyReport(patient, eid, filePath);
return EasyReport(patient, eid, filePath, combineReport);
case "Health.frx":
return EasyReport(patient, eid, filePath);
return EasyReport(patient, eid, filePath, combineReport);
case "CAPReport.frx":
return CAPReport(patient, eid, filePath);
return CAPReport(patient, eid, filePath, combineReport);
default:
return General(patient, eid, filePath);
return General(patient, eid, filePath, combineReport);
}
}
catch (Exception ex)
@ -239,9 +239,13 @@ namespace PEIS.Utils
/// <param name="eid"></param>
/// <param name="filePath"></param>
/// <returns></returns>
private static FastReport.Report CAPReport(EnrollmentPatient patient, Int64 eid, string filePath)
private static FastReport.Report CAPReport(EnrollmentPatient patient, Int64 eid, string filePath, FastReport.Report combineReport)
{
var rpt = new FastReport.Report(); //实例化一个Report报表
var rpt = combineReport;
if (rpt == null)
{
rpt = new FastReport.Report(); //实例化一个Report报表
}
rpt.Load(filePath);
var lstEFeeItems = new ReportModel().GetEFeeItem(eid);
@ -485,7 +489,14 @@ namespace PEIS.Utils
//症状
SetDataSource(ref rpt, symptoms, "CAS", "Symptoms");
if (combineReport == null)
{
rpt.Prepare(); //准备
}
else
{
rpt.Prepare(true); //合并报表
}
return rpt;
}
@ -496,9 +507,13 @@ namespace PEIS.Utils
/// <param name="eid"></param>
/// <param name="filePath"></param>
/// <returns></returns>
private static FastReport.Report General(EnrollmentPatient patient, Int64 eid, string filePath)
private static FastReport.Report General(EnrollmentPatient patient, Int64 eid, string filePath, FastReport.Report combineReport)
{
var rpt = new FastReport.Report(); //实例化一个Report报表
var rpt = combineReport;
if (rpt == null)
{
rpt = new FastReport.Report(); //实例化一个Report报表
}
rpt.Load(filePath);
var lstEFeeItems = new ReportModel().GetEFeeItem(eid);
@ -574,7 +589,14 @@ namespace PEIS.Utils
SetDataSource(ref rpt, lstPacsPhotos.Concat(lstExts.Where(w => w.ReportImg != null).Select(s => new Entity.Report { ReportImage = s.ReportImg })), "I", "PACSImage");
// 科室小结
SetDataSource(ref rpt, lstExamParts, "D", "DeptSummary");
if (combineReport == null)
{
rpt.Prepare(); //准备
}
else
{
rpt.Prepare(true); //合并报表
}
return rpt;
}
@ -585,9 +607,13 @@ namespace PEIS.Utils
/// <param name="eid"></param>
/// <param name="filePath"></param>
/// <returns></returns>
private static FastReport.Report EasyReport(EnrollmentPatient patient, Int64 eid, string filePath)
private static FastReport.Report EasyReport(EnrollmentPatient patient, Int64 eid, string filePath, FastReport.Report combineReport)
{
var rpt = new FastReport.Report(); //实例化一个Report报表
var rpt = combineReport;
if (rpt == null)
{
rpt = new FastReport.Report(); //实例化一个Report报表
}
rpt.Load(filePath);
var lstExts = new ReportModel().GetReportExt(eid);
var lstChildren = new ReportModel().GetFastResult(eid);
@ -640,7 +666,14 @@ namespace PEIS.Utils
SetParameter(ref rpt, dict);
// 第三方报告
//SetDataSource(ref rpt, lstExts, "I", "ImageList");
if (combineReport == null)
{
rpt.Prepare(); //准备
}
else
{
rpt.Prepare(true); //合并报表
}
return rpt;
}
@ -1056,92 +1089,13 @@ namespace PEIS.Utils
{
try
{
var rpt = new FastReport.Report();
var i = 0;
FastReport.Report report = null;
foreach (var eid in idlist)
{
var patient = new ReportModel().GetPatientInfo(eid);
if (patient == null) return null;
var fileName =
DAOHelp.GetDataBySQL<Config>(
$"SELECT Description FROM Dict_Config where Value='{patient.Type}'").FirstOrDefault()
?.Description ?? "PReport.frx";
var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "ReportFiles",
fileName);
if (!File.Exists(filePath))
{
MessageBox.Show($@"未找到报告单模板文件:{fileName}", @"获取报告单失败");
return null;
}
if (fileName != "PReport.frx")
{
rpt = EasyReport(patient, eid, filePath);
rpt.Prepare(i > 0);
}
else
{
rpt.Load(filePath);
var lstEFeeItems = new ReportModel().GetEFeeItem(eid);
var lstConclusions = new ReportModel().GetExamConclusions(eid);
var lstGeneral = new ReportModel().GetGeneralResult(eid);
var lstLis = new ReportModel().GetLisResult(eid);
var lstPacs = new ReportModel().GetPacsResult(eid);
var lstPacsPhotos = new ReportModel().GetPacsPhoto(eid);
// 登记信息
rpt.SetParameterValue("PatientName", patient.Name);
rpt.SetParameterValue("CardNo", patient.CardNo);
rpt.SetParameterValue("Nation", patient.Nation);
rpt.SetParameterValue("Age", patient.Age + patient.AgeClass);
rpt.SetParameterValue("Sex", patient.Sex == "1" ? "男" : patient.Sex == "2" ? "女" : "");
rpt.SetParameterValue("ExamID", patient.ID.ToString());
rpt.SetParameterValue("ExamDate", patient.SignTime?.ToShortDateString());
rpt.SetParameterValue("Marriage", patient.Marriage);
rpt.SetParameterValue("TeamName", patient.OrgName);
rpt.SetParameterValue("GroupName", patient.GroupName);
rpt.SetParameterValue("ExamType", patient.Type);
rpt.SetParameterValue("Address", patient.Address1);
rpt.SetParameterValue("Tel", patient.Tel1);
rpt.SetParameterValue("FinishPerson", patient.Finisher);
rpt.SetParameterValue("FinishDate", patient.FinishTime?.ToShortDateString());
rpt.SetParameterValue("HospitalName", Global._hospital.Name);
if (patient.Photo == null)
{
rpt.SetParameterValue("Avatar", patient.Photo);
}
else
{
byte[] imageBytes = Convert.FromBase64String(patient.Photo);
using (MemoryStream ms = new MemoryStream(imageBytes))
{
Image image = Image.FromStream(ms);
using (MemoryStream stream = new MemoryStream())
{
image.Save(stream, ImageFormat.Png);
rpt.SetParameterValue("Avatar", Convert.ToBase64String(stream.ToArray()));
}
}
}
// 收费列表
SetDataSource(ref rpt, lstEFeeItems, "F", "FeeItems");
// 总结结论词
SetDataSource(ref rpt, lstConclusions, "C", "Conclusion");
//一般检查
SetDataSource(ref rpt, lstGeneral, "G", "General");
//PACS
SetDataSource(ref rpt, lstPacs, "P", "PACS");
//LIS
SetDataSource(ref rpt, lstLis, "L", "LIS");
// PacsImage
SetDataSource(ref rpt, lstPacsPhotos, "I", "PACSImage");
rpt.Prepare(i > 0);
report = ReportHelper.GetReport(eid, null, report);
}
i++;
}
return rpt;
return report;
}
catch (Exception ex)
{

@ -2355,10 +2355,13 @@ namespace PEIS.View.Enrollment
if (topRowIndex != -1)
{
int rowHandle = DgvEnrollment.LocateByValue("ID", topRowIndex);
if (rowHandle > 0)
{
DgvEnrollment.FocusedRowHandle = rowHandle;
DgvEnrollment.SelectRow(rowHandle);
DgcEnrollment.Refresh();
}
}
}));
DgvEnrollment.BestFitColumns();
}

@ -167,6 +167,9 @@
this.panelReport = new System.Windows.Forms.Panel();
this.picReportExt = new System.Windows.Forms.PictureBox();
this.dgcRptExt = new DevExpress.XtraGrid.GridControl();
this.RptExtMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
this.PrintRptExtMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.DeleteRptExtMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.DgvRptExt = new DevExpress.XtraGrid.Views.Grid.GridView();
this.gridColumn24 = new DevExpress.XtraGrid.Columns.GridColumn();
this.gridColumn25 = new DevExpress.XtraGrid.Columns.GridColumn();
@ -241,6 +244,8 @@
this.colRptExtTime = new DevExpress.XtraGrid.Columns.GridColumn();
this.colRptExtDesc = new DevExpress.XtraGrid.Columns.GridColumn();
this.superTabControl1 = new FastReport.DevComponents.DotNetBar.SuperTabControl();
this.RptPacsMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
this.PrintRptPacsMenuItem = new System.Windows.Forms.ToolStripMenuItem();
((System.ComponentModel.ISupportInitialize)(this.splitContainerBase)).BeginInit();
this.splitContainerBase.Panel1.SuspendLayout();
this.splitContainerBase.Panel2.SuspendLayout();
@ -311,6 +316,7 @@
this.panelReport.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.picReportExt)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.dgcRptExt)).BeginInit();
this.RptExtMenuStrip.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.DgvRptExt)).BeginInit();
this.tabPageDept.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dgcDeptResult)).BeginInit();
@ -325,6 +331,7 @@
this.panel2.SuspendLayout();
this.menuStrip1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.superTabControl1)).BeginInit();
this.RptPacsMenuStrip.SuspendLayout();
this.SuspendLayout();
//
// splitContainerBase
@ -1903,6 +1910,7 @@
//
// dgcRptPacs
//
this.dgcRptPacs.ContextMenuStrip = this.RptPacsMenuStrip;
this.dgcRptPacs.Dock = System.Windows.Forms.DockStyle.Fill;
this.dgcRptPacs.Location = new System.Drawing.Point(0, 0);
this.dgcRptPacs.MainView = this.DgvRptPacs;
@ -2011,6 +2019,7 @@
//
// dgcRptExt
//
this.dgcRptExt.ContextMenuStrip = this.RptExtMenuStrip;
this.dgcRptExt.Dock = System.Windows.Forms.DockStyle.Left;
this.dgcRptExt.Location = new System.Drawing.Point(0, 0);
this.dgcRptExt.MainView = this.DgvRptExt;
@ -2020,6 +2029,28 @@
this.dgcRptExt.ViewCollection.AddRange(new DevExpress.XtraGrid.Views.Base.BaseView[] {
this.DgvRptExt});
//
// RptExtMenuStrip
//
this.RptExtMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.PrintRptExtMenuItem,
this.DeleteRptExtMenuItem});
this.RptExtMenuStrip.Name = "contextMenuStrip2";
this.RptExtMenuStrip.Size = new System.Drawing.Size(125, 48);
//
// PrintRptExtMenuItem
//
this.PrintRptExtMenuItem.Image = global::PEIS.Properties.Resources.;
this.PrintRptExtMenuItem.Name = "PrintRptExtMenuItem";
this.PrintRptExtMenuItem.Size = new System.Drawing.Size(124, 22);
this.PrintRptExtMenuItem.Text = "打印报告";
//
// DeleteRptExtMenuItem
//
this.DeleteRptExtMenuItem.Image = global::PEIS.Properties.Resources.1;
this.DeleteRptExtMenuItem.Name = "DeleteRptExtMenuItem";
this.DeleteRptExtMenuItem.Size = new System.Drawing.Size(124, 22);
this.DeleteRptExtMenuItem.Text = "删除报告";
//
// DgvRptExt
//
this.DgvRptExt.Appearance.Empty.BackColor = System.Drawing.Color.WhiteSmoke;
@ -3028,6 +3059,20 @@
this.superTabControl1.SelectedTabIndex = -1;
this.superTabControl1.TabIndex = 0;
//
// RptPacsMenuStrip
//
this.RptPacsMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.PrintRptPacsMenuItem});
this.RptPacsMenuStrip.Name = "RptPacsMenuStrip";
this.RptPacsMenuStrip.Size = new System.Drawing.Size(125, 26);
//
// PrintRptPacsMenuItem
//
this.PrintRptPacsMenuItem.Image = global::PEIS.Properties.Resources.;
this.PrintRptPacsMenuItem.Name = "PrintRptPacsMenuItem";
this.PrintRptPacsMenuItem.Size = new System.Drawing.Size(124, 22);
this.PrintRptPacsMenuItem.Text = "打印报告";
//
// PartForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
@ -3114,6 +3159,7 @@
this.panelReport.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.picReportExt)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.dgcRptExt)).EndInit();
this.RptExtMenuStrip.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.DgvRptExt)).EndInit();
this.tabPageDept.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dgcDeptResult)).EndInit();
@ -3131,6 +3177,7 @@
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.superTabControl1)).EndInit();
this.RptPacsMenuStrip.ResumeLayout(false);
this.ResumeLayout(false);
}
@ -3348,5 +3395,10 @@
private DevExpress.XtraGrid.Views.Grid.GridView gridView1;
private System.Windows.Forms.ToolStripMenuItem tsmiPick;
private System.Windows.Forms.ToolStripMenuItem tsmiOccupation;
private System.Windows.Forms.ContextMenuStrip RptExtMenuStrip;
private System.Windows.Forms.ToolStripMenuItem PrintRptExtMenuItem;
private System.Windows.Forms.ToolStripMenuItem DeleteRptExtMenuItem;
private System.Windows.Forms.ContextMenuStrip RptPacsMenuStrip;
private System.Windows.Forms.ToolStripMenuItem PrintRptPacsMenuItem;
}
}

@ -161,6 +161,7 @@ namespace PEIS.View.Exam
DgvExamResult.KeyUp += DgvExamResult_KeyUp;
//1.2.1.PACS
DgvRptPacs.RowClick += DgvReportPacs_RowClick;
PrintRptPacsMenuItem.Click += PrintRptPacsMenuItem_Click;
//1.2.2.PACS图片选择列表-限制选中项数
ListViewPacsImg.ItemCheck += ListViewPacsImg_ItemCheck;
//1.2.3.单击选中
@ -177,6 +178,8 @@ namespace PEIS.View.Exam
{
if (DgvRptExt.GetFocusedRow() is ReportExt selected) SetPicReportExt(selected);
};
PrintRptExtMenuItem.Click += PrintRptExtMenuItem_Click;
DeleteRptExtMenuItem.Click += DeleteRptExtMenuItem_Click;
//分科检查 颜色提示
DgvDeptExamResult.CustomDrawCell += DgvExamResult_CustomDrawCell;
DgvLisReport.CustomDrawCell += DgvLisReport_CustomDrawCell;
@ -582,7 +585,7 @@ namespace PEIS.View.Exam
// 检测体检者的收费项目在HIS中是否还存在
List<EnrollmentFeeItem> _feeItem = DAOHelp.GetDataBySQL<EnrollmentFeeItem>($"SELECT * FROM Enrollment_FeeItem WHERE EID = {selected.ID} AND FID NOT IN (SELECT ID FROM Dict_FeeItem) AND GiveUpTime is not null").ToList();
string message = "";
foreach(EnrollmentFeeItem feeItem in _feeItem)
foreach (EnrollmentFeeItem feeItem in _feeItem)
{
message += feeItem.FeeItemName + "、";
}
@ -1081,6 +1084,69 @@ namespace PEIS.View.Exam
}
}
private void PrintRptExtMenuItem_Click(object sender, EventArgs e)
{
if (!(DgvRptExt.GetFocusedRow() is ReportExt selected)) return;
if (selected?.ReportImg != null)
{
try
{
using (var ms = new MemoryStream(selected.ReportImg))
{
Image img = Image.FromStream(ms);
System.Windows.Forms.PrintDialog printDialog = new System.Windows.Forms.PrintDialog();
printDialog.Document = new System.Drawing.Printing.PrintDocument();
printDialog.Document.PrintPage += (a, b) =>
{
// 计算图像的宽度和高度
int imageWidth = img.Width;
int imageHeight = img.Height;
// 获取打印区域的宽度和高度(考虑到页边距)
float marginBoundsWidth = b.MarginBounds.Width;
float marginBoundsHeight = b.MarginBounds.Height;
// 计算绘制起点的坐标,使图像居中
float left = (marginBoundsWidth - imageWidth) / 2;
float top = (marginBoundsHeight - imageHeight) / 2;
// 确保坐标值不为负数
left = left < 0 ? 0 : left;
top = top < 0 ? 0 : top;
b.Graphics.DrawImage(img, left, top, imageWidth, imageHeight);
};
printDialog.UseEXDialog = true; // 显示增强的打印对话框
if (printDialog.ShowDialog() == DialogResult.OK)
{
printDialog.Document.Print(); // 执行打印操作
}
}
}
catch (Exception ex)
{
Global.MsgWarn(ex.Message);
Debug.Write(ex.Message);
}
}
}
private void DeleteRptExtMenuItem_Click(object sender, EventArgs e)
{
if (!(DgvRptExt.GetFocusedRow() is ReportExt selected)) return;
if (selected != null)
{
if (DialogResult.OK == MessageBox.Show("即将删除报告, 此操作不可撤销!\r\n确认删除吗?", "删除确认", MessageBoxButtons.OKCancel, MessageBoxIcon.Error))
{
selected.Delete();
RefreshTabPageData(TabPart.SelectedTabPage.Text);
}
}
}
#endregion IView事件实现
#region 页面控件事件
@ -1229,7 +1295,8 @@ namespace PEIS.View.Exam
if (_patient.ID <= 0 || _patient.FinishTime != null || _examPart.VerifyTime != null ||
_examPart.GiveUpTime != null || _examPart.ID <= 0) return;
if (_examPart.CheckTime == null) {
if (_examPart.CheckTime == null)
{
MessageBox.Show(@"请先保存科室分检的检查结果!", @"审核失败");
return;
}
@ -1291,7 +1358,7 @@ namespace PEIS.View.Exam
}
}*/
// 检验科判断项目是否完全出结果
if (_examPart.DeptCode == "3001" && Global._hospital.Name == "德宏州中医医院" &&!string.IsNullOrEmpty(_lisViewName))
if (_examPart.DeptCode == "3001" && Global._hospital.Name == "德宏州中医医院" && !string.IsNullOrEmpty(_lisViewName))
{
List<EnrollmentFeeItem> _noResultItem = DAOHelp.GetDataBySQL<EnrollmentFeeItem>($@"select * from Enrollment_FeeItem where ItemClass = '检验' and GiveUpTime is null and EID = {_patient.ID} and NOT exists (select * from {_lisViewName} where req_id = id)");
string message = "";
@ -1304,7 +1371,7 @@ namespace PEIS.View.Exam
}
if (!string.IsNullOrEmpty(message))
{
DialogResult dr =Global.Msg("warn", message.Substring(0, message.Length - 1) + " 等检验项目结果未出,请核查后审核!\r\n如果核查无误仍要审核,请点击确定按钮。否则点击取消!");
DialogResult dr = Global.Msg("warn", message.Substring(0, message.Length - 1) + " 等检验项目结果未出,请核查后审核!\r\n如果核查无误仍要审核,请点击确定按钮。否则点击取消!");
if (dr != DialogResult.Yes)
{
return;
@ -1501,11 +1568,12 @@ namespace PEIS.View.Exam
{
if (_examPart.VerifyTime != null || _examPart.GiveUpTime != null || _examPart.ID <= 0) return;
if (_patient.FinishTime != null || _patient.ID <= 0) return;
_conclusion.Add(new ExamConclusion()
_conclusion.ForEach(x => x.Seq++);
_conclusion.Insert(0, new ExamConclusion()
{
PID = _examPart.ID,
EID = _examPart.EID,
Seq = _conclusion.Count() + 1
Seq = 1
});
ShowConclusion(_conclusion);
}
@ -1675,7 +1743,7 @@ namespace PEIS.View.Exam
/// <param name="item"></param>
private void RefreshPatient(EnrollmentPatient item = null)
{
Invoke(new Action(() => _patient = item ?? _patient ));
Invoke(new Action(() => _patient = item ?? _patient));
Invoke(new Action(() => stripTxtEid.Text = _patient?.ID.ToString()));
// Invoke(new Action(() => patientInfo.Values = item ?? _patient));
SetPatientInfo(item ?? _patient);
@ -1981,11 +2049,11 @@ namespace PEIS.View.Exam
/// <param name="e"></param>
private void DgvExamResult_KeyUp(object sender, KeyEventArgs e)
{
if(e.KeyCode == Keys.Enter)
if (e.KeyCode == Keys.Enter)
{
int rowHandle = DgvExamResult.FocusedRowHandle;
rowHandle = rowHandle + 1;
if(rowHandle >= DgvExamResult.RowCount)
if (rowHandle >= DgvExamResult.RowCount)
{
SetFocuse(DgvExamResult, 0, "colExamTextResult");
}
@ -2259,12 +2327,58 @@ namespace PEIS.View.Exam
}
/// <summary>
/// 其他报告双击
/// 打印PACS报告
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void DgcRptExt_RowClick(object sender, EventArgs e)
private void PrintRptPacsMenuItem_Click(object sender, EventArgs e)
{
if (!(DgvRptPacs.GetFocusedRow() is Report selected)) return;
selected.GetById();
if (selected?.ReportImage != null)
{
try
{
using (var ms = new MemoryStream(selected.ReportImage))
{
Image img = Image.FromStream(ms);
System.Windows.Forms.PrintDialog printDialog = new System.Windows.Forms.PrintDialog();
printDialog.Document = new System.Drawing.Printing.PrintDocument();
printDialog.Document.PrintPage += (a, b) =>
{
// 计算图像的宽度和高度
int imageWidth = img.Width;
int imageHeight = img.Height;
// 获取打印区域的宽度和高度(考虑到页边距)
float marginBoundsWidth = b.MarginBounds.Width;
float marginBoundsHeight = b.MarginBounds.Height;
// 计算绘制起点的坐标,使图像居中
float left = (marginBoundsWidth - imageWidth) / 2;
float top = (marginBoundsHeight - imageHeight) / 2;
// 确保坐标值不为负数
left = left < 0 ? 0 : left;
top = top < 0 ? 0 : top;
b.Graphics.DrawImage(img, left, top, imageWidth, imageHeight);
};
printDialog.UseEXDialog = true; // 显示增强的打印对话框
if (printDialog.ShowDialog() == DialogResult.OK)
{
printDialog.Document.Print(); // 执行打印操作
}
}
}
catch (Exception ex)
{
Global.MsgWarn(ex.Message);
Debug.Write(ex.Message);
}
}
}
#endregion PACS

@ -123,6 +123,12 @@
<metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>175, 17</value>
</metadata>
<metadata name="RptPacsMenuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>732, 17</value>
</metadata>
<metadata name="RptExtMenuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>580, 17</value>
</metadata>
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>340, 17</value>
</metadata>

Loading…
Cancel
Save