修改仓储
parent
31f90660d3
commit
aa18ce52f2
|
@ -40,7 +40,7 @@ namespace IRaCIS.Application.Services
|
|||
public async Task<PageOutput<BasicDicView>> GetBasicDicList(BasicDicQuery basicDicQuery)
|
||||
{
|
||||
|
||||
var systemBasicDataQueryable = _repository.GetQueryable<Dictionary>().Where(t => t.ParentId == null)
|
||||
var systemBasicDataQueryable = _dicRepository.Where(t => t.ParentId == null)
|
||||
.WhereIf(!string.IsNullOrEmpty(basicDicQuery.Code), t => t.Code.Contains(basicDicQuery.Code!))
|
||||
.WhereIf(!string.IsNullOrEmpty(basicDicQuery.KeyName), t => t.KeyName.Contains(basicDicQuery.KeyName!))
|
||||
.WhereIf(basicDicQuery.ConfigTypeId != null, t => t.ConfigTypeId == basicDicQuery.ConfigTypeId!)
|
||||
|
@ -75,7 +75,7 @@ namespace IRaCIS.Application.Services
|
|||
[HttpGet("{parentId:guid}")]
|
||||
public async Task<List<BasicDicView>> GetChildList(Guid parentId)
|
||||
{
|
||||
return await _repository.GetQueryable<Dictionary>().Where(t => t.ParentId == parentId)
|
||||
return await _dicRepository.Where(t => t.ParentId == parentId)
|
||||
.OrderBy(t => t.ShowOrder).ProjectTo<BasicDicView>(_mapper.ConfigurationProvider).ToListAsync();
|
||||
}
|
||||
|
||||
|
@ -89,7 +89,7 @@ namespace IRaCIS.Application.Services
|
|||
public async Task<Dictionary<string, List<BasicDicSelect>>> GetBasicDataSelect(string[] searchArray)
|
||||
{
|
||||
|
||||
var searchList = await _repository.GetQueryable<Dictionary>().Where(t => searchArray.Contains(t.Parent.Code) && t.ParentId != null && t.IsEnable).ProjectTo<BasicDicSelect>(_mapper.ConfigurationProvider).ToListAsync();
|
||||
var searchList = await _dicRepository.Where(t => searchArray.Contains(t.Parent.Code) && t.ParentId != null && t.IsEnable).ProjectTo<BasicDicSelect>(_mapper.ConfigurationProvider).ToListAsync();
|
||||
|
||||
return searchList.GroupBy(t => t.ParentCode).ToDictionary(g => g.Key, g => g.ToList());
|
||||
|
||||
|
@ -97,7 +97,7 @@ namespace IRaCIS.Application.Services
|
|||
|
||||
public async Task<List<BasicDicSelect>> GetBasicDataSelect(string searchKey)
|
||||
{
|
||||
var searchList = await _repository.GetQueryable<Dictionary>().Where(t => t.Parent.Code== searchKey && t.ParentId != null && t.IsEnable).ProjectTo<BasicDicSelect>(_mapper.ConfigurationProvider).ToListAsync();
|
||||
var searchList = await _dicRepository.Where(t => t.Parent.Code== searchKey && t.ParentId != null && t.IsEnable).ProjectTo<BasicDicSelect>(_mapper.ConfigurationProvider).ToListAsync();
|
||||
|
||||
return searchList;
|
||||
}
|
||||
|
|
|
@ -14,6 +14,11 @@ namespace IRaCIS.Core.Application.Services
|
|||
[ApiExplorerSettings(GroupName = "Common")]
|
||||
public class SystemBasicDataService : BaseService, ISystemBasicDataService
|
||||
{
|
||||
private readonly IRepository<SystemBasicData> _systemBasicDataRepository;
|
||||
|
||||
public SystemBasicDataService(IRepository<SystemBasicData> systemBasicDataRepository) {
|
||||
this._systemBasicDataRepository = systemBasicDataRepository;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
|
@ -24,7 +29,7 @@ namespace IRaCIS.Core.Application.Services
|
|||
[HttpPost]
|
||||
public async Task<PageOutput<SystemBasicDataView>> GetSystemBasicDataList(SystemBasicDataQuery querySystemBasicData)
|
||||
{
|
||||
var systemBasicDataQueryable = _repository.GetQueryable<SystemBasicData>().Where(t => t.ParentId == null)
|
||||
var systemBasicDataQueryable = _systemBasicDataRepository.Where(t => t.ParentId == null)
|
||||
.ProjectTo<SystemBasicDataView>(_mapper.ConfigurationProvider);
|
||||
|
||||
return await systemBasicDataQueryable.ToPagedListAsync(querySystemBasicData.PageIndex, querySystemBasicData.PageSize, String.IsNullOrEmpty(querySystemBasicData.SortField) ? "Code" : querySystemBasicData.SortField, querySystemBasicData.Asc);
|
||||
|
@ -46,7 +51,7 @@ namespace IRaCIS.Core.Application.Services
|
|||
[HttpGet("{parentId:guid}")]
|
||||
public async Task<List<SystemBasicDataView>> GetChildList(Guid parentId)
|
||||
{
|
||||
return await _repository.GetQueryable<SystemBasicData>().Where(t => t.ParentId == parentId&&t.IsEnable).OrderBy(t => t.Code).ProjectTo<SystemBasicDataView>(_mapper.ConfigurationProvider).ToListAsync();
|
||||
return await _systemBasicDataRepository.Where(t => t.ParentId == parentId&&t.IsEnable).OrderBy(t => t.Code).ProjectTo<SystemBasicDataView>(_mapper.ConfigurationProvider).ToListAsync();
|
||||
}
|
||||
|
||||
|
||||
|
@ -78,7 +83,7 @@ namespace IRaCIS.Core.Application.Services
|
|||
public async Task<Dictionary<string, List<SystemBasicDataSelect>>> GetBasicDataSelect(string[] searchArray)
|
||||
{
|
||||
|
||||
var searchList = await _repository.GetQueryable<SystemBasicData>().Where(t => searchArray.Contains(t.Parent.Code) && t.ParentId != null).ProjectTo<SystemBasicDataSelect>(_mapper.ConfigurationProvider).ToListAsync();
|
||||
var searchList = await _systemBasicDataRepository.Where(t => searchArray.Contains(t.Parent.Code) && t.ParentId != null).ProjectTo<SystemBasicDataSelect>(_mapper.ConfigurationProvider).ToListAsync();
|
||||
|
||||
return searchList.GroupBy(t => t.ParentCode).ToDictionary(g => g.Key, g => g.ToList());
|
||||
|
||||
|
|
|
@ -219,7 +219,7 @@ namespace IRaCIS.Application.Services
|
|||
[HttpPost("{doctorId:guid}/{attachmentId:guid}/{language}")]
|
||||
public async Task<IResponseOutput> SetOfficial(Guid doctorId, Guid attachmentId, int language)
|
||||
{
|
||||
var resumeList = await _repository.GetQueryable<Attachment>().Where(t => t.DoctorId == doctorId && t.Type == "Resume" && t.Language == language).ToListAsync();
|
||||
var resumeList = await _attachmentrepository.Where(t => t.DoctorId == doctorId && t.Type == "Resume" && t.Language == language).ToListAsync();
|
||||
foreach (var item in resumeList)
|
||||
{
|
||||
if (item.Id == attachmentId) item.IsOfficial = true;
|
||||
|
|
|
@ -75,7 +75,7 @@ namespace IRaCIS.Application.Services
|
|||
return ResponseOutput.NotOk("The current email already existed!", new DoctorBasicInfoCommand());
|
||||
}
|
||||
|
||||
doctor.Code = await _repository.GetQueryable<Doctor>().MaxAsync(t => t.Code) + 1;
|
||||
doctor.Code = (await _doctorRepository.MaxAsync(t => t.Code)) + 1;
|
||||
|
||||
doctor.ReviewerCode = AppSettings.CodePrefix + doctor.Code.ToString("D4");
|
||||
|
||||
|
@ -425,7 +425,7 @@ namespace IRaCIS.Application.Services
|
|||
{
|
||||
var userId = _userInfo.Id;
|
||||
//判断 合作协议、正式简历 是否有。如果没有,显示提示信息,并且不能保存
|
||||
var attachmentList = await _repository.GetQueryable<Attachment>().Where(u => u.DoctorId == auditResumeParam.Id)
|
||||
var attachmentList = await _attachmentRepository.Where(u => u.DoctorId == auditResumeParam.Id)
|
||||
.Select(u => u.Type).ToListAsync();
|
||||
if (auditResumeParam.ResumeStatus == ResumeStatusEnum.Pass && ((!attachmentList.Contains("Resume")) || (!attachmentList.Contains("Consultant Agreement"))))
|
||||
{
|
||||
|
|
|
@ -31,7 +31,7 @@ namespace IRaCIS.Application.Services
|
|||
var educationList = await _educationRepository.Where(o => o.DoctorId == doctorId)
|
||||
.OrderBy(t => t.CreateTime).ProjectTo<EducationInfoViewModel>(_mapper.ConfigurationProvider).ToListAsync();
|
||||
|
||||
var postgraduateList = await _repository.GetQueryable<Postgraduate>().Where(o => o.DoctorId == doctorId)
|
||||
var postgraduateList = await _postgraduateRepository.Where(o => o.DoctorId == doctorId)
|
||||
.OrderBy(t => t.CreateTime).ProjectTo<PostgraduateViewModel>(_mapper.ConfigurationProvider).ToListAsync();
|
||||
|
||||
|
||||
|
|
|
@ -22,12 +22,15 @@ namespace IRaCIS.Core.Application.Services
|
|||
|
||||
|
||||
private readonly IWebHostEnvironment _hostEnvironment;
|
||||
private readonly IRepository<TrialDocument> trialDocumentRepository;
|
||||
private readonly IRepository<TrialDocument> _trialDocumentRepository;
|
||||
private readonly IRepository<SystemDocConfirmedUser> _systemDocConfirmedUserRepository;
|
||||
|
||||
public TrialDocumentService(IWebHostEnvironment hostEnvironment, IRepository<TrialDocument> trialDocumentRepository)
|
||||
public TrialDocumentService(IWebHostEnvironment hostEnvironment, IRepository<TrialDocument> trialDocumentRepository
|
||||
, IRepository<SystemDocConfirmedUser> systemDocConfirmedUserRepository)
|
||||
{
|
||||
_hostEnvironment = hostEnvironment;
|
||||
this.trialDocumentRepository = trialDocumentRepository;
|
||||
this._trialDocumentRepository = trialDocumentRepository;
|
||||
this._systemDocConfirmedUserRepository = systemDocConfirmedUserRepository;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -39,7 +42,7 @@ namespace IRaCIS.Core.Application.Services
|
|||
public async Task<PageOutput<TrialDocumentView>> GetTrialDocumentList(TrialDocumentQuery queryTrialDocument)
|
||||
{
|
||||
|
||||
var trialDocumentQueryable = trialDocumentRepository.Where(t => t.TrialId == queryTrialDocument.TrialId)
|
||||
var trialDocumentQueryable = _trialDocumentRepository.Where(t => t.TrialId == queryTrialDocument.TrialId)
|
||||
.WhereIf(!string.IsNullOrEmpty(queryTrialDocument.Name), t => t.Name.Contains(queryTrialDocument.Name))
|
||||
.WhereIf(!string.IsNullOrEmpty(queryTrialDocument.Type), t => t.Type.Contains(queryTrialDocument.Type))
|
||||
.ProjectTo<TrialDocumentView>(_mapper.ConfigurationProvider, new { token = _userInfo.UserToken });
|
||||
|
@ -152,7 +155,7 @@ namespace IRaCIS.Core.Application.Services
|
|||
};
|
||||
|
||||
//项目文档查询
|
||||
var trialDocQueryable = from trialDoc in trialDocumentRepository.Where(t => t.TrialId == querySystemDocument.TrialId)
|
||||
var trialDocQueryable = from trialDoc in _trialDocumentRepository.Where(t => t.TrialId == querySystemDocument.TrialId)
|
||||
.WhereIf(!_userInfo.IsAdmin, t => t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId))
|
||||
.WhereIf(!_userInfo.IsAdmin, t => t.IsAbandon == false || (t.IsAbandon == true && t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id)))
|
||||
|
||||
|
@ -218,7 +221,7 @@ namespace IRaCIS.Core.Application.Services
|
|||
};
|
||||
|
||||
//项目文档查询
|
||||
var trialDocQueryable = from trialDoc in trialDocumentRepository.Where(t => t.TrialId == trialId)
|
||||
var trialDocQueryable = from trialDoc in _trialDocumentRepository.Where(t => t.TrialId == trialId)
|
||||
.WhereIf(!_userInfo.IsAdmin, t => t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId))
|
||||
.WhereIf(!_userInfo.IsAdmin, t => t.IsAbandon == false || (t.IsAbandon == true && t.TrialDocConfirmedUserList.Any(t => t.ConfirmUserId == _userInfo.Id)))
|
||||
|
||||
|
@ -372,7 +375,7 @@ namespace IRaCIS.Core.Application.Services
|
|||
[HttpGet("{trialId:guid}")]
|
||||
public async Task<List<string>> GetTrialDocAndSystemDocType(Guid trialId)
|
||||
{
|
||||
return await trialDocumentRepository.Where(t => t.TrialId == trialId).Select(t => t.Type).Union(_repository.GetQueryable<SystemDocument>().Select(t => t.Type)).Distinct()
|
||||
return await _trialDocumentRepository.Where(t => t.TrialId == trialId).Select(t => t.Type).Union(_repository.GetQueryable<SystemDocument>().Select(t => t.Type)).Distinct()
|
||||
|
||||
.ToListAsync();
|
||||
}
|
||||
|
@ -384,7 +387,7 @@ namespace IRaCIS.Core.Application.Services
|
|||
var entity = _mapper.Map<TrialDocument>(addOrEditTrialDocument);
|
||||
|
||||
|
||||
if (await trialDocumentRepository.AnyAsync(t => t.Type == addOrEditTrialDocument.Type && t.Name == addOrEditTrialDocument.Name && t.TrialId == addOrEditTrialDocument.TrialId))
|
||||
if (await _trialDocumentRepository.AnyAsync(t => t.Type == addOrEditTrialDocument.Type && t.Name == addOrEditTrialDocument.Name && t.TrialId == addOrEditTrialDocument.TrialId))
|
||||
{
|
||||
return ResponseOutput.NotOk("同类型已存在该文件名");
|
||||
}
|
||||
|
@ -394,12 +397,12 @@ namespace IRaCIS.Core.Application.Services
|
|||
}
|
||||
else
|
||||
{
|
||||
if (await trialDocumentRepository.AnyAsync(t => t.Type == addOrEditTrialDocument.Type && t.Name == addOrEditTrialDocument.Name && t.Id != addOrEditTrialDocument.Id && t.TrialId == addOrEditTrialDocument.TrialId))
|
||||
if (await _trialDocumentRepository.AnyAsync(t => t.Type == addOrEditTrialDocument.Type && t.Name == addOrEditTrialDocument.Name && t.Id != addOrEditTrialDocument.Id && t.TrialId == addOrEditTrialDocument.TrialId))
|
||||
{
|
||||
return ResponseOutput.NotOk("同类型已存在该文件名");
|
||||
}
|
||||
|
||||
var document = trialDocumentRepository.Where(t => t.Id == addOrEditTrialDocument.Id, true).Include(t => t.NeedConfirmedUserTypeList).FirstOrDefault();
|
||||
var document = _trialDocumentRepository.Where(t => t.Id == addOrEditTrialDocument.Id, true).Include(t => t.NeedConfirmedUserTypeList).FirstOrDefault();
|
||||
|
||||
if (document == null) return Null404NotFound(document);
|
||||
|
||||
|
@ -442,12 +445,12 @@ namespace IRaCIS.Core.Application.Services
|
|||
[HttpDelete("{trialId:guid}/{trialDocumentId:guid}")]
|
||||
public async Task<IResponseOutput> DeleteTrialDocument(Guid trialDocumentId, Guid trialId)
|
||||
{
|
||||
if (await trialDocumentRepository.Where(t => t.Id == trialDocumentId).AnyAsync(t => t.TrialDocConfirmedUserList.Any()))
|
||||
if (await _trialDocumentRepository.Where(t => t.Id == trialDocumentId).AnyAsync(t => t.TrialDocConfirmedUserList.Any()))
|
||||
{
|
||||
return ResponseOutput.NotOk("该文档,已有用户签名 不允许删除");
|
||||
}
|
||||
|
||||
var success = await trialDocumentRepository.DeleteFromQueryAsync(t => t.Id == trialDocumentId);
|
||||
var success = await _trialDocumentRepository.DeleteFromQueryAsync(t => t.Id == trialDocumentId);
|
||||
|
||||
return ResponseOutput.Result(success);
|
||||
}
|
||||
|
@ -508,7 +511,7 @@ namespace IRaCIS.Core.Application.Services
|
|||
{
|
||||
return ResponseOutput.NotOk("该文档已经签名");
|
||||
}
|
||||
if (!await _repository.AnyAsync<SystemDocument>(t => t.Id == userConfirmCommand.DocumentId) || await trialDocumentRepository.AnyAsync(t => t.Id == userConfirmCommand.DocumentId && t.IsAbandon))
|
||||
if (!await _repository.AnyAsync<SystemDocument>(t => t.Id == userConfirmCommand.DocumentId) || await _trialDocumentRepository.AnyAsync(t => t.Id == userConfirmCommand.DocumentId && t.IsAbandon))
|
||||
{
|
||||
return ResponseOutput.NotOk("文件已删除或者废除,签署失败!");
|
||||
}
|
||||
|
@ -522,7 +525,7 @@ namespace IRaCIS.Core.Application.Services
|
|||
return ResponseOutput.NotOk("该文档已经签名");
|
||||
}
|
||||
|
||||
if (!await trialDocumentRepository.AnyAsync(t => t.Id == userConfirmCommand.DocumentId) || await _repository.AnyAsync<TrialDocument>(t => t.Id == userConfirmCommand.DocumentId && t.IsAbandon))
|
||||
if (!await _trialDocumentRepository.AnyAsync(t => t.Id == userConfirmCommand.DocumentId) || await _repository.AnyAsync<TrialDocument>(t => t.Id == userConfirmCommand.DocumentId && t.IsAbandon))
|
||||
{
|
||||
return ResponseOutput.NotOk("文件已删除或者废除,签署失败!");
|
||||
}
|
||||
|
@ -551,7 +554,7 @@ namespace IRaCIS.Core.Application.Services
|
|||
}
|
||||
else
|
||||
{
|
||||
await trialDocumentRepository.UpdateFromQueryAsync(t => t.Id == documentId, u => new TrialDocument() { IsAbandon = true });
|
||||
await _trialDocumentRepository.UpdateFromQueryAsync(t => t.Id == documentId, u => new TrialDocument() { IsAbandon = true });
|
||||
}
|
||||
return ResponseOutput.Ok();
|
||||
}
|
||||
|
@ -612,7 +615,7 @@ namespace IRaCIS.Core.Application.Services
|
|||
DocumentUserCount = t.NeedConfirmedUserTypeList.SelectMany(u => u.UserTypeRole.UserList.SelectMany(b => b.UserTrials.Where(r => r.TrialId == querySystemDocument.TrialId))).Count()
|
||||
});
|
||||
|
||||
var trialDocQueryable = trialDocumentRepository.Where(t => t.TrialId == querySystemDocument.TrialId).Select(t => new DocumentUnionWithUserStatView()
|
||||
var trialDocQueryable = _trialDocumentRepository.Where(t => t.TrialId == querySystemDocument.TrialId).Select(t => new DocumentUnionWithUserStatView()
|
||||
{
|
||||
Id = t.Id,
|
||||
IsSystemDoc = false,
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace IRaCIS.Core.Application.Service.Inspection
|
|||
{
|
||||
public InspectionService()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
public async Task<PageOutput<GetDataInspectionOutDto>> GetInspectionData(GetDataInspectionDto dto)
|
||||
{
|
||||
|
@ -127,39 +127,7 @@ namespace IRaCIS.Core.Application.Service.Inspection
|
|||
.WhereIf(dto.SiteId != null, x => x.SiteId == dto.SiteId);
|
||||
#endregion
|
||||
|
||||
#region 测试
|
||||
//var query = from data in _repository.GetQueryable<DataInspection>()
|
||||
|
||||
// join parent in _repository.GetQueryable<DataInspection>() on data.ParentId equals parent.Id into parenttemp
|
||||
// from leftparent in parenttemp.DefaultIfEmpty()
|
||||
// join subjectVisit in _repository.GetQueryable<SubjectVisit>() on data.SubjectVisitId equals subjectVisit.Id into subjectVisittemp
|
||||
|
||||
// from leftsubjectVisit in subjectVisittemp.DefaultIfEmpty()
|
||||
// select new GetDataInspectionOutDto()
|
||||
// {
|
||||
// CreateTime = data.CreateTime,
|
||||
// CreateUserId = data.CreateUserId,
|
||||
// ModuleType = data.ModuleType,
|
||||
// BlindName = data.BlindName,
|
||||
// TrialId = data.TrialId,
|
||||
// SiteId = data.SiteId,
|
||||
// SubjectId = data.SubjectId,
|
||||
// SubjectVisitId = data.SubjectVisitId,
|
||||
// OptType = data.OptType,
|
||||
// IP = data.IP,
|
||||
// Reason = data.Reason,
|
||||
// IsSign = data.IsSign,
|
||||
// SignId = data.SignId,
|
||||
// ParentId = data.ParentId,
|
||||
// ChildrenType = data.ChildrenType,
|
||||
// JsonDetail = data.JsonDetail,
|
||||
// VisitName = leftsubjectVisit.VisitName,
|
||||
// Id = data.Id,
|
||||
// ParentJson = leftparent.JsonDetail,
|
||||
|
||||
// };
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
dto.Asc = false;
|
||||
return await query.ToPagedListAsync(dto.PageIndex, dto.PageSize, "CreateTime", dto.Asc);
|
||||
|
|
|
@ -9,9 +9,12 @@ namespace IRaCIS.Application.Services
|
|||
public class CroService : BaseService, ICroService
|
||||
{
|
||||
private readonly IRepository<CRO> _croRepository;
|
||||
public CroService(IRepository<CRO> croRepository)
|
||||
private readonly IRepository<Trial> _trialRepository;
|
||||
|
||||
public CroService(IRepository<CRO> croRepository, IRepository<Trial> trialRepository)
|
||||
{
|
||||
_croRepository = croRepository;
|
||||
this._trialRepository = trialRepository;
|
||||
}
|
||||
|
||||
/// <summary> 分页获取CRO列表 </summary>
|
||||
|
@ -59,7 +62,7 @@ namespace IRaCIS.Application.Services
|
|||
[HttpDelete("{croCompanyId:guid}")]
|
||||
public async Task<IResponseOutput> DeleteCro(Guid cROCompanyId)
|
||||
{
|
||||
if (await _repository.GetQueryable<Trial>().AnyAsync(t => t.CROId == cROCompanyId))
|
||||
if (await _trialRepository.AnyAsync(t => t.CROId == cROCompanyId))
|
||||
{
|
||||
return ResponseOutput.NotOk("This CRO has participated in the trial and couldn't be deleted.");
|
||||
}
|
||||
|
|
|
@ -9,10 +9,12 @@ namespace IRaCIS.Application.Services
|
|||
public class HospitalService : BaseService, IHospitalService
|
||||
{
|
||||
private readonly IRepository<Hospital> _hospitalRepository;
|
||||
private readonly IRepository<Doctor> _doctorRepository;
|
||||
|
||||
public HospitalService(IRepository<Hospital> hospitalRepository)
|
||||
public HospitalService(IRepository<Hospital> hospitalRepository, IRepository<Doctor> doctorRepository)
|
||||
{
|
||||
_hospitalRepository = hospitalRepository;
|
||||
this._doctorRepository = doctorRepository;
|
||||
}
|
||||
|
||||
/// <summary> 获取所有医院列表 </summary>
|
||||
|
@ -43,7 +45,7 @@ namespace IRaCIS.Application.Services
|
|||
[HttpDelete("{hospitalId:guid}")]
|
||||
public async Task<IResponseOutput> DeleteHospital(Guid hospitalId)
|
||||
{
|
||||
if (await _repository.GetQueryable<Doctor>().AnyAsync(t => t.Id == hospitalId))
|
||||
if (await _doctorRepository.AnyAsync(t => t.Id == hospitalId))
|
||||
{
|
||||
return ResponseOutput.NotOk("There are already doctors registered in this hospital,and it couldn't be deleted");
|
||||
}
|
||||
|
|
|
@ -9,10 +9,12 @@ namespace IRaCIS.Application.Services
|
|||
public class SiteService : BaseService, ISiteService
|
||||
{
|
||||
private readonly IRepository<Site> _siteRepository;
|
||||
private readonly IRepository<TrialSiteUser> _trialSiteUserRepository;
|
||||
|
||||
public SiteService(IRepository<Site> siteRepository)
|
||||
public SiteService(IRepository<Site> siteRepository, IRepository<TrialSiteUser> trialSiteUserRepository)
|
||||
{
|
||||
_siteRepository = siteRepository;
|
||||
this._trialSiteUserRepository = trialSiteUserRepository;
|
||||
}
|
||||
|
||||
/// <summary> 分页获取研究中心列表 </summary>
|
||||
|
@ -62,7 +64,7 @@ namespace IRaCIS.Application.Services
|
|||
public async Task<IResponseOutput> DeleteSite(Guid siteId)
|
||||
{
|
||||
|
||||
if (_repository.GetQueryable<TrialSiteUser>().Any(t => t.SiteId == siteId))
|
||||
if (await _trialSiteUserRepository.AnyAsync(t => t.SiteId == siteId))
|
||||
{
|
||||
return ResponseOutput.NotOk("This site has participated in the trial and couldn't be deleted.");
|
||||
}
|
||||
|
|
|
@ -9,10 +9,12 @@ namespace IRaCIS.Application.Services
|
|||
public class SponsorService : BaseService, ISponsorService
|
||||
{
|
||||
private readonly IRepository<Sponsor> _sponsorRepository;
|
||||
private readonly IRepository<Trial> _trialRepository;
|
||||
|
||||
public SponsorService(IRepository<Sponsor> sponsorRepository)
|
||||
public SponsorService(IRepository<Sponsor> sponsorRepository, IRepository<Trial> trialRepository)
|
||||
{
|
||||
_sponsorRepository = sponsorRepository;
|
||||
this._trialRepository = trialRepository;
|
||||
}
|
||||
|
||||
/// <summary> 分页获取申办方列表 </summary>
|
||||
|
@ -63,7 +65,7 @@ namespace IRaCIS.Application.Services
|
|||
|
||||
public async Task<IResponseOutput> DeleteSponsor(Guid sponsorId)
|
||||
{
|
||||
if (await _repository.GetQueryable<Trial>().AnyAsync(t => t.CROId == sponsorId))
|
||||
if (await _trialRepository.AnyAsync(t => t.CROId == sponsorId))
|
||||
{
|
||||
return ResponseOutput.NotOk("This sponsor has participated in the trial and couldn't be deleted.");
|
||||
}
|
||||
|
|
|
@ -8,10 +8,12 @@ namespace IRaCIS.Application.Services
|
|||
public class MenuService : BaseService, IMenuService
|
||||
{
|
||||
private readonly IRepository<Menu> menuRepository;
|
||||
private readonly IRepository<UserTypeMenu> _userTypeMenuRepository;
|
||||
|
||||
public MenuService(IRepository<Menu> menuRepository)
|
||||
public MenuService(IRepository<Menu> menuRepository, IRepository<UserTypeMenu> userTypeMenuRepository)
|
||||
{
|
||||
this.menuRepository = menuRepository;
|
||||
this._userTypeMenuRepository = userTypeMenuRepository;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -165,7 +167,7 @@ namespace IRaCIS.Application.Services
|
|||
public async Task<List<MenuTreeNode>> GetUserMenuTree()
|
||||
{
|
||||
|
||||
var menuFunctionlist = await _repository.GetQueryable<UserTypeMenu>()
|
||||
var menuFunctionlist = await _userTypeMenuRepository
|
||||
.Where(t => t.UserTypeId == _userInfo.UserTypeId && (t.Menu.MenuType == "M" || t.Menu.MenuType == "C") && t.Menu.IsEnable)
|
||||
.ProjectTo<MenuTreeNode>(_mapper.ConfigurationProvider).ToListAsync();
|
||||
|
||||
|
@ -184,7 +186,7 @@ namespace IRaCIS.Application.Services
|
|||
public async Task<List<string>> GetUserPermissions()
|
||||
{
|
||||
|
||||
var list = await _repository.GetQueryable<UserTypeMenu>()
|
||||
var list = await _userTypeMenuRepository
|
||||
.Where(t => t.UserTypeId == _userInfo.UserTypeId && t.Menu.MenuType == "F")
|
||||
.Select(t => t.Menu.PermissionStr).ToListAsync();
|
||||
|
||||
|
|
|
@ -26,13 +26,16 @@ namespace IRaCIS.Core.Application.Image.QA
|
|||
|
||||
private readonly DicomFileStoreHelper _dicomFileStoreHelper;
|
||||
private readonly IRepository<SubjectVisit> _subjectVisitRepository;
|
||||
|
||||
private readonly IRepository<Trial> _trialRepository;
|
||||
private object _locker = new object();
|
||||
|
||||
public QCOperationService(DicomFileStoreHelper dicomFileStoreHelper, IRepository<SubjectVisit> subjectVisitRepository)
|
||||
public QCOperationService(DicomFileStoreHelper dicomFileStoreHelper, IRepository<SubjectVisit> subjectVisitRepository,
|
||||
IRepository<Trial> trialRepository
|
||||
)
|
||||
{
|
||||
_dicomFileStoreHelper = dicomFileStoreHelper;
|
||||
_subjectVisitRepository = subjectVisitRepository;
|
||||
this._trialRepository = trialRepository;
|
||||
}
|
||||
|
||||
#region QC质疑 以及回复 关闭
|
||||
|
@ -989,7 +992,7 @@ namespace IRaCIS.Core.Application.Image.QA
|
|||
|
||||
#region 处理验证
|
||||
|
||||
var trialConfig = await _repository.GetQueryable<Trial>()
|
||||
var trialConfig = await _trialRepository
|
||||
.Select(t => new { TrialId = t.Id, t.QCProcessEnum, t.IsImageConsistencyVerification })
|
||||
.FirstOrDefaultAsync(t => t.TrialId == trialId)
|
||||
.IfNullThrowException();
|
||||
|
@ -1086,7 +1089,7 @@ namespace IRaCIS.Core.Application.Image.QA
|
|||
[TypeFilter(typeof(TrialResourceFilter))]
|
||||
public async Task<IResponseOutput> CRCRequestToQC(CRCRequestToQCCommand cRCRequestToQCCommand)
|
||||
{
|
||||
var trialConfig = await _repository.GetQueryable<Trial>()
|
||||
var trialConfig = await _trialRepository
|
||||
.Select(t => new { TrialId = t.Id, t.QCProcessEnum, t.IsImageConsistencyVerification, t.IsUrgent, t.IsHaveFirstGiveMedicineDate, t.ClinicalInformationTransmissionEnum })
|
||||
.FirstOrDefaultAsync(t => t.TrialId == cRCRequestToQCCommand.TrialId);
|
||||
|
||||
|
@ -1218,7 +1221,7 @@ namespace IRaCIS.Core.Application.Image.QA
|
|||
}
|
||||
|
||||
|
||||
var trialConfig = await _repository.GetQueryable<Trial>()
|
||||
var trialConfig = await _trialRepository
|
||||
.Select(t => new { TrialId = t.Id, t.QCProcessEnum, t.IsImageConsistencyVerification })
|
||||
.FirstOrDefaultAsync(t => t.TrialId == trialId)
|
||||
.IfNullThrowException();
|
||||
|
@ -1506,7 +1509,7 @@ namespace IRaCIS.Core.Application.Image.QA
|
|||
return ResponseOutput.NotOk("重传完成 只允许CRC 设置!");
|
||||
}
|
||||
|
||||
var trialConfig = await _repository.GetQueryable<Trial>()
|
||||
var trialConfig = await _trialRepository
|
||||
.Select(t => new { TrialId = t.Id, t.QCProcessEnum, t.IsImageConsistencyVerification, t.IsUrgent, t.IsHaveFirstGiveMedicineDate, t.ClinicalInformationTransmissionEnum })
|
||||
.FirstOrDefaultAsync(t => t.TrialId == cRCReuploadFinishedCommand.TrialId);
|
||||
|
||||
|
|
|
@ -17,13 +17,18 @@ namespace IRaCIS.Application.Services
|
|||
|
||||
private readonly IEasyCachingProvider _provider;
|
||||
private readonly IRepository<Trial> _trialRepository;
|
||||
private readonly IRepository<TrialUser> _trialUserRepository;
|
||||
|
||||
public bool TrialExpeditedChange { get; set; } = false;
|
||||
|
||||
|
||||
public TrialService(IEasyCachingProvider provider,IRepository<Trial> trialRepository)
|
||||
public TrialService(IEasyCachingProvider provider,IRepository<Trial> trialRepository,
|
||||
IRepository<TrialUser> trialUserRepository
|
||||
)
|
||||
{
|
||||
_provider = provider;
|
||||
_trialRepository = trialRepository;
|
||||
this._trialUserRepository = trialUserRepository;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -510,7 +515,7 @@ namespace IRaCIS.Application.Services
|
|||
if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.ProjectManager)
|
||||
{
|
||||
//参与者仅有他自己时,可以删除
|
||||
if (await _repository.GetQueryable<TrialUser>().CountAsync(t => t.TrialId == trialId) == 1)
|
||||
if (await _trialUserRepository.CountAsync(t => t.TrialId == trialId) == 1)
|
||||
{
|
||||
|
||||
var success1 = await _repository.DeleteFromQueryAsync<Trial>(o => o.Id == trialId) ||
|
||||
|
|
|
@ -15,11 +15,14 @@ namespace IRaCIS.Core.Application.Services
|
|||
{
|
||||
private readonly IRepository<TrialSite> _trialSiteRepository;
|
||||
private readonly IRepository<TrialSiteUser> _trialSiteUserRepository;
|
||||
private readonly IRepository<Site> _siteRepository;
|
||||
|
||||
public TrialMaintenanceService(IRepository<TrialSite> trialSiteRepository, IRepository<TrialSiteUser> trialSiteUserRepository)
|
||||
public TrialMaintenanceService(IRepository<TrialSite> trialSiteRepository, IRepository<TrialSiteUser> trialSiteUserRepository
|
||||
, IRepository<Site> siteRepository)
|
||||
{
|
||||
_trialSiteRepository = trialSiteRepository;
|
||||
_trialSiteUserRepository = trialSiteUserRepository;
|
||||
this._siteRepository = siteRepository;
|
||||
}
|
||||
|
||||
/// <summary>Pannel 进去 SiteTab </summary>
|
||||
|
@ -87,7 +90,7 @@ namespace IRaCIS.Core.Application.Services
|
|||
// 之前选择了的不能再次出现在列表,做的时候我就不建议这样搞,搞好了 现在又要改回去。。。 瞎折腾。。。。
|
||||
|
||||
|
||||
var siteQueryable = _repository.GetQueryable<Site>()
|
||||
var siteQueryable = _siteRepository
|
||||
.WhereIf(!string.IsNullOrWhiteSpace(trialSiteQuery.SiteName.Trim()), t => t.SiteName.Contains(trialSiteQuery.SiteName.Trim()))
|
||||
.ProjectTo<TrialSiteScreeningDTO>(_mapper.ConfigurationProvider, new { trialId = trialSiteQuery.TrialId });
|
||||
|
||||
|
|
|
@ -25,6 +25,9 @@ namespace IRaCIS.Core.Infra.EFCore
|
|||
Task<TEntity> FirstOrDefaultAsync(Expression<Func<TEntity, bool>> exp = null, bool ignoreQueryFilters = false);
|
||||
|
||||
Task<bool> AnyAsync(Expression<Func<TEntity, bool>> exp,bool ignoreQueryFilters=false);
|
||||
|
||||
Task<TResult> MaxAsync<TResult>(Expression<Func<TEntity, TResult>> selector);
|
||||
|
||||
Task<int> CountAsync(Expression<Func<TEntity, bool>> whereLambda = null, bool ignoreQueryFilters = false);
|
||||
|
||||
ValueTask<TEntity> AddAsync(TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default);
|
||||
|
|
|
@ -218,6 +218,12 @@ namespace IRaCIS.Core.Infra.EFCore
|
|||
}
|
||||
}
|
||||
|
||||
public async Task<TResult> MaxAsync<TResult>(Expression<Func<TEntity, TResult>> selector)
|
||||
{
|
||||
|
||||
return await _dbSet.AsNoTracking().MaxAsync(selector);
|
||||
}
|
||||
|
||||
public async Task<bool> AnyAsync(Expression<Func<TEntity, bool>> exp, bool ignoreQueryFilters = false)
|
||||
{
|
||||
var query = _dbSet.AsQueryable();
|
||||
|
|
Loading…
Reference in New Issue