using Microsoft.AspNetCore.Mvc; using IRaCIS.Core.Application.Interfaces; using IRaCIS.Core.Application.ViewModel; using IRaCIS.Core.Infra.EFCore.Common; using MassTransit; using IRaCIS.Core.Infrastructure; using IRaCIS.Core.Domain.Share; using IRaCIS.Core.Application.Service.Reading.Dto; using Panda.DynamicWebApi.Attributes; namespace IRaCIS.Core.Application.Service.TA { [ApiExplorerSettings(GroupName = "Reading")] public class ReadingQuestionService : BaseService { private readonly IRepository _tumorAssessmentRepository; public ReadingQuestionService( IRepository tumorAssessmentRepository ) { this._tumorAssessmentRepository = tumorAssessmentRepository; } /// /// 获取疗效对照 /// /// [HttpPost] public async Task> GetTumorAssessmentList(GetTumorAssessmentListInDto inDto) { var result = await _tumorAssessmentRepository .Where(x => x.CriterionId == inDto.CriterionId) .WhereIf(inDto.OverallEfficacy != null, x => x.OverallEfficacy == inDto.OverallEfficacy) .WhereIf(inDto.TargetLesion != null, x => x.TargetLesion == inDto.TargetLesion) .WhereIf(inDto.NonTargetLesions != null, x => x.NonTargetLesions == inDto.NonTargetLesions) .WhereIf(inDto.NewLesion != null, x => x.NewLesion == inDto.NewLesion) .ProjectTo(_mapper.ConfigurationProvider).ToListAsync(); return result; } /// /// 获取疗效对照 /// /// [HttpPost] public async Task> GetTumorAssessmentPageList(GetTumorAssessmentListInDto inQuery) { var query = _tumorAssessmentRepository .Where(x => x.CriterionId == inQuery.CriterionId) .WhereIf(inQuery.OverallEfficacy != null, x => x.OverallEfficacy == inQuery.OverallEfficacy) .WhereIf(inQuery.TargetLesion != null, x => x.TargetLesion == inQuery.TargetLesion) .WhereIf(inQuery.NonTargetLesions != null, x => x.NonTargetLesions == inQuery.NonTargetLesions) .WhereIf(inQuery.NewLesion != null, x => x.NewLesion == inQuery.NewLesion) .ProjectTo(_mapper.ConfigurationProvider); return await query.ToPagedListAsync(inQuery.PageIndex, inQuery.PageSize, string.IsNullOrWhiteSpace(inQuery.SortField) ? nameof(TumorAssessmentView.Id) : inQuery.SortField, inQuery.Asc); } /// /// 新增修改疗效对照 /// /// /// [HttpPost] public async Task AddOrUpdateTumorAssessment(AddOrUpdateTumorAssessmentInDto indto) { var entity = await _tumorAssessmentRepository.InsertOrUpdateAsync(indto, true); return ResponseOutput.Ok(entity.Id.ToString()); } /// /// 删除疗效对照 /// /// /// [HttpDelete("{Id:guid}")] public async Task DeleteTumorAssessment(Guid Id) { await _tumorAssessmentRepository.DeleteFromQueryAsync(t => t.Id == Id); var success = await _tumorAssessmentRepository.SaveChangesAsync(); return ResponseOutput.Result(success); } } }