From fbb010d3a7c9894870afbfa54f0b5031cce8cf7b Mon Sep 17 00:00:00 2001 From: LiJiaWen Date: Tue, 11 Nov 2025 15:19:14 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=A1=B9=E7=9B=AE=E6=8A=A5?= =?UTF-8?q?=E5=91=8A=E6=89=93=E5=8D=B0=E5=8A=9F=E8=83=BD=E5=92=8C=E4=B8=80?= =?UTF-8?q?=E4=BA=9B=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1.检查报告增加右键菜单打印功能 2.其他报告增加右键菜单打印和删除功能 3.修复个人报告的批量预览功能 4.团队登记人员列表刷新逻辑优化 5.分检添加结论词逻辑优化 --- PEIS/PEIS.csproj | 1 + PEIS/Properties/Resources.Designer.cs | 10 ++ PEIS/Properties/Resources.resx | 3 + PEIS/Resources/打印.png | Bin 0 -> 1080 bytes PEIS/Utils/ReportHelper.cs | 152 ++++++++-------------- PEIS/View/Enrollment/EnrollmentOrgForm.cs | 9 +- PEIS/View/Exam/PartForm.Designer.cs | 52 ++++++++ PEIS/View/Exam/PartForm.cs | 142 ++++++++++++++++++-- PEIS/View/Exam/PartForm.resx | 6 + 9 files changed, 259 insertions(+), 116 deletions(-) create mode 100644 PEIS/Resources/打印.png diff --git a/PEIS/PEIS.csproj b/PEIS/PEIS.csproj index 246a355..49417e0 100644 --- a/PEIS/PEIS.csproj +++ b/PEIS/PEIS.csproj @@ -827,6 +827,7 @@ + Always diff --git a/PEIS/Properties/Resources.Designer.cs b/PEIS/Properties/Resources.Designer.cs index baf42c5..10c3353 100644 --- a/PEIS/Properties/Resources.Designer.cs +++ b/PEIS/Properties/Resources.Designer.cs @@ -390,6 +390,16 @@ namespace PEIS.Properties { } } + /// + /// 查找 System.Drawing.Bitmap 类型的本地化资源。 + /// + internal static System.Drawing.Bitmap 打印 { + get { + object obj = ResourceManager.GetObject("打印", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// 查找 System.Drawing.Bitmap 类型的本地化资源。 /// diff --git a/PEIS/Properties/Resources.resx b/PEIS/Properties/Resources.resx index ccf5ed8..276a16c 100644 --- a/PEIS/Properties/Resources.resx +++ b/PEIS/Properties/Resources.resx @@ -247,4 +247,7 @@ ..\Resources\刷新 (1).png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\打印.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/PEIS/Resources/打印.png b/PEIS/Resources/打印.png new file mode 100644 index 0000000000000000000000000000000000000000..155c0ab828e75597f568b180df36679316c055d4 GIT binary patch literal 1080 zcmV-81jqY{P)7%g5T02(4iQ0-LP4knMAcS}Vq29;;u4S`zy%?JNaGbZE^y=mr(O{41%w2G1IHdX z*EW^tpFJ&6_vx zXV;;7{M`Qm9DMWqBe{HCdc}CY{#TsjcFjPdzbWcSg#Htf*;o*{4vr6WEnNffR+Aih z`K40KPR0T3F9BVB!-irRso~wig8*7G@T~jCP;R<@5uPD)b!SwsO$xPJ~f{*5Xzy$kX%@N=vkAM0dL8As`9W;%9l zSL2KwTxAqMQ~v)52Kz|pOYg$X;c_YSVw@cx)8={STK{7R;yX<2wOqd8>fnkf02Y1= zgD+v=53AL&b?w|q%$+^3;`6{e>Qls@R;dUAa3z80Mv(GFRrZP_ZhbVDuN~hEUF#!9 z7oIe_sm3envs&14{7n4Z87EhJE!t-d9h(F$pC0a^KqWP53vHvQC z4<@>Xi9QrIgNtbB%5to0(~@qNUZQ{2CwX}@mS&z=L}57a)ZM{41@|t|@LS=)Kl8=x%w`a=uj{V5a$)2GMUOC+fo;&R{SR|&2 z!){~0(Y3s=ZfNI@)~3euwV6&BbL%;nh9%&I4H|XpDPh@7!pLZ#4FW)2gg#;7zJ$o^ z*wncUR9lMAyazTfbwrbgw-BMw!3TZ%0^B}dXokWk3ZU|B<{RjaG0|=(;n#BEe;{tB zM-jELn=fU)E*CT036<07@8QQ3a9^-~28C9U;rB`CqOA9QZVd1;jv-Bf}n}JSH|7Y33H{B&n!WbL y%77Z)DZ24)0RRC1{}I><(*OVf21!IgR09C5a}91la89iN0000 /// 体检号 /// - 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 /// /// /// - 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"); - rpt.Prepare(); //准备 + if (combineReport == null) + { + rpt.Prepare(); //准备 + } + else + { + rpt.Prepare(true); //合并报表 + } return rpt; } @@ -496,9 +507,13 @@ namespace PEIS.Utils /// /// /// - 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"); - rpt.Prepare(); //准备 + if (combineReport == null) + { + rpt.Prepare(); //准备 + } + else + { + rpt.Prepare(true); //合并报表 + } return rpt; } @@ -585,9 +607,13 @@ namespace PEIS.Utils /// /// /// - 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"); - rpt.Prepare(); //准备 + 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( - $"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); - } - - i++; + report = ReportHelper.GetReport(eid, null, report); } - return rpt; + return report; } catch (Exception ex) { diff --git a/PEIS/View/Enrollment/EnrollmentOrgForm.cs b/PEIS/View/Enrollment/EnrollmentOrgForm.cs index 4e111d2..4b680c2 100644 --- a/PEIS/View/Enrollment/EnrollmentOrgForm.cs +++ b/PEIS/View/Enrollment/EnrollmentOrgForm.cs @@ -2355,9 +2355,12 @@ namespace PEIS.View.Enrollment if (topRowIndex != -1) { int rowHandle = DgvEnrollment.LocateByValue("ID", topRowIndex); - DgvEnrollment.FocusedRowHandle = rowHandle; - DgvEnrollment.SelectRow(rowHandle); - DgcEnrollment.Refresh(); + if (rowHandle > 0) + { + DgvEnrollment.FocusedRowHandle = rowHandle; + DgvEnrollment.SelectRow(rowHandle); + DgcEnrollment.Refresh(); + } } })); DgvEnrollment.BestFitColumns(); diff --git a/PEIS/View/Exam/PartForm.Designer.cs b/PEIS/View/Exam/PartForm.Designer.cs index 2423923..7166df5 100644 --- a/PEIS/View/Exam/PartForm.Designer.cs +++ b/PEIS/View/Exam/PartForm.Designer.cs @@ -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; } } \ No newline at end of file diff --git a/PEIS/View/Exam/PartForm.cs b/PEIS/View/Exam/PartForm.cs index dd6255b..d07ce5b 100644 --- a/PEIS/View/Exam/PartForm.cs +++ b/PEIS/View/Exam/PartForm.cs @@ -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 _feeItem = DAOHelp.GetDataBySQL($"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 页面控件事件 @@ -1142,7 +1208,7 @@ namespace PEIS.View.Exam /// /// /// - private void TsmiPick_Click(object sender, EventArgs e) + private void TsmiPick_Click(object sender, EventArgs e) { if (_patient.ID <= 0 || _patient.FinishTime != null || _examPart.VerifyTime != null || _examPart.GiveUpTime != null) return; DAOHelp.ExecuteSql($@"DELETE FROM Report WHERE ID IN ( @@ -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 _noResultItem = DAOHelp.GetDataBySQL($@"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,14 +1371,14 @@ 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; } } } - + Review?.Invoke(this, new Args { ID = _examPart.ID, @@ -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 /// 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); @@ -1899,7 +1967,7 @@ namespace PEIS.View.Exam _examResultList.Add(rowData); } - + ShowExamResultList(null, DgvExamResult.TopRowIndex); if (rowHandle >= DgvExamResult.RowCount) { @@ -1981,11 +2049,11 @@ namespace PEIS.View.Exam /// 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 } /// - /// 其他报告双击 + /// 打印PACS报告 /// /// /// - 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 diff --git a/PEIS/View/Exam/PartForm.resx b/PEIS/View/Exam/PartForm.resx index 920c9f3..465fe2f 100644 --- a/PEIS/View/Exam/PartForm.resx +++ b/PEIS/View/Exam/PartForm.resx @@ -123,6 +123,12 @@ 175, 17 + + 732, 17 + + + 580, 17 + 340, 17