From fb36a2efbed97a212faf341a053f51079df3f769 Mon Sep 17 00:00:00 2001 From: LiJiaWen Date: Fri, 28 Nov 2025 15:31:36 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=80=E4=BA=9B=E5=8A=9F=E8=83=BD=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E5=92=8CBUG=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1.分检查询功能SQL优化 2.分检界面其他报告放大显示 3.个人报告批量预览时的打印功能BUG修复 4.团体报告内容优化和BUG修复 --- PEIS/Model/Exam/PartModel.cs | 72 +++++++++++++++++++++------ PEIS/Model/ReportModel.cs | 21 ++++++-- PEIS/ReportFiles/TReport.frx | 72 +++++++++++++-------------- PEIS/Utils/Global.cs | 13 +++++ PEIS/View/EReport/PersonReportForm.cs | 15 +++--- PEIS/View/EReport/TeamReportForm.cs | 6 +-- PEIS/View/Exam/PartForm.Designer.cs | 36 +++++++------- PEIS/View/Exam/PartForm.cs | 50 ++++++++++++++----- PEIS/View/Exam/PartForm.resx | 6 +++ 9 files changed, 193 insertions(+), 98 deletions(-) diff --git a/PEIS/Model/Exam/PartModel.cs b/PEIS/Model/Exam/PartModel.cs index 2d9aff9..df0ad98 100644 --- a/PEIS/Model/Exam/PartModel.cs +++ b/PEIS/Model/Exam/PartModel.cs @@ -73,19 +73,44 @@ namespace PEIS.Model return new List(); } - // Tel1,Tel2,Contactor1,Contactor2,Address1,Address2,Education,Occupation,FinisherCode,Finisher, - // OID,OEID,OrgName,GroupID,GroupName,Sex, Age, AgeClass,Nation, CardType,CardNo,Marriage,Type, - var sql = $@" - SELECT DISTINCT eid AS ID, NAME, ExamDate,SignTime,FinishTime, - CASE WHEN EXISTS ( SELECT 1 FROM vi_EnPart AS sub WHERE sub.eid = main.eid AND sub.STATUS = '科室分检' AND sub.isSend=1 ) THEN '科室分检' ELSE main.STATUS END AS Status - FROM vi_EnPart AS main - WHERE isSend=1 and WeChatStatus>=0 "; + string whereCondition = ""; if (string.IsNullOrWhiteSpace(team) && string.IsNullOrWhiteSpace(info)) - sql += $"AND {dateType} >='{begDate}' AND {dateType} <'{endDate}'"; + whereCondition += $" AND {dateType} >='{begDate}' AND {dateType} <'{endDate}' "; if (!string.IsNullOrWhiteSpace(team)) - sql += long.TryParse(team, out _) ? $@" AND OEID ={team}" : $@"AND OrgName LIKE '%{team}%'"; + whereCondition += long.TryParse(team, out _) ? $@" AND OEID ={team}" : $@"AND OrgName LIKE '%{team}%'"; if (!string.IsNullOrWhiteSpace(info)) - sql += long.TryParse(info, out _) ? $@" AND EID ={info}" : $@"AND ( Name LIKE '%{info}%' or SpellCode like '{info}%' )"; + whereCondition += long.TryParse(info, out _) ? $@" AND EID ={info}" : $@"AND ( Name LIKE '%{info}%' or SpellCode like '{info}%' )"; + var sql = $@" +WITH StatusData AS ( + SELECT + eid AS ID, + NAME, + ExamDate, + SignTime, + FinishTime, + STATUS, + MAX(CASE WHEN STATUS = '科室分检' THEN 1 ELSE 0 END) + OVER (PARTITION BY eid) AS HasDeptCheck, + ROW_NUMBER() OVER ( + PARTITION BY eid + ORDER BY SignTime DESC + ) as rn + FROM vi_EnPart + WHERE isSend = 1 AND WeChatStatus >= 0 {whereCondition} +) +SELECT + ID, + NAME, + ExamDate, + SignTime, + FinishTime, + CASE + WHEN HasDeptCheck = 1 THEN '科室分检' + ELSE STATUS -- 直接取当前行的STATUS + END AS STATUS +FROM StatusData +WHERE rn = 1 -- 每个eid只取最新的一行"; + var data = DAOHelp.GetDataBySQL(sql).OrderByDescending(o => o.SignTime).ToList(); return data; @@ -99,12 +124,27 @@ namespace PEIS.Model public EnrollmentPatient GetPatientInfo(long eid) { var sql = $@" - SELECT DISTINCT eid AS ID, NAME, Sex, Age, AgeClass,Nation, CardType,CardNo, - Tel1,Tel2,Contactor1,Contactor2,Address1,Address2,Marriage,Education,Occupation, - ExamDate,Type, OID,OEID,OrgName,GroupID,GroupName,SignTime,FinishTime,FinisherCode,Finisher, - CASE WHEN EXISTS ( SELECT 1 FROM vi_EnPart AS sub WHERE sub.eid = main.eid AND sub.STATUS = '科室分检' AND sub.isSend=1 ) THEN '科室分检' ELSE main.STATUS END AS Status - FROM vi_EnPart AS main - WHERE eid={eid}"; +WITH StatusData AS ( + SELECT + eid AS ID, NAME, Sex, Age, AgeClass, Nation, CardType, CardNo, + Tel1, Tel2, Contactor1, Contactor2, Address1, Address2, Marriage, + Education, Occupation, ExamDate, Type, OID, OEID, OrgName, GroupID, + GroupName, SignTime, FinishTime, FinisherCode, Finisher, STATUS, + MAX(CASE WHEN STATUS = '科室分检' AND isSend = 1 THEN 1 ELSE 0 END) + OVER (PARTITION BY eid) AS HasDeptCheck + FROM vi_EnPart + WHERE eid = {eid} +) +SELECT DISTINCT + ID, NAME, Sex, Age, AgeClass, Nation, CardType, CardNo, + Tel1, Tel2, Contactor1, Contactor2, Address1, Address2, Marriage, + Education, Occupation, ExamDate, Type, OID, OEID, OrgName, GroupID, + GroupName, SignTime, FinishTime, FinisherCode, Finisher, + CASE + WHEN HasDeptCheck = 1 THEN '科室分检' + ELSE STATUS + END AS Status +FROM StatusData;"; return DAOHelp.GetDataBySQL(sql).FirstOrDefault(); } diff --git a/PEIS/Model/ReportModel.cs b/PEIS/Model/ReportModel.cs index 374e4ed..f2f2fb3 100644 --- a/PEIS/Model/ReportModel.cs +++ b/PEIS/Model/ReportModel.cs @@ -205,7 +205,7 @@ namespace PEIS.Model // pacs原始报告 public List GetPacsPhoto(Int64 Eid) { - var pacs = DAOHelp.GetDataBySQL($"select ReportImage from Report where EID = { Eid } AND ReportImage IS NOT NULL"); + var pacs = DAOHelp.GetDataBySQL($"select ReportImage from Report where EID = { Eid } AND ReportImage IS NOT NULL"); var heart = DAOHelp.GetDataBySQL($"select ReportData AS ReportImage from Report_GSEXD where PatientNo = {Eid} AND ReportData IS NOT NULL"); if (heart.Count == 0) @@ -314,7 +314,9 @@ namespace PEIS.Model //根据团体体检号获取收费列表 public List GetOrgFeeItem(Int64 oEid) { - return DAOHelp.GetDataBySQL(@"SELECT + if (Global.UseGroupFeeItemsInTeamReport == "0") + { + return DAOHelp.GetDataBySQL(@"SELECT DISTINCT a.FeeItemName, a.DeptName, @@ -323,7 +325,16 @@ namespace PEIS.Model END AS ItemClass FROM Enrollment_FeeItem a LEFT JOIN Enrollment_Patient b ON a.EID = b.ID " + - $"WHERE a.OEID = {oEid} ORDER BY ItemClass"); + $"WHERE a.OEID = {oEid} ORDER BY ItemClass"); + } + else + { + + return DAOHelp.GetDataBySQL($@" + SELECT DISTINCT A.FeeItemCode,FeeItemName,DeptName,CASE WHEN Sex = 1 THEN '男' ELSE '女' END AS ItemClass + FROM Enrollment_OrgFeeItem A JOIN Enrollment_OrgGroup B ON A.GroupID=B.ID LEFT JOIN Dict_FeeItem C ON A.FID=C.ID + WHERE OEID={oEid} and Sex<>3 and C.IsHide=0 ORDER BY ItemClass"); + } } //根据体检号获取异常结果 @@ -351,7 +362,7 @@ namespace PEIS.Model ROUND( SUM ( CASE Sex WHEN 2 THEN 1 ELSE 0 END ) * 100.0 /@SumPerson, 2 ) AS SumFemalePercent, COUNT ( * ) AS SumWarn, ROUND( COUNT ( * ) * 100.0 /@SumPerson, 2 ) AS SumWarnPercent,@SumPerson AS SumPerson, - ISNULL(A.Suggestion, '') AS Suggestion, + ISNULL(LTRIM(RTRIM(REPLACE(REPLACE(REPLACE(A.Suggestion,CHAR(09),''),CHAR(10),''),CHAR(13),''))), '') AS Suggestion, '已检出' AS ResultFlag FROM Exam_Conclusion A ( NOLOCK ) @@ -360,7 +371,7 @@ namespace PEIS.Model B.OEID = {oEid} GROUP BY A.Conclusion, - A.Suggestion + LTRIM(RTRIM(REPLACE(REPLACE(REPLACE(A.Suggestion,CHAR(09),''),CHAR(10),''),CHAR(13),''))) HAVING COUNT ( * ) != 0 ORDER BY SumWarn DESC"); diff --git a/PEIS/ReportFiles/TReport.frx b/PEIS/ReportFiles/TReport.frx index 9efe1f3..c539f3f 100644 --- a/PEIS/ReportFiles/TReport.frx +++ b/PEIS/ReportFiles/TReport.frx @@ -1,5 +1,5 @@  - + using System; using System.Collections; using System.Collections.Generic; @@ -172,7 +172,7 @@ namespace FastReport - + @@ -186,7 +186,7 @@ namespace FastReport - + @@ -194,11 +194,11 @@ namespace FastReport - + - + @@ -207,7 +207,7 @@ namespace FastReport - + @@ -224,11 +224,11 @@ namespace FastReport - - + + - + @@ -236,7 +236,7 @@ namespace FastReport - + @@ -244,7 +244,7 @@ namespace FastReport - + @@ -259,7 +259,7 @@ namespace FastReport - + @@ -282,13 +282,13 @@ namespace FastReport - + - + @@ -303,7 +303,7 @@ namespace FastReport - + @@ -328,7 +328,7 @@ namespace FastReport - + @@ -343,7 +343,7 @@ namespace FastReport - + @@ -368,93 +368,93 @@ namespace FastReport - + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -462,7 +462,7 @@ namespace FastReport - + @@ -507,7 +507,7 @@ namespace FastReport - + @@ -598,7 +598,7 @@ namespace FastReport - + diff --git a/PEIS/Utils/Global.cs b/PEIS/Utils/Global.cs index 3dce59a..bd1942f 100644 --- a/PEIS/Utils/Global.cs +++ b/PEIS/Utils/Global.cs @@ -36,6 +36,9 @@ namespace PEIS.Utils return Global._lstConfig.FirstOrDefault(x => x.Key == "HisDBName")?.Value ?? "his.hisdata.dbo"; } } + /// + /// 允许重复打开相同页面 + /// public static string AllowDuplicateTabs { get @@ -43,6 +46,16 @@ namespace PEIS.Utils return Global._lstConfig.FirstOrDefault(x => x.Key == "AllowDuplicateTabs")?.Value ?? "0"; } } + /// + /// 在团体报告中展示分组绑定项目而不是实际人员登记项目 + /// + public static string UseGroupFeeItemsInTeamReport + { + get + { + return Global._lstConfig.FirstOrDefault(x => x.Key == "UseGroupFeeItemsInTeamReport")?.Value ?? "0"; + } + } /// /// 配置信息 diff --git a/PEIS/View/EReport/PersonReportForm.cs b/PEIS/View/EReport/PersonReportForm.cs index d42f4d7..ddc7b5c 100644 --- a/PEIS/View/EReport/PersonReportForm.cs +++ b/PEIS/View/EReport/PersonReportForm.cs @@ -58,9 +58,9 @@ namespace PEIS.View.EReport private void ReportPreview_OnPrint(object sender, FastReport.Preview.PreviewControl.PrintEventArgs e) { - if(pReport != null) + if (pReport != null) { - pReport.Print(); + pReport.PrintPrepared(); if (print) { foreach (var eid in _idList) @@ -117,7 +117,7 @@ namespace PEIS.View.EReport Invoke(new Action(() => _regInfo = null)); Invoke(new Action(() => _regInfo = DgvRegItem.GetRow(DgvRegItem.GetSelectedRows()[0]) as EnrollmentPatient)); - + try { pReport = ReportHelper.GetReport(_regInfo.ID); @@ -144,7 +144,7 @@ namespace PEIS.View.EReport if (_lstRegInfo == null || _lstRegInfo.Count == 0) return; var idList = new List(); - for(int i = 0; i < DgvRegItem.RowCount; i++) + for (int i = 0; i < DgvRegItem.RowCount; i++) { if (DgvRegItem.GetRowCellValue(i, "IsSelected").ToString() == "1") { @@ -173,9 +173,10 @@ namespace PEIS.View.EReport public event EventHandler> GetRegItems; public void ShowRegItems(List items) { - Invoke(new Action(() => { - items.ForEach(f => f.IsSelected = 0); - _lstRegInfo = items; + Invoke(new Action(() => + { + items.ForEach(f => f.IsSelected = 0); + _lstRegInfo = items; })); Invoke(new Action(() => DgcRegItem.DataSource = null)); Invoke(new Action(() => DgcRegItem.DataSource = _lstRegInfo)); diff --git a/PEIS/View/EReport/TeamReportForm.cs b/PEIS/View/EReport/TeamReportForm.cs index 7d79068..0f2806f 100644 --- a/PEIS/View/EReport/TeamReportForm.cs +++ b/PEIS/View/EReport/TeamReportForm.cs @@ -386,19 +386,19 @@ namespace PEIS.View.EReport tReport.GetDataSource("F").Enabled = true; //异常结果 - tReport.RegisterData(_lstConclusions.Take(10), "C"); + tReport.RegisterData(_lstCon.Take(10), "C"); DataBand conclusion = tReport.Report.FindObject("Conclusion") as DataBand; conclusion.DataSource = tReport.Report.GetDataSource("C"); tReport.GetDataSource("C").Enabled = true; //男性异常结果 - tReport.RegisterData(_lstConclusions.OrderByDescending(o => o.SumMalePercent).ToList().Take(10), "B"); + tReport.RegisterData(_lstCon.OrderByDescending(o => o.SumMalePercent).ToList().Take(10), "B"); DataBand SumMale = tReport.Report.FindObject("SumMale") as DataBand; SumMale.DataSource = tReport.Report.GetDataSource("B"); tReport.GetDataSource("B").Enabled = true; //女性异常结果 - tReport.RegisterData(_lstConclusions.OrderByDescending(o => o.SumFemalePercent).ToList().Take(10), "G"); + tReport.RegisterData(_lstCon.OrderByDescending(o => o.SumFemalePercent).ToList().Take(10), "G"); DataBand SumFemale = tReport.Report.FindObject("SumFemale") as DataBand; SumFemale.DataSource = tReport.Report.GetDataSource("G"); tReport.GetDataSource("G").Enabled = true; diff --git a/PEIS/View/Exam/PartForm.Designer.cs b/PEIS/View/Exam/PartForm.Designer.cs index 7166df5..26699b6 100644 --- a/PEIS/View/Exam/PartForm.Designer.cs +++ b/PEIS/View/Exam/PartForm.Designer.cs @@ -157,6 +157,8 @@ this.OpsPacsImg = new PEIS.View.UControl.OpMenuSimple(); this.panelPacsRptList = new System.Windows.Forms.Panel(); this.dgcRptPacs = new DevExpress.XtraGrid.GridControl(); + this.RptPacsMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components); + this.PrintRptPacsMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.DgvRptPacs = new DevExpress.XtraGrid.Views.Grid.GridView(); this.colPacsTime = new DevExpress.XtraGrid.Columns.GridColumn(); this.colPacsImageTitle1 = new DevExpress.XtraGrid.Columns.GridColumn(); @@ -244,8 +246,6 @@ 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(); @@ -310,6 +310,7 @@ this.panel14.SuspendLayout(); this.panelPacsRptList.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.dgcRptPacs)).BeginInit(); + this.RptPacsMenuStrip.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.DgvRptPacs)).BeginInit(); this.tabPageReport.SuspendLayout(); this.panelReportBase.SuspendLayout(); @@ -331,7 +332,6 @@ this.panel2.SuspendLayout(); this.menuStrip1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.superTabControl1)).BeginInit(); - this.RptPacsMenuStrip.SuspendLayout(); this.SuspendLayout(); // // splitContainerBase @@ -1920,6 +1920,20 @@ this.dgcRptPacs.ViewCollection.AddRange(new DevExpress.XtraGrid.Views.Base.BaseView[] { this.DgvRptPacs}); // + // 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 = "打印报告"; + // // DgvRptPacs // this.DgvRptPacs.Appearance.Empty.BackColor = System.Drawing.Color.WhiteSmoke; @@ -3059,20 +3073,6 @@ 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); @@ -3152,6 +3152,7 @@ this.panel14.ResumeLayout(false); this.panelPacsRptList.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.dgcRptPacs)).EndInit(); + this.RptPacsMenuStrip.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.DgvRptPacs)).EndInit(); this.tabPageReport.ResumeLayout(false); this.panelReportBase.ResumeLayout(false); @@ -3177,7 +3178,6 @@ this.menuStrip1.ResumeLayout(false); this.menuStrip1.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.superTabControl1)).EndInit(); - this.RptPacsMenuStrip.ResumeLayout(false); this.ResumeLayout(false); } diff --git a/PEIS/View/Exam/PartForm.cs b/PEIS/View/Exam/PartForm.cs index d07ce5b..010cab1 100644 --- a/PEIS/View/Exam/PartForm.cs +++ b/PEIS/View/Exam/PartForm.cs @@ -1053,30 +1053,54 @@ namespace PEIS.View.Exam { Invoke(new Action(() => picReportExt.Image = null)); if (item.ReportImg == null) return; + Image img = null; + Bitmap scaledImage = null; try { if (item.Class == "十二通道心电图检查") { - var img = ReportHelper.PdfToImg(item.ReportImg); - if (img != null) + img = ReportHelper.PdfToImg(item.ReportImg); + } + else + { + using (var ms = new MemoryStream(item.ReportImg, 0, item.ReportImg.Length)) { - Invoke(new Action(() => { picReportExt.Image = img; picReportExt.Dock = DockStyle.Fill; picReportExt.SizeMode = PictureBoxSizeMode.Zoom; })); + img = Image.FromStream(ms, true); } - - return; } - - Invoke(new Action(() => + if (img != null) { - using (var ms = new MemoryStream(item.ReportImg, 0, item.ReportImg.Length)) + int availableWidth = panelReport.ClientSize.Width - SystemInformation.VerticalScrollBarWidth; + + if (availableWidth > 0) { - Invoke(new Action(() => + + // 计算缩放比例 + var currentScale = (float)availableWidth / img.Width; + + // 计算新尺寸 + int newWidth = availableWidth; + int newHeight = (int)(img.Height * currentScale); + + // 创建缩放后的图片 + scaledImage = new Bitmap(newWidth, newHeight); + + using (Graphics g = Graphics.FromImage(scaledImage)) { - var img = Image.FromStream(ms, true); - picReportExt.Image = img; - })); + g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic; + g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; + g.DrawImage(img, 0, 0, newWidth, newHeight); + } + } - })); + + + Invoke(new Action(() => + { + picReportExt.Image = scaledImage; + panelReport.AutoScrollPosition = new Point(0, 0); + })); + } } catch (Exception e) { diff --git a/PEIS/View/Exam/PartForm.resx b/PEIS/View/Exam/PartForm.resx index 465fe2f..27d9593 100644 --- a/PEIS/View/Exam/PartForm.resx +++ b/PEIS/View/Exam/PartForm.resx @@ -120,6 +120,9 @@ 460, 17 + + 460, 17 + 175, 17 @@ -132,6 +135,9 @@ 340, 17 + + 340, 17 +