Merge branch 'Uat_IRC_Net10' of https://gitea.frp.extimaging.com/XCKJ/irc-netcore-api into Uat_IRC_Net10
continuous-integration/drone/push Build is passing Details

Uat_IRC_Net10
he 2026-08-14 11:51:27 +08:00
commit 24faa2d887
16 changed files with 23352 additions and 75 deletions

View File

@ -127,5 +127,6 @@
"DuplicationWindowMs": 500,
"CacheTimeSeconds": 5,
"ExcludedPaths": []
}
},
"FrontWebConfig": "222"
}

View File

@ -28,7 +28,7 @@ public static class ExcelExportHelper
/// <param name="translateType"></param>
/// <param name="criterionType"></param>
/// <returns></returns>
public static async Task<IActionResult> DataExportAsync(string code, ExcelExportInfo data, string exportFileNamePrefix, IRepository<CommonDocument> _commonDocumentRepository, IWebHostEnvironment _hostEnvironment, IDictionaryService? _dictionaryService = null, Type? translateType = null, CriterionType? criterionType = null)
public static async Task<IActionResult> DataExportAsync(string code, ExcelExportInfo data, string exportFileNamePrefix, IRepository<CommonDocument> _commonDocumentRepository, IWebHostEnvironment _hostEnvironment, IDictionaryService? _dictionaryService = null, Type? translateType = null, CriterionType? criterionType = null, List<int> removeExcelIndexList = null)
{
var isEn_US = CultureInfo.CurrentCulture.Name == StaticData.CultureInfo.en_US;
@ -136,7 +136,7 @@ public static class ExcelExportHelper
#region 根据中英文 删除模板sheet
// 打开模板文件
var templateFile = new FileStream(tplPath, FileMode.Open, FileAccess.Read);
using var templateFile = new FileStream(tplPath, FileMode.Open, FileAccess.Read);
// 获取文件流
var templateStream = new MemoryStream();
@ -158,6 +158,17 @@ public static class ExcelExportHelper
workbook.Worksheets.Delete(2); // 删除第2个索引2
}
if (removeExcelIndexList != null)
{
var worksheet = workbook.Worksheet(1); // 索引从1开始
foreach (int colIndex in removeExcelIndexList.OrderByDescending(t => t))
{
// 删除整列
worksheet.Column(colIndex).Delete();
}
}
//中文替换项目术语
if (data.TrialObjectNameList?.Count > 0)
{
@ -932,14 +943,14 @@ public static class ExcelExportHelper
//if (sheetCount == 2)
//{
if (inDto.IsEnglish)
{
workbook.Worksheet(1).Delete(); // 删除第一个工作表
}
else
{
workbook.Worksheet(2).Delete(); // 删除第二个工作表
}
if (inDto.IsEnglish)
{
workbook.Worksheet(1).Delete(); // 删除第一个工作表
}
else
{
workbook.Worksheet(2).Delete(); // 删除第二个工作表
}
//}
#endregion

View File

@ -43,7 +43,7 @@
<param name="next"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.ExcelExportHelper.DataExportAsync(System.String,IRaCIS.Application.Contracts.ExcelExportInfo,System.String,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.CommonDocument},Microsoft.AspNetCore.Hosting.IWebHostEnvironment,IRaCIS.Application.Interfaces.IDictionaryService,System.Type,System.Nullable{IRaCIS.Core.Domain.Share.CriterionType})">
<member name="M:IRaCIS.Core.Application.Service.ExcelExportHelper.DataExportAsync(System.String,IRaCIS.Application.Contracts.ExcelExportInfo,System.String,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.CommonDocument},Microsoft.AspNetCore.Hosting.IWebHostEnvironment,IRaCIS.Application.Interfaces.IDictionaryService,System.Type,System.Nullable{IRaCIS.Core.Domain.Share.CriterionType},System.Collections.Generic.List{System.Int32})">
<summary>
</summary>
@ -579,6 +579,12 @@
<param name="emailConfig"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.Common.DeployConfigService.GetWebConfigInfo">
<summary>
获取前端配置
</summary>
<returns></returns>
</member>
<member name="P:IRaCIS.Core.Application.Service.Common.TU_TR_RSBaseModel.ResearchProgramNo">
<summary>
方案编号 STUDYID
@ -849,6 +855,20 @@
裁决日期 CODTC
</summary>
</member>
<member name="M:IRaCIS.Core.Application.Service.Common.ExcelExportService.GetSiteSurveyEquipmentList_Export(IRaCIS.Core.Application.Contracts.SiteSurveyEquipmentQuery,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialSiteEquipmentSurvey},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialSiteSurvey},IRaCIS.Application.Interfaces.IDictionaryService)">
<summary>
获取中心设备信息
</summary>
<param name="inQuery"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.Common.ExcelExportService.GetSiteSurveyInfoList_Export(IRaCIS.Core.Application.Contracts.SiteSurveyInfoQuery,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialSiteSurvey},IRaCIS.Application.Interfaces.IDictionaryService)">
<summary>
调研表基本信息
</summary>
<param name="inQuery"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.Common.ExcelExportService.GetTrialQCQuestionAnserList_Export(IRaCIS.Core.Application.Contracts.GetQCQuestionAnswerQuery,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialQCQuestionAnswer},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Trial},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.UserRole},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialQCQuestion},IRaCIS.Application.Interfaces.IDictionaryService)">
<summary>
质控问题答案导出
@ -19370,7 +19390,7 @@
TrialSiteSurveyService
</summary>
</member>
<member name="M:IRaCIS.Core.Application.Contracts.TrialSiteSurveyService.#ctor(IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialSiteSurvey},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialSiteUserSurvey},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.UserRole},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.IdentityUser},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialIdentityUser},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Trial},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialSite},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Doctor},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.VerificationCode},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialUserRole},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialSiteUserRole},Medallion.Threading.IDistributedLockProvider,IRaCIS.Core.Application.Auth.ITokenService,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.UserType},IRaCIS.Core.Application.Service.IMailVerificationService,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.UserLog},Microsoft.Extensions.Options.IOptionsMonitor{IRaCIS.Core.Domain.Share.SystemEmailSendConfig},AutoMapper.IMapper,IRaCIS.Core.Domain.Share.IUserInfo,Microsoft.Extensions.Localization.IStringLocalizer)">
<member name="M:IRaCIS.Core.Application.Contracts.TrialSiteSurveyService.#ctor(IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialSiteSurvey},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.SiteSurveyLog},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialSiteEquipmentSurvey},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialSiteUserSurvey},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.UserRole},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.IdentityUser},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialIdentityUser},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Trial},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialSite},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.Doctor},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.VerificationCode},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialUserRole},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.TrialSiteUserRole},Medallion.Threading.IDistributedLockProvider,IRaCIS.Core.Application.Auth.ITokenService,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.UserType},IRaCIS.Core.Application.Service.IMailVerificationService,IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.UserLog},Microsoft.Extensions.Options.IOptionsMonitor{IRaCIS.Core.Domain.Share.SystemEmailSendConfig},AutoMapper.IMapper,IRaCIS.Core.Domain.Share.IUserInfo,Microsoft.Extensions.Localization.IStringLocalizer)">
<summary>
TrialSiteSurveyService
</summary>
@ -19491,6 +19511,34 @@
<param name="siteSurvyeSubmit"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Contracts.TrialSiteSurveyService.GetSiteSurveyLogList(IRaCIS.Core.Application.Contracts.SiteSurveyLogQuery)">
<summary>
获取中心调研日志
</summary>
<param name="inQuery"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Contracts.TrialSiteSurveyService.GetSiteSurveyEquipmentList(IRaCIS.Core.Application.Contracts.SiteSurveyEquipmentQuery)">
<summary>
获取中心设备信息
</summary>
<param name="inQuery"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Contracts.TrialSiteSurveyService.GetSiteSurveyInfoList(IRaCIS.Core.Application.Contracts.SiteSurveyInfoQuery)">
<summary>
调研表基本信息
</summary>
<param name="inQuery"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Contracts.TrialSiteSurveyService.GetTrialIsSPMJoin(System.Guid)">
<summary>
SPM 是否参与流程
</summary>
<param name="trialId"></param>
<returns></returns>
</member>
<member name="T:IRaCIS.Core.Application.Contracts.TrialSiteUserSurveyService">
<summary>
TrialSiteUserSurveyService

View File

@ -269,9 +269,45 @@ public class SiteSurverRejectedEventConsumer(
if (context.Message.IsHaveSPMOrCPM)
{
//PM 驳回到SPM
if (siteSurveyInfo.State == TrialSiteSurveyEnum.CRCSubmitted)
////PM 驳回到SPM
//if (siteSurveyInfo.State == TrialSiteSurveyEnum.CRCSubmitted)
//{
// var sPMOrCPMList = _trialUserRoleRepository.Where(t => t.TrialId == trialId && t.TrialUser.IsDeleted == false)
// .Where(t => t.UserRole.UserTypeEnum == UserTypeEnum.SPM || t.UserRole.UserTypeEnum == UserTypeEnum.CPM)
// .Select(t => new { t.UserRole.IdentityUser.EMail, t.UserRole.FullName, t.UserRole.UserTypeEnum, t.UserRole.IdentityUser.UserWorkLanguage }).ToList();
// var lan_SPMOrCPMList = sPMOrCPMList.Where(t => t.UserWorkLanguage == workLanguage);
// foreach (var user in lan_SPMOrCPMList)
// {
// messageToSend.To.Add(new MailboxAddress(user.FullName, user.EMail));
// }
// toUserName = string.Join('、', lan_SPMOrCPMList.Select(t => t.FullName));
//}
////SPM 驳回到CRC
//else if (siteSurveyInfo.State == TrialSiteSurveyEnum.ToSubmit)
//{
// //使用中心国家语言 一致才发送
// if ((siteInfo.Country == StaticData.SiteCountry.US && isEn_US) || (siteInfo.Country == StaticData.SiteCountry.CN && isEn_US == false))
// {
// messageToSend.To.Add(new MailboxAddress(toUserName, siteSurveyInfo.Email));
// }
//}
// PM 驳回到CRC
if (siteSurveyInfo.State == TrialSiteSurveyEnum.ToSubmit)
{
//使用中心国家语言 一致才发送
if ((siteInfo.Country == StaticData.SiteCountry.US && isEn_US) || (siteInfo.Country == StaticData.SiteCountry.CN && isEn_US == false))
{
messageToSend.To.Add(new MailboxAddress(toUserName, siteSurveyInfo.Email));
}
var sPMOrCPMList = _trialUserRoleRepository.Where(t => t.TrialId == trialId && t.TrialUser.IsDeleted == false)
.Where(t => t.UserRole.UserTypeEnum == UserTypeEnum.SPM || t.UserRole.UserTypeEnum == UserTypeEnum.CPM)
@ -281,24 +317,10 @@ public class SiteSurverRejectedEventConsumer(
foreach (var user in lan_SPMOrCPMList)
{
messageToSend.To.Add(new MailboxAddress(user.FullName, user.EMail));
}
toUserName = string.Join('、', lan_SPMOrCPMList.Select(t => t.FullName));
}
//SPM 驳回到CRC
else if (siteSurveyInfo.State == TrialSiteSurveyEnum.ToSubmit)
{
//使用中心国家语言 一致才发送
if ((siteInfo.Country == StaticData.SiteCountry.US && isEn_US) || (siteInfo.Country == StaticData.SiteCountry.CN && isEn_US == false))
{
messageToSend.To.Add(new MailboxAddress(toUserName, siteSurveyInfo.Email));
messageToSend.Cc.Add(new MailboxAddress(user.FullName, user.EMail));
}
}
}
else
{
@ -312,6 +334,11 @@ public class SiteSurverRejectedEventConsumer(
}
}
Uri uri = new Uri(_systemEmailConfig.SiteUrl);
// 获取 Scheme + Host不包含路径
string baseUrl = uri.GetLeftPart(UriPartial.Authority);
//发件地址
messageToSend.From.Add(new MailboxAddress(_systemEmailConfig.FromName, _systemEmailConfig.FromEmail));
@ -330,8 +357,9 @@ public class SiteSurverRejectedEventConsumer(
siteInfo.TrialSiteCode, //中心编号
siteInfo.TrialSiteAliasName,//中心名称
siteSurveyInfo.LatestBackReason, //驳回原因
_systemEmailConfig.SiteUrl, //链接
(siteSurveyInfo.State == TrialSiteSurveyEnum.ToSubmit ? "inline - block" : "none")
$"{baseUrl}/researchLogin?trialId={trialId}", //链接
(siteSurveyInfo.State == TrialSiteSurveyEnum.ToSubmit ? "inline - block" : "none"),
trialInfo.LinkVerificationCode.IsNullOrEmpty()? trialInfo.ResearchProgramNo: trialInfo.LinkVerificationCode
);
return (topicStr, htmlBodyStr);

View File

@ -767,6 +767,7 @@ namespace IRaCIS.Core.Application.Service
TaskCode = AppSettings.GetCodeStr(currentMaxCodeInt, nameof(VisitTask)),
ReadingCategory = ReadingCategory.Visit,
TrialReadingCriterionId = trialReadingCriterionConfig.TrialReadingCriterionId,
IsNeedClinicalDataSign = isNeedClinicalDataSign,
IsClinicalDataSign = isClinicalDataSign,
@ -1421,6 +1422,7 @@ namespace IRaCIS.Core.Application.Service
// AllocateTime = DateTime.Now,
//DoctorUserId = reReadingVisitTask.DoctorUserId,
IsIRImageDownloaded= reReadingVisitTask.IsIRImageDownloaded,
});
generateTaskCommand.Action(newTask);

View File

