Merge branch 'master' of http://192.168.1.2:8033/IRaCIS_Core_Api
commit
5b992c0980
|
@ -10,6 +10,8 @@ using IRaCIS.Core.Domain.Share;
|
||||||
using IRaCIS.Core.Application.Helper;
|
using IRaCIS.Core.Application.Helper;
|
||||||
using IRaCIS.Core.Infrastructure;
|
using IRaCIS.Core.Infrastructure;
|
||||||
using IRaCIS.Core.Application.Service.Verify;
|
using IRaCIS.Core.Application.Service.Verify;
|
||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
using IRaCIS.Core.Application.Auth;
|
||||||
|
|
||||||
namespace IRaCIS.Core.Application.Contracts
|
namespace IRaCIS.Core.Application.Contracts
|
||||||
{
|
{
|
||||||
|
@ -51,6 +53,7 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost("{trialId:guid}/{subjectVisitId:guid}")]
|
[HttpPost("{trialId:guid}/{subjectVisitId:guid}")]
|
||||||
[DisableRequestSizeLimit]
|
[DisableRequestSizeLimit]
|
||||||
|
[Authorize(Policy = IRaCISPolicy.CRC)]
|
||||||
public async Task<IResponseOutput> UploadVisitClinicalData(IFormCollection formCollection, Guid subjectVisitId, [FromServices] IWebHostEnvironment _hostEnvironment)
|
public async Task<IResponseOutput> UploadVisitClinicalData(IFormCollection formCollection, Guid subjectVisitId, [FromServices] IWebHostEnvironment _hostEnvironment)
|
||||||
{
|
{
|
||||||
await QCCommonVerify.VerifyIsCRCSubmmitAsync(_repository, _userInfo, subjectVisitId);
|
await QCCommonVerify.VerifyIsCRCSubmmitAsync(_repository, _userInfo, subjectVisitId);
|
||||||
|
|
|
@ -8,9 +8,7 @@ using Microsoft.AspNetCore.Http;
|
||||||
using IRaCIS.Core.Domain.Share;
|
using IRaCIS.Core.Domain.Share;
|
||||||
using SharpCompress.Archives;
|
using SharpCompress.Archives;
|
||||||
using IRaCIS.Core.Application.Filter;
|
using IRaCIS.Core.Application.Filter;
|
||||||
using Newtonsoft.Json;
|
|
||||||
using IRaCIS.Core.Application.Service.Inspection.Interface;
|
using IRaCIS.Core.Application.Service.Inspection.Interface;
|
||||||
using IRaCIS.Core.Application.Service.Inspection.DTO;
|
|
||||||
using Nito.AsyncEx;
|
using Nito.AsyncEx;
|
||||||
using IRaCIS.Application.Interfaces;
|
using IRaCIS.Application.Interfaces;
|
||||||
using IRaCIS.Core.Infrastructure;
|
using IRaCIS.Core.Infrastructure;
|
||||||
|
@ -18,6 +16,8 @@ using Microsoft.Extensions.Logging;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using IRaCIS.Core.Application.Helper;
|
using IRaCIS.Core.Application.Helper;
|
||||||
using IRaCIS.Core.Application.Service.Verify;
|
using IRaCIS.Core.Application.Service.Verify;
|
||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
using IRaCIS.Core.Application.Auth;
|
||||||
|
|
||||||
namespace IRaCIS.Core.Application.Contracts
|
namespace IRaCIS.Core.Application.Contracts
|
||||||
{
|
{
|
||||||
|
@ -77,34 +77,12 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
[TypeFilter(typeof(TrialResourceFilter))]
|
[TypeFilter(typeof(TrialResourceFilter))]
|
||||||
public async Task<IResponseOutput<NoneDicomStudyAddReturnDto>> AddOrUpdateNoneDicomStudy(NoneDicomStudyAddOrEdit addOrEditNoneDicomStudy)
|
public async Task<IResponseOutput<NoneDicomStudyAddReturnDto>> AddOrUpdateNoneDicomStudy(NoneDicomStudyAddOrEdit addOrEditNoneDicomStudy)
|
||||||
{
|
{
|
||||||
var visitList = await _subjectVisitRepository.Where(t => t.SubjectId == addOrEditNoneDicomStudy.SubjectId).Select(t => new { t.VisitNum, t.EarliestScanDate, t.LatestScanDate, t.Id }).ToListAsync();
|
|
||||||
|
|
||||||
var currentVisitNum = await _subjectVisitRepository.Where(t => t.Id == addOrEditNoneDicomStudy.SubjectVisitId).Select(t => t.VisitNum).FirstOrDefaultAsync();
|
await QCCommonVerify.VerifyIsCRCSubmmitAsync(_repository, _userInfo, addOrEditNoneDicomStudy.SubjectVisitId);
|
||||||
|
|
||||||
if (addOrEditNoneDicomStudy.Id == null)
|
await QCCommonVerify.VerifyStudyImageDataAsync(_repository, addOrEditNoneDicomStudy.SubjectId, addOrEditNoneDicomStudy.SubjectVisitId, addOrEditNoneDicomStudy.ImageDate);
|
||||||
{
|
|
||||||
//更新验证的时候,排除自己
|
|
||||||
visitList = visitList.Where(t => t.Id != addOrEditNoneDicomStudy.Id).ToList();
|
|
||||||
}
|
|
||||||
|
|
||||||
//小于当前访视 最近的最晚拍片
|
|
||||||
var before = visitList.Where(u => u.VisitNum < currentVisitNum).Max(k => k.LatestScanDate);
|
|
||||||
|
|
||||||
if (before != null && before > addOrEditNoneDicomStudy.ImageDate)
|
|
||||||
{
|
|
||||||
throw new BusinessValidationFailedException($"当前访视检查时间{addOrEditNoneDicomStudy.ImageDate.ToString("yyyy-MM-dd")}不能早于前序访视检查时间{before?.ToString("yyyy-MM-dd")},请核对检查数据是否有误");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//大于当前访视 最近的最早拍片日期
|
|
||||||
var after = visitList.Where(u => u.VisitNum > currentVisitNum).Min(k => k.EarliestScanDate);
|
|
||||||
|
|
||||||
if (after != null && after < addOrEditNoneDicomStudy.ImageDate)
|
|
||||||
{
|
|
||||||
throw new BusinessValidationFailedException($"当前访视检查时间{addOrEditNoneDicomStudy.ImageDate.ToString("yyyy-MM-dd")}不能晚于该访视之后的检查时间{after?.ToString("yyyy-MM-dd")},请核对检查数据是否有误");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
NoneDicomStudy? optEntity = null;
|
NoneDicomStudy? optEntity = null;
|
||||||
using (await _mutex.LockAsync())
|
using (await _mutex.LockAsync())
|
||||||
{
|
{
|
||||||
|
@ -121,14 +99,7 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.IQC)
|
|
||||||
{
|
|
||||||
|
|
||||||
await QCCommonVerify.VerifyIsCanQCAsync(_repository, _userInfo, null, addOrEditNoneDicomStudy.SubjectVisitId);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
optEntity = await _noneDicomStudyRepository.UpdateFromDTOAsync(addOrEditNoneDicomStudy);
|
optEntity = await _noneDicomStudyRepository.UpdateFromDTOAsync(addOrEditNoneDicomStudy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -211,6 +182,7 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
[RequestSizeLimit(1_073_741_824)]
|
[RequestSizeLimit(1_073_741_824)]
|
||||||
[HttpPost("{trialId:guid}/{subjectVisitId:guid}/{noneDicomStudyId:guid}")]
|
[HttpPost("{trialId:guid}/{subjectVisitId:guid}/{noneDicomStudyId:guid}")]
|
||||||
[TypeFilter(typeof(TrialResourceFilter))]
|
[TypeFilter(typeof(TrialResourceFilter))]
|
||||||
|
[Authorize(Policy = IRaCISPolicy.CRC)]
|
||||||
public async Task<IResponseOutput> UploadNoneDicomFile(IFormCollection formCollection, Guid subjectVisitId, Guid noneDicomStudyId)
|
public async Task<IResponseOutput> UploadNoneDicomFile(IFormCollection formCollection, Guid subjectVisitId, Guid noneDicomStudyId)
|
||||||
{
|
{
|
||||||
await QCCommonVerify.VerifyIsCRCSubmmitAsync(_repository, _userInfo, subjectVisitId);
|
await QCCommonVerify.VerifyIsCRCSubmmitAsync(_repository, _userInfo, subjectVisitId);
|
||||||
|
@ -310,19 +282,5 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
await _noneDicomStudyFileRepository.AddAsync(new NoneDicomStudyFile() { FileName = fileName, Path = relativePath, NoneDicomStudyId = noneDicomStudyId });
|
await _noneDicomStudyFileRepository.AddAsync(new NoneDicomStudyFile() { FileName = fileName, Path = relativePath, NoneDicomStudyId = noneDicomStudyId });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 上传非Dicom 文件 支持压缩包
|
|
||||||
/// </summary>
|
|
||||||
[HttpPost]
|
|
||||||
[Obsolete]
|
|
||||||
public async Task<IResponseOutput> NewUploadNoneDicomFile([FromForm] UploadNoneDicomFileDto fileDto)
|
|
||||||
{
|
|
||||||
var file = this._httpContext.HttpContext?.Request.Form;
|
|
||||||
var result = await UploadNoneDicomFile(file, fileDto.subjectVisitId, fileDto.noneDicomStudyId);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,14 @@ namespace IRaCIS.Core.Application.Service.Verify
|
||||||
{
|
{
|
||||||
public static class QCCommonVerify
|
public static class QCCommonVerify
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 验证CRC 是否已提交 已提交 就不允许进行任何操作,如果是IQC 那么还验证是否是当前任务领取人
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="_repository"></param>
|
||||||
|
/// <param name="_userInfo"></param>
|
||||||
|
/// <param name="subjectVisitId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <exception cref="BusinessValidationFailedException"></exception>
|
||||||
public static async Task VerifyIsCRCSubmmitAsync(IRepository _repository, IUserInfo _userInfo, Guid? subjectVisitId=null)
|
public static async Task VerifyIsCRCSubmmitAsync(IRepository _repository, IUserInfo _userInfo, Guid? subjectVisitId=null)
|
||||||
{
|
{
|
||||||
//添加的时候不验证
|
//添加的时候不验证
|
||||||
|
@ -19,6 +26,13 @@ namespace IRaCIS.Core.Application.Service.Verify
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//IQC 的时候 验证是不是当前领取人
|
||||||
|
if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.IQC)
|
||||||
|
{
|
||||||
|
|
||||||
|
await VerifyIsCanQCAsync(_repository, _userInfo, null, subjectVisitId);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,6 +48,36 @@ namespace IRaCIS.Core.Application.Service.Verify
|
||||||
throw new BusinessValidationFailedException("您不是该质控任务当前领取人,没有操作权限!");
|
throw new BusinessValidationFailedException("您不是该质控任务当前领取人,没有操作权限!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static async Task VerifyStudyImageDataAsync(IRepository _repository, Guid subjectId, Guid subjectVisitId,DateTime imageDate)
|
||||||
|
{
|
||||||
|
var visitList = await _repository.Where<SubjectVisit>(t => t.SubjectId == subjectId).Select(t => new { t.VisitNum, t.EarliestScanDate, t.LatestScanDate, t.Id }).ToListAsync();
|
||||||
|
|
||||||
|
var currentVisitNum = await _repository.Where<SubjectVisit>(t => t.Id == subjectVisitId).Select(t => t.VisitNum).FirstOrDefaultAsync();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//小于当前访视 最近的最晚拍片
|
||||||
|
var before = visitList.Where(u => u.VisitNum < currentVisitNum).Max(k => k.LatestScanDate);
|
||||||
|
|
||||||
|
if (before != null && before > imageDate)
|
||||||
|
{
|
||||||
|
throw new BusinessValidationFailedException($"当前访视检查时间{imageDate.ToString("yyyy-MM-dd")}不能早于前序访视检查时间{before?.ToString("yyyy-MM-dd")},请核对检查数据是否有误");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//大于当前访视 最近的最早拍片日期
|
||||||
|
var after = visitList.Where(u => u.VisitNum > currentVisitNum).Min(k => k.EarliestScanDate);
|
||||||
|
|
||||||
|
if (after != null && after < imageDate)
|
||||||
|
{
|
||||||
|
throw new BusinessValidationFailedException($"当前访视检查时间{imageDate.ToString("yyyy-MM-dd")}不能晚于该访视之后的检查时间{after?.ToString("yyyy-MM-dd")},请核对检查数据是否有误");
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue