Browse Source

导入结果

bjmzak
DESKTOP-G961P6V\Zhh 1 year ago
parent
commit
4c107df136
  1. 20
      ThirdPlugIns/Shentun.Peis.PlugIns.Gem/ImportPacsResultPlugInsGem.cs
  2. 3
      src/Shentun.ColumnReferencePlugIns/ImportPacsResultPlugInsBase.cs
  3. 1
      src/Shentun.Peis.Application.Contracts/ImportPacsResults/CreateImportPacsResultDto.cs
  4. 35
      src/Shentun.Peis.Application/ImportPacsResults/ImportPacsResultAppService.cs
  5. 14
      test/Shentun.Peis.Application.Tests/ImportPacsResultAppServiceTest.cs
  6. 13
      test/Shentun.Peis.ColumnReference.Tests/ImportLisResultPlugInsTest.cs

20
ThirdPlugIns/Shentun.Peis.PlugIns.Gem/ImportPacsResultPlugInsGem.cs

@ -9,6 +9,7 @@ using System.Threading.Tasks;
using Shentun.Peis.ImportPacsResults;
using NPOI.SS.Formula.Functions;
using Shentun.Peis.ImportLisResults;
using System.Security.Policy;
namespace Shentun.Peis.PlugIns.Gem
{
@ -29,6 +30,10 @@ namespace Shentun.Peis.PlugIns.Gem
var beginTime = DateTime.Now.Date.AddDays(-30);
foreach (var pacsRequest in pacsRequests)
{
if (string.IsNullOrWhiteSpace(pacsRequest.CheckRequestNo))
{
continue;
}
var interfaceInpu = new ImportPacsResultInterfaceInput()
{
tjNum = pacsRequest.CheckRequestNo,
@ -45,12 +50,12 @@ namespace Shentun.Peis.PlugIns.Gem
//}
var apiResult = await CallInterfaceServiceAsync<ImportPacsResultInterfaceInput,
ImportPacsResultInterfaceOut>(interfaceInpu);
if(!apiResult.data.Any())
if (!apiResult.data.Any())
{
continue;
}
var firstData = apiResult.data[0];
if(!DateTime.TryParse(firstData.reportDateTime,out var checkDate))
if (!DateTime.TryParse(firstData.reportDateTime, out var checkDate))
{
throw new Exception("报告时间格式不正确");
}
@ -68,12 +73,13 @@ namespace Shentun.Peis.PlugIns.Gem
new CreateImportPacsResultPictureDto()
{
IsPrint = 'Y',
FileTransMode = "0",
FileTransMode = "0",//0-json,1-url
FileName = firstData.reportUrl,
FileFormat = "1",
FileFormat = "0",//0-图片,1-pdf
FileUrl = firstData.reportUrl,
FileBase64 = Shentun.Utilities.FileHelper.ToBase64(firstData.reportUrl)
},
}
};
@ -85,7 +91,7 @@ namespace Shentun.Peis.PlugIns.Gem
}
public async Task<TOut> CallInterfaceServiceAsync<TInput, TOut>( TInput data)
public async Task<TOut> CallInterfaceServiceAsync<TInput, TOut>(TInput data)
{
string baseAddress = InterfaceWebApiUrl;
using (var httpClientHandler = new HttpClientHandler())
@ -115,7 +121,7 @@ namespace Shentun.Peis.PlugIns.Gem
dynamic resultDto = JsonConvert.DeserializeObject<TOut>(result);
if (resultDto != null)
{
if (resultDto.code!= "200")
if (resultDto.code != "200")
{
throw new Exception($"调用WebApi失败,返回错误,消息:" + resultDto.code + resultDto.msg);
}

3
src/Shentun.ColumnReferencePlugIns/ImportPacsResultPlugInsBase.cs

@ -39,7 +39,8 @@ where patient_register.id = @PatientRegisterId and
item_type.is_check_request = 'Y' and
(patient_register.complete_flag = '0' or
patient_register.complete_flag = '1' or
patient_register.complete_flag = '2')
patient_register.complete_flag = '2') and
register_check.check_request_no <> ''
";
var pacsRequestForResultImportPlugInss = (await conn.QueryAsync<PacsRequestForImportResultPlugIns>(sql,
new { PatientRegisterId = patientRegisterId })).ToList();

1
src/Shentun.Peis.Application.Contracts/ImportPacsResults/CreateImportPacsResultDto.cs

@ -80,6 +80,7 @@ namespace Shentun.Peis.ImportPacsResults
/// base64文件
/// </summary>
public string FileBase64 { get; set; }
public string FileUrl { get; set; }
public char IsPrint { get; set; }
}

35
src/Shentun.Peis.Application/ImportPacsResults/ImportPacsResultAppService.cs

