diff --git a/IRaCIS.Core.Application/Service/Institution/DTO/SiteModel.cs b/IRaCIS.Core.Application/Service/Institution/DTO/SiteModel.cs index 794f4efa5..2700f5141 100644 --- a/IRaCIS.Core.Application/Service/Institution/DTO/SiteModel.cs +++ b/IRaCIS.Core.Application/Service/Institution/DTO/SiteModel.cs @@ -29,6 +29,8 @@ namespace IRaCIS.Application.Contracts public string DirectorPhone { get; set; } = string.Empty; public string ContactName { get; set; } = string.Empty; public string ContactPhone { get; set; } = string.Empty; + + public Guid? TrialSiteId { get; set; } } public class SiteSelectionDTO @@ -44,6 +46,17 @@ namespace IRaCIS.Application.Contracts public string Country { get; set; } = String.Empty; } + + public class TrialSiteAddView + { + public Guid TrialSiteId { get; set; } + public string TrialCode { get; set; } + + public string TrialSiteName { get; set; } + + public string TrialSiteAliasName { get; set; } = String.Empty; + } + public class SiteSelectDTO : SiteDTO { public string HospitalName { get; set; } = String.Empty; diff --git a/IRaCIS.Core.Application/Service/Institution/SiteService.cs b/IRaCIS.Core.Application/Service/Institution/SiteService.cs index f8cce2a48..32df16d12 100644 --- a/IRaCIS.Core.Application/Service/Institution/SiteService.cs +++ b/IRaCIS.Core.Application/Service/Institution/SiteService.cs @@ -5,6 +5,8 @@ using Microsoft.AspNetCore.Mvc; using IRaCIS.Core.Domain.Share; using Medallion.Threading; using IRaCIS.Core.Domain.Models; +using System.Security.Policy; +using Site = IRaCIS.Core.Domain.Models.Site; namespace IRaCIS.Application.Services { @@ -21,7 +23,7 @@ namespace IRaCIS.Application.Services _siteRepository = siteRepository; _trialSiteUserRepository = trialSiteUserRepository; _distributedLockProvider = distributedLockProvider; - _hospitalRepository= hospitalRepository; + _hospitalRepository = hospitalRepository; } /// 分页获取研究中心列表 @@ -35,7 +37,7 @@ namespace IRaCIS.Application.Services .WhereIf(!string.IsNullOrWhiteSpace(searchModel.City), t => t.City.Contains(searchModel.City)) .WhereIf(!string.IsNullOrWhiteSpace(searchModel.Country), t => t.Country.Contains(searchModel.Country)) .WhereIf(!string.IsNullOrWhiteSpace(searchModel.Province), t => t.Province.Contains(searchModel.Province)) - .ProjectTo(_mapper.ConfigurationProvider, new { isEn_Us = _userInfo.IsEn_Us }); + .ProjectTo(_mapper.ConfigurationProvider, new { isEn_Us = _userInfo.IsEn_Us }); return await siteQueryable.ToPagedListAsync(searchModel.PageIndex, searchModel.PageSize, string.IsNullOrWhiteSpace(searchModel.SortField) ? "SiteName" : searchModel.SortField, searchModel.Asc); @@ -49,6 +51,17 @@ namespace IRaCIS.Application.Services } + public async Task> GetTrialSiteList() + { + return _repository.Where(t => t.SiteId == null).Select(t => new TrialSiteAddView() + { + TrialCode = t.Trial.TrialCode, + TrialSiteAliasName = t.TrialSiteAliasName, + TrialSiteId = t.Id, + TrialSiteName = t.TrialSiteName + }).ToList(); + } + /// 添加研究中心 public async Task AddOrUpdateSite(SiteCommand siteCommand) @@ -56,7 +69,7 @@ namespace IRaCIS.Application.Services var exp = new EntityVerifyExp() { - VerifyExp = h => h.SiteName.Equals(siteCommand.SiteName) || h.SiteCode.Equals(siteCommand.SiteCode), + VerifyExp = h => h.SiteName.Equals(siteCommand.SiteName) || h.SiteNameCN.Equals(siteCommand.SiteNameCN), //---已经存在同名的中心,请确认。 VerifyMsg = _localizer["Site_DupName"] }; @@ -82,15 +95,22 @@ namespace IRaCIS.Application.Services } //手动绑 - if(siteCommand.HospitalId != null) + if (siteCommand.HospitalId != null) { await _hospitalRepository.BatchUpdateNoTrackingAsync(t => t.Id == siteCommand.HospitalId, u => new Hospital() { SiteId = site.Id }); } + if (siteCommand.TrialSiteId != null) + { + await _repository.BatchUpdateAsync(t => t.Id == siteCommand.TrialSiteId, u => new TrialSite() { SiteId = site.Id }); + } + return ResponseOutput.Ok(site.Id.ToString()); } + + } /// 删除研究中心 diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/TrialSiteViewModel.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/TrialSiteViewModel.cs index 7006e529e..ec296769e 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/TrialSiteViewModel.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/DTO/TrialSiteViewModel.cs @@ -19,7 +19,6 @@ namespace IRaCIS.Core.Application.Contracts.DTO public string UserKeyInfo { get; set; } = String.Empty; - } public class SiteCRCExportQueryDTO