返回签名文档数量
This commit is contained in:
@@ -197,56 +197,24 @@ namespace IRaCIS.Core.Application.Services
|
||||
.WhereIf(querySystemDocument.IsSign == true, t => t.ConfirmUserId != null)
|
||||
.WhereIf(querySystemDocument.IsSign == false, t => t.ConfirmUserId == null);
|
||||
|
||||
return await unionQuery.ToPagedListAsync(querySystemDocument.PageIndex, querySystemDocument.PageSize, querySystemDocument.SortField, querySystemDocument.Asc);
|
||||
var result = await unionQuery.ToPagedListAsync(querySystemDocument.PageIndex, querySystemDocument.PageSize, querySystemDocument.SortField, querySystemDocument.Asc);
|
||||
|
||||
var needSignTrialDocCount = await _trialDocumentRepository.AsQueryable(true)
|
||||
.Where(t => t.Trial.TrialUserList.Any(t => t.UserId == _userInfo.Id))
|
||||
.Where(t => t.IsDeleted == false && !t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id) && t.NeedConfirmedUserTypeList.Any(u => u.NeedConfirmUserTypeId == _userInfo.UserTypeId))
|
||||
.CountAsync();
|
||||
|
||||
|
||||
var needSignSystemDocCount = await _systemDocumentRepository
|
||||
.Where(t => t.IsDeleted == false && !t.SystemDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id) && t.NeedConfirmedUserTypeList.Any(u => u.NeedConfirmUserTypeId == _userInfo.UserTypeId))
|
||||
.CountAsync();
|
||||
|
||||
result.OtherData = new { NeedSignCount= needSignTrialDocCount + needSignSystemDocCount , NeedSignTrialDocCount= needSignTrialDocCount, NeedSignSystemDocCount = needSignSystemDocCount } ;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取用户是否有文档未签署
|
||||
/// </summary>
|
||||
/// <param name="trialId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("{trialId:guid}")]
|
||||
public async Task<bool> GetUserIsHaveDocumentNeedSign(Guid trialId)
|
||||
{
|
||||
var trialFininshedTime = await _repository.Where<Trial>(t => t.Id == trialId).Select(t => t.TrialFinishedTime).FirstOrDefaultAsync();
|
||||
|
||||
//系统文档查询
|
||||
var systemDocumentQueryable = from needConfirmedUserType in _repository.Where<SystemDocNeedConfirmedUserType>(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId)
|
||||
//.Where(u => u.UserTypeRole.UserList.SelectMany(cc => cc.UserTrials.Where(t => t.TrialId == querySystemDocument.TrialId)).Any(e => e.Trial.TrialFinishedTime < u.SystemDocument.CreateTime))
|
||||
.WhereIf(trialFininshedTime != null, u => u.SystemDocument.CreateTime < trialFininshedTime)
|
||||
.WhereIf(!_userInfo.IsAdmin, t => t.SystemDocument.IsDeleted == false || (t.SystemDocument.IsDeleted == true && t.SystemDocument.SystemDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id)))
|
||||
|
||||
join trialUser in _repository.Where<TrialUser>(t => t.TrialId == trialId && t.UserId == _userInfo.Id)
|
||||
on needConfirmedUserType.NeedConfirmUserTypeId equals trialUser.User.UserTypeId
|
||||
join confirm in _repository.GetQueryable<SystemDocConfirmedUser>() on new { ConfirmUserId = trialUser.UserId, SystemDocumentId = needConfirmedUserType.SystemDocumentId } equals new { confirm.ConfirmUserId, confirm.SystemDocumentId } into cc
|
||||
from confirm in cc.DefaultIfEmpty()
|
||||
select new
|
||||
{
|
||||
//ConfirmUserId = confirm.ConfirmUserId,
|
||||
ConfirmTime = confirm.ConfirmTime,
|
||||
};
|
||||
|
||||
//项目文档查询
|
||||
var trialDocQueryable = from trialDoc in _trialDocumentRepository.Where(t => t.TrialId == trialId)
|
||||
.WhereIf(!_userInfo.IsAdmin, t => t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId))
|
||||
.WhereIf(!_userInfo.IsAdmin, t => t.IsDeleted == false || (t.IsDeleted == true && t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id)))
|
||||
|
||||
join trialUser in _repository.Where<TrialUser>(t => t.TrialId == trialId && t.UserId == _userInfo.Id) on trialDoc.TrialId equals trialUser.TrialId
|
||||
join confirm in _repository.Where<TrialDocUserTypeConfirmedUser>(t => t.TrialDocument.TrialId == trialId) on
|
||||
new { trialUser.UserId, TrialDocumentId = trialDoc.Id } equals new { UserId = confirm.ConfirmUserId, confirm.TrialDocumentId } into cc
|
||||
from confirm in cc.DefaultIfEmpty()
|
||||
select new
|
||||
{
|
||||
//ConfirmUserId = confirm.ConfirmUserId,
|
||||
ConfirmTime = confirm.ConfirmTime,
|
||||
};
|
||||
|
||||
var unionQuery = systemDocumentQueryable.Union(trialDocQueryable);
|
||||
|
||||
return await unionQuery.AnyAsync(t => t.ConfirmTime == null);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
@@ -533,7 +501,7 @@ namespace IRaCIS.Core.Application.Services
|
||||
/// <returns></returns>
|
||||
public async Task<IResponseOutput> UserConfirm(UserConfirmCommand userConfirmCommand)
|
||||
{
|
||||
|
||||
|
||||
if (userConfirmCommand.isSystemDoc)
|
||||
{
|
||||
if (await _repository.AnyAsync<SystemDocConfirmedUser>(t => t.SystemDocumentId == userConfirmCommand.DocumentId && t.ConfirmUserId == _userInfo.Id))
|
||||
@@ -545,7 +513,7 @@ namespace IRaCIS.Core.Application.Services
|
||||
return ResponseOutput.NotOk("文件已删除或者废除,签署失败!");
|
||||
}
|
||||
|
||||
await _systemDocConfirmedUserRepository.AddAsync(new SystemDocConfirmedUser() { ConfirmTime = DateTime.Now, ConfirmUserId = _userInfo.Id, IsDeleted=false, SystemDocumentId = userConfirmCommand.DocumentId },true);
|
||||
await _systemDocConfirmedUserRepository.AddAsync(new SystemDocConfirmedUser() { ConfirmTime = DateTime.Now, ConfirmUserId = _userInfo.Id, IsDeleted = false, SystemDocumentId = userConfirmCommand.DocumentId }, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -559,7 +527,7 @@ namespace IRaCIS.Core.Application.Services
|
||||
return ResponseOutput.NotOk("文件已删除或者废除,签署失败!");
|
||||
}
|
||||
|
||||
await _trialDocUserTypeConfirmedUserRepository.AddAsync(new TrialDocUserTypeConfirmedUser() { ConfirmTime = DateTime.Now, ConfirmUserId = _userInfo.Id,IsDeleted=false, TrialDocumentId = userConfirmCommand.DocumentId },true);
|
||||
await _trialDocUserTypeConfirmedUserRepository.AddAsync(new TrialDocUserTypeConfirmedUser() { ConfirmTime = DateTime.Now, ConfirmUserId = _userInfo.Id, IsDeleted = false, TrialDocumentId = userConfirmCommand.DocumentId }, true);
|
||||
}
|
||||
|
||||
await _repository.SaveChangesAsync();
|
||||
|
||||
@@ -313,7 +313,7 @@ namespace IRaCIS.Core.Application.Image.QA
|
||||
|
||||
var sv = (await _subjectVisitRepository.FirstOrDefaultAsync(t => t.Id == input.subjectVisitId)).IfNullThrowException();
|
||||
|
||||
if ( sv.RequestBackState == RequestBackStateEnum.CRC_RequestBack)
|
||||
if (sv.RequestBackState == RequestBackStateEnum.CRC_RequestBack)
|
||||
{
|
||||
ResponseOutput.NotOk("当前访视处于申请回退状态, 不允许关闭质疑。");
|
||||
}
|
||||
@@ -341,7 +341,7 @@ namespace IRaCIS.Core.Application.Image.QA
|
||||
/// <returns></returns>
|
||||
[HttpPut("{trialId:guid}")]
|
||||
[TypeFilter(typeof(TrialResourceFilter))]
|
||||
[Authorize(Policy = IRaCISPolicy.PM_APM )]
|
||||
[Authorize(Policy = IRaCISPolicy.PM_APM)]
|
||||
public async Task<IResponseOutput> SetCheckPass(SetCheckPassDt data)
|
||||
{
|
||||
//if (_userInfo.UserTypeEnumInt != (int)UserTypeEnum.ProjectManager && _userInfo.UserTypeEnumInt != (int)UserTypeEnum.APM)
|
||||
@@ -407,7 +407,7 @@ namespace IRaCIS.Core.Application.Image.QA
|
||||
{
|
||||
sv.RequestBackState = RequestBackStateEnum.CRC_RequestBack;
|
||||
|
||||
await _subjectVisitRepository.SaveChangesAsync();
|
||||
await _subjectVisitRepository.SaveChangesAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1301,7 +1301,19 @@ namespace IRaCIS.Core.Application.Image.QA
|
||||
return ResponseOutput.NotOk("有访视未上传任何Dicom/非Dicom影像数据,不允许提交");
|
||||
}
|
||||
|
||||
//单个提交提示信息
|
||||
if (dbSubjectVisitList.Count() == 1 && dbSubjectVisitList.First().SubmitState == SubmitStateEnum.Submitted)
|
||||
{
|
||||
return ResponseOutput.NotOk("当前访视的影像数据,已经由其他CRC提交。", 3, ApiResponseCodeEnum.NeedTips);
|
||||
}
|
||||
else if(dbSubjectVisitList.Any(t => t.SubmitState == SubmitStateEnum.Submitted))
|
||||
{
|
||||
return ResponseOutput.NotOk("当前批量提交访视的影像数据,其中部分已由其他CRC提交。", 3, ApiResponseCodeEnum.NeedTips);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 别人未提交的
|
||||
foreach (var dbSubjectVisit in dbSubjectVisitList)
|
||||
{
|
||||
|
||||
@@ -1369,10 +1381,6 @@ namespace IRaCIS.Core.Application.Image.QA
|
||||
dbSubjectVisit.SubmitTime = DateTime.Now;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
return ResponseOutput.NotOk("当前访视的影像数据,已经由其他CRC提交。",3,ApiResponseCodeEnum.NeedTips);
|
||||
}
|
||||
//不审 直接QC通过 可能一致性核查 也可能不一致性核查
|
||||
if (trialConfig.QCProcessEnum == TrialQCProcess.NotAudit)
|
||||
{
|
||||
@@ -1394,12 +1402,18 @@ namespace IRaCIS.Core.Application.Image.QA
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
var success = await _repository.SaveChangesAsync();
|
||||
|
||||
return ResponseOutput.Result(success);
|
||||
|
||||
|
||||
|
||||
|
||||
return ResponseOutput.Ok(success);
|
||||
|
||||
|
||||
|
||||
@@ -1685,7 +1699,7 @@ namespace IRaCIS.Core.Application.Image.QA
|
||||
if (trialConfig.QCProcessEnum == TrialQCProcess.DoubleAudit && await _repository.AnyAsync<QCChallenge>(t => t.Id == qcChallengeId && t.SubjectVisit.AuditState == AuditStateEnum.InSecondaryQC))
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
// //一致性核查质疑状态
|
||||
// sv.CheckChallengeState = CheckChanllengeTypeEnum.None;
|
||||
@@ -1734,7 +1748,7 @@ namespace IRaCIS.Core.Application.Image.QA
|
||||
[Authorize(Policy = IRaCISPolicy.CRC)]
|
||||
public async Task<IResponseOutput> SetReuploadFinished(CRCReuploadFinishedCommand cRCReuploadFinishedCommand)
|
||||
{
|
||||
|
||||
|
||||
var qcChallenge = (await _qcChallengeRepository.FirstOrDefaultAsync(t => t.Id == cRCReuploadFinishedCommand.QCChallengeId)).IfNullThrowException();
|
||||
|
||||
if (qcChallenge.ReuploadEnum != QCChanllengeReuploadEnum.QCAgreeUpload)
|
||||
@@ -1876,7 +1890,7 @@ namespace IRaCIS.Core.Application.Image.QA
|
||||
|
||||
if (command.SubjectFirstGiveMedicineTime != null)
|
||||
{
|
||||
await _subjectRepository.UpdatePartialFromQueryAsync(command.SubjectId, u => new Subject() { FirstGiveMedicineTime = command.SubjectFirstGiveMedicineTime, },true);
|
||||
await _subjectRepository.UpdatePartialFromQueryAsync(command.SubjectId, u => new Subject() { FirstGiveMedicineTime = command.SubjectFirstGiveMedicineTime, }, true);
|
||||
}
|
||||
|
||||
await _subjectVisitRepository.SaveChangesAsync();
|
||||
|
||||
Reference in New Issue
Block a user