修改邮件前 合并分支

Uat_Study
hang 2023-08-21 14:50:01 +08:00
commit 3084d73f85
43 changed files with 1500 additions and 1784 deletions

View File

@ -37,6 +37,7 @@ using Microsoft.Net.Http.Headers;
using MiniExcelLibs;
using Newtonsoft.Json;
using SharpCompress.Archives;
using SharpCompress.Common;
using System;
using System.Collections.Generic;
using System.Data;
@ -437,312 +438,314 @@ 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>
/// <param name="trialId"></param>
/// <param name="subjectId"></param>
/// <param name="readingId"></param>
/// <returns></returns>
[HttpPost("ClinicalData/UploadClinicalData/{trialId:guid}/{subjectId:guid}/{readingId:guid}")]
[DisableRequestSizeLimit]
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
public async Task<IResponseOutput<List<FileDto>>> UploadReadClinicalData(Guid trialId, Guid subjectId, Guid readingId)
{
var filerelativePath = string.Empty;
List<FileDto> fileDtos = new List<FileDto>();
var siteid = await _repository.Where<Subject>(x => x.Id == subjectId).Select(x => x.SiteId).FirstOrDefaultAsync();
await FileUploadAsync(async (fileName) =>
{
var (serverFilePath, relativePath, fileRealName) = FileStoreHelper.GetReadClinicalDataPath(_hostEnvironment, fileName, trialId, siteid, subjectId, readingId);
//插入临床pdf 路径
filerelativePath = relativePath;
fileDtos.Add(new FileDto()
{
FileName = fileName,
Path = relativePath
});
await Task.CompletedTask;
return serverFilePath;
});
return ResponseOutput.Ok(fileDtos);
}
/// <summary>
/// 上传截图
/// </summary>
/// <param name="subjectId"></param>
/// <returns></returns>
[HttpPost("Printscreen/UploadPrintscreen/{subjectId:guid}")]
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
public async Task<IResponseOutput<FileDto>> UploadPrintscreen(Guid subjectId)
{
var subjectInfo = await this._repository.Where<Subject>(x => x.Id == subjectId).FirstNotNullAsync();
FileDto fileDto = new FileDto();
await FileUploadAsync(async (fileName) =>
{
var (serverFilePath, relativePath, fileRealName) = FileStoreHelper.GetUploadPrintscreenFilePath(_hostEnvironment, fileName, subjectInfo.TrialId, subjectInfo.SiteId, subjectInfo.Id);
fileDto.Path = relativePath;
fileDto.FileName = fileName;
await Task.CompletedTask;
return serverFilePath;
});
return ResponseOutput.Ok(fileDto);
}
/// <summary>
/// 上传Reading问题的图像
/// </summary>
/// <param name="trialId"></param>
/// <param name="visitTaskId"></param>
/// <returns></returns>
[HttpPost("VisitTask/UploadReadingAnswerImage/{trialId:guid}/{visitTaskId:guid}")]
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
public async Task<IResponseOutput<FileDto>> UploadReadingAnswerImage(Guid trialId, Guid visitTaskId)
{
FileDto fileDto = new FileDto();
await FileUploadAsync(async (fileName) =>
{
var (serverFilePath, relativePath, fileRealName) = FileStoreHelper.GetFilePath(_hostEnvironment, fileName, trialId, visitTaskId, StaticData.Folder.JudgeTask);
fileDto.Path = relativePath;
fileDto.FileName = fileName;
await Task.CompletedTask;
return serverFilePath;
});
return ResponseOutput.Ok(fileDto);
}
/// <summary>
/// 上传裁判任务的图像
/// </summary>
/// <param name="trialId"></param>
/// <param name="visitTaskId"></param>
/// <returns></returns>
[HttpPost("VisitTask/UploadJudgeTaskImage/{trialId:guid}/{visitTaskId:guid}")]
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
public async Task<IResponseOutput<FileDto>> UploadJudgeTaskImage(Guid trialId, Guid visitTaskId)
{
FileDto fileDto = new FileDto();
await FileUploadAsync(async (fileName) =>
{
var (serverFilePath, relativePath, fileRealName) = FileStoreHelper.GetFilePath(_hostEnvironment, fileName, trialId, visitTaskId, StaticData.Folder.JudgeTask);
fileDto.Path = relativePath;
fileDto.FileName = fileName;
await Task.CompletedTask;
return serverFilePath;
});
return ResponseOutput.Ok(fileDto);
}
/// <summary>
/// 上传医学审核图片
/// </summary>
/// <param name="trialId"></param>
/// <param name="taskMedicalReviewId"></param>
/// <returns></returns>
[HttpPost("TaskMedicalReview/UploadMedicalReviewImage/{trialId:guid}/{taskMedicalReviewId:guid}")]
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
public async Task<IResponseOutput<FileDto>> UploadMedicalReviewImage(Guid trialId, Guid taskMedicalReviewId)
{
string path = string.Empty;
FileDto fileDto = new FileDto();
await FileUploadAsync(async (fileName) =>
{
var (serverFilePath, relativePath, fileRealName) = FileStoreHelper.GetMedicalReviewImage(_hostEnvironment, fileName, trialId, taskMedicalReviewId);
//await _repository.UpdatePartialFromQueryAsync<TaskMedicalReview>(x => x.Id == taskMedicalReviewId, x => new TaskMedicalReview()
//{
// 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>
///// <summary>
///// 上传临床数据 多文件
///// </summary>
///// <param name="subjectVisitId"></param>
///// <returns></returns>
//[HttpPost("ClinicalData/UploadVisitClinicalData/{trialId:guid}/{subjectVisitId:guid}")]
//[DisableRequestSizeLimit]
[HttpPost("NoneDicomStudy/UploadNoneDicomFile")]
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
//[Authorize(Policy = IRaCISPolicy.CRC)]
public async Task<IResponseOutput> UploadNoneDicomFile(UploadNoneDicomFileCommand incommand,
[FromServices] IRepository<NoneDicomStudy> _noneDicomStudyRepository, [FromServices] IRepository<StudyMonitor> _studyMonitorRepository)
{
////[Authorize(Policy = IRaCISPolicy.CRC)]
//[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
var subjectVisitId = incommand.SubjectVisitId;
var studyMonitorId=incommand.StudyMonitorId;
var noneDicomStudyId=incommand.NoneDicomStudyId;
//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" })]
await _qCCommon.VerifyIsCRCSubmmitAsync(_repository, _userInfo, subjectVisitId);
//public async Task<IResponseOutput<List<FileDto>>> UploadClinicalTemplate(Guid? trialId)
//{
// if (trialId == null)
// trialId = default(Guid);
var sv = (await _repository.Where<SubjectVisit>(t => t.Id == subjectVisitId).Select(t => new { t.TrialId, t.SiteId, t.SubjectId }).FirstOrDefaultAsync()).IfNullThrowConvertException();
// 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;
var studyMonitor = await _studyMonitorRepository.FirstOrDefaultAsync(t => t.Id == studyMonitorId);
// fileDtos.Add(new FileDto()
// {
// FileName = fileName,
// Path = relativePath
studyMonitor.UploadFinishedTime = DateTime.Now;
// });
// await Task.CompletedTask;
// return serverFilePath;
// });
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();
}
// return ResponseOutput.Ok(fileDtos);
//}
///// <summary>
///// 上传阅片临床数据
///// </summary>
///// <param name="trialId"></param>
///// <param name="subjectId"></param>
///// <param name="readingId"></param>
///// <returns></returns>
//[HttpPost("ClinicalData/UploadClinicalData/{trialId:guid}/{subjectId:guid}/{readingId:guid}")]
//[DisableRequestSizeLimit]
//[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
//public async Task<IResponseOutput<List<FileDto>>> UploadReadClinicalData(Guid trialId, Guid subjectId, Guid readingId)
//{
// var filerelativePath = string.Empty;
// List<FileDto> fileDtos = new List<FileDto>();
// var siteid = await _repository.Where<Subject>(x => x.Id == subjectId).Select(x => x.SiteId).FirstOrDefaultAsync();
// await FileUploadAsync(async (fileName) =>
// {
// var (serverFilePath, relativePath, fileRealName) = FileStoreHelper.GetReadClinicalDataPath(_hostEnvironment, fileName, trialId, siteid, subjectId, readingId);
// //插入临床pdf 路径
// filerelativePath = relativePath;
// fileDtos.Add(new FileDto()
// {
// FileName = fileName,
// Path = relativePath
// });
// await Task.CompletedTask;
// return serverFilePath;
// });
// return ResponseOutput.Ok(fileDtos);
//}
///// <summary>
///// 上传截图
///// </summary>
///// <param name="subjectId"></param>
///// <returns></returns>
//[HttpPost("Printscreen/UploadPrintscreen/{subjectId:guid}")]
//[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
//public async Task<IResponseOutput<FileDto>> UploadPrintscreen(Guid subjectId)
//{
// var subjectInfo = await this._repository.Where<Subject>(x => x.Id == subjectId).FirstNotNullAsync();
// FileDto fileDto = new FileDto();
// await FileUploadAsync(async (fileName) =>
// {
// var (serverFilePath, relativePath, fileRealName) = FileStoreHelper.GetUploadPrintscreenFilePath(_hostEnvironment, fileName, subjectInfo.TrialId, subjectInfo.SiteId, subjectInfo.Id);
// fileDto.Path = relativePath;
// fileDto.FileName = fileName;
// await Task.CompletedTask;
// return serverFilePath;
// });
// return ResponseOutput.Ok(fileDto);
//}
///// <summary>
///// 上传Reading问题的图像
///// </summary>
///// <param name="trialId"></param>
///// <param name="visitTaskId"></param>
///// <returns></returns>
//[HttpPost("VisitTask/UploadReadingAnswerImage/{trialId:guid}/{visitTaskId:guid}")]
//[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
//public async Task<IResponseOutput<FileDto>> UploadReadingAnswerImage(Guid trialId, Guid visitTaskId)
//{
// FileDto fileDto = new FileDto();
// await FileUploadAsync(async (fileName) =>
// {
// var (serverFilePath, relativePath, fileRealName) = FileStoreHelper.GetFilePath(_hostEnvironment, fileName, trialId, visitTaskId, StaticData.Folder.JudgeTask);
// fileDto.Path = relativePath;
// fileDto.FileName = fileName;
// await Task.CompletedTask;
// return serverFilePath;
// });
// return ResponseOutput.Ok(fileDto);
//}
///// <summary>
///// 上传裁判任务的图像
///// </summary>
///// <param name="trialId"></param>
///// <param name="visitTaskId"></param>
///// <returns></returns>
//[HttpPost("VisitTask/UploadJudgeTaskImage/{trialId:guid}/{visitTaskId:guid}")]
//[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
//public async Task<IResponseOutput<FileDto>> UploadJudgeTaskImage(Guid trialId, Guid visitTaskId)
//{
// FileDto fileDto = new FileDto();
// await FileUploadAsync(async (fileName) =>
// {
// var (serverFilePath, relativePath, fileRealName) = FileStoreHelper.GetFilePath(_hostEnvironment, fileName, trialId, visitTaskId, StaticData.Folder.JudgeTask);
// fileDto.Path = relativePath;
// fileDto.FileName = fileName;
// await Task.CompletedTask;
// return serverFilePath;
// });
// return ResponseOutput.Ok(fileDto);
//}
///// <summary>
///// 上传医学审核图片
///// </summary>
///// <param name="trialId"></param>
///// <param name="taskMedicalReviewId"></param>
///// <returns></returns>
//[HttpPost("TaskMedicalReview/UploadMedicalReviewImage/{trialId:guid}/{taskMedicalReviewId:guid}")]
//[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
//public async Task<IResponseOutput<FileDto>> UploadMedicalReviewImage(Guid trialId, Guid taskMedicalReviewId)
//{
// string path = string.Empty;
// FileDto fileDto = new FileDto();
// await FileUploadAsync(async (fileName) =>
// {
// var (serverFilePath, relativePath, fileRealName) = FileStoreHelper.GetMedicalReviewImage(_hostEnvironment, fileName, trialId, taskMedicalReviewId);
// //await _repository.UpdatePartialFromQueryAsync<TaskMedicalReview>(x => x.Id == taskMedicalReviewId, x => new TaskMedicalReview()
// //{
// // 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>
/// 一致性核查 excel上传 支持三种格式
@ -936,6 +939,7 @@ namespace IRaCIS.Core.API.Controllers
return ResponseOutput.Ok();
}
}
@ -1031,104 +1035,214 @@ namespace IRaCIS.Core.API.Controllers
_userInfo = userInfo;
}
/// <summary> 缩略图 </summary>
[AllowAnonymous]
[HttpGet("Common/LocalFilePreview")]
public async Task<FileContentResult> LocalFilePreview(string relativePath)
[HttpPost, Route("TrialSiteSurvey/UploadTrialSiteSurveyUser")]
[DisableFormValueModelBinding]
[UnitOfWork]
public async Task<IResponseOutput> UploadTrialSiteSurveyUser(Guid trialId, string baseUrl, string routeUrl,
[FromServices] IRepository<TrialSite> _trialSiteRepository,
[FromServices] IRepository<UserType> _usertypeRepository,
[FromServices] ITrialSiteSurveyService _trialSiteSurveyService)
{
var _fileStorePath = FileStoreHelper.GetPhysicalFilePath(_hostEnvironment, relativePath);
var storePreviewPath = _fileStorePath + ".preview.jpeg";
if (!System.IO.File.Exists(storePreviewPath))
var (serverFilePath, relativePath, fileName) = (string.Empty, string.Empty, string.Empty);
await FileUploadAsync(async (realFileName) =>
{
ImageHelper.ResizeSave(_fileStorePath, storePreviewPath);
fileName = realFileName;
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中 每一行的 中心编号,姓名,邮箱,用户类型数据记录完整再进行上传");
}
return new FileContentResult(await System.IO.File.ReadAllBytesAsync(storePreviewPath), "image/jpeg");
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;
}
item.SiteId = siteList.FirstOrDefault(t => t.TrialSiteCode.ToUpper() == item.TrialSiteCode.ToUpper()).SiteId;
}
await _trialSiteSurveyService.ImportGenerateAccountAndJoinTrialAsync(trialId, baseUrl, routeUrl, excelList.ToList());
return ResponseOutput.Ok();
}
/// <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);
#region 废弃
new FileExtensionContentTypeProvider().Mappings.TryGetValue(Path.GetExtension(filePath), out var contentType);
///// <summary> 缩略图 </summary>
//[AllowAnonymous]
//[HttpGet("Common/LocalFilePreview")]
//public async Task<FileContentResult> LocalFilePreview(string relativePath)
//{
return File(System.IO.File.OpenRead(filePath), contentType ?? "application/octet-stream", fileName);
// var _fileStorePath = FileStoreHelper.GetPhysicalFilePath(_hostEnvironment, relativePath);
}
// var storePreviewPath = _fileStorePath + ".preview.jpeg";
/// <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);
// if (!System.IO.File.Exists(storePreviewPath))
// {
// ImageHelper.ResizeSave(_fileStorePath, storePreviewPath);
// }
new FileExtensionContentTypeProvider().Mappings.TryGetValue(Path.GetExtension(filePath), out var contentType);
// return new FileContentResult(await System.IO.File.ReadAllBytesAsync(storePreviewPath), "image/jpeg");
return File(System.IO.File.OpenRead(filePath), contentType ?? "application/octet-stream", fileName);
}
//}
/// <summary>
/// 下载系统临床数据文件
/// </summary>
/// <param name="clinicalDataSystemSetId"></param>
/// <param name="_clinicalDataSystemSetRepository"></param>
/// <returns></returns>
[AllowAnonymous]
[HttpGet("CommonDocument/DownloadSystemClinicalFile")]
public async Task<IActionResult> DownloadSystemClinicalFile(Guid clinicalDataSystemSetId, [FromServices] IRepository<ClinicalDataSystemSet> _clinicalDataSystemSetRepository)
{
var (filePath, fileName) = await FileStoreHelper.GetSystemClinicalPathAsync(_hostEnvironment, _clinicalDataSystemSetRepository, clinicalDataSystemSetId);
///// <summary> 通用文件下载 </summary>
//[AllowAnonymous]
//[HttpGet("CommonDocument/DownloadCommonDoc")]
//public async Task<IActionResult> DownloadCommonFile(string code, [FromServices] IRepository<CommonDocument> _commonDocumentRepository)
//{
// var (filePath, fileName) = await FileStoreHelper.GetCommonDocPhysicalFilePathAsync(_hostEnvironment, _commonDocumentRepository, code);
new FileExtensionContentTypeProvider().Mappings.TryGetValue(Path.GetExtension(filePath), out var contentType);
// new FileExtensionContentTypeProvider().Mappings.TryGetValue(Path.GetExtension(filePath), out var contentType);
return File(System.IO.File.OpenRead(filePath), contentType ?? "application/octet-stream", fileName);
// return File(System.IO.File.OpenRead(filePath), contentType ?? "application/octet-stream", fileName);
}
//}
/// <summary>
///上传项目签名文档
/// </summary>
/// <param name="trialId"></param>
/// <returns></returns>
[HttpPost("TrialDocument/UploadTrialDoc/{trialId:guid}")]
[DisableRequestSizeLimit]
[DisableFormValueModelBinding]
public async Task<IResponseOutput> UploadTrialDoc(Guid trialId)
{
///// <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);
return await SingleFileUploadAsync((fileName) => FileStoreHelper.GetTrialSignDocPath(_hostEnvironment, trialId, fileName));
// new FileExtensionContentTypeProvider().Mappings.TryGetValue(Path.GetExtension(filePath), out var contentType);
}
// return File(System.IO.File.OpenRead(filePath), contentType ?? "application/octet-stream", 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>
///// <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>
@ -1140,25 +1254,63 @@ namespace IRaCIS.Core.API.Controllers
[DisableFormValueModelBinding]
public async Task<IResponseOutput> UploadCommonDoc()
{
return await SingleFileUploadAsync((fileName) => FileStoreHelper.GetCommonDocPath(_hostEnvironment, fileName));
}
public enum UploadFileType
{
DataUpload=1,
DataDownload=2,
EmailAttachment=3,
EmailBodyHtml=4,
}
/// <summary>
/// 上传系统通知文档
/// 数据上传、导出、 邮件附件 、邮件Html 通过 ----new
/// </summary>
/// <returns></returns>
[HttpPost("SystemNotice/UploadSystemNoticeDoc")]
[HttpPost("SystemFile/Upload")]
[DisableRequestSizeLimit]
[DisableFormValueModelBinding]
public async Task<IResponseOutput> UploadSystemNoticeDoc()
public async Task<IResponseOutput> Upload(UploadFileType fileType)
{
IResponseOutput result = null;
return await SingleFileUploadAsync((fileName) => FileStoreHelper.GetSystemNoticePath(_hostEnvironment, fileName));
switch (fileType)
{
case UploadFileType.DataUpload:
result= await SingleFileUploadAsync((fileName) => FileStoreHelper.GetSystemFileUploadPath(_hostEnvironment, StaticData.Folder.DataTemplate,fileName));
break;
case UploadFileType.DataDownload:
result= await SingleFileUploadAsync((fileName) => FileStoreHelper.GetSystemFileUploadPath(_hostEnvironment, StaticData.Folder.DataTemplate,fileName));
break;
case UploadFileType.EmailAttachment:
result = await SingleFileUploadAsync((fileName) => FileStoreHelper.GetSystemFileUploadPath(_hostEnvironment, StaticData.Folder.DataTemplate, fileName));
break;
case UploadFileType.EmailBodyHtml:
result = await SingleFileUploadAsync((fileName) => FileStoreHelper.GetSystemFileUploadPath(_hostEnvironment, StaticData.Folder.EmailHtmlTemplate, fileName));
break;
default:
break;
}
return result;
}
}
#endregion

View File

@ -72,6 +72,9 @@
<PackageReference Include="EasyCaching.InMemory" Version="1.7.0" />
<PackageReference Include="EasyCaching.Interceptor.Castle" Version="1.7.0" />
<PackageReference Include="EntityFrameworkCore.Triggered.Extensions" Version="3.2.1" />
<PackageReference Include="Hangfire.AspNetCore" Version="1.8.5" />
<PackageReference Include="Hangfire.Dashboard.BasicAuthorization" Version="1.0.2" />
<PackageReference Include="Hangfire.SqlServer" Version="1.8.5" />
<PackageReference Include="Invio.Extensions.Authentication.JwtBearer" Version="2.0.1" />
<PackageReference Include="LogDashboard" Version="1.4.8" />
<PackageReference Include="MediatR.Extensions.Microsoft.DependencyInjection" Version="11.0.0" />

View File

@ -212,67 +212,6 @@
<member name="M:IRaCIS.Core.API.Controllers.StudyController.ArchiveStudyNew(System.Guid,System.Guid,System.String,System.Nullable{System.Guid},System.Guid,Microsoft.Extensions.Logging.ILogger{IRaCIS.Core.API.Controllers.UploadDownLoadController},EasyCaching.Core.IEasyCachingProvider,IRaCIS.Core.Application.Contracts.IStudyService,Microsoft.AspNetCore.SignalR.IHubContext{IRaCIS.Core.API.UploadHub,IRaCIS.Core.API.IUploadClient},IRaCIS.Core.Application.Contracts.Dicom.IDicomArchiveService,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.StudyMonitor})">
<summary>Dicom 归档</summary>
</member>
<member name="M:IRaCIS.Core.API.Controllers.StudyController.UploadVisitClinicalData(System.Guid)">
<summary>
上传临床数据 多文件
</summary>
<param name="subjectVisitId"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.API.Controllers.StudyController.UploadClinicalTemplate(System.Nullable{System.Guid})">
<summary>
上传临床数据模板
</summary>
<param name="trialId"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.API.Controllers.StudyController.UploadReadClinicalData(System.Guid,System.Guid,System.Guid)">
<summary>
上传阅片临床数据
</summary>
<param name="trialId"></param>
<param name="subjectId"></param>
<param name="readingId"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.API.Controllers.StudyController.UploadPrintscreen(System.Guid)">
<summary>
上传截图
</summary>
<param name="subjectId"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.API.Controllers.StudyController.UploadReadingAnswerImage(System.Guid,System.Guid)">
<summary>
上传Reading问题的图像
</summary>
<param name="trialId"></param>
<param name="visitTaskId"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.API.Controllers.StudyController.UploadJudgeTaskImage(System.Guid,System.Guid)">
<summary>
上传裁判任务的图像
</summary>
<param name="trialId"></param>
<param name="visitTaskId"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.API.Controllers.StudyController.UploadMedicalReviewImage(System.Guid,System.Guid)">
<summary>
上传医学审核图片
</summary>
<param name="trialId"></param>
<param name="taskMedicalReviewId"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.API.Controllers.StudyController.UploadNoneDicomFile(IRaCIS.Core.API.Controllers.StudyController.UploadNoneDicomFileCommand,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.NoneDicomStudy},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.StudyMonitor})">
<summary>
上传非Dicom 文件 支持压缩包 多文件上传
</summary>
<param name="_noneDicomStudyRepository"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.API.Controllers.StudyController.UploadVisitCheckExcel(System.Guid)">
<summary>
一致性核查 excel上传 支持三种格式
@ -299,50 +238,15 @@
<param name="type">文件类型</param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.API.Controllers.UploadDownLoadController.LocalFilePreview(System.String)">
<summary> 缩略图 </summary>
</member>
<member name="M:IRaCIS.Core.API.Controllers.UploadDownLoadController.DownloadCommonFile(System.String,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.CommonDocument})">
<summary> 通用文件下载 </summary>
</member>
<member name="M:IRaCIS.Core.API.Controllers.UploadDownLoadController.DownloadTrialClinicalFile(System.Guid,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ClinicalDataTrialSet})">
<summary>
下载项目临床数据文件
</summary>
<param name="clinicalDataTrialSetId"></param>
<param name="_clinicalDataTrialSetRepository"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.API.Controllers.UploadDownLoadController.DownloadSystemClinicalFile(System.Guid,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.ClinicalDataSystemSet})">
<summary>
下载系统临床数据文件
</summary>
<param name="clinicalDataSystemSetId"></param>
<param name="_clinicalDataSystemSetRepository"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.API.Controllers.UploadDownLoadController.UploadTrialDoc(System.Guid)">
<summary>
上传项目签名文档
</summary>
<param name="trialId"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.API.Controllers.UploadDownLoadController.UploadSysTemDoc">
<summary>
上传系统签名文档
</summary>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.API.Controllers.UploadDownLoadController.UploadCommonDoc">
<summary>
上传通用文档 比如一致性核查的 比如导出的excel 模板
</summary>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.API.Controllers.UploadDownLoadController.UploadSystemNoticeDoc">
<member name="M:IRaCIS.Core.API.Controllers.UploadDownLoadController.Upload(IRaCIS.Core.API.Controllers.UploadDownLoadController.UploadFileType)">
<summary>
上传系统通知文档
数据上传、导出、 邮件附件 、邮件Html 通过 ----new
</summary>
<returns></returns>
</member>

View File

@ -30,31 +30,15 @@
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}",
"publishAllPorts": true
},
"IRaCIS.Staging": {
"Uat_Study": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Staging"
"ASPNETCORE_ENVIRONMENT": "Uat_Study"
},
"applicationUrl": "http://localhost:6200"
"applicationUrl": "http://localhost:6100"
},
"IRaCIS.Production": {
"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": {
"Test_Study": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {

View File

@ -114,7 +114,8 @@ namespace IRaCIS.Core.API
//services.AddDistributedMemoryCache();
// hangfire 定时任务框架 有界面,更友好~
//services.AddhangfireSetup(_configuration);
services.AddhangfireSetup(_configuration);
// QuartZ 定时任务框架 使用了hangfire 暂时不用,后续需要可以打开,已经配好
services.AddQuartZSetup(_configuration);
@ -181,7 +182,7 @@ namespace IRaCIS.Core.API
app.UseLogDashboard("/LogDashboard");
//hangfire
//app.UseHangfireConfig(env);
app.UseHangfireConfig(env);
////暂时废弃
//app.UseHttpReports();

View File

@ -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; }
}
}
}

View File

@ -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;
}
}
}

View File

@ -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
}
}
}

View File

@ -19,6 +19,8 @@ namespace IRaCIS.Core.API
//opt.AddAuthorizationFilter(new LogDashBoardAuthFilter());
});
}

View File

@ -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();
}
}
}

View File

@ -7,7 +7,8 @@
}
},
"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": {
@ -28,9 +29,9 @@
"SystemEmailSendConfig": {
"Port": 465,
"Host": "smtp.qiye.aliyun.com",
"FromEmail": "test@extimaging.com",
"FromName": "Test_IRC",
"AuthorizationCode": "SHzyyl2021"
"FromEmail": "test-study@extimaging.com",
"FromName": "Test_Study",
"AuthorizationCode": "zhanying123"
}
}

View File

@ -7,7 +7,8 @@
}
},
"ConnectionStrings": {
"RemoteNew": "Server=123.56.94.154,1433\\MSSQLSERVER;Database=Uat.Study;User ID=sa;Password=dev123456DEV;TrustServerCertificate=true"
"RemoteNew": "Server=123.56.94.154,1433\\MSSQLSERVER;Database=Uat.Study;User ID=sa;Password=dev123456DEV;TrustServerCertificate=true",
"Hangfire": "Server=123.56.94.154,1433\\MSSQLSERVER;Database=Uat.Study.hangfire;User ID=sa;Password=dev123456DEV;TrustServerCertificate=true"
},
"BasicSystemConfig": {
@ -28,9 +29,9 @@
"SystemEmailSendConfig": {
"Port": 465,
"Host": "smtp.qiye.aliyun.com",
"FromEmail": "test@extimaging.com",
"FromName": "Test_IRC",
"AuthorizationCode": "SHzyyl2021"
"FromEmail": "uat-study@extimaging.com",
"FromName": "Uat_Study",
"AuthorizationCode": "zhanying123"
}
}

