一些功能优化和BUG修复

1.分检查询功能SQL优化
2.分检界面其他报告放大显示
3.个人报告批量预览时的打印功能BUG修复
4.团体报告内容优化和BUG修复
dhzzyy
LiJiaWen 3 weeks ago
parent fbb010d3a7
commit fb36a2efbe
  1. 72
      PEIS/Model/Exam/PartModel.cs
  2. 21
      PEIS/Model/ReportModel.cs
  3. 72
      PEIS/ReportFiles/TReport.frx
  4. 13
      PEIS/Utils/Global.cs
  5. 15
      PEIS/View/EReport/PersonReportForm.cs
  6. 6
      PEIS/View/EReport/TeamReportForm.cs
  7. 36
      PEIS/View/Exam/PartForm.Designer.cs
  8. 50
      PEIS/View/Exam/PartForm.cs
  9. 6
      PEIS/View/Exam/PartForm.resx

@ -73,19 +73,44 @@ namespace PEIS.Model
return new List<EnrollmentPatient>(); return new List<EnrollmentPatient>();
} }
// Tel1,Tel2,Contactor1,Contactor2,Address1,Address2,Education,Occupation,FinisherCode,Finisher, string whereCondition = "";
// 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 ";
if (string.IsNullOrWhiteSpace(team) && string.IsNullOrWhiteSpace(info)) 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)) 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)) 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<EnrollmentPatient>(sql).OrderByDescending(o => o.SignTime).ToList(); var data = DAOHelp.GetDataBySQL<EnrollmentPatient>(sql).OrderByDescending(o => o.SignTime).ToList();
return data; return data;
@ -99,12 +124,27 @@ namespace PEIS.Model
public EnrollmentPatient GetPatientInfo(long eid) public EnrollmentPatient GetPatientInfo(long eid)
{ {
var sql = $@" var sql = $@"
SELECT DISTINCT eid AS ID, NAME, Sex, Age, AgeClass,Nation, CardType,CardNo, WITH StatusData AS (
Tel1,Tel2,Contactor1,Contactor2,Address1,Address2,Marriage,Education,Occupation, SELECT
ExamDate,Type, OID,OEID,OrgName,GroupID,GroupName,SignTime,FinishTime,FinisherCode,Finisher, eid AS ID, NAME, Sex, Age, AgeClass, Nation, CardType, CardNo,
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 Tel1, Tel2, Contactor1, Contactor2, Address1, Address2, Marriage,
FROM vi_EnPart AS main Education, Occupation, ExamDate, Type, OID, OEID, OrgName, GroupID,
WHERE eid={eid}"; 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<EnrollmentPatient>(sql).FirstOrDefault(); return DAOHelp.GetDataBySQL<EnrollmentPatient>(sql).FirstOrDefault();
} }

@ -205,7 +205,7 @@ namespace PEIS.Model
// pacs原始报告 // pacs原始报告
public List<Report> GetPacsPhoto(Int64 Eid) public List<Report> GetPacsPhoto(Int64 Eid)
{ {
var pacs = DAOHelp.GetDataBySQL<Report>($"select ReportImage from Report where EID = { Eid } AND ReportImage IS NOT NULL"); var pacs = DAOHelp.GetDataBySQL<Report>($"select ReportImage from Report where EID = { Eid } AND ReportImage IS NOT NULL");
var heart = DAOHelp.GetDataBySQL<Report>($"select ReportData AS ReportImage from Report_GSEXD where PatientNo = {Eid} AND ReportData IS NOT NULL"); var heart = DAOHelp.GetDataBySQL<Report>($"select ReportData AS ReportImage from Report_GSEXD where PatientNo = {Eid} AND ReportData IS NOT NULL");
if (heart.Count == 0) if (heart.Count == 0)
@ -314,7 +314,9 @@ namespace PEIS.Model
//根据团体体检号获取收费列表 //根据团体体检号获取收费列表
public List<EnrollmentFeeItem> GetOrgFeeItem(Int64 oEid) public List<EnrollmentFeeItem> GetOrgFeeItem(Int64 oEid)
{ {
return DAOHelp.GetDataBySQL<EnrollmentFeeItem>(@"SELECT if (Global.UseGroupFeeItemsInTeamReport == "0")
{
return DAOHelp.GetDataBySQL<EnrollmentFeeItem>(@"SELECT
DISTINCT DISTINCT
a.FeeItemName, a.FeeItemName,
a.DeptName, a.DeptName,
@ -323,7 +325,16 @@ namespace PEIS.Model
END AS ItemClass END AS ItemClass
FROM Enrollment_FeeItem a FROM Enrollment_FeeItem a
LEFT JOIN Enrollment_Patient b ON a.EID = b.ID " + 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<EnrollmentFeeItem>($@"
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, ROUND( SUM ( CASE Sex WHEN 2 THEN 1 ELSE 0 END ) * 100.0 /@SumPerson, 2 ) AS SumFemalePercent,
COUNT ( * ) AS SumWarn, COUNT ( * ) AS SumWarn,
ROUND( COUNT ( * ) * 100.0 /@SumPerson, 2 ) AS SumWarnPercent,@SumPerson AS SumPerson, 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 '' AS ResultFlag
FROM FROM
Exam_Conclusion A ( NOLOCK ) Exam_Conclusion A ( NOLOCK )
@ -360,7 +371,7 @@ namespace PEIS.Model
B.OEID = {oEid} B.OEID = {oEid}
GROUP BY GROUP BY
A.Conclusion, A.Conclusion,
A.Suggestion LTRIM(RTRIM(REPLACE(REPLACE(REPLACE(A.Suggestion,CHAR(09),''),CHAR(10),''),CHAR(13),'')))
HAVING HAVING
COUNT ( * ) != 0 COUNT ( * ) != 0
ORDER BY SumWarn DESC"); ORDER BY SumWarn DESC");

File diff suppressed because one or more lines are too long

@ -36,6 +36,9 @@ namespace PEIS.Utils
return Global._lstConfig.FirstOrDefault(x => x.Key == "HisDBName")?.Value ?? "his.hisdata.dbo"; return Global._lstConfig.FirstOrDefault(x => x.Key == "HisDBName")?.Value ?? "his.hisdata.dbo";
} }
} }
/// <summary>
/// 允许重复打开相同页面
/// </summary>
public static string AllowDuplicateTabs public static string AllowDuplicateTabs
{ {
get get
@ -43,6 +46,16 @@ namespace PEIS.Utils
return Global._lstConfig.FirstOrDefault(x => x.Key == "AllowDuplicateTabs")?.Value ?? "0"; return Global._lstConfig.FirstOrDefault(x => x.Key == "AllowDuplicateTabs")?.Value ?? "0";
} }
} }
/// <summary>
/// 在团体报告中展示分组绑定项目而不是实际人员登记项目
/// </summary>
public static string UseGroupFeeItemsInTeamReport
{
get
{
return Global._lstConfig.FirstOrDefault(x => x.Key == "UseGroupFeeItemsInTeamReport")?.Value ?? "0";
}
}
/// <summary> /// <summary>
/// 配置信息 /// 配置信息

@ -58,9 +58,9 @@ namespace PEIS.View.EReport
private void ReportPreview_OnPrint(object sender, FastReport.Preview.PreviewControl.PrintEventArgs e) private void ReportPreview_OnPrint(object sender, FastReport.Preview.PreviewControl.PrintEventArgs e)
{ {
if(pReport != null) if (pReport != null)
{ {
pReport.Print(); pReport.PrintPrepared();
if (print) if (print)
{ {
foreach (var eid in _idList) foreach (var eid in _idList)
@ -117,7 +117,7 @@ namespace PEIS.View.EReport
Invoke(new Action(() => _regInfo = null)); Invoke(new Action(() => _regInfo = null));
Invoke(new Action(() => _regInfo = DgvRegItem.GetRow(DgvRegItem.GetSelectedRows()[0]) as EnrollmentPatient)); Invoke(new Action(() => _regInfo = DgvRegItem.GetRow(DgvRegItem.GetSelectedRows()[0]) as EnrollmentPatient));
try try
{ {
pReport = ReportHelper.GetReport(_regInfo.ID); pReport = ReportHelper.GetReport(_regInfo.ID);
@ -144,7 +144,7 @@ namespace PEIS.View.EReport
if (_lstRegInfo == null || _lstRegInfo.Count == 0) return; if (_lstRegInfo == null || _lstRegInfo.Count == 0) return;
var idList = new List<Int64>(); var idList = new List<Int64>();
for(int i = 0; i < DgvRegItem.RowCount; i++) for (int i = 0; i < DgvRegItem.RowCount; i++)
{ {
if (DgvRegItem.GetRowCellValue(i, "IsSelected").ToString() == "1") if (DgvRegItem.GetRowCellValue(i, "IsSelected").ToString() == "1")
{ {
@ -173,9 +173,10 @@ namespace PEIS.View.EReport
public event EventHandler<Args<dynamic>> GetRegItems; public event EventHandler<Args<dynamic>> GetRegItems;
public void ShowRegItems(List<EnrollmentPatient> items) public void ShowRegItems(List<EnrollmentPatient> items)
{ {
Invoke(new Action(() => { Invoke(new Action(() =>
items.ForEach(f => f.IsSelected = 0); {
_lstRegInfo = items; items.ForEach(f => f.IsSelected = 0);
_lstRegInfo = items;
})); }));
Invoke(new Action(() => DgcRegItem.DataSource = null)); Invoke(new Action(() => DgcRegItem.DataSource = null));
Invoke(new Action(() => DgcRegItem.DataSource = _lstRegInfo)); Invoke(new Action(() => DgcRegItem.DataSource = _lstRegInfo));

@ -386,19 +386,19 @@ namespace PEIS.View.EReport
tReport.GetDataSource("F").Enabled = true; 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; DataBand conclusion = tReport.Report.FindObject("Conclusion") as DataBand;
conclusion.DataSource = tReport.Report.GetDataSource("C"); conclusion.DataSource = tReport.Report.GetDataSource("C");
tReport.GetDataSource("C").Enabled = true; 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; DataBand SumMale = tReport.Report.FindObject("SumMale") as DataBand;
SumMale.DataSource = tReport.Report.GetDataSource("B"); SumMale.DataSource = tReport.Report.GetDataSource("B");
tReport.GetDataSource("B").Enabled = true; 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; DataBand SumFemale = tReport.Report.FindObject("SumFemale") as DataBand;
SumFemale.DataSource = tReport.Report.GetDataSource("G"); SumFemale.DataSource = tReport.Report.GetDataSource("G");
tReport.GetDataSource("G").Enabled = true; tReport.GetDataSource("G").Enabled = true;

@ -157,6 +157,8 @@
this.OpsPacsImg = new PEIS.View.UControl.OpMenuSimple(); this.OpsPacsImg = new PEIS.View.UControl.OpMenuSimple();
this.panelPacsRptList = new System.Windows.Forms.Panel(); this.panelPacsRptList = new System.Windows.Forms.Panel();
this.dgcRptPacs = new DevExpress.XtraGrid.GridControl(); 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.DgvRptPacs = new DevExpress.XtraGrid.Views.Grid.GridView();
this.colPacsTime = new DevExpress.XtraGrid.Columns.GridColumn(); this.colPacsTime = new DevExpress.XtraGrid.Columns.GridColumn();
this.colPacsImageTitle1 = new DevExpress.XtraGrid.Columns.GridColumn(); this.colPacsImageTitle1 = new DevExpress.XtraGrid.Columns.GridColumn();
@ -244,8 +246,6 @@
this.colRptExtTime = new DevExpress.XtraGrid.Columns.GridColumn(); this.colRptExtTime = new DevExpress.XtraGrid.Columns.GridColumn();
this.colRptExtDesc = new DevExpress.XtraGrid.Columns.GridColumn(); this.colRptExtDesc = new DevExpress.XtraGrid.Columns.GridColumn();
this.superTabControl1 = new FastReport.DevComponents.DotNetBar.SuperTabControl(); 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(); ((System.ComponentModel.ISupportInitialize)(this.splitContainerBase)).BeginInit();
this.splitContainerBase.Panel1.SuspendLayout(); this.splitContainerBase.Panel1.SuspendLayout();
this.splitContainerBase.Panel2.SuspendLayout(); this.splitContainerBase.Panel2.SuspendLayout();
@ -310,6 +310,7 @@
this.panel14.SuspendLayout(); this.panel14.SuspendLayout();
this.panelPacsRptList.SuspendLayout(); this.panelPacsRptList.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dgcRptPacs)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dgcRptPacs)).BeginInit();
this.RptPacsMenuStrip.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.DgvRptPacs)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.DgvRptPacs)).BeginInit();
this.tabPageReport.SuspendLayout(); this.tabPageReport.SuspendLayout();
this.panelReportBase.SuspendLayout(); this.panelReportBase.SuspendLayout();
@ -331,7 +332,6 @@
this.panel2.SuspendLayout(); this.panel2.SuspendLayout();
this.menuStrip1.SuspendLayout(); this.menuStrip1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.superTabControl1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.superTabControl1)).BeginInit();
this.RptPacsMenuStrip.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// splitContainerBase // splitContainerBase
@ -1920,6 +1920,20 @@
this.dgcRptPacs.ViewCollection.AddRange(new DevExpress.XtraGrid.Views.Base.BaseView[] { this.dgcRptPacs.ViewCollection.AddRange(new DevExpress.XtraGrid.Views.Base.BaseView[] {
this.DgvRptPacs}); 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 // DgvRptPacs
// //
this.DgvRptPacs.Appearance.Empty.BackColor = System.Drawing.Color.WhiteSmoke; this.DgvRptPacs.Appearance.Empty.BackColor = System.Drawing.Color.WhiteSmoke;
@ -3059,20 +3073,6 @@
this.superTabControl1.SelectedTabIndex = -1; this.superTabControl1.SelectedTabIndex = -1;
this.superTabControl1.TabIndex = 0; 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 // PartForm
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F); this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
@ -3152,6 +3152,7 @@
this.panel14.ResumeLayout(false); this.panel14.ResumeLayout(false);
this.panelPacsRptList.ResumeLayout(false); this.panelPacsRptList.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dgcRptPacs)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.dgcRptPacs)).EndInit();
this.RptPacsMenuStrip.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.DgvRptPacs)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.DgvRptPacs)).EndInit();
this.tabPageReport.ResumeLayout(false); this.tabPageReport.ResumeLayout(false);
this.panelReportBase.ResumeLayout(false); this.panelReportBase.ResumeLayout(false);
@ -3177,7 +3178,6 @@
this.menuStrip1.ResumeLayout(false); this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout(); this.menuStrip1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.superTabControl1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.superTabControl1)).EndInit();
this.RptPacsMenuStrip.ResumeLayout(false);
this.ResumeLayout(false); this.ResumeLayout(false);
} }

@ -1053,30 +1053,54 @@ namespace PEIS.View.Exam
{ {
Invoke(new Action(() => picReportExt.Image = null)); Invoke(new Action(() => picReportExt.Image = null));
if (item.ReportImg == null) return; if (item.ReportImg == null) return;
Image img = null;
Bitmap scaledImage = null;
try try
{ {
if (item.Class == "十二通道心电图检查") if (item.Class == "十二通道心电图检查")
{ {
var img = ReportHelper.PdfToImg(item.ReportImg); img = ReportHelper.PdfToImg(item.ReportImg);
if (img != null) }
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;
} }
if (img != null)
Invoke(new Action(() =>
{ {
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); g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
picReportExt.Image = img; 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) catch (Exception e)
{ {

@ -120,6 +120,9 @@
<metadata name="menuStrip2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="menuStrip2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>460, 17</value> <value>460, 17</value>
</metadata> </metadata>
<metadata name="menuStrip2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>460, 17</value>
</metadata>
<metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>175, 17</value> <value>175, 17</value>
</metadata> </metadata>
@ -132,6 +135,9 @@
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>340, 17</value> <value>340, 17</value>
</metadata> </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>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="tsmiCancel.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="tsmiCancel.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value> <value>

Loading…
Cancel
Save