稽查访视修改
parent
a89b69e1f8
commit
9ed7320c10
|
@ -7,10 +7,7 @@ using Microsoft.AspNetCore.Authorization;
|
||||||
using IRaCIS.Core.Domain.Share;
|
using IRaCIS.Core.Domain.Share;
|
||||||
using IRaCIS.Core.Application.Contracts;
|
using IRaCIS.Core.Application.Contracts;
|
||||||
using IRaCIS.Core.Application.Interfaces;
|
using IRaCIS.Core.Application.Interfaces;
|
||||||
using IRaCIS.Core.Application.Service.Inspection.Interface;
|
|
||||||
using Newtonsoft.Json;
|
|
||||||
using IRaCIS.Core.Infrastructure;
|
using IRaCIS.Core.Infrastructure;
|
||||||
using IRaCIS.Core.Domain.Common;
|
|
||||||
|
|
||||||
namespace IRaCIS.Core.Application.Services
|
namespace IRaCIS.Core.Application.Services
|
||||||
{
|
{
|
||||||
|
@ -18,13 +15,11 @@ namespace IRaCIS.Core.Application.Services
|
||||||
public class SubjectVisitService : BaseService, ISubjectVisitService
|
public class SubjectVisitService : BaseService, ISubjectVisitService
|
||||||
{
|
{
|
||||||
private readonly IRepository<SubjectVisit> _subjectVisitRepository;
|
private readonly IRepository<SubjectVisit> _subjectVisitRepository;
|
||||||
private readonly IInspectionService _inspectionService;
|
|
||||||
private readonly IRepository<Subject> _subjectRepository;
|
private readonly IRepository<Subject> _subjectRepository;
|
||||||
|
|
||||||
public SubjectVisitService(IRepository<SubjectVisit> subjectVisitRepository, IInspectionService inspectionService,IRepository<Subject> subjectRepository)
|
public SubjectVisitService(IRepository<SubjectVisit> subjectVisitRepository, IRepository<Subject> subjectRepository)
|
||||||
{
|
{
|
||||||
_subjectVisitRepository = subjectVisitRepository;
|
_subjectVisitRepository = subjectVisitRepository;
|
||||||
this._inspectionService = inspectionService;
|
|
||||||
_subjectRepository = subjectRepository;
|
_subjectRepository = subjectRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,27 +88,19 @@ namespace IRaCIS.Core.Application.Services
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//更新受试者 首次给药日期 是否入组确认
|
//更新受试者 首次给药日期 是否入组确认
|
||||||
if (svCommand.SubjectFirstGiveMedicineTime != null && svCommand.IsBaseLine)
|
if (svCommand.SubjectFirstGiveMedicineTime != null && svCommand.IsBaseLine)
|
||||||
{
|
{
|
||||||
|
|
||||||
//await _subjectRepository.UpdatePartialSearchFirstAsync(svCommand.SubjectId,
|
await _subjectRepository.UpdatePartialFromQueryAsync(svCommand.SubjectId, t => new Subject()
|
||||||
// u => new Subject() { FirstGiveMedicineTime = svCommand.SubjectFirstGiveMedicineTime });
|
{
|
||||||
|
FirstGiveMedicineTime = svCommand.SubjectFirstGiveMedicineTime
|
||||||
|
});
|
||||||
|
|
||||||
var subject = (await _subjectRepository.FirstOrDefaultAsync(t => t.Id == svCommand.SubjectId)).IfNullThrowException();
|
|
||||||
|
|
||||||
// 更新受试者
|
|
||||||
subject.FirstGiveMedicineTime = svCommand.SubjectFirstGiveMedicineTime;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
await _repository.SaveChangesAsync();
|
await _subjectVisitRepository.SaveChangesAsync();
|
||||||
|
|
||||||
return ResponseOutput.Ok(dbBeforeEntity.Id.ToString());
|
return ResponseOutput.Ok(dbBeforeEntity.Id.ToString());
|
||||||
|
|
||||||
|
@ -126,7 +113,7 @@ namespace IRaCIS.Core.Application.Services
|
||||||
[HttpPut("{trialId:guid}/{subjectVisitId:guid}/{isUrgent:bool}")]
|
[HttpPut("{trialId:guid}/{subjectVisitId:guid}/{isUrgent:bool}")]
|
||||||
public async Task<IResponseOutput> SetSubjectVisitUrgent(Guid subjectVisitId, bool isUrgent)
|
public async Task<IResponseOutput> SetSubjectVisitUrgent(Guid subjectVisitId, bool isUrgent)
|
||||||
{
|
{
|
||||||
await _subjectVisitRepository.BatchUpdateNoTrackingAsync(t => t.Id == subjectVisitId, u => new SubjectVisit() { IsUrgent = isUrgent });
|
await _subjectVisitRepository.UpdatePartialFromQueryAsync(subjectVisitId, u => new SubjectVisit() { IsUrgent = isUrgent },true);
|
||||||
|
|
||||||
return ResponseOutput.Ok();
|
return ResponseOutput.Ok();
|
||||||
}
|
}
|
||||||
|
@ -149,7 +136,9 @@ namespace IRaCIS.Core.Application.Services
|
||||||
{
|
{
|
||||||
return ResponseOutput.NotOk("This visit is OutPlanPreviousVisitId and couldn't be deleted.");
|
return ResponseOutput.NotOk("This visit is OutPlanPreviousVisitId and couldn't be deleted.");
|
||||||
}
|
}
|
||||||
return ResponseOutput.Result(await _repository.BatchDeleteAsync<SubjectVisit>(s => s.Id == id));
|
|
||||||
|
await _subjectVisitRepository.SoftDeleteFromQueryAsync(s => s.Id == id);
|
||||||
|
return ResponseOutput.Ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -157,12 +146,13 @@ namespace IRaCIS.Core.Application.Services
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="subjectVisitId"></param>
|
/// <param name="subjectVisitId"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost("{subjectVisitId:guid}/{trialId:guid}")]
|
[HttpPut("{trialId:guid}/{subjectVisitId:guid}")]
|
||||||
[TrialAudit(AuditType.SubjectAudit, AuditOptType.SetSVExecuted)]
|
[TrialAudit(AuditType.SubjectAudit, AuditOptType.SetSVExecuted)]
|
||||||
[TypeFilter(typeof(TrialResourceFilter))]
|
[TypeFilter(typeof(TrialResourceFilter))]
|
||||||
public async Task<IResponseOutput> SetSVExecuted(Guid subjectVisitId)
|
public async Task<IResponseOutput> SetSVExecuted(Guid subjectVisitId)
|
||||||
{
|
{
|
||||||
return ResponseOutput.Result(await _subjectVisitRepository.BatchUpdateNoTrackingAsync(s => s.Id == subjectVisitId, u => new SubjectVisit() { VisitExecuted = VisitExecutedEnum.Executed }));
|
await _subjectVisitRepository.UpdatePartialFromQueryAsync(subjectVisitId, u => new SubjectVisit() { VisitExecuted = VisitExecutedEnum.Executed }, true);
|
||||||
|
return ResponseOutput.Ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue