|
|
|
@ -21,6 +21,7 @@ using System.IO; |
|
|
|
using System.Linq; |
|
|
|
using System.Security.Cryptography.Xml; |
|
|
|
using System.Text; |
|
|
|
using System.Threading; |
|
|
|
using System.Threading.Tasks; |
|
|
|
using Volo.Abp; |
|
|
|
using Volo.Abp.Application.Services; |
|
|
|
@ -129,7 +130,7 @@ namespace Shentun.Peis.ImportPacsResults |
|
|
|
throw new UserFriendlyException("input参数不能为空"); |
|
|
|
|
|
|
|
} |
|
|
|
if(string.IsNullOrWhiteSpace(input.CheckRequestNo)) |
|
|
|
if (string.IsNullOrWhiteSpace(input.CheckRequestNo)) |
|
|
|
{ |
|
|
|
throw new UserFriendlyException("CheckRequestNo不能为空"); |
|
|
|
} |
|
|
|
@ -206,7 +207,7 @@ namespace Shentun.Peis.ImportPacsResults |
|
|
|
string pictureUrl; |
|
|
|
foreach (var file in input.Files) |
|
|
|
{ |
|
|
|
if(string.IsNullOrWhiteSpace(file.FileTransMode)) |
|
|
|
if (string.IsNullOrWhiteSpace(file.FileTransMode)) |
|
|
|
{ |
|
|
|
throw new UserFriendlyException("文件传输模式不能为空"); |
|
|
|
} |
|
|
|
@ -214,7 +215,7 @@ namespace Shentun.Peis.ImportPacsResults |
|
|
|
{ |
|
|
|
throw new UserFriendlyException("文件格式不能为空"); |
|
|
|
} |
|
|
|
if(file.FileTransMode != "0" && file.FileTransMode != "1") |
|
|
|
if (file.FileTransMode != "0" && file.FileTransMode != "1") |
|
|
|
{ |
|
|
|
throw new UserFriendlyException("文件传输模式不正确"); |
|
|
|
} |
|
|
|
@ -233,7 +234,7 @@ namespace Shentun.Peis.ImportPacsResults |
|
|
|
} |
|
|
|
if (file.FileTransMode == "1") |
|
|
|
{ |
|
|
|
if(string.IsNullOrWhiteSpace(file.FileUrl)) |
|
|
|
if (string.IsNullOrWhiteSpace(file.FileUrl)) |
|
|
|
{ |
|
|
|
throw new UserFriendlyException("文件URL不能为空"); |
|
|
|
} |
|
|
|
@ -259,7 +260,7 @@ namespace Shentun.Peis.ImportPacsResults |
|
|
|
} |
|
|
|
else if (file.FileFormat == "1") |
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
byte[] pdfBytes = Convert.FromBase64String(file.FileBase64); |
|
|
|
var tempFilePath = DirectoryHelper.GetAppDirectory() + "\\temp-files"; |
|
|
|
if (!Directory.Exists(tempFilePath)) |
|
|
|
@ -271,16 +272,28 @@ namespace Shentun.Peis.ImportPacsResults |
|
|
|
using (System.IO.FileStream stream = new System.IO.FileStream(tempPdf, System.IO.FileMode.Create)) |
|
|
|
{ |
|
|
|
//通过流的方式写入
|
|
|
|
using(System.IO.BinaryWriter writer = new System.IO.BinaryWriter(stream) ) |
|
|
|
using (System.IO.BinaryWriter writer = new System.IO.BinaryWriter(stream)) |
|
|
|
{ |
|
|
|
writer.Write(pdfBytes, 0, pdfBytes.Length); |
|
|
|
writer.Close(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
string hostName = file.FileUrl.Replace("http://", "").Replace("https://", ""); |
|
|
|
if (hostName.IndexOf(":") > 0) |
|
|
|
{ |
|
|
|
hostName = hostName.Substring(0, hostName.IndexOf(":")); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
hostName = hostName.Substring(0, hostName.IndexOf("/")); |
|
|
|
} |
|
|
|
PDFHelper.ConvertPdfToImage(tempPdf, tempFilePath ,"tempImage"); |
|
|
|
|
|
|
|
pictureUrl = ImageHelper.SavePacsFile(absolutePath, tempFilePath + "\\tempImage_0.jpg", firstEntity.patientRegister.Id.ToString(), |
|
|
|
string tempImageName = "tempImage" + hostName; |
|
|
|
PDFHelper.ConvertPdfToImage(tempPdf, tempFilePath, tempImageName); |
|
|
|
|
|
|
|
pictureUrl = ImageHelper.SavePacsFile(absolutePath, tempFilePath + "\\" + tempImageName + "_0.jpg", firstEntity.patientRegister.Id.ToString(), |
|
|
|
firstEntity.registerCheck.Id.ToString(), fileName); |
|
|
|
} |
|
|
|
else |
|
|
|
@ -288,7 +301,7 @@ namespace Shentun.Peis.ImportPacsResults |
|
|
|
throw new UserFriendlyException("不支持的文件类型"); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(pictureUrl)) |
|
|
|
{ |
|
|
|
|