1、心电图改为PDF读取,角度调整,2、自动保存开启

msfy
lsm 10 months ago
parent 1d9f4a5305
commit f2a858d3d7
  1. 8
      PEIS/App.config
  2. 47
      PEIS/Model/ReportModel.cs
  3. 42
      PEIS/Utils/ReportHelper.cs
  4. 5
      PEIS/View/Exam/PartForm.cs
  5. 3
      PEIS/View/Exam/TotalForm.cs

@ -6,8 +6,8 @@
<appSettings>
<!-- <add value="1.0.3" key="Version"/> -->
<!-- <add value="http://200.200.200.71:5200/version/download" key="DownloadUrl"/> -->
<add value="0513" key="UserCode"/>
<add value="赵翠回" key="UserName"/>
<add value="0465" key="UserCode"/>
<add value="李信富" key="UserName"/>
</appSettings>
<connectionStrings>
@ -15,13 +15,13 @@
<!-- <add name="ConnString" connectionString="10C598E364BCAFCF71617738597417B368D095FA1A37D76CC4755C411E5B6E792E0D4950863434F9B242AA9F134426A2922569235322E2342030D4AE0170168D8F1BC9B44D56F367DE9614CDCCBB6CDAEF20B4992B3758AD9FF39A400D08CC48"/> -->
<!-- 德宏州中医院 peisdb-->
<add name="ConnString" connectionString="10C598E364BCAFCF71617738597417B368D095FA1A37D76CC4755C411E5B6E792E0D4950863434F9B242AA9F134426A27810AC34D6EDC4F6ABFC4BE6027BB990824DB7092BFDA15709314FEBC2C3C9E312752DFBDF33BC1BF3C0FC84EAA83A4F"/>
<!--<add name="ConnString" connectionString="10C598E364BCAFCF71617738597417B368D095FA1A37D76CC4755C411E5B6E792E0D4950863434F9B242AA9F134426A27810AC34D6EDC4F6ABFC4BE6027BB990824DB7092BFDA15709314FEBC2C3C9E312752DFBDF33BC1BF3C0FC84EAA83A4F"/>-->
<!-- 192.168.12.188 -->
<!--<add name="ConnString" connectionString="10C598E364BCAFCFDC6960B18CB026C75BD46245729DFD1D3D78E221B3E0300765B697A8C044694AA8A0575480464D83E79206ED689FE4A1CE0C479D02BC880B7FDEDDC464EE6B74BDB082FD5B1B9EFC"/>-->
<!-- 盈江妇幼YJFY -->
<!--<add name="ConnString" connectionString="10C598E364BCAFCF5A016EA6C7463FAC7D75379F63924F4F82C1749BDA88D9414EC0303E1ECC3E76895E07FCFC13332D1D79643A2AD3AA60507FD3EAF9A41761B30F4FDE900F983F1FE6ED6F0245E5BF8BFCFC5F0A2C03E4"/>-->
<!-- 芒市妇幼MSFY -->
<!-- <add name="ConnString" connectionString="10C598E364BCAFCFDC6960B18CB026C71974C5748654F280FDC48E754851202242B4E7B1AA07112A874114ABFCB682AC3D64541EBBF807FEB54E514CC3815F4A0521AC62245D6E0B29E34ADCAE07492C51045002E903C53C8DC45FF6FC4A547A"/> -->
<add name="ConnString" connectionString="10C598E364BCAFCFDC6960B18CB026C71974C5748654F280FDC48E754851202242B4E7B1AA07112A874114ABFCB682AC3D64541EBBF807FEB54E514CC3815F4A0521AC62245D6E0B29E34ADCAE07492C51045002E903C53C8DC45FF6FC4A547A"/>
</connectionStrings>
<entityFramework>

@ -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 });
}
}
}
}
}
}

@ -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;
}
/// <summary>
/// PDF to Image
/// </summary>
@ -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();

@ -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;

@ -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;

Loading…
Cancel
Save