修改设置重传完成 限制

Uat_Study
hang 2022-04-26 15:27:40 +08:00
parent 55d3ea2c75
commit 34a5532ee2
1 changed files with 25 additions and 13 deletions

View File

@ -56,7 +56,7 @@ namespace IRaCIS.Core.Application.Image.QA
_dicomStudyRepository = dicomStudyRepository; _dicomStudyRepository = dicomStudyRepository;
this._dictionaryrepository = dictionaryrepository; this._dictionaryrepository = dictionaryrepository;
_mediator = mediator; _mediator = mediator;
_trialRepository = trialRepository; _trialRepository = trialRepository;
_inspectionService = inspectionService; _inspectionService = inspectionService;
this._dictionaryService = dictionaryService; this._dictionaryService = dictionaryService;
} }
@ -108,7 +108,7 @@ namespace IRaCIS.Core.Application.Image.QA
using (await _mutex.LockAsync()) using (await _mutex.LockAsync())
{ {
var qcChallenge = _mapper.Map<QCChallenge>(qaQuestionCommand); var qcChallenge = _mapper.Map<QCChallenge>(qaQuestionCommand);
qcChallenge.QCProcessEnum = trialConfig.QCProcessEnum; qcChallenge.QCProcessEnum = trialConfig.QCProcessEnum;
qcChallenge.CurrentQCEnum = currentQCType; qcChallenge.CurrentQCEnum = currentQCType;
@ -117,7 +117,7 @@ namespace IRaCIS.Core.Application.Image.QA
qcChallenge.ChallengeCode = code + 1; qcChallenge.ChallengeCode = code + 1;
qcChallenge.UserTypeEnum = (UserTypeEnum)_userInfo.UserTypeEnumInt; qcChallenge.UserTypeEnum = (UserTypeEnum)_userInfo.UserTypeEnumInt;
qcChallenge= await _repository.AddAsync(qcChallenge,true); qcChallenge = await _repository.AddAsync(qcChallenge, true);
return qcChallenge; return qcChallenge;
} }
@ -1084,10 +1084,10 @@ namespace IRaCIS.Core.Application.Image.QA
} }
if (await _subjectVisitRepository.AnyAsync(t => t.IsTake && if (await _subjectVisitRepository.AnyAsync(t => t.IsTake &&
t.SubjectId != dbSubjectVisit.SubjectId && t.SubjectId != dbSubjectVisit.SubjectId &&
t.CurrentActionUserId == _userInfo.Id && t.CurrentActionUserId == _userInfo.Id &&
t.TrialId == dbSubjectVisit.TrialId t.TrialId == dbSubjectVisit.TrialId
)) ))
{ {
@ -1527,7 +1527,8 @@ namespace IRaCIS.Core.Application.Image.QA
// 删除序列 // 删除序列
List<DataInspection> datas = new List<DataInspection>(); List<DataInspection> datas = new List<DataInspection>();
var DicomSeriesdata = await _repository.GetQueryable<DicomSeries>().Where(x => x.SubjectVisitId == subjectVisitId&&x.IsDeleted).Select(x => new { var DicomSeriesdata = await _repository.GetQueryable<DicomSeries>().Where(x => x.SubjectVisitId == subjectVisitId && x.IsDeleted).Select(x => new
{
StudyCode = x.DicomStudy.StudyCode, StudyCode = x.DicomStudy.StudyCode,
Modalities = x.DicomStudy.Modalities, Modalities = x.DicomStudy.Modalities,
SeriesNumber = x.SeriesNumber, SeriesNumber = x.SeriesNumber,
@ -1724,15 +1725,28 @@ namespace IRaCIS.Core.Application.Image.QA
return ResponseOutput.NotOk("重传完成 只允许CRC 设置!"); return ResponseOutput.NotOk("重传完成 只允许CRC 设置!");
} }
var trialConfig = await _trialRepository
.Select(t => new { TrialId = t.Id, t.QCProcessEnum, t.IsImageConsistencyVerification, t.IsUrgent, t.IsHaveFirstGiveMedicineDate, t.ClinicalInformationTransmissionEnum })
.Where(t => t.TrialId == cRCReuploadFinishedCommand.TrialId).FirstOrDefaultAsync();
var qcChallenge = await _repository.FirstOrDefaultAsync<QCChallenge>(t => t.Id == cRCReuploadFinishedCommand.QCChallengeId); var qcChallenge = await _repository.FirstOrDefaultAsync<QCChallenge>(t => t.Id == cRCReuploadFinishedCommand.QCChallengeId);
if (qcChallenge == null) return Null404NotFound(qcChallenge); if (qcChallenge == null) return Null404NotFound(qcChallenge);
var subjectVisitId = qcChallenge.SubjectVisitId;
if (await _subjectVisitRepository.Where(t => t.Id == subjectVisitId).SelectMany(t => t.StudyList)
.CountAsync() == 0 &&
await _subjectVisitRepository.Where(t => t.Id == subjectVisitId)
.SelectMany(t => t.NoneDicomStudyList).SelectMany(u => u.NoneDicomFileList).CountAsync() == 0)
{
throw new BusinessValidationFailedException("当前没有影像,不允许设置重传完成");
}
var trialConfig = await _trialRepository
.Select(t => new { TrialId = t.Id, t.QCProcessEnum, t.IsImageConsistencyVerification, t.IsUrgent, t.IsHaveFirstGiveMedicineDate, t.ClinicalInformationTransmissionEnum })
.Where(t => t.TrialId == cRCReuploadFinishedCommand.TrialId).FirstOrDefaultAsync();
qcChallenge.ReuploadEnum = QCChanllengeReuploadEnum.CRCReuploaded; qcChallenge.ReuploadEnum = QCChanllengeReuploadEnum.CRCReuploaded;
qcChallenge.ReUploadedTime = DateTime.Now; qcChallenge.ReUploadedTime = DateTime.Now;
@ -1767,8 +1781,6 @@ namespace IRaCIS.Core.Application.Image.QA
dbSubjectVisit.IsConfirmedClinicalData = true; dbSubjectVisit.IsConfirmedClinicalData = true;
var signSuccess = await _repository.BatchUpdateAsync<TrialSign>(t => t.Id == cRCReuploadFinishedCommand.SignId, u => new TrialSign() { IsCompleted = true }); var signSuccess = await _repository.BatchUpdateAsync<TrialSign>(t => t.Id == cRCReuploadFinishedCommand.SignId, u => new TrialSign() { IsCompleted = true });
} }
var success = await _repository.SaveChangesAsync(); var success = await _repository.SaveChangesAsync();