Test.EIImageViewer
parent
505eb1b33b
commit
711fc43008
|
@ -594,8 +594,65 @@ namespace IRaCIS.Core.Application.Image.QA
|
|||
[HttpPut("{trialId:guid}/{subjectVisitId:guid}/{studyId:guid}/{seriesId:guid}/{state:int}")]
|
||||
[TypeFilter(typeof(TrialResourceFilter))]
|
||||
[Authorize(Policy = IRaCISPolicy.IQC)]
|
||||
public async Task<IResponseOutput> SetSeriesState(Guid subjectVisitId, Guid studyId, Guid seriesId, int state
|
||||
public async Task<IResponseOutput> SetSeriesState(Guid subjectVisitId, Guid studyId, Guid seriesId, int state)
|
||||
{
|
||||
|
||||
await VerifyIsCanQCAsync(null, subjectVisitId);
|
||||
|
||||
var series = (await _repository.Where<DicomSeries>(t => t.Id == seriesId, true).IgnoreQueryFilters().FirstOrDefaultAsync()).IfNullThrowException();
|
||||
|
||||
|
||||
if (state == 1)
|
||||
{
|
||||
series.IsReading = false;
|
||||
}
|
||||
else if (state == 2)
|
||||
{
|
||||
series.IsReading = true;
|
||||
}
|
||||
else if (state == 4)
|
||||
{
|
||||
series.IsDeleted = true;
|
||||
|
||||
var study = (await _repository.Where<DicomStudy>(t => t.Id == studyId, true).IgnoreQueryFilters().FirstOrDefaultAsync()).IfNullThrowException();
|
||||
|
||||
var instanceIdList = await _repository.Where<DicomInstance>(t => t.SeriesId == seriesId).Select(t => t.Id).ToListAsync();
|
||||
|
||||
//instanceIdList.ForEach(t =>
|
||||
//{
|
||||
// var path = _dicomFileStoreHelper.GetInstanceFilePath(study, seriesId, t.ToString());
|
||||
|
||||
// if (System.IO.File.Exists(path))
|
||||
// {
|
||||
// File.Delete(path);
|
||||
// }
|
||||
|
||||
//});
|
||||
|
||||
study.InstanceCount = study.InstanceCount - instanceIdList.Count;
|
||||
study.SeriesCount = study.SeriesCount - 1;
|
||||
|
||||
study.IsDeleted = study.SeriesCount == 0;
|
||||
|
||||
}
|
||||
else if (state == 5)
|
||||
{
|
||||
series.IsDeleted = false;
|
||||
|
||||
var study = (await _repository.Where<DicomStudy>(t => t.Id == studyId, true).IgnoreQueryFilters().FirstOrDefaultAsync()).IfNullThrowException();
|
||||
|
||||
|
||||
var instanceIdList = await _repository.Where<DicomInstance>(t => t.SeriesId == seriesId).Select(t => t.Id).ToListAsync();
|
||||
|
||||
study.InstanceCount = study.InstanceCount + instanceIdList.Count;
|
||||
|
||||
study.SeriesCount = study.SeriesCount + 1;
|
||||
|
||||
study.IsDeleted = study.SeriesCount == 0;
|
||||
}
|
||||
|
||||
return ResponseOutput.Ok(await _repository.SaveChangesAsync());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///type 1 :study 2: series 3:非dicom QC修改检查部位和 拍片类型
|
||||
|
|
Loading…
Reference in New Issue