View File

@ -227,6 +227,28 @@ public static class FileStoreHelper
return (serverFilePath, relativePath);
}
public static (string PhysicalPath, string RelativePath) GetSystemFileUploadPath(IWebHostEnvironment _hostEnvironment, string templateFolderName, string fileName)
{
var rootPath = FileStoreHelper.GetIRaCISRootDataFolder(_hostEnvironment);
//文件类型路径处理
var uploadFolderPath = Path.Combine(rootPath, StaticData.Folder.SystemDataFolder, templateFolderName);
if (!Directory.Exists(uploadFolderPath)) Directory.CreateDirectory(uploadFolderPath);
var (trustedFileNameForFileStorage, fileRealName) = FileStoreHelper.GetStoreFileName(fileName);
var relativePath = $"/{StaticData.Folder.IRaCISDataFolder}/{StaticData.Folder.SystemDataFolder}/{templateFolderName}/{trustedFileNameForFileStorage}";
var serverFilePath = Path.Combine(uploadFolderPath, trustedFileNameForFileStorage);
return (serverFilePath, relativePath);
}
// 获取通用文档存放路径excel模板
public static (string PhysicalPath, string RelativePath) GetCommonDocPath(IWebHostEnvironment _hostEnvironment, string fileName)
@ -292,6 +314,28 @@ public static class FileStoreHelper
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)
{

View File

@ -7741,42 +7741,6 @@
<param name="addOrEditTrialExternalUser"></param>
<returns></returns>
</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">
<summary> TaskAllocationRuleView 列表视图模型 </summary>
</member>
@ -9460,11 +9424,11 @@
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Contracts.TrialSiteSurveyService.SendVerifyCode(IRaCIS.Core.Application.Contracts.SiteSurveySendVerifyCode)">
<summary>
发送验证码
</summary>
<param name="userInfo"></param>
<returns></returns>
<summary>
site 调研 发送验证码
</summary>
<param name="userInfo"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Contracts.TrialSiteSurveyService.VerifySendCode(IRaCIS.Core.Application.Contracts.LoginDto,IRaCIS.Core.Application.Auth.ITokenService)">
<summary>
@ -9520,14 +9484,6 @@
</summary>
<returns></returns>
</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)">
<summary>
提交 后台自动识别是谁提交

View File

@ -55,7 +55,7 @@ namespace IRaCIS.Core.Application.Service
public VisitTaskHelpeService(IRepository<VisitTask> visitTaskRepository, IRepository<Trial> trialRepository, IEasyCachingProvider provider,
IRepository<SubjectVisit> subjectVisitRepository,
IRepository<ReadModule> readModuleRepository,
IRepository<ReadingTaskQuestionAnswer> readingTaskQuestionAnswerRepository,
IRepository<ReadingTaskQuestionAnswer> readingTaskQuestionAnswerRepository,
IRepository<ReadingTableAnswerRowInfo> readingTableAnswerRowInfoRepository,
IRepository<ReadingTableQuestionAnswer> readingTableQuestionAnswerRepository,
IRepository<ReadingTableQuestionTrial> readingTableQuestionTrialRepository,

View File

@ -255,6 +255,8 @@ namespace IRaCIS.Core.Application.Service.Allocation
visitTask.LatestReplyUserId = _userInfo.Id;
visitTask.LatestReplyTime = DateTime.Now;
visitTask.IsEnrollment = incommand.PIAuditState == PIAuditState.PINotAgree ? null : visitTask.IsEnrollment;
visitTask.IsPDConfirm = incommand.PIAuditState == PIAuditState.PINotAgree ? null : visitTask.IsPDConfirm;
if (isFirstAudit)
{

View File

@ -155,9 +155,7 @@ namespace IRaCIS.Core.Application.Service.Common
.Where(t => groupSelectIdQuery.Contains(t.TrialSiteSurveyId))
.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.UserName), t => (t.LastName + " / " + t.FirstName).Contains(queryParam.UserName))
.WhereIf(!string.IsNullOrEmpty(queryParam.OrganizationName), t => t.OrganizationName.Contains(queryParam.OrganizationName))
.ProjectTo<TrialSiteUserSummaryDto>(_mapper.ConfigurationProvider);

View File

@ -7,6 +7,7 @@
using Microsoft.AspNetCore.Mvc;
using IRaCIS.Core.Application.Contracts;
using User = IRaCIS.Core.Domain.Models.User;
using DocumentFormat.OpenXml.Office2010.Word;
namespace IRaCIS.Core.Application.Services
{
@ -19,14 +20,16 @@ namespace IRaCIS.Core.Application.Services
private readonly IRepository<SystemDocument> _systemDocumentRepository;
private readonly IRepository<SystemDocNeedConfirmedUserType> _systemDocNeedConfirmedUserTypeRepository;
private readonly IRepository<SystemDocConfirmedUser> _systemDocConfirmedUserRepository;
public SystemDocumentService( IRepository<SystemDocument> systemDocumentRepository,
IRepository<SystemDocNeedConfirmedUserType> systemDocNeedConfirmedUserTypeRepository
)
IRepository<SystemDocNeedConfirmedUserType> systemDocNeedConfirmedUserTypeRepository,
IRepository<SystemDocConfirmedUser> systemDocConfirmedUserRepository)
{
_systemDocumentRepository = systemDocumentRepository;
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}")]
public async Task<IResponseOutput> DeleteSystemDocumentAsync(Guid systemDocumentId)

View File

@ -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))
.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

View File

@ -113,7 +113,15 @@ namespace IRaCIS.Core.Application.Contracts
if (userTypeSelectEnum == UserTypeSelectEnum.ExternalUser)
{
userTypeEnums = new List<UserTypeEnum>() { UserTypeEnum.PI, UserTypeEnum.MIM };
if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.TA)
{
userTypeEnums = new List<UserTypeEnum>() { UserTypeEnum.ProjectManager };
}
else
{
userTypeEnums = new List<UserTypeEnum>() { UserTypeEnum.PI, UserTypeEnum.MIM };
}
}
if (userTypeSelectEnum == UserTypeSelectEnum.SiteSurvey)

View File

@ -84,7 +84,6 @@ namespace IRaCIS.Core.Application.Contracts
public bool? IsGenerateAccount { get; set; }
public Guid? TrialRoleNameId { 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>

View File

@ -5,7 +5,9 @@
//--------------------------------------------------------------------
using IRaCIS.Core.Application.Helper;
using IRaCIS.Core.Domain.Share;
using MiniExcelLibs.Attributes;
using Newtonsoft.Json;
using System.ComponentModel.DataAnnotations;
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 Guid? SystemUserId { get; set; }
public bool? IsHistoryUserOriginDeleted { get; set; }
}
@ -98,11 +104,20 @@ namespace IRaCIS.Core.Application.Contracts
[DictionaryTranslateAttribute("YesOrNo")]
public bool IsGenerateAccount { get; set; }
public Guid TrialRoleNameId { get; set; }
public int TrialRoleCode { get; set; }
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
{
@ -111,6 +126,44 @@ namespace IRaCIS.Core.Application.Contracts
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; }
}
}

View File

@ -20,5 +20,7 @@ namespace IRaCIS.Core.Application.Contracts
//Task<IResponseOutput> TrialSurveyLock(Guid trialSiteSurveyId, bool isLock);
//IResponseOutput TrialSurveySubmmit(Guid trialId, Guid trialSiteSurveyId);
Task<IResponseOutput> VerifySendCode(LoginDto userInfo, [FromServices] ITokenService _tokenService);
Task ImportGenerateAccountAndJoinTrialAsync(Guid trialId, string baseUrl,string rootUrl, List<SiteSurveyUserImportDto> list);
}
}

View File

@ -10,6 +10,6 @@ namespace IRaCIS.Core.Application.Contracts
{
Task<IResponseOutput> AddOrUpdateTrialSiteUserSurvey(TrialSiteUserSurveyAddOrEdit addOrEditTrialSiteUserSurvey);
Task<IResponseOutput> DeleteTrialSiteUserSurvey(Guid trialSiteUserSurveyId);
Task<List<TrialSiteUserSurveyView>> GetTrialSiteUserSurveyList(Guid trialSiteSurveyId);
Task<List<TrialSiteUserSurveyView>> GetTrialSiteUserSurveyList(TrialSiteUserSurverQuery inquery);
}
}

View File

@ -17,10 +17,12 @@ namespace IRaCIS.Core.Application.Contracts
public class TrialSiteEquipmentSurveyService : BaseService, ITrialSiteEquipmentSurveyService
{
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;
_trialSiteSurveyRepository = trialSiteSurveyRepository;
}
@ -38,17 +40,14 @@ namespace IRaCIS.Core.Application.Contracts
[HttpPost("{trialId:guid}")]
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(_localizer["TrialSiteEquipment_Locked"]);
}
return ResponseOutput.NotOk("当前调研表已废除,或者调研表状态已锁定,不允许操作");
}
var entity = await _trialSiteEquipmentSurveyRepository.InsertOrUpdateAsync(addOrEditTrialSiteEquipmentSurvey, true);
return ResponseOutput.Ok(entity.Id.ToString());

View File

@ -7,6 +7,7 @@ using Microsoft.AspNetCore.Mvc;
using IRaCIS.Core.Domain.Share;
using IRaCIS.Core.Application.Filter;
using IRaCIS.Core.Infrastructure;
using IRaCIS.Application.Contracts;
namespace IRaCIS.Core.Application.Contracts
{
@ -17,57 +18,43 @@ namespace IRaCIS.Core.Application.Contracts
public class TrialSiteUserSurveyService : BaseService, ITrialSiteUserSurveyService
{
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;
_trialSiteSurveyRepository = trialSiteSurveyRepository;
}
[HttpGet("{trialSiteSurveyId:guid}")]
public async Task<List<TrialSiteUserSurveyView>> GetTrialSiteUserSurveyList(Guid trialSiteSurveyId)
[HttpPost]
public async Task<List<TrialSiteUserSurveyView>> GetTrialSiteUserSurveyList(TrialSiteUserSurverQuery inquery)
{
var trialSiteUserSurveyQueryable = _trialSiteUserSurveyRepository.Where(t => t.TrialSiteSurveyId == trialSiteSurveyId)
//.WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.SPM, t => t.TrialSiteSurvey.State >= TrialSiteSurveyEnum.CRCSubmitted)
//.WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.APM|| _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CPM, t => t.TrialSiteSurvey.State >= TrialSiteSurveyEnum.SPMApproved)
var trialSiteUserSurveyQueryable = _trialSiteUserSurveyRepository.Where(t => t.TrialSiteSurveyId == inquery.TrialSiteSurveyId)
.WhereIf(inquery.IsHistoryUser !=null, t => t.IsHistoryUser==inquery.IsHistoryUser)
.ProjectTo<TrialSiteUserSurveyView>(_mapper.ConfigurationProvider, new { isEn_Us = _userInfo.IsEn_Us });
return await trialSiteUserSurveyQueryable.ToListAsync();
}
[TypeFilter(typeof(TrialResourceFilter),Arguments = new object[] { "AfterStopCannNotOpt" })]
[TypeFilter(typeof(TrialResourceFilter),Arguments = new object[] { "AfterStopCannNotOpt" })]
[HttpPost("{trialId:guid}")]
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 )
{
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();
@ -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());

View File

@ -21,6 +21,23 @@ namespace IRaCIS.Core.Application.AutoMapper
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>()
@ -33,11 +50,10 @@ namespace IRaCIS.Core.Application.AutoMapper
.ForMember(d => d.SiteName, u => u.MapFrom(s => s.Site.SiteName))
.ForMember(d => d.TrialSiteCode, u => u.MapFrom(s => s.TrialSite.TrialSiteCode));
CreateMap<TrialSiteSurvey, TrialSiteSurveySelectView>();
var isEn_Us = false;
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.UserTypeEnum, u => u.MapFrom(s => s.UserTypeRole.UserTypeEnum));
@ -61,6 +77,10 @@ namespace IRaCIS.Core.Application.AutoMapper
CreateMap<TrialSiteUserSurvey, User>();
CreateMap<SiteSurveyUserImportDto, User>()
.ForMember(d => d.EMail, u => u.MapFrom(s => s.Email));
CreateMap<TrialSiteUserSurveyView, User>();
@ -70,7 +90,6 @@ namespace IRaCIS.Core.Application.AutoMapper
CreateMap<TrialSiteUserSurvey, TrialSiteUserSurveyAllDTO>()
.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.UserTypeEnum, u => u.MapFrom(s => s.UserTypeRole.UserTypeEnum));

View File

