修改Subject
parent
b10064aef4
commit
c5dd75e5d6
|
@ -19,8 +19,7 @@ using IRaCIS.Core.Infra.EFCore;
|
||||||
using IRaCIS.Core.Infrastructure.Extention;
|
using IRaCIS.Core.Infrastructure.Extention;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Newtonsoft.Json;
|
|
||||||
|
|
||||||
namespace IRaCIS.Core.API.Controllers
|
namespace IRaCIS.Core.API.Controllers
|
||||||
{
|
{
|
||||||
|
@ -543,6 +542,7 @@ namespace IRaCIS.Core.API.Controllers
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 临床数据采集 ClinicalDataService
|
#region 临床数据采集 ClinicalDataService
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 新增或修改既往放疗史
|
/// 新增或修改既往放疗史
|
||||||
|
|
|
@ -3,9 +3,7 @@ using IRaCIS.Application.Contracts;
|
||||||
using IRaCIS.Core.Application.Filter;
|
using IRaCIS.Core.Application.Filter;
|
||||||
using IRaCIS.Core.Domain.Share;
|
using IRaCIS.Core.Domain.Share;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using IRaCIS.Core.Application.Service.Inspection.Interface;
|
|
||||||
using Newtonsoft.Json;
|
|
||||||
using IRaCIS.Core.Domain.Common;
|
|
||||||
|
|
||||||
namespace IRaCIS.Application.Services
|
namespace IRaCIS.Application.Services
|
||||||
{
|
{
|
||||||
|
@ -13,13 +11,11 @@ namespace IRaCIS.Application.Services
|
||||||
public class SubjectService : BaseService, ISubjectService
|
public class SubjectService : BaseService, ISubjectService
|
||||||
{
|
{
|
||||||
private readonly IRepository<Subject> _subjectRepository;
|
private readonly IRepository<Subject> _subjectRepository;
|
||||||
private readonly IInspectionService _inspectionService;
|
|
||||||
private readonly IRepository<SubjectVisit> _subjectVisitRepository;
|
private readonly IRepository<SubjectVisit> _subjectVisitRepository;
|
||||||
|
|
||||||
public SubjectService(IRepository<Subject> subjectRepository, IInspectionService inspectionService,IRepository<SubjectVisit> subjectVisitRepository)
|
public SubjectService(IRepository<Subject> subjectRepository,IRepository<SubjectVisit> subjectVisitRepository)
|
||||||
{
|
{
|
||||||
_subjectRepository = subjectRepository;
|
_subjectRepository = subjectRepository;
|
||||||
_inspectionService = inspectionService;
|
|
||||||
_subjectVisitRepository = subjectVisitRepository;
|
_subjectVisitRepository = subjectVisitRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,21 +87,16 @@ namespace IRaCIS.Application.Services
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPut("{trialId:guid}")]
|
[HttpPut]
|
||||||
[UnitOfWork]
|
[UnitOfWork]
|
||||||
public async Task<IResponseOutput> UpdateSubjectStatus(SubjectStatusChangeCommand subjectStatusChangeCommand)
|
public async Task<IResponseOutput> UpdateSubjectStatus(SubjectStatusChangeCommand subjectStatusChangeCommand)
|
||||||
{
|
{
|
||||||
|
|
||||||
await _subjectRepository.UpdateFromDTOAsync(subjectStatusChangeCommand, true);
|
await _subjectRepository.UpdateFromDTOAsync(subjectStatusChangeCommand, true);
|
||||||
|
|
||||||
return ResponseOutput.Ok();
|
return ResponseOutput.Ok();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[HttpDelete("{id:guid}/{trialId:guid}")]
|
[HttpDelete("{trialId:guid}/{id:guid}")]
|
||||||
[TrialAudit(AuditType.SubjectAudit, AuditOptType.DeleteSubject)]
|
|
||||||
[TypeFilter(typeof(TrialResourceFilter))]
|
[TypeFilter(typeof(TrialResourceFilter))]
|
||||||
public async Task<IResponseOutput> DeleteSubject(Guid id)
|
public async Task<IResponseOutput> DeleteSubject(Guid id)
|
||||||
{
|
{
|
||||||
|
@ -118,8 +109,6 @@ namespace IRaCIS.Application.Services
|
||||||
await _subjectRepository.DeleteFromQueryAsync(u => u.Id == id);
|
await _subjectRepository.DeleteFromQueryAsync(u => u.Id == id);
|
||||||
await _subjectVisitRepository.DeleteFromQueryAsync(u => u.SubjectId == id);
|
await _subjectVisitRepository.DeleteFromQueryAsync(u => u.SubjectId == id);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var isSuccess = await _subjectRepository.SaveChangesAsync();
|
var isSuccess = await _subjectRepository.SaveChangesAsync();
|
||||||
|
|
||||||
|
|
||||||
|
@ -176,25 +165,6 @@ namespace IRaCIS.Application.Services
|
||||||
return query.ToList();
|
return query.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Obsolete]
|
|
||||||
[HttpGet("{trialId:guid}/{subjectId:guid}/{finalSubjectVisitId:guid}")]
|
|
||||||
public async Task<IResponseOutput> VerifySubjectFinalVisit(Guid subjectId, Guid finalSubjectVisitId)
|
|
||||||
{
|
|
||||||
|
|
||||||
if (await _repository.AnyAsync<SubjectVisit>(t => t.SubjectId == subjectId && t.IsFinalVisit))
|
|
||||||
{
|
|
||||||
return ResponseOutput.NotOk("该受试者已经有访视设置为末次访视,不允许将该访视设置为末次访视");
|
|
||||||
}
|
|
||||||
|
|
||||||
var sv = (await _repository.FirstOrDefaultAsync<SubjectVisit>(t => t.Id == finalSubjectVisitId)).IfNullThrowException();
|
|
||||||
|
|
||||||
if (await _repository.AnyAsync<SubjectVisit>(t => t.SubjectId == subjectId && t.VisitNum > sv.VisitNum && t.SubmitState == SubmitStateEnum.ToSubmit))
|
|
||||||
{
|
|
||||||
return ResponseOutput.NotOk("该受试者此访视后有影像上传,该访视不允许设置为末次访视");
|
|
||||||
}
|
|
||||||
|
|
||||||
return ResponseOutput.Ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue