修改
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
70c7f8a740
commit
67b226ee44
|
@ -1,5 +1,7 @@
|
|||
using IRaCIS.Application.Contracts;
|
||||
using IRaCIS.Application.Interfaces;
|
||||
using IRaCIS.Core.Application.ViewModel;
|
||||
using IRaCIS.Core.Infrastructure.Extention;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Panda.DynamicWebApi.Attributes;
|
||||
|
||||
|
@ -9,7 +11,9 @@ namespace IRaCIS.Core.Application.Service
|
|||
/// 医生文档关联关系维护
|
||||
/// </summary>
|
||||
[ApiExplorerSettings(GroupName = "Reviewer")]
|
||||
public class AttachmentService(IRepository<Attachment> _attachmentrepository, IRepository<Doctor> _doctorrepository, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService, IAttachmentService
|
||||
public class AttachmentService(IRepository<Attachment> _attachmentrepository,
|
||||
IRepository<Enroll> _enrollRepository,
|
||||
IRepository<Doctor> _doctorrepository, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService, IAttachmentService
|
||||
{
|
||||
|
||||
|
||||
|
@ -90,7 +94,71 @@ namespace IRaCIS.Core.Application.Service
|
|||
}
|
||||
|
||||
|
||||
//public async Task<>
|
||||
/// <summary>
|
||||
/// 获取项目医生附件
|
||||
/// </summary>
|
||||
/// <param name="inDto"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<PageOutput<AttachmentDTO>> GetTrialAttachments(GetTrialAttachmentsInDto inDto)
|
||||
{
|
||||
var doctorIds =await _enrollRepository.Where(x => x.TrialId == inDto.TrialId && x.EnrollStatus >= EnrollStatus.InviteIntoGroup).Select(x => x.DoctorId).ToListAsync();
|
||||
|
||||
var ids = doctorIds.Select(x=>(Guid?)x).ToList();
|
||||
|
||||
var attachmentList = await _attachmentrepository
|
||||
.WhereIf(inDto.DoctorId!=null,x=>x.DoctorId==inDto.DoctorId)
|
||||
.WhereIf(inDto.IsAuthorizedView != null, x => x.IsAuthorizedView == inDto.IsAuthorizedView)
|
||||
.WhereIf(inDto.Type.IsNotNullOrEmpty(), x => x.Type == inDto.Type)
|
||||
.WhereIf(inDto.FileName.IsNotNullOrEmpty(), x => inDto.FileName.Contains(x.FileName))
|
||||
|
||||
.Where(a => ids.Contains(a.DoctorId)||a.TrialId==inDto.TrialId ).ProjectTo<AttachmentDTO>(_mapper.ConfigurationProvider).ToPagedListAsync(inDto);
|
||||
|
||||
|
||||
return attachmentList;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改稽查状态
|
||||
/// </summary>
|
||||
/// <param name="inDto"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<IResponseOutput> SetAuthorizedView(SetAttachmentAuthorizedView inDto)
|
||||
{
|
||||
await _attachmentrepository.UpdatePartialFromQueryAsync(x => x.Id == inDto.Id, x => new Attachment() { IsAuthorizedView = inDto.IsAuthorizedView }, true);
|
||||
return ResponseOutput.Ok();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 上传项目医生
|
||||
/// </summary>
|
||||
/// <param name="attachmentList"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<IEnumerable<AttachmentDTO>> SaveTrialAttachments(IEnumerable<AttachmentDTO> attachmentList)
|
||||
{
|
||||
foreach (var item in attachmentList)
|
||||
{
|
||||
if (item.DoctorId != null)
|
||||
{
|
||||
await _attachmentrepository.BatchDeleteNoTrackingAsync(a => a.DoctorId == item.DoctorId && a.Type == item.Type);
|
||||
}
|
||||
}
|
||||
|
||||
var attachments = _mapper.Map<IEnumerable<Attachment>>(attachmentList).ToList();
|
||||
var newAttachment = attachments.Where(t => t.Id == Guid.Empty);
|
||||
await _attachmentrepository.AddRangeAsync(newAttachment);
|
||||
await _attachmentrepository.SaveChangesAsync();
|
||||
|
||||
var list = _mapper.Map<IEnumerable<AttachmentDTO>>(attachments).ToList();
|
||||
|
||||
list.ForEach(t => t.FullPath = t.Path + "?access_token=" + _userInfo.UserToken);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
[NonDynamicMethod]
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
public class AttachmentDTO
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public Guid DoctorId { get; set; }
|
||||
public Guid? DoctorId { get; set; }
|
||||
public bool IsOfficial { get; set; }
|
||||
public string Type { get; set; } = string.Empty;
|
||||
public string Path { get; set; } = string.Empty;
|
||||
|
@ -13,8 +13,30 @@
|
|||
public int Language { get; set; }
|
||||
|
||||
public bool ReUpload { get; set; } = false;
|
||||
|
||||
public Guid? TrialId { get; set; }
|
||||
}
|
||||
|
||||
public class SetAttachmentAuthorizedView
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
|
||||
public bool IsAuthorizedView { get; set; }
|
||||
}
|
||||
|
||||
|
||||
public class GetTrialAttachmentsInDto:PageInput
|
||||
{
|
||||
public Guid TrialId { get; set; }
|
||||
|
||||
public string? Type { get; set; }
|
||||
|
||||
public Guid? DoctorId { get; set; }
|
||||
|
||||
public string? FileName { get; set; }
|
||||
|
||||
public bool? IsAuthorizedView { get; set; }
|
||||
}
|
||||
public class ReviewerAckDTO
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
|
|
|
@ -12,7 +12,7 @@ public class Attachment : BaseAddAuditEntity
|
|||
[Comment("编码")]
|
||||
public string Code { get; set; } = null!;
|
||||
|
||||
public Guid DoctorId { get; set; }
|
||||
public Guid? DoctorId { get; set; }
|
||||
|
||||
[Comment("过期时间")]
|
||||
public DateTime? ExpiryDate { get; set; }
|
||||
|
@ -30,4 +30,16 @@ public class Attachment : BaseAddAuditEntity
|
|||
|
||||
[Comment("文件类型名")]
|
||||
public string Type { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// 项目Id
|
||||
/// </summary>
|
||||
public Guid? TrialId { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 是否授权
|
||||
/// </summary>
|
||||
|
||||
public bool IsAuthorizedView { get; set; } = false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue