Browse Source

组合结果统计加条件

master
wxd 1 year ago
parent
commit
9024a961c8
  1. 5
      src/Shentun.Peis.Application.Contracts/CustomerReports/GetAsbitemSpecificResultReportRequestDto.cs
  2. 20
      src/Shentun.Peis.Application/CustomerReports/CustomerReportAppService.cs

5
src/Shentun.Peis.Application.Contracts/CustomerReports/GetAsbitemSpecificResultReportRequestDto.cs

@ -18,5 +18,10 @@ namespace Shentun.Peis.CustomerReports
/// </summary> /// </summary>
[Required(ErrorMessage ="组合项目不能为空")] [Required(ErrorMessage ="组合项目不能为空")]
public List<Guid> AsbitemId { get; set; } public List<Guid> AsbitemId { get; set; }
/// <summary>
/// 项目完成标志 0(为未检), 1(已检), 2(弃检)
/// </summary>
public char? CompleteFlag { get; set; }
} }
} }

20
src/Shentun.Peis.Application/CustomerReports/CustomerReportAppService.cs

@ -1283,12 +1283,22 @@ namespace Shentun.Peis.CustomerReports
public async Task<List<GetAsbitemSpecificResultReportDto>> GetAsbitemSpecificResultReportAsync(GetAsbitemSpecificResultReportRequestDto input) public async Task<List<GetAsbitemSpecificResultReportDto>> 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() var query = from a in await _patientRegisterRepository.GetQueryableAsync()
join b in await _patientRepository.GetQueryableAsync() on a.PatientId equals b.Id into bb join b in await _patientRepository.GetQueryableAsync() on a.PatientId equals b.Id into bb
from ab in bb.DefaultIfEmpty() 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 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 join g in await _sexRepository.GetQueryableAsync() on a.SexId equals g.Id into gg
from ag in gg.DefaultIfEmpty() from ag in gg.DefaultIfEmpty()
select new { a, ab, c, d, ag, e }; select new { a, ab, c, d, ag, e };
@ -1314,7 +1324,7 @@ namespace Shentun.Peis.CustomerReports
var CustomerOrgIds = await _customerOrgManager.GetCustomerOrgChildrenId(item.CustomerOrgId.Value); var CustomerOrgIds = await _customerOrgManager.GetCustomerOrgChildrenId(item.CustomerOrgId.Value);
sumquery = sumquery.Where(m => CustomerOrgIds.Contains(m.a.CustomerOrgId)); 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') if (item.DateType == '1')
{ {
@ -1388,6 +1398,10 @@ namespace Shentun.Peis.CustomerReports
sumquery = sumquery.Where(m => input.AsbitemId.Contains(m.d.AsbitemId)); 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()) if (sumquery.Any())
{ {

Loading…
Cancel
Save