HIR 修改下载代码
parent
47e85ebbdf
commit
976b89e970
|
@ -82,7 +82,7 @@ namespace IRaCIS.Core.SCP.Service
|
||||||
DateTime? studyTime = dataset.GetSingleValueOrDefault(DicomTag.StudyDate, string.Empty) == string.Empty ? null : dataset.GetSingleValue<DateTime>(DicomTag.StudyDate).Add(dataset.GetSingleValueOrDefault(DicomTag.StudyTime, string.Empty) == string.Empty ? TimeSpan.Zero : dataset.GetSingleValue<DateTime>(DicomTag.StudyTime).TimeOfDay);
|
DateTime? studyTime = dataset.GetSingleValueOrDefault(DicomTag.StudyDate, string.Empty) == string.Empty ? null : dataset.GetSingleValue<DateTime>(DicomTag.StudyDate).Add(dataset.GetSingleValueOrDefault(DicomTag.StudyTime, string.Empty) == string.Empty ? TimeSpan.Zero : dataset.GetSingleValue<DateTime>(DicomTag.StudyTime).TimeOfDay);
|
||||||
|
|
||||||
//先传输了修改了患者编号的,又传输了没有修改患者编号的,导致后传输的没有修改患者编号的下面的检查为0
|
//先传输了修改了患者编号的,又传输了没有修改患者编号的,导致后传输的没有修改患者编号的下面的检查为0
|
||||||
if (findPatient == null && findStudy==null)
|
if (findPatient == null && findStudy == null)
|
||||||
{
|
{
|
||||||
isPatientNeedAdd = true;
|
isPatientNeedAdd = true;
|
||||||
|
|
||||||
|
@ -279,13 +279,14 @@ namespace IRaCIS.Core.SCP.Service
|
||||||
{
|
{
|
||||||
await _seriesRepository.AddAsync(findSerice);
|
await _seriesRepository.AddAsync(findSerice);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isInstanceNeedAdd)
|
if (isInstanceNeedAdd)
|
||||||
{
|
{
|
||||||
await _instanceRepository.AddAsync(findInstance);
|
await _instanceRepository.AddAsync(findInstance);
|
||||||
}
|
}
|
||||||
else
|
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();
|
await _studyRepository.SaveChangesAsync();
|
||||||
|
|
|
@ -18213,6 +18213,21 @@
|
||||||
<param name="isAnonymize"></param>
|
<param name="isAnonymize"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</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)">
|
<member name="M:IRaCIS.Application.Services.PatientService.GetTrialSubjectVisitDownloadList(IRaCIS.Application.Contracts.VisitImageDownloadQuery)">
|
||||||
<summary>
|
<summary>
|
||||||
访视影像下载记录表
|
访视影像下载记录表
|
||||||
|
|
|
@ -838,9 +838,9 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||||
lesionImage.Add(new Dictionary<string, object>()
|
lesionImage.Add(new Dictionary<string, object>()
|
||||||
{
|
{
|
||||||
{ "ImageOneMark",getPicNum(true)+ picRowinfo[2*i].VisitTask.TaskName+" "+picRowinfo[2*i].RowMark},
|
{ "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) },
|
{ "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) },
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -271,7 +271,7 @@ namespace IRaCIS.Application.Services
|
||||||
|
|
||||||
var caheInfo = new TrialCacheInfo() { TrialId = trial.Id, TrialStatusStr = trial.TrialStatusStr, CriterionTypes = trial.CriterionTypes, AuthorizationEncrypt = trial.AuthorizationEncrypt, AuthorizationDate = trial.AuthorizationDate, CreateUserId = trial.CreateUserId, TrialCode = trial.TrialCode };
|
var caheInfo = new TrialCacheInfo() { TrialId = trial.Id, TrialStatusStr = trial.TrialStatusStr, CriterionTypes = trial.CriterionTypes, AuthorizationEncrypt = trial.AuthorizationEncrypt, AuthorizationDate = trial.AuthorizationDate, CreateUserId = trial.CreateUserId, TrialCode = trial.TrialCode };
|
||||||
|
|
||||||
await _provider.SetAsync(trial.Id.ToString(),caheInfo, TimeSpan.FromDays(7));
|
await _provider.SetAsync(trial.Id.ToString(), caheInfo, TimeSpan.FromDays(7));
|
||||||
|
|
||||||
return ResponseOutput.Ok(trial);
|
return ResponseOutput.Ok(trial);
|
||||||
}
|
}
|
||||||
|
@ -736,7 +736,7 @@ namespace IRaCIS.Application.Services
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var study = await _studyRepository.FirstOrDefaultAsync(t=>t.Id== scpStudyId);
|
var study = await _studyRepository.FirstOrDefaultAsync(t => t.Id == scpStudyId);
|
||||||
|
|
||||||
return ResponseOutput.Ok(seriesList, study);
|
return ResponseOutput.Ok(seriesList, study);
|
||||||
}
|
}
|
||||||
|
@ -899,7 +899,7 @@ namespace IRaCIS.Application.Services
|
||||||
.WhereIf(inQuery.Status != null, t => t.Status == inQuery.Status)
|
.WhereIf(inQuery.Status != null, t => t.Status == inQuery.Status)
|
||||||
.ProjectTo<PatienSubejctView>(_mapper.ConfigurationProvider);
|
.ProjectTo<PatienSubejctView>(_mapper.ConfigurationProvider);
|
||||||
|
|
||||||
var pageList = await subjectQuery.ToPagedListAsync(inQuery, nameof(PatienSubejctView.Code) );
|
var pageList = await subjectQuery.ToPagedListAsync(inQuery, nameof(PatienSubejctView.Code));
|
||||||
|
|
||||||
|
|
||||||
return ResponseOutput.Ok(pageList);
|
return ResponseOutput.Ok(pageList);
|
||||||
|
@ -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>
|
||||||
/// 访视影像下载记录表
|
/// 访视影像下载记录表
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -16,11 +16,9 @@ namespace IRaCIS.Core.Domain.Models
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
[Required]
|
|
||||||
public string IP { get; set; }
|
public string IP { get; set; }
|
||||||
|
|
||||||
|
|
||||||
[Required]
|
|
||||||
public Guid SubjectVisitId { get; set; }
|
public Guid SubjectVisitId { get; set; }
|
||||||
|
|
||||||
[ForeignKey("SubjectVisitId")]
|
[ForeignKey("SubjectVisitId")]
|
||||||
|
@ -28,6 +26,15 @@ namespace IRaCIS.Core.Domain.Models
|
||||||
public SubjectVisit SubjectVisit { get; set; }
|
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")
|
b.Property<Guid>("CreateUserId")
|
||||||
.HasColumnType("uniqueidentifier");
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("DownloadEndTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<DateTime>("DownloadStartTime")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
b.Property<string>("IP")
|
b.Property<string>("IP")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasMaxLength(400)
|
.HasMaxLength(400)
|
||||||
.HasColumnType("nvarchar(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")
|
b.Property<Guid>("SubjectVisitId")
|
||||||
.HasColumnType("uniqueidentifier");
|
.HasColumnType("uniqueidentifier");
|
||||||
|
|
||||||
|
@ -16044,6 +16059,7 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
||||||
b.HasOne("IRaCIS.Core.Domain.Models.SCPStudy", "SCPStudy")
|
b.HasOne("IRaCIS.Core.Domain.Models.SCPStudy", "SCPStudy")
|
||||||
.WithMany("InstanceList")
|
.WithMany("InstanceList")
|
||||||
.HasForeignKey("StudyId")
|
.HasForeignKey("StudyId")
|
||||||
|
.HasPrincipalKey("Id")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
|
@ -16139,6 +16155,7 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
||||||
b.HasOne("IRaCIS.Core.Domain.Models.SCPStudy", "SCPStudy")
|
b.HasOne("IRaCIS.Core.Domain.Models.SCPStudy", "SCPStudy")
|
||||||
.WithMany("SCPStudySubjectVisitList")
|
.WithMany("SCPStudySubjectVisitList")
|
||||||
.HasForeignKey("SCPStudyId")
|
.HasForeignKey("SCPStudyId")
|
||||||
|
.HasPrincipalKey("Id")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue