135 lines
6.1 KiB
C#
135 lines
6.1 KiB
C#
using IRaCIS.Application.Interfaces;
|
|
using IRaCIS.Core.Infra.EFCore;
|
|
using IRaCIS.Core.Domain.Share;
|
|
using IRaCIS.Core.Application.Filter;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using IRaCIS.Core.Application.Service.WorkLoad.DTO;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using IRaCIS.Core.Application.Auth;
|
|
using IRaCIS.Core.Application.Service.Reading.Dto;
|
|
using IRaCIS.Core.Domain.Share.Reading;
|
|
using MassTransit;
|
|
using IRaCIS.Core.Application.Service.Reading;
|
|
using IRaCIS.Core.Infra.EFCore.Common;
|
|
|
|
namespace IRaCIS.Application.Services
|
|
{
|
|
/// <summary>
|
|
/// 阅片问题.标准
|
|
/// </summary>
|
|
[ApiExplorerSettings(GroupName = "Reading")]
|
|
public class ReadingQuestionService : BaseService
|
|
{
|
|
|
|
public IRepository<SubjectVisit> _subjectVisitRepository;
|
|
private readonly IRepository<ReadingQuestionCriterionSystem> _readingQuestionCriterionSystemRepository;
|
|
private readonly IRepository<ReadingQuestionSystem> _readingQuestionSystemRepository;
|
|
private readonly IRepository<ClinicalDataTrialSet> _clinicalDataTrialSetRepository;
|
|
private readonly IRepository<ClinicalDataSystemSet> _clinicalDataSystemSetRepository;
|
|
private readonly IRepository<PreviousPDF> _previousPDFRepository;
|
|
|
|
public ReadingQuestionService(IRepository<SubjectVisit> subjectVisitRepository,
|
|
|
|
IRepository<ReadingQuestionCriterionSystem> readingQuestionCriterionSystemRepository,
|
|
IRepository<ReadingQuestionSystem> readingQuestionSystemRepository,
|
|
IRepository<ClinicalDataTrialSet> ClinicalDataTrialSetRepository,
|
|
IRepository<ClinicalDataSystemSet> ClinicalDataSystemSetRepository,
|
|
IRepository<PreviousPDF> previousPDFRepository
|
|
)
|
|
{
|
|
_subjectVisitRepository = subjectVisitRepository;
|
|
this._readingQuestionCriterionSystemRepository = readingQuestionCriterionSystemRepository;
|
|
this._readingQuestionSystemRepository = readingQuestionSystemRepository;
|
|
_clinicalDataTrialSetRepository = ClinicalDataTrialSetRepository;
|
|
_clinicalDataSystemSetRepository = ClinicalDataSystemSetRepository;
|
|
this._previousPDFRepository = previousPDFRepository;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 新增修改系统问题标准
|
|
/// </summary>
|
|
/// <param name="indto"></param>
|
|
/// <returns></returns>
|
|
[HttpPost]
|
|
public async Task<IResponseOutput> AddOrUpdateReadingQuestionCriterionSystem(AddOrUpdateReadingQuestionCriterionSystemInDto indto)
|
|
{
|
|
var entity = await _readingQuestionCriterionSystemRepository.InsertOrUpdateAsync(indto,true);
|
|
return ResponseOutput.Ok(entity.Id.ToString());
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取系统问题标准
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[HttpPost]
|
|
public async Task<PageOutput<ReadingQuestionCriterionSystemView>> GetReadingQuestionCriterionSystemList(ReadingQuestionCriterionSystemViewInDto inDto)
|
|
{
|
|
var query= _readingQuestionCriterionSystemRepository.AsQueryable()
|
|
.WhereIf(!inDto.CriterionName.IsNullOrEmpty(), x => x.CriterionName.Contains(inDto.CriterionName))
|
|
.ProjectTo<ReadingQuestionCriterionSystemView>(_mapper.ConfigurationProvider);
|
|
return await query.ToPagedListAsync(inDto.PageIndex, inDto.PageSize, inDto.SortField == null ? nameof(ReadingQuestionCriterionSystemView.CriterionName) : inDto.SortField,
|
|
inDto.Asc);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 删除系统问题标准
|
|
/// </summary>
|
|
/// <param name="readingQuestionCriterionSystemId"></param>
|
|
/// <returns></returns>
|
|
[HttpDelete("{readingQuestionCriterionSystemId:guid}")]
|
|
public async Task<IResponseOutput> DeleteReadingQuestionCriterionSystem(Guid readingQuestionCriterionSystemId)
|
|
{
|
|
await _readingQuestionCriterionSystemRepository.DeleteFromQueryAsync(t => t.Id == readingQuestionCriterionSystemId);
|
|
var success = await _readingQuestionCriterionSystemRepository.SaveChangesAsync();
|
|
return ResponseOutput.Result(success);
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// 新增修改系统问题
|
|
/// </summary>
|
|
/// <param name="indto"></param>
|
|
/// <returns></returns>
|
|
[HttpPost]
|
|
public async Task<IResponseOutput> AddOrUpdateReadingQuestionSystem(AddOrUpdateReadingQuestionSystemInDto indto)
|
|
{
|
|
var entity = await _readingQuestionSystemRepository.InsertOrUpdateAsync(indto, true);
|
|
return ResponseOutput.Ok(entity.Id.ToString());
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取系统问题
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[HttpPost]
|
|
public async Task<PageOutput<ReadingQuestionSystemView>> GetReadingQuestionSystemList(ReadingQuestionSystemViewInDto inDto)
|
|
{
|
|
var query = _readingQuestionSystemRepository.AsQueryable()
|
|
.Where(x=>x.ReadingQuestionCriterionSystemId==inDto.ReadingQuestionCriterionSystemId)
|
|
.WhereIf(!inDto.QuestionName.IsNullOrEmpty(), x => x.QuestionName.Contains(inDto.QuestionName))
|
|
.WhereIf(!inDto.Type.IsNullOrEmpty(), x => x.Type.Contains(inDto.Type))
|
|
.ProjectTo<ReadingQuestionSystemView>(_mapper.ConfigurationProvider);
|
|
return await query.ToPagedListAsync(inDto.PageIndex, inDto.PageSize, inDto.SortField == null ? nameof(ReadingQuestionSystemView.QuestionName) : inDto.SortField,
|
|
inDto.Asc);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 删除系统问题
|
|
/// </summary>
|
|
/// <param name="readingQuestionSystemId"></param>
|
|
/// <returns></returns>
|
|
[HttpDelete("{readingQuestionSystemId:guid}")]
|
|
public async Task<IResponseOutput> DeleteReadingQuestionSystem(Guid readingQuestionSystemId)
|
|
{
|
|
await _readingQuestionSystemRepository.DeleteFromQueryAsync(t => t.Id == readingQuestionSystemId);
|
|
var success = await _readingQuestionSystemRepository.SaveChangesAsync();
|
|
return ResponseOutput.Result(success);
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|