参与人员和项目Site接口更改

Uat_Study
hang 2022-03-29 09:34:18 +08:00
parent abb09b80ae
commit 7c5b848e9a
8 changed files with 271 additions and 412 deletions

View File

@ -562,6 +562,107 @@
SystemAnonymizationService
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Inspection.DTO.DataInspectionAddDTO.ChildrenType">
<summary>
子类
</summary>
</member>
<member name="T:IRaCIS.Core.Application.Service.Inspection.DTO.InsBasicTrialConfig">
<summary>
配置 基础逻辑信息
</summary>
</member>
<member name="T:IRaCIS.Core.Application.Service.Inspection.DTO.InsTrialProcessConfig">
<summary>
配置流程
</summary>
</member>
<member name="T:IRaCIS.Core.Application.Service.Inspection.DTO.InsTrialUrgentConfig">
<summary>
配置加急信息
</summary>
</member>
<member name="T:IRaCIS.Core.Application.Service.Inspection.DTO.TrialDocumentConfirmDTO">
<summary>
用户 签名某个文档 Dto
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Inspection.DTO.GetDataInspectionDto.ModuleType">
<summary>
功能模块
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Inspection.DTO.GetDataInspectionDto.BlindName">
<summary>
盲态访视名
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Inspection.DTO.GetDataInspectionDto.TrialId">
<summary>
项目iD
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Inspection.DTO.GetDataInspectionDto.SiteId">
<summary>
中心
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Inspection.DTO.GetDataInspectionDto.SubjectId">
<summary>
受试者
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Inspection.DTO.GetDataInspectionDto.SubjectVisitId">
<summary>
访视
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Inspection.DTO.GetDataInspectionDto.OptType">
<summary>
操作类型
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Inspection.DTO.GetDataInspectionDto.ChildrenType">
<summary>
子类
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Inspection.DTO.GetDataInspectionDto.Reason">
<summary>
修改原因
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Inspection.DTO.GetDataInspectionDto.IsSign">
<summary>
是否有签名
</summary>
</member>
<member name="M:IRaCIS.Core.Application.Service.Inspection.InspectionService.Enforcement(System.Object,IRaCIS.Core.Application.Service.Inspection.DTO.DataInspectionAddDTO,IRaCIS.Core.Application.Contracts.SignDTO,System.Object,IRaCIS.Core.Infrastructure.Extention.IResponseOutput)">
<summary>
通用逻辑封装
</summary>
<param name="OptCommand">方法参数</param>
<param name="AuditInfo">添加稽查</param>
<param name="SignInfo">用户签名</param>
<param name="fun">委托</param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.Inspection.InspectionService.MapData(System.Object,System.Object)">
<summary>
映射 SiteId SubjectId SubjectVisitId TrialId 最开始没有 需要特殊处理
</summary>
<param name="data"></param>
<param name="mapData"></param>
</member>
<member name="M:IRaCIS.Core.Application.Service.Inspection.InspectionService.VerifySignatureAsync(IRaCIS.Core.Application.Contracts.SignDTO)">
<summary> 验证用户签名信息 </summary> ///
</member>
<member name="M:IRaCIS.Core.Application.Service.Inspection.InspectionService.AddSignRecordAsync(IRaCIS.Core.Application.Contracts.SignDTO)">
<summary> 添加签名记录 </summary> ///
</member>
<member name="M:IRaCIS.Core.Application.Service.Inspection.InspectionService.AddInspectionRecordAsync(IRaCIS.Core.Application.Service.Inspection.DTO.DataInspectionAddDTO,System.Nullable{System.Guid})">
<summary> 添加稽查记录( 有的会签名,有的不会签名) </summary> ///
</member>
<member name="T:IRaCIS.Core.Application.Service.TrialExternalUserService">
<summary>
项目外部人员 录入流程相关
@ -816,6 +917,13 @@
<member name="M:IRaCIS.Core.Application.Services.TrialMaintenanceService.AddTrialSites(System.Collections.Generic.List{IRaCIS.Core.Application.Contracts.DTO.TrialSiteCommand})">
<summary>Setting页面 Site批量添加</summary>
</member>
<member name="M:IRaCIS.Core.Application.Services.TrialMaintenanceService.EditTrialSite(IRaCIS.Core.Application.Contracts.DTO.EditTrialSiteCommand)">
<summary>
项目site 编辑接口 New 可以设置为启用不启用 不启用 不会验证Code 重复
</summary>
<param name="editTrialSiteCommand"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Services.TrialMaintenanceService.EditTrialSite(System.Guid,System.Guid,System.String,System.String)">
<summary>
编辑项目中Site 基本信息
@ -858,212 +966,6 @@
<param name="isReading"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.ImageAndDoc.StudyService.Preview(System.Guid)">
<summary> 指定资源Id渲染Dicom检查的Jpeg预览图像 </summary>
<param name="studyId"> Dicom检查的Id </param>
</member>
<member name="M:IRaCIS.Core.Application.Service.ImageAndDoc.StudyService.GetAllRelationStudyList(System.Guid)">
<summary>
获取某个检查的关联检查列表(该受试者在这个想项目下的所有检查)
点击检查检查列表中的一个检查获取对应的序列列表(调用之前的接口:/series/list/根据StudyId获取访视的序列列表
</summary>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.ImageAndDoc.StudyService.Item(System.Guid)">
<summary> 指定资源Id获取Dicom检查信息 </summary>
<param name="studyId"> Dicom检查的Id </param>
</member>
<member name="M:IRaCIS.Core.Application.Service.ImageAndDoc.StudyService.VerifyStudyAllowUpload(IRaCIS.Core.Application.Contracts.VerifyUploadOrReupload)">
<summary>
批量验证 检查是否可以上传 并告知原因
</summary>
</member>
<member name="T:IRaCIS.Core.Application.Service.SystemAnonymizationService">
<summary>
SystemAnonymizationService
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Inspection.DTO.DataInspectionAddDTO.ChildrenType">
<summary>
子类
</summary>
</member>
<member name="T:IRaCIS.Core.Application.Service.Inspection.DTO.InsBasicTrialConfig">
<summary>
配置 基础逻辑信息
</summary>
</member>
<member name="T:IRaCIS.Core.Application.Service.Inspection.DTO.InsTrialProcessConfig">
<summary>
配置流程
</summary>
</member>
<member name="T:IRaCIS.Core.Application.Service.Inspection.DTO.InsTrialUrgentConfig">
<summary>
配置加急信息
</summary>
</member>
<member name="T:IRaCIS.Core.Application.Service.Inspection.DTO.TrialDocumentConfirmDTO">
<summary>
用户 签名某个文档 Dto
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Inspection.DTO.GetDataInspectionDto.ModuleType">
<summary>
功能模块
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Inspection.DTO.GetDataInspectionDto.BlindName">
<summary>
盲态访视名
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Inspection.DTO.GetDataInspectionDto.TrialId">
<summary>
项目iD
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Inspection.DTO.GetDataInspectionDto.SiteId">
<summary>
中心
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Inspection.DTO.GetDataInspectionDto.SubjectId">
<summary>
受试者
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Inspection.DTO.GetDataInspectionDto.SubjectVisitId">
<summary>
访视
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Inspection.DTO.GetDataInspectionDto.OptType">
<summary>
操作类型
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Inspection.DTO.GetDataInspectionDto.ChildrenType">
<summary>
子类
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Inspection.DTO.GetDataInspectionDto.Reason">
<summary>
修改原因
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Inspection.DTO.GetDataInspectionDto.IsSign">
<summary>
是否有签名
</summary>
</member>
<member name="M:IRaCIS.Core.Application.Service.Inspection.InspectionService.Enforcement(System.Object,IRaCIS.Core.Application.Service.Inspection.DTO.DataInspectionAddDTO,IRaCIS.Core.Application.Contracts.SignDTO,System.Object,IRaCIS.Core.Infrastructure.Extention.IResponseOutput)">
<summary>
通用逻辑封装
</summary>
<param name="OptCommand">方法参数</param>
<param name="AuditInfo">添加稽查</param>
<param name="SignInfo">用户签名</param>
<param name="fun">委托</param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.Inspection.InspectionService.MapData(System.Object,System.Object)">
<summary>
映射 SiteId SubjectId SubjectVisitId TrialId 最开始没有 需要特殊处理
</summary>
<param name="data"></param>
<param name="mapData"></param>
</member>
<member name="M:IRaCIS.Core.Application.Service.Inspection.InspectionService.VerifySignatureAsync(IRaCIS.Core.Application.Contracts.SignDTO)">
<summary> 验证用户签名信息 </summary> ///
</member>
<member name="M:IRaCIS.Core.Application.Service.Inspection.InspectionService.AddSignRecordAsync(IRaCIS.Core.Application.Contracts.SignDTO)">
<summary> 添加签名记录 </summary> ///
</member>
<member name="M:IRaCIS.Core.Application.Service.Inspection.InspectionService.AddInspectionRecordAsync(IRaCIS.Core.Application.Service.Inspection.DTO.DataInspectionAddDTO,System.Nullable{System.Guid})">
<summary> 添加稽查记录( 有的会签名,有的不会签名) </summary> ///
</member>
<member name="T:IRaCIS.Core.Application.Service.TrialExternalUserService">
<summary>
项目外部人员 录入流程相关
</summary>
</member>
<member name="M:IRaCIS.Core.Application.Service.TrialExternalUserService.VerifyUserIsCanAddOrUpdate(IRaCIS.Core.Application.ViewModel.VerifyUserAdd)">
<summary>
验证 在系统中是否存在该类型的账户 返回true 表示 不存在 可以添加和更新|存在但是信息一致false 需要提示不一致项(前端 可以直接用我返回的错误信息,或者根据返回的用户信息实体,自己设置格式显示)
</summary>
<param name="addOrEditTrialExternalUser"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.TrialExternalUserService.AddOrUpdateTrialExternalUser(IRaCIS.Core.Application.ViewModel.TrialExternalUserAddOrEdit)">
<summary>
添加和更新接口 已验证邮箱和账户类型不允许添加重复项
</summary>
<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>
<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.Service.TrialUserPreparationService">
<summary>
TrialUserPreparation Service
</summary>
</member>
<member name="M:IRaCIS.Core.Application.Service.TrialUserPreparationService.GetTrialUserPreparationList(IRaCIS.Core.Application.ViewModel.TrialUserPreparationQuery)">
<summary>
项目下 人员邀请 加入列表
</summary>
<param name="queryTrialUserPreparation"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.TrialUserPreparationService.JoinTrial(IRaCIS.Core.Application.ViewModel.JoinCommand)">
<summary>
不带Token访问 加入项目 记录 同意与否
</summary>
<param name="joinCommand"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.TrialUserPreparationService.UserJoinTrialAsync(IRaCIS.Core.Application.ViewModel.UserJoinTrialCommand)">
<summary>
用户加入项目
</summary>
<param name="joinTrialCommand"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Image.QA.QCListService.GetCRCVisitList(IRaCIS.Core.Application.Contracts.CRCVisitSearchDTO)">
<summary>
CRC 访视上传列表

View File

@ -1,6 +1,7 @@
using System;
using IRaCIS.Core.Infrastructure.Extention;
using IRaCIS.Core.Domain.Share;
using System.ComponentModel.DataAnnotations;
namespace IRaCIS.Core.Application.Contracts.DTO
{
@ -9,10 +10,16 @@ namespace IRaCIS.Core.Application.Contracts.DTO
public class SiteCrcQueryDTO : PageInput
{
public Guid TrialId { get; set; } = Guid.Empty;
public string UserRealName { get; set; } = String.Empty;
public string SiteName { get; set; } = String.Empty;
public string TrialSiteAliasName { get; set; } = String.Empty;
public bool? IsDeleted { get; set; }
public string TrialSiteCode { get; set; } = String.Empty;
public string UserKeyInfo { get; set; } = String.Empty;
}
public class TrialSiteCommand
@ -22,9 +29,26 @@ namespace IRaCIS.Core.Application.Contracts.DTO
public string SiteName { get; set; }
}
}
public class AssginSiteCRCCommand
public class EditTrialSiteCommand
{
//Guid id, Guid trialId, string trialSiteCode, string? trialSiteAliasName
[NotDefault]
public Guid TrialId { get; set; }
public Guid Id { get; set; }
public string TrialSiteAliasName { get; set; } = String.Empty;
public string TrialSiteCode { get; set; } = String.Empty;
public bool IsDeleted { get; set; }
}
public class AssginSiteCRCCommand
{
public Guid TrialId { get; set; }
public Guid SiteId { get; set; }
@ -34,7 +58,7 @@ public class AssginSiteCRCCommand
}
public class AssginSiteCRCListDTO:AssginSiteCRCCommand
public class AssginSiteCRCListDTO : AssginSiteCRCCommand
{
public Guid UserTypeId { get; set; }
public string UserType { get; set; } = String.Empty;
@ -58,7 +82,7 @@ public class AssginSiteCRCCommand
public class TrialSiteScreeningDTO
{
public Guid Id { get; set; }
public Guid Id { get; set; }
public string SiteName { get; set; } = String.Empty;
public string SiteCode { get; set; } = String.Empty;
public string City { get; set; } = String.Empty;
@ -66,7 +90,7 @@ public class AssginSiteCRCCommand
public Guid HospitalId { get; set; } = Guid.Empty;
public string HospitalName { get; set; } = String.Empty;
public string HospitalName { get; set; } = String.Empty;
public bool IsSelect { get; set; }
}

View File

@ -105,6 +105,8 @@ namespace IRaCIS.Application.Contracts
public string TrialSiteCode { get; set; } = String.Empty;
public string TrialSiteAliasName { get; set; } = String.Empty;
public bool IsDeleted { get; set; }
public DateTime UpdateTime { get; set; }
public string Site { get; set; } = String.Empty;

View File

@ -63,32 +63,7 @@ namespace IRaCIS.Application.Services
param.PageSize, string.IsNullOrWhiteSpace(param.SortField) ? "UpdateTime" : param.SortField, param.Asc);
//from userTrial in.Where(userTrialLambda)
// join user in _userRepository.Where(userLambda) on userTrial.UserId equals user.Id
// // 判断site下面的用户是否已经选择
// join userId in _userTrialSiteRepository.Where(t => t.TrialId == param.TrialId && t.SiteId == param.SiteId).Select(t => t.UserId).Distinct() on user.Id equals userId into cc
// from userId in cc.DefaultIfEmpty()
// select new AssginSiteCRCListDTO()
// {
// //Id = userTrial.Id,
// SiteId = param.SiteId,
// UserId = userTrial.UserId,
// UserRealName = user.LastName + " / " + user.FirstName,
// UserName = user.UserName,
// TrialId = userTrial.TrialId,
// UserTypeId = userTrial.UserTypeId,
// UserTypeEnum= user.UserTypeEnum,
// //OrganizationTypeId = userTrial.OrganizationTypeId,
// //OrganizationType = userTrial.OrganizationType,
// //OrganizationId = userTrial.OrganizationId,
// OrganizationName = user.OrganizationName,
// UpdateTime = userTrial.UpdateTime,
// UserType = userTrial.UserType,
// IsSelect = userId!=null,
// };
}
@ -114,34 +89,7 @@ namespace IRaCIS.Application.Services
//IQueryable<TrialUserScreeningDTO> userQueryable = from user in _userRepository.Where(userLambda)
// join userType in _userTypeRoleRepository.AsQueryable() on user.UserTypeId equals userType.Id
// //下面左连接 判断是否已经选择了
// join userId in _userTrialRepository.Where(t => t.TrialId == trialUserQuery.TrialId).Select(t=>t.UserId).Distinct() on user.Id equals userId into cc
// from userId in cc.DefaultIfEmpty()
// select new TrialUserScreeningDTO()
// {
// TrialId = trialUserQuery.TrialId,
// UserId = user.Id,
// UserRealName = user.LastName + " / " + user.FirstName,
// UserName = user.UserName,
// Sex = user.Sex,
// Phone = user.Phone,
// EMail = user.EMail,
// UserTypeId = user.UserTypeId,
// OrganizationName = user.OrganizationName,
// UserTypeEnum=user.UserTypeEnum,
// //OrganizationTypeId = user.OrganizationTypeId,
// //OrganizationType = user.OrganizationType,
// //OrganizationId = user.OrganizationId,
// DepartmentName = user.DepartmentName,
// PositionName = user.PositionName,
// IsSelect = userId != null
// UserType = userType.UserTypeShortName,
// };

View File

@ -25,77 +25,16 @@ namespace IRaCIS.Core.Application.Services
public async Task<PageOutput<SiteStatDTO>> GetSiteCRCList(SiteCrcQueryDTO param)
{
var siteStatQuery = _trialSiteRepository.Where(t => t.TrialId == param.TrialId)
var siteStatQuery = _trialSiteRepository.Where(t => t.TrialId == param.TrialId, ignoreQueryFilters: true)
.WhereIf(!string.IsNullOrWhiteSpace(param.SiteName), t => t.Site.SiteName.Contains(param.SiteName))
.WhereIf(!string.IsNullOrWhiteSpace(param.TrialSiteAliasName), t => t.TrialSiteAliasName.Contains(param.TrialSiteAliasName))
.WhereIf(!string.IsNullOrWhiteSpace(param.TrialSiteCode), t => t.TrialSiteAliasName.Contains(param.TrialSiteCode))
.WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator, t => t.CRCUserList.Any(k => k.UserId == _userInfo.Id))
.WhereIf(!string.IsNullOrWhiteSpace(param.UserRealName), t => t.CRCUserList.Any(k => (k.User.LastName + " / " + k.User.FirstName).Contains(param.UserRealName)))
.WhereIf(!string.IsNullOrWhiteSpace(param.UserKeyInfo), t => t.CRCUserList.Any(k => (k.User.LastName + " / " + k.User.FirstName).Contains(param.UserKeyInfo)
|| k.User.UserName.Contains(param.UserKeyInfo) || k.User.EMail.Contains(param.UserKeyInfo)))
.ProjectTo<SiteStatDTO>(_mapper.ConfigurationProvider);
#region 统计 废弃
//= from trialSite in
// join site in _siteRepository.Where() on trialSite.SiteId equals site.Id
// join userTrialStat in _userTrialSiteRepository
// .Where(t => t.TrialId == param.TrialId).GroupBy(u => u.SiteId)
// .Select(g => new { SiteId = g.Key, UserCount = g.Count() }) on site.Id equals userTrialStat.SiteId into kk
// from userTrialStat in kk.DefaultIfEmpty()
// join subjectStat in _subjectRepository.Where(t => t.TrialId == param.TrialId).GroupBy(u => u.SiteId)
// .Select(g => new { SiteId = g.Key, SubjectCount = g.Count() }) on site.Id equals subjectStat
// .SiteId
// into ST
// from subjectStatItem in ST.DefaultIfEmpty()
// ////加入 Visit统计 通过site下的受试者过滤visit 加入siteId 后修改 不用通过site下的用户过滤
// //join subjectVisitStat in _subjectVisitRepository.Find(t=>t.TrialId==param.TrialId).GroupBy(t => t.SiteId).Select(g => new { SiteId = g.Key, VisitCount = g.Count() }) on site.Id equals subjectVisitStat.SiteId into SSV
// //from subjectVisitStatItem in SSV.DefaultIfEmpty()
// //join subjectVisitStat2 in _subjectVisitRepository.Find(t => t.TrialId == param.TrialId&&t.VisitExecuted).GroupBy(t => t.SiteId).Select(g => new { SiteId = g.Key, VisitCount = g.Count() }) on site.Id equals subjectVisitStat2.SiteId into SSV2
// //from subjectVisitStatItem2 in SSV2.DefaultIfEmpty()
// join studyStat in _studyRepository.Where(t => t.TrialId == param.TrialId /*&& t.Status != (int)StudyStatus.Abandon*/).GroupBy(u => u.SiteId).Select(g => new { SiteId = g.Key, StudyCount = g.Count() }) on site.Id equals studyStat.SiteId into STT
// from studyStatItem in STT.DefaultIfEmpty()
// select new SiteStatDTO()
// {
// SiteId = site.Id,
// Site = site.SiteName,
// City = site.City,
// Country = site.Country,
// TrialSiteCode = trialSite.TrialSiteCode,
// //VisitCount = subjectVisitStatItem2.VisitCount,
// //PlanVisitCount = subjectVisitStatItem.VisitCount,
// StudyCount = studyStatItem.StudyCount,
// UserCount = userTrialStat.UserCount,
// SubjectCount = subjectStatItem.SubjectCount,
// UserList = trialSite.CRCUserList.Select(t => new UserTrialDTO()
// {
// Id = t.Id,
// SiteId = t.SiteId,
// UserId = t.UserId,
// UserRealName = t.UserRealName,
// TrialId = t.TrialId,
// UserTypeId = t.UserTypeId,
// UserType = t.UserType,
// //OrganizationTypeId = userTrial.OrganizationTypeId,
// //OrganizationType = userTrial.OrganizationType,
// //OrganizationId = userTrial.OrganizationId,
// OrganizationName = t.User.OrganizationName,
// UserName = t.User.UserName,
// Phone = t.User.Phone,
// UpdateTime = t.UpdateTime,
// }).ToList()
// };
#endregion
return await siteStatQuery.ToPagedListAsync(param.PageIndex,
param.PageSize, string.IsNullOrWhiteSpace(param.SortField) ? "SiteCode" : param.SortField, param.Asc);
@ -108,63 +47,16 @@ namespace IRaCIS.Core.Application.Services
public async Task<PageOutput<SiteStatSimpleDTO>> GetSiteCRCSimpleList(SiteCrcQueryDTO param)
{
var siteStatQuery = _trialSiteRepository.Where(t => t.TrialId == param.TrialId)
var siteStatQuery = _trialSiteRepository.Where(t => t.TrialId == param.TrialId).IgnoreQueryFilters()
.WhereIf(!string.IsNullOrWhiteSpace(param.SiteName), t => t.Site.SiteName.Contains(param.SiteName))
.WhereIf(!string.IsNullOrWhiteSpace(param.TrialSiteAliasName), t => t.TrialSiteAliasName.Contains(param.TrialSiteAliasName))
.WhereIf(!string.IsNullOrWhiteSpace(param.TrialSiteCode), t => t.TrialSiteAliasName.Contains(param.TrialSiteCode))
.WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator, t => t.CRCUserList.Any(k => k.UserId == _userInfo.Id))
.WhereIf(!string.IsNullOrWhiteSpace(param.UserRealName), t => t.CRCUserList.Any(k => (k.User.LastName + " / " + k.User.FirstName).Contains(param.UserRealName)))
.WhereIf(!string.IsNullOrWhiteSpace(param.UserKeyInfo), t => t.CRCUserList.Any(k => (k.User.LastName + " / " + k.User.FirstName).Contains(param.UserKeyInfo)
|| k.User.UserName.Contains(param.UserKeyInfo) || k.User.EMail.Contains(param.UserKeyInfo)))
.ProjectTo<SiteStatSimpleDTO>(_mapper.ConfigurationProvider);
#region 废弃
//IQueryable<SiteStatSimpleDTO> siteStatQuery = from trialSite in _trialSiteRepository.Where(t => t.TrialId == param.TrialId)
// join site in _siteRepository.AsQueryable() on trialSite.SiteId equals site.Id
// join hospital in _hospitalRepository.AsQueryable() on site.HospitalId equals hospital.Id
// join userTrialStat in _userTrialSiteRepository
// .Where(t => t.TrialId == param.TrialId).GroupBy(u => u.SiteId)
// .Select(g => new { SiteId = g.Key, UserCount = g.Count() }) on site.Id equals userTrialStat.SiteId into kk
// from userTrialStat in kk.DefaultIfEmpty()
// select new SiteStatSimpleDTO()
// {
// Id = trialSite.Id,
// SiteId = site.Id,
// Site = site.SiteName,
// SiteCode = site.SiteCode,
// TrialSiteCode = trialSite.TrialSiteCode,
// Hospital = hospital.HospitalName,
// DirectorName = site.DirectorName,
// DirectorPhone = site.DirectorPhone,
// ContactName = site.ContactName,
// ContactPhone = site.ContactPhone,
// City = site.City,
// Country = site.Country,
// UpdateTime = trialSite.UpdateTime,
// UserCount = userTrialStat.UserCount,
// UserList = trialSite.CRCUserList.Select(t => new UserTrialDTO()
// {
// Id = t.Id,
// SiteId = t.SiteId,
// UserId = t.UserId,
// UserRealName = t.UserRealName,
// TrialId = t.TrialId,
// UserTypeId = t.UserTypeId,
// UserType = t.UserType,
// //OrganizationTypeId = userTrial.OrganizationTypeId,
// //OrganizationType = userTrial.OrganizationType,
// //OrganizationId = userTrial.OrganizationId,
// OrganizationName = t.User.OrganizationName,
// UserName = t.User.UserName,
// Phone = t.User.Phone,
// UpdateTime = t.UpdateTime,
// }).ToList()
// };
#endregion
var result = await siteStatQuery.ToPagedListAsync(param.PageIndex,
param.PageSize, string.IsNullOrWhiteSpace(param.SortField) ? "Site" : param.SortField, param.Asc);
@ -175,12 +67,12 @@ namespace IRaCIS.Core.Application.Services
/// <summary>获取某一Site下面的负责的CRC列表</summary>
[HttpGet, Route("{trialId:guid}/{siteId:guid}")]
public async Task<List<UserTrialDTO>> GetTrialSiteCRCList(Guid trialId,Guid siteId)
public async Task<List<UserTrialDTO>> GetTrialSiteCRCList(Guid trialId, Guid siteId)
{
var query = _repository.Where<TrialSiteUser>(t => t.TrialId == trialId && t.SiteId==siteId).IgnoreQueryFilters()
var query = _repository.Where<TrialSiteUser>(t => t.TrialId == trialId && t.SiteId == siteId).IgnoreQueryFilters()
.ProjectTo<UserTrialDTO>(_mapper.ConfigurationProvider);
return await query.ToListAsync();
return await query.ToListAsync();
}
@ -220,21 +112,76 @@ namespace IRaCIS.Core.Application.Services
}
/// <summary>
/// 编辑项目中Site 基本信息
/// </summary>
/// <param name="id"></param>
/// <param name="trialId"></param>
/// <param name="trialSiteCode"></param>
/// <param name="trialSiteAliasName"></param>
/// <returns></returns>
/// <summary>
/// 项目site 编辑接口 New 可以设置为启用不启用 不启用 不会验证Code 重复
/// </summary>
/// <param name="editTrialSiteCommand"></param>
/// <returns></returns>
[HttpPut]
public async Task<IResponseOutput> EditTrialSite(EditTrialSiteCommand editTrialSiteCommand)
{
var dbEntity = await _trialSiteRepository.FirstOrDefaultAsync(t => t.Id == editTrialSiteCommand.Id, true);
if (dbEntity == null) return Null404NotFound(dbEntity);
var trialId = dbEntity.TrialId;
var siteId = dbEntity.SiteId;
if (editTrialSiteCommand.IsDeleted)
{
//if (await _repository.AnyAsync<TrialSiteUser>(t => t.TrialId == trialId && t.SiteId == siteId))
//{
// return ResponseOutput.NotOk("The site has been associated with CRC, and couldn't be deleted.");
//}
if (await _repository.AnyAsync<Subject>(t => t.SiteId == siteId && t.TrialId == trialId))
{
return ResponseOutput.NotOk("The subjects has been added to this site, and couldn't be deleted.");
}
//if (await _repository.AnyAsync<DicomStudy>(t => t.SiteId == siteId && t.TrialId == trialId))
//{
// return ResponseOutput.NotOk("The site has been uploaded study, and couldn't be deleted.");
//}
}
else
{
if (await _trialSiteRepository.AnyAsync(t => t.Id != editTrialSiteCommand.Id && t.TrialSiteCode == editTrialSiteCommand.TrialSiteCode && t.TrialId == editTrialSiteCommand.TrialId))
{
return ResponseOutput.NotOk("Code is not allowed to be repeated");
}
}
_mapper.Map(editTrialSiteCommand, dbEntity);
await _trialSiteRepository.SaveChangesAsync();
return ResponseOutput.Ok();
}
/// <summary>
/// 编辑项目中Site 基本信息
/// </summary>
/// <param name="id"></param>
/// <param name="trialId"></param>
/// <param name="trialSiteCode"></param>
/// <param name="trialSiteAliasName"></param>
/// <returns></returns>
[UnitOfWork]
[HttpPost("{trialId:guid}/{id:guid}/{trialSiteCode}/{trialSiteAliasName?}")]
[TypeFilter(typeof(TrialResourceFilter))]
[Obsolete]
public async Task<IResponseOutput> EditTrialSite(Guid id, Guid trialId, string trialSiteCode, string? trialSiteAliasName)
{
if (await _trialSiteRepository.AnyAsync(t => t.Id != id && t.TrialSiteCode == trialSiteCode && t.TrialId == trialId))
if (await _trialSiteRepository.AnyAsync(t => t.Id != id && t.TrialSiteCode == trialSiteCode && t.TrialId == trialId && t.IsDeleted == false, true))
{
return ResponseOutput.NotOk("Code is not allowed to be repeated");
}
@ -250,6 +197,7 @@ namespace IRaCIS.Core.Application.Services
[HttpDelete("{id:guid}/{trialId:guid}")]
[TrialAudit(AuditType.TrialAudit, AuditOptType.DeleteTrialSite)]
[TypeFilter(typeof(TrialResourceFilter))]
[Obsolete]
public async Task<IResponseOutput> DeleteTrialSite(Guid id)
{
var relation = await _trialSiteRepository.FirstOrDefaultAsync(t => t.Id == id);
@ -298,9 +246,9 @@ namespace IRaCIS.Core.Application.Services
//[TrialAudit(AuditType.TrialAudit, AuditOptType.DeleteTrialSiteCRC)]
[TypeFilter(typeof(TrialResourceFilter))]
public async Task<IResponseOutput> DeleteSiteCRC(Guid id, bool isDelete )
public async Task<IResponseOutput> DeleteSiteCRC(Guid id, bool isDelete)
{
var isSuccess = await _repository.UpdateFromQueryAsync<TrialSiteUser>(u => u.Id == id,u=>new TrialSiteUser()
var isSuccess = await _repository.UpdateFromQueryAsync<TrialSiteUser>(u => u.Id == id, u => new TrialSiteUser()
{ IsDeleted = isDelete, RemoveTime = isDelete ? DateTime.Now : null });
return ResponseOutput.Result(isSuccess);

View File

@ -22,9 +22,10 @@ namespace IRaCIS.Core.Infra.EFCore
EntityEntry Entry(TEntity t);
Task<TEntity> FirstOrDefaultAsync(Expression<Func<TEntity, bool>> exp = null);
Task<bool> AnyAsync(Expression<Func<TEntity, bool>> exp);
Task<int> CountAsync(Expression<Func<TEntity, bool>> whereLambda = null);
Task<TEntity> FirstOrDefaultAsync(Expression<Func<TEntity, bool>> exp = null, bool ignoreQueryFilters = false);
Task<bool> AnyAsync(Expression<Func<TEntity, bool>> exp,bool ignoreQueryFilters=false);
Task<int> CountAsync(Expression<Func<TEntity, bool>> whereLambda = null, bool ignoreQueryFilters = false);
ValueTask<TEntity> AddAsync(TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default);
Task<bool> AddRangeAsync(IEnumerable<TEntity> entities, bool autoSave = false, CancellationToken cancellationToken = default);

View File

@ -24,8 +24,8 @@ namespace IRaCIS.Core.Infra.EFCore
public interface IQueryRepository<TEntity> : IQueryRepository<TEntity, Guid> where TEntity : Entity
{
TEntity ImageFind(Guid id, Type type);
IQueryable<TEntity> Where(Expression<Func<TEntity, bool>> exp = null, bool isTraking = false);
IQueryable<TEntity> AsQueryable();
IQueryable<TEntity> Where(Expression<Func<TEntity, bool>> exp = null, bool isTraking = false, bool ignoreQueryFilters = false);
IQueryable<TEntity> AsQueryable( bool ignoreQueryFilters = false);
IQueryable<TEntity> WhereIf(bool condition, Expression<Func<TEntity, bool>> filter);
IQueryable<TDestination> ProjectTo<TDestination>(IConfigurationProvider configuration, params Expression<Func<TDestination, object>>[] membersToExpand);

View File

@ -113,10 +113,18 @@ namespace IRaCIS.Core.Infra.EFCore
return await _dbContext.FindAsync<TEntity>(keyValues);
}
public async Task<TEntity> FirstOrDefaultAsync(Expression<Func<TEntity, bool>> exp = null)
public async Task<TEntity> FirstOrDefaultAsync(Expression<Func<TEntity, bool>> exp = null, bool ignoreQueryFilters = false)
{
if (exp == null) return await _dbSet.FirstOrDefaultAsync().ConfigureAwait(false);
return await _dbSet.FirstOrDefaultAsync(exp).ConfigureAwait(false);
var query = _dbSet.AsQueryable();
if (ignoreQueryFilters)
{
query = query.IgnoreQueryFilters();
}
if (exp == null)
return await query.FirstOrDefaultAsync().ConfigureAwait(false);
return await query.FirstOrDefaultAsync(exp).ConfigureAwait(false);
}
public async ValueTask<TEntity> AddAsync(TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default)
@ -205,14 +213,28 @@ namespace IRaCIS.Core.Infra.EFCore
}
}
public async Task<bool> AnyAsync(Expression<Func<TEntity, bool>> exp)
public async Task<bool> AnyAsync(Expression<Func<TEntity, bool>> exp, bool ignoreQueryFilters = false)
{
return await _dbSet.AsNoTracking().AnyAsync(exp);
var query = _dbSet.AsQueryable();
if (ignoreQueryFilters)
{
query = query.IgnoreQueryFilters();
}
return await query.AsNoTracking().AnyAsync(exp);
}
public async Task<int> CountAsync(Expression<Func<TEntity, bool>> whereLambda = null)
public async Task<int> CountAsync(Expression<Func<TEntity, bool>> whereLambda = null, bool ignoreQueryFilters = false)
{
return whereLambda == null ? await _dbSet.AsNoTracking().CountAsync() : await _dbSet.AsNoTracking().CountAsync(whereLambda);
var query = _dbSet.AsQueryable();
if (ignoreQueryFilters)
{
query = query.IgnoreQueryFilters();
}
return whereLambda == null ? await query.AsNoTracking().CountAsync() : await query.AsNoTracking().CountAsync(whereLambda);
}
// Z.EntityFramework.Plus.EFCore
@ -251,9 +273,16 @@ namespace IRaCIS.Core.Infra.EFCore
}
public IQueryable<TEntity> AsQueryable()
public IQueryable<TEntity> AsQueryable( bool ignoreQueryFilters = false)
{
return _dbSet.AsNoTracking();
var query = _dbSet.AsQueryable();
if (ignoreQueryFilters)
{
query = query.IgnoreQueryFilters();
}
return query.AsNoTracking();
}
public IQueryable<TResult> Select<TResult>(Expression<Func<TEntity, TResult>> selector)
@ -266,7 +295,7 @@ namespace IRaCIS.Core.Infra.EFCore
return condition ? _dbSet.AsNoTracking().Where(filter) : _dbSet.AsNoTracking();
}
public IQueryable<TEntity> Where(Expression<Func<TEntity, bool>> exp = null, bool isTraking = false)
public IQueryable<TEntity> Where(Expression<Func<TEntity, bool>> exp = null, bool isTraking = false,bool ignoreQueryFilters = false)
{
IQueryable<TEntity> query = _dbSet;
@ -275,6 +304,11 @@ namespace IRaCIS.Core.Infra.EFCore
query = query.AsNoTracking();
}
if (ignoreQueryFilters)
{
query = query.IgnoreQueryFilters();
}
if (exp != null)
{
query = query.Where(exp);