修改邮件前 合并分支
commit
3084d73f85
|
@ -37,6 +37,7 @@ using Microsoft.Net.Http.Headers;
|
||||||
using MiniExcelLibs;
|
using MiniExcelLibs;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using SharpCompress.Archives;
|
using SharpCompress.Archives;
|
||||||
|
using SharpCompress.Common;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
|
@ -437,311 +438,313 @@ namespace IRaCIS.Core.API.Controllers
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#region 废弃
|
||||||
|
|
||||||
/// <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);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
///// <summary>
|
||||||
/// 上传阅片临床数据
|
///// 上传临床数据 多文件
|
||||||
/// </summary>
|
///// </summary>
|
||||||
/// <param name="trialId"></param>
|
///// <param name="subjectVisitId"></param>
|
||||||
/// <param name="subjectId"></param>
|
///// <returns></returns>
|
||||||
/// <param name="readingId"></param>
|
//[HttpPost("ClinicalData/UploadVisitClinicalData/{trialId:guid}/{subjectVisitId:guid}")]
|
||||||
/// <returns></returns>
|
//[DisableRequestSizeLimit]
|
||||||
[HttpPost("ClinicalData/UploadClinicalData/{trialId:guid}/{subjectId:guid}/{readingId:guid}")]
|
////[Authorize(Policy = IRaCISPolicy.CRC)]
|
||||||
[DisableRequestSizeLimit]
|
//[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
|
||||||
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
|
|
||||||
|
|
||||||
public async Task<IResponseOutput<List<FileDto>>> UploadReadClinicalData(Guid trialId, Guid subjectId, Guid readingId)
|
//public async Task<IResponseOutput> UploadVisitClinicalData(Guid subjectVisitId)
|
||||||
{
|
//{
|
||||||
var filerelativePath = string.Empty;
|
// await _qCCommon.VerifyIsCRCSubmmitAsync(_repository, _userInfo, subjectVisitId);
|
||||||
List<FileDto> fileDtos = new List<FileDto>();
|
// var sv = _repository.Where<SubjectVisit>(t => t.Id == subjectVisitId).Select(t => new { t.TrialId, t.SiteId, t.SubjectId }).FirstOrDefault().IfNullThrowException();
|
||||||
|
|
||||||
var siteid = await _repository.Where<Subject>(x => x.Id == subjectId).Select(x => x.SiteId).FirstOrDefaultAsync();
|
// await FileUploadAsync(async (fileName) =>
|
||||||
|
// {
|
||||||
await FileUploadAsync(async (fileName) =>
|
// var (serverFilePath, relativePath, fileRealName) = FileStoreHelper.GetClinicalDataPath(_hostEnvironment, fileName, sv.TrialId, sv.SiteId, sv.SubjectId, subjectVisitId);
|
||||||
{
|
// //插入临床pdf 路径
|
||||||
var (serverFilePath, relativePath, fileRealName) = FileStoreHelper.GetReadClinicalDataPath(_hostEnvironment, fileName, trialId, siteid, subjectId, readingId);
|
// await _repository.AddAsync(new PreviousPDF()
|
||||||
//插入临床pdf 路径
|
// {
|
||||||
filerelativePath = relativePath;
|
// SubjectVisitId = subjectVisitId,
|
||||||
|
|
||||||
fileDtos.Add(new FileDto()
|
// IsVisist = true,
|
||||||
{
|
// DataType = ClinicalDataType.MedicalHistory,
|
||||||
FileName = fileName,
|
// UploadType = ClinicalUploadType.PDF,
|
||||||
Path = relativePath
|
// SubjectId = sv.SubjectId,
|
||||||
|
// TrialId = sv.TrialId,
|
||||||
});
|
// ClinicalLevel = ClinicalLevel.Subject,
|
||||||
await Task.CompletedTask;
|
// Path = relativePath,
|
||||||
return serverFilePath;
|
// FileName = fileRealName
|
||||||
});
|
// });
|
||||||
|
// return serverFilePath;
|
||||||
return ResponseOutput.Ok(fileDtos);
|
// });
|
||||||
|
// await _repository.SaveChangesAsync();
|
||||||
}
|
// return ResponseOutput.Ok();
|
||||||
|
|
||||||
|
//}
|
||||||
/// <summary>
|
|
||||||
/// 上传截图
|
///// <summary>
|
||||||
/// </summary>
|
///// 上传临床数据模板
|
||||||
/// <param name="subjectId"></param>
|
///// </summary>
|
||||||
/// <returns></returns>
|
///// <param name="trialId"></param>
|
||||||
[HttpPost("Printscreen/UploadPrintscreen/{subjectId:guid}")]
|
///// <returns></returns>
|
||||||
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
|
//[HttpPost("ClinicalData/UploadClinicalTemplate")]
|
||||||
public async Task<IResponseOutput<FileDto>> UploadPrintscreen(Guid subjectId)
|
//[DisableRequestSizeLimit]
|
||||||
{
|
//[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "BeforeOngoingCantOpt", "AfterStopCannNotOpt" })]
|
||||||
|
|
||||||
var subjectInfo = await this._repository.Where<Subject>(x => x.Id == subjectId).FirstNotNullAsync();
|
|
||||||
|
//public async Task<IResponseOutput<List<FileDto>>> UploadClinicalTemplate(Guid? trialId)
|
||||||
FileDto fileDto = new FileDto();
|
//{
|
||||||
await FileUploadAsync(async (fileName) =>
|
// if (trialId == null)
|
||||||
{
|
// trialId = default(Guid);
|
||||||
var (serverFilePath, relativePath, fileRealName) = FileStoreHelper.GetUploadPrintscreenFilePath(_hostEnvironment, fileName, subjectInfo.TrialId, subjectInfo.SiteId, subjectInfo.Id);
|
|
||||||
fileDto.Path = relativePath;
|
// var filerelativePath = string.Empty;
|
||||||
fileDto.FileName = fileName;
|
// List<FileDto> fileDtos = new List<FileDto>();
|
||||||
await Task.CompletedTask;
|
// await FileUploadAsync(async (fileName) =>
|
||||||
return serverFilePath;
|
// {
|
||||||
});
|
// var (serverFilePath, relativePath, fileRealName) = FileStoreHelper.GetClinicalTemplatePath(_hostEnvironment, fileName, trialId.Value);
|
||||||
|
// //插入临床pdf 路径
|
||||||
|
// filerelativePath = relativePath;
|
||||||
return ResponseOutput.Ok(fileDto);
|
|
||||||
}
|
// fileDtos.Add(new 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,
|
// FileName = fileName,
|
||||||
|
// Path = relativePath
|
||||||
|
|
||||||
|
// });
|
||||||
|
// await Task.CompletedTask;
|
||||||
|
// return serverFilePath;
|
||||||
// });
|
// });
|
||||||
|
|
||||||
path = relativePath;
|
// return ResponseOutput.Ok(fileDtos);
|
||||||
fileDto.Path = relativePath;
|
//}
|
||||||
fileDto.FileName = fileName;
|
|
||||||
return serverFilePath;
|
|
||||||
});
|
|
||||||
|
|
||||||
await _repository.SaveChangesAsync();
|
|
||||||
return ResponseOutput.Ok(fileDto);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public class UploadNoneDicomFileCommand
|
///// <summary>
|
||||||
{
|
///// 上传阅片临床数据
|
||||||
public Guid TrialId { get; set; }
|
///// </summary>
|
||||||
public Guid SubjectVisitId { get; set; }
|
///// <param name="trialId"></param>
|
||||||
public Guid NoneDicomStudyId { get; set; }
|
///// <param name="subjectId"></param>
|
||||||
public Guid StudyMonitorId { get; set; }
|
///// <param name="readingId"></param>
|
||||||
|
///// <returns></returns>
|
||||||
|
//[HttpPost("ClinicalData/UploadClinicalData/{trialId:guid}/{subjectId:guid}/{readingId:guid}")]
|
||||||
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]
|
//[DisableRequestSizeLimit]
|
||||||
[HttpPost("NoneDicomStudy/UploadNoneDicomFile")]
|
//[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
|
||||||
[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;
|
//public async Task<IResponseOutput<List<FileDto>>> UploadReadClinicalData(Guid trialId, Guid subjectId, Guid readingId)
|
||||||
var studyMonitorId=incommand.StudyMonitorId;
|
//{
|
||||||
var noneDicomStudyId=incommand.NoneDicomStudyId;
|
// 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);
|
// FileDto fileDto = new FileDto();
|
||||||
|
// await FileUploadAsync(async (fileName) =>
|
||||||
studyMonitor.UploadFinishedTime = DateTime.Now;
|
// {
|
||||||
|
// var (serverFilePath, relativePath, fileRealName) = FileStoreHelper.GetUploadPrintscreenFilePath(_hostEnvironment, fileName, subjectInfo.TrialId, subjectInfo.SiteId, subjectInfo.Id);
|
||||||
foreach (var item in incommand.UploadedFileList)
|
// fileDto.Path = relativePath;
|
||||||
{
|
// fileDto.FileName = fileName;
|
||||||
await _repository.AddAsync(new NoneDicomStudyFile() { FileName = item.FileName, Path = item.FilePath, NoneDicomStudyId = noneDicomStudyId });
|
// await Task.CompletedTask;
|
||||||
|
// return serverFilePath;
|
||||||
}
|
// });
|
||||||
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();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
// 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>
|
/// <summary>
|
||||||
|
@ -936,6 +939,7 @@ namespace IRaCIS.Core.API.Controllers
|
||||||
return ResponseOutput.Ok();
|
return ResponseOutput.Ok();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1031,106 +1035,216 @@ namespace IRaCIS.Core.API.Controllers
|
||||||
_userInfo = userInfo;
|
_userInfo = userInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary> 缩略图 </summary>
|
|
||||||
[AllowAnonymous]
|
|
||||||
[HttpGet("Common/LocalFilePreview")]
|
|
||||||
public async Task<FileContentResult> LocalFilePreview(string relativePath)
|
|
||||||
{
|
|
||||||
|
|
||||||
var _fileStorePath = FileStoreHelper.GetPhysicalFilePath(_hostEnvironment, relativePath);
|
[HttpPost, Route("TrialSiteSurvey/UploadTrialSiteSurveyUser")]
|
||||||
|
|
||||||
var storePreviewPath = _fileStorePath + ".preview.jpeg";
|
|
||||||
|
|
||||||
if (!System.IO.File.Exists(storePreviewPath))
|
|
||||||
{
|
|
||||||
ImageHelper.ResizeSave(_fileStorePath, storePreviewPath);
|
|
||||||
}
|
|
||||||
|
|
||||||
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);
|
|
||||||
|
|
||||||
new FileExtensionContentTypeProvider().Mappings.TryGetValue(Path.GetExtension(filePath), out var contentType);
|
|
||||||
|
|
||||||
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);
|
|
||||||
|
|
||||||
new FileExtensionContentTypeProvider().Mappings.TryGetValue(Path.GetExtension(filePath), out var contentType);
|
|
||||||
|
|
||||||
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);
|
|
||||||
|
|
||||||
new FileExtensionContentTypeProvider().Mappings.TryGetValue(Path.GetExtension(filePath), out var contentType);
|
|
||||||
|
|
||||||
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]
|
[DisableFormValueModelBinding]
|
||||||
public async Task<IResponseOutput> UploadTrialDoc(Guid trialId)
|
[UnitOfWork]
|
||||||
|
public async Task<IResponseOutput> UploadTrialSiteSurveyUser(Guid trialId, string baseUrl, string routeUrl,
|
||||||
|
[FromServices] IRepository<TrialSite> _trialSiteRepository,
|
||||||
|
[FromServices] IRepository<UserType> _usertypeRepository,
|
||||||
|
[FromServices] ITrialSiteSurveyService _trialSiteSurveyService)
|
||||||
{
|
{
|
||||||
|
var (serverFilePath, relativePath, fileName) = (string.Empty, string.Empty, string.Empty);
|
||||||
|
await FileUploadAsync(async (realFileName) =>
|
||||||
|
{
|
||||||
|
fileName = realFileName;
|
||||||
|
|
||||||
return await SingleFileUploadAsync((fileName) => FileStoreHelper.GetTrialSignDocPath(_hostEnvironment, trialId, fileName));
|
if (!fileName.EndsWith(".xlsx", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
throw new BusinessValidationFailedException("请用提供格式的模板excel上传需要处理的数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
(serverFilePath, relativePath) = FileStoreHelper.GetTrialSiteSurveyFilePath(_hostEnvironment, fileName, trialId);
|
||||||
|
|
||||||
|
return serverFilePath;
|
||||||
|
});
|
||||||
|
|
||||||
|
//去掉空白行
|
||||||
|
var excelList = MiniExcel.Query<SiteSurveyUserImportDto>(serverFilePath).ToList()
|
||||||
|
.Where(t => !(string.IsNullOrWhiteSpace(t.TrialSiteCode) && string.IsNullOrWhiteSpace(t.FirstName) && string.IsNullOrWhiteSpace(t.LastName) && string.IsNullOrWhiteSpace(t.Email)
|
||||||
|
&& string.IsNullOrWhiteSpace(t.Phone) && string.IsNullOrWhiteSpace(t.UserTypeStr) && string.IsNullOrWhiteSpace(t.OrganizationName))).ToList();
|
||||||
|
|
||||||
|
if (excelList.Any(t => string.IsNullOrWhiteSpace(t.TrialSiteCode) || string.IsNullOrWhiteSpace(t.FirstName) || string.IsNullOrWhiteSpace(t.LastName) || string.IsNullOrWhiteSpace(t.Email) || string.IsNullOrWhiteSpace(t.UserTypeStr)))
|
||||||
|
{
|
||||||
|
throw new BusinessValidationFailedException("请确保Excel中 每一行的 中心编号,姓名,邮箱,用户类型数据记录完整再进行上传");
|
||||||
|
}
|
||||||
|
|
||||||
|
var siteCodeList = excelList.Select(t => t.TrialSiteCode.Trim().ToUpper()).Distinct().ToList();
|
||||||
|
|
||||||
|
if (_trialSiteRepository.Where(t => t.TrialId==trialId && siteCodeList.Contains(t.TrialSiteCode.ToUpper())).Count() != siteCodeList.Count)
|
||||||
|
{
|
||||||
|
throw new BusinessValidationFailedException("在项目中未找到该Excel中部分或全部中心");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (excelList.GroupBy(t => new { t.UserTypeStr, t.Email }).Any(g => g.Count() > 1))
|
||||||
|
{
|
||||||
|
throw new BusinessValidationFailedException("同一邮箱,同一用户类型,只能生成一个账户,请核查Excel数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (excelList.Any(t => !t.Email.Contains("@")))
|
||||||
|
{
|
||||||
|
throw new BusinessValidationFailedException("有邮箱不符合邮箱格式,请核查Excel数据");
|
||||||
|
}
|
||||||
|
var generateUserTypeList = new List<string>() { "CRC", "SR", "CRA" };
|
||||||
|
|
||||||
|
if (excelList.Any(t => !generateUserTypeList.Contains(t.UserTypeStr.ToUpper())))
|
||||||
|
{
|
||||||
|
throw new BusinessValidationFailedException("用户类型仅能为 CRC,SR,CRA 请核查Excel数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
//处理好 用户类型 和用户类型枚举
|
||||||
|
var sysUserTypeList = _usertypeRepository.Where(t => t.UserTypeEnum == UserTypeEnum.CRA || t.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator || t.UserTypeEnum == UserTypeEnum.SR).Select(t => new { UserTypeId = t.Id, t.UserTypeEnum }).ToList();
|
||||||
|
var siteList = _trialSiteRepository.Where(t => t.TrialId == trialId && siteCodeList.Contains(t.TrialSiteCode)).Select(t => new { t.TrialSiteCode, t.SiteId }).ToList();
|
||||||
|
|
||||||
|
foreach (var item in excelList)
|
||||||
|
{
|
||||||
|
switch (item.UserTypeStr.ToUpper())
|
||||||
|
{
|
||||||
|
case "CRC":
|
||||||
|
|
||||||
|
item.UserTypeId = sysUserTypeList.FirstOrDefault(t => t.UserTypeEnum == UserTypeEnum.ClinicalResearchCoordinator).UserTypeId;
|
||||||
|
item.UserTypeEnum = UserTypeEnum.ClinicalResearchCoordinator;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "CRA":
|
||||||
|
item.UserTypeId = sysUserTypeList.FirstOrDefault(t => t.UserTypeEnum == UserTypeEnum.CRA).UserTypeId;
|
||||||
|
item.UserTypeEnum = UserTypeEnum.CRA;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "SR":
|
||||||
|
item.UserTypeId = sysUserTypeList.FirstOrDefault(t => t.UserTypeEnum == UserTypeEnum.SR).UserTypeId;
|
||||||
|
item.UserTypeEnum = UserTypeEnum.SR;
|
||||||
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
item.SiteId = siteList.FirstOrDefault(t => t.TrialSiteCode.ToUpper() == item.TrialSiteCode.ToUpper()).SiteId;
|
||||||
/// 上传系统签名文档
|
}
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpPost("TrialDocument/UploadSystemDoc")]
|
|
||||||
[DisableRequestSizeLimit]
|
|
||||||
[DisableFormValueModelBinding]
|
|
||||||
public async Task<IResponseOutput> UploadSysTemDoc()
|
|
||||||
{
|
|
||||||
|
|
||||||
return await SingleFileUploadAsync((fileName) => FileStoreHelper.GetSystemSignDocPath(_hostEnvironment, fileName));
|
await _trialSiteSurveyService.ImportGenerateAccountAndJoinTrialAsync(trialId, baseUrl, routeUrl, excelList.ToList());
|
||||||
|
|
||||||
|
return ResponseOutput.Ok();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#region 废弃
|
||||||
|
|
||||||
|
///// <summary> 缩略图 </summary>
|
||||||
|
//[AllowAnonymous]
|
||||||
|
//[HttpGet("Common/LocalFilePreview")]
|
||||||
|
//public async Task<FileContentResult> LocalFilePreview(string relativePath)
|
||||||
|
//{
|
||||||
|
|
||||||
|
// var _fileStorePath = FileStoreHelper.GetPhysicalFilePath(_hostEnvironment, relativePath);
|
||||||
|
|
||||||
|
// var storePreviewPath = _fileStorePath + ".preview.jpeg";
|
||||||
|
|
||||||
|
// if (!System.IO.File.Exists(storePreviewPath))
|
||||||
|
// {
|
||||||
|
// ImageHelper.ResizeSave(_fileStorePath, storePreviewPath);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// 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);
|
||||||
|
|
||||||
|
// new FileExtensionContentTypeProvider().Mappings.TryGetValue(Path.GetExtension(filePath), out var contentType);
|
||||||
|
|
||||||
|
// 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);
|
||||||
|
|
||||||
|
// new FileExtensionContentTypeProvider().Mappings.TryGetValue(Path.GetExtension(filePath), out var contentType);
|
||||||
|
|
||||||
|
// 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);
|
||||||
|
|
||||||
|
// new FileExtensionContentTypeProvider().Mappings.TryGetValue(Path.GetExtension(filePath), out var contentType);
|
||||||
|
|
||||||
|
// 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)
|
||||||
|
//{
|
||||||
|
|
||||||
|
// return await SingleFileUploadAsync((fileName) => FileStoreHelper.GetTrialSignDocPath(_hostEnvironment, trialId, fileName));
|
||||||
|
|
||||||
|
//}
|
||||||
|
|
||||||
|
///// <summary>
|
||||||
|
///// 上传系统签名文档
|
||||||
|
///// </summary>
|
||||||
|
///// <returns></returns>
|
||||||
|
//[HttpPost("TrialDocument/UploadSystemDoc")]
|
||||||
|
//[DisableRequestSizeLimit]
|
||||||
|
//[DisableFormValueModelBinding]
|
||||||
|
//public async Task<IResponseOutput> UploadSysTemDoc()
|
||||||
|
//{
|
||||||
|
|
||||||
|
// 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>
|
/// <summary>
|
||||||
/// 上传通用文档 比如一致性核查的 比如导出的excel 模板
|
/// 上传通用文档 比如一致性核查的 比如导出的excel 模板
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -1140,25 +1254,63 @@ namespace IRaCIS.Core.API.Controllers
|
||||||
[DisableFormValueModelBinding]
|
[DisableFormValueModelBinding]
|
||||||
public async Task<IResponseOutput> UploadCommonDoc()
|
public async Task<IResponseOutput> UploadCommonDoc()
|
||||||
{
|
{
|
||||||
|
|
||||||
return await SingleFileUploadAsync((fileName) => FileStoreHelper.GetCommonDocPath(_hostEnvironment, fileName));
|
return await SingleFileUploadAsync((fileName) => FileStoreHelper.GetCommonDocPath(_hostEnvironment, fileName));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public enum UploadFileType
|
||||||
|
{
|
||||||
|
DataUpload=1,
|
||||||
|
|
||||||
|
DataDownload=2,
|
||||||
|
|
||||||
|
EmailAttachment=3,
|
||||||
|
|
||||||
|
EmailBodyHtml=4,
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 上传系统通知文档
|
/// 数据上传、导出、 邮件附件 、邮件Html 通过 ----new
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost("SystemNotice/UploadSystemNoticeDoc")]
|
[HttpPost("SystemFile/Upload")]
|
||||||
[DisableRequestSizeLimit]
|
[DisableRequestSizeLimit]
|
||||||
[DisableFormValueModelBinding]
|
[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
|
#endregion
|
||||||
|
|
||||||
|
|
|
@ -72,6 +72,9 @@
|
||||||
<PackageReference Include="EasyCaching.InMemory" Version="1.7.0" />
|
<PackageReference Include="EasyCaching.InMemory" Version="1.7.0" />
|
||||||
<PackageReference Include="EasyCaching.Interceptor.Castle" Version="1.7.0" />
|
<PackageReference Include="EasyCaching.Interceptor.Castle" Version="1.7.0" />
|
||||||
<PackageReference Include="EntityFrameworkCore.Triggered.Extensions" Version="3.2.1" />
|
<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="Invio.Extensions.Authentication.JwtBearer" Version="2.0.1" />
|
||||||
<PackageReference Include="LogDashboard" Version="1.4.8" />
|
<PackageReference Include="LogDashboard" Version="1.4.8" />
|
||||||
<PackageReference Include="MediatR.Extensions.Microsoft.DependencyInjection" Version="11.0.0" />
|
<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})">
|
<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>
|
<summary>Dicom 归档</summary>
|
||||||
</member>
|
</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)">
|
<member name="M:IRaCIS.Core.API.Controllers.StudyController.UploadVisitCheckExcel(System.Guid)">
|
||||||
<summary>
|
<summary>
|
||||||
一致性核查 excel上传 支持三种格式
|
一致性核查 excel上传 支持三种格式
|
||||||
|
@ -299,50 +238,15 @@
|
||||||
<param name="type">文件类型</param>
|
<param name="type">文件类型</param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</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">
|
<member name="M:IRaCIS.Core.API.Controllers.UploadDownLoadController.UploadCommonDoc">
|
||||||
<summary>
|
<summary>
|
||||||
上传通用文档 比如一致性核查的 比如导出的excel 模板
|
上传通用文档 比如一致性核查的 比如导出的excel 模板
|
||||||
</summary>
|
</summary>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</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>
|
<summary>
|
||||||
上传系统通知文档
|
数据上传、导出、 邮件附件 、邮件Html 通过 ----new
|
||||||
</summary>
|
</summary>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
|
|
|
@ -30,31 +30,15 @@
|
||||||
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}",
|
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}",
|
||||||
"publishAllPorts": true
|
"publishAllPorts": true
|
||||||
},
|
},
|
||||||
"IRaCIS.Staging": {
|
"Uat_Study": {
|
||||||
"commandName": "Project",
|
"commandName": "Project",
|
||||||
"launchBrowser": true,
|
"launchBrowser": true,
|
||||||
"environmentVariables": {
|
"environmentVariables": {
|
||||||
"ASPNETCORE_ENVIRONMENT": "Staging"
|
"ASPNETCORE_ENVIRONMENT": "Uat_Study"
|
||||||
},
|
},
|
||||||
"applicationUrl": "http://localhost:6200"
|
"applicationUrl": "http://localhost:6100"
|
||||||
},
|
},
|
||||||
"IRaCIS.Production": {
|
"Test_Study": {
|
||||||
"commandName": "Project",
|
|
||||||
"launchBrowser": true,
|
|
||||||
"environmentVariables": {
|
|
||||||
"ASPNETCORE_ENVIRONMENT": "Production"
|
|
||||||
},
|
|
||||||
"applicationUrl": "http://localhost:6300"
|
|
||||||
},
|
|
||||||
"IRaCIS.CertificateApply": {
|
|
||||||
"commandName": "Project",
|
|
||||||
"launchBrowser": true,
|
|
||||||
"environmentVariables": {
|
|
||||||
"ASPNETCORE_ENVIRONMENT": "CertificateApply"
|
|
||||||
},
|
|
||||||
"applicationUrl": "http://localhost:6400"
|
|
||||||
},
|
|
||||||
"IRaCIS.CenterImageDev": {
|
|
||||||
"commandName": "Project",
|
"commandName": "Project",
|
||||||
"launchBrowser": true,
|
"launchBrowser": true,
|
||||||
"environmentVariables": {
|
"environmentVariables": {
|
||||||
|
|
|
@ -114,7 +114,8 @@ namespace IRaCIS.Core.API
|
||||||
//services.AddDistributedMemoryCache();
|
//services.AddDistributedMemoryCache();
|
||||||
|
|
||||||
// hangfire 定时任务框架 有界面,更友好~
|
// hangfire 定时任务框架 有界面,更友好~
|
||||||
//services.AddhangfireSetup(_configuration);
|
services.AddhangfireSetup(_configuration);
|
||||||
|
|
||||||
// QuartZ 定时任务框架 使用了hangfire 暂时不用,后续需要可以打开,已经配好
|
// QuartZ 定时任务框架 使用了hangfire 暂时不用,后续需要可以打开,已经配好
|
||||||
services.AddQuartZSetup(_configuration);
|
services.AddQuartZSetup(_configuration);
|
||||||
|
|
||||||
|
@ -181,7 +182,7 @@ namespace IRaCIS.Core.API
|
||||||
app.UseLogDashboard("/LogDashboard");
|
app.UseLogDashboard("/LogDashboard");
|
||||||
|
|
||||||
//hangfire
|
//hangfire
|
||||||
//app.UseHangfireConfig(env);
|
app.UseHangfireConfig(env);
|
||||||
|
|
||||||
////暂时废弃
|
////暂时废弃
|
||||||
//app.UseHttpReports();
|
//app.UseHttpReports();
|
||||||
|
|
|
@ -1,99 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
using System.Linq;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
|
|
||||||
namespace EFSaving.Concurrency
|
|
||||||
{
|
|
||||||
public class Sample
|
|
||||||
{
|
|
||||||
public static void Run()
|
|
||||||
{
|
|
||||||
// Ensure database is created and has a person in it
|
|
||||||
using (var setupContext = new PersonContext())
|
|
||||||
{
|
|
||||||
setupContext.Database.EnsureDeleted();
|
|
||||||
setupContext.Database.EnsureCreated();
|
|
||||||
|
|
||||||
setupContext.People.Add(new Person { FirstName = "John", LastName = "Doe" });
|
|
||||||
setupContext.SaveChanges();
|
|
||||||
}
|
|
||||||
|
|
||||||
#region ConcurrencyHandlingCode
|
|
||||||
using var context = new PersonContext();
|
|
||||||
// Fetch a person from database and change phone number
|
|
||||||
var person = context.People.Single(p => p.PersonId == 1);
|
|
||||||
person.PhoneNumber = "555-555-5555";
|
|
||||||
|
|
||||||
// Change the person's name in the database to simulate a concurrency conflict
|
|
||||||
context.Database.ExecuteSqlRaw(
|
|
||||||
"UPDATE dbo.People SET FirstName = 'Jane' WHERE PersonId = 1");
|
|
||||||
|
|
||||||
var saved = false;
|
|
||||||
while (!saved)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
// Attempt to save changes to the database
|
|
||||||
context.SaveChanges();
|
|
||||||
saved = true;
|
|
||||||
}
|
|
||||||
catch (DbUpdateConcurrencyException ex)
|
|
||||||
{
|
|
||||||
foreach (var entry in ex.Entries)
|
|
||||||
{
|
|
||||||
if (entry.Entity is Person)
|
|
||||||
{
|
|
||||||
var proposedValues = entry.CurrentValues;
|
|
||||||
var databaseValues = entry.GetDatabaseValues();
|
|
||||||
|
|
||||||
foreach (var property in proposedValues.Properties)
|
|
||||||
{
|
|
||||||
var proposedValue = proposedValues[property];
|
|
||||||
var databaseValue = databaseValues[property];
|
|
||||||
|
|
||||||
// TODO: decide which value should be written to database
|
|
||||||
// proposedValues[property] = <value to be saved>;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Refresh original values to bypass next concurrency check
|
|
||||||
entry.OriginalValues.SetValues(databaseValues);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
throw new NotSupportedException(
|
|
||||||
"Don't know how to handle concurrency conflicts for "
|
|
||||||
+ entry.Metadata.Name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
|
|
||||||
public class PersonContext : DbContext
|
|
||||||
{
|
|
||||||
public DbSet<Person> People { get; set; }
|
|
||||||
|
|
||||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
|
||||||
{
|
|
||||||
// Requires NuGet package Microsoft.EntityFrameworkCore.SqlServer
|
|
||||||
optionsBuilder.UseSqlServer(
|
|
||||||
@"Server=(localdb)\mssqllocaldb;Database=EFSaving.Concurrency;Trusted_Connection=True");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class Person
|
|
||||||
{
|
|
||||||
public int PersonId { get; set; }
|
|
||||||
|
|
||||||
[ConcurrencyCheck]
|
|
||||||
public string FirstName { get; set; }
|
|
||||||
|
|
||||||
[ConcurrencyCheck]
|
|
||||||
public string LastName { get; set; }
|
|
||||||
|
|
||||||
public string PhoneNumber { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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());
|
//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": {
|
"ConnectionStrings": {
|
||||||
"RemoteNew": "Server=123.56.94.154,1433\\MSSQLSERVER;Database=CenterImage_Test;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": {
|
"BasicSystemConfig": {
|
||||||
|
|
||||||
|
@ -28,9 +29,9 @@
|
||||||
"SystemEmailSendConfig": {
|
"SystemEmailSendConfig": {
|
||||||
"Port": 465,
|
"Port": 465,
|
||||||
"Host": "smtp.qiye.aliyun.com",
|
"Host": "smtp.qiye.aliyun.com",
|
||||||
"FromEmail": "test@extimaging.com",
|
"FromEmail": "test-study@extimaging.com",
|
||||||
"FromName": "Test_IRC",
|
"FromName": "Test_Study",
|
||||||
"AuthorizationCode": "SHzyyl2021"
|
"AuthorizationCode": "zhanying123"
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,8 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ConnectionStrings": {
|
"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": {
|
"BasicSystemConfig": {
|
||||||
|
|
||||||
|
@ -28,9 +29,9 @@
|
||||||
"SystemEmailSendConfig": {
|
"SystemEmailSendConfig": {
|
||||||
"Port": 465,
|
"Port": 465,
|
||||||
"Host": "smtp.qiye.aliyun.com",
|
"Host": "smtp.qiye.aliyun.com",
|
||||||
"FromEmail": "test@extimaging.com",
|
"FromEmail": "uat-study@extimaging.com",
|
||||||
"FromName": "Test_IRC",
|
"FromName": "Uat_Study",
|
||||||
"AuthorizationCode": "SHzyyl2021"
|
"AuthorizationCode": "zhanying123"
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -227,6 +227,28 @@ public static class FileStoreHelper
|
||||||
return (serverFilePath, relativePath);
|
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模板 )
|
// 获取通用文档存放路径(excel模板 )
|
||||||
|
|
||||||
public static (string PhysicalPath, string RelativePath) GetCommonDocPath(IWebHostEnvironment _hostEnvironment, string fileName)
|
public static (string PhysicalPath, string RelativePath) GetCommonDocPath(IWebHostEnvironment _hostEnvironment, string fileName)
|
||||||
|
@ -292,6 +314,28 @@ public static class FileStoreHelper
|
||||||
return (serverFilePath, relativePath);
|
return (serverFilePath, relativePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//获取 中心调研用户路径
|
||||||
|
|
||||||
|
public static (string PhysicalPath, string RelativePath) GetTrialSiteSurveyFilePath(IWebHostEnvironment _hostEnvironment, string fileName, Guid trialId)
|
||||||
|
{
|
||||||
|
var rootPath = FileStoreHelper.GetIRaCISRootDataFolder(_hostEnvironment);
|
||||||
|
|
||||||
|
//上传根路径
|
||||||
|
string uploadFolderPath = Path.Combine(rootPath, StaticData.Folder.TrialDataFolder, trialId.ToString(), StaticData.Folder.UploadSiteSurveyData);
|
||||||
|
|
||||||
|
if (!Directory.Exists(uploadFolderPath)) Directory.CreateDirectory(uploadFolderPath);
|
||||||
|
|
||||||
|
|
||||||
|
var (trustedFileNameForFileStorage, realFileName) = FileStoreHelper.GetStoreFileName(fileName);
|
||||||
|
|
||||||
|
|
||||||
|
var relativePath = $"/{StaticData.Folder.IRaCISDataFolder}/{StaticData.Folder.TrialDataFolder}/{trialId}/{StaticData.Folder.UploadSiteSurveyData}/{trustedFileNameForFileStorage}";
|
||||||
|
|
||||||
|
var serverFilePath = Path.Combine(uploadFolderPath, trustedFileNameForFileStorage);
|
||||||
|
|
||||||
|
return (serverFilePath, relativePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static (string PhysicalPath, string RelativePath, string FileRealName) GetClinicalTemplatePath(IWebHostEnvironment _hostEnvironment, string fileName,Guid trialId)
|
public static (string PhysicalPath, string RelativePath, string FileRealName) GetClinicalTemplatePath(IWebHostEnvironment _hostEnvironment, string fileName,Guid trialId)
|
||||||
{
|
{
|
||||||
|
|
|
@ -7741,42 +7741,6 @@
|
||||||
<param name="addOrEditTrialExternalUser"></param>
|
<param name="addOrEditTrialExternalUser"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:IRaCIS.Core.Application.Service.TrialExternalUserService.SendInviteEmail(IRaCIS.Core.Application.ViewModel.TrialExternalUserSendEmail)">
|
|
||||||
<summary>
|
|
||||||
勾选用户 批量发送邮件
|
|
||||||
</summary>
|
|
||||||
<returns></returns>
|
|
||||||
</member>
|
|
||||||
<member name="M:IRaCIS.Core.Application.Service.TrialExternalUserService.TrialExternalUserJoinTrial(IRaCIS.Core.Application.ViewModel.TrialExternalUserConfirm)">
|
|
||||||
<summary>
|
|
||||||
不带Token 访问 用户选择 参与 不参与 Id: TrialExternalUserId 加入发送邮件
|
|
||||||
</summary>
|
|
||||||
<param name="editTrialUserPreparation"></param>
|
|
||||||
<returns></returns>
|
|
||||||
</member>
|
|
||||||
<member name="M:IRaCIS.Core.Application.Service.TrialExternalUserService.TrialSiteSurveyUserJoinTrial(IRaCIS.Core.Application.ViewModel.TrialExternalUserConfirm)">
|
|
||||||
<summary>
|
|
||||||
不带Token 访问 Site调研用户 加入项目 Id: TrialSiteSurveyUserId
|
|
||||||
</summary>
|
|
||||||
<param name="editInfo"></param>
|
|
||||||
<returns></returns>
|
|
||||||
</member>
|
|
||||||
<member name="M:IRaCIS.Core.Application.Service.TrialExternalUserService.JoinBasicInfo(System.Guid,System.Boolean)">
|
|
||||||
<summary>
|
|
||||||
不带Token 访问 页面获取项目基本信息 和参与情况 (已经确认了 就不允许再次确认) Id: TrialExternalUserId/TrialSiteSurveyUserId
|
|
||||||
</summary>
|
|
||||||
<param name="id"></param>
|
|
||||||
<param name="isExternalUser"></param>
|
|
||||||
<returns></returns>
|
|
||||||
</member>
|
|
||||||
<member name="M:IRaCIS.Core.Application.Service.TrialExternalUserService.UserConfirmJoinTrial(System.Guid,System.Guid)">
|
|
||||||
<summary>
|
|
||||||
加入项目
|
|
||||||
</summary>
|
|
||||||
<param name="trialId"></param>
|
|
||||||
<param name="trialExternalUserId"></param>
|
|
||||||
<returns></returns>
|
|
||||||
</member>
|
|
||||||
<member name="T:IRaCIS.Core.Application.ViewModel.TaskAllocationRuleView">
|
<member name="T:IRaCIS.Core.Application.ViewModel.TaskAllocationRuleView">
|
||||||
<summary> TaskAllocationRuleView 列表视图模型 </summary>
|
<summary> TaskAllocationRuleView 列表视图模型 </summary>
|
||||||
</member>
|
</member>
|
||||||
|
@ -9461,7 +9425,7 @@
|
||||||
</member>
|
</member>
|
||||||
<member name="M:IRaCIS.Core.Application.Contracts.TrialSiteSurveyService.SendVerifyCode(IRaCIS.Core.Application.Contracts.SiteSurveySendVerifyCode)">
|
<member name="M:IRaCIS.Core.Application.Contracts.TrialSiteSurveyService.SendVerifyCode(IRaCIS.Core.Application.Contracts.SiteSurveySendVerifyCode)">
|
||||||
<summary>
|
<summary>
|
||||||
发送验证码
|
site 调研 发送验证码
|
||||||
</summary>
|
</summary>
|
||||||
<param name="userInfo"></param>
|
<param name="userInfo"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
|
@ -9520,14 +9484,6 @@
|
||||||
</summary>
|
</summary>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:IRaCIS.Core.Application.Contracts.TrialSiteSurveyService.SubmissionRejection(System.Guid,System.Guid)">
|
|
||||||
<summary>
|
|
||||||
驳回
|
|
||||||
</summary>
|
|
||||||
<param name="trialId"></param>
|
|
||||||
<param name="trialSiteSurveyId"></param>
|
|
||||||
<returns></returns>
|
|
||||||
</member>
|
|
||||||
<member name="M:IRaCIS.Core.Application.Contracts.TrialSiteSurveyService.TrialSurveySubmit(IRaCIS.Core.Application.Contracts.TrialSiteSurvyeSubmitDTO)">
|
<member name="M:IRaCIS.Core.Application.Contracts.TrialSiteSurveyService.TrialSurveySubmit(IRaCIS.Core.Application.Contracts.TrialSiteSurvyeSubmitDTO)">
|
||||||
<summary>
|
<summary>
|
||||||
提交 后台自动识别是谁提交
|
提交 后台自动识别是谁提交
|
||||||
|
|
|
@ -255,6 +255,8 @@ namespace IRaCIS.Core.Application.Service.Allocation
|
||||||
|
|
||||||
visitTask.LatestReplyUserId = _userInfo.Id;
|
visitTask.LatestReplyUserId = _userInfo.Id;
|
||||||
visitTask.LatestReplyTime = DateTime.Now;
|
visitTask.LatestReplyTime = DateTime.Now;
|
||||||
|
visitTask.IsEnrollment = incommand.PIAuditState == PIAuditState.PINotAgree ? null : visitTask.IsEnrollment;
|
||||||
|
visitTask.IsPDConfirm = incommand.PIAuditState == PIAuditState.PINotAgree ? null : visitTask.IsPDConfirm;
|
||||||
|
|
||||||
if (isFirstAudit)
|
if (isFirstAudit)
|
||||||
{
|
{
|
||||||
|
|
|
@ -155,9 +155,7 @@ namespace IRaCIS.Core.Application.Service.Common
|
||||||
.Where(t => groupSelectIdQuery.Contains(t.TrialSiteSurveyId))
|
.Where(t => groupSelectIdQuery.Contains(t.TrialSiteSurveyId))
|
||||||
.WhereIf(queryParam.UserTypeId != null, t => t.UserTypeId == queryParam.UserTypeId)
|
.WhereIf(queryParam.UserTypeId != null, t => t.UserTypeId == queryParam.UserTypeId)
|
||||||
.WhereIf(queryParam.IsGenerateAccount != null, t => t.IsGenerateAccount == queryParam.IsGenerateAccount)
|
.WhereIf(queryParam.IsGenerateAccount != null, t => t.IsGenerateAccount == queryParam.IsGenerateAccount)
|
||||||
.WhereIf(queryParam.TrialRoleNameId != null, t => t.TrialRoleNameId == queryParam.TrialRoleNameId)
|
|
||||||
.WhereIf(queryParam.State != null && queryParam.State != TrialSiteUserStateEnum.OverTime, t => t.InviteState == queryParam.State)
|
.WhereIf(queryParam.State != null && queryParam.State != TrialSiteUserStateEnum.OverTime, t => t.InviteState == queryParam.State)
|
||||||
.WhereIf(queryParam.State != null && queryParam.State == TrialSiteUserStateEnum.OverTime, t => t.InviteState == TrialSiteUserStateEnum.HasSend && t.ExpireTime < DateTime.Now)
|
|
||||||
.WhereIf(!string.IsNullOrEmpty(queryParam.UserName), t => (t.LastName + " / " + t.FirstName).Contains(queryParam.UserName))
|
.WhereIf(!string.IsNullOrEmpty(queryParam.UserName), t => (t.LastName + " / " + t.FirstName).Contains(queryParam.UserName))
|
||||||
.WhereIf(!string.IsNullOrEmpty(queryParam.OrganizationName), t => t.OrganizationName.Contains(queryParam.OrganizationName))
|
.WhereIf(!string.IsNullOrEmpty(queryParam.OrganizationName), t => t.OrganizationName.Contains(queryParam.OrganizationName))
|
||||||
.ProjectTo<TrialSiteUserSummaryDto>(_mapper.ConfigurationProvider);
|
.ProjectTo<TrialSiteUserSummaryDto>(_mapper.ConfigurationProvider);
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using IRaCIS.Core.Application.Contracts;
|
using IRaCIS.Core.Application.Contracts;
|
||||||
using User = IRaCIS.Core.Domain.Models.User;
|
using User = IRaCIS.Core.Domain.Models.User;
|
||||||
|
using DocumentFormat.OpenXml.Office2010.Word;
|
||||||
|
|
||||||
namespace IRaCIS.Core.Application.Services
|
namespace IRaCIS.Core.Application.Services
|
||||||
{
|
{
|
||||||
|
@ -19,13 +20,15 @@ namespace IRaCIS.Core.Application.Services
|
||||||
|
|
||||||
private readonly IRepository<SystemDocument> _systemDocumentRepository;
|
private readonly IRepository<SystemDocument> _systemDocumentRepository;
|
||||||
private readonly IRepository<SystemDocNeedConfirmedUserType> _systemDocNeedConfirmedUserTypeRepository;
|
private readonly IRepository<SystemDocNeedConfirmedUserType> _systemDocNeedConfirmedUserTypeRepository;
|
||||||
|
private readonly IRepository<SystemDocConfirmedUser> _systemDocConfirmedUserRepository;
|
||||||
|
|
||||||
public SystemDocumentService( IRepository<SystemDocument> systemDocumentRepository,
|
public SystemDocumentService( IRepository<SystemDocument> systemDocumentRepository,
|
||||||
IRepository<SystemDocNeedConfirmedUserType> systemDocNeedConfirmedUserTypeRepository
|
IRepository<SystemDocNeedConfirmedUserType> systemDocNeedConfirmedUserTypeRepository,
|
||||||
)
|
IRepository<SystemDocConfirmedUser> systemDocConfirmedUserRepository)
|
||||||
{
|
{
|
||||||
_systemDocumentRepository = systemDocumentRepository;
|
_systemDocumentRepository = systemDocumentRepository;
|
||||||
this._systemDocNeedConfirmedUserTypeRepository = systemDocNeedConfirmedUserTypeRepository;
|
this._systemDocNeedConfirmedUserTypeRepository = systemDocNeedConfirmedUserTypeRepository;
|
||||||
|
_systemDocConfirmedUserRepository = systemDocConfirmedUserRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -109,6 +112,22 @@ namespace IRaCIS.Core.Application.Services
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpDelete("{systemDocumentId:guid}")]
|
||||||
|
public async Task<IResponseOutput> AbandonSystemDocumentAsync(Guid systemDocumentId)
|
||||||
|
{
|
||||||
|
|
||||||
|
await _systemDocumentRepository.UpdatePartialFromQueryAsync(systemDocumentId, u => new SystemDocument() { IsDeleted = true });
|
||||||
|
|
||||||
|
await _systemDocConfirmedUserRepository.UpdatePartialFromQueryAsync(x => x.SystemDocumentId == systemDocumentId, x => new SystemDocConfirmedUser()
|
||||||
|
{
|
||||||
|
IsDeleted = true
|
||||||
|
});
|
||||||
|
|
||||||
|
await _systemDocConfirmedUserRepository.SaveChangesAsync();
|
||||||
|
return ResponseOutput.Result(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[HttpDelete("{systemDocumentId:guid}")]
|
[HttpDelete("{systemDocumentId:guid}")]
|
||||||
public async Task<IResponseOutput> DeleteSystemDocumentAsync(Guid systemDocumentId)
|
public async Task<IResponseOutput> DeleteSystemDocumentAsync(Guid systemDocumentId)
|
||||||
|
|
|
@ -224,7 +224,7 @@ namespace IRaCIS.Core.Application.Services
|
||||||
.Where(t => t.IsDeleted == false && !t.SystemDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id && t.ConfirmTime != null) && t.NeedConfirmedUserTypeList.Any(u => u.NeedConfirmUserTypeId == _userInfo.UserTypeId))
|
.Where(t => t.IsDeleted == false && !t.SystemDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id && t.ConfirmTime != null) && t.NeedConfirmedUserTypeList.Any(u => u.NeedConfirmUserTypeId == _userInfo.UserTypeId))
|
||||||
.CountAsync();
|
.CountAsync();
|
||||||
|
|
||||||
var trialTaskConfig = _trialRepository.Where(t => t.Id == querySystemDocument.TrialId).ProjectTo<TrialProcessConfigDTO>(_mapper.ConfigurationProvider).FirstOrDefault();
|
var trialTaskConfig = _trialRepository.Where(t => t.Id == querySystemDocument.TrialId).ProjectTo<TrialConfigTabDto>(_mapper.ConfigurationProvider).FirstOrDefault();
|
||||||
|
|
||||||
|
|
||||||
//var trialCriterionAdditionalAssessmentTypeList = _trialCriterionAdditionalAssessmentTypeRepository
|
//var trialCriterionAdditionalAssessmentTypeList = _trialCriterionAdditionalAssessmentTypeRepository
|
||||||
|
|
|
@ -112,10 +112,18 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
var userTypeEnums = new List<UserTypeEnum>();
|
var userTypeEnums = new List<UserTypeEnum>();
|
||||||
|
|
||||||
if (userTypeSelectEnum == UserTypeSelectEnum.ExternalUser)
|
if (userTypeSelectEnum == UserTypeSelectEnum.ExternalUser)
|
||||||
|
{
|
||||||
|
if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.TA)
|
||||||
|
{
|
||||||
|
userTypeEnums = new List<UserTypeEnum>() { UserTypeEnum.ProjectManager };
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
userTypeEnums = new List<UserTypeEnum>() { UserTypeEnum.PI, UserTypeEnum.MIM };
|
userTypeEnums = new List<UserTypeEnum>() { UserTypeEnum.PI, UserTypeEnum.MIM };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if (userTypeSelectEnum == UserTypeSelectEnum.SiteSurvey)
|
if (userTypeSelectEnum == UserTypeSelectEnum.SiteSurvey)
|
||||||
{
|
{
|
||||||
userTypeEnums = new List<UserTypeEnum>() { UserTypeEnum.SR, UserTypeEnum.ClinicalResearchCoordinator, UserTypeEnum.CRA };
|
userTypeEnums = new List<UserTypeEnum>() { UserTypeEnum.SR, UserTypeEnum.ClinicalResearchCoordinator, UserTypeEnum.CRA };
|
||||||
|
|
|
@ -84,7 +84,6 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
|
|
||||||
|
|
||||||
public bool? IsGenerateAccount { get; set; }
|
public bool? IsGenerateAccount { get; set; }
|
||||||
public Guid? TrialRoleNameId { get; set; }
|
|
||||||
|
|
||||||
public TrialSiteUserStateEnum? State { get; set; }
|
public TrialSiteUserStateEnum? State { get; set; }
|
||||||
|
|
||||||
|
@ -168,6 +167,29 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public class TrialSiteSurveySelectView
|
||||||
|
{
|
||||||
|
public Guid Id { get; set; }
|
||||||
|
public TrialSiteSurveyEnum State { get; set; }
|
||||||
|
public DateTime CreateTime { get; set; }
|
||||||
|
public bool IsDeleted { get; set; }
|
||||||
|
|
||||||
|
public string Phone { get; set; } = string.Empty;
|
||||||
|
public string Email { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public string UserName { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public class TrialSiteSurveySelectquery
|
||||||
|
{
|
||||||
|
public Guid TrialId { get; set; }
|
||||||
|
|
||||||
|
public Guid SiteId { get; set; }
|
||||||
|
|
||||||
|
public Guid TrialSiteSurveyId { get;set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
///<summary>TrialSiteSurveyQuery 列表查询参数模型</summary>
|
///<summary>TrialSiteSurveyQuery 列表查询参数模型</summary>
|
||||||
|
|
|
@ -5,7 +5,9 @@
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
using IRaCIS.Core.Application.Helper;
|
using IRaCIS.Core.Application.Helper;
|
||||||
using IRaCIS.Core.Domain.Share;
|
using IRaCIS.Core.Domain.Share;
|
||||||
|
using MiniExcelLibs.Attributes;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
namespace IRaCIS.Core.Application.Contracts
|
namespace IRaCIS.Core.Application.Contracts
|
||||||
{
|
{
|
||||||
|
@ -48,14 +50,18 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public string TrialRoleName { get; set; }
|
|
||||||
|
|
||||||
public string TrialRoleCode { get; set; }
|
|
||||||
|
|
||||||
public UserTypeEnum? UserTypeEnum { get; set; }
|
public UserTypeEnum? UserTypeEnum { get; set; }
|
||||||
|
|
||||||
public Guid? SystemUserId { get; set; }
|
public Guid? SystemUserId { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public bool? IsHistoryUserOriginDeleted { get; set; }
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -98,11 +104,20 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
|
|
||||||
[DictionaryTranslateAttribute("YesOrNo")]
|
[DictionaryTranslateAttribute("YesOrNo")]
|
||||||
public bool IsGenerateAccount { get; set; }
|
public bool IsGenerateAccount { get; set; }
|
||||||
public Guid TrialRoleNameId { get; set; }
|
public int TrialRoleCode { get; set; }
|
||||||
|
|
||||||
public string OrganizationName { get; set; } = string.Empty;
|
public string OrganizationName { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public bool IsHistoryUser { get; set; }
|
||||||
|
public bool? IsHistoryUserDeleted { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class TrialSiteUserSurverQuery
|
||||||
|
{
|
||||||
|
public Guid TrialSiteSurveyId { get; set; }
|
||||||
|
|
||||||
|
public bool? IsHistoryUser { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
public class TrialSiteUserSurveyVerfyResult
|
public class TrialSiteUserSurveyVerfyResult
|
||||||
{
|
{
|
||||||
|
@ -111,6 +126,44 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
public List<string> ErroMsgList { get; set; } = new List<string>();
|
public List<string> ErroMsgList { get; set; } = new List<string>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class SiteSurveyUserImportUploadDto
|
||||||
|
{
|
||||||
|
[NotDefault]
|
||||||
|
public Guid TrialId { get; set; }
|
||||||
|
|
||||||
|
public string BaseUrl { get; set; }
|
||||||
|
public string RouteUrl { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class SiteSurveyUserImportDto
|
||||||
|
{
|
||||||
|
public string TrialSiteCode { get;set; }=string.Empty;
|
||||||
|
public string FirstName { get; set; } = string.Empty;
|
||||||
|
public string LastName { get; set; } = string.Empty;
|
||||||
|
public string Email { get; set; } = string.Empty;
|
||||||
|
public string Phone { get; set; } = string.Empty;
|
||||||
|
public string OrganizationName { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
[ExcelColumnName("UserType")]
|
||||||
|
public string UserTypeStr { get; set; }
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
|
public Guid SiteId { get; set; }
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
|
public UserTypeEnum UserTypeEnum { get; set; } = UserTypeEnum.Undefined;
|
||||||
|
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
|
public Guid UserTypeId{ get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
|
public bool IsGeneratedAccount { get; set; }
|
||||||
|
[JsonIgnore]
|
||||||
|
public bool IsJoinedTrial { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -20,5 +20,7 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
//Task<IResponseOutput> TrialSurveyLock(Guid trialSiteSurveyId, bool isLock);
|
//Task<IResponseOutput> TrialSurveyLock(Guid trialSiteSurveyId, bool isLock);
|
||||||
//IResponseOutput TrialSurveySubmmit(Guid trialId, Guid trialSiteSurveyId);
|
//IResponseOutput TrialSurveySubmmit(Guid trialId, Guid trialSiteSurveyId);
|
||||||
Task<IResponseOutput> VerifySendCode(LoginDto userInfo, [FromServices] ITokenService _tokenService);
|
Task<IResponseOutput> VerifySendCode(LoginDto userInfo, [FromServices] ITokenService _tokenService);
|
||||||
|
|
||||||
|
Task ImportGenerateAccountAndJoinTrialAsync(Guid trialId, string baseUrl,string rootUrl, List<SiteSurveyUserImportDto> list);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -10,6 +10,6 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
{
|
{
|
||||||
Task<IResponseOutput> AddOrUpdateTrialSiteUserSurvey(TrialSiteUserSurveyAddOrEdit addOrEditTrialSiteUserSurvey);
|
Task<IResponseOutput> AddOrUpdateTrialSiteUserSurvey(TrialSiteUserSurveyAddOrEdit addOrEditTrialSiteUserSurvey);
|
||||||
Task<IResponseOutput> DeleteTrialSiteUserSurvey(Guid trialSiteUserSurveyId);
|
Task<IResponseOutput> DeleteTrialSiteUserSurvey(Guid trialSiteUserSurveyId);
|
||||||
Task<List<TrialSiteUserSurveyView>> GetTrialSiteUserSurveyList(Guid trialSiteSurveyId);
|
Task<List<TrialSiteUserSurveyView>> GetTrialSiteUserSurveyList(TrialSiteUserSurverQuery inquery);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -17,10 +17,12 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
public class TrialSiteEquipmentSurveyService : BaseService, ITrialSiteEquipmentSurveyService
|
public class TrialSiteEquipmentSurveyService : BaseService, ITrialSiteEquipmentSurveyService
|
||||||
{
|
{
|
||||||
private readonly IRepository<TrialSiteEquipmentSurvey> _trialSiteEquipmentSurveyRepository;
|
private readonly IRepository<TrialSiteEquipmentSurvey> _trialSiteEquipmentSurveyRepository;
|
||||||
|
private readonly IRepository<TrialSiteSurvey> _trialSiteSurveyRepository;
|
||||||
|
|
||||||
public TrialSiteEquipmentSurveyService(IRepository<TrialSiteEquipmentSurvey> trialSiteEquipmentSurveyRepository)
|
public TrialSiteEquipmentSurveyService(IRepository<TrialSiteEquipmentSurvey> trialSiteEquipmentSurveyRepository, IRepository<TrialSiteSurvey> trialSiteSurveyRepository)
|
||||||
{
|
{
|
||||||
_trialSiteEquipmentSurveyRepository = trialSiteEquipmentSurveyRepository;
|
_trialSiteEquipmentSurveyRepository = trialSiteEquipmentSurveyRepository;
|
||||||
|
_trialSiteSurveyRepository = trialSiteSurveyRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -39,16 +41,13 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
public async Task<IResponseOutput> AddOrUpdateTrialSiteEquipmentSurvey(TrialSiteEquipmentSurveyAddOrEdit addOrEditTrialSiteEquipmentSurvey)
|
public async Task<IResponseOutput> AddOrUpdateTrialSiteEquipmentSurvey(TrialSiteEquipmentSurveyAddOrEdit addOrEditTrialSiteEquipmentSurvey)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (addOrEditTrialSiteEquipmentSurvey.Id != null)
|
if (await _trialSiteSurveyRepository.AnyAsync(t => t.Id == addOrEditTrialSiteEquipmentSurvey.TrialSiteSurveyId && (t.IsDeleted == true ||t.State==TrialSiteSurveyEnum.PMCreatedAndLock), true))
|
||||||
{
|
{
|
||||||
if (await _trialSiteEquipmentSurveyRepository.Where(t => t.Id == addOrEditTrialSiteEquipmentSurvey.Id).AnyAsync(t => t.TrialSiteSurvey.State==TrialSiteSurveyEnum.PMCreatedAndLock))
|
return ResponseOutput.NotOk("当前调研表已废除,或者调研表状态已锁定,不允许操作");
|
||||||
{
|
|
||||||
//---已锁定,不允许操作
|
|
||||||
return ResponseOutput.NotOk(_localizer["TrialSiteEquipment_Locked"]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var entity = await _trialSiteEquipmentSurveyRepository.InsertOrUpdateAsync(addOrEditTrialSiteEquipmentSurvey, true);
|
var entity = await _trialSiteEquipmentSurveyRepository.InsertOrUpdateAsync(addOrEditTrialSiteEquipmentSurvey, true);
|
||||||
|
|
||||||
return ResponseOutput.Ok(entity.Id.ToString());
|
return ResponseOutput.Ok(entity.Id.ToString());
|
||||||
|
|
|
@ -15,6 +15,12 @@ using MailKit.Security;
|
||||||
using MimeKit;
|
using MimeKit;
|
||||||
using IRaCIS.Core.Application.Helper;
|
using IRaCIS.Core.Application.Helper;
|
||||||
using IRaCIS.Core.Application.Filter;
|
using IRaCIS.Core.Application.Filter;
|
||||||
|
using IRaCIS.Core.Infrastructure.Extention;
|
||||||
|
using Microsoft.VisualBasic;
|
||||||
|
using DocumentFormat.OpenXml.Spreadsheet;
|
||||||
|
using IRaCIS.Core.Domain.Models;
|
||||||
|
using IRaCIS.Core.Application.ViewModel;
|
||||||
|
using Dicom;
|
||||||
|
|
||||||
namespace IRaCIS.Core.Application.Contracts
|
namespace IRaCIS.Core.Application.Contracts
|
||||||
{
|
{
|
||||||
|
@ -29,13 +35,14 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
private readonly IRepository<User> _userRepository;
|
private readonly IRepository<User> _userRepository;
|
||||||
private readonly IRepository<TrialSite> _trialSiteRepository;
|
private readonly IRepository<TrialSite> _trialSiteRepository;
|
||||||
private readonly IRepository<TrialUser> _trialUserRepository;
|
private readonly IRepository<TrialUser> _trialUserRepository;
|
||||||
|
private readonly IRepository<TrialSiteUser> _trialSiteUserRepository;
|
||||||
private readonly ITokenService _tokenService;
|
private readonly ITokenService _tokenService;
|
||||||
private readonly IMailVerificationService _mailVerificationService;
|
private readonly IMailVerificationService _mailVerificationService;
|
||||||
|
|
||||||
public TrialSiteSurveyService(IRepository<TrialSiteSurvey> trialSiteSurveyRepository, IRepository<TrialUser> trialUserRepository, IRepository<TrialSiteUserSurvey> trialSiteUserSurveyRepository,
|
public TrialSiteSurveyService(IRepository<TrialSiteSurvey> trialSiteSurveyRepository, IRepository<TrialUser> trialUserRepository, IRepository<TrialSiteUserSurvey> trialSiteUserSurveyRepository,
|
||||||
IRepository<User> userRepository, IRepository<TrialSite> trialSiteRepository,
|
IRepository<User> userRepository, IRepository<TrialSite> trialSiteRepository,
|
||||||
ITokenService tokenService,
|
ITokenService tokenService,
|
||||||
IMailVerificationService mailVerificationService)
|
IMailVerificationService mailVerificationService, IRepository<TrialSiteUser> trialSiteUserRepository)
|
||||||
{
|
{
|
||||||
_trialSiteSurveyRepository = trialSiteSurveyRepository;
|
_trialSiteSurveyRepository = trialSiteSurveyRepository;
|
||||||
_trialSiteUserSurveyRepository = trialSiteUserSurveyRepository;
|
_trialSiteUserSurveyRepository = trialSiteUserSurveyRepository;
|
||||||
|
@ -44,6 +51,7 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
_trialSiteRepository = trialSiteRepository;
|
_trialSiteRepository = trialSiteRepository;
|
||||||
_tokenService = tokenService;
|
_tokenService = tokenService;
|
||||||
_mailVerificationService = mailVerificationService;
|
_mailVerificationService = mailVerificationService;
|
||||||
|
_trialSiteUserRepository = trialSiteUserRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
private object lockObj { get; set; } = new object();
|
private object lockObj { get; set; } = new object();
|
||||||
|
@ -107,7 +115,7 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 发送验证码
|
///site 调研 发送验证码
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="userInfo"></param>
|
/// <param name="userInfo"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
|
@ -150,106 +158,168 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
public async Task<IResponseOutput> VerifySendCode(LoginDto userInfo, [FromServices] ITokenService _tokenService)
|
public async Task<IResponseOutput> VerifySendCode(LoginDto userInfo, [FromServices] ITokenService _tokenService)
|
||||||
{
|
{
|
||||||
|
|
||||||
var isReplaceUser = !string.IsNullOrEmpty(userInfo.ReplaceUserEmailOrPhone);
|
|
||||||
|
#region 历史版本 删除前
|
||||||
|
|
||||||
|
//var isReplaceUser = !string.IsNullOrEmpty(userInfo.ReplaceUserEmailOrPhone);
|
||||||
|
|
||||||
|
|
||||||
if (userInfo.IsUpdate && isReplaceUser && !await _trialSiteSurveyRepository.AnyAsync(t => (t.Email == userInfo.ReplaceUserEmailOrPhone || t.Phone == userInfo.ReplaceUserEmailOrPhone) && t.SiteId == userInfo.SiteId && t.TrialId == userInfo.TrialId))
|
//if (userInfo.IsUpdate && isReplaceUser && !await _trialSiteSurveyRepository.AnyAsync(t => (t.Email == userInfo.ReplaceUserEmailOrPhone || t.Phone == userInfo.ReplaceUserEmailOrPhone) && t.SiteId == userInfo.SiteId && t.TrialId == userInfo.TrialId))
|
||||||
|
//{
|
||||||
|
// //---该中心不存在该交接人的中心调研记录表,不允许选择更新。
|
||||||
|
// return ResponseOutput.NotOk(_localizer["TrialSiteSurvey_NoRecordToUpdate"]);
|
||||||
|
//}
|
||||||
|
|
||||||
|
|
||||||
|
//if (userInfo.IsUpdate && await _trialSiteSurveyRepository.AnyAsync(t => (t.Email == userInfo.EmailOrPhone || t.Phone == userInfo.EmailOrPhone) && t.SiteId == userInfo.SiteId && t.TrialId == userInfo.TrialId && t.State != TrialSiteSurveyEnum.PMCreatedAndLock))
|
||||||
|
//{
|
||||||
|
// //---您的中心调研记录正在审核中,不允许进行更新操作。若需要更新,请在驳回后进行操作。
|
||||||
|
// return ResponseOutput.NotOk(_localizer["TrialSiteSurvey_RecordUnderReview"]);
|
||||||
|
//}
|
||||||
|
|
||||||
|
|
||||||
|
////自己的记录锁定了 只能更新自己的,不能更新别人的(但是别人能更新自己锁定的)
|
||||||
|
//if (userInfo.IsUpdate && userInfo.ReplaceUserEmailOrPhone != userInfo.EmailOrPhone && await _trialSiteSurveyRepository.AnyAsync(t => (t.Email == userInfo.EmailOrPhone || t.Phone == userInfo.EmailOrPhone) && t.SiteId == userInfo.SiteId && t.TrialId == userInfo.TrialId && t.State == TrialSiteSurveyEnum.PMCreatedAndLock))
|
||||||
|
//{
|
||||||
|
// //自己的锁了 想更新别人的
|
||||||
|
// //---当前中心中,您提交调研记录表已锁定,不允许更新其他人邮箱调研记录。
|
||||||
|
// return ResponseOutput.NotOk(_localizer["TrialSiteSurvey_LockedByCurrentUser"]);
|
||||||
|
//}
|
||||||
|
|
||||||
|
////自己的锁定了 如果有其他未锁定的,也不能更新自己的
|
||||||
|
//if (userInfo.IsUpdate && userInfo.ReplaceUserEmailOrPhone == userInfo.EmailOrPhone &&
|
||||||
|
// await _trialSiteSurveyRepository.AnyAsync(t => (t.Email == userInfo.EmailOrPhone || t.Phone == userInfo.EmailOrPhone) && t.SiteId == userInfo.SiteId && t.TrialId == userInfo.TrialId && t.State == TrialSiteSurveyEnum.PMCreatedAndLock)
|
||||||
|
// && await _trialSiteSurveyRepository.AnyAsync(t => (t.Email != userInfo.EmailOrPhone && t.Phone != userInfo.EmailOrPhone) && t.SiteId == userInfo.SiteId && t.TrialId == userInfo.TrialId && t.State != TrialSiteSurveyEnum.PMCreatedAndLock))
|
||||||
|
//{
|
||||||
|
|
||||||
|
// //---当前中心,您提交的调研记录表已锁定。当前存在其他人员提交的调研记录表未锁定,不允许更新您之前提交的调研记录。
|
||||||
|
// return ResponseOutput.NotOk(_localizer["TrialSiteSurvey_LockedByOtherUsers"]);
|
||||||
|
//}
|
||||||
|
|
||||||
|
|
||||||
|
//////存在未锁定的记录,却去更新已锁定的
|
||||||
|
//if (userInfo.IsUpdate && userInfo.ReplaceUserEmailOrPhone != userInfo.EmailOrPhone && await _trialSiteSurveyRepository.AnyAsync(t => t.SiteId == userInfo.SiteId && t.TrialId == userInfo.TrialId && t.State != TrialSiteSurveyEnum.PMCreatedAndLock)
|
||||||
|
//&& await _trialSiteSurveyRepository.AnyAsync(t => (t.Email == userInfo.ReplaceUserEmailOrPhone || t.Phone == userInfo.ReplaceUserEmailOrPhone) && t.SiteId == userInfo.SiteId && t.TrialId == userInfo.TrialId && t.State == TrialSiteSurveyEnum.PMCreatedAndLock)
|
||||||
|
//&& !await _trialSiteSurveyRepository.AnyAsync(t => (t.Email == userInfo.ReplaceUserEmailOrPhone || t.Phone == userInfo.ReplaceUserEmailOrPhone) && t.SiteId == userInfo.SiteId && t.TrialId == userInfo.TrialId && t.State != TrialSiteSurveyEnum.PMCreatedAndLock)
|
||||||
|
//)
|
||||||
|
//{
|
||||||
|
// //---当前中心存在未锁定的调研记录,不允许更新已锁定的调研记录。
|
||||||
|
// return ResponseOutput.NotOk(_localizer["TrialSiteSurvey_UnlockedRecordsExist"]);
|
||||||
|
//}
|
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
#region 20230804 修改调研表逻辑
|
||||||
|
|
||||||
|
var verifyRecord = await _repository.FirstOrDefaultAsync<VerificationCode>(t => (t.EmailOrPhone == userInfo.EmailOrPhone) && t.Code == userInfo.verificationCode && t.CodeType == userInfo.verificationType);
|
||||||
|
//检查数据库是否存在该验证码
|
||||||
|
if (verifyRecord == null)
|
||||||
|
{
|
||||||
|
//---验证码错误。
|
||||||
|
return ResponseOutput.NotOk(_localizer["TrialSiteSurvey_WrongVerificationCode"]);
|
||||||
|
}
|
||||||
|
else if (verifyRecord.ExpirationTime < DateTime.Now)
|
||||||
|
{
|
||||||
|
return ResponseOutput.NotOk(_localizer["TrialSiteSurvey_WrongVerificationCode"]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//验证码正确 不处理
|
||||||
|
}
|
||||||
|
|
||||||
|
TrialSiteSurvey? currentEntity = null;
|
||||||
|
|
||||||
|
|
||||||
|
var userList = await _trialSiteUserRepository.Where(t => t.TrialId == userInfo.TrialId && t.SiteId == userInfo.SiteId, false, true).ProjectTo<TrialSiteUserSurvey>(_mapper.ConfigurationProvider).ToListAsync();
|
||||||
|
|
||||||
|
//普通登录
|
||||||
|
if (userInfo.IsUpdate == false)
|
||||||
|
{
|
||||||
|
|
||||||
|
var dbEntityList = await _trialSiteSurveyRepository.Where(t => t.TrialId == userInfo.TrialId && t.SiteId == userInfo.SiteId).ToListAsync();
|
||||||
|
|
||||||
|
|
||||||
|
//没有记录 new一份
|
||||||
|
if (dbEntityList.Count == 0)
|
||||||
|
{
|
||||||
|
var addSurvey = _mapper.Map<TrialSiteSurvey>(userInfo);
|
||||||
|
|
||||||
|
|
||||||
|
//从项目site 中找到已存在的 加到历史人员中
|
||||||
|
addSurvey.TrialSiteUserSurveyList = userList;
|
||||||
|
|
||||||
|
currentEntity = await _repository.AddAsync(addSurvey);
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
//找到当前最新的调研表
|
||||||
|
|
||||||
|
var currentLatest = dbEntityList.OrderByDescending(t => t.CreateTime).FirstOrDefault();
|
||||||
|
|
||||||
|
if (currentLatest.Email != userInfo.EmailOrPhone)
|
||||||
|
{
|
||||||
|
//---该中心下已经有其他用户已填写的调研表,您不被允许继续填写
|
||||||
|
return ResponseOutput.NotOk(_localizer["TrialSiteSurvey_AlreadyFilledByOtherUsers"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
currentEntity = currentLatest;
|
||||||
|
|
||||||
|
if (currentEntity.State != TrialSiteSurveyEnum.PMCreatedAndLock)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
await UnlockSyncSiteUserAsync(userInfo.TrialId, userInfo.SiteId, currentEntity.Id, userList);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
//更新调研表
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//找到最新的调研表
|
||||||
|
|
||||||
|
var currentLatest = await _trialSiteSurveyRepository.Where(t => t.TrialId == userInfo.TrialId && t.SiteId == userInfo.SiteId, true)
|
||||||
|
.Include(u => u.TrialSiteEquipmentSurveyList).Include(u => u.TrialSiteUserSurveyList).OrderByDescending(t => t.CreateTime).FirstOrDefaultAsync();
|
||||||
|
|
||||||
|
if (currentLatest == null)
|
||||||
|
{
|
||||||
|
return ResponseOutput.NotOk("当前site没有调研表可以更新,请确认");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (currentLatest.Email != userInfo.ReplaceUserEmailOrPhone)
|
||||||
{
|
{
|
||||||
//---该中心不存在该交接人的中心调研记录表,不允许选择更新。
|
//---该中心不存在该交接人的中心调研记录表,不允许选择更新。
|
||||||
return ResponseOutput.NotOk(_localizer["TrialSiteSurvey_NoRecordToUpdate"]);
|
return ResponseOutput.NotOk(_localizer["TrialSiteSurvey_NoRecordToUpdate"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (userInfo.IsUpdate && await _trialSiteSurveyRepository.AnyAsync(t => (t.Email == userInfo.EmailOrPhone || t.Phone == userInfo.EmailOrPhone) && t.SiteId == userInfo.SiteId && t.TrialId == userInfo.TrialId && t.State != TrialSiteSurveyEnum.PMCreatedAndLock))
|
|
||||||
|
//未锁定的状态 就改为废除
|
||||||
|
if (currentLatest.State != TrialSiteSurveyEnum.PMCreatedAndLock)
|
||||||
{
|
{
|
||||||
//---您的中心调研记录正在审核中,不允许进行更新操作。若需要更新,请在驳回后进行操作。
|
currentLatest.IsDeleted = true;
|
||||||
return ResponseOutput.NotOk(_localizer["TrialSiteSurvey_RecordUnderReview"]);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//自己的记录锁定了 只能更新自己的,不能更新别人的(但是别人能更新自己锁定的)
|
|
||||||
if (userInfo.IsUpdate && userInfo.ReplaceUserEmailOrPhone != userInfo.EmailOrPhone && await _trialSiteSurveyRepository.AnyAsync(t => (t.Email == userInfo.EmailOrPhone || t.Phone == userInfo.EmailOrPhone) && t.SiteId == userInfo.SiteId && t.TrialId == userInfo.TrialId && t.State == TrialSiteSurveyEnum.PMCreatedAndLock))
|
|
||||||
{
|
|
||||||
//自己的锁了 想更新别人的
|
|
||||||
//---当前中心中,您提交调研记录表已锁定,不允许更新其他人邮箱调研记录。
|
|
||||||
return ResponseOutput.NotOk(_localizer["TrialSiteSurvey_LockedByCurrentUser"]);
|
|
||||||
}
|
|
||||||
|
|
||||||
//自己的锁定了 如果有其他未锁定的,也不能更新自己的
|
|
||||||
if (userInfo.IsUpdate && userInfo.ReplaceUserEmailOrPhone == userInfo.EmailOrPhone &&
|
|
||||||
await _trialSiteSurveyRepository.AnyAsync(t => (t.Email == userInfo.EmailOrPhone || t.Phone == userInfo.EmailOrPhone) && t.SiteId == userInfo.SiteId && t.TrialId == userInfo.TrialId && t.State == TrialSiteSurveyEnum.PMCreatedAndLock)
|
|
||||||
&& await _trialSiteSurveyRepository.AnyAsync(t => (t.Email != userInfo.EmailOrPhone && t.Phone != userInfo.EmailOrPhone) && t.SiteId == userInfo.SiteId && t.TrialId == userInfo.TrialId && t.State != TrialSiteSurveyEnum.PMCreatedAndLock))
|
|
||||||
{
|
|
||||||
|
|
||||||
//---当前中心,您提交的调研记录表已锁定。当前存在其他人员提交的调研记录表未锁定,不允许更新您之前提交的调研记录。
|
|
||||||
return ResponseOutput.NotOk(_localizer["TrialSiteSurvey_LockedByOtherUsers"]);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////存在未锁定的记录,却去更新已锁定的
|
|
||||||
if (userInfo.IsUpdate && userInfo.ReplaceUserEmailOrPhone != userInfo.EmailOrPhone && await _trialSiteSurveyRepository.AnyAsync(t => t.SiteId == userInfo.SiteId && t.TrialId == userInfo.TrialId && t.State != TrialSiteSurveyEnum.PMCreatedAndLock)
|
|
||||||
&& await _trialSiteSurveyRepository.AnyAsync(t => (t.Email == userInfo.ReplaceUserEmailOrPhone || t.Phone == userInfo.ReplaceUserEmailOrPhone) && t.SiteId == userInfo.SiteId && t.TrialId == userInfo.TrialId && t.State == TrialSiteSurveyEnum.PMCreatedAndLock)
|
|
||||||
&& !await _trialSiteSurveyRepository.AnyAsync(t => (t.Email == userInfo.ReplaceUserEmailOrPhone || t.Phone == userInfo.ReplaceUserEmailOrPhone) && t.SiteId == userInfo.SiteId && t.TrialId == userInfo.TrialId && t.State != TrialSiteSurveyEnum.PMCreatedAndLock)
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//---当前中心存在未锁定的调研记录,不允许更新已锁定的调研记录。
|
|
||||||
return ResponseOutput.NotOk(_localizer["TrialSiteSurvey_UnlockedRecordsExist"]);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var verificationRecord = await _repository
|
|
||||||
.FirstOrDefaultAsync<VerificationCode>(t => (t.EmailOrPhone == userInfo.EmailOrPhone) && t.Code == userInfo.verificationCode && t.CodeType == userInfo.verificationType);
|
|
||||||
|
|
||||||
//检查数据库是否存在该验证码
|
|
||||||
if (verificationRecord == null)
|
|
||||||
{
|
|
||||||
//---验证码错误。
|
|
||||||
return ResponseOutput.NotOk(_localizer["TrialSiteSurvey_WrongVerificationCode"]);
|
|
||||||
}
|
}
|
||||||
|
//锁定的 需要改状态么?
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//检查验证码是否失效
|
|
||||||
if (verificationRecord.ExpirationTime < DateTime.Now)
|
|
||||||
{
|
|
||||||
//---验证码已经过期。
|
|
||||||
return ResponseOutput.NotOk(_localizer["TrialSiteSurvey_ExpiredVerificationCode"]);
|
|
||||||
}
|
}
|
||||||
else //验证码正确 并且 没有超时
|
var copy = currentLatest.Clone();
|
||||||
{
|
|
||||||
|
|
||||||
TrialSiteSurvey? dbEntity = null;
|
|
||||||
|
|
||||||
|
|
||||||
//替换交接人
|
|
||||||
if (isReplaceUser)
|
|
||||||
{
|
|
||||||
//该交接人的记录 是否有未锁定的 有就用未锁定的,没有就用 锁定的最后一条
|
|
||||||
|
|
||||||
var noLockedLastSurvey = await _trialSiteSurveyRepository.Where(t => (t.Email == userInfo.ReplaceUserEmailOrPhone || t.Phone == userInfo.ReplaceUserEmailOrPhone) && t.SiteId == userInfo.SiteId && t.TrialId == userInfo.TrialId && t.State == TrialSiteSurveyEnum.PMCreatedAndLock == false, true)
|
|
||||||
.Include(u => u.TrialSiteEquipmentSurveyList).Include(u => u.TrialSiteUserSurveyList).OrderByDescending(t => t.CreateTime).FirstOrDefaultAsync();
|
|
||||||
|
|
||||||
//都是锁定的
|
|
||||||
if (noLockedLastSurvey == null)
|
|
||||||
{
|
|
||||||
|
|
||||||
var latestLock = await _trialSiteSurveyRepository.Where(t => t.SiteId == userInfo.SiteId && t.TrialId == userInfo.TrialId).OrderByDescending(t => t.CreateTime).FirstOrDefaultAsync();
|
|
||||||
|
|
||||||
if (latestLock!.Email != userInfo.ReplaceUserEmailOrPhone)
|
|
||||||
{
|
|
||||||
return ResponseOutput.NotOk($"该邮箱{userInfo.ReplaceUserEmailOrPhone}对应的调查表不是最新锁定的记录,不允许更新!");
|
|
||||||
}
|
|
||||||
|
|
||||||
var lockedLastSurvey = await _trialSiteSurveyRepository.Where(t => (t.Email == userInfo.ReplaceUserEmailOrPhone || t.Phone == userInfo.ReplaceUserEmailOrPhone) && t.SiteId == userInfo.SiteId && t.TrialId == userInfo.TrialId && t.State == TrialSiteSurveyEnum.PMCreatedAndLock == true)
|
|
||||||
.Include(u => u.TrialSiteEquipmentSurveyList).Include(u => u.TrialSiteUserSurveyList).OrderByDescending(t => t.CreateTime).FirstOrDefaultAsync().IfNullThrowException();
|
|
||||||
|
|
||||||
//Copy 一份 更换邮箱
|
|
||||||
|
|
||||||
var copy = lockedLastSurvey.Clone();
|
|
||||||
|
|
||||||
copy.State = TrialSiteSurveyEnum.ToSubmit;
|
copy.State = TrialSiteSurveyEnum.ToSubmit;
|
||||||
|
copy.IsDeleted = false;
|
||||||
|
|
||||||
copy.Email = userInfo.EmailOrPhone;
|
copy.Email = userInfo.EmailOrPhone;
|
||||||
|
copy.Id = Guid.Empty;
|
||||||
|
copy.CreateTime = DateAndTime.Now;
|
||||||
|
|
||||||
if (userInfo.ReplaceUserEmailOrPhone != userInfo.EmailOrPhone)
|
if (userInfo.ReplaceUserEmailOrPhone != userInfo.EmailOrPhone)
|
||||||
{
|
{
|
||||||
|
@ -258,86 +328,23 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
copy.Id = Guid.Empty;
|
|
||||||
copy.TrialSiteEquipmentSurveyList.ForEach(t => t.Id = Guid.Empty);
|
|
||||||
copy.TrialSiteUserSurveyList.ForEach(t => t.Id = Guid.Empty);
|
|
||||||
|
|
||||||
dbEntity = await _repository.AddAsync(copy);
|
copy.TrialSiteEquipmentSurveyList = currentLatest.TrialSiteEquipmentSurveyList.Clone();
|
||||||
|
copy.TrialSiteEquipmentSurveyList.ForEach(t => { t.Id = Guid.Empty; t.CreateTime = DateTime.Now; });
|
||||||
|
|
||||||
}
|
//锁定了的话,就不拷贝
|
||||||
else
|
if (currentLatest.State != TrialSiteSurveyEnum.PMCreatedAndLock)
|
||||||
{
|
{
|
||||||
//有未锁定的 更新下邮箱
|
copy.TrialSiteUserSurveyList = currentLatest.TrialSiteUserSurveyList.Clone().Where(t => t.IsHistoryUser == false).ToList();
|
||||||
noLockedLastSurvey.Email = userInfo.EmailOrPhone;
|
copy.TrialSiteUserSurveyList.ForEach(t => { t.Id = Guid.Empty; t.IsGenerateSuccess = false; t.CreateTime = DateTime.Now; });
|
||||||
noLockedLastSurvey.UserName = String.Empty;
|
|
||||||
noLockedLastSurvey.Phone = String.Empty;
|
|
||||||
|
|
||||||
dbEntity = noLockedLastSurvey;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//从项目site 中找到已存在的 加到历史人员中
|
||||||
|
|
||||||
|
|
||||||
////邮箱相同的话 就是同一个人进来 copy一份
|
copy.TrialSiteUserSurveyList.AddRange(userList);
|
||||||
//if (userInfo.EmailOrPhone == userInfo.ReplaceUserEmailOrPhone)
|
|
||||||
//{
|
|
||||||
// dbEntity = await _repository.Where<TrialSiteSurvey>(t => (t.Email == userInfo.EmailOrPhone || t.Phone == userInfo.EmailOrPhone) && t.SiteId == userInfo.SiteId && t.TrialId == userInfo.TrialId).Include(u => u.TrialSiteEquipmentSurveyList).Include(u => u.TrialSiteUserSurveyList).FirstOrDefaultAsync().IfNullThrowConvertException();
|
|
||||||
|
|
||||||
// var clone = dbEntity.Clone();
|
|
||||||
// clone.Id = Guid.Empty;
|
|
||||||
// clone.TrialSiteEquipmentSurveyList.ForEach(t => t.Id = Guid.Empty);
|
|
||||||
// clone.TrialSiteUserSurveyList.ForEach(t => t.Id = Guid.Empty);
|
|
||||||
// clone.State = TrialSiteSurveyEnum.ToSubmit;
|
|
||||||
|
|
||||||
// dbEntity = await _repository.AddAsync(clone);
|
|
||||||
|
|
||||||
//}
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
var dbEntityList = await _trialSiteSurveyRepository.Where(t => t.TrialId == userInfo.TrialId && t.SiteId == userInfo.SiteId).ToListAsync();
|
|
||||||
|
|
||||||
|
|
||||||
//没有记录 new一份
|
|
||||||
if (dbEntityList.Count == 0)
|
|
||||||
{
|
|
||||||
|
|
||||||
dbEntity = await _repository.AddAsync(_mapper.Map<TrialSiteSurvey>(userInfo));
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//该site 下不存在该邮箱的记录
|
|
||||||
if (!dbEntityList.Any(t => t.Email == userInfo.EmailOrPhone || t.Phone == userInfo.EmailOrPhone))
|
|
||||||
{
|
|
||||||
//---该中心下已经有其他用户已填写的调研表,您不被允许继续填写
|
|
||||||
return ResponseOutput.NotOk(_localizer["TrialSiteSurvey_AlreadyFilledByOtherUsers"]);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//有没有该邮箱 未锁定的
|
|
||||||
var nolockEntity = dbEntityList.Where(t => t.Email == userInfo.EmailOrPhone || t.Phone == userInfo.EmailOrPhone).FirstOrDefault(t => t.State != TrialSiteSurveyEnum.PMCreatedAndLock);
|
|
||||||
|
|
||||||
// 未锁定的 为空
|
|
||||||
if (nolockEntity == null)
|
|
||||||
{
|
|
||||||
//查看最新锁定的
|
|
||||||
dbEntity = dbEntityList.Where(t => t.Email == userInfo.EmailOrPhone || t.Phone == userInfo.EmailOrPhone).OrderByDescending(t => t.CreateTime).FirstOrDefault(t => t.State == TrialSiteSurveyEnum.PMCreatedAndLock).IfNullThrowException();
|
|
||||||
|
|
||||||
}
|
|
||||||
else //有未锁定的 直接用未锁定的
|
|
||||||
{
|
|
||||||
dbEntity = nolockEntity;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
//_mapper.Map(userInfo, dbEntity);
|
|
||||||
|
|
||||||
|
currentEntity = await _trialSiteSurveyRepository.AddAsync(copy);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -347,11 +354,11 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
//删除验证码历史记录
|
//删除验证码历史记录
|
||||||
await _repository.BatchDeleteAsync<VerificationCode>(t => t.EmailOrPhone == userInfo.EmailOrPhone && t.Code == userInfo.verificationCode && t.CodeType == userInfo.verificationType);
|
await _repository.BatchDeleteAsync<VerificationCode>(t => t.EmailOrPhone == userInfo.EmailOrPhone && t.Code == userInfo.verificationCode && t.CodeType == userInfo.verificationType);
|
||||||
|
|
||||||
await _repository.SaveChangesAsync();
|
await _trialSiteSurveyRepository.SaveChangesAsync();
|
||||||
|
|
||||||
return ResponseOutput.Ok(new
|
return ResponseOutput.Ok(new
|
||||||
{
|
{
|
||||||
TrialSiteSurveyId = dbEntity!.Id,
|
TrialSiteSurveyId = currentEntity!.Id,
|
||||||
Token = _tokenService.GetToken(IRaCISClaims.Create(new UserBasicInfo()
|
Token = _tokenService.GetToken(IRaCISClaims.Create(new UserBasicInfo()
|
||||||
{
|
{
|
||||||
Id = Guid.NewGuid(),
|
Id = Guid.NewGuid(),
|
||||||
|
@ -366,9 +373,29 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
}))
|
}))
|
||||||
});
|
});
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task UnlockSyncSiteUserAsync(Guid trialId, Guid siteId, Guid trialSiteSurveyId, List<TrialSiteUserSurvey> userList)
|
||||||
|
{
|
||||||
|
var existList = await _trialSiteUserSurveyRepository.Where(t => t.IsHistoryUser && t.TrialSiteSurvey.TrialId == trialId && t.TrialSiteSurvey.SiteId == siteId, true).ToListAsync();
|
||||||
|
|
||||||
|
foreach (var item in userList)
|
||||||
|
{
|
||||||
|
var find = existList.FirstOrDefault(t => t.SystemUserId == item.SystemUserId);
|
||||||
|
//不存在就加入
|
||||||
|
if (find == null)
|
||||||
|
{
|
||||||
|
item.TrialSiteSurveyId = trialSiteSurveyId;
|
||||||
|
await _trialSiteUserSurveyRepository.AddAsync(item);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
find.IsHistoryUserOriginDeleted = item.IsHistoryUserOriginDeleted;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await _trialSiteUserSurveyRepository.SaveChangesAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -379,9 +406,24 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
[HttpGet("{trialId:guid}/{trialSiteSurveyId:guid}")]
|
[HttpGet("{trialId:guid}/{trialSiteSurveyId:guid}")]
|
||||||
public async Task<LoginReturnDTO> GetSiteSurveyInfo(Guid trialSiteSurveyId, Guid trialId)
|
public async Task<LoginReturnDTO> GetSiteSurveyInfo(Guid trialSiteSurveyId, Guid trialId)
|
||||||
{
|
{
|
||||||
var result = await _trialSiteSurveyRepository.Where(t => t.Id == trialSiteSurveyId && t.TrialId == trialId)
|
|
||||||
.ProjectTo<LoginReturnDTO>(_mapper.ConfigurationProvider).FirstOrDefaultAsync().IfNullThrowException();
|
|
||||||
|
|
||||||
|
//有可能填表人提交了,但是此时PM手动对人员信息进行了更改,此时需要将数据同步下(选择在这里同步是因为 不想改动 中心人员哪里的两个接口的逻辑)
|
||||||
|
var find = await _trialSiteSurveyRepository.FirstOrDefaultAsync(t => t.Id == trialSiteSurveyId, true);
|
||||||
|
|
||||||
|
|
||||||
|
if (find.State != TrialSiteSurveyEnum.PMCreatedAndLock && find.IsDeleted != true)
|
||||||
|
{
|
||||||
|
var userList = await _trialSiteUserRepository.Where(t => t.TrialId == find.TrialId && t.SiteId == find.SiteId, false, true).ProjectTo<TrialSiteUserSurvey>(_mapper.ConfigurationProvider).ToListAsync();
|
||||||
|
|
||||||
|
|
||||||
|
await UnlockSyncSiteUserAsync(find.TrialId, find.SiteId, find.Id, userList);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var result = await _trialSiteSurveyRepository.Where(t => t.Id == trialSiteSurveyId && t.TrialId == trialId).IgnoreQueryFilters()
|
||||||
|
.ProjectTo<LoginReturnDTO>(_mapper.ConfigurationProvider).FirstOrDefaultAsync().IfNullThrowException();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -464,6 +506,16 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
return await trialSiteSurveyQueryable.ToPagedListAsync(surveyQueryDTO.PageIndex, surveyQueryDTO.PageSize, surveyQueryDTO.SortField, surveyQueryDTO.Asc);
|
return await trialSiteSurveyQueryable.ToPagedListAsync(surveyQueryDTO.PageIndex, surveyQueryDTO.PageSize, surveyQueryDTO.SortField, surveyQueryDTO.Asc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<List<TrialSiteSurveySelectView>> GetTrialSiteSurveySelectList(TrialSiteSurveySelectquery inQuery)
|
||||||
|
{
|
||||||
|
var trialSiteSurveyQueryable = _trialSiteSurveyRepository
|
||||||
|
.Where(t => t.Id != inQuery.TrialSiteSurveyId)
|
||||||
|
.Where(t => t.TrialId == inQuery.TrialId && t.SiteId == inQuery.SiteId).IgnoreQueryFilters()
|
||||||
|
.ProjectTo<TrialSiteSurveySelectView>(_mapper.ConfigurationProvider);
|
||||||
|
|
||||||
|
return await trialSiteSurveyQueryable.ToListAsync();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 项目Site调研用户列表 所有site的调研用户 最新的调研表的记录的用户 new
|
/// 项目Site调研用户列表 所有site的调研用户 最新的调研表的记录的用户 new
|
||||||
|
@ -485,27 +537,12 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
.Where(t => groupSelectIdQuery.Contains(t.TrialSiteSurveyId))
|
.Where(t => groupSelectIdQuery.Contains(t.TrialSiteSurveyId))
|
||||||
.WhereIf(queryParam.UserTypeId != null, t => t.UserTypeId == queryParam.UserTypeId)
|
.WhereIf(queryParam.UserTypeId != null, t => t.UserTypeId == queryParam.UserTypeId)
|
||||||
.WhereIf(queryParam.IsGenerateAccount != null, t => t.IsGenerateAccount == queryParam.IsGenerateAccount)
|
.WhereIf(queryParam.IsGenerateAccount != null, t => t.IsGenerateAccount == queryParam.IsGenerateAccount)
|
||||||
.WhereIf(queryParam.TrialRoleNameId != null, t => t.TrialRoleNameId == queryParam.TrialRoleNameId)
|
|
||||||
.WhereIf(queryParam.State != null && queryParam.State != TrialSiteUserStateEnum.OverTime, t => t.InviteState == queryParam.State)
|
.WhereIf(queryParam.State != null && queryParam.State != TrialSiteUserStateEnum.OverTime, t => t.InviteState == queryParam.State)
|
||||||
.WhereIf(queryParam.State != null && queryParam.State == TrialSiteUserStateEnum.OverTime, t => t.InviteState == TrialSiteUserStateEnum.HasSend && t.ExpireTime < DateTime.Now)
|
|
||||||
.WhereIf(!string.IsNullOrEmpty(queryParam.UserName), t => (t.LastName + " / " + t.FirstName).Contains(queryParam.UserName))
|
.WhereIf(!string.IsNullOrEmpty(queryParam.UserName), t => (t.LastName + " / " + t.FirstName).Contains(queryParam.UserName))
|
||||||
.WhereIf(!string.IsNullOrEmpty(queryParam.OrganizationName), t => t.OrganizationName.Contains(queryParam.OrganizationName))
|
.WhereIf(!string.IsNullOrEmpty(queryParam.OrganizationName), t => t.OrganizationName.Contains(queryParam.OrganizationName))
|
||||||
|
|
||||||
.ProjectTo<TrialSiteUserSurveyAllDTO>(_mapper.ConfigurationProvider);
|
.ProjectTo<TrialSiteUserSurveyAllDTO>(_mapper.ConfigurationProvider);
|
||||||
|
|
||||||
//var query = _trialSiteSurveyRepository.Where(t => t.TrialId == queryParam.TrialId && t.IsAbandon == false)
|
|
||||||
// .WhereIf(queryParam.SiteId != null, t => t.SiteId == queryParam.SiteId)
|
|
||||||
// .WhereIf(!string.IsNullOrEmpty(queryParam.FormWriterKeyInfo), t => (t.UserName).Contains(queryParam.FormWriterKeyInfo) || t.Email.Contains(queryParam.FormWriterKeyInfo) || t.Phone.Contains(queryParam.FormWriterKeyInfo))
|
|
||||||
// .GroupBy(t => t.SiteId)
|
|
||||||
// .Select(g => g.OrderByDescending(u => u.CreateTime).FirstOrDefault())
|
|
||||||
// .SelectMany(t => t.TrialSiteUserSurveyList)
|
|
||||||
//.WhereIf(queryParam.UserTypeId != null, t => t.UserTypeId == queryParam.UserTypeId)
|
|
||||||
//.WhereIf(queryParam.IsGenerateAccount != null, t => t.IsGenerateAccount == queryParam.IsGenerateAccount)
|
|
||||||
//.WhereIf(queryParam.TrialRoleNameId != null, t => t.TrialRoleNameId == queryParam.TrialRoleNameId)
|
|
||||||
//.WhereIf(queryParam.State != null && queryParam.State != TrialSiteUserStateEnum.OverTime, t => t.InviteState == queryParam.State)
|
|
||||||
//.WhereIf(queryParam.State != null && queryParam.State == TrialSiteUserStateEnum.OverTime, t => t.InviteState == TrialSiteUserStateEnum.HasSend && t.ExpireTime < DateTime.Now)
|
|
||||||
//.WhereIf(!string.IsNullOrEmpty(queryParam.UserKeyInfo), t => (t.LastName + " / " + t.FirstName).Contains(queryParam.UserKeyInfo) || t.Email.Contains(queryParam.UserKeyInfo) || t.Phone.Contains(queryParam.UserKeyInfo))
|
|
||||||
//.ProjectTo<TrialSiteUserSurveyAllDTO>(_mapper.ConfigurationProvider);
|
|
||||||
|
|
||||||
return await query.ToPagedListAsync(queryParam.PageIndex, queryParam.PageSize, queryParam.SortField, queryParam.Asc);
|
return await query.ToPagedListAsync(queryParam.PageIndex, queryParam.PageSize, queryParam.SortField, queryParam.Asc);
|
||||||
|
|
||||||
|
@ -620,29 +657,8 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 驳回
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="trialId"></param>
|
|
||||||
/// <param name="trialSiteSurveyId"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpPut("{trialId:guid}/{trialSiteSurveyId:guid}")]
|
|
||||||
[Obsolete]
|
|
||||||
public async Task<IResponseOutput> SubmissionRejection(Guid trialId, Guid trialSiteSurveyId)
|
|
||||||
{
|
|
||||||
if (await _repository.AnyAsync<TrialSiteSurvey>(t => t.State == TrialSiteSurveyEnum.PMCreatedAndLock && t.Id == trialSiteSurveyId))
|
|
||||||
{
|
|
||||||
//---中心调研已锁定,不允许操作。
|
|
||||||
return ResponseOutput.NotOk(_localizer["TrialSiteSurvey_Locked"]);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
await _trialSiteSurveyRepository.BatchUpdateNoTrackingAsync(t => t.Id == trialSiteSurveyId, u => new TrialSiteSurvey() { State = TrialSiteSurveyEnum.ToSubmit });
|
|
||||||
|
|
||||||
return ResponseOutput.Ok();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
[HttpPut("{trialId:guid}/{trialSiteSurveyId:guid}")]
|
[HttpPut("{trialId:guid}/{trialSiteSurveyId:guid}")]
|
||||||
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
|
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
|
||||||
|
@ -681,9 +697,20 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
var trialId = siteSurvyeSubmit.TrialId;
|
var trialId = siteSurvyeSubmit.TrialId;
|
||||||
var trialSiteSurveyId = siteSurvyeSubmit.TrialSiteSurveyId;
|
var trialSiteSurveyId = siteSurvyeSubmit.TrialSiteSurveyId;
|
||||||
|
|
||||||
var trialSiteSurvey = (await _trialSiteSurveyRepository.Where(t => t.Id == trialSiteSurveyId).FirstOrDefaultAsync()).IfNullThrowException();
|
var trialSiteSurvey = (await _trialSiteSurveyRepository.Where(t => t.Id == trialSiteSurveyId, false, true).FirstOrDefaultAsync()).IfNullThrowException();
|
||||||
|
|
||||||
var siteUserList = await _trialSiteUserSurveyRepository.Where(t => t.TrialSiteSurvey.TrialId == trialId && t.TrialSiteSurvey.SiteId == trialSiteSurvey.SiteId && t.TrialSiteSurvey.IsDeleted == false).Select(t =>
|
|
||||||
|
if (trialSiteSurvey.IsDeleted == true || trialSiteSurvey.State == TrialSiteSurveyEnum.PMCreatedAndLock)
|
||||||
|
{
|
||||||
|
throw new BusinessValidationFailedException("当前调研表已废除,或者调研表状态已锁定,不允许操作");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var siteUserList = await _trialSiteUserSurveyRepository.Where(t => t.TrialSiteSurveyId == trialSiteSurveyId)
|
||||||
|
.Where(t => !(t.IsHistoryUser && t.IsHistoryUserDeleted == true))
|
||||||
|
.Select(t =>
|
||||||
new
|
new
|
||||||
{
|
{
|
||||||
t.TrialSiteSurveyId,
|
t.TrialSiteSurveyId,
|
||||||
|
@ -691,25 +718,29 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
t.IsGenerateSuccess,
|
t.IsGenerateSuccess,
|
||||||
t.UserTypeId,
|
t.UserTypeId,
|
||||||
UserTypeEnum = (UserTypeEnum?)t.UserTypeRole.UserTypeEnum,
|
UserTypeEnum = (UserTypeEnum?)t.UserTypeRole.UserTypeEnum,
|
||||||
t.TrialRoleName.Code,
|
t.TrialRoleCode,
|
||||||
t.Email
|
t.Email,
|
||||||
}).ToListAsync();
|
}).ToListAsync();
|
||||||
|
|
||||||
|
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)
|
if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.Undefined)
|
||||||
{
|
{
|
||||||
//是第一次
|
|
||||||
if (!siteUserList.Any(t => t.IsGenerateSuccess))
|
|
||||||
{
|
|
||||||
var currentUserList = siteUserList.Where(t => t.TrialSiteSurveyId == trialSiteSurveyId).ToList();
|
|
||||||
|
|
||||||
if (!currentUserList.Any(t => t.Code == "1") || !currentUserList.Any(t => t.Code == "5"))
|
|
||||||
{
|
|
||||||
throw new BusinessValidationFailedException("本次提交,必须有CRC和影像阅片人信息");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
await _trialSiteSurveyRepository.UpdatePartialFromQueryAsync(t => t.Id == trialSiteSurveyId && t.State == TrialSiteSurveyEnum.ToSubmit, u => new TrialSiteSurvey() { State = TrialSiteSurveyEnum.SPMApproved });
|
await _trialSiteSurveyRepository.UpdatePartialFromQueryAsync(t => t.Id == trialSiteSurveyId && t.State == TrialSiteSurveyEnum.ToSubmit, u => new TrialSiteSurvey() { State = TrialSiteSurveyEnum.SPMApproved });
|
||||||
|
|
||||||
|
@ -717,39 +748,26 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
|
|
||||||
else if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager)
|
else if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager)
|
||||||
{
|
{
|
||||||
foreach (var group in (siteUserList.Where(t => t.IsGenerateAccount && t.TrialSiteSurveyId == trialSiteSurveyId)
|
|
||||||
.GroupBy(t => new { t.Email, t.IsGenerateAccount, t.UserTypeId })))
|
|
||||||
{
|
|
||||||
if (group.Count() > 1)
|
|
||||||
{
|
|
||||||
throw new BusinessValidationFailedException("同一邮箱同一用户类型,生成账号的数据只允许存在一条!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//是第一次
|
|
||||||
if (!siteUserList.Any(t => t.IsGenerateSuccess))
|
|
||||||
{
|
|
||||||
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");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
var allUserList = _trialSiteUserSurveyRepository.Where(t => t.TrialSiteSurveyId == trialSiteSurveyId).ProjectTo<TrialSiteUserSurveyView>(_mapper.ConfigurationProvider).ToList();
|
||||||
|
|
||||||
//已生成的不管 管的只需要是 生成失败的并且需要生成账号的
|
//已生成的不管 管的只需要是 生成失败的并且需要生成账号的
|
||||||
var needGenerateList = _trialSiteUserSurveyRepository.Where(t => t.TrialSiteSurveyId == trialSiteSurveyId && t.IsGenerateAccount && t.IsJoin != true).ProjectTo<TrialSiteUserSurveyView>(_mapper.ConfigurationProvider).ToList();
|
var needGenerateList = allUserList.Where(t => t.IsHistoryUser == false && t.IsGenerateAccount && t.IsJoin != true).ToList();
|
||||||
|
|
||||||
|
|
||||||
//await SendInviteEmail(new InviteEmailCommand() { TrialId = trialId, RouteUrl = siteSurvyeSubmit.RouteUrl, UserList = needGenerateList });
|
|
||||||
|
|
||||||
|
|
||||||
await GenerateAccountAsync(needGenerateList, trialId);
|
await GenerateAccountAsync(needGenerateList, trialId);
|
||||||
await SendSiteSurveyUserJoinEmail(new TrialSiteUserSurveyJoinCommand() { TrialId = trialId, TrialSiteSurveyId = trialSiteSurveyId, RouteUrl = siteSurvyeSubmit.RouteUrl, BaseUrl = siteSurvyeSubmit.BaseUrl, UserList = needGenerateList });
|
|
||||||
|
|
||||||
|
//新加入的 或者历史人员退出改为加入的
|
||||||
|
var needSendEmailList = allUserList.Where(t => (t.IsHistoryUser == false && t.IsGenerateAccount && t.IsJoin != true) || (t.IsHistoryUser == true && t.IsHistoryUserOriginDeleted == true && t.IsHistoryUserDeleted == false)).ToList();
|
||||||
|
|
||||||
|
await SendSiteSurveyUserJoinEmail(new TrialSiteUserSurveyJoinCommand() { TrialId = trialId, TrialSiteSurveyId = trialSiteSurveyId, RouteUrl = siteSurvyeSubmit.RouteUrl, BaseUrl = siteSurvyeSubmit.BaseUrl, UserList = needSendEmailList });
|
||||||
|
|
||||||
|
|
||||||
|
var needQuitUserList = allUserList.Where(t => t.IsHistoryUser && t.IsHistoryUserOriginDeleted == false && t.IsHistoryUserDeleted == true).ToList();
|
||||||
|
|
||||||
|
await DealSiteUserQuitSiteAsync(trialId, trialSiteSurvey.SiteId, needQuitUserList);
|
||||||
|
|
||||||
|
//将历史锁定的调研表废弃
|
||||||
|
await _trialSiteSurveyRepository.BatchUpdateNoTrackingAsync(t => t.TrialId == trialId && t.SiteId == trialSiteSurvey.SiteId && t.State == TrialSiteSurveyEnum.PMCreatedAndLock && t.Id != trialSiteSurveyId, z => new TrialSiteSurvey() { IsDeleted = true });
|
||||||
|
|
||||||
//将历史锁定的调研表废弃
|
//将历史锁定的调研表废弃
|
||||||
await _trialSiteSurveyRepository.BatchUpdateNoTrackingAsync(t => t.TrialId == trialId && t.SiteId == trialSiteSurvey.SiteId && t.State == TrialSiteSurveyEnum.PMCreatedAndLock, z => new TrialSiteSurvey() { IsDeleted = true });
|
await _trialSiteSurveyRepository.BatchUpdateNoTrackingAsync(t => t.TrialId == trialId && t.SiteId == trialSiteSurvey.SiteId && t.State == TrialSiteSurveyEnum.PMCreatedAndLock, z => new TrialSiteSurvey() { IsDeleted = true });
|
||||||
|
@ -763,13 +781,14 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
|
|
||||||
private async Task GenerateAccountAsync(List<TrialSiteUserSurveyView> needGenerateList, Guid trialId)
|
private async Task GenerateAccountAsync(List<TrialSiteUserSurveyView> needGenerateList, Guid trialId)
|
||||||
{
|
{
|
||||||
|
var trialType = _repository.Where<Trial>(t => t.Id == trialId).Select(t => t.TrialType).FirstOrDefault();
|
||||||
|
|
||||||
foreach (var item in needGenerateList)
|
foreach (var item in needGenerateList)
|
||||||
{
|
{
|
||||||
|
|
||||||
//找下系统中是否存在该用户类型的 并且邮箱 或者手机的账户
|
//找下系统中是否存在该用户类型的 并且邮箱 或者手机的账户
|
||||||
var sysUserInfo = await _userRepository.Where(t => t.UserTypeId == item.UserTypeId && t.EMail == item.Email).Include(t => t.UserTypeRole).FirstOrDefaultAsync();
|
var sysUserInfo = await _userRepository.Where(t => t.UserTypeId == item.UserTypeId && t.EMail == item.Email).Include(t => t.UserTypeRole).FirstOrDefaultAsync();
|
||||||
|
|
||||||
var trialType = _repository.Where<Trial>(t => t.Id == trialId).Select(t => t.TrialType).FirstOrDefault();
|
|
||||||
|
|
||||||
if (sysUserInfo == null)
|
if (sysUserInfo == null)
|
||||||
{
|
{
|
||||||
|
@ -794,7 +813,6 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
|
|
||||||
saveItem.UserTypeEnum = _repository.Where<UserType>(t => t.Id == saveItem.UserTypeId).Select(t => t.UserTypeEnum).First();
|
saveItem.UserTypeEnum = _repository.Where<UserType>(t => t.Id == saveItem.UserTypeId).Select(t => t.UserTypeEnum).First();
|
||||||
|
|
||||||
//saveItem.Password = MD5Helper.Md5(verificationCode.ToString());
|
|
||||||
|
|
||||||
var newUser = _userRepository.AddAsync(saveItem).Result;
|
var newUser = _userRepository.AddAsync(saveItem).Result;
|
||||||
|
|
||||||
|
@ -803,29 +821,24 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
|
|
||||||
|
|
||||||
sysUserInfo = newUser;
|
sysUserInfo = newUser;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await _trialSiteUserSurveyRepository.BatchUpdateNoTrackingAsync(t => t.Id == item.Id, u => new TrialSiteUserSurvey() { IsGenerateSuccess = true, SystemUserId = sysUserInfo.Id });
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//发送邮件的时候需要用到该字段
|
//发送邮件的时候需要用到该字段
|
||||||
item.SystemUserId = sysUserInfo.Id;
|
item.SystemUserId = sysUserInfo.Id;
|
||||||
|
|
||||||
await _trialSiteUserSurveyRepository.BatchUpdateNoTrackingAsync(t => t.Id == item.Id, u => new TrialSiteUserSurvey() { IsGenerateSuccess = true, SystemUserId = sysUserInfo.Id });
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
await _trialSiteUserSurveyRepository.SaveChangesAsync();
|
await _trialSiteUserSurveyRepository.SaveChangesAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private async Task<IResponseOutput> SendSiteSurveyUserJoinEmail(TrialSiteUserSurveyJoinCommand joinCommand)
|
||||||
|
|
||||||
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
|
|
||||||
public async Task<IResponseOutput> SendSiteSurveyUserJoinEmail(TrialSiteUserSurveyJoinCommand joinCommand)
|
|
||||||
{
|
{
|
||||||
var trialSiteSurvey = await _trialSiteSurveyRepository.FirstAsync(t => t.Id == joinCommand.TrialSiteSurveyId);
|
var trialSiteSurvey = await _trialSiteSurveyRepository.FirstAsync(t => t.Id == joinCommand.TrialSiteSurveyId);
|
||||||
|
|
||||||
|
@ -846,24 +859,48 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
|
|
||||||
|
|
||||||
//判断TrialUser中是否存在 不存在就插入
|
//判断TrialUser中是否存在 不存在就插入
|
||||||
if (!await _trialUserRepository.AnyAsync(t => t.TrialId == trialId && t.UserId == userId, true))
|
|
||||||
|
var findTrialUser = await _trialUserRepository.FirstOrDefaultAsync(t => t.TrialId == trialId && t.UserId == userId, true);
|
||||||
|
if (findTrialUser == null)
|
||||||
{
|
{
|
||||||
await _repository.AddAsync(new TrialUser() { TrialId = trialId, UserId = userId, JoinTime = DateTime.Now });
|
await _repository.AddAsync(new TrialUser() { TrialId = trialId, UserId = userId, JoinTime = DateTime.Now });
|
||||||
}
|
|
||||||
if (!await _repository.AnyAsync<TrialSiteUser>(t => t.TrialId == trialId && t.UserId == userId && t.SiteId == siteId, true))
|
|
||||||
{
|
|
||||||
await _repository.AddAsync(new TrialSiteUser() { TrialId = trialId, SiteId = siteId, UserId = userId });
|
|
||||||
}
|
|
||||||
|
|
||||||
await _userRepository.BatchUpdateNoTrackingAsync(t => t.Id == userId, u => new User() { Status = UserStateEnum.Enable });
|
|
||||||
|
|
||||||
await _trialSiteUserSurveyRepository.UpdatePartialFromQueryAsync(t => t.Id == userInfo.Id, u => new TrialSiteUserSurvey() { IsJoin = true });
|
|
||||||
|
|
||||||
await _mailVerificationService.SiteSurveyUserJoinEmail(trialId, userId, joinCommand.BaseUrl, joinCommand.RouteUrl);
|
await _mailVerificationService.SiteSurveyUserJoinEmail(trialId, userId, joinCommand.BaseUrl, joinCommand.RouteUrl);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
else if (findTrialUser.IsDeleted == true)
|
||||||
|
{
|
||||||
|
await _trialUserRepository.UpdatePartialFromQueryAsync(t => t.TrialId == trialId && t.UserId == userId, c => new TrialUser()
|
||||||
|
{
|
||||||
|
IsDeleted = false,
|
||||||
|
DeletedTime = null,
|
||||||
|
JoinTime = DateTime.Now,
|
||||||
|
});
|
||||||
|
|
||||||
|
await _mailVerificationService.SiteSurveyUserJoinEmail(trialId, userId, joinCommand.BaseUrl, joinCommand.RouteUrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
var findTrialSiteUser = await _trialSiteUserRepository.FirstOrDefaultAsync(t => t.TrialId == trialId && t.UserId == userId && t.SiteId == siteId, true);
|
||||||
|
|
||||||
|
if (findTrialSiteUser == null)
|
||||||
|
{
|
||||||
|
await _repository.AddAsync(new TrialSiteUser() { TrialId = trialId, SiteId = siteId, UserId = userId });
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
findTrialSiteUser.IsDeleted = false;
|
||||||
|
findTrialSiteUser.DeletedTime = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
await _userRepository.BatchUpdateNoTrackingAsync(t => t.Id == userId, u => new User() { Status = UserStateEnum.Enable });
|
||||||
|
|
||||||
|
|
||||||
|
await _trialSiteUserSurveyRepository.UpdatePartialFromQueryAsync(t => t.Id == userInfo.Id, u => new TrialSiteUserSurvey() { IsJoin = true });
|
||||||
|
}
|
||||||
|
|
||||||
await _trialSiteSurveyRepository.UpdatePartialFromQueryAsync(t => t.Id == trialSiteSurvey.Id && t.State == TrialSiteSurveyEnum.SPMApproved, u => new TrialSiteSurvey() { State = TrialSiteSurveyEnum.PMCreatedAndLock, ReviewerUserId = _userInfo.Id, ReviewerTime = DateTime.Now });
|
await _trialSiteSurveyRepository.UpdatePartialFromQueryAsync(t => t.Id == trialSiteSurvey.Id && t.State == TrialSiteSurveyEnum.SPMApproved, u => new TrialSiteSurvey() { State = TrialSiteSurveyEnum.PMCreatedAndLock, ReviewerUserId = _userInfo.Id, ReviewerTime = DateTime.Now });
|
||||||
|
|
||||||
await _userRepository.SaveChangesAsync();
|
await _userRepository.SaveChangesAsync();
|
||||||
|
|
||||||
return ResponseOutput.Ok();
|
return ResponseOutput.Ok();
|
||||||
|
@ -872,39 +909,67 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private async Task DealSiteUserQuitSiteAsync(Guid trialId, Guid siteId, List<TrialSiteUserSurveyView> list)
|
||||||
|
|
||||||
|
|
||||||
#region 废弃
|
|
||||||
//Site 调研邀请
|
|
||||||
public async Task<IResponseOutput> SendInviteEmail(InviteEmailCommand inviteEmailCommand)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
var trialInfo = await _repository.FirstOrDefaultAsync<Trial>(t => t.Id == inviteEmailCommand.TrialId);
|
var userIdList = list.Select(t => t.SystemUserId).ToList();
|
||||||
|
|
||||||
|
|
||||||
foreach (var item in inviteEmailCommand.UserList)
|
await _trialSiteUserRepository.UpdatePartialFromQueryAsync(t => t.TrialId == trialId && t.SiteId == siteId && userIdList.Contains(t.UserId), c => new TrialSiteUser()
|
||||||
|
{
|
||||||
|
IsDeleted = true,
|
||||||
|
DeletedTime = DateTime.Now,
|
||||||
|
});
|
||||||
|
|
||||||
|
//var siteUserList = await _repository.Where<TrialSiteUser>(t => t.TrialId == trialId && t.SiteId == siteId && userIdList.Contains(t.UserId), true,true).ToListAsync();
|
||||||
|
|
||||||
|
|
||||||
|
//foreach (var siteUser in siteUserList)
|
||||||
|
//{
|
||||||
|
|
||||||
|
// var find= list.FirstOrDefault(t => t.SystemUserId == siteUser.UserId);
|
||||||
|
// if(find != null)
|
||||||
|
// {
|
||||||
|
// siteUser.IsDeleted =(bool) find.IsHistoryUserDeleted;
|
||||||
|
// siteUser.DeletedTime = find.IsHistoryUserDeleted==true? DateTime.Now:null;
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
|
|
||||||
|
#region MyRegion
|
||||||
|
////跟踪查询该site下的所有的用户
|
||||||
|
//var siteUserList = await _repository.Where<TrialSiteUser>(t => t.TrialId == trialId && t.SiteId == siteId, true).ToListAsync();
|
||||||
|
|
||||||
|
//foreach (var siteUser in siteUserList)
|
||||||
|
//{
|
||||||
|
// //当前中心用户 不在调研表存在,就将该人退出
|
||||||
|
// if (!list.Any(t => t.SystemUserId == siteUser.UserId))
|
||||||
|
// {
|
||||||
|
// siteUser.IsDeleted = true;
|
||||||
|
// siteUser.DeletedTime = DateTime.Now;
|
||||||
|
// }
|
||||||
|
|
||||||
|
//}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
await _repository.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public async Task ImportGenerateAccountAndJoinTrialAsync(Guid trialId, string baseUrl, string routeUrl, List<SiteSurveyUserImportDto> list)
|
||||||
{
|
{
|
||||||
|
|
||||||
var messageToSend = new MimeMessage();
|
|
||||||
//发件地址
|
|
||||||
messageToSend.From.Add(new MailboxAddress("GRR", "iracis_grr@163.com"));
|
|
||||||
//收件地址
|
|
||||||
messageToSend.To.Add(new MailboxAddress(String.Empty, item.Email));
|
|
||||||
//主题
|
|
||||||
//$"[来自展影IRC] [{trialInfo.ResearchProgramNo}] 邀请信";
|
|
||||||
messageToSend.Subject = _localizer["TrialSiteSurvey_IRCInvitation", trialInfo.ResearchProgramNo];
|
|
||||||
|
|
||||||
var builder = new BodyBuilder();
|
var trialType = _repository.Where<Trial>(t => t.Id == trialId).Select(t => t.TrialType).FirstOrDefault();
|
||||||
|
|
||||||
|
//判断是否有系统账号
|
||||||
|
foreach (var item in list)
|
||||||
|
{
|
||||||
//找下系统中是否存在该用户类型的 并且邮箱 或者手机的账户
|
//找下系统中是否存在该用户类型的 并且邮箱 或者手机的账户
|
||||||
var sysUserInfo = await _userRepository.Where(t => t.UserTypeId == item.UserTypeId && t.EMail == item.Email).Include(t => t.UserTypeRole).FirstOrDefaultAsync();
|
var sysUserInfo = await _userRepository.Where(t => t.UserTypeId == item.UserTypeId && t.EMail == item.Email).Include(t => t.UserTypeRole).FirstOrDefaultAsync();
|
||||||
|
|
||||||
//int verificationCode = new Random().Next(100000, 1000000);
|
|
||||||
|
|
||||||
//var baseApiUrl = baseUrl.Remove(baseUrl.IndexOf("#")) + "api";
|
|
||||||
|
|
||||||
|
|
||||||
if (sysUserInfo == null)
|
if (sysUserInfo == null)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -912,83 +977,80 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
{
|
{
|
||||||
var saveItem = _mapper.Map<User>(item);
|
var saveItem = _mapper.Map<User>(item);
|
||||||
|
|
||||||
|
|
||||||
|
if (trialType == TrialType.NoneOfficial)
|
||||||
|
{
|
||||||
|
saveItem.IsTestUser = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 中心调研生成账号 都是外部的
|
||||||
|
saveItem.IsZhiZhun = false;
|
||||||
saveItem.Code = _userRepository.Select(t => t.Code).DefaultIfEmpty().Max() + 1;
|
saveItem.Code = _userRepository.Select(t => t.Code).DefaultIfEmpty().Max() + 1;
|
||||||
|
|
||||||
saveItem.UserCode = AppSettings.GetCodeStr(saveItem.Code, nameof(User)); ;
|
saveItem.UserCode = AppSettings.GetCodeStr(saveItem.Code, nameof(User));
|
||||||
|
|
||||||
saveItem.UserName = saveItem.UserCode;
|
saveItem.UserName = saveItem.UserCode;
|
||||||
|
|
||||||
saveItem.UserTypeEnum = _repository.Where<UserType>(t => t.Id == saveItem.UserTypeId).Select(t => t.UserTypeEnum).First();
|
var newUser = _userRepository.AddAsync(saveItem).Result;
|
||||||
|
|
||||||
//saveItem.Password = MD5Helper.Md5(verificationCode.ToString());
|
_ = _userRepository.SaveChangesAsync().Result;
|
||||||
|
|
||||||
_ = _repository.AddAsync(saveItem).Result;
|
sysUserInfo = newUser;
|
||||||
|
|
||||||
_ = _repository.SaveChangesAsync().Result;
|
|
||||||
|
|
||||||
|
|
||||||
sysUserInfo = saveItem;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
item.IsGeneratedAccount = true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
builder.HtmlBody = @$"<body style='font-family: 微软雅黑;padding: 0;margin: 0;'>
|
var userId = sysUserInfo.Id;
|
||||||
<div style='padding-left: 40px;background: #f6f6f6'>
|
var siteId = item.SiteId;
|
||||||
<div style='padding-top: 20px;'>
|
|
||||||
<div style='line-height: 40px;font-size: 18px'>
|
|
||||||
{sysUserInfo.LastName + "/" + sysUserInfo.FirstName}:
|
|
||||||
</div>
|
|
||||||
<div style='line-height: 40px;padding-left: 40px;margin-bottom: 10px;'>
|
|
||||||
{_localizer["TrialSiteSurvey_IRCInvitationContent", trialInfo.ResearchProgramNo]}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<a href=' {inviteEmailCommand.RouteUrl + "?Id=" + item.Id + "&IsExternalUser=0"}' style='margin-left:60px;font-size:14px;text-decoration: none;display: inline-block;height: 40px;width: 140px;background: #00D1B2;color:#fff;border-radius: 5px;line-height: 40px;text-align: center;margin-bottom: 100px;'>
|
//判断是否加入到项目
|
||||||
查看并确认
|
var findTrialUser = await _trialUserRepository.FirstOrDefaultAsync(t => t.TrialId == trialId && t.UserId == userId, true);
|
||||||
</a>
|
if (findTrialUser == null)
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</body>";
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
messageToSend.Body = builder.ToMessageBody();
|
|
||||||
|
|
||||||
using (var smtp = new MailKit.Net.Smtp.SmtpClient())
|
|
||||||
{
|
{
|
||||||
|
await _repository.AddAsync(new TrialUser() { TrialId = trialId, UserId = userId, JoinTime = DateTime.Now });
|
||||||
|
|
||||||
smtp.ServerCertificateValidationCallback = (s, c, h, e) => true;
|
await _mailVerificationService.SiteSurveyUserJoinEmail(trialId, userId, baseUrl, routeUrl);
|
||||||
|
|
||||||
smtp.MessageSent += (sender, args) =>
|
}
|
||||||
|
else if (findTrialUser.IsDeleted == true)
|
||||||
{
|
{
|
||||||
|
await _trialUserRepository.UpdatePartialFromQueryAsync(t => t.TrialId == trialId && t.UserId == userId, c => new TrialUser()
|
||||||
|
{
|
||||||
|
IsDeleted = false,
|
||||||
|
DeletedTime = null,
|
||||||
|
JoinTime = DateTime.Now,
|
||||||
|
});
|
||||||
|
|
||||||
_ = _trialSiteUserSurveyRepository.BatchUpdateNoTrackingAsync(t => t.Id == item.Id, u => new TrialSiteUserSurvey() { IsGenerateSuccess = true, InviteState = TrialSiteUserStateEnum.HasSend, ConfirmTime = null, RejectReason = String.Empty, SystemUserId = sysUserInfo.Id, ExpireTime = DateTime.Now.AddDays(7) }).Result;
|
await _mailVerificationService.SiteSurveyUserJoinEmail(trialId, userId, baseUrl, routeUrl);
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
await smtp.ConnectAsync("smtp.163.com", 465, SecureSocketOptions.StartTls);
|
|
||||||
|
|
||||||
|
|
||||||
await smtp.AuthenticateAsync("iracis_grr@163.com", "XLWVQKZAEKLDWOAH");
|
|
||||||
|
|
||||||
|
|
||||||
await smtp.SendAsync(messageToSend);
|
|
||||||
|
|
||||||
|
|
||||||
await smtp.DisconnectAsync(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var findTrialSiteUser = await _trialSiteUserRepository.FirstOrDefaultAsync(t => t.TrialId == trialId && t.UserId == userId && t.SiteId == siteId, true);
|
||||||
|
|
||||||
|
if (findTrialSiteUser == null)
|
||||||
|
{
|
||||||
|
await _repository.AddAsync(new TrialSiteUser() { TrialId = trialId, SiteId = siteId, UserId = userId });
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
findTrialSiteUser.IsDeleted = false;
|
||||||
|
findTrialSiteUser.DeletedTime = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
await _userRepository.BatchUpdateNoTrackingAsync(t => t.Id == userId, u => new User() { Status = UserStateEnum.Enable });
|
||||||
|
|
||||||
|
await _trialSiteUserRepository.SaveChangesAsync();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return ResponseOutput.Ok();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ using Microsoft.AspNetCore.Mvc;
|
||||||
using IRaCIS.Core.Domain.Share;
|
using IRaCIS.Core.Domain.Share;
|
||||||
using IRaCIS.Core.Application.Filter;
|
using IRaCIS.Core.Application.Filter;
|
||||||
using IRaCIS.Core.Infrastructure;
|
using IRaCIS.Core.Infrastructure;
|
||||||
|
using IRaCIS.Application.Contracts;
|
||||||
|
|
||||||
namespace IRaCIS.Core.Application.Contracts
|
namespace IRaCIS.Core.Application.Contracts
|
||||||
{
|
{
|
||||||
|
@ -17,57 +18,43 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
public class TrialSiteUserSurveyService : BaseService, ITrialSiteUserSurveyService
|
public class TrialSiteUserSurveyService : BaseService, ITrialSiteUserSurveyService
|
||||||
{
|
{
|
||||||
private readonly IRepository<TrialSiteUserSurvey> _trialSiteUserSurveyRepository;
|
private readonly IRepository<TrialSiteUserSurvey> _trialSiteUserSurveyRepository;
|
||||||
|
private readonly IRepository<TrialSiteSurvey> _trialSiteSurveyRepository;
|
||||||
|
|
||||||
public TrialSiteUserSurveyService(IRepository<TrialSiteUserSurvey> trialSiteUserSurveyRepository)
|
public TrialSiteUserSurveyService(IRepository<TrialSiteUserSurvey> trialSiteUserSurveyRepository, IRepository<TrialSiteSurvey> trialSiteSurveyRepository)
|
||||||
{
|
{
|
||||||
_trialSiteUserSurveyRepository = trialSiteUserSurveyRepository;
|
_trialSiteUserSurveyRepository = trialSiteUserSurveyRepository;
|
||||||
|
_trialSiteSurveyRepository = trialSiteSurveyRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("{trialSiteSurveyId:guid}")]
|
[HttpPost]
|
||||||
public async Task<List<TrialSiteUserSurveyView>> GetTrialSiteUserSurveyList(Guid trialSiteSurveyId)
|
public async Task<List<TrialSiteUserSurveyView>> GetTrialSiteUserSurveyList(TrialSiteUserSurverQuery inquery)
|
||||||
{
|
{
|
||||||
|
|
||||||
var trialSiteUserSurveyQueryable = _trialSiteUserSurveyRepository.Where(t => t.TrialSiteSurveyId == trialSiteSurveyId)
|
var trialSiteUserSurveyQueryable = _trialSiteUserSurveyRepository.Where(t => t.TrialSiteSurveyId == inquery.TrialSiteSurveyId)
|
||||||
//.WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.SPM, t => t.TrialSiteSurvey.State >= TrialSiteSurveyEnum.CRCSubmitted)
|
.WhereIf(inquery.IsHistoryUser !=null, t => t.IsHistoryUser==inquery.IsHistoryUser)
|
||||||
//.WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.APM|| _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CPM, t => t.TrialSiteSurvey.State >= TrialSiteSurveyEnum.SPMApproved)
|
|
||||||
.ProjectTo<TrialSiteUserSurveyView>(_mapper.ConfigurationProvider, new { isEn_Us = _userInfo.IsEn_Us });
|
.ProjectTo<TrialSiteUserSurveyView>(_mapper.ConfigurationProvider, new { isEn_Us = _userInfo.IsEn_Us });
|
||||||
|
|
||||||
return await trialSiteUserSurveyQueryable.ToListAsync();
|
return await trialSiteUserSurveyQueryable.ToListAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[TypeFilter(typeof(TrialResourceFilter),Arguments = new object[] { "AfterStopCannNotOpt" })]
|
[TypeFilter(typeof(TrialResourceFilter),Arguments = new object[] { "AfterStopCannNotOpt" })]
|
||||||
[HttpPost("{trialId:guid}")]
|
[HttpPost("{trialId:guid}")]
|
||||||
public async Task<IResponseOutput> AddOrUpdateTrialSiteUserSurvey(TrialSiteUserSurveyAddOrEdit addOrEditTrialSiteUserSurvey)
|
public async Task<IResponseOutput> AddOrUpdateTrialSiteUserSurvey(TrialSiteUserSurveyAddOrEdit addOrEditTrialSiteUserSurvey)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (await _trialSiteUserSurveyRepository.Where(t => t.Id == addOrEditTrialSiteUserSurvey.Id).AnyAsync(t => t.TrialSiteSurvey.State == TrialSiteSurveyEnum.PMCreatedAndLock))
|
|
||||||
|
|
||||||
|
if (await _trialSiteSurveyRepository.AnyAsync(t => t.Id == addOrEditTrialSiteUserSurvey.TrialSiteSurveyId && (t.IsDeleted == true || t.State == TrialSiteSurveyEnum.PMCreatedAndLock), true))
|
||||||
{
|
{
|
||||||
//---已锁定,不允许操作
|
//当前调研表已废除,或者调研表状态已锁定,不允许操作
|
||||||
return ResponseOutput.NotOk(_localizer["TrialSiteUser_Locked"]);
|
return ResponseOutput.NotOk("当前调研表已废除,或者调研表状态已锁定,不允许操作");
|
||||||
}
|
|
||||||
|
|
||||||
if (addOrEditTrialSiteUserSurvey.UserTypeId != null && ( _userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.APM))
|
|
||||||
{
|
|
||||||
var existSysUser = await _repository.Where<User>(t => t.EMail == addOrEditTrialSiteUserSurvey.Email && t.UserTypeId == addOrEditTrialSiteUserSurvey.UserTypeId).Include(d=>d.UserTypeRole).FirstOrDefaultAsync();
|
|
||||||
|
|
||||||
|
|
||||||
if (existSysUser != null)
|
|
||||||
{
|
|
||||||
if (existSysUser.LastName != addOrEditTrialSiteUserSurvey.LastName || existSysUser.FirstName != addOrEditTrialSiteUserSurvey.FirstName)
|
|
||||||
{
|
|
||||||
//$"该用户在系统中账户名为:{existSysUser.LastName + " / " + existSysUser.FirstName} ,与填写信息存在不一致项, 现将界面信息修改为与系统一致,可进行保存"
|
|
||||||
return ResponseOutput.NotOk(_localizer["TrialSiteUser_InconsistentInfo", existSysUser.UserTypeRole.UserTypeShortName, existSysUser.EMail, existSysUser.LastName + " / " + existSysUser.FirstName,existSysUser.Phone],
|
|
||||||
new { existSysUser.LastName, existSysUser.FirstName, existSysUser.Phone,existSysUser.IsTestUser,existSysUser.IsZhiZhun }, ApiResponseCodeEnum.NeedTips);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (addOrEditTrialSiteUserSurvey.IsGenerateAccount )
|
if (addOrEditTrialSiteUserSurvey.IsGenerateAccount )
|
||||||
{
|
{
|
||||||
var trialId= _trialSiteUserSurveyRepository.Where(t=>t.TrialSiteSurveyId == addOrEditTrialSiteUserSurvey.TrialSiteSurveyId).Select(t=>t.TrialSiteSurvey.TrialId).FirstOrDefault();
|
var trialId= _trialSiteSurveyRepository.Where(t=>t.Id == addOrEditTrialSiteUserSurvey.TrialSiteSurveyId,false,true).Select(t=>t.TrialId).FirstOrDefault();
|
||||||
|
|
||||||
var trialType = _repository.Where<Trial>(t => t.Id == trialId).Select(t => t.TrialType).FirstOrDefault();
|
var trialType = _repository.Where<Trial>(t => t.Id == trialId).Select(t => t.TrialType).FirstOrDefault();
|
||||||
|
|
||||||
|
@ -105,7 +92,40 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var entity = await _trialSiteUserSurveyRepository.InsertOrUpdateAsync(addOrEditTrialSiteUserSurvey, true);
|
var verifyExp1 = new EntityVerifyExp<TrialSiteUserSurvey>()
|
||||||
|
{
|
||||||
|
VerifyExp = u => u.UserTypeId == addOrEditTrialSiteUserSurvey.UserTypeId && u.Email == addOrEditTrialSiteUserSurvey.Email && u.TrialSiteSurveyId==addOrEditTrialSiteUserSurvey.TrialSiteSurveyId,
|
||||||
|
VerifyMsg = "同一邮箱同一用户类型,生成账号的数据只允许存在一条!",
|
||||||
|
IsVerify=addOrEditTrialSiteUserSurvey.IsGenerateAccount
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
if (addOrEditTrialSiteUserSurvey.UserTypeId != null)
|
||||||
|
{
|
||||||
|
var existSysUser = await _repository.Where<User>(t => t.EMail == addOrEditTrialSiteUserSurvey.Email && t.UserTypeId == addOrEditTrialSiteUserSurvey.UserTypeId).Include(d => d.UserTypeRole).FirstOrDefaultAsync();
|
||||||
|
|
||||||
|
|
||||||
|
if (existSysUser != null)
|
||||||
|
{
|
||||||
|
if (existSysUser.LastName != addOrEditTrialSiteUserSurvey.LastName || existSysUser.FirstName != addOrEditTrialSiteUserSurvey.FirstName)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
var optEntity = await _trialSiteUserSurveyRepository.InsertOrUpdateAsync(addOrEditTrialSiteUserSurvey, true, verifyExp1);
|
||||||
|
|
||||||
|
//$"该用户在系统中账户名为:{existSysUser.LastName + " / " + existSysUser.FirstName} ,与填写信息存在不一致项, 现将界面信息修改为与系统一致,可进行保存"
|
||||||
|
return ResponseOutput.NotOk(_localizer["TrialSiteUser_InconsistentInfo", existSysUser.UserTypeRole.UserTypeShortName, existSysUser.EMail, existSysUser.LastName + " / " + existSysUser.FirstName, existSysUser.Phone],
|
||||||
|
new { Id= optEntity.Id, existSysUser.LastName, existSysUser.FirstName, existSysUser.Phone, existSysUser.IsTestUser, existSysUser.IsZhiZhun }, ApiResponseCodeEnum.NeedTips);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var entity = await _trialSiteUserSurveyRepository.InsertOrUpdateAsync(addOrEditTrialSiteUserSurvey, true, verifyExp1);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return ResponseOutput.Ok(entity.Id.ToString());
|
return ResponseOutput.Ok(entity.Id.ToString());
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,23 @@ namespace IRaCIS.Core.Application.AutoMapper
|
||||||
|
|
||||||
CreateMap<LoginDto, TrialSiteSurvey>().ForMember(d => d.Email, t => t.MapFrom(t => t.EmailOrPhone));
|
CreateMap<LoginDto, TrialSiteSurvey>().ForMember(d => d.Email, t => t.MapFrom(t => t.EmailOrPhone));
|
||||||
|
|
||||||
|
CreateMap<TrialSiteUser, TrialSiteUserSurvey>()
|
||||||
|
.ForMember(d => d.Id, u => u.Ignore())
|
||||||
|
.ForMember(d => d.Phone, u => u.MapFrom(c => c.User.Phone))
|
||||||
|
.ForMember(d => d.Email, u => u.MapFrom(c => c.User.EMail))
|
||||||
|
.ForMember(d => d.OrganizationName, u => u.MapFrom(c => c.User.OrganizationName))
|
||||||
|
.ForMember(d => d.UserTypeId, u => u.MapFrom(c => c.User.UserTypeId))
|
||||||
|
.ForMember(d => d.IsHistoryUser, u => u.MapFrom(c => true))
|
||||||
|
.ForMember(d => d.IsHistoryUserOriginDeleted, u => u.MapFrom(c => c.IsDeleted))
|
||||||
|
.ForMember(d => d.IsHistoryUserDeleted, u => u.MapFrom(c => c.IsDeleted))
|
||||||
|
.ForMember(d => d.FirstName, u => u.MapFrom(c => c.User.FirstName))
|
||||||
|
.ForMember(d => d.LastName, u => u.MapFrom(c => c.User.LastName))
|
||||||
|
.ForMember(d => d.IsGenerateAccount, u => u.MapFrom(c => true))
|
||||||
|
.ForMember(d => d.IsGenerateSuccess, u => u.MapFrom(c => true))
|
||||||
|
.ForMember(d => d.SystemUserId, u => u.MapFrom(c => c.UserId))
|
||||||
|
.ForMember(d => d.IsJoin, u => u.MapFrom(c => !c.IsDeleted));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//列表
|
//列表
|
||||||
CreateMap<TrialSiteEquipmentSurvey, TrialSiteEquipmentSurveyView>()
|
CreateMap<TrialSiteEquipmentSurvey, TrialSiteEquipmentSurveyView>()
|
||||||
|
@ -33,11 +50,10 @@ namespace IRaCIS.Core.Application.AutoMapper
|
||||||
.ForMember(d => d.SiteName, u => u.MapFrom(s => s.Site.SiteName))
|
.ForMember(d => d.SiteName, u => u.MapFrom(s => s.Site.SiteName))
|
||||||
.ForMember(d => d.TrialSiteCode, u => u.MapFrom(s => s.TrialSite.TrialSiteCode));
|
.ForMember(d => d.TrialSiteCode, u => u.MapFrom(s => s.TrialSite.TrialSiteCode));
|
||||||
|
|
||||||
|
CreateMap<TrialSiteSurvey, TrialSiteSurveySelectView>();
|
||||||
|
|
||||||
var isEn_Us = false;
|
var isEn_Us = false;
|
||||||
CreateMap<TrialSiteUserSurvey, TrialSiteUserSurveyView>()
|
CreateMap<TrialSiteUserSurvey, TrialSiteUserSurveyView>()
|
||||||
.ForMember(t => t.TrialRoleName, u => u.MapFrom(d => isEn_Us? d.TrialRoleName.Value:d.TrialRoleName.ValueCN))
|
|
||||||
.ForMember(t => t.TrialRoleCode, u => u.MapFrom(d => d.TrialRoleName.Code))
|
|
||||||
.ForMember(d => d.UserType, u => u.MapFrom(s => s.UserTypeRole.UserTypeShortName))
|
.ForMember(d => d.UserType, u => u.MapFrom(s => s.UserTypeRole.UserTypeShortName))
|
||||||
.ForMember(d => d.UserTypeEnum, u => u.MapFrom(s => s.UserTypeRole.UserTypeEnum));
|
.ForMember(d => d.UserTypeEnum, u => u.MapFrom(s => s.UserTypeRole.UserTypeEnum));
|
||||||
|
|
||||||
|
@ -61,6 +77,10 @@ namespace IRaCIS.Core.Application.AutoMapper
|
||||||
|
|
||||||
CreateMap<TrialSiteUserSurvey, User>();
|
CreateMap<TrialSiteUserSurvey, User>();
|
||||||
|
|
||||||
|
CreateMap<SiteSurveyUserImportDto, User>()
|
||||||
|
.ForMember(d => d.EMail, u => u.MapFrom(s => s.Email));
|
||||||
|
|
||||||
|
|
||||||
CreateMap<TrialSiteUserSurveyView, User>();
|
CreateMap<TrialSiteUserSurveyView, User>();
|
||||||
|
|
||||||
|
|
||||||
|
@ -70,7 +90,6 @@ namespace IRaCIS.Core.Application.AutoMapper
|
||||||
|
|
||||||
CreateMap<TrialSiteUserSurvey, TrialSiteUserSurveyAllDTO>()
|
CreateMap<TrialSiteUserSurvey, TrialSiteUserSurveyAllDTO>()
|
||||||
.ForMember(t=>t.TrialSiteSurvey,u=>u.MapFrom(c=>c.TrialSiteSurvey))
|
.ForMember(t=>t.TrialSiteSurvey,u=>u.MapFrom(c=>c.TrialSiteSurvey))
|
||||||
.ForMember(t => t.TrialRoleName, u => u.MapFrom(d => d.TrialRoleName.Value))
|
|
||||||
.ForMember(d => d.UserType, u => u.MapFrom(s => s.UserTypeRole.UserTypeShortName))
|
.ForMember(d => d.UserType, u => u.MapFrom(s => s.UserTypeRole.UserTypeShortName))
|
||||||
.ForMember(d => d.UserTypeEnum, u => u.MapFrom(s => s.UserTypeRole.UserTypeEnum));
|
.ForMember(d => d.UserTypeEnum, u => u.MapFrom(s => s.UserTypeRole.UserTypeEnum));
|
||||||
|
|
||||||
|
|
|
@ -214,6 +214,25 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public class TrialConfigTabDto
|
||||||
|
{
|
||||||
|
public TrialQCProcess QCProcessEnum { get; set; } = TrialQCProcess.DoubleAudit;
|
||||||
|
|
||||||
|
public bool IsImageConsistencyVerification { get; set; } = true;
|
||||||
|
|
||||||
|
public bool IsMedicalReview { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
public bool IsEnrollementQualificationConfirm { get; set; } = false;
|
||||||
|
|
||||||
|
|
||||||
|
public bool IsPDProgressView { get; set; }
|
||||||
|
|
||||||
|
public UserTypeEnum? EnrollConfirmDefaultUserType { get; set; }
|
||||||
|
|
||||||
|
public UserTypeEnum? PDProgressDefaultUserType { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
public class TrialProcessConfigDTO
|
public class TrialProcessConfigDTO
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -50,7 +50,7 @@ namespace IRaCIS.Core.Application.ViewModel
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public UserTypeEnum? UserTypeEnum { get; set; }
|
||||||
|
|
||||||
public DateTime? ExpireTime { get; set; }
|
public DateTime? ExpireTime { get; set; }
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,6 @@ namespace IRaCIS.Core.Application.Interfaces
|
||||||
Task<IResponseOutput> DeleteTrialExternalUser(Guid trialExternalUserId, bool isSystemUser,
|
Task<IResponseOutput> DeleteTrialExternalUser(Guid trialExternalUserId, bool isSystemUser,
|
||||||
Guid systemUserId);
|
Guid systemUserId);
|
||||||
|
|
||||||
Task<IResponseOutput> UserConfirmJoinTrial(Guid trialId, Guid trialExternalUserId);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -281,535 +281,5 @@ namespace IRaCIS.Core.Application.Service
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region 老版本流程 现在废弃
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 勾选用户 批量发送邮件
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpPost]
|
|
||||||
public async Task<IResponseOutput> SendInviteEmail(TrialExternalUserSendEmail sendEmail)
|
|
||||||
{
|
|
||||||
|
|
||||||
var trialInfo = await _repository.FirstOrDefaultAsync<Trial>(t => t.Id == sendEmail.TrialId);
|
|
||||||
|
|
||||||
foreach (var userInfo in sendEmail.SendUsers)
|
|
||||||
{
|
|
||||||
var messageToSend = new MimeMessage();
|
|
||||||
//发件地址
|
|
||||||
messageToSend.From.Add(new MailboxAddress("GRR", "iracis_grr@163.com"));
|
|
||||||
//收件地址
|
|
||||||
messageToSend.To.Add(new MailboxAddress(String.Empty, userInfo.Email));
|
|
||||||
//主题
|
|
||||||
messageToSend.Subject = $"[{trialInfo.ResearchProgramNo}] 邀请";
|
|
||||||
|
|
||||||
//var baseApiUrl = sendEmail.BaseUrl.Remove(sendEmail.BaseUrl.IndexOf("#")) + "api";
|
|
||||||
|
|
||||||
var builder = new BodyBuilder();
|
|
||||||
|
|
||||||
var sysUserInfo = (await _userRepository.Where(t => t.Id == userInfo.SystemUserId).FirstOrDefaultAsync()).IfNullThrowException();
|
|
||||||
|
|
||||||
|
|
||||||
builder.HtmlBody = @$"<body style='font-family: 微软雅黑;padding: 0;margin: 0;'>
|
|
||||||
<div style='padding-left: 40px;background: #f6f6f6'>
|
|
||||||
<div style='padding-top: 20px;'>
|
|
||||||
<div style='line-height: 40px;font-size: 18px'>
|
|
||||||
{sysUserInfo.LastName + "/" + sysUserInfo.FirstName}:
|
|
||||||
</div>
|
|
||||||
<div style='line-height: 40px;padding-left: 40px;margin-bottom: 10px;'>
|
|
||||||
{
|
|
||||||
//您好,展影医疗作为 实验方案号:{trialInfo.ResearchProgramNo} 项目的IRC供应商,诚邀您参加该项目IRC相关工作,欢迎您提供指导和建议,非常感谢!
|
|
||||||
_localizer["TrialExternalUser_IRCInvitation", trialInfo.ResearchProgramNo]
|
|
||||||
}
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a href=' {sendEmail.RouteUrl + "?Id=" + userInfo.Id + "&IsExternalUser=1"}' style='margin-left:60px;font-size:14px;text-decoration: none;display: inline-block;height: 40px;width: 140px;background: #00D1B2;color:#fff;border-radius: 5px;line-height: 40px;text-align: center;margin-bottom: 100px;'>
|
|
||||||
查看并确认
|
|
||||||
</a>
|
|
||||||
</div>櫭
|
|
||||||
</div>
|
|
||||||
</body>";
|
|
||||||
|
|
||||||
|
|
||||||
//< form action = '#' method = 'post' >
|
|
||||||
|
|
||||||
// < button type = 'submit' style = 'margin-left:60px;font-size:14px;text-decoration: none;display: inline-block;height: 40px;width: 140px;background: #00D1B2;color:#fff;border-radius: 5px;line-height: 40px;text-align: center;border:none;margin-bottom: 100px;cursor: pointer' > 查看并确认 </ button >
|
|
||||||
|
|
||||||
// </ form >
|
|
||||||
messageToSend.Body = builder.ToMessageBody();
|
|
||||||
|
|
||||||
using (var smtp = new MailKit.Net.Smtp.SmtpClient())
|
|
||||||
{
|
|
||||||
smtp.MessageSent += (sender, args) =>
|
|
||||||
{
|
|
||||||
|
|
||||||
_ = _trialExternalUseRepository.BatchUpdateNoTrackingAsync(t => t.Id == userInfo.Id, u => new TrialExternalUser() { InviteState = TrialExternalUserStateEnum.HasSend, ConfirmTime = null, RejectReason = String.Empty, ExpireTime = DateTime.Now.AddDays(7) }).Result;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
smtp.ServerCertificateValidationCallback = (s, c, h, e) => true;
|
|
||||||
|
|
||||||
await smtp.ConnectAsync("smtp.163.com", 465, SecureSocketOptions.StartTls);
|
|
||||||
|
|
||||||
await smtp.AuthenticateAsync("iracis_grr@163.com", "XLWVQKZAEKLDWOAH");
|
|
||||||
|
|
||||||
await smtp.SendAsync(messageToSend);
|
|
||||||
|
|
||||||
await smtp.DisconnectAsync(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return ResponseOutput.Ok();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 不带Token 访问 用户选择 参与 不参与 Id: TrialExternalUserId 加入发送邮件
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="editTrialUserPreparation"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[AllowAnonymous]
|
|
||||||
public async Task<IResponseOutput> TrialExternalUserJoinTrial(TrialExternalUserConfirm editTrialUserPreparation)
|
|
||||||
{
|
|
||||||
|
|
||||||
var needUpdate = await _trialExternalUseRepository.FirstOrDefaultAsync(t => t.Id == editTrialUserPreparation.Id);
|
|
||||||
|
|
||||||
if (DateTime.Now > needUpdate.ExpireTime)
|
|
||||||
{
|
|
||||||
//---邀请加入时间已过期,重新被邀请后才可以进行确认操作
|
|
||||||
return ResponseOutput.NotOk(_localizer["TrialExternalUser_InvitationExpired"]);
|
|
||||||
}
|
|
||||||
|
|
||||||
_mapper.Map(editTrialUserPreparation, needUpdate);
|
|
||||||
|
|
||||||
needUpdate.InviteState = editTrialUserPreparation.IsJoin == true ? TrialExternalUserStateEnum.UserConfirmed : TrialExternalUserStateEnum.UserReject;
|
|
||||||
|
|
||||||
|
|
||||||
var trialId = needUpdate.TrialId;
|
|
||||||
var userId = needUpdate.SystemUserId;
|
|
||||||
|
|
||||||
//判断TrialUser中是否存在 不存在就插入
|
|
||||||
if (!await _trialUserRepository.AnyAsync(t => t.TrialId == trialId && t.UserId == userId))
|
|
||||||
{
|
|
||||||
|
|
||||||
await _trialUserRepository.AddAsync(new TrialUser() { TrialId = trialId, UserId = userId, JoinTime = DateTime.Now });
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
var success = await _trialExternalUseRepository.SaveChangesAsync();
|
|
||||||
|
|
||||||
|
|
||||||
if (editTrialUserPreparation.IsJoin == true)
|
|
||||||
{
|
|
||||||
var trialInfo = await _repository.FirstOrDefaultAsync<Trial>(t => t.Id == needUpdate.TrialId);
|
|
||||||
|
|
||||||
var messageToSend = new MimeMessage();
|
|
||||||
//发件地址
|
|
||||||
messageToSend.From.Add(new MailboxAddress("GRR", "iracis_grr@163.com"));
|
|
||||||
//收件地址
|
|
||||||
messageToSend.To.Add(new MailboxAddress(String.Empty, needUpdate.Email));
|
|
||||||
//主题
|
|
||||||
//$"[来自展影IRC] [{trialInfo.ResearchProgramNo}] 账户信息";
|
|
||||||
messageToSend.Subject = _localizer["TrialExternalUser_AccountInfo", trialInfo.ResearchProgramNo];
|
|
||||||
|
|
||||||
var builder = new BodyBuilder();
|
|
||||||
|
|
||||||
|
|
||||||
var sysUserInfo = (await _userRepository.Where(t => t.Id == needUpdate.SystemUserId).Include(t => t.UserTypeRole).FirstOrDefaultAsync()).IfNullThrowException();
|
|
||||||
|
|
||||||
int verificationCode = new Random().Next(100000, 1000000);
|
|
||||||
|
|
||||||
if (sysUserInfo.IsFirstAdd)
|
|
||||||
{
|
|
||||||
await _userRepository.BatchUpdateNoTrackingAsync(t => t.Id == sysUserInfo.Id,
|
|
||||||
u => new User() { Password = MD5Helper.Md5(verificationCode.ToString()) });
|
|
||||||
}
|
|
||||||
|
|
||||||
builder.HtmlBody = @$"<body style='font-family: 微软雅黑;padding: 0;margin: 0;'>
|
|
||||||
<div style='padding-left: 40px;background: #f6f6f6'>
|
|
||||||
<div style='padding-top: 20px;padding-bottom:40px'>
|
|
||||||
<div style='line-height: 40px;font-size: 18px'>
|
|
||||||
{sysUserInfo.LastName + "/" + sysUserInfo.FirstName}:
|
|
||||||
</div>
|
|
||||||
<div style='line-height: 40px;padding-left: 40px;margin-bottom: 10px;'>
|
|
||||||
{
|
|
||||||
// 您好,欢迎您参加项目 实验方案号:{trialInfo.ResearchProgramNo}IRC相关工作。该项目采用电子化工作流,系统及您的账号信息如下:
|
|
||||||
_localizer["TrialExternalUser_Welcome", trialInfo.ResearchProgramNo]
|
|
||||||
}
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div style='border: 1px solid #eee;box-sizing:border-box;width: 80%;background: #fff;padding: 20px;line-height: 40px;font-size: 14px;border-radius: 5px;margin-left: 60px;margin-bottom: 30px;'>
|
|
||||||
<div>
|
|
||||||
|
|
||||||
{
|
|
||||||
// 项目编号: {trialInfo.TrialCode}
|
|
||||||
_localizer["TrialExternalUser_ProjectNumber", trialInfo.TrialCode]
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
|
|
||||||
{
|
|
||||||
// 试验方案号: {trialInfo.ResearchProgramNo}
|
|
||||||
_localizer["TrialExternalUser_ExperimentPlanNumber", trialInfo.ResearchProgramNo]
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
|
|
||||||
{
|
|
||||||
// 试验名称: {trialInfo.ExperimentName}
|
|
||||||
_localizer["TrialExternalUser_ExperimentName", trialInfo.ExperimentName]
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
|
|
||||||
{
|
|
||||||
// 用户名: {sysUserInfo.UserName}
|
|
||||||
_localizer["TrialExternalUser_Username", sysUserInfo.UserName]
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
|
|
||||||
|
|
||||||
{
|
|
||||||
// 密码: {(sysUserInfo.IsFirstAdd ? verificationCode.ToString() + "(请在登录后进行修改)" : "***(您已有账号, 若忘记密码, 请通过邮箱找回)")}
|
|
||||||
_localizer["TrialExternalUser_Password", verificationCode.ToString()]
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
|
|
||||||
{
|
|
||||||
// 角色: {sysUserInfo.UserTypeRole.UserTypeShortName}
|
|
||||||
_localizer["TrialExternalUser_Role", sysUserInfo.UserTypeRole.UserTypeShortName]
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
系统登录地址: {editTrialUserPreparation.BaseUrl}
|
|
||||||
{
|
|
||||||
// 系统登录地址: {editTrialUserPreparation.BaseUrl}
|
|
||||||
_localizer["TrialExternalUser_LoginUrl", editTrialUserPreparation.BaseUrl]
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</body>";
|
|
||||||
|
|
||||||
messageToSend.Body = builder.ToMessageBody();
|
|
||||||
|
|
||||||
using (var smtp = new MailKit.Net.Smtp.SmtpClient())
|
|
||||||
{
|
|
||||||
|
|
||||||
smtp.ServerCertificateValidationCallback = (s, c, h, e) => true;
|
|
||||||
|
|
||||||
await smtp.ConnectAsync("smtp.163.com", 465, SecureSocketOptions.StartTls);
|
|
||||||
|
|
||||||
await smtp.AuthenticateAsync("iracis_grr@163.com", "XLWVQKZAEKLDWOAH");
|
|
||||||
|
|
||||||
await smtp.SendAsync(messageToSend);
|
|
||||||
|
|
||||||
await smtp.DisconnectAsync(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
await _userRepository.BatchUpdateNoTrackingAsync(t => t.Id == userId, u => new User() { Status = UserStateEnum.Enable });
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
return ResponseOutput.Ok();
|
|
||||||
|
|
||||||
//else
|
|
||||||
//{
|
|
||||||
// builder.HtmlBody = @$"<body style='font-family: 微软雅黑;padding: 0;margin: 0;'>
|
|
||||||
// <div style='padding-left: 40px;background: #f6f6f6'>
|
|
||||||
// <div style='padding-top: 20px;padding-bottom:40px'>
|
|
||||||
// <div style='line-height: 40px;font-size: 18px'>
|
|
||||||
// {sysUserInfo.LastName + "/" + sysUserInfo.FirstName}:
|
|
||||||
// </div>
|
|
||||||
// <div style='line-height: 40px;padding-left: 40px;margin-bottom: 10px;'>
|
|
||||||
// 您好,您拒绝了参加 {trialInfo.ResearchProgramNo} 项目IRC相关工作的邀请。详细信息如下:
|
|
||||||
// </div>
|
|
||||||
// <div style='border: 1px solid #eee;box-sizing:border-box;width: 80%;background: #fff;padding: 20px;line-height: 40px;font-size: 14px;border-radius: 5px;margin-left: 60px;margin-bottom: 30px;'>
|
|
||||||
// <div>
|
|
||||||
// 项目编号: {trialInfo.TrialCode}
|
|
||||||
// </div>
|
|
||||||
// <div>
|
|
||||||
// 试验方案号: {trialInfo.ResearchProgramNo}
|
|
||||||
// </div>
|
|
||||||
// <div>
|
|
||||||
// 试验名称: {trialInfo.ExperimentName}
|
|
||||||
// </div>
|
|
||||||
// <div>
|
|
||||||
// 用户名: {sysUserInfo.UserName}
|
|
||||||
// </div>
|
|
||||||
// <div>
|
|
||||||
// 角色: {sysUserInfo.UserTypeRole.UserTypeShortName}
|
|
||||||
// </div>
|
|
||||||
// </div>
|
|
||||||
// </div>
|
|
||||||
// </div>
|
|
||||||
// </body>";
|
|
||||||
//}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 不带Token 访问 Site调研用户 加入项目 Id: TrialSiteSurveyUserId
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="editInfo"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[AllowAnonymous]
|
|
||||||
public async Task<IResponseOutput> TrialSiteSurveyUserJoinTrial(TrialExternalUserConfirm editInfo)
|
|
||||||
{
|
|
||||||
|
|
||||||
var needUpdate = (await _trialSiteSurveyUserRepository.Where(t => t.Id == editInfo.Id, true).Include(t => t.TrialSiteSurvey).FirstOrDefaultAsync()).IfNullThrowException();
|
|
||||||
|
|
||||||
var revieweUser = await _userRepository.FirstOrDefaultAsync(t => t.Id == needUpdate.TrialSiteSurvey.ReviewerUserId);
|
|
||||||
|
|
||||||
|
|
||||||
if (DateTime.Now > needUpdate.ExpireTime)
|
|
||||||
{
|
|
||||||
//---邀请加入时间已过期,重新被邀请后才可以进行确认操作
|
|
||||||
return ResponseOutput.NotOk(_localizer["TrialExternalUser_InvitationExpired"]);
|
|
||||||
}
|
|
||||||
|
|
||||||
_mapper.Map(editInfo, needUpdate);
|
|
||||||
|
|
||||||
needUpdate.InviteState = editInfo.IsJoin == true ? TrialSiteUserStateEnum.UserConfirmed : TrialSiteUserStateEnum.UserReject;
|
|
||||||
|
|
||||||
|
|
||||||
if (needUpdate.SystemUserId == null)
|
|
||||||
{
|
|
||||||
//---调研表系统用户Id 存储有问题
|
|
||||||
return ResponseOutput.NotOk(_localizer["TrialExternalUser_UserIdStorageProblem"]);
|
|
||||||
}
|
|
||||||
|
|
||||||
var trialId = needUpdate.TrialSiteSurvey.TrialId;
|
|
||||||
var siteId = needUpdate.TrialSiteSurvey.SiteId;
|
|
||||||
var userId = (Guid)needUpdate.SystemUserId;
|
|
||||||
|
|
||||||
|
|
||||||
if (!await _trialUserRepository.AnyAsync(t => t.TrialId == trialId && t.UserId == userId))
|
|
||||||
{
|
|
||||||
await _trialUserRepository.AddAsync(new TrialUser() { TrialId = trialId, UserId = userId, JoinTime = DateTime.Now });
|
|
||||||
|
|
||||||
await _trialSiteUserRepository.AddAsync(new TrialSiteUser() { TrialId = trialId, SiteId = siteId, UserId = userId });
|
|
||||||
|
|
||||||
await _userRepository.BatchUpdateNoTrackingAsync(t => t.Id == needUpdate.SystemUserId, u => new User() { Status = UserStateEnum.Enable });
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
var success = await _trialExternalUseRepository.SaveChangesAsync();
|
|
||||||
|
|
||||||
var trialInfo = await _repository.FirstOrDefaultAsync<Trial>(t => t.Id == needUpdate.TrialSiteSurvey.TrialId);
|
|
||||||
|
|
||||||
|
|
||||||
var messageToSend = new MimeMessage();
|
|
||||||
//发件地址
|
|
||||||
messageToSend.From.Add(new MailboxAddress("GRR", "iracis_grr@163.com"));
|
|
||||||
//收件地址
|
|
||||||
messageToSend.To.Add(new MailboxAddress(String.Empty, editInfo.IsJoin == true ? needUpdate.Email : revieweUser.EMail));
|
|
||||||
//主题
|
|
||||||
// $"[来自展影IRC] [{trialInfo.ResearchProgramNo}] 账户信息";
|
|
||||||
messageToSend.Subject = _localizer["TrialExternalUser_IRCAccountInfo", trialInfo.ResearchProgramNo];
|
|
||||||
|
|
||||||
|
|
||||||
var builder = new BodyBuilder();
|
|
||||||
|
|
||||||
|
|
||||||
var sysUserInfo = await _userRepository.Where(t => t.Id == needUpdate.SystemUserId).Include(t => t.UserTypeRole).FirstOrDefaultAsync();
|
|
||||||
|
|
||||||
int verificationCode = new Random().Next(100000, 1000000);
|
|
||||||
|
|
||||||
if (sysUserInfo.IsFirstAdd)
|
|
||||||
{
|
|
||||||
await _userRepository.BatchUpdateNoTrackingAsync(t => t.Id == sysUserInfo.Id,
|
|
||||||
u => new User() { Password = MD5Helper.Md5(verificationCode.ToString()) });
|
|
||||||
}
|
|
||||||
|
|
||||||
if (editInfo.IsJoin == true)
|
|
||||||
{
|
|
||||||
builder.HtmlBody = @$"<body style='font-family: 微软雅黑;padding: 0;margin: 0;'>
|
|
||||||
<div style='padding-left: 40px;background: #f6f6f6'>
|
|
||||||
<div style='padding-top: 20px;padding-bottom:40px'>
|
|
||||||
<div style='line-height: 40px;font-size: 18px'>
|
|
||||||
{sysUserInfo.LastName + "/" + sysUserInfo.FirstName}:
|
|
||||||
</div>
|
|
||||||
<div style='line-height: 40px;padding-left: 40px;margin-bottom: 10px;'>
|
|
||||||
您好,欢迎您参加项目 实验方案号: {trialInfo.ResearchProgramNo} IRC相关工作。该项目采用电子化工作流,系统及您的账号信息如下:
|
|
||||||
</div>
|
|
||||||
<div style='border: 1px solid #eee;box-sizing:border-box;width: 80%;background: #fff;padding: 20px;line-height: 40px;font-size: 14px;border-radius: 5px;margin-left: 60px;margin-bottom: 30px;'>
|
|
||||||
<div>
|
|
||||||
项目编号: {trialInfo.TrialCode}
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
试验方案号: {trialInfo.ResearchProgramNo}
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
试验名称: {trialInfo.ExperimentName}
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
用户名: {sysUserInfo.UserName}
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
密码: {(sysUserInfo.IsFirstAdd ? verificationCode.ToString() + "(请在登录后进行修改)" : "***(您已有账号, 若忘记密码, 请通过邮箱找回)")}
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
角色: {sysUserInfo.UserTypeRole.UserTypeShortName}
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
系统登录地址: {editInfo.BaseUrl}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</body>";
|
|
||||||
|
|
||||||
messageToSend.Body = builder.ToMessageBody();
|
|
||||||
|
|
||||||
using (var smtp = new MailKit.Net.Smtp.SmtpClient())
|
|
||||||
{
|
|
||||||
|
|
||||||
smtp.ServerCertificateValidationCallback = (s, c, h, e) => true;
|
|
||||||
|
|
||||||
await smtp.ConnectAsync("smtp.163.com", 465, SecureSocketOptions.StartTls);
|
|
||||||
|
|
||||||
await smtp.AuthenticateAsync("iracis_grr@163.com", "XLWVQKZAEKLDWOAH");
|
|
||||||
|
|
||||||
await smtp.SendAsync(messageToSend);
|
|
||||||
|
|
||||||
await smtp.DisconnectAsync(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//else
|
|
||||||
//{
|
|
||||||
|
|
||||||
// builder.HtmlBody = @$"<body style='font-family: 微软雅黑;padding: 0;margin: 0;'>
|
|
||||||
// <div style='padding-left: 40px;background: #f6f6f6'>
|
|
||||||
// <div style='padding-top: 20px;padding-bottom:40px'>
|
|
||||||
// <div style='line-height: 40px;font-size: 18px'>
|
|
||||||
// {revieweUser.LastName + "/" + revieweUser.FirstName}:
|
|
||||||
// </div>
|
|
||||||
// <div style='line-height: 40px;padding-left: 40px;margin-bottom: 10px;'>
|
|
||||||
// 您好,{sysUserInfo.LastName + "/" + sysUserInfo.FirstName} 拒绝了参加 {trialInfo.ResearchProgramNo} 项目IRC相关工作的邀请。详细信息如下:
|
|
||||||
// </div>
|
|
||||||
// <div style='border: 1px solid #eee;box-sizing:border-box;width: 80%;background: #fff;padding: 20px;line-height: 40px;font-size: 14px;border-radius: 5px;margin-left: 60px;margin-bottom: 30px;'>
|
|
||||||
// <div>
|
|
||||||
// 项目编号: {trialInfo.TrialCode}
|
|
||||||
// </div>
|
|
||||||
// <div>
|
|
||||||
// 试验方案号: {trialInfo.ResearchProgramNo}
|
|
||||||
// </div>
|
|
||||||
// <div>
|
|
||||||
// 试验名称: {trialInfo.ExperimentName}
|
|
||||||
// </div>
|
|
||||||
// <div>
|
|
||||||
// 用户名: {sysUserInfo.UserName}
|
|
||||||
// </div>
|
|
||||||
// <div>
|
|
||||||
// 角色: {sysUserInfo.UserTypeRole.UserTypeShortName}
|
|
||||||
// </div>
|
|
||||||
// <div>
|
|
||||||
// 拒绝原因: {editInfo.RejectReason}
|
|
||||||
// </div>
|
|
||||||
// </div>
|
|
||||||
// </div>
|
|
||||||
// </div>
|
|
||||||
// </body>";
|
|
||||||
|
|
||||||
//}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return ResponseOutput.Ok();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 不带Token 访问 页面获取项目基本信息 和参与情况 (已经确认了 就不允许再次确认) Id: TrialExternalUserId/TrialSiteSurveyUserId
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="id"></param>
|
|
||||||
/// <param name="isExternalUser"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[AllowAnonymous]
|
|
||||||
public async Task<TrialInfoWithPreparationInfo> JoinBasicInfo(Guid id, bool isExternalUser)
|
|
||||||
{
|
|
||||||
if (isExternalUser)
|
|
||||||
{
|
|
||||||
return (await _trialExternalUseRepository.Where(t => t.Id == id)
|
|
||||||
.ProjectTo<TrialInfoWithPreparationInfo>(_mapper.ConfigurationProvider).FirstOrDefaultAsync()).IfNullThrowException();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return (await _trialSiteSurveyUserRepository.Where(t => t.Id == id)
|
|
||||||
.ProjectTo<TrialInfoWithPreparationInfo>(_mapper.ConfigurationProvider).FirstOrDefaultAsync()).IfNullThrowException();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 加入项目
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="trialId"></param>
|
|
||||||
/// <param name="trialExternalUserId"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpGet("{trialId:guid}/{trialExternalUserId:guid}")]
|
|
||||||
[NonDynamicMethod]
|
|
||||||
public async Task<IResponseOutput> UserConfirmJoinTrial(Guid trialId, Guid trialExternalUserId)
|
|
||||||
{
|
|
||||||
|
|
||||||
var externalUser = await _trialExternalUseRepository.FirstOrDefaultAsync(t => t.Id == trialExternalUserId);
|
|
||||||
|
|
||||||
|
|
||||||
//判断TrialUser中是否存在 不存在就插入
|
|
||||||
if (!await _repository.AnyAsync<TrialUser>(t => t.TrialId == trialId && t.UserId == externalUser.SystemUserId))
|
|
||||||
{
|
|
||||||
await _repository.AddAsync(new TrialUser() { TrialId = trialId, UserId = (Guid)externalUser.SystemUserId, JoinTime = DateTime.Now });
|
|
||||||
|
|
||||||
await _trialExternalUseRepository.BatchUpdateNoTrackingAsync(t => t.Id == trialExternalUserId,
|
|
||||||
u => new TrialExternalUser() { InviteState = TrialExternalUserStateEnum.UserConfirmed });
|
|
||||||
|
|
||||||
await _userRepository.BatchUpdateNoTrackingAsync(t => t.Id == externalUser.SystemUserId, u => new User() { Status = UserStateEnum.Enable });
|
|
||||||
|
|
||||||
await _userRepository.SaveChangesAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return ResponseOutput.Ok();
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -280,52 +280,9 @@ namespace IRaCIS.Application.Services
|
||||||
public async Task<IResponseOutput> DeleteTrial(Guid trialId)
|
public async Task<IResponseOutput> DeleteTrial(Guid trialId)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
var trial = (await _trialRepository.FirstOrDefaultAsync(u => u.Id == trialId, true)).IfNullThrowException();
|
|
||||||
|
|
||||||
|
|
||||||
if (_verifyConfig.CurrentValue.OpenTrialRelationDelete)
|
if (_verifyConfig.CurrentValue.OpenTrialRelationDelete)
|
||||||
{
|
{
|
||||||
|
|
||||||
#region 项目真删除废弃
|
|
||||||
|
|
||||||
//if (trial.VisitPlanConfirmed)
|
|
||||||
//{
|
|
||||||
// return ResponseOutput.NotOk("Trial访视计划已经确认,无法删除");
|
|
||||||
//}
|
|
||||||
|
|
||||||
//if (await _repository.AnyAsync<Enroll>(u => u.TrialId == trialId))
|
|
||||||
//{
|
|
||||||
// return ResponseOutput.NotOk("该Trial有医生入组或在入组流程中,无法删除");
|
|
||||||
//}
|
|
||||||
|
|
||||||
//if (await _repository.AnyAsync<TrialSite>(u => u.TrialId == trialId))
|
|
||||||
//{
|
|
||||||
// return ResponseOutput.NotOk("该Trial下面有Site,无法删除");
|
|
||||||
//}
|
|
||||||
|
|
||||||
////PM 可以删除项目 仅仅在没有site 参与者只有他自己的时候
|
|
||||||
//if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager)
|
|
||||||
//{
|
|
||||||
// //参与者仅有他自己时,可以删除
|
|
||||||
// if (await _trialUserRepository.CountAsync(t => t.TrialId == trialId) == 1)
|
|
||||||
// {
|
|
||||||
|
|
||||||
// var success1 = await _repository.BatchDeleteAsync<Trial>(o => o.Id == trialId) ||
|
|
||||||
// await _repository.BatchDeleteAsync<TrialUser>(t => t.TrialId == trialId) ||
|
|
||||||
// await _repository.BatchDeleteAsync<TrialDictionary>(t => t.TrialId == trialId);
|
|
||||||
|
|
||||||
// return ResponseOutput.Result(success1);
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
//if (await _repository.AnyAsync<TrialUser>(u => u.TrialId == trialId))
|
|
||||||
//{
|
|
||||||
// return ResponseOutput.NotOk("该Trial下面有参与者,无法删除");
|
|
||||||
//}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
await _repository.BatchDeleteAsync<CheckChallengeDialog>(o => o.SubjectVisit.TrialId == trialId);
|
await _repository.BatchDeleteAsync<CheckChallengeDialog>(o => o.SubjectVisit.TrialId == trialId);
|
||||||
await _repository.BatchDeleteAsync<ClinicalDataTrialSet>(o => o.TrialId == trialId);
|
await _repository.BatchDeleteAsync<ClinicalDataTrialSet>(o => o.TrialId == trialId);
|
||||||
|
@ -344,9 +301,6 @@ namespace IRaCIS.Application.Services
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
await _repository.BatchDeleteAsync<PreviousHistory>(t => t.SubjectVisit.TrialId == trialId);
|
await _repository.BatchDeleteAsync<PreviousHistory>(t => t.SubjectVisit.TrialId == trialId);
|
||||||
await _repository.BatchDeleteAsync<PreviousOther>(t => t.SubjectVisit.TrialId == trialId);
|
await _repository.BatchDeleteAsync<PreviousOther>(t => t.SubjectVisit.TrialId == trialId);
|
||||||
await _repository.BatchDeleteAsync<PreviousPDF>(t => t.SubjectVisit.TrialId == trialId);
|
await _repository.BatchDeleteAsync<PreviousPDF>(t => t.SubjectVisit.TrialId == trialId);
|
||||||
|
@ -438,7 +392,6 @@ namespace IRaCIS.Application.Services
|
||||||
|
|
||||||
await _repository.BatchDeleteAsync<VisitTaskReReading>(t => t.OriginalReReadingTask.TrialId == trialId);
|
await _repository.BatchDeleteAsync<VisitTaskReReading>(t => t.OriginalReReadingTask.TrialId == trialId);
|
||||||
await _repository.BatchDeleteAsync<VisitTask>(t => t.TrialId == trialId);
|
await _repository.BatchDeleteAsync<VisitTask>(t => t.TrialId == trialId);
|
||||||
await _repository.BatchDeleteAsync<TrialAttachment>(t => t.TrialId == trialId);
|
|
||||||
await _repository.BatchDeleteAsync<TrialStateChange>(t => t.TrialId == trialId) ;
|
await _repository.BatchDeleteAsync<TrialStateChange>(t => t.TrialId == trialId) ;
|
||||||
|
|
||||||
return ResponseOutput.Ok();
|
return ResponseOutput.Ok();
|
||||||
|
@ -454,41 +407,6 @@ namespace IRaCIS.Application.Services
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[AllowAnonymous]
|
|
||||||
[HttpDelete, Route("{trialId:guid}")]
|
|
||||||
public async Task<IResponseOutput> DeleteTrialTaskData(Guid trialId)
|
|
||||||
{
|
|
||||||
|
|
||||||
//await _repository.BatchDeleteAsync<ReadingMedicineTrialQuestion>(t => t.TrialId == trialId) ||
|
|
||||||
// await _repository.BatchDeleteAsync<ReadingQuestionTrial>(t => t.TrialId == trialId) ||
|
|
||||||
// await _repository.BatchDeleteAsync<ReadingTableQuestionTrial>(t => t.TrialId == trialId) ||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//await _repository.BatchDeleteAsync<ReadingGlobalTaskInfo>(t => t.TrialId == trialId);
|
|
||||||
// await _repository.BatchDeleteAsync<ReadingJudgeInfo>(t => t.TrialId == trialId);
|
|
||||||
|
|
||||||
|
|
||||||
// await _repository.BatchDeleteAsync<ReadingMedicalReviewDialog>(t => t.TaskMedicalReview.TrialId == trialId);
|
|
||||||
// await _repository.BatchDeleteAsync<ReadingMedicineQuestionAnswer>(t => t.TaskMedicalReview.TrialId == trialId);
|
|
||||||
|
|
||||||
|
|
||||||
// await _repository.BatchDeleteAsync<ReadingOncologyTaskInfo>(t => t.VisitTask.TrialId == trialId);
|
|
||||||
|
|
||||||
// await _repository.BatchDeleteAsync<ReadingTableAnswerRowInfo>(t => t.TrialId == trialId);
|
|
||||||
|
|
||||||
// await _repository.BatchDeleteAsync<ReadingTableQuestionAnswer>(t => t.TrialId == trialId);
|
|
||||||
// await _repository.BatchDeleteAsync<ReadingTaskQuestionAnswer>(t => t.TrialId == trialId) ;
|
|
||||||
|
|
||||||
// await _repository.BatchDeleteAsync<ReadingTaskRelation>(t => t.VisitTask.TrialId == trialId);
|
|
||||||
// await _repository.BatchDeleteAsync<ReadingTaskQuestionAnswer>(t => t.TrialId == trialId);
|
|
||||||
|
|
||||||
// await _repository.BatchDeleteAsync<VisitTaskReReading>(t => t.OriginalReReadingTask.TrialId == trialId);
|
|
||||||
// await _repository.BatchDeleteAsync<VisitTask>(t => t.TrialId == trialId);
|
|
||||||
|
|
||||||
return ResponseOutput.Ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
|
|
||||||
|
|
||||||
CreateMap<Trial, TrialProcessConfigDTO>();
|
CreateMap<Trial, TrialProcessConfigDTO>();
|
||||||
|
CreateMap<Trial, TrialConfigTabDto>();
|
||||||
|
|
||||||
CreateMap<ReadingQuestionCriterionTrial, TrialTaskConfigView > ()
|
CreateMap<ReadingQuestionCriterionTrial, TrialTaskConfigView > ()
|
||||||
.ForMember(d => d.QCProcessEnum, u => u.MapFrom(s => s.Trial.QCProcessEnum))
|
.ForMember(d => d.QCProcessEnum, u => u.MapFrom(s => s.Trial.QCProcessEnum))
|
||||||
|
@ -206,7 +206,8 @@ namespace IRaCIS.Core.Application.Service
|
||||||
CreateMap<TrialExternalUser, TrialExternalUserAddOrEdit>().ReverseMap();
|
CreateMap<TrialExternalUser, TrialExternalUserAddOrEdit>().ReverseMap();
|
||||||
CreateMap<TrialExternalUserAddOrEdit, User>();
|
CreateMap<TrialExternalUserAddOrEdit, User>();
|
||||||
|
|
||||||
CreateMap<TrialExternalUser, TrialExternalUserView>();
|
CreateMap<TrialExternalUser, TrialExternalUserView>()
|
||||||
|
.ForMember(t=>t.UserTypeEnum,u=>u.MapFrom(c=>c.SystemUser.UserTypeEnum));
|
||||||
|
|
||||||
|
|
||||||
CreateMap<User, TrialExternalUser>().ReverseMap();
|
CreateMap<User, TrialExternalUser>().ReverseMap();
|
||||||
|
@ -285,7 +286,6 @@ namespace IRaCIS.Core.Application.Service
|
||||||
.ForMember(t => t.TrialSiteUserList, u => u.Ignore());
|
.ForMember(t => t.TrialSiteUserList, u => u.Ignore());
|
||||||
|
|
||||||
CreateMap<TrialSiteUserSurvey, TrialSiteUserSummaryDto>()
|
CreateMap<TrialSiteUserSurvey, TrialSiteUserSummaryDto>()
|
||||||
.ForMember(t => t.TrialRoleName, u => u.MapFrom(d => d.TrialRoleName.Value))
|
|
||||||
.ForMember(d => d.UserType, u => u.MapFrom(s => s.UserTypeRole.UserTypeShortName))
|
.ForMember(d => d.UserType, u => u.MapFrom(s => s.UserTypeRole.UserTypeShortName))
|
||||||
.ForMember(d => d.UserTypeEnum, u => u.MapFrom(s => s.UserTypeRole.UserTypeEnum))
|
.ForMember(d => d.UserTypeEnum, u => u.MapFrom(s => s.UserTypeRole.UserTypeEnum))
|
||||||
.ForMember(t => t.TrialSiteCode, u => u.MapFrom(d => d.TrialSiteSurvey.TrialSite.TrialSiteCode))
|
.ForMember(t => t.TrialSiteCode, u => u.MapFrom(d => d.TrialSiteSurvey.TrialSite.TrialSiteCode))
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
using IRaCIS.Core.Application.ViewModel;
|
using IRaCIS.Core.Application.ViewModel;
|
||||||
using IRaCIS.Core.Domain.Share;
|
using IRaCIS.Core.Domain.Share;
|
||||||
using IRaCIS.Core.Infrastructure;
|
using IRaCIS.Core.Infrastructure;
|
||||||
|
using MassTransit;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
@ -64,90 +65,12 @@ namespace IRaCIS.Application.Services
|
||||||
|
|
||||||
return ResponseOutput.Ok();
|
return ResponseOutput.Ok();
|
||||||
}
|
}
|
||||||
|
[AllowAnonymous]
|
||||||
[UnitOfWork]
|
[UnitOfWork]
|
||||||
public async Task<string> Get()
|
public async Task<string> Get()
|
||||||
{
|
{
|
||||||
|
|
||||||
//Expression<Func<VisitTask, bool>> visitTaskLambda = x => x.TrialId == Guid.Empty && x.SubjectId == Guid.Empty && x.TrialReadingCriterionId == Guid.Empty;
|
return "修改服务器时间自动发布测试--我又修改了";
|
||||||
|
|
||||||
//var visitTaskIdQueryable = _visitTaskRepositoryy.Where(visitTaskLambda).Where(t => t.Subject.SubjectVisitTaskList.AsQueryable().Where(visitTaskLambda).Any(c => c.IsNeedClinicalDataSign == true && c.IsClinicalDataSign == false && c.VisitTaskNum < t.VisitTaskNum)).Select(t => t.Id);
|
|
||||||
|
|
||||||
//await _visitTaskRepositoryy.BatchUpdateNoTrackingAsync(t => visitTaskIdQueryable.Contains(t.Id), u => new VisitTask()
|
|
||||||
//{
|
|
||||||
// IsFrontTaskNeedSignButNotSign = true
|
|
||||||
//});
|
|
||||||
|
|
||||||
|
|
||||||
//var a = ((Decimal)1.00).ToString().TrimEnd(new char[] { '.', '0' });
|
|
||||||
//var b = ((Decimal)1.01).ToString().TrimEnd(new char[] { '.', '0' });
|
|
||||||
//var c = ((Decimal)100).ToString().TrimEnd(new char[] { '.', '0' });
|
|
||||||
//var subject1 = Guid.Parse("431D0C58-ABC5-4166-B9BC-08DA0E391693");
|
|
||||||
//var subject2 = Guid.Parse("431D0C58-ABC5-4166-B9BC-08DA0E391694");
|
|
||||||
|
|
||||||
// var subjectList = new List<Guid>() { Guid.Parse("431D0C58-ABC5-4166-B9BC-08DA0E391693") ,
|
|
||||||
// Guid.Parse("431D0C58-ABC5-4166-B9BC-08DA0E391694") ,
|
|
||||||
// Guid.Parse("431D0C58-ABC5-4166-B9BC-08DA0E391695")
|
|
||||||
// };
|
|
||||||
|
|
||||||
//string[] citys = new string[] { "广州", "深圳", "上海", "北京" };
|
|
||||||
//foreach (var item in subjectList)
|
|
||||||
//{
|
|
||||||
// Console.WriteLine(await BNRFactory.Default.Create($"[CN:{item}][N:[CN:{item}]/0000000]"));
|
|
||||||
//}
|
|
||||||
//foreach (var item in subjectList)
|
|
||||||
//{
|
|
||||||
// Console.WriteLine(await BNRFactory.Default.Create($"[N:[CN:{item}]/0000000]"));
|
|
||||||
//}
|
|
||||||
|
|
||||||
//foreach (var item in subjectList)
|
|
||||||
//{
|
|
||||||
// Console.WriteLine(await BNRFactory.Default.Create($"[CN:{item}][redis:city/0000000]"));
|
|
||||||
//}
|
|
||||||
|
|
||||||
//var needAddVisitList = await _repository.Where<VisitTask>(t => t.TrialId == Guid.Empty).DistinctBy(t => t.VisitTaskNum).ToListAsync();
|
|
||||||
|
|
||||||
|
|
||||||
//await _repository.BatchUpdateAsync<VisitTask>(t => t.Id == Guid.Empty, u => new VisitTask()
|
|
||||||
//{
|
|
||||||
// SuggesteFinishedTime = u.IsUrgent ? DateTime.Now.AddDays(2) : DateTime.Now.AddDays(7),
|
|
||||||
|
|
||||||
// Code = u.Code + 1
|
|
||||||
//});
|
|
||||||
|
|
||||||
//var query = from item1 in _repository.Where<ReadingQuestionTrial>()
|
|
||||||
// join item2 in _repository.Where<ReadingQuestionTrial>() on item1.ValueType equals item2.ValueType
|
|
||||||
// select new
|
|
||||||
// {
|
|
||||||
// item1.ValueType,
|
|
||||||
// dd = item2.ValueType
|
|
||||||
// };
|
|
||||||
|
|
||||||
//var list2 = query.ToList();
|
|
||||||
|
|
||||||
//await Task.CompletedTask;
|
|
||||||
|
|
||||||
//var list = await _repository.Where<ClinicalDataTrialSet>(t => t.TrialId == Guid.Parse("40400000-3e2c-0016-239b-08da581f0e74")).ToListAsync();
|
|
||||||
|
|
||||||
////await _repository.BatchDeleteAsync<ClinicalDataTrialSet>(t => t.TrialId == Guid.Parse("40400000-3e2c-0016-239b-08da581f0e74"));
|
|
||||||
|
|
||||||
//await _repository.AddRangeAsync(list, true);
|
|
||||||
|
|
||||||
//await _repository.SaveChangesAsync();
|
|
||||||
|
|
||||||
//await _repository.BatchUpdateAsync<DataInspection>(t => t.TrialId == Guid.Parse("40400000-3e2c-0016-239b-08da581f0e74") && t.EntityName== "ClinicalDataTrialSet", t => new DataInspection() { CreateTime= DateTime.Now.AddMonths(-2) } );
|
|
||||||
|
|
||||||
//await _visitTaskRepositoryy.UpdatePartialFromQueryAsync( Guid.Parse("78360000-3E2C-0016-9B53-08DA6A002040"), c => new VisitTask() { UpdateTime = DateTime.Now });
|
|
||||||
|
|
||||||
//await _visitTaskRepositoryy.UpdatePartialFromQueryAsync( Guid.Parse("78360000-3E2C-0016-9B53-08DA6A002040"), c => new VisitTask() { UpdateTime = DateTime.Now.AddMinutes(1) });
|
|
||||||
|
|
||||||
//var a = _userInfo.IsTestUser;
|
|
||||||
|
|
||||||
//var list1 = await _repository.Where<Dictionary>().Select(t => t.TranslateValue(t.Value, t.ValueCN, true)).ToListAsync();
|
|
||||||
//var list2 = await _repository.Where<Dictionary>().Select(t => t.TranslateValue(t.Value, t.ValueCN, false)).ToListAsync();
|
|
||||||
|
|
||||||
await _repository.SaveChangesAsync();
|
|
||||||
return _userInfo.LocalIp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -171,9 +94,19 @@ namespace IRaCIS.Application.Services
|
||||||
|
|
||||||
|
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
public async Task testwwwww([FromServices] IWebHostEnvironment env)
|
public async Task<List<Guid>> testwwwww([FromServices] IWebHostEnvironment env)
|
||||||
{
|
{
|
||||||
await Task.CompletedTask;
|
int count = 200;
|
||||||
|
|
||||||
|
var list=new List<Guid>();
|
||||||
|
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
Guid guid = NewId.NextGuid();
|
||||||
|
list.Add(guid);
|
||||||
|
}
|
||||||
|
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -489,11 +489,11 @@ namespace IRaCIS.Core.Domain.Models
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// PI不认同
|
/// PI不认同
|
||||||
/// </summary>
|
/// </summary>
|
||||||
PIAgree = 1,
|
PINotAgree = 1,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// PI认同
|
/// PI认同
|
||||||
/// </summary>
|
/// </summary>
|
||||||
PINotAgree = 2
|
PIAgree = 2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
|
||||||
|
update TrialSiteUserSurvey set TrialRoleCode= (select Code from Dictionary where Id=TrialSiteUserSurvey.TrialRoleNameId)
|
|
@ -28,11 +28,11 @@ namespace IRaCIS.Core.Domain.Models
|
||||||
public Guid? UserTypeId { get; set; }
|
public Guid? UserTypeId { get; set; }
|
||||||
|
|
||||||
|
|
||||||
public Guid TrialRoleNameId { get; set; }
|
//public Guid TrialRoleNameId { get; set; }
|
||||||
|
|
||||||
public Dictionary TrialRoleName { get; set; }
|
|
||||||
|
|
||||||
|
//public Dictionary TrialRoleName { get; set; }
|
||||||
|
|
||||||
|
public int? TrialRoleCode { get; set; }
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -59,7 +59,6 @@ namespace IRaCIS.Core.Domain.Models
|
||||||
[Required]
|
[Required]
|
||||||
public Guid UpdateUserId { get; set; }
|
public Guid UpdateUserId { get; set; }
|
||||||
|
|
||||||
public string UserName { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Phone
|
/// Phone
|
||||||
|
@ -85,13 +84,6 @@ namespace IRaCIS.Core.Domain.Models
|
||||||
public Guid? SystemUserId { get; set; }
|
public Guid? SystemUserId { get; set; }
|
||||||
|
|
||||||
|
|
||||||
public DateTime? ExpireTime { get; set; }
|
|
||||||
|
|
||||||
public bool IsJoin { get; set; }
|
|
||||||
|
|
||||||
public DateTime? ConfirmTime { get; set; }
|
|
||||||
|
|
||||||
public string RejectReason { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// IsGenerateAccount
|
/// IsGenerateAccount
|
||||||
|
@ -104,6 +96,15 @@ namespace IRaCIS.Core.Domain.Models
|
||||||
|
|
||||||
public TrialSiteUserStateEnum InviteState { get; set; } = TrialSiteUserStateEnum.WaitSent;
|
public TrialSiteUserStateEnum InviteState { get; set; } = TrialSiteUserStateEnum.WaitSent;
|
||||||
|
|
||||||
|
public bool IsJoin { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
public bool IsHistoryUser { get; set; }
|
||||||
|
|
||||||
|
public bool? IsHistoryUserDeleted { get; set; }
|
||||||
|
|
||||||
|
public bool? IsHistoryUserOriginDeleted { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -92,7 +92,8 @@ namespace IRaCIS.Core.Domain.Models
|
||||||
|
|
||||||
public Guid SystemUserId { get; set; }
|
public Guid SystemUserId { get; set; }
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
|
public User SystemUser { get; set; }
|
||||||
|
|
||||||
public bool IsJoin { get; set; }
|
public bool IsJoin { get; set; }
|
||||||
|
|
||||||
|
|
|
@ -88,6 +88,8 @@ public static class StaticData
|
||||||
|
|
||||||
public static readonly string DataTemplate = "DataTemplate";
|
public static readonly string DataTemplate = "DataTemplate";
|
||||||
|
|
||||||
|
public static readonly string EmailHtmlTemplate = "EmailHtml";
|
||||||
|
|
||||||
public static readonly string NoticeAttachment = "NoticeAttachment";
|
public static readonly string NoticeAttachment = "NoticeAttachment";
|
||||||
|
|
||||||
public static readonly string DicomFolder = "Dicom";
|
public static readonly string DicomFolder = "Dicom";
|
||||||
|
@ -104,6 +106,8 @@ public static class StaticData
|
||||||
|
|
||||||
|
|
||||||
public static readonly string UploadEDCData = "UploadEDCData";
|
public static readonly string UploadEDCData = "UploadEDCData";
|
||||||
|
|
||||||
|
public static readonly string UploadSiteSurveyData = "SiteSurveyData";
|
||||||
public static readonly string UploadFileFolder = "UploadFile";
|
public static readonly string UploadFileFolder = "UploadFile";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,17 +23,10 @@ namespace IRaCIS.Core.Infrastructure.Extention
|
||||||
//程序异常 相当于之前的 IsSuccess = false
|
//程序异常 相当于之前的 IsSuccess = false
|
||||||
ProgramException = 4,
|
ProgramException = 4,
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//需要提示 ,需要提示 从Result 取数据 ( 0 可以继续处理提交 ,1 不能进行继续处理提交 ,2 刷新列表 )
|
//需要提示 ,需要提示 从Result 取数据 ( 0 可以继续处理提交 ,1 不能进行继续处理提交 ,2 刷新列表 )
|
||||||
NeedTips = 5,
|
NeedTips = 5,
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//在其他地方登陆,被迫下线
|
//在其他地方登陆,被迫下线
|
||||||
LoginInOtherPlace = -1,
|
LoginInOtherPlace = -1,
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,106 @@
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: irc-netcore-api
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: docker-build
|
||||||
|
image: docker
|
||||||
|
pull: if-not-exists
|
||||||
|
volumes:
|
||||||
|
- name: dockersock
|
||||||
|
path: /var/run/docker.sock
|
||||||
|
- name: cached_nuget_packages
|
||||||
|
path: /drone/nuget_packages
|
||||||
|
commands:
|
||||||
|
- date +%H:%M:%S
|
||||||
|
- pwd
|
||||||
|
- docker build -t Test.Study .
|
||||||
|
- date +%H:%M:%S
|
||||||
|
|
||||||
|
- name: docker-deploy
|
||||||
|
image: docker
|
||||||
|
pull: if-not-exists
|
||||||
|
depends_on:
|
||||||
|
- docker-build
|
||||||
|
volumes:
|
||||||
|
- name: dockersock
|
||||||
|
path: /var/run/docker.sock
|
||||||
|
commands:
|
||||||
|
- date +%H:%M:%S
|
||||||
|
- docker rm -f test-study-container
|
||||||
|
- docker run -itd -e TZ=Asia/Shanghai -e ASPNETCORE_ENVIRONMENT=Test_Study --restart=always --name test-study-container -p 8030:80 Test.Study
|
||||||
|
- date +%H:%M:%S
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
- name: cached_nuget_packages
|
||||||
|
host:
|
||||||
|
path: /mnt/f/docker_publish/nuget_packages
|
||||||
|
- name: dockersock
|
||||||
|
host:
|
||||||
|
path: /var/run/docker.sock
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
branch:
|
||||||
|
- master
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
kind: pipeline
|
||||||
|
type: ssh
|
||||||
|
name: ssh-windows-test-study-publish
|
||||||
|
|
||||||
|
platform:
|
||||||
|
os: windows
|
||||||
|
arch: amd64
|
||||||
|
|
||||||
|
clone:
|
||||||
|
disable: true #禁用默认克隆
|
||||||
|
|
||||||
|
server:
|
||||||
|
host: 123.56.94.154
|
||||||
|
user: Administrator
|
||||||
|
password: WHxckj2019
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: publish-test-study
|
||||||
|
commands:
|
||||||
|
#拉取代码 并停止服务
|
||||||
|
- Start-Process "C:\CICD\Test.Study\netcore_Publish.bat" -Wait
|
||||||
|
- cd C:\CICD\Test.Study\netcore_repo
|
||||||
|
- dotnet restore .\IRaCIS.Core.API\IRaCIS.Core.API.csproj --packages C:\Users\Administrator\.nuget\packages
|
||||||
|
- dotnet publish .\IRaCIS.Core.API\IRaCIS.Core.API.csproj -c Release --no-restore --packages C:\Users\Administrator\.nuget\packages -o D:\Develop\Test_Study_PublishSite\IRaCIS.NetCore.API
|
||||||
|
- Start-Service -Name "Test_Study_API"
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
branch:
|
||||||
|
- Test.Study
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
kind: pipeline
|
||||||
|
type: ssh
|
||||||
|
name: ssh-windows-test-irc-publish
|
||||||
|
|
||||||
|
platform:
|
||||||
|
os: windows
|
||||||
|
arch: amd64
|
||||||
|
|
||||||
|
clone:
|
||||||
|
disable: true #禁用默认克隆
|
||||||
|
|
||||||
|
server:
|
||||||
|
host: 123.56.94.154
|
||||||
|
user: Administrator
|
||||||
|
password: WHxckj2019
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: publish-test-irc
|
||||||
|
commands:
|
||||||
|
- Start-Process "C:\CICD\Test.IRC\netcore_Publish.bat" -Wait
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
branch:
|
||||||
|
- Test.IRC
|
Loading…
Reference in New Issue