修改一版

Uat_Study
he 2022-06-13 11:55:51 +08:00
parent 040f80f988
commit 1c456c68bc
1 changed files with 3 additions and 3 deletions

View File

@ -377,7 +377,7 @@ namespace IRaCIS.Application.Services
/// <returns></returns>
public async Task<List<GetSubjectReadVisitsOutDto>> GetSubjectReadVisitList(GetSubjectReadVisitsInDto inDto)
{
var maxReadVisit = await _readModuleRepository.Where(x => x.SubjectId == inDto.SubjectId&&x.ReadingSetType==inDto.ReadingSetType && x.ModuleType != ModuleTypeEnum.Global).OrderByDescending(x=>x.VisitNum).FirstOrDefaultAsync();
var maxReadVisit = await _readModuleRepository.Where(x => x.SubjectId == inDto.SubjectId&&x.ReadingSetType==inDto.ReadingSetType).OrderByDescending(x=>x.VisitNum).FirstOrDefaultAsync();
var maxReadVisitNum= maxReadVisit==null?0:maxReadVisit.VisitNum;
var visitQuery = _subjectVisitRepository.Where(x => x.SubjectId == inDto.SubjectId && x.LatestScanDate != null&&!x.IsLostVisit);
var finalVisitNum = await visitQuery.Where(x => x.IsFinalVisit).Select(x => x.VisitNum).FirstOrDefaultAsync();
@ -385,7 +385,7 @@ namespace IRaCIS.Application.Services
var readModulequery = _readModuleRepository.AsQueryable();
var resultlist= await visitQuery.WhereIf(finalVisitNum != null&& finalVisitNum!=0, x => x.VisitNum <= finalVisitNum)
.Where(x=>x.VisitNum>= maxReadVisitNum)
.Where(x=>x.VisitNum> maxReadVisitNum)
.Where(x => readModulequery.Where(y => y.SubjectVisitId == x.Id && y.ReadingSetType == inDto.ReadingSetType).Count() == 0).OrderBy(x => finalVisitNum)
.Select(x => new GetSubjectReadVisitsOutDto()
{
@ -405,7 +405,7 @@ namespace IRaCIS.Application.Services
[HttpPost]
public async Task<IResponseOutput> AddReadModule(ReadModuleAddDto dto)
{
var visitQuery = _subjectVisitRepository.Where(x => x.SubjectId == dto.SubjectId && x.InPlan);
var visitQuery = _subjectVisitRepository.Where(x => x.SubjectId == dto.SubjectId);
visitQuery = visitQuery.WhereIf(dto.ExpirationDate != null, x => x.LatestScanDate <= dto.ExpirationDate.Value)
.WhereIf(dto.ExpirationVisitNum != null, x => x.VisitNum <= dto.ExpirationVisitNum.Value);