Compare commits

..

No commits in common. "3fab377454fc8464a3b96f18f27f6c8a7757bf97" and "63530b7847fd592c3dbe4504d6768228b2965bad" have entirely different histories.

3 changed files with 22 additions and 45 deletions

View File

@ -17,7 +17,6 @@ using IRaCIS.Core.Application.ViewModel;
using IRaCIS.Core.Domain.Models;
using IRaCIS.Core.Application.Service;
using Medallion.Threading;
using DocumentFormat.OpenXml.Office2010.Excel;
namespace IRaCIS.Core.Application.Image.QA
{
@ -803,46 +802,28 @@ namespace IRaCIS.Core.Application.Image.QA
var succeess2 = await _repository.BatchDeleteAsync<DicomInstance>(t => t.StudyId == id);
var success3 = await _dicomSeriesrepository.BatchDeleteNoTrackingAsync(t => t.StudyId == id);
await _repository.BatchUpdateAsync<SCPStudy>(t => t.Id == id,u=>new SCPStudy() { SubjectVisitId=null});
//var success3 = await _dicomSeriesrepository.DeleteFromQueryAsync(t => t.StudyId == id, true);
//var success4 = await _repository.BatchDeleteAsync<StudyMonitor>(t => t.StudyId == id);
//删除 物理文件
//var instancePathList = await _repository.Where<DicomInstance>(t => t.StudyId == id)
// .Select(t => t.Path).ToListAsync();
var instancePathList = await _repository.Where<DicomInstance>(t => t.StudyId == id)
.Select(t => t.Path).ToListAsync();
//instancePathList.ForEach(path =>
//{
// var physicalPath = FileStoreHelper.GetPhysicalFilePath(_hostEnvironment, path);
// if (System.IO.File.Exists(physicalPath))
// {
// File.Delete(physicalPath);
// }
//});
}
var subjectId=waitDeleteStudyList.Select(t=>t.SubjectId).FirstOrDefault();
var patientList = _repository.Where<SCPPatient>(t => t.SubjectId == subjectId).Select(t => t.Id).ToList();
foreach (var patientId in patientList)
{
if (_repository.Where<SCPPatient>(t=>t.Id== patientId).Any(t => t.SCPStudyList.Count() == t.SCPStudyList.Where(t => t.SubjectVisitId == null).Count()))
instancePathList.ForEach(path =>
{
await _repository.BatchUpdateAsync<SCPPatient>(t => t.Id == patientId, u => new SCPPatient() { SubjectId = null });
}
var physicalPath = FileStoreHelper.GetPhysicalFilePath(_hostEnvironment, path);
if (System.IO.File.Exists(physicalPath))
{
File.Delete(physicalPath);
}
});
}
await _subjectVisitRepository.SaveChangesAsync();

View File

@ -229,7 +229,7 @@ namespace IRaCIS.Application.Services
public async Task<List<string>> GetDicomModalityList(Guid trialId)
{
var list = await _scpStudyRepository.Where(t => t.TrialId == trialId).SelectMany(t => t.SeriesList).Select(t => t.Modality).Distinct().ToListAsync();
var list = await _scpStudyRepository.Where(t => t.TrialId == trialId).SelectMany(t => t.SeriesList).Select(t=>t.Modality).Distinct().ToListAsync();
return list;
}
@ -265,10 +265,10 @@ namespace IRaCIS.Application.Services
SCPStudyId = scpStudy.Id,
SeriesCount = scpStudy.SeriesCount,
StudyTime = scpStudy.StudyTime,
BodyPartExamined = scpStudy.BodyPartExamined,
AccessionNumber = scpStudy.AccessionNumber,
BodyPartExamined=scpStudy.BodyPartExamined,
AccessionNumber=scpStudy.AccessionNumber,
PatientBirthDate = scpStudy.PatientBirthDate,
PatientBirthDate=scpStudy.PatientBirthDate,
PatientAge = scpStudy.PatientAge,
PatientIdStr = scpStudy.PatientIdStr,
PatientName = scpStudy.PatientName,
@ -311,12 +311,12 @@ namespace IRaCIS.Application.Services
foreach (var scpStudyId in inCommand.SCPStudyIdList)
{
var find = _scpStudyRepository.Where(t => t.Id == scpStudyId).Select(t => new { SCPStudy = t, t.SeriesList, t.InstanceList }).FirstOrDefault();
var find = _scpStudyRepository.Where(t => t.Id == scpStudyId).Include(t => t.SeriesList).Include(t => t.InstanceList).FirstOrDefault();
if (find != null)
{
var newStuty = _mapper.Map<DicomStudy>(find.SCPStudy);
var newStuty = _mapper.Map<DicomStudy>(find);
await _repository.AddAsync(newStuty);
@ -345,6 +345,8 @@ namespace IRaCIS.Application.Services
foreach (var instance in newInstanceList)
{
instance.SeqId = Guid.Empty;
instance.TrialId = trialId;
instance.SubjectId = subjectId;
@ -356,10 +358,6 @@ namespace IRaCIS.Application.Services
currentNextCodeInt++;
await _repository.BatchUpdateAsync<SCPPatient>(t => t.Id == find.SCPStudy.PatientId, u => new SCPPatient() { SubjectId = subjectId });
await _repository.BatchUpdateAsync<SCPStudy>(t => t.Id == scpStudyId, u => new SCPStudy() { SubjectVisitId = subjectVisitId });
}
@ -369,7 +367,6 @@ namespace IRaCIS.Application.Services
await _repository.SaveChangesAsync();
return ResponseOutput.Ok();
}

View File

@ -99,6 +99,5 @@ namespace IRaCIS.Core.Domain.Models
[JsonIgnore]
public TrialSite TrialSite { get; set; }
}
}