74 lines
2.7 KiB
C#
74 lines
2.7 KiB
C#
using IRaCIS.Application.Interfaces;
|
|
using IRaCIS.Core.Infra.EFCore;
|
|
using IRaCIS.Core.Domain.Share;
|
|
using IRaCIS.Core.Application.Filter;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using IRaCIS.Core.Application.Service.WorkLoad.DTO;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using IRaCIS.Core.Application.Auth;
|
|
using IRaCIS.Core.Application.Service.Reading.Dto;
|
|
using IRaCIS.Core.Domain.Share.Reading;
|
|
|
|
namespace IRaCIS.Application.Services
|
|
{
|
|
/// <summary>
|
|
/// 生成的阅片模块(在大列表上展示的)
|
|
/// </summary>
|
|
[ApiExplorerSettings(GroupName = "Reading")]
|
|
public class ReadModuleService : BaseService
|
|
{
|
|
|
|
public IRepository<SubjectVisit> _subjectVisitRepository;
|
|
private readonly IRepository<Subject> _subjectRepository;
|
|
|
|
public ReadModuleService(IRepository<SubjectVisit> subjectVisitRepository,
|
|
IRepository<Subject> subjectRepository
|
|
)
|
|
{
|
|
_subjectVisitRepository = subjectVisitRepository;
|
|
this._subjectRepository = subjectRepository;
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 获取读片模块
|
|
/// </summary>
|
|
[HttpPost]
|
|
public async Task<(PageOutput<GetReadModuleDtoOut>,int)> GetReadModule(GetReadModuleDto dto)
|
|
{
|
|
var subjectquery = _subjectRepository.WhereIf(dto.TrialId!=null, x => x.TrialId == dto.TrialId).Include(x => x.SubjectVisitList).Include(x=>x.Site)
|
|
.Select(x => new GetReadModuleDtoOut
|
|
{
|
|
SiteCode = x.Site.SiteCode,
|
|
SiteId = x.SiteId,
|
|
SubjectCode = x.Code,
|
|
SubjectId = x.Id,
|
|
Data=x.SubjectVisitList.Select(y=>new GetReadModuleOutDto()
|
|
{
|
|
CreateTime = y.CreateTime,
|
|
Id = y.Id,
|
|
SubjectId = x.Id,
|
|
SubjectVisitId = y.Id,
|
|
IsUrgent = x.IsUrgent,
|
|
ModuleName = y.InPlan ? "计划内访视" : "计划外访视",
|
|
ModuleType = y.InPlan ? ModuleTypeEnum.InPlanSubjectVisit : ModuleTypeEnum.OutPlanSubjectVisit,
|
|
SubjectCode = y.Subject.Code,
|
|
SiteCode = x.Site.SiteCode,
|
|
SiteId = x.Site.Id,
|
|
VisitName = y.VisitName,
|
|
|
|
}).ToList()
|
|
});
|
|
var pageList = await subjectquery.ToPagedListAsync(dto.PageIndex, dto.PageSize, dto.SortField == null ? "SiteCode" : dto.SortField,
|
|
dto.SortAsc);
|
|
return (pageList, pageList.CurrentPageData.ToList().Max(x => x.Data.Count));
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|