@ -31,7 +31,7 @@ public class DeployConfigService(IMapper _mapper, IConfiguration _configuration,
//return config;
var path = Path.Combine( _hostEnvironment.ContentRootPath,$"appsettings.{_hostEnvironment.EnvironmentName}.json");
var path = Path.Combine(_hostEnvironment.ContentRootPath, $"appsettings.{_hostEnvironment.EnvironmentName}.json");
var json = File.ReadAllText(path);
@ -123,7 +123,7 @@ public class DeployConfigService(IMapper _mapper, IConfiguration _configuration,
[HttpPost]
public async Task<IResponseOutput> UpdateSystemEmailConfig(SystemEmailSendConfig emailConfig)
{
var path = Path.Combine(_hostEnvironment.ContentRootPath,$"appsettings.{_hostEnvironment.EnvironmentName}.json");
var path = Path.Combine(_hostEnvironment.ContentRootPath, $"appsettings.{_hostEnvironment.EnvironmentName}.json");
//var path = $"appsettings.{_hostEnvironment.EnvironmentName}.json";
var @lock = _distributedLockProvider.CreateLock("WriteConfigFile");
@ -171,4 +171,51 @@ public class DeployConfigService(IMapper _mapper, IConfiguration _configuration,
return ResponseOutput.Ok();
}
/// <summary>
/// 获取前端配置
/// </summary>
/// <returns></returns>
[AllowAnonymous]
public async Task<string> GetWebConfigInfo()
{
var path = Path.Combine(_hostEnvironment.ContentRootPath, $"appsettings.{_hostEnvironment.EnvironmentName}.json");
var json = File.ReadAllText(path);
var obj = JObject.Parse(json);
return obj["FrontWebConfig"]!.ToString();
}
public async Task<IResponseOutput> UpdateWebConfigInfo(string configStr)
{
var path = Path.Combine(_hostEnvironment.ContentRootPath, $"appsettings.{_hostEnvironment.EnvironmentName}.json");
//var path = $"appsettings.{_hostEnvironment.EnvironmentName}.json";
var @lock = _distributedLockProvider.CreateLock("WriteConfigFile");
using (await @lock.AcquireAsync())
{
string text = System.IO.File.ReadAllText(path);
// 修改
JObject obj = JObject.Parse(text);
// SystemEmailSendConfig 相关配置
obj["FrontWebConfig"] = configStr;
// 重新写入appsettings.json
string result = obj.ToString();
System.IO.File.WriteAllText(path, result);
}
return ResponseOutput.Ok();
}
}

View File

@ -10,6 +10,7 @@ using IRaCIS.Core.Infra.EFCore.Common;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using System.Reflection;
using System.Text;
using static IRaCIS.Core.Application.Service.ExcelExportHelper;
@ -40,6 +41,191 @@ namespace IRaCIS.Core.Application.Service.Common
IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer, IWebHostEnvironment _hostEnvironment) : BaseService
{
#region 中心调研导出
[HttpPost]
public async Task<IActionResult> GetTrialSiteSurveyList_Export(TrialSiteSurveyQueryDTO inQuery,
[FromServices] IRepository<TrialSiteSurvey> _trialSiteSurveyRepository,
[FromServices] IDictionaryService _dictionaryService)
{
var trialSiteSurveyQueryable = _trialSiteSurveyRepository.Where(t => t.TrialId == inQuery.TrialId).IgnoreQueryFilters()
.WhereIf(inQuery.TrialSiteId != null, t => t.TrialSiteId == inQuery.TrialSiteId)
.WhereIf(inQuery.IsDeleted != null, t => t.IsDeleted == inQuery.IsDeleted)
.WhereIf(!string.IsNullOrWhiteSpace(inQuery.UserKeyInfo), t => t.UserName.Contains(inQuery.UserKeyInfo) || t.Phone.Contains(inQuery.UserKeyInfo) || t.Email.Contains(inQuery.UserKeyInfo))
.WhereIf(inQuery.State != null, t => t.State == inQuery.State)
.WhereIf(inQuery.UpdateTimeBegin != null, t => t.UpdateTime >= inQuery.UpdateTimeBegin)
.WhereIf(inQuery.UpdateTimeEnd != null, t => t.UpdateTime <= inQuery.UpdateTimeEnd)
.ProjectTo<TrialSiteSurveyView>(_mapper.ConfigurationProvider, new { isEn_Us = _userInfo.IsEn_Us })
.WhereIf(!string.IsNullOrWhiteSpace(inQuery.PreliminaryUserName), t => t.PreliminaryUser.RealName.Contains(inQuery.PreliminaryUserName))
.WhereIf(!string.IsNullOrWhiteSpace(inQuery.ReviewerUserName), t => t.ReviewerUser.RealName.Contains(inQuery.ReviewerUserName))
;
//var defalutSortArray = new string[] { /*nameof(TrialSiteSurveyView.LanguageType) + " desc", nameof(TrialSiteSurveyView.ShowOrder)*/ };
var list = await trialSiteSurveyQueryable.SortToListAsync(inQuery /*,defalutSortArray*/);
var exportInfo = new ExcelExportInfo();
exportInfo.List = ExportExcelConverterDate.ConvertToClientTimeInObject(list, _userInfo.TimeZoneId);
exportInfo.CurrentTime = ExportExcelConverterDate.DateTimeInternationalToString(DateTime.Now, _userInfo.TimeZoneId);
return await ExcelExportHelper.DataExportAsync(StaticData.Export.TrialSiteSurvey_BasicInfo_Export, exportInfo, exportInfo.TrialCode, _commonDocumentRepository, _hostEnvironment, _dictionaryService, typeof(TrialSiteSurveyView));
}
/// <summary>
/// 获取中心设备信息
/// </summary>
/// <param name="inQuery"></param>
/// <returns></returns>
[HttpPost]
public async Task<IActionResult> GetSiteSurveyEquipmentList_Export(SiteSurveyEquipmentQuery inQuery,
[FromServices] IRepository<TrialSiteEquipmentSurvey> _trialSiteEquipmentSurveyRepository,
[FromServices] IRepository<TrialSiteSurvey> _trialSiteSurveyRepository,
[FromServices] IDictionaryService _dictionaryService)
{
//找到该中心最新的调研记录
var groupSelectIdQuery =
_trialSiteSurveyRepository.Where(t => t.TrialId == inQuery.TrialId)
.WhereIf(inQuery.TrialSiteId != null, t => t.TrialSiteId == inQuery.TrialSiteId)
.GroupBy(t => t.TrialSiteId)
.Select(g => g.OrderByDescending(u => u.CreateTime).Select(t => t.Id).First());
var query = _trialSiteEquipmentSurveyRepository.Where(t => t.TrialSiteSurvey.TrialId == inQuery.TrialId)
.IgnoreQueryFilters().Where(t => groupSelectIdQuery.Contains(t.TrialSiteSurveyId))
.WhereIf(inQuery.IsDeleted != null, t => t.TrialSiteSurvey.IsDeleted == inQuery.IsDeleted)
.WhereIf(inQuery.State != null, t => t.TrialSiteSurvey.State == inQuery.State)
.WhereIf(inQuery.TrialSiteId != null, t => t.TrialSiteSurvey.TrialSiteId == inQuery.TrialSiteId)
.WhereIf(inQuery.TrialSiteCode.IsNotNullOrEmpty(), t => t.TrialSiteSurvey.TrialSite.TrialSiteCode.Contains(inQuery.TrialSiteCode))
.WhereIf(inQuery.TrialSiteName.IsNotNullOrEmpty(), t => t.TrialSiteSurvey.TrialSite.TrialSiteAliasName.Contains(inQuery.TrialSiteName) ||
t.TrialSiteSurvey.TrialSite.TrialSiteName.Contains(inQuery.TrialSiteName))
.ProjectTo<SiteSurveyEquipmentDto>(_mapper.ConfigurationProvider);
var siteSurveryConfig = _trialRepository.Where(t => t.Id == inQuery.TrialId).Select(t => t.TrialExtraConfigJsonStr).FirstOrDefault() ?? string.Empty;
var config = JsonConvert.DeserializeObject<TrialExtraConfig>(siteSurveryConfig) ?? new TrialExtraConfig();
var fields = new List<(string FieldName, int excelIndex)>()
{
("Parameters", 9),
("ManufacturerType", 10),
("ScannerType", 11),
("MagneticFieldStrengthType", 12),
("BodyCoilChannelCount", 13),
("HasDedicatedPdfFatQuantificationSequence", 14),
("PdfFatQuantificationSequenceType", 15),
//("OtherSequenceSpecification", 15),
("HasT2R2Correction", 16),
("CanFullyExportPdfParameterMapsAndRawDicom", 17),
("Note", 18),
};
var viewNameList = config.EquipmentControlFieldList.Where(t => t.IsView == true).Select(t => t.FiledName).ToList();
var columnsToDelete = fields.Where(f => !viewNameList.Any(t => f.FieldName == t)).Select(f => f.excelIndex).Distinct().OrderByDescending(i => i).ToList();
//var defalutSortArray = new string[] { /*nameof(TrialSiteSurveyView.LanguageType) + " desc", nameof(TrialSiteSurveyView.ShowOrder)*/ };
var list = await query.SortToListAsync(inQuery /*,defalutSortArray*/);
var exportInfo = new ExcelExportInfo();
exportInfo.List = ExportExcelConverterDate.ConvertToClientTimeInObject(list, _userInfo.TimeZoneId);
exportInfo.CurrentTime = ExportExcelConverterDate.DateTimeInternationalToString(DateTime.Now, _userInfo.TimeZoneId);
return await ExcelExportHelper.DataExportAsync(StaticData.Export.TrialSiteSurvey_Equipment_Export, exportInfo, exportInfo.TrialCode, _commonDocumentRepository, _hostEnvironment, _dictionaryService, typeof(SiteSurveyEquipmentDto), removeExcelIndexList: columnsToDelete);
}
/// <summary>
/// 调研表基本信息
/// </summary>
/// <param name="inQuery"></param>
/// <returns></returns>
[HttpPost]
public async Task<IActionResult> GetSiteSurveyInfoList_Export(SiteSurveyInfoQuery inQuery,
[FromServices] IRepository<TrialSiteSurvey> _trialSiteSurveyRepository,
[FromServices] IDictionaryService _dictionaryService)
{
//找到该中心最新的调研记录
var groupSelectIdQuery =
_trialSiteSurveyRepository.Where(t => t.TrialId == inQuery.TrialId)
.WhereIf(inQuery.TrialSiteId != null, t => t.TrialSiteId == inQuery.TrialSiteId)
.GroupBy(t => t.TrialSiteId)
.Select(g => g.OrderByDescending(u => u.CreateTime).Select(t => t.Id).First());
var query = _trialSiteSurveyRepository.Where(t => t.TrialId == inQuery.TrialId).IgnoreQueryFilters()
.Where(t => groupSelectIdQuery.Contains(t.Id))
.WhereIf(inQuery.IsDeleted != null, t => t.IsDeleted == inQuery.IsDeleted)
.WhereIf(inQuery.State != null, t => t.State == inQuery.State)
.WhereIf(inQuery.TrialSiteId != null, t => t.TrialSiteId == inQuery.TrialSiteId)
.WhereIf(inQuery.TrialSiteCode.IsNotNullOrEmpty(), t => t.TrialSite.TrialSiteCode.Contains(inQuery.TrialSiteCode))
.WhereIf(inQuery.TrialSiteName.IsNotNullOrEmpty(), t => t.TrialSite.TrialSiteAliasName.Contains(inQuery.TrialSiteName) ||
t.TrialSite.TrialSiteName.Contains(inQuery.TrialSiteName))
.ProjectTo<TrialSiteSurveyView>(_mapper.ConfigurationProvider);
var siteSurveryConfig = _trialRepository.Where(t => t.Id == inQuery.TrialId).Select(t => t.TrialExtraConfigJsonStr).FirstOrDefault() ?? string.Empty;
var config = JsonConvert.DeserializeObject<TrialExtraConfig>(siteSurveryConfig) ?? new TrialExtraConfig();
var fields = new List<(string FieldName, int excelIndex)>()
{
("AverageEngravingCycle", 8),
("IsRoutineMRIPDEE", 9),
("MRIPDFFScanTime", 10),
("MRIPDFFLeadTime", 11),
("MRIPDFFOther", 12),
("IsAuthorizeRadiologistsParticipate", 13),
("AssignFixedTechnologists", 14),
("IsConfirmImagingTechnologist", 15),
("NotConfirmReson", 16),
("EfficacyEvaluatorType", 17),
("IsFollowStudyParameters", 18),
("NotFollowReson", 19),
("ISStrictManualBurnFlag", 20),
("NotStrictManualBurnFlagReason",21)
};
//var viewNameList = config.NotShowFieldList;
var columnsToDelete = fields.Where(f => config.NotShowFieldList.Any(t => f.FieldName == t)).Select(f => f.excelIndex).Distinct().OrderByDescending(i => i).ToList();
//var defalutSortArray = new string[] { /*nameof(TrialSiteSurveyView.LanguageType) + " desc", nameof(TrialSiteSurveyView.ShowOrder)*/ };
var list = await query.SortToListAsync(inQuery /*,defalutSortArray*/);
var exportInfo = new ExcelExportInfo();
exportInfo.List = ExportExcelConverterDate.ConvertToClientTimeInObject(list, _userInfo.TimeZoneId);
exportInfo.CurrentTime = ExportExcelConverterDate.DateTimeInternationalToString(DateTime.Now, _userInfo.TimeZoneId);
return await ExcelExportHelper.DataExportAsync(StaticData.Export.TrialSiteSurvey_Info_Export, exportInfo, exportInfo.TrialCode, _commonDocumentRepository, _hostEnvironment, _dictionaryService, typeof(TrialSiteSurveyView), removeExcelIndexList: columnsToDelete);
}
#endregion
/// <summary>
/// 质控问题答案导出
/// </summary>
@ -1197,7 +1383,7 @@ namespace IRaCIS.Core.Application.Service.Common
t.VisitTaskList.Where(t => t.TaskState == TaskState.Effect && t.TrialReadingCriterionId == dto.TrialReadingCriterionId && t.TaskAllocationState == TaskAllocationState.Allocated && t.IsAnalysisCreate == false && t.ReadingCategory == ReadingCategory.Visit && t.ReadingTaskState == ReadingTaskState.HaveSigned).Count() == (int)trialReadingCriterion.ReadingType ?
ReadingStatusEnum.ReadCompleted : t.VisitTaskList.Where(t => t.TaskState == TaskState.Effect && t.TrialReadingCriterionId == dto.TrialReadingCriterionId && t.IsAnalysisCreate == false && t.ReadingCategory == ReadingCategory.Visit && t.TaskAllocationState == TaskAllocationState.Allocated).Count() == (int)trialReadingCriterion.ReadingType ? ReadingStatusEnum.ImageReading :
t.ReadingStatus
}).OrderBy(t=>t.VisitTaskNum).ToList(),
}).OrderBy(t => t.VisitTaskNum).ToList(),
ModuleList = subject.ReadModuleList.Where(t => t.TrialReadingCriterionId == dto.TrialReadingCriterionId).Select(t => new SubjectProgressDto.MouduleProgress()
{
@ -2863,7 +3049,7 @@ namespace IRaCIS.Core.Application.Service.Common
{
//仲裁阅片 才有裁判阅片明细表 同时要把模板里面的三列给去掉
//removeColumnIndexList = new List<int>() { 6, 7, 8 };
removeColumnIndexList = new List<int>() { 7, 8 ,9};
removeColumnIndexList = new List<int>() { 7, 8, 9 };
}
//阅片结果表 和阅片结果明细表 没有肿瘤学的时候需要移除肿瘤学三个字段

View File

@ -3,6 +3,8 @@
// 生成时间 2021-12-23 13:21:04
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
//--------------------------------------------------------------------
using IRaCIS.Core.Application.Helper;
namespace IRaCIS.Core.Application.Contracts
{
/// <summary> TrialSiteEquipmentSurveyView 列表视图模型 </summary>
@ -49,33 +51,44 @@ namespace IRaCIS.Core.Application.Contracts
public string ScannerType { get; set; } = string.Empty;
public string Note { get; set; } = string.Empty;
[DictionaryTranslate("SiteSurvey_ScanEquipmentType")]
[Comment("扫描设备-New")]
public int? EquipmentTypeEnum { get; set; }
public string OtherEquipmentType { get; set; }
[Comment("扫描设备厂商")]
[DictionaryTranslate("ManufacturerType")]
public int? ManufacturerType { get; set; }
[Comment("磁场强度 (1.5T / 3.0T)")]
[DictionaryTranslate("MagneticFieldStrengthType")]
public int? MagneticFieldStrengthType { get; set; }
[DictionaryTranslate("BodyCoilChannelCount")]
[Comment("体部线圈通道数 (≥16 或 16)")]
public int? BodyCoilChannelCount { get; set; }
[DictionaryTranslate("YesOrNo")]
[Comment("是否具备专用的PDFF脂肪定量序列CSE-MRI序列")]
public bool? HasDedicatedPdfFatQuantificationSequence { get; set; }
[DictionaryTranslate("PdfFatQuantificationSequenceType")]
[Comment("专用的PDFF脂肪定量序列类型 (当 HasDedicatedPdfFatQuantificationSequence = true 时有效)")]
public int? PdfFatQuantificationSequenceType { get; set; }
[Comment("其他序列详细说明 (当 PdfFatQuantificationSequenceType = Other 时建议填写)")]
public string OtherSequenceSpecification { get; set; }
[DictionaryTranslate("YesOrNo")]
[Comment("是否包含 T2/R2 校正(用于铁沉积校正)")]
public bool? HasT2R2Correction { get; set; }
[DictionaryTranslate("YesOrNo")]
[Comment("是否可完整导出 PDFF 参数图及全部原始 DICOM 数据")]
public bool? CanFullyExportPdfParameterMapsAndRawDicom { get; set; }
}

View File

@ -5,6 +5,7 @@
//--------------------------------------------------------------------
using IRaCIS.Application.Contracts;
using IRaCIS.Core.Application.Helper;
using IRaCIS.Core.Application.ViewModel;
using IRaCIS.Core.Domain.Share;
using System.ComponentModel.DataAnnotations;
@ -131,21 +132,23 @@ namespace IRaCIS.Core.Application.Contracts
/// <summary> TrialSiteSurveyView 列表视图模型 </summary>
public class TrialSiteSurveyView: TrialSiteSurveyAddOrEdit
public class TrialSiteSurveyView : TrialSiteSurveyAddOrEdit
{
public string TrialSiteCode { get; set; } = String.Empty;
public string TrialSiteAliasName { get; set; } = String.Empty;
public string SiteName { get; set; } = string.Empty;
[DictionaryTranslate("YesOrNo")]
public bool IsDeleted { get; set; }
public DateTime CreateTime { get; set; }
public Guid CreateUserId { get; set; }
public DateTime UpdateTime { get; set; }
public Guid UpdateUserId { get; set; }
[DictionaryTranslate("ResearchRecord")]
public TrialSiteSurveyEnum State { get; set; }
public string LatestBackReason { get; set; } = string.Empty;
@ -215,7 +218,7 @@ namespace IRaCIS.Core.Application.Contracts
}
public class UseEmialGetDoctorInfoOutDto
{
{
public Guid DoctorId { get; set; }
}
@ -326,14 +329,21 @@ namespace IRaCIS.Core.Application.Contracts
public string UserName { get; set; } = string.Empty;
public string Phone { get; set; } = string.Empty;
public string Email { get; set; } = string.Empty;
public int AverageEngravingCycle { get; set; }
[DictionaryTranslate("YesOrNo")]
public bool IsConfirmImagingTechnologist { get; set; }
public string NotConfirmReson { get; set; } = string.Empty;
[DictionaryTranslate("EfficacyEvaluatorType")]
public int EfficacyEvaluatorType { get; set; }
[DictionaryTranslate("YesOrNo")]
public bool IsFollowStudyParameters { get; set; }
public string NotFollowReson { get; set; } = string.Empty;
[DictionaryTranslate("YesOrNo")]
[Comment("MRI-PDEE 是否为本中心该适应症的常规诊疗检查项目")]
public bool? IsRoutineMRIPDEE { get; set; }
@ -346,14 +356,17 @@ namespace IRaCIS.Core.Application.Contracts
[Comment("MRI-PDEE 其他")]
public string MRIPDFFOther { get; set; }
[DictionaryTranslate("YesOrNo")]
[Comment("是否授权影像科老师参与")]
public bool? IsAuthorizeRadiologistsParticipate { get; set; }
[DictionaryTranslate("YesOrNo")]
[Comment("保持 1-2 名固定技师")]
public bool? AssignFixedTechnologists { get; set; }
[DictionaryTranslate("YesOrNo")]
[Comment("是否严格按照影像手册参数完成刻盘")]
public bool? ISStrictManualBurnFlag { get; set; }
@ -450,6 +463,92 @@ namespace IRaCIS.Core.Application.Contracts
}
public class SiteSurveyLogQuery:SortInput
{
[NotDefault]
public Guid TrialSiteSurveyId { get; set; }
public Guid? Id { get; set; }
}
public class SiteSurveyLogDTO
{
public Guid Id { get; set; }
public Guid TrialSiteSurveyId { get; set; }
public string Name { get; set; }
public UserTypeEnum UserType { get; set; }
public SiteSurveyOptTyp OptType { get; set; }
public string Reason { get; set; }
[MaxLength]
public string Json { get; set; }
[Comment("更新调研表之前的调研表")]
public Guid? OriginTrialSiteSurveyId { get; set; }
public string CreateTime { get; set; }
}
public class SiteSurveyEquipmentDto : TrialSiteEquipmentSurveyView
{
public string TrialSiteCode { get; set; }
public string TrialSiteName { get; set; } = String.Empty;
public string TrialSiteAliasName { get; set; } = String.Empty;
public string UserName { get; set; } = string.Empty;
public string Phone { get; set; } = string.Empty;
public string Email { get; set; } = string.Empty;
[DictionaryTranslate("YesOrNo")]
public bool IsDeleted { get; set; }
[DictionaryTranslate("ResearchRecord")]
public TrialSiteSurveyEnum State { get; set; }
}
public class SiteSurveyEquipmentQuery : PageInput
{
[NotDefault]
public Guid TrialId { get; set; }
public Guid? TrialSiteId { get; set; }
public string? TrialSiteCode { get; set; }
public string? TrialSiteName { get; set; }
public bool? IsDeleted { get; set; }
public TrialSiteSurveyEnum? State { get; set; }
}
public class SiteSurveyInfoQuery : PageInput
{
[NotDefault]
public Guid TrialId { get; set; }
public Guid? TrialSiteId { get; set; }
public string? TrialSiteCode { get; set; }
public string? TrialSiteName { get; set; }
public bool? IsDeleted { get; set; }
public TrialSiteSurveyEnum? State { get; set; }
}
public class SiteSurveyInfoDto
{
}
}

View File

@ -3,6 +3,9 @@
// 生成时间 2021-12-23 13:20:59
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
//--------------------------------------------------------------------
using DocumentFormat.OpenXml.Office2013.Excel;
using DocumentFormat.OpenXml.Spreadsheet;
using DocumentFormat.OpenXml.Vml;
using IRaCIS.Application.Contracts;
using IRaCIS.Core.Application.Auth;
using IRaCIS.Core.Application.Helper;
@ -22,6 +25,8 @@ namespace IRaCIS.Core.Application.Contracts
/// </summary>
[ApiExplorerSettings(GroupName = "Trial")]
public class TrialSiteSurveyService(IRepository<TrialSiteSurvey> _trialSiteSurveyRepository,
IRepository<SiteSurveyLog> _siteSurveyLogRepository,
IRepository<TrialSiteEquipmentSurvey> _trialSiteEquipmentSurveyRepository,
IRepository<TrialSiteUserSurvey> _trialSiteUserSurveyRepository,
IRepository<UserRole> _userRoleRepository,
IRepository<IdentityUser> _identityUserRepository,
@ -474,6 +479,7 @@ namespace IRaCIS.Core.Application.Contracts
public async Task<IResponseOutput> SubmissionRejection(TrialSiteSubmitBackCommand trialSiteSubmitBackCommand, [FromServices] IMailVerificationService _IMailVerificationService)
{
var trialId = trialSiteSubmitBackCommand.TrialId;
var trialSiteSurveyId = trialSiteSubmitBackCommand.TrialSiteSurveyId;
var survey = await _trialSiteSurveyRepository.FirstOrDefaultAsync(t => t.Id == trialSiteSurveyId);
@ -492,36 +498,48 @@ namespace IRaCIS.Core.Application.Contracts
}
else if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.APM)
{
var isTrialSPMJoin = await _trialRepository.AnyAsync(t => t.Id == trialSiteSubmitBackCommand.TrialId && t.IsSPMJoinSiteSurvey);
// var isTrialSPMJoin = await _trialRepository.AnyAsync(t => t.Id == trialSiteSubmitBackCommand.TrialId && t.IsSPMJoinSiteSurvey);
var hasSPMOrCPM = await _trialRepository.Where(t => t.Id == trialSiteSubmitBackCommand.TrialId).AnyAsync(t => t.TrialIdentityUserList.SelectMany(t => t.TrialUserRoleList).Any(t =>
t.UserRole.IdentityUser.Status == UserStateEnum.Enable
&& t.UserRole.IsUserRoleDisabled == false
&& (t.UserRole.UserTypeEnum == UserTypeEnum.SPM || t.UserRole.UserTypeEnum == UserTypeEnum.CPM))
);
// var hasSPMOrCPM = await _trialRepository.Where(t => t.Id == trialSiteSubmitBackCommand.TrialId).AnyAsync(t => t.TrialIdentityUserList.SelectMany(t => t.TrialUserRoleList).Any(t =>
//t.UserRole.IdentityUser.Status == UserStateEnum.Enable
//&& t.UserRole.IsUserRoleDisabled == false
//&& (t.UserRole.UserTypeEnum == UserTypeEnum.SPM || t.UserRole.UserTypeEnum == UserTypeEnum.CPM))
//);
var isSPMjoin = isTrialSPMJoin && hasSPMOrCPM;
// var isSPMjoin = isTrialSPMJoin && hasSPMOrCPM;
if (isSPMjoin)
{
survey.State = TrialSiteSurveyEnum.CRCSubmitted;
// if (isSPMjoin)
// {
// survey.State = TrialSiteSurveyEnum.CRCSubmitted;
survey.ReviewerUserId = null;
survey.ReviewerTime = null;
}
else
{
survey.State = TrialSiteSurveyEnum.ToSubmit;
// survey.ReviewerUserId = null;
// survey.ReviewerTime = null;
// }
// else
// {
// survey.State = TrialSiteSurveyEnum.ToSubmit;
survey.PreliminaryUserId = null;
survey.ReviewerUserId = null;
survey.PreliminaryTime = null;
survey.ReviewerTime = null;
// survey.PreliminaryUserId = null;
// survey.ReviewerUserId = null;
// survey.PreliminaryTime = null;
// survey.ReviewerTime = null;
// }
survey.State = TrialSiteSurveyEnum.ToSubmit;
survey.PreliminaryUserId = null;
survey.ReviewerUserId = null;
survey.PreliminaryTime = null;
survey.ReviewerTime = null;
}
}
var info = await GetSiteSurveyInfo(trialSiteSurveyId, trialId);
await _siteSurveyLogRepository.AddAsync(new SiteSurveyLog() { TrialSiteSurveyId = trialSiteSurveyId, Name = $"{_userInfo.FullName} ({_userInfo.UserName})", UserType = (UserTypeEnum)_userInfo.UserTypeEnumInt, OptType = SiteSurveyOptTyp.Reject, Reason = survey.LatestBackReason, Json = info.ToJsonStr() });
await _trialSiteSurveyRepository.SaveChangesAsync();
return ResponseOutput.Ok();
@ -547,6 +565,10 @@ namespace IRaCIS.Core.Application.Contracts
survey.IsDeleted = true;
var info = await GetSiteSurveyInfo(trialSiteSurveyId, survey.TrialId);
await _siteSurveyLogRepository.AddAsync(new SiteSurveyLog() { TrialSiteSurveyId = trialSiteSurveyId, Name = $"{_userInfo.FullName} ({_userInfo.UserName})", UserType = (UserTypeEnum)_userInfo.UserTypeEnumInt, OptType = SiteSurveyOptTyp.Over, Json = info.ToJsonStr() });
await _trialSiteSurveyRepository.SaveChangesAsync();
return ResponseOutput.Ok();
@ -612,6 +634,9 @@ namespace IRaCIS.Core.Application.Contracts
//从项目site 中找到已存在的 加到历史人员中
addSurvey.TrialSiteUserSurveyList = userList;
//添加创建日志
addSurvey.SiteSurveyLogList.Add(new SiteSurveyLog() { Name = userInfo.EmailOrPhone, OptType = SiteSurveyOptTyp.Create });
currentEntity = await _trialSiteSurveyRepository.AddAsync(addSurvey);
}
@ -649,7 +674,7 @@ namespace IRaCIS.Core.Application.Contracts
//找到最新的调研表
var currentLatest = await _trialSiteSurveyRepository.Where(t => t.TrialId == userInfo.TrialId && t.TrialSiteId == userInfo.TrialSiteId, true)
.Include(u => u.TrialSiteEquipmentSurveyList).Include(u => u.TrialSiteUserSurveyList).OrderByDescending(t => t.CreateTime).FirstOrDefaultAsync();
.Include(u => u.TrialSiteEquipmentSurveyList).Include(u => u.TrialSiteUserSurveyList).Include(t => t.SiteSurveyLogList).OrderByDescending(t => t.CreateTime).FirstOrDefaultAsync();
if (currentLatest == null)
{
@ -674,6 +699,11 @@ namespace IRaCIS.Core.Application.Contracts
{
}
//更新调研表日志 - 老的调研表
var info1 = await GetSiteSurveyInfo(currentLatest.Id, currentLatest.TrialId);
currentLatest.SiteSurveyLogList.Add(new SiteSurveyLog() { Name = userInfo.ReplaceUserEmailOrPhone, OptType = SiteSurveyOptTyp.Over, Json = info1.ToJsonStr() });
var copy = currentLatest.Clone();
copy.State = TrialSiteSurveyEnum.ToSubmit;
@ -685,10 +715,21 @@ namespace IRaCIS.Core.Application.Contracts
copy.Id = Guid.Empty;
copy.CreateTime = DateTime.Now;
copy.PreliminaryUserId = null;
copy.ReviewerUserId = null;
copy.PreliminaryTime = null;
copy.ReviewerTime = null;
if (userInfo.ReplaceUserEmailOrPhone != userInfo.EmailOrPhone)
{
copy.UserName = String.Empty;
copy.Phone = String.Empty;
//更新调研表日志
var info = await GetSiteSurveyInfo(currentLatest.Id, currentLatest.TrialId);
copy.SiteSurveyLogList.ForEach(t => { t.Id = Guid.Empty; });
copy.SiteSurveyLogList.Add(new SiteSurveyLog() { Name = userInfo.EmailOrPhone, OptType = SiteSurveyOptTyp.Update, OriginTrialSiteSurveyId = currentLatest.Id, Json = info.ToJsonStr() });
}
@ -885,12 +926,25 @@ namespace IRaCIS.Core.Application.Contracts
}
//审批调研表日志
var info = await GetSiteSurveyInfo(trialSiteSurveyId, trialId);
await _siteSurveyLogRepository.AddAsync(new SiteSurveyLog() { TrialSiteSurveyId = trialSiteSurveyId, Name = trialSiteSurvey.UserName, OptType = SiteSurveyOptTyp.Submit, Json = info.ToJsonStr() });
}
else if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.SPM || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.CPM)
{
await _trialSiteSurveyRepository.UpdatePartialFromQueryAsync(t => t.Id == trialSiteSurveyId && t.State == TrialSiteSurveyEnum.CRCSubmitted, u => new TrialSiteSurvey() { State = TrialSiteSurveyEnum.SPMApproved, PreliminaryUserId = _userInfo.UserRoleId, PreliminaryTime = DateTime.Now });
//审批调研表日志
var info = await GetSiteSurveyInfo(trialSiteSurveyId, trialId);
await _siteSurveyLogRepository.AddAsync(new SiteSurveyLog() { TrialSiteSurveyId = trialSiteSurveyId, Name = $"{_userInfo.FullName} ({_userInfo.UserName})", UserType = (UserTypeEnum)_userInfo.UserTypeEnumInt, OptType = SiteSurveyOptTyp.Approved, Json = info.ToJsonStr() });
}
else if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager || _userInfo.UserTypeEnumInt == (int)UserTypeEnum.APM)
{
@ -903,7 +957,16 @@ namespace IRaCIS.Core.Application.Contracts
//将历史锁定的调研表废弃
await _trialSiteSurveyRepository.BatchUpdateNoTrackingAsync(t => t.TrialId == trialId && t.TrialSiteId == trialSiteSurvey.TrialSiteId && t.State == TrialSiteSurveyEnum.PMCreatedAndLock && t.Id != trialSiteSurveyId, z => new TrialSiteSurvey() { IsDeleted = true });
//审批调研表日志
var info = await GetSiteSurveyInfo(trialSiteSurveyId, trialId);
await _siteSurveyLogRepository.AddAsync(new SiteSurveyLog() { TrialSiteSurveyId = trialSiteSurveyId, Name = $"{_userInfo.FullName} ({_userInfo.UserName})", UserType = (UserTypeEnum)_userInfo.UserTypeEnumInt, OptType = SiteSurveyOptTyp.Approved, Json = info.ToJsonStr() });
}
await _trialSiteSurveyRepository.SaveChangesAsync();
return ResponseOutput.Ok();
}
@ -1137,7 +1200,7 @@ namespace IRaCIS.Core.Application.Contracts
await _trialSiteUserSurveyRepository.UpdatePartialFromQueryAsync(t => userJoinIdList.Contains(t.Id), u => new TrialSiteUserSurvey() { IsJoin = true, SystemUserId = existSysUser.Id });
await _trialSiteUserRoleRepository.SaveChangesAsync();
@ -1149,12 +1212,19 @@ namespace IRaCIS.Core.Application.Contracts
var queitUserTypeIdList = needQuitUserList.Select(t => t.UserTypeId).ToList();
await _trialSiteUserRoleRepository.UpdatePartialFromQueryAsync(t => t.TrialId == trialId && t.TrialSiteId == trialSiteId && queitUserTypeIdList.Contains(t.UserRole.UserTypeId), c => new TrialSiteUserRole()
foreach (var item in needQuitUserList)
{
IsDeleted = true,
DeletedTime = DateTime.Now,
});
await _trialSiteUserRoleRepository.UpdatePartialFromQueryAsync(t => t.TrialId == trialId && t.TrialSiteId == trialSiteId
&& t.UserRole.UserTypeId == item.UserTypeId
&& t.UserRole.IdentityUserId == item.SystemUserId, c => new TrialSiteUserRole()
{
IsDeleted = true,
DeletedTime = DateTime.Now,
});
}
await _trialSiteSurveyRepository.UpdatePartialFromQueryAsync(t => t.Id == trialSiteSurveyId && t.State == TrialSiteSurveyEnum.SPMApproved, u => new TrialSiteSurvey() { State = TrialSiteSurveyEnum.PMCreatedAndLock, ReviewerUserId = _userInfo.UserRoleId, ReviewerTime = DateTime.Now });
@ -1398,5 +1468,87 @@ namespace IRaCIS.Core.Application.Contracts
/// <summary>
/// 获取中心调研日志
/// </summary>
/// <param name="inQuery"></param>
/// <returns></returns>
[HttpPost]
public async Task<List<SiteSurveyLogDTO>> GetSiteSurveyLogList(SiteSurveyLogQuery inQuery)
{
return _siteSurveyLogRepository.Where(t => t.TrialSiteSurveyId == inQuery.TrialSiteSurveyId)
.WhereIf(inQuery.Id != null, t => t.Id == inQuery.Id)
.ProjectTo<SiteSurveyLogDTO>(_mapper.ConfigurationProvider).OrderBy(t => t.CreateTime).ToList();
}
/// <summary>
/// 获取中心设备信息
/// </summary>
/// <param name="inQuery"></param>
/// <returns></returns>
[HttpPost]
public async Task<IResponseOutput> GetSiteSurveyEquipmentList(SiteSurveyEquipmentQuery inQuery)
{
var pageList = await _trialSiteEquipmentSurveyRepository.Where(t => t.TrialSiteSurvey.TrialId == inQuery.TrialId).IgnoreQueryFilters()
.WhereIf(inQuery.IsDeleted != null, t => t.TrialSiteSurvey.IsDeleted == inQuery.IsDeleted)
.WhereIf(inQuery.State != null, t => t.TrialSiteSurvey.State == inQuery.State)
.WhereIf(inQuery.TrialSiteId != null, t => t.TrialSiteSurvey.TrialSiteId == inQuery.TrialSiteId)
.WhereIf(inQuery.TrialSiteCode.IsNotNullOrEmpty(), t => t.TrialSiteSurvey.TrialSite.TrialSiteCode.Contains(inQuery.TrialSiteCode))
.WhereIf(inQuery.TrialSiteName.IsNotNullOrEmpty(), t => t.TrialSiteSurvey.TrialSite.TrialSiteAliasName.Contains(inQuery.TrialSiteName) ||
t.TrialSiteSurvey.TrialSite.TrialSiteName.Contains(inQuery.TrialSiteName))
.ProjectTo<SiteSurveyEquipmentDto>(_mapper.ConfigurationProvider).ToPagedListAsync(inQuery);
var siteSurveryConfig = _trialRepository.Where(t => t.Id == inQuery.TrialId).Select(t => t.TrialExtraConfigJsonStr).FirstOrDefault() ?? string.Empty;
var config = JsonConvert.DeserializeObject<TrialExtraConfig>(siteSurveryConfig) ?? new TrialExtraConfig();
return ResponseOutput.Ok(pageList, config);
}
/// <summary>
/// 调研表基本信息
/// </summary>
/// <param name="inQuery"></param>
/// <returns></returns>
[HttpPost]
public async Task<IResponseOutput> GetSiteSurveyInfoList(SiteSurveyInfoQuery inQuery)
{
var pageList = await _trialSiteSurveyRepository.Where(t => t.TrialId == inQuery.TrialId).IgnoreQueryFilters()
.WhereIf(inQuery.IsDeleted != null, t => t.IsDeleted == inQuery.IsDeleted)
.WhereIf(inQuery.State != null, t => t.State == inQuery.State)
.WhereIf(inQuery.TrialSiteId != null, t => t.TrialSiteId == inQuery.TrialSiteId)
.WhereIf(inQuery.TrialSiteCode.IsNotNullOrEmpty(), t => t.TrialSite.TrialSiteCode.Contains(inQuery.TrialSiteCode))
.WhereIf(inQuery.TrialSiteName.IsNotNullOrEmpty(), t => t.TrialSite.TrialSiteAliasName.Contains(inQuery.TrialSiteName) ||
t.TrialSite.TrialSiteName.Contains(inQuery.TrialSiteName))
.ProjectTo<TrialSiteSurveyView>(_mapper.ConfigurationProvider).ToPagedListAsync(inQuery);
var siteSurveryConfig = _trialRepository.Where(t => t.Id == inQuery.TrialId).Select(t => t.TrialExtraConfigJsonStr).FirstOrDefault() ?? string.Empty;
var config = JsonConvert.DeserializeObject<TrialExtraConfig>(siteSurveryConfig) ?? new TrialExtraConfig();
return ResponseOutput.Ok(pageList, config);
}
/// <summary>
/// SPM 是否参与流程
/// </summary>
/// <param name="trialId"></param>
/// <returns></returns>
public async Task<bool> GetTrialIsSPMJoin(Guid trialId)
{
var hasSPMOrCPM = await _trialRepository.Where(t => t.Id == trialId).AnyAsync(t => t.TrialIdentityUserList.SelectMany(t => t.TrialUserRoleList).Any(t =>
t.UserRole.IdentityUser.Status == UserStateEnum.Enable
&& t.UserRole.IsUserRoleDisabled == false
&& (t.UserRole.UserTypeEnum == UserTypeEnum.SPM || t.UserRole.UserTypeEnum == UserTypeEnum.CPM))
);
var isTrialSPMJoin = await _trialRepository.AnyAsync(t => t.Id == trialId && t.IsSPMJoinSiteSurvey);
var isSPMjoin = isTrialSPMJoin && hasSPMOrCPM;
return isSPMjoin;
}
}
}

View File

@ -97,7 +97,22 @@ namespace IRaCIS.Core.Application.AutoMapper
CreateMap<SiteSurveyUserImportDto, IdentityUser>();
CreateMap<SiteSurveyLog, SiteSurveyLogDTO>();
CreateMap<TrialSiteEquipmentSurvey, SiteSurveyEquipmentDto>()
.ForMember(d => d.IsDeleted, u => u.MapFrom(s => s.TrialSiteSurvey.IsDeleted))
.ForMember(d => d.State, u => u.MapFrom(s => s.TrialSiteSurvey.State))
.ForMember(d => d.Email, u => u.MapFrom(s => s.TrialSiteSurvey.Email))
.ForMember(d => d.Phone, u => u.MapFrom(s => s.TrialSiteSurvey.Phone))
.ForMember(d => d.UserName, u => u.MapFrom(s => s.TrialSiteSurvey.UserName))
.ForMember(d => d.TrialSiteAliasName, u => u.MapFrom(s => s.TrialSiteSurvey.TrialSite.TrialSiteAliasName))
.ForMember(d => d.TrialSiteName, u => u.MapFrom(s => s.TrialSiteSurvey.TrialSite.TrialSiteName))
.ForMember(d => d.TrialSiteCode, u => u.MapFrom(s => s.TrialSiteSurvey.TrialSite.TrialSiteCode));
}
}
}

View File

@ -23,6 +23,10 @@ public class TrialSiteSurvey : BaseFullDeleteAuditEntity
[JsonIgnore]
public CommonUploadRecord SiteSurveyFile { get; set; }
[JsonIgnore]
public List<SiteSurveyLog> SiteSurveyLogList { get; set; }=new List<SiteSurveyLog>();
#endregion
public Guid TrialSiteId { get; set; }
@ -64,7 +68,7 @@ public class TrialSiteSurvey : BaseFullDeleteAuditEntity
public bool? IsRoutineMRIPDEE { get; set; }
[Comment("MRI-PDFF 单次检查时长")]
public string MRIPDFFScanTime { get; set; }
public string MRIPDFFScanTime { get; set; }
[Comment("MRI-PDFF 预约等待时长")]
public string MRIPDFFLeadTime { get; set; }
@ -74,7 +78,7 @@ public class TrialSiteSurvey : BaseFullDeleteAuditEntity
[Comment("是否授权影像科老师参与")]
public bool? IsAuthorizeRadiologistsParticipate { get; set; }
[Comment("保持 1-2 名固定技师")]
@ -88,3 +92,43 @@ public class TrialSiteSurvey : BaseFullDeleteAuditEntity
public string NotStrictManualBurnFlagReason { get; set; }
}
public class SiteSurveyLog : BaseAddAuditEntity
{
[JsonIgnore]
[ForeignKey("TrialSiteSurveyId")]
public TrialSiteSurvey TrialSiteSurvey { get; set; }
public Guid TrialSiteSurveyId { get; set; }
public string Name { get; set; }
public UserTypeEnum UserType { get; set; }
public SiteSurveyOptTyp OptType { get; set; }
public string Reason { get; set; }
[MaxLength]
public string Json { get; set; }
[Comment("更新调研表之前的调研表")]
public Guid? OriginTrialSiteSurveyId { get; set; }
}
public enum SiteSurveyOptTyp
{
Create = 0,
Submit = 1,
Approved = 2,
Reject = 3,
Update = 4,
Over=5,
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,61 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace IRaCIS.Core.Infra.EFCore.Migrations
{
/// <inheritdoc />
public partial class siteSurveylog : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "SiteSurveyLog",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TrialSiteSurveyId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Name = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
UserType = table.Column<int>(type: "int", nullable: false),
OptType = table.Column<int>(type: "int", nullable: false),
Reason = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
Json = table.Column<string>(type: "nvarchar(max)", nullable: false),
OriginTrialSiteSurveyId = table.Column<Guid>(type: "uniqueidentifier", nullable: true, comment: "更新调研表之前的调研表"),
CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_SiteSurveyLog", x => x.Id)
.Annotation("SqlServer:Clustered", false);
table.ForeignKey(
name: "FK_SiteSurveyLog_TrialSiteSurvey_TrialSiteSurveyId",
column: x => x.TrialSiteSurveyId,
principalTable: "TrialSiteSurvey",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_SiteSurveyLog_User_CreateUserId",
column: x => x.CreateUserId,
principalTable: "User",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_SiteSurveyLog_CreateTime",
table: "SiteSurveyLog",
column: "CreateTime")
.Annotation("SqlServer:Clustered", true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "SiteSurveyLog");
}
}
}

View File

@ -9827,6 +9827,55 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
});
});
modelBuilder.Entity("IRaCIS.Core.Domain.Models.SiteSurveyLog", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("CreateTime")
.HasColumnType("datetime2");
b.Property<Guid>("CreateUserId")
.HasColumnType("uniqueidentifier");
b.Property<string>("Json")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(400)
.HasColumnType("nvarchar(400)");
b.Property<int>("OptType")
.HasColumnType("int");
b.Property<Guid?>("OriginTrialSiteSurveyId")
.HasColumnType("uniqueidentifier")
.HasComment("更新调研表之前的调研表");
b.Property<string>("Reason")
.IsRequired()
.HasMaxLength(400)
.HasColumnType("nvarchar(400)");
b.Property<Guid>("TrialSiteSurveyId")
.HasColumnType("uniqueidentifier");
b.Property<int>("UserType")
.HasColumnType("int");
b.HasKey("Id");
SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false);
b.HasIndex("CreateTime");
SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("CreateTime"));
b.ToTable("SiteSurveyLog");
});
modelBuilder.Entity("IRaCIS.Core.Domain.Models.Sponsor", b =>
{
b.Property<Guid>("Id")
@ -19563,6 +19612,25 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
b.Navigation("Hospital");
});
modelBuilder.Entity("IRaCIS.Core.Domain.Models.SiteSurveyLog", b =>
{
b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole")
.WithMany()
.HasForeignKey("CreateUserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("IRaCIS.Core.Domain.Models.TrialSiteSurvey", "TrialSiteSurvey")
.WithMany("SiteSurveyLogList")
.HasForeignKey("TrialSiteSurveyId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("CreateUserRole");
b.Navigation("TrialSiteSurvey");
});
modelBuilder.Entity("IRaCIS.Core.Domain.Models.Sponsor", b =>
{
b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole")
@ -22356,6 +22424,8 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
modelBuilder.Entity("IRaCIS.Core.Domain.Models.TrialSiteSurvey", b =>
{
b.Navigation("SiteSurveyLogList");
b.Navigation("TrialSiteEquipmentSurveyList");
b.Navigation("TrialSiteUserSurveyList");

View File

@ -325,7 +325,11 @@ public static class StaticData
public const string TrialVisit_InfluenceStudys_Export = "TrialVisit_InfluenceStudys_Export";
public const string TrialSiteSurvey_BasicInfo_Export = "TrialSiteSurvey_BasicInfo_Export";
public const string TrialSiteSurvey_Info_Export = "TrialSiteSurvey_Info_Export";
public const string TrialSiteSurvey_Equipment_Export = "TrialSiteSurvey_Equipment_Export";
}