提交后发布事件
parent
80d78cb989
commit
1e9efd6d40
|
|
@ -24,7 +24,7 @@
|
||||||
},
|
},
|
||||||
"ObjectStoreService": {
|
"ObjectStoreService": {
|
||||||
"ObjectStoreUse": "AliyunOSS",
|
"ObjectStoreUse": "AliyunOSS",
|
||||||
"IsOpenStoreSync": true,
|
"IsOpenStoreSync": false,
|
||||||
"ApiDeployRegion": "CN",
|
"ApiDeployRegion": "CN",
|
||||||
"SyncConfigList": [
|
"SyncConfigList": [
|
||||||
{
|
{
|
||||||
|
|
@ -41,7 +41,7 @@
|
||||||
"Target": "AliyunOSS",
|
"Target": "AliyunOSS",
|
||||||
"UploadRegion": "US",
|
"UploadRegion": "US",
|
||||||
"TargetRegion": "CN",
|
"TargetRegion": "CN",
|
||||||
"IsOpenSync": true
|
"IsOpenSync": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"AliyunOSS": {
|
"AliyunOSS": {
|
||||||
|
|
|
||||||
|
|
@ -391,9 +391,9 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
var addEntity = await _studyMonitorRepository.AddAsync(studyMonitor, true);
|
//var addEntity = await _studyMonitorRepository.AddAsync(studyMonitor, true);
|
||||||
|
|
||||||
return ResponseOutput.Ok(addEntity.Id);
|
return ResponseOutput.Ok(Guid.NewGuid());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -580,25 +580,25 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||||
var trialId = incommand.TrialId;
|
var trialId = incommand.TrialId;
|
||||||
|
|
||||||
|
|
||||||
var studyMonitor = await _studyMonitorRepository.FirstOrDefaultAsync(t => t.Id == incommand.StudyMonitorId);
|
//var studyMonitor = await _studyMonitorRepository.FirstOrDefaultAsync(t => t.Id == incommand.StudyMonitorId);
|
||||||
studyMonitor.UploadFinishedTime = DateTime.Now;
|
//studyMonitor.UploadFinishedTime = DateTime.Now;
|
||||||
studyMonitor.ArchiveFinishedTime = DateTime.Now;
|
//studyMonitor.ArchiveFinishedTime = DateTime.Now;
|
||||||
studyMonitor.FailedFileCount = incommand.FailedFileCount;
|
//studyMonitor.FailedFileCount = incommand.FailedFileCount;
|
||||||
studyMonitor.IsSuccess = incommand.FailedFileCount == 0;
|
//studyMonitor.IsSuccess = incommand.FailedFileCount == 0;
|
||||||
studyMonitor.RecordPath = incommand.RecordPath;
|
//studyMonitor.RecordPath = incommand.RecordPath;
|
||||||
studyMonitor.FileSize = incommand.Study.SeriesList.SelectMany(t => t.InstanceList).Sum(t => t.FileSize);
|
//studyMonitor.FileSize = incommand.Study.SeriesList.SelectMany(t => t.InstanceList).Sum(t => t.FileSize);
|
||||||
|
|
||||||
var studyId = IdentifierHelper.CreateGuid(incommand.Study.StudyInstanceUid, incommand.TrialId.ToString(), visiTaskId.ToString());
|
var studyId = IdentifierHelper.CreateGuid(incommand.Study.StudyInstanceUid, incommand.TrialId.ToString(), visiTaskId.ToString());
|
||||||
var findStudy = await _taskStudyRepository.FirstOrDefaultAsync(t => t.Id == studyId);
|
var findStudy = await _taskStudyRepository.FirstOrDefaultAsync(t => t.Id == studyId);
|
||||||
|
|
||||||
|
|
||||||
studyMonitor.StudyId = studyId;
|
//studyMonitor.StudyId = studyId;
|
||||||
studyMonitor.StudyCode = findStudy?.StudyCode ?? "";
|
//studyMonitor.StudyCode = findStudy?.StudyCode ?? "";
|
||||||
|
|
||||||
studyMonitor.IsDicomReUpload = findStudy != null;
|
//studyMonitor.IsDicomReUpload = findStudy != null;
|
||||||
|
|
||||||
//上传
|
//上传
|
||||||
if (studyMonitor.IsDicomReUpload == false)
|
if (findStudy == null)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -640,7 +640,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||||
await _taskStudyRepository.AddAsync(study);
|
await _taskStudyRepository.AddAsync(study);
|
||||||
|
|
||||||
|
|
||||||
studyMonitor.StudyCode = study.StudyCode;
|
//studyMonitor.StudyCode = study.StudyCode;
|
||||||
|
|
||||||
|
|
||||||
foreach (var seriesItem in incommand.Study.SeriesList)
|
foreach (var seriesItem in incommand.Study.SeriesList)
|
||||||
|
|
@ -689,9 +689,9 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//重传的时候也要赋值检查Id
|
////重传的时候也要赋值检查Id
|
||||||
studyMonitor.StudyId = findStudy.Id;
|
//studyMonitor.StudyId = findStudy.Id;
|
||||||
studyMonitor.StudyCode = findStudy.StudyCode;
|
//studyMonitor.StudyCode = findStudy.StudyCode;
|
||||||
|
|
||||||
//特殊处理逻辑
|
//特殊处理逻辑
|
||||||
findStudy.Modalities = string.Join("、", incommand.Study.SeriesList.Select(t => t.Modality).Union(findStudy.Modalities.Split("、", StringSplitOptions.RemoveEmptyEntries)).Distinct());
|
findStudy.Modalities = string.Join("、", incommand.Study.SeriesList.Select(t => t.Modality).Union(findStudy.Modalities.Split("、", StringSplitOptions.RemoveEmptyEntries)).Distinct());
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using FellowOakDicom;
|
using DocumentFormat.OpenXml.InkML;
|
||||||
|
using FellowOakDicom;
|
||||||
using FellowOakDicom.Imaging;
|
using FellowOakDicom.Imaging;
|
||||||
using FellowOakDicom.IO.Buffer;
|
using FellowOakDicom.IO.Buffer;
|
||||||
using IRaCIS.Core.Application.Contracts;
|
using IRaCIS.Core.Application.Contracts;
|
||||||
|
|
@ -67,6 +68,80 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class DeleteImagePathCommand
|
||||||
|
{
|
||||||
|
public string Path { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IResponseOutput> DeleteImageCache(DeleteImagePathCommand incommand)
|
||||||
|
{
|
||||||
|
await _oSSService.DeleteFromPrefix(incommand.Path, true);
|
||||||
|
|
||||||
|
return ResponseOutput.Ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IResponseOutput> GetAnonymizeInfo(Guid visitTaskId, Guid? subjectVisitId)
|
||||||
|
{
|
||||||
|
|
||||||
|
Guid svId = Guid.Empty;
|
||||||
|
|
||||||
|
if (subjectVisitId != null)
|
||||||
|
{
|
||||||
|
svId = subjectVisitId.Value;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
svId = (Guid)_visitTaskRepository.Where(t => t.Id == visitTaskId).Select(t => t.SourceSubjectVisitId).FirstOrDefault();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// 写入dicom 固定的信息,以及组织路径的信息 以及匿名化的信息
|
||||||
|
var otherData = GetSaveToDicomInfo(svId);
|
||||||
|
|
||||||
|
var anonymizeList = _fusionCache.GetOrSetAsync(CacheKeys.SystemAnonymization, _ => CacheHelper.GetSystemAnonymizationListAsync(_systemAnonymizationRepository), TimeSpan.FromDays(7)).Result;
|
||||||
|
|
||||||
|
return ResponseOutput.Ok(new
|
||||||
|
{
|
||||||
|
DicomStoreInfo = otherData,
|
||||||
|
AnonymizeFixedList = anonymizeList.Where(t => t.IsFixed).ToList(),
|
||||||
|
AnonymizeNotFixedList = anonymizeList.Where(t => t.IsFixed == false).ToList()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IResponseOutput> UpdateModality(Guid seriesId, string modality, bool isCRCReplace,
|
||||||
|
[FromServices] IRepository<TaskSeries> _taskSeriesRepository,
|
||||||
|
[FromServices] IRepository<TaskStudy> _taskStudyRepository
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (isCRCReplace)
|
||||||
|
{
|
||||||
|
await _dicomSeriesRepository.BatchUpdateNoTrackingAsync(t => t.Id == seriesId, u => new DicomSeries() { Modality = modality });
|
||||||
|
|
||||||
|
var studyId = _dicomSeriesRepository.Where(t => t.Id == seriesId).Select(t => t.StudyId).FirstOrDefault();
|
||||||
|
|
||||||
|
//处理Modality
|
||||||
|
var seriesModalityList = _dicomStudyRepository.Where(t => t.Id == studyId).SelectMany(u => u.SeriesList.Select(t => t.Modality)).Distinct();
|
||||||
|
string ModaliyStr = string.Join('、', seriesModalityList.ToList());
|
||||||
|
|
||||||
|
await _dicomStudyRepository.BatchUpdateNoTrackingAsync(t => t.Id == studyId, u => new DicomStudy() { Modalities = ModaliyStr });
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
await _taskSeriesRepository.BatchUpdateNoTrackingAsync(t => t.Id == seriesId, u => new TaskSeries() { Modality = modality });
|
||||||
|
|
||||||
|
|
||||||
|
var studyId = _taskSeriesRepository.Where(t => t.Id == seriesId).Select(t => t.StudyId).FirstOrDefault();
|
||||||
|
|
||||||
|
//处理Modality
|
||||||
|
var seriesModalityList = _taskStudyRepository.Where(t => t.Id == studyId).SelectMany(u => u.SeriesList.Select(t => t.Modality)).Distinct();
|
||||||
|
string ModaliyStr = string.Join('、', seriesModalityList.ToList());
|
||||||
|
|
||||||
|
await _taskStudyRepository.BatchUpdateNoTrackingAsync(t => t.Id == studyId, u => new TaskStudy() { Modalities = ModaliyStr });
|
||||||
|
|
||||||
|
}
|
||||||
|
return ResponseOutput.Ok();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private static async Task<bool> TryWriteMergedDicomAsync(Func<Task<Stream>> sourceFactory, Stream output)
|
private static async Task<bool> TryWriteMergedDicomAsync(Func<Task<Stream>> sourceFactory, Stream output)
|
||||||
{
|
{
|
||||||
|
|
@ -832,7 +907,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||||
{
|
{
|
||||||
//更新,需要删除缓存,并更新路径
|
//更新,需要删除缓存,并更新路径
|
||||||
|
|
||||||
await _oSSService.DeleteFromPrefix(insntance.Path,true);
|
await _oSSService.DeleteFromPrefix(insntance.Path, true);
|
||||||
|
|
||||||
await _dicomInstanceRepository.BatchUpdateNoTrackingAsync(t => t.Id == insntance.Id, u => new DicomInstance() { Path = insntance.Path });
|
await _dicomInstanceRepository.BatchUpdateNoTrackingAsync(t => t.Id == insntance.Id, u => new DicomInstance() { Path = insntance.Path });
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue