From 1c456c68bcdd3af3978785a359110c5f0d0a2dda Mon Sep 17 00:00:00 2001
From: he <10978375@qq.com>
Date: Mon, 13 Jun 2022 11:55:51 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=80=E7=89=88?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Service/Reading/ReadModuleService.cs | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/IRaCIS.Core.Application/Service/Reading/ReadModuleService.cs b/IRaCIS.Core.Application/Service/Reading/ReadModuleService.cs
index f346b1870..944ae2eed 100644
--- a/IRaCIS.Core.Application/Service/Reading/ReadModuleService.cs
+++ b/IRaCIS.Core.Application/Service/Reading/ReadModuleService.cs
@@ -377,7 +377,7 @@ namespace IRaCIS.Application.Services
///
public async Task> 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 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);