@ -29,7 +29,7 @@ using Volo.Abp.Users;
namespace Shentun.Peis.ImportPacsResults
{
[ApiExplorerSettings(GroupName = "Work")]
//[Authorize]
[Authorize]
public class ImportPacsResultAppService : ApplicationService
{
private readonly IRepository<RegisterCheckItem> _registerCheckItemRepository;
@ -118,6 +118,15 @@ namespace Shentun.Peis.ImportPacsResults
[HttpPost("api/app/ImportPacsResult/ImportResult")]
public async Task ImportResultAsync(CreateImportPacsResultDto input)
{
if (input == null)
{
throw new UserFriendlyException("input参数不能为空");
}
if(string.IsNullOrWhiteSpace(input.CheckRequestNo))
{
throw new UserFriendlyException("CheckRequestNo不能为空");
}
//设置结果
var list = (from patientRegister in await _patientRegisterRepository.GetQueryableAsync()
@ -216,17 +225,35 @@ namespace Shentun.Peis.ImportPacsResults
{
fileName = Path.GetFileNameWithoutExtension(file.FileName);
}
if (file.FileTransMode == "1")
{
if(string.IsNullOrWhiteSpace(file.FileUrl))
{
throw new UserFriendlyException("文件URL不能为空");
}
if (!string.IsNullOrWhiteSpace(file.FileBase64))
{
throw new UserFriendlyException("文件Base64不能传值");
}
file.FileBase64 = Shentun.Utilities.FileHelper.ToBase64(file.FileUrl);
}
else
{
if (string.IsNullOrWhiteSpace(file.FileBase64))
{
throw new UserFriendlyException("文件Base64不能为空");
}
}
//0-图片,1-PDF
if (file.FileFormat == "0")
{
pictureUrl = ImageHelper.Base64StrToImageInAbsolutePath(absolutePath, fileName, file.FileBase64, firstEntity.patientRegister.Id.ToString(),
firstEntity.registerCheck.Id.ToString());
}
else if (file.FileFormat == "1")
{
byte[] pdfBytes = Convert.FromBase64String(file.FileBase64);
var tempFilePath = DirectoryHelper.GetAppDirectory() + "\\temp-files";
if (!Directory.Exists(tempFilePath))
@ -257,7 +284,7 @@ namespace Shentun.Peis.ImportPacsResults
if (string.IsNullOrEmpty(pictureUrl))
if (string.IsNullOrWhiteSpace(pictureUrl))
{
throw new UserFriendlyException("pictureUrl是空值");
}

14
test/Shentun.Peis.Application.Tests/ImportPacsResultAppServiceTest.cs

@ -42,19 +42,21 @@ namespace Shentun.Peis
Suggestion = "Pacs建议",
CheckDate = DateTime.Now,
CheckDoctorName = "张医生",
Files = new List<CreateImportPacsResultPictureDto>()
{
Files = new List<CreateImportPacsResultPictureDto>()
{
new CreateImportPacsResultPictureDto()
{
IsPrint = 'Y',
FileName = Guid.NewGuid().ToString(),
FileFormat = "0",
FileTransMode = "0",
FileBase64 = Shentun.Utilities.FileHelper.ToBase64("E:\\Whitedolphins\\prog20220722\\pic\\login.png")
},
new CreateImportPacsResultPictureDto()
{
IsPrint = 'Y',
FileFormat = "0",
FileTransMode = "0",
FileName = Guid.NewGuid().ToString(),
FileBase64 = Shentun.Utilities.FileHelper.ToBase64("E:\\Whitedolphins\\prog20220722\\pic\\首页背景图.jpg")
},
@ -62,9 +64,11 @@ namespace Shentun.Peis
{
IsPrint = 'Y',
FileFormat = "1",
FileTransMode = "0",
FileName = Guid.NewGuid().ToString(),
FileBase64 = Shentun.Utilities.FileHelper.ToBase64("http://10.1.13.18:8380//image/66389af146ac4b27f4da93ff/risPdf/3135.pdf")
FileTransMode = "1",
FileName = "http://10.1.13.18:8380//image/66389af146ac4b27f4da93ff/risPdf/3135.pdf",
FileUrl = "http://10.1.13.18:8380//image/66389af146ac4b27f4da93ff/risPdf/3135.pdf",
// FileBase64 = Shentun.Utilities.FileHelper.ToBase64("http://10.1.13.18:8380//image/66389af146ac4b27f4da93ff/risPdf/3135.pdf")
},
}
};

13
test/Shentun.Peis.ColumnReference.Tests/ImportLisResultPlugInsTest.cs

@ -32,6 +32,19 @@ namespace Shentun.Peis.PlugIns.Tests
});
}
[Fact]
public async Task DoWorkAsync()
{
string configParm;
string filePath = DirectoryHelper.GetAppDirectory() + "/appsettings.json";
configParm = File.ReadAllText(filePath);
var input = new ImportLisResultPlugInsDbBase(configParm);
await input.DoWork();
}
}
}
Loading…
Cancel
Save