增加下载信息的接口
parent
9cd4e272c7
commit
7c5f3323de
|
@ -214,6 +214,20 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
public int FileCount { get; set; }
|
||||
}
|
||||
|
||||
|
||||
public class SubejctZipInfoQuery
|
||||
{
|
||||
public Guid? SubejctId { get; set; }
|
||||
|
||||
public string? SubjectCode { get; set; }
|
||||
|
||||
|
||||
public Guid? SubejectVisitId { get; set; }
|
||||
|
||||
public Guid? TrialReadingCriterionId { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class TaskArchiveStudyCommand
|
||||
{
|
||||
[NotDefault]
|
||||
|
|
|
@ -4,6 +4,7 @@ using IRaCIS.Core.Application.Contracts;
|
|||
using IRaCIS.Core.Application.Filter;
|
||||
using IRaCIS.Core.Application.Helper;
|
||||
using IRaCIS.Core.Application.Service.ImageAndDoc.DTO;
|
||||
using IRaCIS.Core.Domain.Models;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using IRaCIS.Core.Infrastructure;
|
||||
using IRaCIS.Core.Infrastructure.Extention;
|
||||
|
@ -11,6 +12,7 @@ using MassTransit;
|
|||
using MathNet.Numerics;
|
||||
using Medallion.Threading;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion.Internal;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
@ -536,36 +538,134 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
|||
|
||||
|
||||
|
||||
public async Task<IResponseOutput> GetSubejectVisitPathInfo(Guid subjectVisitId)
|
||||
/// <summary>
|
||||
/// 受试者级别所有的影像
|
||||
/// 访视级别的影响 传递subjectVisitId
|
||||
/// 标准Id是可选的 不同标准有些检查可能有过滤
|
||||
/// </summary>
|
||||
/// <param name="_subjectRepository"></param>
|
||||
/// <param name="inQuery"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<IResponseOutput> GetSubejectOrVisitZipInfo([FromServices] IRepository<Subject> _subjectRepository, SubejctZipInfoQuery inQuery)
|
||||
{
|
||||
var query = from sv in _subjectVisitRepository.Where(t => t.Id == subjectVisitId)
|
||||
var isImageFilter = false;
|
||||
|
||||
select new
|
||||
{
|
||||
SubjectCode = sv.Subject.Code,
|
||||
VisitName = sv.VisitName,
|
||||
StudyList = sv.StudyList.Select(u => new
|
||||
var criterionModalitys = string.Empty;
|
||||
|
||||
if (inQuery.TrialReadingCriterionId != null)
|
||||
{
|
||||
var criterionInfo = await _repository.Where<ReadingQuestionCriterionTrial>(t => t.Id == inQuery.TrialReadingCriterionId).Select(t => new { t.IsImageFilter, t.CriterionModalitys }).FirstOrDefaultAsync();
|
||||
|
||||
if (criterionInfo != null)
|
||||
{
|
||||
isImageFilter = criterionInfo.IsImageFilter;
|
||||
criterionModalitys = criterionInfo.CriterionModalitys;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (inQuery.SubejectVisitId != null)
|
||||
{
|
||||
var query = from sv in _subjectVisitRepository.Where(t => t.Id == inQuery.SubejectVisitId)
|
||||
|
||||
|
||||
select new
|
||||
{
|
||||
u.PatientId,
|
||||
u.StudyTime,
|
||||
u.StudyCode,
|
||||
|
||||
SeriesList = u.SeriesList.Select(z => new
|
||||
SubjectCode = sv.Subject.Code,
|
||||
VisitName = sv.VisitName,
|
||||
StudyList = sv.StudyList.AsQueryable().WhereIf(isImageFilter, t => ("|" + criterionModalitys + "|").Contains("|" + t.ModalityForEdit + "|"))
|
||||
.Select(u => new
|
||||
{
|
||||
z.Modality,
|
||||
u.PatientId,
|
||||
u.StudyTime,
|
||||
u.StudyCode,
|
||||
|
||||
InstancePathList = z.DicomInstanceList.Select(k => new
|
||||
SeriesList = u.SeriesList.Select(z => new
|
||||
{
|
||||
k.Path
|
||||
z.Modality,
|
||||
|
||||
InstancePathList = z.DicomInstanceList.Select(k => new
|
||||
{
|
||||
k.Path
|
||||
})
|
||||
})
|
||||
|
||||
}),
|
||||
|
||||
NoneDicomStudyList = sv.NoneDicomStudyList.AsQueryable().WhereIf(isImageFilter, t => ("|" + criterionModalitys + "|").Contains("|" + t.Modality + "|"))
|
||||
.Select(nd => new
|
||||
{
|
||||
nd.Modality,
|
||||
nd.StudyCode,
|
||||
nd.ImageDate,
|
||||
|
||||
FileList = nd.NoneDicomFileList.Select(file => new
|
||||
{
|
||||
file.FileName,
|
||||
file.Path,
|
||||
file.FileType
|
||||
})
|
||||
})
|
||||
};
|
||||
|
||||
})
|
||||
};
|
||||
var result = query.ToList();
|
||||
|
||||
return ResponseOutput.Ok(result);
|
||||
}
|
||||
else if (inQuery.SubejctId != null)
|
||||
{
|
||||
var query = from sv in _subjectRepository.Where(t => t.Id == inQuery.SubejctId).SelectMany(t=>t.SubjectVisitList)
|
||||
|
||||
|
||||
select new
|
||||
{
|
||||
SubjectCode = sv.Subject.Code,
|
||||
VisitName = sv.VisitName,
|
||||
StudyList = sv.StudyList.AsQueryable().WhereIf(isImageFilter, t => ("|" + criterionModalitys + "|").Contains("|" + t.ModalityForEdit + "|"))
|
||||
.Select(u => new
|
||||
{
|
||||
u.PatientId,
|
||||
u.StudyTime,
|
||||
u.StudyCode,
|
||||
|
||||
SeriesList = u.SeriesList.Select(z => new
|
||||
{
|
||||
z.Modality,
|
||||
|
||||
InstancePathList = z.DicomInstanceList.Select(k => new
|
||||
{
|
||||
k.Path
|
||||
})
|
||||
})
|
||||
|
||||
}),
|
||||
|
||||
NoneDicomStudyList = sv.NoneDicomStudyList.AsQueryable().WhereIf(isImageFilter, t => ("|" + criterionModalitys + "|").Contains("|" + t.Modality + "|"))
|
||||
.Select(nd => new
|
||||
{
|
||||
nd.Modality,
|
||||
nd.StudyCode,
|
||||
nd.ImageDate,
|
||||
|
||||
FileList = nd.NoneDicomFileList.Select(file => new
|
||||
{
|
||||
file.FileName,
|
||||
file.Path,
|
||||
file.FileType
|
||||
})
|
||||
})
|
||||
};
|
||||
|
||||
var result = query.ToList();
|
||||
|
||||
return ResponseOutput.Ok(result);
|
||||
}
|
||||
else
|
||||
{
|
||||
return ResponseOutput.NotOk("不允许 subjectId subjectId 都不传递");
|
||||
}
|
||||
|
||||
var info = query.FirstOrDefault();
|
||||
|
||||
return ResponseOutput.Ok(info);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -765,9 +865,9 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
|||
foreach (var file in noneDicomStudy.FileList)
|
||||
{
|
||||
string destinationPath = Path.Combine(studyNoneDicomFolderPath, Path.GetFileName(file.FileName));
|
||||
|
||||
|
||||
//下载到当前目录
|
||||
await _oSSService.DownLoadFromOSSAsync(HttpUtility.UrlDecode(file.Path) , destinationPath);
|
||||
await _oSSService.DownLoadFromOSSAsync(HttpUtility.UrlDecode(file.Path), destinationPath);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue