返回签名文档数量
parent
eba41a039d
commit
b52e2de6e5
|
@ -20,6 +20,7 @@ using Localization;
|
|||
using Magicodes.ExporterAndImporter.Core.Filters;
|
||||
using IRaCIS.Core.Application.MediatR.CommandAndQueries;
|
||||
using IRaCIS.Core.Infra.EFCore.Common;
|
||||
using Invio.Extensions.Authentication.JwtBearer;
|
||||
|
||||
namespace IRaCIS.Core.API
|
||||
{
|
||||
|
@ -198,6 +199,7 @@ namespace IRaCIS.Core.API
|
|||
app.UseRouting();
|
||||
|
||||
app.UseAuthentication();
|
||||
//app.UseJwtBearerQueryString();
|
||||
app.UseAuthorization();
|
||||
|
||||
//文件伺服 必须带Token 访问
|
||||
|
|
|
@ -20,7 +20,8 @@ namespace IRaCIS.Core.API
|
|||
configuration.Bind("JwtSetting", jwtSetting);
|
||||
|
||||
services
|
||||
.AddAuthentication(o=> {
|
||||
.AddAuthentication(o =>
|
||||
{
|
||||
o.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
|
||||
o.DefaultChallengeScheme = nameof(ApiResponseHandler);
|
||||
o.DefaultForbidScheme = nameof(ApiResponseHandler);
|
||||
|
@ -40,6 +41,15 @@ namespace IRaCIS.Core.API
|
|||
|
||||
options.AddQueryStringAuthentication();
|
||||
|
||||
|
||||
|
||||
//).AddJwtBearerQueryStringAuthentication(
|
||||
// (JwtBearerQueryStringOptions options) =>
|
||||
// {
|
||||
// options.QueryStringParameterName = "access_token";
|
||||
// options.QueryStringBehavior = QueryStringBehaviors.Redact;
|
||||
// };
|
||||
|
||||
// OPTION 2: do it manually
|
||||
|
||||
#region
|
||||
|
|
|
@ -1179,13 +1179,6 @@
|
|||
<param name="querySystemDocument"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.Application.Services.TrialDocumentService.GetUserIsHaveDocumentNeedSign(System.Guid)">
|
||||
<summary>
|
||||
获取用户是否有文档未签署
|
||||
</summary>
|
||||
<param name="trialId"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.Application.Services.TrialDocumentService.GetDocumentConfirmList(IRaCIS.Core.Application.Contracts.DocumentTrialUnionQuery)">
|
||||
<summary>
|
||||
获取确认列表情况 项目文档+系统文档+具体的人
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue