禁用时间修改
parent
fb2586e5c1
commit
a0690552e8
|
@ -1083,16 +1083,6 @@
|
|||
<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 基本信息
|
||||
</summary>
|
||||
<param name="id"></param>
|
||||
<param name="trialId"></param>
|
||||
<param name="trialSiteCode"></param>
|
||||
<param name="trialSiteAliasName"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.Application.Services.TrialMaintenanceService.DeleteTrialSite(System.Guid)">
|
||||
<summary>删除 项目 下某一site </summary>
|
||||
</member>
|
||||
|
|
|
@ -33,7 +33,6 @@ namespace IRaCIS.Core.Application.Contracts.DTO
|
|||
|
||||
public class EditTrialSiteCommand
|
||||
{
|
||||
//Guid id, Guid trialId, string trialSiteCode, string? trialSiteAliasName
|
||||
|
||||
[NotDefault]
|
||||
public Guid TrialId { get; set; }
|
||||
|
|
|
@ -13,7 +13,6 @@ namespace IRaCIS.Application.Contracts
|
|||
|
||||
public bool IsDeleted { get; set; }
|
||||
|
||||
public DateTime? RemoveTime { get; set; }
|
||||
public Guid? SiteId { get; set; }
|
||||
public string Phone { get; set; } = String.Empty;
|
||||
public DateTime UpdateTime { get; set; }
|
||||
|
@ -37,10 +36,14 @@ namespace IRaCIS.Application.Contracts
|
|||
public class TrialMaintenanceDTO : UserTrialCommand
|
||||
{
|
||||
public bool IsDeleted { get; set; }
|
||||
|
||||
public DateTime? DeletedTime { get; set; }
|
||||
|
||||
public DateTime? RemoveTime { get; set; }
|
||||
|
||||
public DateTime? JoinTime { get; set; }
|
||||
|
||||
public DateTime CreateTime { get; set; }
|
||||
|
||||
|
||||
public DateTime UpdateTime { get; set; } = DateTime.Now;
|
||||
|
@ -117,6 +120,9 @@ namespace IRaCIS.Application.Contracts
|
|||
public string TrialSiteAliasName { get; set; } = String.Empty;
|
||||
|
||||
public bool IsDeleted { get; set; }
|
||||
|
||||
public DateTime? DeletedTime { get; set; }
|
||||
|
||||
public DateTime UpdateTime { get; set; }
|
||||
|
||||
public string Site { get; set; } = String.Empty;
|
||||
|
|
|
@ -10,7 +10,6 @@ namespace IRaCIS.Core.Application.Interfaces
|
|||
Task<IResponseOutput> AssignSiteCRC(List<AssginSiteCRCCommand> trialSiteCRCList);
|
||||
Task<IResponseOutput> DeleteSiteCRC(Guid id, bool isDelete);
|
||||
Task<IResponseOutput> DeleteTrialSite(Guid id);
|
||||
Task<IResponseOutput> EditTrialSite(Guid id, Guid trialId, string trialSiteCode, string? trialSiteAliasName);
|
||||
Task<PageOutput<SiteStatDTO>> GetSiteCRCList(SiteCrcQueryDTO param);
|
||||
Task<PageOutput<SiteStatSimpleDTO>> GetSiteCRCSimpleList(SiteCrcQueryDTO param);
|
||||
Task<PageOutput<TrialSiteScreeningDTO>> GetTrialSiteScreeningList(TrialSiteQuery trialSiteQuery);
|
||||
|
|
|
@ -31,8 +31,6 @@ namespace IRaCIS.Application.Services
|
|||
.WhereIf(param.UserTypeId!=null, t => t.User.UserTypeId==param.UserTypeId)
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(param.UserName), t => t.User.UserName.Contains(param.UserName))
|
||||
|
||||
//.WhereIf( param.JoinTime!=null, t => t.JoinTime.to ==param.JoinTime.ToString("yyyy-MM-dd"))
|
||||
//.WhereIf(param.RemoveTime!=null, t => t.RemoveTime.ToString("yyyy-MM-dd") == param.JoinTime.ToString("yyyy-MM-dd"))
|
||||
.WhereIf(param.IsDeleted != null, t => t.IsDeleted == param.IsDeleted)
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(param.OrganizationName), t => t.User.OrganizationName.Contains(param.OrganizationName))
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(param.UserRealName), t => (t.User.LastName + " / " + t.User.FirstName).Contains(param.UserRealName))
|
||||
|
|
|
@ -14,10 +14,12 @@ namespace IRaCIS.Core.Application.Services
|
|||
public class TrialMaintenanceService : BaseService, ITrialSiteService
|
||||
{
|
||||
private readonly IRepository<TrialSite> _trialSiteRepository;
|
||||
private readonly IRepository<TrialSiteUser> _trialSiteUserRepository;
|
||||
|
||||
public TrialMaintenanceService(IRepository<TrialSite> trialSiteRepository)
|
||||
public TrialMaintenanceService(IRepository<TrialSite> trialSiteRepository,IRepository<TrialSiteUser> trialSiteUserRepository)
|
||||
{
|
||||
_trialSiteRepository = trialSiteRepository;
|
||||
_trialSiteUserRepository = trialSiteUserRepository;
|
||||
}
|
||||
|
||||
/// <summary>Pannel 进去 SiteTab </summary>
|
||||
|
@ -71,7 +73,7 @@ namespace IRaCIS.Core.Application.Services
|
|||
[HttpGet, Route("{trialId:guid}/{siteId:guid}")]
|
||||
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 = _trialSiteUserRepository.Where(t => t.TrialId == trialId && t.SiteId == siteId).IgnoreQueryFilters()
|
||||
.ProjectTo<UserTrialDTO>(_mapper.ConfigurationProvider);
|
||||
|
||||
return await query.ToListAsync();
|
||||
|
@ -149,6 +151,8 @@ namespace IRaCIS.Core.Application.Services
|
|||
//{
|
||||
// return ResponseOutput.NotOk("The site has been uploaded study, and couldn't be deleted.");
|
||||
//}
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -168,30 +172,47 @@ 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>
|
||||
[UnitOfWork]
|
||||
[HttpPost("{trialId:guid}/{id:guid}/{trialSiteCode}/{trialSiteAliasName?}")]
|
||||
|
||||
/// <summary> 批量添加Site下 CRC的负责人 </summary>
|
||||
[HttpPost]
|
||||
[TrialAudit(AuditType.TrialAudit, AuditOptType.AddTrialSiteCRC)]
|
||||
[TypeFilter(typeof(TrialResourceFilter))]
|
||||
[Obsolete]
|
||||
public async Task<IResponseOutput> EditTrialSite(Guid id, Guid trialId, string trialSiteCode, string? trialSiteAliasName)
|
||||
public async Task<IResponseOutput> AssignSiteCRC(List<AssginSiteCRCCommand> trialSiteCRCList)
|
||||
{
|
||||
var addArray = _mapper.Map<List<TrialSiteUser>>(trialSiteCRCList);
|
||||
|
||||
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");
|
||||
}
|
||||
await _repository.AddRangeAsync(addArray);
|
||||
|
||||
await _trialSiteRepository.UpdateFromQueryAsync(t => t.Id == id, u => new TrialSite() { TrialSiteCode = trialSiteCode, TrialSiteAliasName = trialSiteAliasName ?? String.Empty });
|
||||
await _repository.SaveChangesAsync();
|
||||
return ResponseOutput.Result(await _repository.SaveChangesAsync());
|
||||
}
|
||||
|
||||
return ResponseOutput.Ok();
|
||||
/// <summary> 删除CRC人员</summary>
|
||||
[HttpDelete, Route("{id:guid}/{trialId:guid}/{isDelete:bool}")]
|
||||
[TypeFilter(typeof(TrialResourceFilter))]
|
||||
public async Task<IResponseOutput> DeleteSiteCRC(Guid id, bool isDelete)
|
||||
{
|
||||
var isSuccess = await _repository.UpdateFromQueryAsync<TrialSiteUser>(u => u.Id == id, u => new TrialSiteUser()
|
||||
{ IsDeleted = isDelete, DeletedTime = isDelete ? DateTime.Now : null });
|
||||
|
||||
return ResponseOutput.Result(isSuccess);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取项目下的 site 下拉框数据 CRC只看到他负责的
|
||||
/// </summary>
|
||||
/// <param name="trialId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("{trialId:guid}")]
|
||||
public async Task<IEnumerable<TrialSiteForSelect>> GetTrialSiteSelect(Guid trialId)
|
||||
{
|
||||
//CRC只看到他负责的
|
||||
|
||||
var list = await _trialSiteRepository.Where(t => t.TrialId == trialId)
|
||||
.WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator, t => t.CRCUserList.Any(t => t.UserId == _userInfo.Id))
|
||||
.ProjectTo<TrialSiteForSelect>(_mapper.ConfigurationProvider).OrderBy(t => t.TrialSiteCode).ToListAsync();
|
||||
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
|
@ -229,52 +250,5 @@ namespace IRaCIS.Core.Application.Services
|
|||
}
|
||||
|
||||
|
||||
|
||||
/// <summary> 批量添加Site下 CRC的负责人 </summary>
|
||||
[HttpPost]
|
||||
[TrialAudit(AuditType.TrialAudit, AuditOptType.AddTrialSiteCRC)]
|
||||
[TypeFilter(typeof(TrialResourceFilter))]
|
||||
public async Task<IResponseOutput> AssignSiteCRC(List<AssginSiteCRCCommand> trialSiteCRCList)
|
||||
{
|
||||
var addArray = _mapper.Map<List<TrialSiteUser>>(trialSiteCRCList);
|
||||
|
||||
await _repository.AddRangeAsync(addArray);
|
||||
|
||||
return ResponseOutput.Result(await _repository.SaveChangesAsync());
|
||||
}
|
||||
|
||||
/// <summary> 删除CRC人员</summary>
|
||||
[HttpDelete, Route("{id:guid}/{trialId:guid}/{isDelete:bool}")]
|
||||
|
||||
//[TrialAudit(AuditType.TrialAudit, AuditOptType.DeleteTrialSiteCRC)]
|
||||
[TypeFilter(typeof(TrialResourceFilter))]
|
||||
public async Task<IResponseOutput> DeleteSiteCRC(Guid id, bool isDelete)
|
||||
{
|
||||
var isSuccess = await _repository.UpdateFromQueryAsync<TrialSiteUser>(u => u.Id == id, u => new TrialSiteUser()
|
||||
{ IsDeleted = isDelete, RemoveTime = isDelete ? DateTime.Now : null });
|
||||
|
||||
return ResponseOutput.Result(isSuccess);
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取项目下的 site 下拉框数据 CRC只看到他负责的
|
||||
/// </summary>
|
||||
/// <param name="trialId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("{trialId:guid}")]
|
||||
public async Task<IEnumerable<TrialSiteForSelect>> GetTrialSiteSelect(Guid trialId)
|
||||
{
|
||||
//CRC只看到他负责的
|
||||
|
||||
var list = await _trialSiteRepository.Where(t => t.TrialId == trialId)
|
||||
.WhereIf(_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ClinicalResearchCoordinator, t => t.CRCUserList.Any(t => t.UserId == _userInfo.Id))
|
||||
.ProjectTo<TrialSiteForSelect>(_mapper.ConfigurationProvider).OrderBy(t => t.TrialSiteCode).ToListAsync();
|
||||
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -2,10 +2,12 @@
|
|||
|
||||
namespace IRaCIS.Core.Domain.Models
|
||||
{
|
||||
|
||||
|
||||
|
||||
public interface ISoftDelete
|
||||
{
|
||||
bool IsDeleted { get; set; }
|
||||
|
||||
public DateTime? DeletedTime { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,6 +56,7 @@ namespace IRaCIS.Core.Domain.Models
|
|||
public DateTime UpdateTime { get; set; } = DateTime.Now;
|
||||
|
||||
public bool IsDeleted {get;set;}
|
||||
public DateTime? DeletedTime { get; set; }
|
||||
|
||||
public bool IsReading { get; set; } = true;
|
||||
|
||||
|
|
|
@ -100,6 +100,8 @@ namespace IRaCIS.Core.Domain.Models
|
|||
//软删除
|
||||
public bool IsDeleted { get; set; }
|
||||
|
||||
public DateTime? DeletedTime { get; set; }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ namespace IRaCIS.Core.Domain.Models
|
|||
public DateTime UpdateTime { get; set; }
|
||||
|
||||
public bool IsDeleted { get; set; }
|
||||
public DateTime? DeletedTime { get; set; }
|
||||
|
||||
|
||||
//导航属性
|
||||
|
|
|
@ -40,20 +40,13 @@ namespace IRaCIS.Core.Domain.Models
|
|||
|
||||
public bool IsDeleted { get; set; }
|
||||
|
||||
public DateTime? DeletedTime { get; set; }
|
||||
|
||||
public DateTime? RemoveTime { get; set; }
|
||||
|
||||
|
||||
|
||||
|
||||
//public Guid UserTypeId { get; set; }
|
||||
//public string UserType { get; set; } = string.Empty;
|
||||
//public string UserRealName { get; set; } = string.Empty;
|
||||
//public UserType UserTypeEnum { get; set; }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
[ForeignKey("UserId")]
|
||||
|
@ -68,11 +61,6 @@ namespace IRaCIS.Core.Domain.Models
|
|||
|
||||
|
||||
|
||||
//public DicomStudy DicomStudy { get; set; }
|
||||
|
||||
//public Subject Subject {get;set;}
|
||||
|
||||
//TrialId 不管 其实就是 User和Site 的中间关系表
|
||||
[ForeignKey("SiteId")]
|
||||
public TrialSite TrialSite { get; set; }
|
||||
|
||||
|
|
|
@ -23,19 +23,6 @@ namespace IRaCIS.Core.Domain.Models
|
|||
public List<TrialSiteUser> SiteList { get; set; }
|
||||
|
||||
|
||||
// 0 表示参与 1 表示暂停
|
||||
//public int JoinState { get; set; }
|
||||
|
||||
//已经确认的 项目文档
|
||||
//public List<TrialDocUserTypeConfirmedUser> TrialDocUserConfirmedList { get; set; }
|
||||
//////一个用户 肯定对应一个用户类型 通过用户的UserTypeId 作为关联 弱关系 手动配置
|
||||
//public TrialDocNeedConfirmedUserType TrialDocNeedConfirmedUserType { get; set; }
|
||||
//public List<TrialDocument> TrialDocumentList { get; set; }
|
||||
//public Guid UserTypeId { get; set; }
|
||||
//public string UserRealName { get; set; }
|
||||
//public string UserType { get; set; }
|
||||
//public UserType UserTypeEnum { get; set; }
|
||||
|
||||
|
||||
public Guid UpdateUserId { get; set; }
|
||||
public DateTime UpdateTime { get; set; }
|
||||
|
@ -44,6 +31,9 @@ namespace IRaCIS.Core.Domain.Models
|
|||
|
||||
public bool IsDeleted { get; set; }
|
||||
|
||||
public DateTime? DeletedTime { get; set; }
|
||||
|
||||
|
||||
public DateTime? RemoveTime { get; set; }
|
||||
|
||||
public DateTime? JoinTime { get; set; }
|
||||
|
|
|
@ -305,6 +305,15 @@ namespace IRaCIS.Core.Infra.EFCore
|
|||
updateEntity1.UpdateTime = DateTime.UtcNow.AddHours(8);
|
||||
updateEntity1.UpdateUserId = _userInfo.Id;
|
||||
}
|
||||
|
||||
if(t.Entity is ISoftDelete updateEntity2)
|
||||
{
|
||||
if (updateEntity2.IsDeleted == true)
|
||||
{
|
||||
updateEntity2.DeletedTime = DateTime.UtcNow.AddHours(8);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
//添加的时候,更新审计字段也赋值
|
||||
case EntityState.Added:
|
||||
|
|
Loading…
Reference in New Issue