返回签名文档数量
parent
eba41a039d
commit
b52e2de6e5
|
@ -20,6 +20,7 @@ using Localization;
|
||||||
using Magicodes.ExporterAndImporter.Core.Filters;
|
using Magicodes.ExporterAndImporter.Core.Filters;
|
||||||
using IRaCIS.Core.Application.MediatR.CommandAndQueries;
|
using IRaCIS.Core.Application.MediatR.CommandAndQueries;
|
||||||
using IRaCIS.Core.Infra.EFCore.Common;
|
using IRaCIS.Core.Infra.EFCore.Common;
|
||||||
|
using Invio.Extensions.Authentication.JwtBearer;
|
||||||
|
|
||||||
namespace IRaCIS.Core.API
|
namespace IRaCIS.Core.API
|
||||||
{
|
{
|
||||||
|
@ -198,6 +199,7 @@ namespace IRaCIS.Core.API
|
||||||
app.UseRouting();
|
app.UseRouting();
|
||||||
|
|
||||||
app.UseAuthentication();
|
app.UseAuthentication();
|
||||||
|
//app.UseJwtBearerQueryString();
|
||||||
app.UseAuthorization();
|
app.UseAuthorization();
|
||||||
|
|
||||||
//文件伺服 必须带Token 访问
|
//文件伺服 必须带Token 访问
|
||||||
|
|
|
@ -20,7 +20,8 @@ namespace IRaCIS.Core.API
|
||||||
configuration.Bind("JwtSetting", jwtSetting);
|
configuration.Bind("JwtSetting", jwtSetting);
|
||||||
|
|
||||||
services
|
services
|
||||||
.AddAuthentication(o=> {
|
.AddAuthentication(o =>
|
||||||
|
{
|
||||||
o.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
|
o.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
|
||||||
o.DefaultChallengeScheme = nameof(ApiResponseHandler);
|
o.DefaultChallengeScheme = nameof(ApiResponseHandler);
|
||||||
o.DefaultForbidScheme = nameof(ApiResponseHandler);
|
o.DefaultForbidScheme = nameof(ApiResponseHandler);
|
||||||
|
@ -40,6 +41,15 @@ namespace IRaCIS.Core.API
|
||||||
|
|
||||||
options.AddQueryStringAuthentication();
|
options.AddQueryStringAuthentication();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//).AddJwtBearerQueryStringAuthentication(
|
||||||
|
// (JwtBearerQueryStringOptions options) =>
|
||||||
|
// {
|
||||||
|
// options.QueryStringParameterName = "access_token";
|
||||||
|
// options.QueryStringBehavior = QueryStringBehaviors.Redact;
|
||||||
|
// };
|
||||||
|
|
||||||
// OPTION 2: do it manually
|
// OPTION 2: do it manually
|
||||||
|
|
||||||
#region
|
#region
|
||||||
|
@ -87,5 +97,5 @@ namespace IRaCIS.Core.API
|
||||||
.AddScheme<AuthenticationSchemeOptions, ApiResponseHandler>(nameof(ApiResponseHandler), o => { });
|
.AddScheme<AuthenticationSchemeOptions, ApiResponseHandler>(nameof(ApiResponseHandler), o => { });
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1179,13 +1179,6 @@
|
||||||
<param name="querySystemDocument"></param>
|
<param name="querySystemDocument"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</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)">
|
<member name="M:IRaCIS.Core.Application.Services.TrialDocumentService.GetDocumentConfirmList(IRaCIS.Core.Application.Contracts.DocumentTrialUnionQuery)">
|
||||||
<summary>
|
<summary>
|
||||||
获取确认列表情况 项目文档+系统文档+具体的人
|
获取确认列表情况 项目文档+系统文档+具体的人
|
||||||
|
|
|
@ -197,56 +197,24 @@ namespace IRaCIS.Core.Application.Services
|
||||||
.WhereIf(querySystemDocument.IsSign == true, t => t.ConfirmUserId != null)
|
.WhereIf(querySystemDocument.IsSign == true, t => t.ConfirmUserId != null)
|
||||||
.WhereIf(querySystemDocument.IsSign == false, 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>
|
/// <summary>
|
||||||
|
@ -545,7 +513,7 @@ namespace IRaCIS.Core.Application.Services
|
||||||
return ResponseOutput.NotOk("文件已删除或者废除,签署失败!");
|
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
|
else
|
||||||
{
|
{
|
||||||
|
@ -559,7 +527,7 @@ namespace IRaCIS.Core.Application.Services
|
||||||
return ResponseOutput.NotOk("文件已删除或者废除,签署失败!");
|
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();
|
await _repository.SaveChangesAsync();
|
||||||
|
|
|
@ -313,7 +313,7 @@ namespace IRaCIS.Core.Application.Image.QA
|
||||||
|
|
||||||
var sv = (await _subjectVisitRepository.FirstOrDefaultAsync(t => t.Id == input.subjectVisitId)).IfNullThrowException();
|
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("当前访视处于申请回退状态, 不允许关闭质疑。");
|
ResponseOutput.NotOk("当前访视处于申请回退状态, 不允许关闭质疑。");
|
||||||
}
|
}
|
||||||
|
@ -341,7 +341,7 @@ namespace IRaCIS.Core.Application.Image.QA
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPut("{trialId:guid}")]
|
[HttpPut("{trialId:guid}")]
|
||||||
[TypeFilter(typeof(TrialResourceFilter))]
|
[TypeFilter(typeof(TrialResourceFilter))]
|
||||||
[Authorize(Policy = IRaCISPolicy.PM_APM )]
|
[Authorize(Policy = IRaCISPolicy.PM_APM)]
|
||||||
public async Task<IResponseOutput> SetCheckPass(SetCheckPassDt data)
|
public async Task<IResponseOutput> SetCheckPass(SetCheckPassDt data)
|
||||||
{
|
{
|
||||||
//if (_userInfo.UserTypeEnumInt != (int)UserTypeEnum.ProjectManager && _userInfo.UserTypeEnumInt != (int)UserTypeEnum.APM)
|
//if (_userInfo.UserTypeEnumInt != (int)UserTypeEnum.ProjectManager && _userInfo.UserTypeEnumInt != (int)UserTypeEnum.APM)
|
||||||
|
@ -1301,7 +1301,19 @@ namespace IRaCIS.Core.Application.Image.QA
|
||||||
return ResponseOutput.NotOk("有访视未上传任何Dicom/非Dicom影像数据,不允许提交");
|
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)
|
foreach (var dbSubjectVisit in dbSubjectVisitList)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -1369,10 +1381,6 @@ namespace IRaCIS.Core.Application.Image.QA
|
||||||
dbSubjectVisit.SubmitTime = DateTime.Now;
|
dbSubjectVisit.SubmitTime = DateTime.Now;
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
return ResponseOutput.NotOk("当前访视的影像数据,已经由其他CRC提交。",3,ApiResponseCodeEnum.NeedTips);
|
|
||||||
}
|
|
||||||
//不审 直接QC通过 可能一致性核查 也可能不一致性核查
|
//不审 直接QC通过 可能一致性核查 也可能不一致性核查
|
||||||
if (trialConfig.QCProcessEnum == TrialQCProcess.NotAudit)
|
if (trialConfig.QCProcessEnum == TrialQCProcess.NotAudit)
|
||||||
{
|
{
|
||||||
|
@ -1394,12 +1402,18 @@ namespace IRaCIS.Core.Application.Image.QA
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var success = await _repository.SaveChangesAsync();
|
var success = await _repository.SaveChangesAsync();
|
||||||
|
|
||||||
return ResponseOutput.Result(success);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return ResponseOutput.Ok(success);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1876,7 +1890,7 @@ namespace IRaCIS.Core.Application.Image.QA
|
||||||
|
|
||||||
if (command.SubjectFirstGiveMedicineTime != null)
|
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();
|
await _subjectVisitRepository.SaveChangesAsync();
|
||||||
|
|
Loading…
Reference in New Issue