Browse Source

疾病统计

master
wxd 6 months ago
parent
commit
eaba0fec2a
  1. 7
      src/Shentun.Peis.Application.Contracts/CustomerReports/GetDiseaseCountStatisticsReportRequestDto.cs
  2. 13
      src/Shentun.Peis.Application/CustomerReports/CustomerReportAppService.cs

7
src/Shentun.Peis.Application.Contracts/CustomerReports/GetDiseaseCountStatisticsReportRequestDto.cs

@ -1,6 +1,8 @@
using Shentun.Peis.PeisReports; using Shentun.Peis.PeisReports;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using System.Text; using System.Text;
namespace Shentun.Peis.CustomerReports namespace Shentun.Peis.CustomerReports
@ -18,5 +20,10 @@ namespace Shentun.Peis.CustomerReports
/// 诊断ID 集合 这里的诊断需要增加一个是否为疾病的条件 前台拉取的数据就需要筛选 /// 诊断ID 集合 这里的诊断需要增加一个是否为疾病的条件 前台拉取的数据就需要筛选
/// </summary> /// </summary>
public List<Guid> DiagnosisIds { get; set; } = new List<Guid>(); public List<Guid> DiagnosisIds { get; set; } = new List<Guid>();
/// <summary>
/// 完成标志(0 预登记 1正式登记 2部分已检 3已总检) 不传查所有
/// </summary>
public List<char> CompleteFlags { get; set; } = new List<char>();
} }
} }

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

@ -717,6 +717,10 @@ namespace Shentun.Peis.CustomerReports
} }
} }
if (input.CompleteFlags.Any())
{
sumquery_count = sumquery_count.Where(m => input.CompleteFlags.Contains(m.a.CompleteFlag));
}
sumCount = sumquery_count.Count(); sumCount = sumquery_count.Count();
@ -816,7 +820,10 @@ namespace Shentun.Peis.CustomerReports
} }
} }
if (input.CompleteFlags.Any())
{
sumquery = sumquery.Where(m => input.CompleteFlags.Contains(m.a.CompleteFlag));
}
if (input.DiagnosisIds.Any()) if (input.DiagnosisIds.Any())
{ {
@ -824,13 +831,13 @@ namespace Shentun.Peis.CustomerReports
} }
#endregion #endregion
var entlist = sumquery.GroupBy(g => g.c.DiagnosisId).Select(s => new GetDiseaseCountStatisticsReportDto
var entlist = sumquery.ToList().GroupBy(g => g.c.DiagnosisId).Select(s => new GetDiseaseCountStatisticsReportDto
{ {
DiagnosisName = s.FirstOrDefault().ad != null ? s.FirstOrDefault().ad.DisplayName : "", DiagnosisName = s.FirstOrDefault().ad != null ? s.FirstOrDefault().ad.DisplayName : "",
PatientCount = s.Count(), PatientCount = s.Count(),
PatientNames = string.Join(",", s.Where(m => m.a != null).Select(sa => sa.a.PatientName)), PatientNames = string.Join(",", s.Where(m => m.a != null).Select(sa => sa.a.PatientName)),
Percentage = Math.Round(Convert.ToDecimal(s.Count() * 100) / sumCount, 2).ToString() Percentage = Math.Round(Convert.ToDecimal(s.Count() * 100) / sumCount, 2).ToString()
}).ToList();
}).OrderByDescending(o => o.PatientCount).ToList();
return entlist; return entlist;
} }

Loading…
Cancel
Save