修改
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
1617de2fc1
commit
e55a13cfb1
|
|
@ -127,6 +127,18 @@ namespace IRaCIS.Core.Application.Service.Reading.Dto
|
|||
public Guid? TrialReadingCriterionId { get; set; }
|
||||
}
|
||||
|
||||
public class SetBatchAddOrRemoveReadingPlanInDto
|
||||
{
|
||||
public List<Guid> SubjectVisitIdList { get; set; } = new List<Guid>();
|
||||
|
||||
/// <summary>
|
||||
/// 是否加入阅片计划
|
||||
/// </summary>
|
||||
public bool IsJoin { get; set; }
|
||||
|
||||
public Guid Id { get; set; }
|
||||
}
|
||||
|
||||
public class PreviewTheReadingListInDto : PageInput
|
||||
{
|
||||
|
||||
|
|
|
|||
|
|
@ -83,11 +83,42 @@ namespace IRaCIS.Core.Application.Service
|
|||
TrialSiteId = x,
|
||||
}).ToList();
|
||||
|
||||
// 修改了就是重新生成计划
|
||||
if (await IsChangeReadingPlan(new IsChangeReadingPlanInDto()
|
||||
{
|
||||
|
||||
Id = addOrEditReadingPeriodSet.Id,
|
||||
ExpirationDate = addOrEditReadingPeriodSet.ExpirationDate,
|
||||
ReadingScope = addOrEditReadingPeriodSet.ReadingScope.Value,
|
||||
TrialId = addOrEditReadingPeriodSet.TrialId,
|
||||
ExpirationVisitNum = addOrEditReadingPeriodSet.ExpirationVisitNum,
|
||||
VisitStageId = addOrEditReadingPeriodSet.VisitStageId,
|
||||
ReadingSetType = addOrEditReadingPeriodSet.ReadingSetType,
|
||||
TrialReadingCriterionId = addOrEditReadingPeriodSet.TrialReadingCriterionId,
|
||||
SiteIds = addOrEditReadingPeriodSet.SiteIds,
|
||||
}))
|
||||
{
|
||||
|
||||
entity.ReadingPeriodPlanList = addOrEditReadingPeriodSet.SubjectVisitIds.Select(x => new ReadingPeriodPlan
|
||||
{
|
||||
ReadingPeriodSetId = entity.Id,
|
||||
SubjectVisitId = x,
|
||||
}).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
var existsVisitIds = await _readingPeriodPlanRepository.Where(x => x.ReadingPeriodSetId == addOrEditReadingPeriodSet.Id).Select(x => x.SubjectVisitId).ToListAsync();
|
||||
|
||||
var needaddIds = addOrEditReadingPeriodSet.SubjectVisitIds.Where(x => !existsVisitIds.Contains(x)).ToList();
|
||||
|
||||
entity.ReadingPeriodPlanList.AddRange(needaddIds.Select(x => new ReadingPeriodPlan()
|
||||
{
|
||||
ReadingPeriodSetId = entity.Id,
|
||||
SubjectVisitId = x,
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
|
||||
var success = await _readingPeriodSetRepository.SaveChangesAsync();
|
||||
return ResponseOutput.Ok(entity.Id);
|
||||
|
|
@ -498,6 +529,45 @@ namespace IRaCIS.Core.Application.Service
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置加入或者移除阅片计划
|
||||
/// </summary>
|
||||
/// <param name="inDto"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<IResponseOutput> SetBatchAddOrRemoveReadingPlan(SetBatchAddOrRemoveReadingPlanInDto inDto)
|
||||
{
|
||||
|
||||
|
||||
if (inDto.IsJoin)
|
||||
{
|
||||
var existsVisitIds = await _readingPeriodPlanRepository.Where(x => x.ReadingPeriodSetId == inDto.Id).Select(x => x.SubjectVisitId).ToListAsync();
|
||||
|
||||
inDto.SubjectVisitIdList = inDto.SubjectVisitIdList.Where(x => !existsVisitIds.Contains(x)).ToList();
|
||||
|
||||
List<ReadingPeriodPlan> plans = inDto.SubjectVisitIdList.Select(x => new ReadingPeriodPlan()
|
||||
{
|
||||
SubjectVisitId = x,
|
||||
ReadingPeriodSetId = inDto.Id
|
||||
}).ToList();
|
||||
|
||||
await _readingPeriodPlanRepository.AddRangeAsync(plans);
|
||||
}
|
||||
else
|
||||
{
|
||||
await _readingPeriodPlanRepository.UpdatePartialFromQueryAsync(x => x.ReadingPeriodSetId == inDto.Id && inDto.SubjectVisitIdList.Contains(x.SubjectVisitId), x => new ReadingPeriodPlan()
|
||||
{
|
||||
IsDeleted = true
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
await _readingPeriodPlanRepository.SaveChangesAsync();
|
||||
|
||||
|
||||
return ResponseOutput.Ok(true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取影像阅片的预览 // 需要清除之前已经选中的 (增加标准搜索,已修改)
|
||||
/// </summary>
|
||||
|
|
|
|||
Loading…
Reference in New Issue