一致性核查

Uat_Study
he 2022-05-12 16:14:54 +08:00
parent a8df6ef4d5
commit 8b56b17043
2 changed files with 91 additions and 9 deletions

View File

@ -33,6 +33,7 @@ namespace IRaCIS.Core.Application.Image.QA
private readonly IRepository<DicomSeries> _dicomSeriesrepository;
private readonly IRepository<Subject> _subjectRepository;
private readonly IRepository<QCChallengeDialog> _qCChallengeDialogrepository;
private readonly IRepository<CheckChallengeDialog> _checkChallengeDialogrepository;
private readonly IRepository<Trial> _trialRepository;
private readonly IMediator _mediator;
@ -45,7 +46,8 @@ namespace IRaCIS.Core.Application.Image.QA
IRepository<DicomStudy> dicomStudyRepository,
IRepository<DicomSeries> dicomSeriesrepository,
IRepository<Subject> subjectRepository,
IRepository<QCChallengeDialog> qCChallengeDialogrepository
IRepository<QCChallengeDialog> qCChallengeDialogrepository,
IRepository<CheckChallengeDialog> checkChallengeDialogrepository
)
{
_dicomFileStoreHelper = dicomFileStoreHelper;
@ -55,6 +57,7 @@ namespace IRaCIS.Core.Application.Image.QA
this._dicomSeriesrepository = dicomSeriesrepository;
this._subjectRepository = subjectRepository;
this._qCChallengeDialogrepository = qCChallengeDialogrepository;
this._checkChallengeDialogrepository = checkChallengeDialogrepository;
_mediator = mediator;
_trialRepository = trialRepository;
}
@ -312,7 +315,13 @@ namespace IRaCIS.Core.Application.Image.QA
}
sv.CloseTheReason = input.CloseCheckChallenge;
sv.CheckChallengeState = CheckChanllengeTypeEnum.Closed;
await _checkChallengeDialogrepository.AddAsync(new CheckChallengeDialog()
{
SubjectVisitId = input.subjectVisitId,
TalkContent = "原因:" + input.CloseCheckChallenge,
UserTypeEnum = (UserTypeEnum)_userInfo.UserTypeEnumInt,
});
await _repository.SaveChangesAsync();
return ResponseOutput.Ok(sv);
@ -377,11 +386,10 @@ namespace IRaCIS.Core.Application.Image.QA
var QCChallengeId = await _qcChallengeRepository.Where(x => x.SubjectVisitId == subjectVisitId).Select(x => x.Id).FirstOrDefaultAsync();
await _qCChallengeDialogrepository.AddAsync(new QCChallengeDialog()
await _checkChallengeDialogrepository.AddAsync(new CheckChallengeDialog()
{
SubjectVisitId = subjectVisitId,
UserTypeEnum = (UserTypeEnum)_userInfo.UserTypeEnumInt,
QCChallengeId = QCChallengeId,
TalkContent = "CRC 请求回退"
});

View File

@ -255,12 +255,18 @@ namespace IRaCIS.Core.Infra.EFCore.Common
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(SubjectVisit)))
{
var entity = item.Entity as SubjectVisit;
switch (GetRequestUrl())
string reason = string.Empty;
switch (GetRequestUrl().ToLower())
{
case "QCOperation/obtainOrCancelQCTask":
case "qcoperation/obtainorcancelqctask":
type = type +"/"+ entity.IsTake.ToString();
break;
case "QCOperation/QCPassedOrFailed":
// 设置通过一致性核查
case "qcoperation/setcheckpass":
reason = entity.ManualPassReason;
break;
case "qcoperation/qcpassedorfailed":
try
{
type = type + "/" + (40 % (int)entity.AuditState).ToString();
@ -282,6 +288,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
SubjectVisitId = x.Id,
SubjectVisitName=x.VisitName,
BlindName=x.BlindName,
Reason= reason,
});
}
@ -348,21 +355,66 @@ namespace IRaCIS.Core.Infra.EFCore.Common
//质疑
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(QCChallenge)))
{
var entity = item.Entity as QCChallenge;
type = _userInfo.UserTypeShortName +"/"+ type;
var subjectvisit = await _dbContext.SubjectVisit.Where(x => x.Id == entity.SubjectVisitId).FirstOrDefaultAsync();
subjectvisit = subjectvisit ?? new SubjectVisit();
var content = string.Empty;
if (type == "Add")
{
content = entity.Content;
}
await InsertInspection<QCChallenge>(item, type, x => new DataInspection()
{
GeneralId = x.Id,
TrialId=x.TrialId,
SubjectVisitId=x.SubjectVisitId,
SiteId= subjectvisit.SiteId,
SubjectId= subjectvisit.SubjectId,
SubjectVisitName= subjectvisit.VisitName,
BlindName= subjectvisit.BlindName,
},new {
ChallengeCode= "Q" + entity.ChallengeCode.ToString("D5"),
AuditState= subjectvisit.AuditState,
TalkContent= content,
IsOverTime= entity.IsClosed ? entity.ClosedTime > entity.DeadlineTime : DateTime.Now > entity.DeadlineTime,
});
}
//质疑
// 质疑信息
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(QCChallengeDialog)))
{
var reason = string.Empty;
var entity = item.Entity as QCChallengeDialog;
switch (GetRequestUrl().ToLower())
{
case "qcoperation/closeqcchallenge":
reason = entity.TalkContent.Substring(entity.TalkContent.LastIndexOf(':') + 1);
break;
}
type = _userInfo.UserTypeShortName + "/" + type;
var subjectvisit = await _dbContext.SubjectVisit.Where(x => x.Id == entity.SubjectVisitId).FirstOrDefaultAsync();
var qCChallenge = await _dbContext.QCChallenge.Where(x => x.Id == entity.QCChallengeId).FirstOrDefaultAsync();
subjectvisit = subjectvisit ?? new SubjectVisit();
await InsertInspection<QCChallengeDialog>(item, type, x => new DataInspection()
{
GeneralId = x.Id,
GeneralId = qCChallenge.Id,
TrialId = subjectvisit.TrialId,
SubjectVisitId = x.SubjectVisitId,
SiteId = subjectvisit.SiteId,
SubjectId = subjectvisit.SubjectId,
SubjectVisitName = subjectvisit.VisitName,
BlindName = subjectvisit.BlindName,
Reason= reason,
}, new {
AuditState= subjectvisit.AuditState,
ChallengeCode = "Q" + qCChallenge.ChallengeCode.ToString("D5"),
ReuploadEnum= qCChallenge.ReuploadEnum,
Content= qCChallenge.Content,
DeadlineTime= qCChallenge.DeadlineTime,
IsOverTime = qCChallenge.IsClosed ? qCChallenge.ClosedTime > qCChallenge.DeadlineTime : DateTime.Now > qCChallenge.DeadlineTime,
IsClosed= qCChallenge.IsClosed
});
}
@ -370,9 +422,31 @@ namespace IRaCIS.Core.Infra.EFCore.Common
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(CheckChallengeDialog)))
{
type = _userInfo.UserTypeShortName + "/" + type;
var entity = item.Entity as CheckChallengeDialog;
var subjectvisit = await _dbContext.SubjectVisit.Where(x => x.Id == entity.SubjectVisitId).FirstOrDefaultAsync();
subjectvisit = subjectvisit ?? new SubjectVisit();
var reason = string.Empty;
switch (GetRequestUrl().ToLower())
{
case "qcoperation/closecheckchallenge":
reason = entity.TalkContent.Substring(entity.TalkContent.LastIndexOf(':') + 1);
break;
}
await InsertInspection<CheckChallengeDialog>(item, type, x => new DataInspection()
{
GeneralId = x.Id,
GeneralId = entity.SubjectVisitId,
TrialId = subjectvisit.TrialId,
SubjectVisitId = x.SubjectVisitId,
SiteId = subjectvisit.SiteId,
SubjectId = subjectvisit.SubjectId,
SubjectVisitName = subjectvisit.VisitName,
BlindName = subjectvisit.BlindName,
Reason= reason,
},new {
CheckState= subjectvisit.CheckState,
RequestBackState = subjectvisit.RequestBackState,
CheckChallengeState= subjectvisit.CheckChallengeState,
});
}