diff --git a/PEIS/App.config b/PEIS/App.config index e35a23d..f1bc3d1 100644 --- a/PEIS/App.config +++ b/PEIS/App.config @@ -6,8 +6,8 @@ - - + + @@ -15,13 +15,13 @@ - + - + diff --git a/PEIS/Model/ReportModel.cs b/PEIS/Model/ReportModel.cs index 94d2b10..776f2fb 100644 --- a/PEIS/Model/ReportModel.cs +++ b/PEIS/Model/ReportModel.cs @@ -198,32 +198,31 @@ namespace PEIS.Model { using (MemoryStream memoryStream = new MemoryStream(heart[0].ReportImage)) { - Image bitmap = Image.FromStream(memoryStream); - using (MemoryStream stream = new MemoryStream()) - { - bitmap.RotateFlip(RotateFlipType.Rotate270FlipNone); - bitmap.Save(stream, ImageFormat.Jpeg); - var img = stream.ToArray(); - pacs.Add(new Report { ReportImage = img }); - } - - - //using (PdfDocument pdfDocument = PdfDocument.Load(memoryStream)) + //Image bitmap = Image.FromStream(memoryStream); + //using (MemoryStream stream = new MemoryStream()) //{ - // for (int pageIndex = 0; pageIndex < pdfDocument.PageCount; pageIndex++) - // { - // using (Image bitmap = pdfDocument.Render(pageIndex, 2480, 3508, false)) - // { - // using (MemoryStream stream = new MemoryStream()) - // { - // bitmap.RotateFlip(RotateFlipType.Rotate90FlipNone); - // bitmap.Save(stream, ImageFormat.Jpeg); - // var img = stream.ToArray(); - // pacs.Add(new Report { ReportImage = img }); - // } - // } - // } + // bitmap.RotateFlip(RotateFlipType.Rotate270FlipNone); + // bitmap.Save(stream, ImageFormat.Jpeg); + // var img = stream.ToArray(); + // pacs.Add(new Report { ReportImage = img }); //} + + using (PdfDocument pdfDocument = PdfDocument.Load(memoryStream)) + { + for (int pageIndex = 0; pageIndex < pdfDocument.PageCount; pageIndex++) + { + using (Image bitmap = pdfDocument.Render(pageIndex, 2480, 3508, false)) + { + using (MemoryStream stream = new MemoryStream()) + { + bitmap.RotateFlip(RotateFlipType.Rotate270FlipNone); + bitmap.Save(stream, ImageFormat.Jpeg); + var img = stream.ToArray(); + pacs.Add(new Report { ReportImage = img }); + } + } + } + } } } diff --git a/PEIS/Utils/ReportHelper.cs b/PEIS/Utils/ReportHelper.cs index 848182f..707e310 100644 --- a/PEIS/Utils/ReportHelper.cs +++ b/PEIS/Utils/ReportHelper.cs @@ -33,37 +33,6 @@ namespace PEIS.Utils { public static class ReportHelper { - - // 逆时针旋转图片的函数 - public static Image RotateImage(Image img) - { - // 旋转角度为负90度 - float angle = -90f; - - // 计算旋转后的图像的矩形范围 - RectangleF bounds = new RectangleF(0, 0, img.Height, img.Width); - - // 创建旋转后的位图 - Bitmap rotatedImage = new Bitmap((int)bounds.Width, (int)bounds.Height); - rotatedImage.SetResolution(img.HorizontalResolution, img.VerticalResolution); - - using (Graphics g = Graphics.FromImage(rotatedImage)) - { - // 设置插值模式以改善旋转后图像的质量 - g.InterpolationMode = InterpolationMode.HighQualityBicubic; - // 设置旋转中心点 - g.TranslateTransform(rotatedImage.Width / 2, rotatedImage.Height / 2); - // 旋转角度 - g.RotateTransform(angle); - // 将旋转中心点恢复到原点 - g.TranslateTransform(-img.Width / 2, -img.Height / 2); - // 绘制旋转后的图片 - g.DrawImage(img, new PointF(0, 0)); - } - - return rotatedImage; - } - /// /// PDF to Image /// @@ -73,11 +42,11 @@ namespace PEIS.Utils { try { - // 德宏中医院 ECG 心电保存的结果为图片JPG 不是PDF - using (var ms = new MemoryStream(pdf, 0, pdf.Length)) - { - return Image.FromStream(ms, true); - } + //// 德宏中医院 ECG 心电保存的结果为图片JPG 不是PDF + //using (var ms = new MemoryStream(pdf, 0, pdf.Length)) + //{ + // return Image.FromStream(ms, true); + //} using (var memoryStream = new MemoryStream(pdf)) { using (var pdfDocument = PdfiumViewer.PdfDocument.Load(memoryStream)) @@ -88,7 +57,6 @@ namespace PEIS.Utils { using (var stream = new MemoryStream()) { - bitmap.RotateFlip(RotateFlipType.Rotate90FlipNone); bitmap.Save(stream, ImageFormat.Jpeg); var img = stream.ToArray(); diff --git a/PEIS/View/Exam/PartForm.cs b/PEIS/View/Exam/PartForm.cs index ced17cd..f245698 100644 --- a/PEIS/View/Exam/PartForm.cs +++ b/PEIS/View/Exam/PartForm.cs @@ -845,7 +845,7 @@ namespace PEIS.View.Exam } //检验/检查科室 自动保存 - if (false) // IsAutoSaveSummary // 停用自动保存 + if (IsAutoSaveSummary) // IsAutoSaveSummary // 停用自动保存 { // 检验/检查科室,未审核且未弃检,自动保存结果,自动生成小结和结论 if (_patient.ID <= 0 || _patient.FinishTime != null || _examPart.VerifyTime != null || @@ -1001,8 +1001,7 @@ namespace PEIS.View.Exam var img = ReportHelper.PdfToImg(item.ReportImg); if (img != null) { - var newImg = ReportHelper.RotateImage(img); - Invoke(new Action(() => { picReportExt.Image = newImg; })); + Invoke(new Action(() => { picReportExt.Image = img; picReportExt.Dock = DockStyle.Fill; picReportExt.SizeMode = PictureBoxSizeMode.Zoom; })); } return; diff --git a/PEIS/View/Exam/TotalForm.cs b/PEIS/View/Exam/TotalForm.cs index 9924384..262e5e1 100644 --- a/PEIS/View/Exam/TotalForm.cs +++ b/PEIS/View/Exam/TotalForm.cs @@ -954,8 +954,7 @@ namespace PEIS.View.Exam var img = ReportHelper.PdfToImg(item.ReportImg); if (img != null) { - var newImg = ReportHelper.RotateImage(img); - Invoke(new Action(() => { PictureBoxReportExt.Image = newImg; })); + Invoke(new Action(() => { PictureBoxReportExt.Image = img; PictureBoxReportExt.Dock = DockStyle.Fill; PictureBoxReportExt.SizeMode = PictureBoxSizeMode.Zoom; })); } return;