Uat_Study
he 2022-04-01 15:27:22 +08:00
parent 6e9871b099
commit 75b7c35bfb
4 changed files with 21 additions and 15 deletions

View File

@ -14,11 +14,11 @@ namespace IRaCIS.Application.Services
[ApiExplorerSettings(GroupName = "Reviewer")]
public class AttachmentService : BaseService, IAttachmentService
{
private readonly IRepository<Attachment> attachmentrepository;
private readonly IRepository<Attachment> _attachmentrepository;
public AttachmentService(IRepository<Attachment> attachmentrepository)
{
this.attachmentrepository = attachmentrepository;
this._attachmentrepository = attachmentrepository;
}
/// <summary>
@ -42,7 +42,7 @@ namespace IRaCIS.Application.Services
// File.Delete(temp);
//}
var success =await attachmentrepository.DeleteFromQueryAsync(a => a.Id == param.Id);
var success =await _attachmentrepository.DeleteFromQueryAsync(a => a.Id == param.Id);
return ResponseOutput.Result(success);
}
@ -56,7 +56,7 @@ namespace IRaCIS.Application.Services
[HttpGet("{doctorId:guid}/{type}")]
public async Task<IEnumerable<AttachmentDTO>> GetAttachmentByType(Guid doctorId, string type)
{
var attachmentList = await attachmentrepository.Where(a => a.DoctorId == doctorId && a.Type.Equals(type)).ProjectTo<AttachmentDTO>(_mapper.ConfigurationProvider).ToListAsync();
var attachmentList = await _attachmentrepository.Where(a => a.DoctorId == doctorId && a.Type.Equals(type)).ProjectTo<AttachmentDTO>(_mapper.ConfigurationProvider).ToListAsync();
attachmentList.ForEach(t => t.FullPath = t.Path + "?access_token=" + _userInfo.UserToken);
return attachmentList;
@ -72,7 +72,7 @@ namespace IRaCIS.Application.Services
public async Task<IEnumerable<AttachmentDTO>> GetAttachmentByTypes(Guid doctorId, string[] types)
{
var attachmentList =await attachmentrepository.Where(a => a.DoctorId == doctorId && types.Contains(a.Type)).OrderBy(s => s.Type).ThenBy(m => m.CreateTime).ProjectTo<AttachmentDTO>(_mapper.ConfigurationProvider).ToListAsync();
var attachmentList =await _attachmentrepository.Where(a => a.DoctorId == doctorId && types.Contains(a.Type)).OrderBy(s => s.Type).ThenBy(m => m.CreateTime).ProjectTo<AttachmentDTO>(_mapper.ConfigurationProvider).ToListAsync();
attachmentList.ForEach(t => t.FullPath = t.Path + "?access_token=" + _userInfo.UserToken);
return attachmentList;
@ -86,7 +86,7 @@ namespace IRaCIS.Application.Services
[HttpGet("{doctorId:guid}")]
public async Task<IEnumerable<AttachmentDTO>> GetAttachments(Guid doctorId)
{
var attachmentList =await attachmentrepository.Where(a => a.DoctorId == doctorId).OrderBy(s => s.Type).ThenBy(m => m.CreateTime).ProjectTo<AttachmentDTO>(_mapper.ConfigurationProvider).ToListAsync();
var attachmentList =await _attachmentrepository.Where(a => a.DoctorId == doctorId).OrderBy(s => s.Type).ThenBy(m => m.CreateTime).ProjectTo<AttachmentDTO>(_mapper.ConfigurationProvider).ToListAsync();
attachmentList.ForEach(t => t.FullPath = t.Path + "?access_token=" + _userInfo.UserToken);
return attachmentList;
@ -95,7 +95,7 @@ namespace IRaCIS.Application.Services
[NonDynamicMethod]
public async Task<AttachmentDTO> GetDetailById(Guid attachmentId)
{
var attachment = await attachmentrepository.FirstOrDefaultAsync(a => a.Id == attachmentId).IfNullThrowException();
var attachment = await _attachmentrepository.FirstOrDefaultAsync(a => a.Id == attachmentId).IfNullThrowException();
var temp= _mapper.Map<AttachmentDTO>(attachment);
temp.FullPath = temp.Path + "?access_token=" + _userInfo.UserToken;
return temp;
@ -139,7 +139,7 @@ namespace IRaCIS.Application.Services
//重传的时候,发现 相同语言的官方简历数量为2 那么将重传的简历设置为非官方
if (attachments.Count(t => t.Language == reUpload.Language && t.IsOfficial) == 2)
{
await attachmentrepository.UpdateFromQueryAsync(t => t.Id == reUpload.Id, u => new Attachment()
await _attachmentrepository.UpdateFromQueryAsync(t => t.Id == reUpload.Id, u => new Attachment()
{
Path = reUpload.Path,
CreateTime = DateTime.Now,
@ -150,7 +150,7 @@ namespace IRaCIS.Application.Services
}
else //相同语言的重传
{
await attachmentrepository.UpdateFromQueryAsync(t => t.Id == reUpload.Id, u => new Attachment()
await _attachmentrepository.UpdateFromQueryAsync(t => t.Id == reUpload.Id, u => new Attachment()
{
Path = reUpload.Path,
CreateTime = DateTime.Now,
@ -182,7 +182,7 @@ namespace IRaCIS.Application.Services
var newAttachment = _mapper.Map<Attachment>(attachment);
//如果这个医生不存在 这个语言的官方简历 就设置为官方简历
if (! await attachmentrepository.AnyAsync(t => t.Type == "Resume" && t.DoctorId == attachment.DoctorId && t.Language == attachment.Language && t.IsOfficial))
if (! await _attachmentrepository.AnyAsync(t => t.Type == "Resume" && t.DoctorId == attachment.DoctorId && t.Language == attachment.Language && t.IsOfficial))
{
newAttachment.IsOfficial = true;
@ -198,7 +198,7 @@ namespace IRaCIS.Application.Services
[NonDynamicMethod]
public async Task<string> GetDoctorOfficialCV(int language, Guid doctorId)
{
var result = await attachmentrepository.FirstOrDefaultAsync(a => a.DoctorId == doctorId &&
var result = await _attachmentrepository.FirstOrDefaultAsync(a => a.DoctorId == doctorId &&
a.IsOfficial && a.Type.Equals("Resume") && a.Language == language);
if (result != null)
{
@ -241,7 +241,7 @@ namespace IRaCIS.Application.Services
[HttpPost("{doctorId:guid}/{attachmentId:guid}/{language}")]
public async Task<IResponseOutput> SetLanguage(Guid doctorId, Guid attachmentId, int language)
{
bool result =await attachmentrepository.UpdateFromQueryAsync(t => t.Id == attachmentId, a => new Attachment
bool result =await _attachmentrepository.UpdateFromQueryAsync(t => t.Id == attachmentId, a => new Attachment
{
Language = language,
IsOfficial = false

View File

@ -109,6 +109,9 @@ namespace IRaCIS.Application.Contracts
public int? InPlanVisitCount { get; set; }
public int? InPlanVisitSubmmitCount { get; set; }
public string FinalSubjectVisitName { get; set; }
public int? MissingSubmmitCount { get; set; }
public int? LostVisitCount { get; set; }

View File

@ -51,6 +51,7 @@ namespace IRaCIS.Core.Application.Service
//.ForMember(d => d.InPlanNoneDicomStudyUploadCount, u => u.MapFrom(s => s.SubjectVisitList.Where(t => t.InPlan).SelectMany(k => k.NoneDicomStudyList).Count()))
//.ForMember(d => d.OutPlanNoneDicomStudyUploadCount, u => u.MapFrom(s => s.SubjectVisitList.Where(t => t.InPlan == false).SelectMany(k => k.NoneDicomStudyList).Count()))
.ForMember(d => d.FinalSubjectVisitId, u => u.MapFrom(s => s.SubjectVisitList.Where(t => t.IsFinalVisit).Select(c=>(Guid?) c.Id).FirstOrDefault()))
.ForMember(d => d.FinalSubjectVisitName, u => u.MapFrom(s => s.SubjectVisitList.Where(t => t.IsFinalVisit).Select(c => c.VisitName).FirstOrDefault()))
.ForMember(d => d.InPlanVisitCount, u => u.MapFrom(s => s.SubjectVisitList.Count(t => t.InPlan)))
.ForMember(d => d.OutPlanVisitCount, u => u.MapFrom(s => s.SubjectVisitList.Count(t => t.InPlan == false)))
//执行不一定上传了 可能是失访 实际执行过了

View File

@ -13,10 +13,12 @@ namespace IRaCIS.Core.Domain.Models
{
public List<SubjectVisit> SubjectVisitList { get; set; } = new List<SubjectVisit>();
//受试者有TrialId SiteId
//public List<TrialSiteUser> TrialSiteUserList { get; set; } = new List<TrialSiteUser>();
//public List<SubjectVisit> LastSubjectVisit { get; set; } = SubjectVisitList.where;
//受试者有TrialId SiteId
//public List<TrialSiteUser> TrialSiteUserList { get; set; } = new List<TrialSiteUser>();
//需要配置是两个键连接
public TrialSite TrialSite { get; set; }