修改Subject
							parent
							
								
									b10064aef4
								
							
						
					
					
						commit
						c5dd75e5d6
					
				| 
						 | 
				
			
			@ -19,8 +19,7 @@ using IRaCIS.Core.Infra.EFCore;
 | 
			
		|||
using IRaCIS.Core.Infrastructure.Extention;
 | 
			
		||||
using Microsoft.AspNetCore.Http;
 | 
			
		||||
using Microsoft.AspNetCore.Mvc;
 | 
			
		||||
using Microsoft.EntityFrameworkCore;
 | 
			
		||||
using Newtonsoft.Json;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
namespace IRaCIS.Core.API.Controllers
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -543,6 +542,7 @@ namespace IRaCIS.Core.API.Controllers
 | 
			
		|||
        }
 | 
			
		||||
 | 
			
		||||
        #endregion
 | 
			
		||||
 | 
			
		||||
        #region 临床数据采集 ClinicalDataService 
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 新增或修改既往放疗史
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,9 +3,7 @@ using IRaCIS.Application.Contracts;
 | 
			
		|||
using IRaCIS.Core.Application.Filter;
 | 
			
		||||
using IRaCIS.Core.Domain.Share;
 | 
			
		||||
using Microsoft.AspNetCore.Mvc;
 | 
			
		||||
using IRaCIS.Core.Application.Service.Inspection.Interface;
 | 
			
		||||
using Newtonsoft.Json;
 | 
			
		||||
using IRaCIS.Core.Domain.Common;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
namespace IRaCIS.Application.Services
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -13,13 +11,11 @@ namespace IRaCIS.Application.Services
 | 
			
		|||
    public class SubjectService : BaseService, ISubjectService
 | 
			
		||||
    {
 | 
			
		||||
        private readonly IRepository<Subject> _subjectRepository;
 | 
			
		||||
        private readonly IInspectionService _inspectionService;
 | 
			
		||||
        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;
 | 
			
		||||
            _inspectionService = inspectionService;
 | 
			
		||||
             _subjectVisitRepository = subjectVisitRepository;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -91,21 +87,16 @@ namespace IRaCIS.Application.Services
 | 
			
		|||
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        [HttpPut("{trialId:guid}")]
 | 
			
		||||
        [HttpPut]
 | 
			
		||||
        [UnitOfWork]
 | 
			
		||||
        public async Task<IResponseOutput> UpdateSubjectStatus(SubjectStatusChangeCommand subjectStatusChangeCommand)
 | 
			
		||||
        {
 | 
			
		||||
 | 
			
		||||
             await _subjectRepository.UpdateFromDTOAsync(subjectStatusChangeCommand, true);
 | 
			
		||||
 | 
			
		||||
            return ResponseOutput.Ok();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        [HttpDelete("{id:guid}/{trialId:guid}")]
 | 
			
		||||
        [TrialAudit(AuditType.SubjectAudit, AuditOptType.DeleteSubject)]
 | 
			
		||||
        [HttpDelete("{trialId:guid}/{id:guid}")]
 | 
			
		||||
        [TypeFilter(typeof(TrialResourceFilter))]
 | 
			
		||||
        public async Task<IResponseOutput> DeleteSubject(Guid id)
 | 
			
		||||
        {
 | 
			
		||||
| 
						 | 
				
			
			@ -118,8 +109,6 @@ namespace IRaCIS.Application.Services
 | 
			
		|||
            await _subjectRepository.DeleteFromQueryAsync(u => u.Id == id);
 | 
			
		||||
            await _subjectVisitRepository.DeleteFromQueryAsync(u => u.SubjectId == id);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
            var isSuccess =  await _subjectRepository.SaveChangesAsync();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -176,25 +165,6 @@ namespace IRaCIS.Application.Services
 | 
			
		|||
            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