HIR 修改下载代码
parent
47e85ebbdf
commit
976b89e970
|
@ -279,13 +279,14 @@ namespace IRaCIS.Core.SCP.Service
|
|||
{
|
||||
await _seriesRepository.AddAsync(findSerice);
|
||||
}
|
||||
|
||||
if (isInstanceNeedAdd)
|
||||
{
|
||||
await _instanceRepository.AddAsync(findInstance);
|
||||
}
|
||||
else
|
||||
{
|
||||
await _instanceRepository.BatchUpdateNoTrackingAsync(t => t.Id == instanceId, u => new SCPInstance() { Path = fileRelativePath });
|
||||
await _instanceRepository.BatchUpdateNoTrackingAsync(t => t.Id == instanceId, u => new SCPInstance() { Path = fileRelativePath, FileSize = fileSize });
|
||||
}
|
||||
|
||||
await _studyRepository.SaveChangesAsync();
|
||||
|
|
|
@ -18213,6 +18213,21 @@
|
|||
<param name="isAnonymize"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Application.Services.PatientService.GetDownloadSubjectVisitStudyInfo(System.Guid,System.Guid)">
|
||||
<summary>
|
||||
获取下载的访视检查信息
|
||||
</summary>
|
||||
<param name="trialId"></param>
|
||||
<param name="subjectVisitId"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Application.Services.PatientService.DownloadImageSuccess(System.Guid)">
|
||||
<summary>
|
||||
影像下载成功回调
|
||||
</summary>
|
||||
<param name="trialImageDownloadId"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Application.Services.PatientService.GetTrialSubjectVisitDownloadList(IRaCIS.Application.Contracts.VisitImageDownloadQuery)">
|
||||
<summary>
|
||||
访视影像下载记录表
|
||||
|
|
|
@ -838,9 +838,9 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
lesionImage.Add(new Dictionary<string, object>()
|
||||
{
|
||||
{ "ImageOneMark",getPicNum(true)+ picRowinfo[2*i].VisitTask.TaskName+" "+picRowinfo[2*i].RowMark},
|
||||
{ "ImageOneUrl" ,await GetWordPictureMaxWL(_options.CurrentValue.MinIO.viewEndpoint+picRowinfo[2*i].PicturePath ,System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $@"wwwroot/ReadReoprtTemplate/downLoad/{DownLoadGuid}"),290,390) },
|
||||
{ "ImageOneUrl" ,await GetWordPictureMaxWL(_options.CurrentValue.MinIO.ViewEndpoint+picRowinfo[2*i].PicturePath ,System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $@"wwwroot/ReadReoprtTemplate/downLoad/{DownLoadGuid}"),290,390) },
|
||||
{ "ImageTwoMark",getPicNum(picCount>2*i+1) + (picCount<=2*i+1?string.Empty:picRowinfo[2*i+1].VisitTask.TaskName+" "+picRowinfo[2*i+1].RowMark) },
|
||||
{ "ImageTwoUrl", picCount<=2*i+1?string.Empty:await GetWordPictureMaxWL(_options.CurrentValue.MinIO.viewEndpoint+picRowinfo[2*i+1].PicturePath ,System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $@"wwwroot/ReadReoprtTemplate/downLoad/{DownLoadGuid}"),290, 390) },
|
||||
{ "ImageTwoUrl", picCount<=2*i+1?string.Empty:await GetWordPictureMaxWL(_options.CurrentValue.MinIO.ViewEndpoint+picRowinfo[2*i+1].PicturePath ,System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $@"wwwroot/ReadReoprtTemplate/downLoad/{DownLoadGuid}"),290, 390) },
|
||||
|
||||
});
|
||||
}
|
||||
|
|
|
@ -2742,6 +2742,77 @@ namespace IRaCIS.Application.Services
|
|||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取下载的访视检查信息
|
||||
/// </summary>
|
||||
/// <param name="trialId"></param>
|
||||
/// <param name="subjectVisitId"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<IResponseOutput> GetDownloadSubjectVisitStudyInfo(Guid trialId, Guid subjectVisitId)
|
||||
{
|
||||
var query = from sv in _subjectVisitRepository.Where(t => t.Id == subjectVisitId)
|
||||
|
||||
select new
|
||||
{
|
||||
TrialId = sv.TrialId,
|
||||
SubjectId = sv.SubjectId,
|
||||
SubjectCode = sv.Subject.Code,
|
||||
TrialSiteCode = sv.TrialSite.TrialSiteCode,
|
||||
VisitName = sv.VisitName,
|
||||
|
||||
StudyList = sv.StudyList
|
||||
|
||||
.Select(u => new
|
||||
{
|
||||
u.PatientId,
|
||||
u.StudyTime,
|
||||
u.StudyCode,
|
||||
|
||||
SeriesList = u.SeriesList.Select(z => new
|
||||
{
|
||||
z.Modality,
|
||||
|
||||
InstanceList = z.DicomInstanceList.Select(k => new
|
||||
{
|
||||
k.Path,
|
||||
k.FileSize
|
||||
})
|
||||
})
|
||||
|
||||
}).ToList(),
|
||||
|
||||
|
||||
};
|
||||
|
||||
var result = query.FirstOrDefault();
|
||||
|
||||
var preDownloadInfo = new SubejctVisitDownload()
|
||||
{
|
||||
Id = NewId.NextSequentialGuid(),
|
||||
IP = _userInfo.IP,
|
||||
SubjectVisitId = subjectVisitId,
|
||||
DownloadStartTime = DateTime.Now,
|
||||
ImageCount = result.StudyList.Sum(s => s.SeriesList.Sum(s => s.InstanceList.Count())),
|
||||
ImageSize = result.StudyList.Sum(t => t.SeriesList.Sum(s => s.InstanceList.Sum(i => i.FileSize)))?? 0
|
||||
};
|
||||
|
||||
await _subejctVisitDownloadRepository.AddAsync(preDownloadInfo, true);
|
||||
|
||||
return ResponseOutput.Ok(result, preDownloadInfo.Id);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 影像下载成功回调
|
||||
/// </summary>
|
||||
/// <param name="trialImageDownloadId"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<IResponseOutput> DownloadImageSuccess(Guid trialImageDownloadId)
|
||||
{
|
||||
await _subejctVisitDownloadRepository.UpdatePartialFromQueryAsync(t => t.Id == trialImageDownloadId, u => new SubejctVisitDownload()
|
||||
{ DownloadEndTime = DateTime.Now, IsSuccess = true }, true);
|
||||
return ResponseOutput.Ok();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 访视影像下载记录表
|
||||
/// </summary>
|
||||
|
|
|
@ -16,11 +16,9 @@ namespace IRaCIS.Core.Domain.Models
|
|||
{
|
||||
|
||||
|
||||
[Required]
|
||||
public string IP { get; set; }
|
||||
|
||||
|
||||
[Required]
|
||||
public Guid SubjectVisitId { get; set; }
|
||||
|
||||
[ForeignKey("SubjectVisitId")]
|
||||
|
@ -28,6 +26,15 @@ namespace IRaCIS.Core.Domain.Models
|
|||
public SubjectVisit SubjectVisit { get; set; }
|
||||
|
||||
|
||||
|
||||
public bool IsSuccess { get; set; }
|
||||
|
||||
public DateTime DownloadStartTime { get; set; }
|
||||
public DateTime? DownloadEndTime { get; set; }
|
||||
|
||||
public int ImageCount { get; set; }
|
||||
public long ImageSize { get; set; }
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
18661
IRaCIS.Core.Infra.EFCore/Migrations/20241114064649_ImageDown.Designer.cs
generated
Normal file
18661
IRaCIS.Core.Infra.EFCore/Migrations/20241114064649_ImageDown.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,121 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace IRaCIS.Core.Infra.EFCore.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class ImageDown : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_SCPInstance_SCPStudy_StudyId",
|
||||
table: "SCPInstance");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_SCPStudySubjectVisit_SCPStudy_SCPStudyId",
|
||||
table: "SCPStudySubjectVisit");
|
||||
|
||||
migrationBuilder.AddColumn<DateTime>(
|
||||
name: "DownloadEndTime",
|
||||
table: "SubejctVisitDownload",
|
||||
type: "datetime2",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<DateTime>(
|
||||
name: "DownloadStartTime",
|
||||
table: "SubejctVisitDownload",
|
||||
type: "datetime2",
|
||||
nullable: false,
|
||||
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "ImageCount",
|
||||
table: "SubejctVisitDownload",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<long>(
|
||||
name: "ImageSize",
|
||||
table: "SubejctVisitDownload",
|
||||
type: "bigint",
|
||||
nullable: false,
|
||||
defaultValue: 0L);
|
||||
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "IsSuccess",
|
||||
table: "SubejctVisitDownload",
|
||||
type: "bit",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_SCPInstance_SCPStudy_StudyId",
|
||||
table: "SCPInstance",
|
||||
column: "StudyId",
|
||||
principalTable: "SCPStudy",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_SCPStudySubjectVisit_SCPStudy_SCPStudyId",
|
||||
table: "SCPStudySubjectVisit",
|
||||
column: "SCPStudyId",
|
||||
principalTable: "SCPStudy",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_SCPInstance_SCPStudy_StudyId",
|
||||
table: "SCPInstance");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_SCPStudySubjectVisit_SCPStudy_SCPStudyId",
|
||||
table: "SCPStudySubjectVisit");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "DownloadEndTime",
|
||||
table: "SubejctVisitDownload");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "DownloadStartTime",
|
||||
table: "SubejctVisitDownload");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ImageCount",
|
||||
table: "SubejctVisitDownload");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ImageSize",
|
||||
table: "SubejctVisitDownload");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "IsSuccess",
|
||||
table: "SubejctVisitDownload");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_SCPInstance_SCPStudy_StudyId",
|
||||
table: "SCPInstance",
|
||||
column: "StudyId",
|
||||
principalTable: "SCPStudy",
|
||||
principalColumn: "SeqId",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_SCPStudySubjectVisit_SCPStudy_SCPStudyId",
|
||||
table: "SCPStudySubjectVisit",
|
||||
column: "SCPStudyId",
|
||||
principalTable: "SCPStudy",
|
||||
principalColumn: "SeqId",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -8102,11 +8102,26 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
|||
b.Property<Guid>("CreateUserId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<DateTime?>("DownloadEndTime")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime>("DownloadStartTime")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("IP")
|
||||
.IsRequired()
|
||||
.HasMaxLength(400)
|
||||
.HasColumnType("nvarchar(400)");
|
||||
|
||||
b.Property<int>("ImageCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<long>("ImageSize")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<bool>("IsSuccess")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<Guid>("SubjectVisitId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
|
@ -16044,6 +16059,7 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
|||
b.HasOne("IRaCIS.Core.Domain.Models.SCPStudy", "SCPStudy")
|
||||
.WithMany("InstanceList")
|
||||
.HasForeignKey("StudyId")
|
||||
.HasPrincipalKey("Id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
|
@ -16139,6 +16155,7 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
|||
b.HasOne("IRaCIS.Core.Domain.Models.SCPStudy", "SCPStudy")
|
||||
.WithMany("SCPStudySubjectVisitList")
|
||||
.HasForeignKey("SCPStudyId")
|
||||
.HasPrincipalKey("Id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
|
|
Loading…
Reference in New Issue