91 lines
2.9 KiB
C#
91 lines
2.9 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 IRaCIS.Core.Application.Contracts;
|
|
|
|
namespace IRaCIS.Application.Services
|
|
{
|
|
/// <summary>
|
|
/// 临床数据 原表
|
|
/// </summary>
|
|
[ApiExplorerSettings(GroupName = "Reading")]
|
|
public class PreviousPDFService : BaseService
|
|
{
|
|
|
|
public IRepository<SubjectVisit> _subjectVisitRepository;
|
|
private readonly IRepository<PreviousPDF> _previousPDFRepository;
|
|
|
|
public PreviousPDFService(IRepository<SubjectVisit> subjectVisitRepository,
|
|
IRepository<PreviousPDF> PreviousPDFRepository
|
|
)
|
|
{
|
|
_subjectVisitRepository = subjectVisitRepository;
|
|
_previousPDFRepository = PreviousPDFRepository;
|
|
|
|
}
|
|
|
|
#region 历史 接口名暂未修改
|
|
|
|
|
|
/// <summary>
|
|
/// 新增或者修改
|
|
/// </summary>
|
|
/// <param name="addOrEditPreviousPDF"></param>
|
|
/// <returns></returns>
|
|
[HttpPost]
|
|
public async Task<IResponseOutput> AddOrUpdateReadingPreviousPDF(PreviousPDFAddOrEdit addOrEditPreviousPDF)
|
|
{
|
|
var entity = await _repository.InsertOrUpdateAsync<PreviousPDF, PreviousPDFAddOrEdit>(addOrEditPreviousPDF, true);
|
|
return ResponseOutput.Ok(entity.Id.ToString());
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// 获取
|
|
/// </summary>
|
|
/// <param name="query"></param>
|
|
/// <returns></returns>
|
|
[HttpPost]
|
|
public async Task<dynamic> GetPreviousPDFList(PreviousPDFInDto inDto)
|
|
{
|
|
var list= await _previousPDFRepository.AsQueryable().Where(x => x.TrialId == inDto.TrialId)
|
|
.Where(x => (x.ClinicalLevel == ClinicalLevel.Subject && x.SubjectId == inDto.SubjectId) || x.SubjectVisitId == inDto.VisitOrReadId)
|
|
.Select(x=>new {
|
|
x.Path,
|
|
x.DataType,
|
|
x.CreateTime,
|
|
x.ClinicalLevel,
|
|
x.FileName,
|
|
x.UploadType,
|
|
x.Id,
|
|
}).ToListAsync();
|
|
return list;
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
/// <summary>
|
|
/// 删除
|
|
/// </summary>
|
|
/// <param name="previousPDFId"></param>
|
|
/// <returns></returns>
|
|
[HttpDelete("{previousPDFId:guid}")]
|
|
public async Task<IResponseOutput> DeletePreviousPDF(Guid previousPDFId)
|
|
{
|
|
var success = await _previousPDFRepository.DeleteFromQueryAsync(t => t.Id == previousPDFId,true);
|
|
return ResponseOutput.Result(true);
|
|
}
|
|
}
|
|
}
|