修改中心调研,引入hangfire
parent
b6403580de
commit
96e1a2c393
|
@ -438,311 +438,313 @@ namespace IRaCIS.Core.API.Controllers
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 上传临床数据 多文件
|
||||
/// </summary>
|
||||
/// <param name="subjectVisitId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("ClinicalData/UploadVisitClinicalData/{trialId:guid}/{subjectVisitId:guid}")]
|
||||
[DisableRequestSizeLimit]
|
||||
//[Authorize(Policy = IRaCISPolicy.CRC)]
|
||||
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
|
||||
|
||||
public async Task<IResponseOutput> UploadVisitClinicalData(Guid subjectVisitId)
|
||||
{
|
||||
await _qCCommon.VerifyIsCRCSubmmitAsync(_repository, _userInfo, subjectVisitId);
|
||||
var sv = _repository.Where<SubjectVisit>(t => t.Id == subjectVisitId).Select(t => new { t.TrialId, t.SiteId, t.SubjectId }).FirstOrDefault().IfNullThrowException();
|
||||
|
||||
await FileUploadAsync(async (fileName) =>
|
||||
{
|
||||
var (serverFilePath, relativePath, fileRealName) = FileStoreHelper.GetClinicalDataPath(_hostEnvironment, fileName, sv.TrialId, sv.SiteId, sv.SubjectId, subjectVisitId);
|
||||
//插入临床pdf 路径
|
||||
await _repository.AddAsync(new PreviousPDF()
|
||||
{
|
||||
SubjectVisitId = subjectVisitId,
|
||||
|
||||
IsVisist = true,
|
||||
DataType = ClinicalDataType.MedicalHistory,
|
||||
UploadType = ClinicalUploadType.PDF,
|
||||
SubjectId = sv.SubjectId,
|
||||
TrialId = sv.TrialId,
|
||||
ClinicalLevel = ClinicalLevel.Subject,
|
||||
Path = relativePath,
|
||||
FileName = fileRealName
|
||||
});
|
||||
return serverFilePath;
|
||||
});
|
||||
await _repository.SaveChangesAsync();
|
||||
return ResponseOutput.Ok();
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 上传临床数据模板
|
||||
/// </summary>
|
||||
/// <param name="trialId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("ClinicalData/UploadClinicalTemplate")]
|
||||
[DisableRequestSizeLimit]
|
||||
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "BeforeOngoingCantOpt", "AfterStopCannNotOpt" })]
|
||||
|
||||
|
||||
public async Task<IResponseOutput<List<FileDto>>> UploadClinicalTemplate(Guid? trialId)
|
||||
{
|
||||
if (trialId == null)
|
||||
trialId = default(Guid);
|
||||
|
||||
var filerelativePath = string.Empty;
|
||||
List<FileDto> fileDtos = new List<FileDto>();
|
||||
await FileUploadAsync(async (fileName) =>
|
||||
{
|
||||
var (serverFilePath, relativePath, fileRealName) = FileStoreHelper.GetClinicalTemplatePath(_hostEnvironment, fileName, trialId.Value);
|
||||
//插入临床pdf 路径
|
||||
filerelativePath = relativePath;
|
||||
|
||||
fileDtos.Add(new FileDto()
|
||||
{
|
||||
FileName = fileName,
|
||||
Path = relativePath
|
||||
|
||||
});
|
||||
await Task.CompletedTask;
|
||||
return serverFilePath;
|
||||
});
|
||||
|
||||
return ResponseOutput.Ok(fileDtos);
|
||||
}
|
||||
#region 废弃
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 上传阅片临床数据
|
||||
/// </summary>
|
||||
/// <param name="trialId"></param>
|
||||
/// <param name="subjectId"></param>
|
||||
/// <param name="readingId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("ClinicalData/UploadClinicalData/{trialId:guid}/{subjectId:guid}/{readingId:guid}")]
|
||||
[DisableRequestSizeLimit]
|
||||
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
|
||||
///// <summary>
|
||||
///// 上传临床数据 多文件
|
||||
///// </summary>
|
||||
///// <param name="subjectVisitId"></param>
|
||||
///// <returns></returns>
|
||||
//[HttpPost("ClinicalData/UploadVisitClinicalData/{trialId:guid}/{subjectVisitId:guid}")]
|
||||
//[DisableRequestSizeLimit]
|
||||
////[Authorize(Policy = IRaCISPolicy.CRC)]
|
||||
//[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
|
||||
|
||||
public async Task<IResponseOutput<List<FileDto>>> UploadReadClinicalData(Guid trialId, Guid subjectId, Guid readingId)
|
||||
{
|
||||
var filerelativePath = string.Empty;
|
||||
List<FileDto> fileDtos = new List<FileDto>();
|
||||
|
||||
var siteid = await _repository.Where<Subject>(x => x.Id == subjectId).Select(x => x.SiteId).FirstOrDefaultAsync();
|
||||
|
||||
await FileUploadAsync(async (fileName) =>
|
||||
{
|
||||
var (serverFilePath, relativePath, fileRealName) = FileStoreHelper.GetReadClinicalDataPath(_hostEnvironment, fileName, trialId, siteid, subjectId, readingId);
|
||||
//插入临床pdf 路径
|
||||
filerelativePath = relativePath;
|
||||
|
||||
fileDtos.Add(new FileDto()
|
||||
{
|
||||
FileName = fileName,
|
||||
Path = relativePath
|
||||
|
||||
});
|
||||
await Task.CompletedTask;
|
||||
return serverFilePath;
|
||||
});
|
||||
|
||||
return ResponseOutput.Ok(fileDtos);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 上传截图
|
||||
/// </summary>
|
||||
/// <param name="subjectId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("Printscreen/UploadPrintscreen/{subjectId:guid}")]
|
||||
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
|
||||
public async Task<IResponseOutput<FileDto>> UploadPrintscreen(Guid subjectId)
|
||||
{
|
||||
|
||||
var subjectInfo = await this._repository.Where<Subject>(x => x.Id == subjectId).FirstNotNullAsync();
|
||||
|
||||
FileDto fileDto = new FileDto();
|
||||
await FileUploadAsync(async (fileName) =>
|
||||
{
|
||||
var (serverFilePath, relativePath, fileRealName) = FileStoreHelper.GetUploadPrintscreenFilePath(_hostEnvironment, fileName, subjectInfo.TrialId, subjectInfo.SiteId, subjectInfo.Id);
|
||||
fileDto.Path = relativePath;
|
||||
fileDto.FileName = fileName;
|
||||
await Task.CompletedTask;
|
||||
return serverFilePath;
|
||||
});
|
||||
|
||||
|
||||
return ResponseOutput.Ok(fileDto);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 上传Reading问题的图像
|
||||
/// </summary>
|
||||
/// <param name="trialId"></param>
|
||||
/// <param name="visitTaskId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("VisitTask/UploadReadingAnswerImage/{trialId:guid}/{visitTaskId:guid}")]
|
||||
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
|
||||
public async Task<IResponseOutput<FileDto>> UploadReadingAnswerImage(Guid trialId, Guid visitTaskId)
|
||||
{
|
||||
|
||||
FileDto fileDto = new FileDto();
|
||||
await FileUploadAsync(async (fileName) =>
|
||||
{
|
||||
var (serverFilePath, relativePath, fileRealName) = FileStoreHelper.GetFilePath(_hostEnvironment, fileName, trialId, visitTaskId, StaticData.Folder.JudgeTask);
|
||||
fileDto.Path = relativePath;
|
||||
fileDto.FileName = fileName;
|
||||
await Task.CompletedTask;
|
||||
return serverFilePath;
|
||||
});
|
||||
|
||||
|
||||
return ResponseOutput.Ok(fileDto);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 上传裁判任务的图像
|
||||
/// </summary>
|
||||
/// <param name="trialId"></param>
|
||||
/// <param name="visitTaskId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("VisitTask/UploadJudgeTaskImage/{trialId:guid}/{visitTaskId:guid}")]
|
||||
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
|
||||
public async Task<IResponseOutput<FileDto>> UploadJudgeTaskImage(Guid trialId, Guid visitTaskId)
|
||||
{
|
||||
|
||||
FileDto fileDto = new FileDto();
|
||||
await FileUploadAsync(async (fileName) =>
|
||||
{
|
||||
var (serverFilePath, relativePath, fileRealName) = FileStoreHelper.GetFilePath(_hostEnvironment, fileName, trialId, visitTaskId, StaticData.Folder.JudgeTask);
|
||||
fileDto.Path = relativePath;
|
||||
fileDto.FileName = fileName;
|
||||
|
||||
await Task.CompletedTask;
|
||||
|
||||
return serverFilePath;
|
||||
});
|
||||
|
||||
return ResponseOutput.Ok(fileDto);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 上传医学审核图片
|
||||
/// </summary>
|
||||
/// <param name="trialId"></param>
|
||||
/// <param name="taskMedicalReviewId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("TaskMedicalReview/UploadMedicalReviewImage/{trialId:guid}/{taskMedicalReviewId:guid}")]
|
||||
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
|
||||
public async Task<IResponseOutput<FileDto>> UploadMedicalReviewImage(Guid trialId, Guid taskMedicalReviewId)
|
||||
{
|
||||
string path = string.Empty;
|
||||
FileDto fileDto = new FileDto();
|
||||
await FileUploadAsync(async (fileName) =>
|
||||
{
|
||||
|
||||
var (serverFilePath, relativePath, fileRealName) = FileStoreHelper.GetMedicalReviewImage(_hostEnvironment, fileName, trialId, taskMedicalReviewId);
|
||||
|
||||
|
||||
//await _repository.UpdatePartialFromQueryAsync<TaskMedicalReview>(x => x.Id == taskMedicalReviewId, x => new TaskMedicalReview()
|
||||
//public async Task<IResponseOutput> UploadVisitClinicalData(Guid subjectVisitId)
|
||||
//{
|
||||
// await _qCCommon.VerifyIsCRCSubmmitAsync(_repository, _userInfo, subjectVisitId);
|
||||
// var sv = _repository.Where<SubjectVisit>(t => t.Id == subjectVisitId).Select(t => new { t.TrialId, t.SiteId, t.SubjectId }).FirstOrDefault().IfNullThrowException();
|
||||
|
||||
// await FileUploadAsync(async (fileName) =>
|
||||
// {
|
||||
// var (serverFilePath, relativePath, fileRealName) = FileStoreHelper.GetClinicalDataPath(_hostEnvironment, fileName, sv.TrialId, sv.SiteId, sv.SubjectId, subjectVisitId);
|
||||
// //插入临床pdf 路径
|
||||
// await _repository.AddAsync(new PreviousPDF()
|
||||
// {
|
||||
// SubjectVisitId = subjectVisitId,
|
||||
|
||||
// IsVisist = true,
|
||||
// DataType = ClinicalDataType.MedicalHistory,
|
||||
// UploadType = ClinicalUploadType.PDF,
|
||||
// SubjectId = sv.SubjectId,
|
||||
// TrialId = sv.TrialId,
|
||||
// ClinicalLevel = ClinicalLevel.Subject,
|
||||
// Path = relativePath,
|
||||
// FileName = fileRealName
|
||||
// });
|
||||
// return serverFilePath;
|
||||
// });
|
||||
// await _repository.SaveChangesAsync();
|
||||
// return ResponseOutput.Ok();
|
||||
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
///// 上传临床数据模板
|
||||
///// </summary>
|
||||
///// <param name="trialId"></param>
|
||||
///// <returns></returns>
|
||||
//[HttpPost("ClinicalData/UploadClinicalTemplate")]
|
||||
//[DisableRequestSizeLimit]
|
||||
//[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "BeforeOngoingCantOpt", "AfterStopCannNotOpt" })]
|
||||
|
||||
|
||||
//public async Task<IResponseOutput<List<FileDto>>> UploadClinicalTemplate(Guid? trialId)
|
||||
//{
|
||||
// if (trialId == null)
|
||||
// trialId = default(Guid);
|
||||
|
||||
// var filerelativePath = string.Empty;
|
||||
// List<FileDto> fileDtos = new List<FileDto>();
|
||||
// await FileUploadAsync(async (fileName) =>
|
||||
// {
|
||||
// var (serverFilePath, relativePath, fileRealName) = FileStoreHelper.GetClinicalTemplatePath(_hostEnvironment, fileName, trialId.Value);
|
||||
// //插入临床pdf 路径
|
||||
// filerelativePath = relativePath;
|
||||
|
||||
// fileDtos.Add(new FileDto()
|
||||
// {
|
||||
// ImagePath = relativePath,
|
||||
// FileName = fileName,
|
||||
// Path = relativePath
|
||||
|
||||
// });
|
||||
// await Task.CompletedTask;
|
||||
// return serverFilePath;
|
||||
// });
|
||||
|
||||
path = relativePath;
|
||||
fileDto.Path = relativePath;
|
||||
fileDto.FileName = fileName;
|
||||
return serverFilePath;
|
||||
});
|
||||
|
||||
await _repository.SaveChangesAsync();
|
||||
return ResponseOutput.Ok(fileDto);
|
||||
}
|
||||
// return ResponseOutput.Ok(fileDtos);
|
||||
//}
|
||||
|
||||
|
||||
|
||||
public class UploadNoneDicomFileCommand
|
||||
{
|
||||
public Guid TrialId { get; set; }
|
||||
public Guid SubjectVisitId { get; set; }
|
||||
public Guid NoneDicomStudyId { get; set; }
|
||||
public Guid StudyMonitorId { get; set; }
|
||||
|
||||
|
||||
public List<OSSFileDTO> UploadedFileList { get; set; } = new List<OSSFileDTO>();
|
||||
|
||||
|
||||
public class OSSFileDTO
|
||||
{
|
||||
public string FilePath { get; set; }
|
||||
public string FileName { get; set; }
|
||||
public int FileFize { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 上传非Dicom 文件 支持压缩包 多文件上传
|
||||
/// </summary>
|
||||
/// <param name="_noneDicomStudyRepository"></param>
|
||||
/// <returns></returns>
|
||||
///// <summary>
|
||||
///// 上传阅片临床数据
|
||||
///// </summary>
|
||||
///// <param name="trialId"></param>
|
||||
///// <param name="subjectId"></param>
|
||||
///// <param name="readingId"></param>
|
||||
///// <returns></returns>
|
||||
//[HttpPost("ClinicalData/UploadClinicalData/{trialId:guid}/{subjectId:guid}/{readingId:guid}")]
|
||||
//[DisableRequestSizeLimit]
|
||||
[HttpPost("NoneDicomStudy/UploadNoneDicomFile")]
|
||||
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
|
||||
//[Authorize(Policy = IRaCISPolicy.CRC)]
|
||||
public async Task<IResponseOutput> UploadNoneDicomFile(UploadNoneDicomFileCommand incommand,
|
||||
[FromServices] IRepository<NoneDicomStudy> _noneDicomStudyRepository, [FromServices] IRepository<StudyMonitor> _studyMonitorRepository)
|
||||
{
|
||||
//[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
|
||||
|
||||
var subjectVisitId = incommand.SubjectVisitId;
|
||||
var studyMonitorId = incommand.StudyMonitorId;
|
||||
var noneDicomStudyId = incommand.NoneDicomStudyId;
|
||||
//public async Task<IResponseOutput<List<FileDto>>> UploadReadClinicalData(Guid trialId, Guid subjectId, Guid readingId)
|
||||
//{
|
||||
// var filerelativePath = string.Empty;
|
||||
// List<FileDto> fileDtos = new List<FileDto>();
|
||||
|
||||
// var siteid = await _repository.Where<Subject>(x => x.Id == subjectId).Select(x => x.SiteId).FirstOrDefaultAsync();
|
||||
|
||||
// await FileUploadAsync(async (fileName) =>
|
||||
// {
|
||||
// var (serverFilePath, relativePath, fileRealName) = FileStoreHelper.GetReadClinicalDataPath(_hostEnvironment, fileName, trialId, siteid, subjectId, readingId);
|
||||
// //插入临床pdf 路径
|
||||
// filerelativePath = relativePath;
|
||||
|
||||
// fileDtos.Add(new FileDto()
|
||||
// {
|
||||
// FileName = fileName,
|
||||
// Path = relativePath
|
||||
|
||||
// });
|
||||
// await Task.CompletedTask;
|
||||
// return serverFilePath;
|
||||
// });
|
||||
|
||||
// return ResponseOutput.Ok(fileDtos);
|
||||
|
||||
//}
|
||||
|
||||
|
||||
await _qCCommon.VerifyIsCRCSubmmitAsync(_repository, _userInfo, subjectVisitId);
|
||||
///// <summary>
|
||||
///// 上传截图
|
||||
///// </summary>
|
||||
///// <param name="subjectId"></param>
|
||||
///// <returns></returns>
|
||||
//[HttpPost("Printscreen/UploadPrintscreen/{subjectId:guid}")]
|
||||
//[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
|
||||
//public async Task<IResponseOutput<FileDto>> UploadPrintscreen(Guid subjectId)
|
||||
//{
|
||||
|
||||
var sv = (await _repository.Where<SubjectVisit>(t => t.Id == subjectVisitId).Select(t => new { t.TrialId, t.SiteId, t.SubjectId }).FirstOrDefaultAsync()).IfNullThrowConvertException();
|
||||
// var subjectInfo = await this._repository.Where<Subject>(x => x.Id == subjectId).FirstNotNullAsync();
|
||||
|
||||
var studyMonitor = await _studyMonitorRepository.FirstOrDefaultAsync(t => t.Id == studyMonitorId);
|
||||
|
||||
studyMonitor.UploadFinishedTime = DateTime.Now;
|
||||
|
||||
foreach (var item in incommand.UploadedFileList)
|
||||
{
|
||||
await _repository.AddAsync(new NoneDicomStudyFile() { FileName = item.FileName, Path = item.FilePath, NoneDicomStudyId = noneDicomStudyId });
|
||||
|
||||
}
|
||||
var uploadFinishedTime = DateTime.Now;
|
||||
|
||||
var noneDicomStudy = await _noneDicomStudyRepository.FirstOrDefaultAsync((t => t.Id == noneDicomStudyId));
|
||||
|
||||
noneDicomStudy.FileCount = noneDicomStudy.FileCount + incommand.UploadedFileList.Count;
|
||||
|
||||
studyMonitor.FileCount = incommand.UploadedFileList.Count;
|
||||
studyMonitor.FileSize = incommand.UploadedFileList.Sum(t => t.FileFize);
|
||||
studyMonitor.IsDicom = false;
|
||||
studyMonitor.IsDicomReUpload = false;
|
||||
studyMonitor.StudyId = noneDicomStudyId;
|
||||
studyMonitor.StudyCode = noneDicomStudy.StudyCode;
|
||||
studyMonitor.ArchiveFinishedTime = DateTime.Now;
|
||||
studyMonitor.IP = _userInfo.IP;
|
||||
|
||||
await _repository.SaveChangesAsync();
|
||||
|
||||
return ResponseOutput.Ok();
|
||||
}
|
||||
// FileDto fileDto = new FileDto();
|
||||
// await FileUploadAsync(async (fileName) =>
|
||||
// {
|
||||
// var (serverFilePath, relativePath, fileRealName) = FileStoreHelper.GetUploadPrintscreenFilePath(_hostEnvironment, fileName, subjectInfo.TrialId, subjectInfo.SiteId, subjectInfo.Id);
|
||||
// fileDto.Path = relativePath;
|
||||
// fileDto.FileName = fileName;
|
||||
// await Task.CompletedTask;
|
||||
// return serverFilePath;
|
||||
// });
|
||||
|
||||
|
||||
// return ResponseOutput.Ok(fileDto);
|
||||
//}
|
||||
|
||||
|
||||
///// <summary>
|
||||
///// 上传Reading问题的图像
|
||||
///// </summary>
|
||||
///// <param name="trialId"></param>
|
||||
///// <param name="visitTaskId"></param>
|
||||
///// <returns></returns>
|
||||
//[HttpPost("VisitTask/UploadReadingAnswerImage/{trialId:guid}/{visitTaskId:guid}")]
|
||||
//[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
|
||||
//public async Task<IResponseOutput<FileDto>> UploadReadingAnswerImage(Guid trialId, Guid visitTaskId)
|
||||
//{
|
||||
|
||||
// FileDto fileDto = new FileDto();
|
||||
// await FileUploadAsync(async (fileName) =>
|
||||
// {
|
||||
// var (serverFilePath, relativePath, fileRealName) = FileStoreHelper.GetFilePath(_hostEnvironment, fileName, trialId, visitTaskId, StaticData.Folder.JudgeTask);
|
||||
// fileDto.Path = relativePath;
|
||||
// fileDto.FileName = fileName;
|
||||
// await Task.CompletedTask;
|
||||
// return serverFilePath;
|
||||
// });
|
||||
|
||||
|
||||
// return ResponseOutput.Ok(fileDto);
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
///// 上传裁判任务的图像
|
||||
///// </summary>
|
||||
///// <param name="trialId"></param>
|
||||
///// <param name="visitTaskId"></param>
|
||||
///// <returns></returns>
|
||||
//[HttpPost("VisitTask/UploadJudgeTaskImage/{trialId:guid}/{visitTaskId:guid}")]
|
||||
//[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
|
||||
//public async Task<IResponseOutput<FileDto>> UploadJudgeTaskImage(Guid trialId, Guid visitTaskId)
|
||||
//{
|
||||
|
||||
// FileDto fileDto = new FileDto();
|
||||
// await FileUploadAsync(async (fileName) =>
|
||||
// {
|
||||
// var (serverFilePath, relativePath, fileRealName) = FileStoreHelper.GetFilePath(_hostEnvironment, fileName, trialId, visitTaskId, StaticData.Folder.JudgeTask);
|
||||
// fileDto.Path = relativePath;
|
||||
// fileDto.FileName = fileName;
|
||||
|
||||
// await Task.CompletedTask;
|
||||
|
||||
// return serverFilePath;
|
||||
// });
|
||||
|
||||
// return ResponseOutput.Ok(fileDto);
|
||||
//}
|
||||
|
||||
|
||||
|
||||
///// <summary>
|
||||
///// 上传医学审核图片
|
||||
///// </summary>
|
||||
///// <param name="trialId"></param>
|
||||
///// <param name="taskMedicalReviewId"></param>
|
||||
///// <returns></returns>
|
||||
//[HttpPost("TaskMedicalReview/UploadMedicalReviewImage/{trialId:guid}/{taskMedicalReviewId:guid}")]
|
||||
//[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
|
||||
//public async Task<IResponseOutput<FileDto>> UploadMedicalReviewImage(Guid trialId, Guid taskMedicalReviewId)
|
||||
//{
|
||||
// string path = string.Empty;
|
||||
// FileDto fileDto = new FileDto();
|
||||
// await FileUploadAsync(async (fileName) =>
|
||||
// {
|
||||
|
||||
// var (serverFilePath, relativePath, fileRealName) = FileStoreHelper.GetMedicalReviewImage(_hostEnvironment, fileName, trialId, taskMedicalReviewId);
|
||||
|
||||
|
||||
// //await _repository.UpdatePartialFromQueryAsync<TaskMedicalReview>(x => x.Id == taskMedicalReviewId, x => new TaskMedicalReview()
|
||||
// //{
|
||||
// // ImagePath = relativePath,
|
||||
// // FileName = fileName,
|
||||
// //});
|
||||
|
||||
// path = relativePath;
|
||||
// fileDto.Path = relativePath;
|
||||
// fileDto.FileName = fileName;
|
||||
// return serverFilePath;
|
||||
// });
|
||||
|
||||
// await _repository.SaveChangesAsync();
|
||||
// return ResponseOutput.Ok(fileDto);
|
||||
//}
|
||||
|
||||
|
||||
|
||||
//public class UploadNoneDicomFileCommand
|
||||
//{
|
||||
// public Guid TrialId { get; set; }
|
||||
// public Guid SubjectVisitId { get; set; }
|
||||
// public Guid NoneDicomStudyId { get; set; }
|
||||
// public Guid StudyMonitorId { get; set; }
|
||||
|
||||
|
||||
// public List<OSSFileDTO> UploadedFileList { get; set; } = new List<OSSFileDTO>();
|
||||
|
||||
|
||||
// public class OSSFileDTO
|
||||
// {
|
||||
// public string FilePath { get; set; }
|
||||
// public string FileName { get; set; }
|
||||
// public int FileFize { get; set; }
|
||||
// }
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
///// 上传非Dicom 文件 支持压缩包 多文件上传
|
||||
///// </summary>
|
||||
///// <param name="_noneDicomStudyRepository"></param>
|
||||
///// <returns></returns>
|
||||
////[DisableRequestSizeLimit]
|
||||
//[HttpPost("NoneDicomStudy/UploadNoneDicomFile")]
|
||||
//[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
|
||||
////[Authorize(Policy = IRaCISPolicy.CRC)]
|
||||
//public async Task<IResponseOutput> UploadNoneDicomFile(UploadNoneDicomFileCommand incommand,
|
||||
// [FromServices] IRepository<NoneDicomStudy> _noneDicomStudyRepository, [FromServices] IRepository<StudyMonitor> _studyMonitorRepository)
|
||||
//{
|
||||
|
||||
// var subjectVisitId = incommand.SubjectVisitId;
|
||||
// var studyMonitorId = incommand.StudyMonitorId;
|
||||
// var noneDicomStudyId = incommand.NoneDicomStudyId;
|
||||
|
||||
|
||||
// await _qCCommon.VerifyIsCRCSubmmitAsync(_repository, _userInfo, subjectVisitId);
|
||||
|
||||
// var sv = (await _repository.Where<SubjectVisit>(t => t.Id == subjectVisitId).Select(t => new { t.TrialId, t.SiteId, t.SubjectId }).FirstOrDefaultAsync()).IfNullThrowConvertException();
|
||||
|
||||
// var studyMonitor = await _studyMonitorRepository.FirstOrDefaultAsync(t => t.Id == studyMonitorId);
|
||||
|
||||
// studyMonitor.UploadFinishedTime = DateTime.Now;
|
||||
|
||||
// foreach (var item in incommand.UploadedFileList)
|
||||
// {
|
||||
// await _repository.AddAsync(new NoneDicomStudyFile() { FileName = item.FileName, Path = item.FilePath, NoneDicomStudyId = noneDicomStudyId });
|
||||
|
||||
// }
|
||||
// var uploadFinishedTime = DateTime.Now;
|
||||
|
||||
// var noneDicomStudy = await _noneDicomStudyRepository.FirstOrDefaultAsync((t => t.Id == noneDicomStudyId));
|
||||
|
||||
// noneDicomStudy.FileCount = noneDicomStudy.FileCount + incommand.UploadedFileList.Count;
|
||||
|
||||
// studyMonitor.FileCount = incommand.UploadedFileList.Count;
|
||||
// studyMonitor.FileSize = incommand.UploadedFileList.Sum(t => t.FileFize);
|
||||
// studyMonitor.IsDicom = false;
|
||||
// studyMonitor.IsDicomReUpload = false;
|
||||
// studyMonitor.StudyId = noneDicomStudyId;
|
||||
// studyMonitor.StudyCode = noneDicomStudy.StudyCode;
|
||||
// studyMonitor.ArchiveFinishedTime = DateTime.Now;
|
||||
// studyMonitor.IP = _userInfo.IP;
|
||||
|
||||
// await _repository.SaveChangesAsync();
|
||||
|
||||
// return ResponseOutput.Ok();
|
||||
//}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
/// <summary>
|
||||
|
@ -1126,105 +1128,121 @@ namespace IRaCIS.Core.API.Controllers
|
|||
}
|
||||
|
||||
|
||||
#region 废弃
|
||||
|
||||
/// <summary> 缩略图 </summary>
|
||||
[AllowAnonymous]
|
||||
[HttpGet("Common/LocalFilePreview")]
|
||||
public async Task<FileContentResult> LocalFilePreview(string relativePath)
|
||||
{
|
||||
///// <summary> 缩略图 </summary>
|
||||
//[AllowAnonymous]
|
||||
//[HttpGet("Common/LocalFilePreview")]
|
||||
//public async Task<FileContentResult> LocalFilePreview(string relativePath)
|
||||
//{
|
||||
|
||||
var _fileStorePath = FileStoreHelper.GetPhysicalFilePath(_hostEnvironment, relativePath);
|
||||
// var _fileStorePath = FileStoreHelper.GetPhysicalFilePath(_hostEnvironment, relativePath);
|
||||
|
||||
var storePreviewPath = _fileStorePath + ".preview.jpeg";
|
||||
// var storePreviewPath = _fileStorePath + ".preview.jpeg";
|
||||
|
||||
if (!System.IO.File.Exists(storePreviewPath))
|
||||
{
|
||||
ImageHelper.ResizeSave(_fileStorePath, storePreviewPath);
|
||||
}
|
||||
// if (!System.IO.File.Exists(storePreviewPath))
|
||||
// {
|
||||
// ImageHelper.ResizeSave(_fileStorePath, storePreviewPath);
|
||||
// }
|
||||
|
||||
return new FileContentResult(await System.IO.File.ReadAllBytesAsync(storePreviewPath), "image/jpeg");
|
||||
// return new FileContentResult(await System.IO.File.ReadAllBytesAsync(storePreviewPath), "image/jpeg");
|
||||
|
||||
}
|
||||
//}
|
||||
|
||||
|
||||
/// <summary> 通用文件下载 </summary>
|
||||
[AllowAnonymous]
|
||||
[HttpGet("CommonDocument/DownloadCommonDoc")]
|
||||
public async Task<IActionResult> DownloadCommonFile(string code, [FromServices] IRepository<CommonDocument> _commonDocumentRepository)
|
||||
{
|
||||
var (filePath, fileName) = await FileStoreHelper.GetCommonDocPhysicalFilePathAsync(_hostEnvironment, _commonDocumentRepository, code);
|
||||
///// <summary> 通用文件下载 </summary>
|
||||
//[AllowAnonymous]
|
||||
//[HttpGet("CommonDocument/DownloadCommonDoc")]
|
||||
//public async Task<IActionResult> DownloadCommonFile(string code, [FromServices] IRepository<CommonDocument> _commonDocumentRepository)
|
||||
//{
|
||||
// var (filePath, fileName) = await FileStoreHelper.GetCommonDocPhysicalFilePathAsync(_hostEnvironment, _commonDocumentRepository, code);
|
||||
|
||||
new FileExtensionContentTypeProvider().Mappings.TryGetValue(Path.GetExtension(filePath), out var contentType);
|
||||
// new FileExtensionContentTypeProvider().Mappings.TryGetValue(Path.GetExtension(filePath), out var contentType);
|
||||
|
||||
return File(System.IO.File.OpenRead(filePath), contentType ?? "application/octet-stream", fileName);
|
||||
// return File(System.IO.File.OpenRead(filePath), contentType ?? "application/octet-stream", fileName);
|
||||
|
||||
}
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// 下载项目临床数据文件
|
||||
/// </summary>
|
||||
/// <param name="clinicalDataTrialSetId"></param>
|
||||
/// <param name="_clinicalDataTrialSetRepository"></param>
|
||||
/// <returns></returns>
|
||||
[AllowAnonymous]
|
||||
[HttpGet("CommonDocument/DownloadTrialClinicalFile")]
|
||||
public async Task<IActionResult> DownloadTrialClinicalFile(Guid clinicalDataTrialSetId, [FromServices] IRepository<ClinicalDataTrialSet> _clinicalDataTrialSetRepository)
|
||||
{
|
||||
var (filePath, fileName) = await FileStoreHelper.GetTrialClinicalPathAsync(_hostEnvironment, _clinicalDataTrialSetRepository, clinicalDataTrialSetId);
|
||||
///// <summary>
|
||||
///// 下载项目临床数据文件
|
||||
///// </summary>
|
||||
///// <param name="clinicalDataTrialSetId"></param>
|
||||
///// <param name="_clinicalDataTrialSetRepository"></param>
|
||||
///// <returns></returns>
|
||||
//[AllowAnonymous]
|
||||
//[HttpGet("CommonDocument/DownloadTrialClinicalFile")]
|
||||
//public async Task<IActionResult> DownloadTrialClinicalFile(Guid clinicalDataTrialSetId, [FromServices] IRepository<ClinicalDataTrialSet> _clinicalDataTrialSetRepository)
|
||||
//{
|
||||
// var (filePath, fileName) = await FileStoreHelper.GetTrialClinicalPathAsync(_hostEnvironment, _clinicalDataTrialSetRepository, clinicalDataTrialSetId);
|
||||
|
||||
new FileExtensionContentTypeProvider().Mappings.TryGetValue(Path.GetExtension(filePath), out var contentType);
|
||||
// new FileExtensionContentTypeProvider().Mappings.TryGetValue(Path.GetExtension(filePath), out var contentType);
|
||||
|
||||
return File(System.IO.File.OpenRead(filePath), contentType ?? "application/octet-stream", fileName);
|
||||
// return File(System.IO.File.OpenRead(filePath), contentType ?? "application/octet-stream", fileName);
|
||||
|
||||
}
|
||||
//}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 下载系统临床数据文件
|
||||
/// </summary>
|
||||
/// <param name="clinicalDataSystemSetId"></param>
|
||||
/// <param name="_clinicalDataSystemSetRepository"></param>
|
||||
/// <returns></returns>
|
||||
[AllowAnonymous]
|
||||
[HttpGet("CommonDocument/DownloadSystemClinicalFile")]
|
||||
public async Task<IActionResult> DownloadSystemClinicalFile(Guid clinicalDataSystemSetId, [FromServices] IRepository<ClinicalDataSystemSet> _clinicalDataSystemSetRepository)
|
||||
{
|
||||
var (filePath, fileName) = await FileStoreHelper.GetSystemClinicalPathAsync(_hostEnvironment, _clinicalDataSystemSetRepository, clinicalDataSystemSetId);
|
||||
///// <summary>
|
||||
///// 下载系统临床数据文件
|
||||
///// </summary>
|
||||
///// <param name="clinicalDataSystemSetId"></param>
|
||||
///// <param name="_clinicalDataSystemSetRepository"></param>
|
||||
///// <returns></returns>
|
||||
//[AllowAnonymous]
|
||||
//[HttpGet("CommonDocument/DownloadSystemClinicalFile")]
|
||||
//public async Task<IActionResult> DownloadSystemClinicalFile(Guid clinicalDataSystemSetId, [FromServices] IRepository<ClinicalDataSystemSet> _clinicalDataSystemSetRepository)
|
||||
//{
|
||||
// var (filePath, fileName) = await FileStoreHelper.GetSystemClinicalPathAsync(_hostEnvironment, _clinicalDataSystemSetRepository, clinicalDataSystemSetId);
|
||||
|
||||
new FileExtensionContentTypeProvider().Mappings.TryGetValue(Path.GetExtension(filePath), out var contentType);
|
||||
// new FileExtensionContentTypeProvider().Mappings.TryGetValue(Path.GetExtension(filePath), out var contentType);
|
||||
|
||||
return File(System.IO.File.OpenRead(filePath), contentType ?? "application/octet-stream", fileName);
|
||||
// return File(System.IO.File.OpenRead(filePath), contentType ?? "application/octet-stream", fileName);
|
||||
|
||||
}
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
///上传项目签名文档
|
||||
/// </summary>
|
||||
/// <param name="trialId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("TrialDocument/UploadTrialDoc/{trialId:guid}")]
|
||||
[DisableRequestSizeLimit]
|
||||
[DisableFormValueModelBinding]
|
||||
public async Task<IResponseOutput> UploadTrialDoc(Guid trialId)
|
||||
{
|
||||
///// <summary>
|
||||
/////上传项目签名文档
|
||||
///// </summary>
|
||||
///// <param name="trialId"></param>
|
||||
///// <returns></returns>
|
||||
//[HttpPost("TrialDocument/UploadTrialDoc/{trialId:guid}")]
|
||||
//[DisableRequestSizeLimit]
|
||||
//[DisableFormValueModelBinding]
|
||||
//public async Task<IResponseOutput> UploadTrialDoc(Guid trialId)
|
||||
//{
|
||||
|
||||
return await SingleFileUploadAsync((fileName) => FileStoreHelper.GetTrialSignDocPath(_hostEnvironment, trialId, fileName));
|
||||
// return await SingleFileUploadAsync((fileName) => FileStoreHelper.GetTrialSignDocPath(_hostEnvironment, trialId, fileName));
|
||||
|
||||
}
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// 上传系统签名文档
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost("TrialDocument/UploadSystemDoc")]
|
||||
[DisableRequestSizeLimit]
|
||||
[DisableFormValueModelBinding]
|
||||
public async Task<IResponseOutput> UploadSysTemDoc()
|
||||
{
|
||||
///// <summary>
|
||||
///// 上传系统签名文档
|
||||
///// </summary>
|
||||
///// <returns></returns>
|
||||
//[HttpPost("TrialDocument/UploadSystemDoc")]
|
||||
//[DisableRequestSizeLimit]
|
||||
//[DisableFormValueModelBinding]
|
||||
//public async Task<IResponseOutput> UploadSysTemDoc()
|
||||
//{
|
||||
|
||||
return await SingleFileUploadAsync((fileName) => FileStoreHelper.GetSystemSignDocPath(_hostEnvironment, fileName));
|
||||
// return await SingleFileUploadAsync((fileName) => FileStoreHelper.GetSystemSignDocPath(_hostEnvironment, fileName));
|
||||
|
||||
//}
|
||||
///// <summary>
|
||||
///// 上传系统通知文档
|
||||
///// </summary>
|
||||
///// <returns></returns>
|
||||
//[HttpPost("SystemNotice/UploadSystemNoticeDoc")]
|
||||
//[DisableRequestSizeLimit]
|
||||
//[DisableFormValueModelBinding]
|
||||
//public async Task<IResponseOutput> UploadSystemNoticeDoc()
|
||||
//{
|
||||
|
||||
// return await SingleFileUploadAsync((fileName) => FileStoreHelper.GetSystemNoticePath(_hostEnvironment, fileName));
|
||||
|
||||
//}
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
|
@ -1236,25 +1254,63 @@ namespace IRaCIS.Core.API.Controllers
|
|||
[DisableFormValueModelBinding]
|
||||
public async Task<IResponseOutput> UploadCommonDoc()
|
||||
{
|
||||
|
||||
return await SingleFileUploadAsync((fileName) => FileStoreHelper.GetCommonDocPath(_hostEnvironment, fileName));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public enum UploadFileType
|
||||
{
|
||||
DataUpload=1,
|
||||
|
||||
DataDownload=2,
|
||||
|
||||
EmailAttachment=3,
|
||||
|
||||
EmailBodyHtml=4,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 上传系统通知文档
|
||||
/// 数据上传、导出、 邮件附件 、邮件Html 通过 ----new
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost("SystemNotice/UploadSystemNoticeDoc")]
|
||||
[HttpPost("SystemFile/Upload")]
|
||||
[DisableRequestSizeLimit]
|
||||
[DisableFormValueModelBinding]
|
||||
public async Task<IResponseOutput> UploadSystemNoticeDoc()
|
||||
public async Task<IResponseOutput> Upload(UploadFileType fileType)
|
||||
{
|
||||
IResponseOutput result = null;
|
||||
|
||||
return await SingleFileUploadAsync((fileName) => FileStoreHelper.GetSystemNoticePath(_hostEnvironment, fileName));
|
||||
switch (fileType)
|
||||
{
|
||||
case UploadFileType.DataUpload:
|
||||
result= await SingleFileUploadAsync((fileName) => FileStoreHelper.GetSystemFileUploadPath(_hostEnvironment, StaticData.Folder.DataTemplate,fileName));
|
||||
|
||||
break;
|
||||
case UploadFileType.DataDownload:
|
||||
result= await SingleFileUploadAsync((fileName) => FileStoreHelper.GetSystemFileUploadPath(_hostEnvironment, StaticData.Folder.DataTemplate,fileName));
|
||||
|
||||
break;
|
||||
case UploadFileType.EmailAttachment:
|
||||
result = await SingleFileUploadAsync((fileName) => FileStoreHelper.GetSystemFileUploadPath(_hostEnvironment, StaticData.Folder.DataTemplate, fileName));
|
||||
|
||||
break;
|
||||
|
||||
case UploadFileType.EmailBodyHtml:
|
||||
result = await SingleFileUploadAsync((fileName) => FileStoreHelper.GetSystemFileUploadPath(_hostEnvironment, StaticData.Folder.EmailHtmlTemplate, fileName));
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
|
|
@ -72,6 +72,9 @@
|
|||
<PackageReference Include="EasyCaching.InMemory" Version="1.7.0" />
|
||||
<PackageReference Include="EasyCaching.Interceptor.Castle" Version="1.7.0" />
|
||||
<PackageReference Include="EntityFrameworkCore.Triggered.Extensions" Version="3.2.1" />
|
||||
<PackageReference Include="Hangfire.AspNetCore" Version="1.8.5" />
|
||||
<PackageReference Include="Hangfire.Dashboard.BasicAuthorization" Version="1.0.2" />
|
||||
<PackageReference Include="Hangfire.SqlServer" Version="1.8.5" />
|
||||
<PackageReference Include="Invio.Extensions.Authentication.JwtBearer" Version="2.0.1" />
|
||||
<PackageReference Include="LogDashboard" Version="1.4.8" />
|
||||
<PackageReference Include="MediatR.Extensions.Microsoft.DependencyInjection" Version="11.0.0" />
|
||||
|
|
|
@ -212,67 +212,6 @@
|
|||
<member name="M:IRaCIS.Core.API.Controllers.StudyController.ArchiveStudyNew(System.Guid,System.Guid,System.String,System.Nullable{System.Guid},System.Guid,Microsoft.Extensions.Logging.ILogger{IRaCIS.Core.API.Controllers.UploadDownLoadController},EasyCaching.Core.IEasyCachingProvider,IRaCIS.Core.Application.Contracts.IStudyService,Microsoft.AspNetCore.SignalR.IHubContext{IRaCIS.Core.API.UploadHub,IRaCIS.Core.API.IUploadClient},IRaCIS.Core.Application.Contracts.Dicom.IDicomArchiveService,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.StudyMonitor})">
|
||||
<summary>Dicom 归档</summary>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.API.Controllers.StudyController.UploadVisitClinicalData(System.Guid)">
|
||||
<summary>
|
||||
上传临床数据 多文件
|
||||
</summary>
|
||||
<param name="subjectVisitId"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.API.Controllers.StudyController.UploadClinicalTemplate(System.Nullable{System.Guid})">
|
||||
<summary>
|
||||
上传临床数据模板
|
||||
</summary>
|
||||
<param name="trialId"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.API.Controllers.StudyController.UploadReadClinicalData(System.Guid,System.Guid,System.Guid)">
|
||||
<summary>
|
||||
上传阅片临床数据
|
||||
</summary>
|
||||
<param name="trialId"></param>
|
||||
<param name="subjectId"></param>
|
||||
<param name="readingId"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.API.Controllers.StudyController.UploadPrintscreen(System.Guid)">
|
||||
<summary>
|
||||
上传截图
|
||||
</summary>
|
||||
<param name="subjectId"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.API.Controllers.StudyController.UploadReadingAnswerImage(System.Guid,System.Guid)">
|
||||
<summary>
|
||||
上传Reading问题的图像
|
||||
</summary>
|
||||
<param name="trialId"></param>
|
||||
<param name="visitTaskId"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.API.Controllers.StudyController.UploadJudgeTaskImage(System.Guid,System.Guid)">
|
||||
<summary>
|
||||
上传裁判任务的图像
|
||||
</summary>
|
||||
<param name="trialId"></param>
|
||||
<param name="visitTaskId"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.API.Controllers.StudyController.UploadMedicalReviewImage(System.Guid,System.Guid)">
|
||||
<summary>
|
||||
上传医学审核图片
|
||||
</summary>
|
||||
<param name="trialId"></param>
|
||||
<param name="taskMedicalReviewId"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.API.Controllers.StudyController.UploadNoneDicomFile(IRaCIS.Core.API.Controllers.StudyController.UploadNoneDicomFileCommand,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.NoneDicomStudy},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.StudyMonitor})">
|
||||
<summary>
|
||||
上传非Dicom 文件 支持压缩包 多文件上传
|
||||
</summary>
|
||||
<param name="_noneDicomStudyRepository"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.API.Controllers.StudyController.UploadVisitCheckExcel(System.Guid)">
|
||||
<summary>
|
||||
一致性核查 excel上传 支持三种格式
|
||||
|
@ -299,50 +238,15 @@
|
|||
<param name="type">文件类型</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.API.Controllers.UploadDownLoadController.LocalFilePreview(System.String)">
|
||||
<summary> 缩略图 </summary>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.API.Controllers.UploadDownLoadController.DownloadCommonFile(System.String,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.CommonDocument})">
|
||||
<summary> 通用文件下载 </summary>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.API.Controllers.UploadDownLoadController.DownloadTrialClinicalFile(System.Guid,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ClinicalDataTrialSet})">
|
||||
<summary>
|
||||
下载项目临床数据文件
|
||||
</summary>
|
||||
<param name="clinicalDataTrialSetId"></param>
|
||||
<param name="_clinicalDataTrialSetRepository"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.API.Controllers.UploadDownLoadController.DownloadSystemClinicalFile(System.Guid,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ClinicalDataSystemSet})">
|
||||
<summary>
|
||||
下载系统临床数据文件
|
||||
</summary>
|
||||
<param name="clinicalDataSystemSetId"></param>
|
||||
<param name="_clinicalDataSystemSetRepository"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.API.Controllers.UploadDownLoadController.UploadTrialDoc(System.Guid)">
|
||||
<summary>
|
||||
上传项目签名文档
|
||||
</summary>
|
||||
<param name="trialId"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.API.Controllers.UploadDownLoadController.UploadSysTemDoc">
|
||||
<summary>
|
||||
上传系统签名文档
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.API.Controllers.UploadDownLoadController.UploadCommonDoc">
|
||||
<summary>
|
||||
上传通用文档 比如一致性核查的 比如导出的excel 模板
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.API.Controllers.UploadDownLoadController.UploadSystemNoticeDoc">
|
||||
<member name="M:IRaCIS.Core.API.Controllers.UploadDownLoadController.Upload(IRaCIS.Core.API.Controllers.UploadDownLoadController.UploadFileType)">
|
||||
<summary>
|
||||
上传系统通知文档
|
||||
数据上传、导出、 邮件附件 、邮件Html 通过 ----new
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
|
|
|
@ -114,7 +114,8 @@ namespace IRaCIS.Core.API
|
|||
//services.AddDistributedMemoryCache();
|
||||
|
||||
// hangfire 定时任务框架 有界面,更友好~
|
||||
//services.AddhangfireSetup(_configuration);
|
||||
services.AddhangfireSetup(_configuration);
|
||||
|
||||
// QuartZ 定时任务框架 使用了hangfire 暂时不用,后续需要可以打开,已经配好
|
||||
services.AddQuartZSetup(_configuration);
|
||||
|
||||
|
@ -181,7 +182,7 @@ namespace IRaCIS.Core.API
|
|||
app.UseLogDashboard("/LogDashboard");
|
||||
|
||||
//hangfire
|
||||
//app.UseHangfireConfig(env);
|
||||
app.UseHangfireConfig(env);
|
||||
|
||||
////暂时废弃
|
||||
//app.UseHttpReports();
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
using Hangfire.Dashboard;
|
||||
|
||||
namespace IRaCIS.Core.API.Filter
|
||||
{
|
||||
public class hangfireAuthorizationFilter : IDashboardAuthorizationFilter
|
||||
{
|
||||
public bool Authorize(DashboardContext context)
|
||||
{
|
||||
var httpContext = context.GetHttpContext();
|
||||
|
||||
// Allow all authenticated users to see the Dashboard (potentially dangerous).
|
||||
//return httpContext.User.Identity.IsAuthenticated;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
using Hangfire;
|
||||
using Hangfire.Dashboard;
|
||||
using Hangfire.Dashboard.BasicAuthorization;
|
||||
using IRaCIS.Application.Services.BackGroundJob;
|
||||
using IRaCIS.Core.API.Filter;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
|
||||
namespace IRaCIS.Core.API
|
||||
{
|
||||
|
||||
|
||||
public static class HangfireConfig
|
||||
{
|
||||
|
||||
public static void UseHangfireConfig(this IApplicationBuilder app, IWebHostEnvironment env)
|
||||
{
|
||||
|
||||
|
||||
app.UseHangfireDashboard("/api/hangfire", new DashboardOptions()
|
||||
{
|
||||
//直接访问,没有带token 获取不到用户身份信息,所以这种自定义授权暂时没法使用
|
||||
//Authorization = new[] { new hangfireAuthorizationFilter() }
|
||||
|
||||
//本地请求 才能看
|
||||
//Authorization = new[] { new LocalRequestsOnlyAuthorizationFilter() }
|
||||
|
||||
Authorization = new BasicAuthAuthorizationFilter[] {
|
||||
new BasicAuthAuthorizationFilter(new BasicAuthAuthorizationFilterOptions(){
|
||||
SslRedirect=false,
|
||||
RequireSsl=false,
|
||||
Users=new BasicAuthAuthorizationUser[]{
|
||||
new BasicAuthAuthorizationUser(){
|
||||
Login="admin",
|
||||
PasswordClear="test",
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
#region hangfire
|
||||
|
||||
//// 延迟任务执行 1秒之后执行 有时启动没运行 换成添加到队列中
|
||||
//BackgroundJob.Schedule<ICacheTrialStatusJob>(t => t.MemoryCacheTrialStatus(), TimeSpan.FromSeconds(1));
|
||||
////添加到后台任务队列,
|
||||
//BackgroundJob.Enqueue<ICacheTrialStatusJob>(t => t.MemoryCacheTrialStatus());
|
||||
|
||||
//周期性任务,1天执行一次
|
||||
|
||||
//RecurringJob.AddOrUpdate<IIRaCISCacheHangfireJob>(t => t.ProjectStartCache(), Cron.Daily);
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -19,6 +19,8 @@ namespace IRaCIS.Core.API
|
|||
|
||||
//opt.AddAuthorizationFilter(new LogDashBoardAuthFilter());
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
using Hangfire;
|
||||
using Hangfire.SqlServer;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using System;
|
||||
|
||||
namespace IRaCIS.Core.API
|
||||
{
|
||||
public static class hangfireSetup
|
||||
{
|
||||
public static void AddhangfireSetup(this IServiceCollection services, IConfiguration configuration)
|
||||
{
|
||||
var hangFireConnStr = configuration.GetSection("ConnectionStrings:Hangfire").Value;
|
||||
|
||||
services.AddHangfire(hangFireConfig =>
|
||||
{
|
||||
|
||||
//hangFireConfig.UseInMemoryStorage();
|
||||
|
||||
//指定存储介质
|
||||
hangFireConfig.UseSqlServerStorage(hangFireConnStr, new SqlServerStorageOptions()
|
||||
{
|
||||
SchemaName = "hangfire",
|
||||
CommandBatchMaxTimeout = TimeSpan.FromMinutes(5),
|
||||
SlidingInvisibilityTimeout = TimeSpan.FromMinutes(5),
|
||||
QueuePollInterval = TimeSpan.Zero,
|
||||
UseRecommendedIsolationLevel = true,
|
||||
DisableGlobalLocks = true
|
||||
});
|
||||
|
||||
//hangFireConfig.UseTagsWithSql(); //nuget引入Hangfire.Tags.SqlServer
|
||||
//.UseHangfireHttpJob();
|
||||
|
||||
});
|
||||
|
||||
services.AddHangfireServer();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -7,7 +7,8 @@
|
|||
}
|
||||
},
|
||||
"ConnectionStrings": {
|
||||
"RemoteNew": "Server=123.56.94.154,1433\\MSSQLSERVER;Database=Test.Study;User ID=sa;Password=dev123456DEV;TrustServerCertificate=true"
|
||||
"RemoteNew": "Server=123.56.94.154,1433\\MSSQLSERVER;Database=Test.Study;User ID=sa;Password=dev123456DEV;TrustServerCertificate=true",
|
||||
"Hangfire": "Server=123.56.94.154,1433\\MSSQLSERVER;Database=Test.Study.hangfire;User ID=sa;Password=dev123456DEV;TrustServerCertificate=true"
|
||||
},
|
||||
"BasicSystemConfig": {
|
||||
|
||||
|
|
|
@ -7,7 +7,8 @@
|
|||
}
|
||||
},
|
||||
"ConnectionStrings": {
|
||||
"RemoteNew": "Server=123.56.94.154,1433\\MSSQLSERVER;Database=Uat.Study;User ID=sa;Password=dev123456DEV;TrustServerCertificate=true"
|
||||
"RemoteNew": "Server=123.56.94.154,1433\\MSSQLSERVER;Database=Uat.Study;User ID=sa;Password=dev123456DEV;TrustServerCertificate=true",
|
||||
"Hangfire": "Server=123.56.94.154,1433\\MSSQLSERVER;Database=Uat.Study.hangfire;User ID=sa;Password=dev123456DEV;TrustServerCertificate=true"
|
||||
},
|
||||
"BasicSystemConfig": {
|
||||
|
||||
|
|
|
@ -227,6 +227,28 @@ public static class FileStoreHelper
|
|||
return (serverFilePath, relativePath);
|
||||
}
|
||||
|
||||
|
||||
public static (string PhysicalPath, string RelativePath) GetSystemFileUploadPath(IWebHostEnvironment _hostEnvironment, string templateFolderName, string fileName)
|
||||
{
|
||||
var rootPath = FileStoreHelper.GetIRaCISRootDataFolder(_hostEnvironment);
|
||||
|
||||
//文件类型路径处理
|
||||
var uploadFolderPath = Path.Combine(rootPath, StaticData.Folder.SystemDataFolder, templateFolderName);
|
||||
if (!Directory.Exists(uploadFolderPath)) Directory.CreateDirectory(uploadFolderPath);
|
||||
|
||||
|
||||
var (trustedFileNameForFileStorage, fileRealName) = FileStoreHelper.GetStoreFileName(fileName);
|
||||
|
||||
|
||||
var relativePath = $"/{StaticData.Folder.IRaCISDataFolder}/{StaticData.Folder.SystemDataFolder}/{templateFolderName}/{trustedFileNameForFileStorage}";
|
||||
|
||||
var serverFilePath = Path.Combine(uploadFolderPath, trustedFileNameForFileStorage);
|
||||
|
||||
return (serverFilePath, relativePath);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 获取通用文档存放路径(excel模板 )
|
||||
|
||||
public static (string PhysicalPath, string RelativePath) GetCommonDocPath(IWebHostEnvironment _hostEnvironment, string fileName)
|
||||
|
|
|
@ -705,6 +705,9 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
throw new BusinessValidationFailedException("当前调研表已废除,或者调研表状态已锁定,不允许操作");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
var siteUserList = await _trialSiteUserSurveyRepository.Where(t => t.TrialSiteSurveyId == trialSiteSurveyId)
|
||||
.Where(t => !(t.IsHistoryUser && t.IsHistoryUserDeleted == true))
|
||||
.Select(t =>
|
||||
|
@ -719,19 +722,25 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
t.Email,
|
||||
}).ToListAsync();
|
||||
|
||||
|
||||
if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.Undefined)
|
||||
{
|
||||
var currentUserList = siteUserList.Where(t => t.TrialSiteSurveyId == trialSiteSurveyId).ToList();
|
||||
|
||||
|
||||
|
||||
if (!currentUserList.Any(t => t.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator) ||
|
||||
!currentUserList.Any(t => t.UserTypeEnum == UserTypeEnum.SR))
|
||||
{
|
||||
throw new BusinessValidationFailedException("本次提交,生成账号必须要有CRC和SR");
|
||||
}
|
||||
|
||||
if(currentUserList.GroupBy(t=>new {t.UserTypeId,t.Email})
|
||||
.Any(g => g.Count() > 1))
|
||||
{
|
||||
throw new BusinessValidationFailedException("同一邮箱同一用户类型,生成账号的数据只允许存在一条!");
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.Undefined)
|
||||
{
|
||||
|
||||
await _trialSiteSurveyRepository.UpdatePartialFromQueryAsync(t => t.Id == trialSiteSurveyId && t.State == TrialSiteSurveyEnum.ToSubmit, u => new TrialSiteSurvey() { State = TrialSiteSurveyEnum.SPMApproved });
|
||||
|
||||
|
|
|
@ -88,6 +88,8 @@ public static class StaticData
|
|||
|
||||
public static readonly string DataTemplate = "DataTemplate";
|
||||
|
||||
public static readonly string EmailHtmlTemplate = "EmailHtml";
|
||||
|
||||
public static readonly string NoticeAttachment = "NoticeAttachment";
|
||||
|
||||
public static readonly string DicomFolder = "Dicom";
|
||||
|
|
Loading…
Reference in New Issue