@ -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
{
/// <summary>

View File

@ -50,7 +50,7 @@ namespace IRaCIS.Core.Application.ViewModel
public UserTypeEnum? UserTypeEnum { get; set; }
public DateTime? ExpireTime { get; set; }

View File

@ -21,7 +21,6 @@ namespace IRaCIS.Core.Application.Interfaces
Task<IResponseOutput> DeleteTrialExternalUser(Guid trialExternalUserId, bool isSystemUser,
Guid systemUserId);
Task<IResponseOutput> UserConfirmJoinTrial(Guid trialId, Guid trialExternalUserId);
}
}

View File

@ -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
}
}

View File

@ -280,52 +280,9 @@ namespace IRaCIS.Application.Services
public async Task<IResponseOutput> DeleteTrial(Guid trialId)
{
var trial = (await _trialRepository.FirstOrDefaultAsync(u => u.Id == trialId, true)).IfNullThrowException();
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<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<PreviousOther>(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<VisitTask>(t => t.TrialId == trialId);
await _repository.BatchDeleteAsync<TrialAttachment>(t => t.TrialId == trialId);
await _repository.BatchDeleteAsync<TrialStateChange>(t => t.TrialId == trialId) ;
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();
}

View File

@ -22,8 +22,8 @@ namespace IRaCIS.Core.Application.Service
CreateMap<Trial, TrialProcessConfigDTO>();
CreateMap<Trial, TrialConfigTabDto>();
CreateMap<ReadingQuestionCriterionTrial, TrialTaskConfigView > ()
.ForMember(d => d.QCProcessEnum, u => u.MapFrom(s => s.Trial.QCProcessEnum))
.ForMember(d => d.IsImageConsistencyVerification, u => u.MapFrom(s => s.Trial.IsImageConsistencyVerification))
@ -206,7 +206,8 @@ namespace IRaCIS.Core.Application.Service
CreateMap<TrialExternalUser, TrialExternalUserAddOrEdit>().ReverseMap();
CreateMap<TrialExternalUserAddOrEdit, User>();
CreateMap<TrialExternalUser, TrialExternalUserView>();
CreateMap<TrialExternalUser, TrialExternalUserView>()
.ForMember(t=>t.UserTypeEnum,u=>u.MapFrom(c=>c.SystemUser.UserTypeEnum));
CreateMap<User, TrialExternalUser>().ReverseMap();
@ -285,7 +286,6 @@ namespace IRaCIS.Core.Application.Service
.ForMember(t => t.TrialSiteUserList, u => u.Ignore());
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.UserTypeEnum, u => u.MapFrom(s => s.UserTypeRole.UserTypeEnum))
.ForMember(t => t.TrialSiteCode, u => u.MapFrom(d => d.TrialSiteSurvey.TrialSite.TrialSiteCode))

View File

@ -2,6 +2,7 @@
using IRaCIS.Core.Application.ViewModel;
using IRaCIS.Core.Domain.Share;
using IRaCIS.Core.Infrastructure;
using MassTransit;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
@ -64,90 +65,12 @@ namespace IRaCIS.Application.Services
return ResponseOutput.Ok();
}
[AllowAnonymous]
[UnitOfWork]
public async Task<string> Get()
{
//Expression<Func<VisitTask, bool>> visitTaskLambda = x => x.TrialId == Guid.Empty && x.SubjectId == Guid.Empty && x.TrialReadingCriterionId == Guid.Empty;
//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;
return "修改服务器时间自动发布测试--我又修改了";
}
@ -171,9 +94,19 @@ namespace IRaCIS.Application.Services
[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;
}

View File

@ -489,11 +489,11 @@ namespace IRaCIS.Core.Domain.Models
/// <summary>
/// PI不认同
/// </summary>
PIAgree = 1,
PINotAgree = 1,
/// <summary>
/// PI认同
/// </summary>
PINotAgree = 2
PIAgree = 2
}
}

View File

@ -0,0 +1,2 @@

update TrialSiteUserSurvey set TrialRoleCode= (select Code from Dictionary where Id=TrialSiteUserSurvey.TrialRoleNameId)

View File

@ -28,11 +28,11 @@ namespace IRaCIS.Core.Domain.Models
public Guid? UserTypeId { get; set; }
public Guid TrialRoleNameId { get; set; }
public Dictionary TrialRoleName { get; set; }
//public Guid TrialRoleNameId { get; set; }
//public Dictionary TrialRoleName { get; set; }
public int? TrialRoleCode { get; set; }
/// <summary>
@ -59,7 +59,6 @@ namespace IRaCIS.Core.Domain.Models
[Required]
public Guid UpdateUserId { get; set; }
public string UserName { get; set; } = string.Empty;
/// <summary>
/// Phone
@ -85,13 +84,6 @@ namespace IRaCIS.Core.Domain.Models
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>
/// IsGenerateAccount
@ -104,7 +96,16 @@ namespace IRaCIS.Core.Domain.Models
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; }
}

View File

@ -92,7 +92,8 @@ namespace IRaCIS.Core.Domain.Models
public Guid SystemUserId { get; set; }
[JsonIgnore]
public User SystemUser { get; set; }
public bool IsJoin { get; set; }

View File

@ -88,6 +88,8 @@ public static class StaticData
public static readonly string DataTemplate = "DataTemplate";
public static readonly string EmailHtmlTemplate = "EmailHtml";
public static readonly string NoticeAttachment = "NoticeAttachment";
public static readonly string DicomFolder = "Dicom";
@ -104,6 +106,8 @@ public static class StaticData
public static readonly string UploadEDCData = "UploadEDCData";
public static readonly string UploadSiteSurveyData = "SiteSurveyData";
public static readonly string UploadFileFolder = "UploadFile";
}

View File

@ -23,17 +23,10 @@ namespace IRaCIS.Core.Infrastructure.Extention
//程序异常 相当于之前的 IsSuccess = false
ProgramException = 4,
//需要提示 ,需要提示 从Result 取数据 0 可以继续处理提交 ,1 不能进行继续处理提交 ,2 刷新列表 )
NeedTips = 5,
//在其他地方登陆,被迫下线
LoginInOtherPlace = -1,

106
irc_api.drone.yml Normal file
View File

@ -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