修复检查列表上传人
parent
8b56b17043
commit
46b728e9a8
|
@ -139,7 +139,8 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
|
|
||||||
public string SubjectInfo { get; set; } = String.Empty;
|
public string SubjectInfo { get; set; } = String.Empty;
|
||||||
|
|
||||||
public string VisitPlanInfo { get; set; } = String.Empty;
|
|
||||||
|
public string[]? VisitPlanArray { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ using IRaCIS.Core.Application.Dicom;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using IRaCIS.Core.Application.Services;
|
using IRaCIS.Core.Application.Services;
|
||||||
using EasyCaching.Core;
|
using EasyCaching.Core;
|
||||||
|
using System.Linq.Expressions;
|
||||||
|
|
||||||
namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||||
{
|
{
|
||||||
|
@ -22,13 +23,109 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private Expression<Func<DicomStudy, bool>> GetDicomStudySubjectVisitFilter(string[]? VisitPlanArray)
|
||||||
|
{
|
||||||
|
Expression<Func<DicomStudy, bool>> svExpression = x => true;
|
||||||
|
|
||||||
|
bool isNeedVisitSearch = VisitPlanArray != null && VisitPlanArray?.Length > 0;
|
||||||
|
|
||||||
|
if (isNeedVisitSearch)
|
||||||
|
{
|
||||||
|
var inPlanArray = VisitPlanArray!.Where(t => !t.Contains('.')).Select(t => decimal.Parse(t)).ToArray();
|
||||||
|
var isSelectOutPlan = VisitPlanArray!.Any(t => t.Contains('.'));
|
||||||
|
|
||||||
|
|
||||||
|
if (inPlanArray.Length > 0)
|
||||||
|
{
|
||||||
|
svExpression = svExpression.And(t => inPlanArray.Contains(t.SubjectVisit.VisitNum));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (isSelectOutPlan)
|
||||||
|
{
|
||||||
|
svExpression = svExpression.Or(t => t.SubjectVisit.InPlan == false);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return svExpression;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private Expression<Func<NoneDicomStudy, bool>> GetNoneDicomStudySubjectVisitFilter(string[]? VisitPlanArray)
|
||||||
|
{
|
||||||
|
Expression<Func<NoneDicomStudy, bool>> svExpression = x => true;
|
||||||
|
|
||||||
|
bool isNeedVisitSearch = VisitPlanArray != null && VisitPlanArray?.Length > 0;
|
||||||
|
|
||||||
|
if (isNeedVisitSearch)
|
||||||
|
{
|
||||||
|
var inPlanArray = VisitPlanArray!.Where(t => !t.Contains('.')).Select(t => decimal.Parse(t)).ToArray();
|
||||||
|
var isSelectOutPlan = VisitPlanArray!.Any(t => t.Contains('.'));
|
||||||
|
|
||||||
|
|
||||||
|
if (inPlanArray.Length > 0)
|
||||||
|
{
|
||||||
|
svExpression = svExpression.And(t => inPlanArray.Contains(t.SubjectVisit.VisitNum));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (isSelectOutPlan)
|
||||||
|
{
|
||||||
|
svExpression = svExpression.Or(t => t.SubjectVisit.InPlan == false);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return svExpression;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Expression<Func<StudyMonitor, bool>> GetStudyMonitorSubjectVisitFilter(string[]? VisitPlanArray)
|
||||||
|
{
|
||||||
|
Expression<Func<StudyMonitor, bool>> svExpression = x => true;
|
||||||
|
|
||||||
|
bool isNeedVisitSearch = VisitPlanArray != null && VisitPlanArray?.Length > 0;
|
||||||
|
|
||||||
|
if (isNeedVisitSearch)
|
||||||
|
{
|
||||||
|
var inPlanArray = VisitPlanArray!.Where(t => !t.Contains('.')).Select(t => decimal.Parse(t)).ToArray();
|
||||||
|
var isSelectOutPlan = VisitPlanArray!.Any(t => t.Contains('.'));
|
||||||
|
|
||||||
|
|
||||||
|
if (inPlanArray.Length > 0)
|
||||||
|
{
|
||||||
|
svExpression = svExpression.And(t => inPlanArray.Contains(t.SubjectVisit.VisitNum));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (isSelectOutPlan)
|
||||||
|
{
|
||||||
|
svExpression = svExpression.Or(t => t.SubjectVisit.InPlan == false);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return svExpression;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public async Task<PageOutput<UnionStudyViewModel>> GetDicomAndNoneDicomStudyList(StudyQuery studyQuery)
|
public async Task<PageOutput<UnionStudyViewModel>> GetDicomAndNoneDicomStudyList(StudyQuery studyQuery)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
var svExpression = GetDicomStudySubjectVisitFilter(studyQuery.VisitPlanArray);
|
||||||
|
|
||||||
var dicomStudyQuery = _repository.Where<DicomStudy>(t => t.TrialId == studyQuery.TrialId)
|
var dicomStudyQuery = _repository.Where<DicomStudy>(t => t.TrialId == studyQuery.TrialId)
|
||||||
.WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.Id))
|
.WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.Id))
|
||||||
.WhereIf(!string.IsNullOrEmpty(studyQuery.VisitPlanInfo), studyQuery.VisitPlanInfo.Contains('.') ? t => t.SubjectVisit.VisitNum.ToString().Contains(".") : t => t.SubjectVisit.VisitNum == decimal.Parse(studyQuery.VisitPlanInfo))
|
//.WhereIf(!string.IsNullOrEmpty(studyQuery.VisitPlanInfo), studyQuery.VisitPlanInfo.Contains('.') ? t => t.SubjectVisit.VisitNum.ToString().Contains(".") : t => t.SubjectVisit.VisitNum == decimal.Parse(studyQuery.VisitPlanInfo))
|
||||||
|
.WhereIf(studyQuery.VisitPlanArray != null && studyQuery.VisitPlanArray?.Length > 0, t=>t.SubjectVisit.)
|
||||||
.WhereIf(!string.IsNullOrWhiteSpace(studyQuery.SubjectInfo), t => t.Subject.Code.Contains(studyQuery.SubjectInfo))
|
.WhereIf(!string.IsNullOrWhiteSpace(studyQuery.SubjectInfo), t => t.Subject.Code.Contains(studyQuery.SubjectInfo))
|
||||||
.Select(t => new UnionStudyViewModel()
|
.Select(t => new UnionStudyViewModel()
|
||||||
{
|
{
|
||||||
|
@ -62,7 +159,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||||
|
|
||||||
TrialSiteCode = t.TrialSite.TrialSiteCode,
|
TrialSiteCode = t.TrialSite.TrialSiteCode,
|
||||||
|
|
||||||
Uploader = t.Uploader.FullName,
|
Uploader = t.Uploader.UserName,
|
||||||
|
|
||||||
UploadTime = t.CreateTime
|
UploadTime = t.CreateTime
|
||||||
|
|
||||||
|
@ -70,13 +167,14 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||||
|
|
||||||
|
|
||||||
//.ProjectTo<UnionStudyViewDodel>(_mapper.ConfigurationProvider);
|
//.ProjectTo<UnionStudyViewDodel>(_mapper.ConfigurationProvider);
|
||||||
|
var svExpression2 = GetNoneDicomStudySubjectVisitFilter(studyQuery.VisitPlanArray);
|
||||||
|
|
||||||
|
|
||||||
var nodeDicomStudyQuery = _repository.Where<NoneDicomStudy>(t => t.TrialId == studyQuery.TrialId)
|
var nodeDicomStudyQuery = _repository.Where<NoneDicomStudy>(t => t.TrialId == studyQuery.TrialId)
|
||||||
.WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.Id))
|
.WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.Id))
|
||||||
.WhereIf(!string.IsNullOrEmpty(studyQuery.VisitPlanInfo), studyQuery.VisitPlanInfo.Contains('.') ? t => t.SubjectVisit.VisitNum.ToString().Contains(".") : t => t.SubjectVisit.VisitNum == decimal.Parse(studyQuery.VisitPlanInfo))
|
//.WhereIf(!string.IsNullOrEmpty(studyQuery.VisitPlanInfo), studyQuery.VisitPlanInfo.Contains('.') ? t => t.SubjectVisit.VisitNum.ToString().Contains(".") : t => t.SubjectVisit.VisitNum == decimal.Parse(studyQuery.VisitPlanInfo))
|
||||||
.WhereIf(!string.IsNullOrWhiteSpace(studyQuery.SubjectInfo), t => t.Subject.Code.Contains(studyQuery.SubjectInfo))
|
.WhereIf(studyQuery.VisitPlanArray != null && studyQuery.VisitPlanArray?.Length > 0, svExpression2)
|
||||||
|
.WhereIf(!string.IsNullOrWhiteSpace(studyQuery.SubjectInfo), t => t.Subject.Code.Contains(studyQuery.SubjectInfo))
|
||||||
|
|
||||||
.Select(t => new UnionStudyViewModel()
|
.Select(t => new UnionStudyViewModel()
|
||||||
{
|
{
|
||||||
|
@ -110,7 +208,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||||
|
|
||||||
TrialSiteCode = t.TrialSite.TrialSiteCode,
|
TrialSiteCode = t.TrialSite.TrialSiteCode,
|
||||||
|
|
||||||
Uploader = t.CreateUser.FullName,
|
Uploader = t.CreateUser.UserName,
|
||||||
|
|
||||||
UploadTime = t.CreateTime
|
UploadTime = t.CreateTime
|
||||||
|
|
||||||
|
@ -131,10 +229,11 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public async Task<PageOutput<UnionStudyMonitorModel>> GetDicomAndNoneDicomStudyMonitorList(StudyQuery studyQuery)
|
public async Task<PageOutput<UnionStudyMonitorModel>> GetDicomAndNoneDicomStudyMonitorList(StudyQuery studyQuery)
|
||||||
{
|
{
|
||||||
|
var svExpression = GetStudyMonitorSubjectVisitFilter(studyQuery.VisitPlanArray);
|
||||||
var StudyMonitorQuery = _repository.Where<StudyMonitor>(t => t.TrialId == studyQuery.TrialId)
|
var StudyMonitorQuery = _repository.Where<StudyMonitor>(t => t.TrialId == studyQuery.TrialId)
|
||||||
.WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.Id))
|
.WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CRA, t => t.TrialSite.CRCUserList.Any(t => t.UserId == _userInfo.Id))
|
||||||
.WhereIf(!string.IsNullOrEmpty(studyQuery.VisitPlanInfo), studyQuery.VisitPlanInfo.Contains('.') ? t => t.SubjectVisit.VisitNum.ToString().Contains(".") : t => t.SubjectVisit.VisitNum == decimal.Parse(studyQuery.VisitPlanInfo))
|
//.WhereIf(!string.IsNullOrEmpty(studyQuery.VisitPlanInfo), studyQuery.VisitPlanInfo.Contains('.') ? t => t.SubjectVisit.VisitNum.ToString().Contains(".") : t => t.SubjectVisit.VisitNum == decimal.Parse(studyQuery.VisitPlanInfo))
|
||||||
|
.WhereIf(studyQuery.VisitPlanArray != null && studyQuery.VisitPlanArray?.Length > 0, svExpression)
|
||||||
.WhereIf(!string.IsNullOrWhiteSpace(studyQuery.SubjectInfo), t => t.Subject.Code.Contains(studyQuery.SubjectInfo))
|
.WhereIf(!string.IsNullOrWhiteSpace(studyQuery.SubjectInfo), t => t.Subject.Code.Contains(studyQuery.SubjectInfo))
|
||||||
.WhereIf(studyQuery.SubjectId != null, t => t.SubjectId == studyQuery.SubjectId)
|
.WhereIf(studyQuery.SubjectId != null, t => t.SubjectId == studyQuery.SubjectId)
|
||||||
.WhereIf(studyQuery.SubjectVisitId != null, t => t.SubjectId == studyQuery.SubjectVisitId)
|
.WhereIf(studyQuery.SubjectVisitId != null, t => t.SubjectId == studyQuery.SubjectVisitId)
|
||||||
|
@ -157,7 +256,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||||
|
|
||||||
TrialSiteCode = t.TrialSite.TrialSiteCode,
|
TrialSiteCode = t.TrialSite.TrialSiteCode,
|
||||||
|
|
||||||
Uploader = t.Uploader.FullName,
|
Uploader = t.Uploader.UserName,
|
||||||
|
|
||||||
UploadTime = t.CreateTime,
|
UploadTime = t.CreateTime,
|
||||||
|
|
||||||
|
|
|
@ -406,6 +406,7 @@ namespace IRaCIS.Core.Application.Image.QA
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPut("{trialId:guid}/{subjectVisitId:guid}")]
|
[HttpPut("{trialId:guid}/{subjectVisitId:guid}")]
|
||||||
[TypeFilter(typeof(TrialResourceFilter))]
|
[TypeFilter(typeof(TrialResourceFilter))]
|
||||||
|
[UnitOfWork]
|
||||||
public async Task<IResponseOutput> CheckBack(Guid subjectVisitId)
|
public async Task<IResponseOutput> CheckBack(Guid subjectVisitId)
|
||||||
{
|
{
|
||||||
if (_userInfo.UserTypeEnumInt != (int)UserTypeEnum.ProjectManager)
|
if (_userInfo.UserTypeEnumInt != (int)UserTypeEnum.ProjectManager)
|
||||||
|
@ -459,6 +460,9 @@ namespace IRaCIS.Core.Application.Image.QA
|
||||||
|
|
||||||
await _repository.BatchDeleteAsync<TrialQCQuestionAnswer>(t => t.SubjectVisitId == subjectVisitId);
|
await _repository.BatchDeleteAsync<TrialQCQuestionAnswer>(t => t.SubjectVisitId == subjectVisitId);
|
||||||
|
|
||||||
|
await _repository.BatchDeleteAsync<DicomInstance>(t => t.DicomSerie.IsDeleted);
|
||||||
|
await _repository.BatchDeleteAsync<DicomSeries>(t => t.IsDeleted);
|
||||||
|
|
||||||
var success = await _subjectVisitRepository.SaveChangesAsync();
|
var success = await _subjectVisitRepository.SaveChangesAsync();
|
||||||
|
|
||||||
|
|
||||||
|
@ -1616,6 +1620,8 @@ namespace IRaCIS.Core.Application.Image.QA
|
||||||
await _repository.BatchUpdateAsync<QCChallenge>(t => t.SubjectVisitId == qcChallenge.SubjectVisitId && t.CurrentQCEnum == CurrentQC.Second, k => new QCChallenge() { CurrentQCEnum = CurrentQC.First });
|
await _repository.BatchUpdateAsync<QCChallenge>(t => t.SubjectVisitId == qcChallenge.SubjectVisitId && t.CurrentQCEnum == CurrentQC.Second, k => new QCChallenge() { CurrentQCEnum = CurrentQC.First });
|
||||||
await _repository.BatchUpdateAsync<TrialQCQuestionAnswer>(t => t.SubjectVisitId == qcChallenge.SubjectVisitId && t.CurrentQCEnum == CurrentQC.Second, k => new TrialQCQuestionAnswer() { CurrentQCEnum = CurrentQC.First });
|
await _repository.BatchUpdateAsync<TrialQCQuestionAnswer>(t => t.SubjectVisitId == qcChallenge.SubjectVisitId && t.CurrentQCEnum == CurrentQC.Second, k => new TrialQCQuestionAnswer() { CurrentQCEnum = CurrentQC.First });
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -467,7 +467,7 @@ namespace IRaCIS.Core.Infra.EFCore
|
||||||
{
|
{
|
||||||
if (deleteFilter == null) throw new ArgumentNullException(nameof(deleteFilter));
|
if (deleteFilter == null) throw new ArgumentNullException(nameof(deleteFilter));
|
||||||
|
|
||||||
return await _dbContext.Set<T>().AsNoTracking().Where(deleteFilter).BatchDeleteAsync().ConfigureAwait(false) > 0;
|
return await _dbContext.Set<T>().AsNoTracking().IgnoreQueryFilters().Where(deleteFilter).BatchDeleteAsync().ConfigureAwait(false) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<bool> BatchUpdateAsync<T>(Expression<Func<T, bool>> whereFilter, Expression<Func<T, T>> updateFactory) where T : Entity
|
public async Task<bool> BatchUpdateAsync<T>(Expression<Func<T, bool>> whereFilter, Expression<Func<T, T>> updateFactory) where T : Entity
|
||||||
|
|
Loading…
Reference in New Issue