处理检查删除、添加、维护绑定关系
parent
9898673dbf
commit
5246c10e32
|
@ -17,6 +17,7 @@ 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
|
||||
{
|
||||
|
@ -802,28 +803,46 @@ 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 =>
|
||||
{
|
||||
//instancePathList.ForEach(path =>
|
||||
//{
|
||||
|
||||
var physicalPath = FileStoreHelper.GetPhysicalFilePath(_hostEnvironment, path);
|
||||
// var physicalPath = FileStoreHelper.GetPhysicalFilePath(_hostEnvironment, path);
|
||||
|
||||
if (System.IO.File.Exists(physicalPath))
|
||||
{
|
||||
File.Delete(physicalPath);
|
||||
}
|
||||
});
|
||||
// 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()))
|
||||
{
|
||||
await _repository.BatchUpdateAsync<SCPPatient>(t => t.Id == patientId, u => new SCPPatient() { SubjectId = null });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
await _subjectVisitRepository.SaveChangesAsync();
|
||||
|
||||
|
||||
|
|
|
@ -192,7 +192,7 @@ namespace IRaCIS.Application.Services
|
|||
SCPStudyId = scpStudy.Id,
|
||||
SeriesCount = scpStudy.SeriesCount,
|
||||
StudyTime = scpStudy.StudyTime,
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -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).Include(t => t.SeriesList).Include(t => t.InstanceList).FirstOrDefault();
|
||||
var find = _scpStudyRepository.Where(t => t.Id == scpStudyId).Select(t => new { SCPStudy = t, t.SeriesList, t.InstanceList }).FirstOrDefault();
|
||||
|
||||
if (find != null)
|
||||
{
|
||||
|
||||
var newStuty = _mapper.Map<DicomStudy>(find);
|
||||
var newStuty = _mapper.Map<DicomStudy>(find.SCPStudy);
|
||||
|
||||
await _repository.AddAsync(newStuty);
|
||||
|
||||
|
@ -345,8 +345,6 @@ namespace IRaCIS.Application.Services
|
|||
|
||||
foreach (var instance in newInstanceList)
|
||||
{
|
||||
|
||||
|
||||
instance.SeqId = Guid.Empty;
|
||||
instance.TrialId = trialId;
|
||||
instance.SubjectId = subjectId;
|
||||
|
@ -358,6 +356,10 @@ 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 });
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -367,6 +369,7 @@ namespace IRaCIS.Application.Services
|
|||
|
||||
await _repository.SaveChangesAsync();
|
||||
|
||||
|
||||
return ResponseOutput.Ok();
|
||||
}
|
||||
|
||||
|
|
|
@ -99,5 +99,6 @@ namespace IRaCIS.Core.Domain.Models
|
|||
[JsonIgnore]
|
||||
public TrialSite TrialSite { get; set; }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue