修改参数

This commit is contained in:
he
2022-06-06 15:03:26 +08:00
parent 6bdaf926c4
commit a914e6815e
6 changed files with 96 additions and 110 deletions
@@ -218,7 +218,7 @@ namespace IRaCIS.Core.Application.Service
private async Task<string> SetDataInspectionDateType(List<string> identification, string json)
{
var list = await (from parent in _frontAuditConfigRepository.AsQueryable().Where(x => identification.Contains(x.Identification))
join child in _frontAuditConfigRepository.AsQueryable().Where(x => x.EnumType == "Date" && x.IsEnable.HasValue && x.IsEnable.Value) on parent.Id equals child.ParentId
join child in _frontAuditConfigRepository.AsQueryable().Where(x => x.EnumType == "Date" && x.IsEnable ) on parent.Id equals child.ParentId
select new DateDto()
{
Code = child.Code,
@@ -279,13 +279,13 @@ namespace IRaCIS.Core.Application.Service
private async Task<string> GetInspectionEnumValue(List<string> identification, string json)
{
var list = await (from u in _frontAuditConfigRepository.Where(x => identification.Contains(x.Identification))
join p in _frontAuditConfigRepository.Where(x => x.EnumType == "Foreign" && x.IsEnable.HasValue && x.IsEnable.Value) on u.Id equals p.ParentId
join p in _frontAuditConfigRepository.Where(x => x.EnumType == "Foreign" && x.IsEnable) on u.Id equals p.ParentId
select new
{
Key = p.Code,
ForeignKeyValue = p.ForeignKeyValue,
ForeignKeyText = p.ForeignKeyText,
ForeignKeyTable = p.ForeignKeyTable
ForeignKeyTable = p.ForeignKeyTableName
}).ToListAsync();
list = list.GroupBy(x => new { x.Key }, (key, lst) => new
{
@@ -349,7 +349,7 @@ namespace IRaCIS.Core.Application.Service
return null;
}
var list = await (from u in _frontAuditConfigRepository.Where(x => identifications.Contains(x.Identification))
join p in _frontAuditConfigRepository.Where(x => x.Code != "AuditState" && x.EnumType == "Dictionary" && x.IsEnable.HasValue && x.IsEnable.Value) on u.Id equals p.ParentId
join p in _frontAuditConfigRepository.Where(x => x.Code != "AuditState" && x.EnumType == "Dictionary" && x.IsEnable) on u.Id equals p.ParentId
select new
{
Key = p.Code,
@@ -586,12 +586,12 @@ namespace IRaCIS.Core.Application.Service
{
Sort = lst.Select(x => x.Sort).FirstOrDefault(),
IsShowByTrialConfig= lst.Select(x => x.IsShowByTrialConfig).FirstOrDefault(),
ByTrialConfig = lst.Select(x => x.ByTrialConfig).FirstOrDefault(),
TrialConfigRelyFieldName = lst.Select(x => x.TrialConfigRelyFieldName).FirstOrDefault(),
Code = lst.Max(x => x.Code),
ConfigType = lst.Select(x => x.ConfigType).FirstOrDefault(),
CreateTime = DateTime.Now,
Description = lst.Select(x => x.Description).FirstOrDefault(),
EnumList = lst.Select(x => x.EnumList).FirstOrDefault(),
//EnumList = lst.Select(x => x.EnumList).FirstOrDefault(),
//IsConfig = lst.Select(x => x.IsConfig).FirstOrDefault(),
IsShowParent = lst.Select(x => x.IsShowParent).FirstOrDefault(),
ParentId = item.AddItemGuid,
@@ -612,7 +612,7 @@ namespace IRaCIS.Core.Application.Service
DateType = lst.Select(x => x.DateType).FirstOrDefault(),
ForeignKeyValue = lst.Select(x => x.ForeignKeyValue).FirstOrDefault(),
ForeignKeyText = lst.Select(x => x.ForeignKeyText).FirstOrDefault(),
ForeignKeyTable = lst.Select(x => x.ForeignKeyTable).FirstOrDefault(),
ForeignKeyTableName = lst.Select(x => x.ForeignKeyTableName).FirstOrDefault(),
DataType = lst.Select(x => x.DataType).FirstOrDefault(),
Id =NewId.NextGuid()//新id,
}).ToList();
@@ -642,7 +642,7 @@ namespace IRaCIS.Core.Application.Service
x.DateType = !item.DateType.IsNullOrEmpty() ? item.DateType : x.DateType;
x.DictionaryKey = !item.DictionaryKey.IsNullOrEmpty() ? item.DictionaryKey : x.DictionaryKey;
x.IsShowParent = !item.IsShowParent==null ? item.IsShowParent : x.IsShowParent;
x.ForeignKeyTable = !item.ForeignKeyTable.IsNullOrEmpty() ? item.ForeignKeyTable : x.ForeignKeyTable;
x.ForeignKeyTableName = !item.ForeignKeyTableName.IsNullOrEmpty() ? item.ForeignKeyTableName : x.ForeignKeyTableName;
x.ForeignKeyText = !item.ForeignKeyText.IsNullOrEmpty() ? item.ForeignKeyText : x.ForeignKeyText;
x.ForeignKeyValue = !item.ForeignKeyValue.IsNullOrEmpty() ? item.ForeignKeyValue : x.ForeignKeyValue;
x.EnumType = !item.EnumType.IsNullOrEmpty() ? item.EnumType : x.EnumType;
@@ -714,15 +714,15 @@ namespace IRaCIS.Core.Application.Service
Sort=data.Sort,
ValueCN = data.ValueCN,
ChildrenTypeValue = leftchildrenType.Value,
EnumList=data.EnumList,
DictionaryKey=data.DictionaryKey,
EnumType=data.EnumType,
ObjectTypeId=data.ObjectTypeId,
ObjectTypeValue = leftObjectTypeIdtemp.Value,
ObjectTypeValueCN = leftObjectTypeIdtemp.ValueCN,
IsShowByTrialConfig =data.IsShowByTrialConfig,
ByTrialConfig=data.ByTrialConfig,
IsForwardPosition=data.IsForwardPosition,
TrialConfigRelyFieldName = data.TrialConfigRelyFieldName,
Identification=data.Identification,
IsHaveReason=data.IsHaveReason,
IsHaveSign=data.IsHaveSign,
@@ -40,7 +40,7 @@ namespace IRaCIS.Application.Services
/// <param name="addOrEditPreviousPDF"></param>
/// <returns></returns>
[HttpPost]
public async Task<IResponseOutput> AddOrUpdatePreviousPDFService(PreviousPDFAddOrEdit addOrEditPreviousPDF)
public async Task<IResponseOutput> AddOrUpdateReadingPreviousPDF(PreviousPDFAddOrEdit addOrEditPreviousPDF)
{
var entity = await _repository.InsertOrUpdateAsync<PreviousPDF, PreviousPDFAddOrEdit>(addOrEditPreviousPDF, true);
return ResponseOutput.Ok(entity.Id.ToString());
@@ -55,7 +55,7 @@ namespace IRaCIS.Application.Services
/// <param name="query"></param>
/// <returns></returns>
[HttpPost]
public async Task<dynamic> PreviousPDFView(PreviousPDFInDto inDto)
public async Task<dynamic> GetPreviousPDFList(PreviousPDFInDto inDto)
{
var list= await _previousPDFRepository.AsQueryable().Where(x => x.TrialId == inDto.TrialId)
.Where(x => (x.ClinicalLevel == ClinicalLevel.Subject && x.SubjectId == inDto.SubjectId) || x.SubjectVisitId == inDto.VisitOrReadId)
@@ -59,7 +59,7 @@ namespace IRaCIS.Application.Services
[HttpPost]
public async Task<(PageOutput<GetReadModuleDtoOut>,object)> GetReadModuleList(GetReadModuleDto dto)
{
var subjectquery = _subjectRepository.WhereIf(dto.TrialId!=null, x => x.TrialId == dto.TrialId)
var subjectQuery = _subjectRepository.WhereIf(dto.TrialId!=null, x => x.TrialId == dto.TrialId)
.WhereIf(dto.SubjectId != null, x => x.Id == dto.SubjectId)
.Include(x => x.SubjectVisitList).Include(x=>x.Site).Include(x => x.TrialSite)
.Select(x => new GetReadModuleDtoOut
@@ -96,7 +96,7 @@ namespace IRaCIS.Application.Services
var pageList = await subjectquery.ToPagedListAsync(dto.PageIndex, dto.PageSize, dto.SortField == null|| dto.SortField==string.Empty ? "SiteCode" : dto.SortField,
var pageList = await subjectQuery.ToPagedListAsync(dto.PageIndex, dto.PageSize, dto.SortField == null|| dto.SortField==string.Empty ? "SiteCode" : dto.SortField,
dto.Asc);
@@ -109,9 +109,9 @@ namespace IRaCIS.Application.Services
}
});
var subjectisd = pageList.CurrentPageData.Select(x => x.SubjectId).ToList();
var subjectIds = pageList.CurrentPageData.Select(x => x.SubjectId).ToList();
var readModules =await _readModuleRepository.Where(x => subjectisd.Contains(x.SubjectId)).Include(x=>x.SubjectVisit)
var readModules =await _readModuleRepository.Where(x => subjectIds.Contains(x.SubjectId)).Include(x=>x.SubjectVisit)
.Include(x => x.ReadModuleModel).ToListAsync();
pageList.CurrentPageData.ForEach(x => {
@@ -164,7 +164,7 @@ namespace IRaCIS.Application.Services
/// <param name="dto"></param>
/// <returns></returns>
[HttpPost]
public async Task<GetReadModuleSingleOutdto> GetReadModuleSingle(GetReadModuleSingleIndto dto)
public async Task<GetReadModuleSingleOutdto> GetReadModule(GetReadModuleSingleIndto dto)
{
var data = await GetReadModuleList(new GetReadModuleDto()
{
@@ -214,15 +214,15 @@ namespace IRaCIS.Application.Services
/// </summary>
/// <param name="inDto"></param>
/// <returns></returns>
public async Task<List<GetSubjectReadVisitsOutDto>> GetSubjectReadVisits(GetSubjectReadVisitsInDto inDto)
public async Task<List<GetSubjectReadVisitsOutDto>> GetSubjectReadVisitList(GetSubjectReadVisitsInDto inDto)
{
var visitquery = _subjectVisitRepository.Where(x => x.SubjectId == inDto.SubjectId && x.SubmitState != SubmitStateEnum.None);
var visitQuery = _subjectVisitRepository.Where(x => x.SubjectId == inDto.SubjectId && x.SubmitState != SubmitStateEnum.None);
var finalVisitNum = await visitquery.Where(x => x.IsFinalVisit).Select(x => x.VisitNum).FirstOrDefaultAsync();
var finalVisitNum = await visitQuery.Where(x => x.IsFinalVisit).Select(x => x.VisitNum).FirstOrDefaultAsync();
var readModulequery = _readModuleRepository.AsQueryable();
return await visitquery.WhereIf(finalVisitNum != null, x => x.VisitNum < finalVisitNum)
return await visitQuery.WhereIf(finalVisitNum != null, x => x.VisitNum < finalVisitNum)
.Where(x => readModulequery.Where(y => y.SubjectVisitId == x.Id && y.ReadingSetType == inDto.ReadingSetType).Count() == 0).OrderBy(x => finalVisitNum)
.Select(x => new GetSubjectReadVisitsOutDto()
{
@@ -240,13 +240,11 @@ namespace IRaCIS.Application.Services
[HttpPost]
public async Task<IResponseOutput> AddReadModule(ReadModuleAddDto dto)
{
var visitquery = _subjectVisitRepository.Where(x => x.SubjectId == dto.SubjectId && x.InPlan);
var visitQuery = _subjectVisitRepository.Where(x => x.SubjectId == dto.SubjectId && x.InPlan);
visitquery = visitquery.WhereIf(dto.ExpirationDate != null, x => x.LatestScanDate <= dto.ExpirationDate.Value)
visitQuery = visitQuery.WhereIf(dto.ExpirationDate != null, x => x.LatestScanDate <= dto.ExpirationDate.Value)
.WhereIf(dto.ExpirationVisitNum != null, x => x.VisitNum <= dto.ExpirationVisitNum.Value);
var visit = visitquery.OrderByDescending(x => x.VisitNum).FirstOrDefault();
var visit = visitQuery.OrderByDescending(x => x.VisitNum).FirstOrDefault();
if (visit != null)
{
@@ -262,9 +260,7 @@ namespace IRaCIS.Application.Services
Status = ReadingCommon.GetVisitSubmitStateEnum(visit),
});
var res = await _readModuleRepository.SaveChangesAsync();
return ResponseOutput.Ok(res);
}
else
@@ -297,7 +293,7 @@ namespace IRaCIS.Application.Services
[HttpDelete("{readModuleId:guid}")]
public async Task<IResponseOutput> DeleteReadModule(Guid readModuleId)
{
var success = await _readModuleRepository.DeleteFromQueryAsync(t => t.Id == readModuleId, true);
await _readModuleRepository.DeleteFromQueryAsync(t => t.Id == readModuleId, true);
return ResponseOutput.Result(true);
}
@@ -88,17 +88,17 @@ namespace IRaCIS.Application.Services
await _readingPeriodPlanRepository.DeleteFromQueryAsync(x => x.ReadingPeriodSetId == inDto.ReadingPeriodSetId);
await _readingPeriodPlanRepository.SaveChangesAsync();
}
var readset = (await _readingPeriodSetRepository.Where(x => x.Id == inDto.ReadingPeriodSetId).Include(x => x.ReadingPeriodSites).FirstOrDefaultAsync()).IfNullThrowException();
var visitquery = _subjectVisitRepository.Where(x => x.TrialId == readset.TrialId && x.InPlan);
if (readset.ReadingScope == ReadingScopeEnum.Site)
var readSet = (await _readingPeriodSetRepository.Where(x => x.Id == inDto.ReadingPeriodSetId).Include(x => x.ReadingPeriodSites).FirstOrDefaultAsync()).IfNullThrowException();
var visitQuery = _subjectVisitRepository.Where(x => x.TrialId == readSet.TrialId && x.InPlan);
if (readSet.ReadingScope == ReadingScopeEnum.Site)
{
var siteids = readset.ReadingPeriodSites.Select(x => x.SiteId);
visitquery = visitquery.Where(x => siteids.Contains(x.SiteId));
var siteIds = readSet.ReadingPeriodSites.Select(x => x.SiteId);
visitQuery = visitQuery.Where(x => siteIds.Contains(x.SiteId));
}
visitquery = visitquery.WhereIf(readset.ExpirationDate != null, x => x.LatestScanDate <= readset.ExpirationDate.Value)
.WhereIf(readset.ExpirationVisitNum != null, x => x.VisitNum <= readset.ExpirationVisitNum);
var subjectVisits = await visitquery.Include(x => x.Subject).Include(x => x.TrialSite).GroupBy(x => x.SubjectId).Select(x => new
visitQuery = visitQuery.WhereIf(readSet.ExpirationDate != null, x => x.LatestScanDate <= readSet.ExpirationDate.Value)
.WhereIf(readSet.ExpirationVisitNum != null, x => x.VisitNum <= readSet.ExpirationVisitNum);
var subjectVisits = await visitQuery.Include(x => x.Subject).Include(x => x.TrialSite).GroupBy(x => x.SubjectId).Select(x => new
{
SubjectId = x.Key,
Visit = x.ToList()
@@ -127,15 +127,15 @@ namespace IRaCIS.Application.Services
});
return visits.Where(x => _readModuleRepository.Where(y => y.ReadingSetType == readset.ReadingSetType && x.Id == y.SubjectVisitId).Count() == 0)
return visits.Where(x => _readModuleRepository.Where(y => y.ReadingSetType == readSet.ReadingSetType && x.Id == y.SubjectVisitId).Count() == 0)
.Select(x => new PreviewTheReadingListOutDto
{
ExpirationDate= readset.ExpirationDate,
ExpirationDate= readSet.ExpirationDate,
SubjectVisitId= x.Id,
TrialSiteCode = x.TrialSite.TrialSiteCode,
LatestScanDate=x.LatestScanDate,
ReadingPeriodName= readset.ReadingPeriodName,
ReadingPeriodSetId=readset.Id,
ReadingPeriodName= readSet.ReadingPeriodName,
ReadingPeriodSetId= readSet.Id,
SubjectCode=x.Subject.Code,
SubjectId=x.SubjectId,
SubjectVisitName=x.VisitName,
@@ -148,7 +148,7 @@ namespace IRaCIS.Application.Services
/// </summary>
/// <param name="inDto"></param>
/// <returns></returns>
public async Task<IResponseOutput> ReadingToGenerate(ReadingToGenerateInDto inDto)
public async Task<IResponseOutput> GenerateReadingTask(ReadingToGenerateInDto inDto)
{
//var readset = (await _readingPeriodSetRepository.Where(x => x.Id == inDto.ReadingPeriodSetId).Include(x => x.ReadingPeriodSites).FirstOrDefaultAsync()).IfNullThrowConvertException();
//var visits = await _subjectVisitRepository.Where(x => inDto.SubjectVisitIds.Contains(x.Id)).ToListAsync();
@@ -187,8 +187,8 @@ namespace IRaCIS.Application.Services
await _readingPeriodPlanRepository.DeleteFromQueryAsync(x => x.ReadingPeriodSetId == inDto.ReadingPeriodSetId);
await _readingPeriodPlanRepository.SaveChangesAsync();
await _readingPeriodPlanRepository.AddRangeAsync(plans);
var res = await _readingPeriodPlanRepository.SaveChangesAsync();
return ResponseOutput.Result(res);
var result = await _readingPeriodPlanRepository.SaveChangesAsync();
return ResponseOutput.Result(result);
}
/// <summary>
@@ -226,11 +226,11 @@ namespace IRaCIS.Application.Services
[HttpPost]
public async Task<PageOutput<ReadingPeriodSetView>> GetReadingPeriodSetList(ReadingPeriodSetQuery query)
{
var readquery =_readingPeriodSetRepository.AsQueryable().Include(x=>x.ReadingPeriodSites)
var readQuery =_readingPeriodSetRepository.AsQueryable().Include(x=>x.ReadingPeriodSites)
.WhereIf(query.TrialId!=null,x=>x.TrialId==query.TrialId)
.WhereIf(query.ReadingPeriodName != null, x => x.ReadingPeriodName.Contains(query.ReadingPeriodName))
.ProjectTo<ReadingPeriodSetView>(_mapper.ConfigurationProvider);
var pageList= await readquery.ToPagedListAsync(query.PageIndex, query.PageSize, query.SortField == null ? "CreateTime" : query.SortField,
var pageList= await readQuery.ToPagedListAsync(query.PageIndex, query.PageSize, query.SortField == null ? "CreateTime" : query.SortField,
query.SortAsc);
return pageList;
}
@@ -263,18 +263,13 @@ namespace IRaCIS.Application.Services
{
var plans = _readingPeriodPlanRepository.Where(x => x.ReadingPeriodSetId == indto.Id).Include(x=>x.SubjectVisit)
.Include(x => x.ReadingPeriodSet).ToList();
var needAddVisitIds = plans.Select(x => x.SubjectVisitId).ToList();
var repeatVisitNames = _readModuleRepository.Where(x => x.ReadingSetType == ReadingSetType.ImageReading && needAddVisitIds.Contains(x.SubjectVisitId)).Select(x => x.SubjectVisit.VisitName).ToList();
if(repeatVisitNames.Count!=0)
{
return ResponseOutput.NotOk($"{string.Join(",", repeatVisitNames)}已经添加过阅片期,无法设置生效");
}
List<ReadModule> readModules = new List<ReadModule>();
foreach (var item in plans)
{
@@ -293,17 +288,18 @@ namespace IRaCIS.Application.Services
};
await _readModuleRepository.AddRangeAsync(readModules);
} else
}
else
{
await _readModuleRepository.DeleteFromQueryAsync(x => x.ReadingPeriodSetId == indto.Id);
}
var readquery =await _readingPeriodSetRepository.UpdatePartialFromQueryAsync(indto.Id, x => new ReadingPeriodSet() {
var readQuery =await _readingPeriodSetRepository.UpdatePartialFromQueryAsync(indto.Id, x => new ReadingPeriodSet() {
IsTakeEffect = indto.IsTakeEffect
});
var res=await _readingPeriodSetRepository.SaveChangesAsync();
return ResponseOutput.Result(res);
var result = await _readingPeriodSetRepository.SaveChangesAsync();
return ResponseOutput.Result(result);
}