diff --git a/src/Shentun.Peis.Application.Contracts/CustomerReports/GetAsbitemSpecificResultReportRequestDto.cs b/src/Shentun.Peis.Application.Contracts/CustomerReports/GetAsbitemSpecificResultReportRequestDto.cs index 834e182..219968f 100644 --- a/src/Shentun.Peis.Application.Contracts/CustomerReports/GetAsbitemSpecificResultReportRequestDto.cs +++ b/src/Shentun.Peis.Application.Contracts/CustomerReports/GetAsbitemSpecificResultReportRequestDto.cs @@ -18,5 +18,10 @@ namespace Shentun.Peis.CustomerReports /// [Required(ErrorMessage ="组合项目不能为空")] public List AsbitemId { get; set; } + + /// + /// 项目完成标志 0(为未检), 1(已检), 2(弃检) + /// + public char? CompleteFlag { get; set; } } } diff --git a/src/Shentun.Peis.Application/CustomerReports/CustomerReportAppService.cs b/src/Shentun.Peis.Application/CustomerReports/CustomerReportAppService.cs index 6ce39dd..4626cf3 100644 --- a/src/Shentun.Peis.Application/CustomerReports/CustomerReportAppService.cs +++ b/src/Shentun.Peis.Application/CustomerReports/CustomerReportAppService.cs @@ -1283,12 +1283,22 @@ namespace Shentun.Peis.CustomerReports public async Task> GetAsbitemSpecificResultReportAsync(GetAsbitemSpecificResultReportRequestDto input) { + //var query = from a in await _patientRegisterRepository.GetQueryableAsync() + // join b in await _patientRepository.GetQueryableAsync() on a.PatientId equals b.Id into bb + // from ab in bb.DefaultIfEmpty() + // join d in await _registerAsbitemRepository.GetQueryableAsync() on a.Id equals d.PatientRegisterId + // join e in await _asbitemRepository.GetQueryableAsync() on d.AsbitemId equals e.Id + // join c in await _registerCheckRepository.GetQueryableAsync() on d.RegisterCheckId equals c.Id + // join g in await _sexRepository.GetQueryableAsync() on a.SexId equals g.Id into gg + // from ag in gg.DefaultIfEmpty() + // select new { a, ab, c, d, ag, e }; + var query = from a in await _patientRegisterRepository.GetQueryableAsync() join b in await _patientRepository.GetQueryableAsync() on a.PatientId equals b.Id into bb from ab in bb.DefaultIfEmpty() - join d in await _registerAsbitemRepository.GetQueryableAsync() on a.Id equals d.PatientRegisterId + join c in await _registerCheckRepository.GetQueryableAsync() on a.Id equals c.PatientRegisterId + join d in await _registerAsbitemRepository.GetQueryableAsync() on c.Id equals d.RegisterCheckId join e in await _asbitemRepository.GetQueryableAsync() on d.AsbitemId equals e.Id - join c in await _registerCheckRepository.GetQueryableAsync() on d.RegisterCheckId equals c.Id join g in await _sexRepository.GetQueryableAsync() on a.SexId equals g.Id into gg from ag in gg.DefaultIfEmpty() select new { a, ab, c, d, ag, e }; @@ -1314,7 +1324,7 @@ namespace Shentun.Peis.CustomerReports var CustomerOrgIds = await _customerOrgManager.GetCustomerOrgChildrenId(item.CustomerOrgId.Value); sumquery = sumquery.Where(m => CustomerOrgIds.Contains(m.a.CustomerOrgId)); } - if (item.DateType != null && !string.IsNullOrEmpty(item.StartDate) && !string.IsNullOrEmpty(item.EndDate)) + if (!string.IsNullOrEmpty(item.StartDate) && !string.IsNullOrEmpty(item.EndDate)) { if (item.DateType == '1') { @@ -1388,6 +1398,10 @@ namespace Shentun.Peis.CustomerReports sumquery = sumquery.Where(m => input.AsbitemId.Contains(m.d.AsbitemId)); + if (input.CompleteFlag != null) + { + sumquery = sumquery.Where(m => m.c.CompleteFlag == input.CompleteFlag); + } if (sumquery.Any()) {