diff --git a/src/Shentun.Peis.Application.Contracts/InternalReports/GetAuditDoctorWorkLoadReportDto.cs b/src/Shentun.Peis.Application.Contracts/InternalReports/GetAuditDoctorWorkLoadReportDto.cs
new file mode 100644
index 0000000..47b191c
--- /dev/null
+++ b/src/Shentun.Peis.Application.Contracts/InternalReports/GetAuditDoctorWorkLoadReportDto.cs
@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Shentun.Peis.InternalReports
+{
+ public class GetAuditDoctorWorkLoadReportDto
+ {
+ ///
+ /// s审核医生名称
+ ///
+ public string AuditDoctorName { get; set; }
+
+ ///
+ /// 审核数量
+ ///
+ public int AuditCount { get; set; }
+
+ ///
+ /// 占百分比
+ ///
+ public string Percentage { get; set; }
+ }
+}
diff --git a/src/Shentun.Peis.Application.Contracts/InternalReports/GetAuditDoctorWorkLoadReportRequestDto.cs b/src/Shentun.Peis.Application.Contracts/InternalReports/GetAuditDoctorWorkLoadReportRequestDto.cs
new file mode 100644
index 0000000..fdf5344
--- /dev/null
+++ b/src/Shentun.Peis.Application.Contracts/InternalReports/GetAuditDoctorWorkLoadReportRequestDto.cs
@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Shentun.Peis.InternalReports
+{
+ public class GetAuditDoctorWorkLoadReportRequestDto
+ {
+ ///
+ /// 审核医生ID 集合
+ ///
+ public List UserIds { get; set; }
+
+ ///
+ /// 开始审核日期
+ ///
+ public string StartDate { get; set; }
+
+ ///
+ /// 结束审核日期
+ ///
+ public string EndDate { get; set; }
+ }
+}
diff --git a/src/Shentun.Peis.Application.Contracts/InternalReports/GetDoctorPersonnelWorkLoadReportRequestDto.cs b/src/Shentun.Peis.Application.Contracts/InternalReports/GetDoctorPersonnelWorkLoadReportRequestDto.cs
index ed2eb77..34522c3 100644
--- a/src/Shentun.Peis.Application.Contracts/InternalReports/GetDoctorPersonnelWorkLoadReportRequestDto.cs
+++ b/src/Shentun.Peis.Application.Contracts/InternalReports/GetDoctorPersonnelWorkLoadReportRequestDto.cs
@@ -10,7 +10,7 @@ namespace Shentun.Peis.InternalReports
///
/// 医生ID 集合
///
- public List UserIds { get; set; }
+ public List UserIds { get; set; }
///
/// 开始检查日期
diff --git a/src/Shentun.Peis.Application.Contracts/InternalReports/GetItemTypeWorkLoadInCustomerAndAsbitemDto.cs b/src/Shentun.Peis.Application.Contracts/InternalReports/GetItemTypeWorkLoadInCustomerAndAsbitemDto.cs
new file mode 100644
index 0000000..5c21966
--- /dev/null
+++ b/src/Shentun.Peis.Application.Contracts/InternalReports/GetItemTypeWorkLoadInCustomerAndAsbitemDto.cs
@@ -0,0 +1,32 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Shentun.Peis.InternalReports
+{
+ public class GetItemTypeWorkLoadInCustomerAndAsbitemDto
+ {
+ ///
+ /// 单位名称
+ ///
+ public string CustomerName { get; set; }
+
+
+ ///
+ /// 项目类别名称
+ ///
+ public string ItemTypeName { get; set; }
+
+ ///
+ /// 组合项目名称
+ ///
+ public string AsbitemName { get; set; }
+
+
+
+ ///
+ /// 人次 组合项目数量
+ ///
+ public int DoctorCheckCount { get; set; }
+ }
+}
diff --git a/src/Shentun.Peis.Application.Contracts/InternalReports/GetItemTypeWorkLoadInCustomerAndAsbitemRequestDto.cs b/src/Shentun.Peis.Application.Contracts/InternalReports/GetItemTypeWorkLoadInCustomerAndAsbitemRequestDto.cs
new file mode 100644
index 0000000..c4d7342
--- /dev/null
+++ b/src/Shentun.Peis.Application.Contracts/InternalReports/GetItemTypeWorkLoadInCustomerAndAsbitemRequestDto.cs
@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Shentun.Peis.InternalReports
+{
+ public class GetItemTypeWorkLoadInCustomerAndAsbitemRequestDto
+ {
+ ///
+ /// 项目类别ID
+ ///
+ public List ItemTypeId { get; set; }
+
+ ///
+ /// 开始检查日期
+ ///
+ public string StartDate { get; set; }
+
+ ///
+ /// 结束检查日期
+ ///
+ public string EndDate { get; set; }
+ }
+}
diff --git a/src/Shentun.Peis.Application.Contracts/InternalReports/GetItemTypeWorkLoadInCustomerAndDoctorDto.cs b/src/Shentun.Peis.Application.Contracts/InternalReports/GetItemTypeWorkLoadInCustomerAndDoctorDto.cs
new file mode 100644
index 0000000..a903cbb
--- /dev/null
+++ b/src/Shentun.Peis.Application.Contracts/InternalReports/GetItemTypeWorkLoadInCustomerAndDoctorDto.cs
@@ -0,0 +1,38 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Shentun.Peis.InternalReports
+{
+ public class GetItemTypeWorkLoadInCustomerAndDoctorDto
+ {
+
+ ///
+ /// 单位名称
+ ///
+ public string CustomerName { get; set; }
+
+
+ ///
+ /// 项目类别名称
+ ///
+ public string ItemTypeName { get; set; }
+
+ ///
+ /// 组合项目名称
+ ///
+ public string AsbitemName { get; set; }
+
+ ///
+ /// 医生名称
+ ///
+ public string DoctorName { get; set; }
+
+ ///
+ /// 人次 医生检查数量
+ ///
+ public int DoctorCheckCount { get; set; }
+
+
+ }
+}
diff --git a/src/Shentun.Peis.Application.Contracts/InternalReports/GetItemTypeWorkLoadInCustomerAndDoctorRequestDto.cs b/src/Shentun.Peis.Application.Contracts/InternalReports/GetItemTypeWorkLoadInCustomerAndDoctorRequestDto.cs
new file mode 100644
index 0000000..29a0ed1
--- /dev/null
+++ b/src/Shentun.Peis.Application.Contracts/InternalReports/GetItemTypeWorkLoadInCustomerAndDoctorRequestDto.cs
@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Shentun.Peis.InternalReports
+{
+ public class GetItemTypeWorkLoadInCustomerAndDoctorRequestDto
+ {
+ ///
+ /// 项目类别ID
+ ///
+ public List ItemTypeId { get; set; }
+
+ ///
+ /// 开始检查日期
+ ///
+ public string StartDate { get; set; }
+
+ ///
+ /// 结束检查日期
+ ///
+ public string EndDate { get; set; }
+ }
+}
diff --git a/src/Shentun.Peis.Application.Contracts/InternalReports/GetItemTypeWorkLoadInStandardDto.cs b/src/Shentun.Peis.Application.Contracts/InternalReports/GetItemTypeWorkLoadInStandardDto.cs
new file mode 100644
index 0000000..f817f3b
--- /dev/null
+++ b/src/Shentun.Peis.Application.Contracts/InternalReports/GetItemTypeWorkLoadInStandardDto.cs
@@ -0,0 +1,44 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Shentun.Peis.InternalReports
+{
+ public class GetItemTypeWorkLoadInStandardDto
+ {
+ ///
+ /// 项目类别名称
+ ///
+ public string ItemTypeName { get; set; }
+
+ ///
+ /// 组合项目名称
+ ///
+ public string AsbitemName { get; set; }
+
+ ///
+ /// 人次 组合项目数量
+ ///
+ public int AsbitemCount { get; set; }
+
+ ///
+ /// 标准均价
+ ///
+ public decimal AvgStandardPrice { get; set; }
+ ///
+ /// 实收均价
+ ///
+ public decimal AvgChargePrice { get; set; }
+
+
+ ///
+ /// 标准价格总金额
+ ///
+ public decimal SumStandardPrice { get; set; }
+ ///
+ /// 实收价格总金额
+ ///
+ public decimal SumChargePrice { get; set; }
+
+ }
+}
diff --git a/src/Shentun.Peis.Application.Contracts/InternalReports/GetItemTypeWorkLoadInStandardRequestDto.cs b/src/Shentun.Peis.Application.Contracts/InternalReports/GetItemTypeWorkLoadInStandardRequestDto.cs
new file mode 100644
index 0000000..d70892e
--- /dev/null
+++ b/src/Shentun.Peis.Application.Contracts/InternalReports/GetItemTypeWorkLoadInStandardRequestDto.cs
@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Shentun.Peis.InternalReports
+{
+ public class GetItemTypeWorkLoadInStandardRequestDto
+ {
+ ///
+ /// 项目类别ID
+ ///
+ public List ItemTypeId { get; set; }
+
+ ///
+ /// 开始检查日期
+ ///
+ public string StartDate { get; set; }
+
+ ///
+ /// 结束检查日期
+ ///
+ public string EndDate { get; set; }
+ }
+}
diff --git a/src/Shentun.Peis.Application.Contracts/InternalReports/GetSumCheckDoctorWorkLoadReportDto.cs b/src/Shentun.Peis.Application.Contracts/InternalReports/GetSumCheckDoctorWorkLoadReportDto.cs
index 01f7628..47178f3 100644
--- a/src/Shentun.Peis.Application.Contracts/InternalReports/GetSumCheckDoctorWorkLoadReportDto.cs
+++ b/src/Shentun.Peis.Application.Contracts/InternalReports/GetSumCheckDoctorWorkLoadReportDto.cs
@@ -7,14 +7,14 @@ namespace Shentun.Peis.InternalReports
public class GetSumCheckDoctorWorkLoadReportDto
{
///
- /// 人员名称
+ /// 总检医生名称
///
- public string PersonnelName { get; set; }
+ public string SumCheckDoctorName { get; set; }
///
- /// 登记数量
+ /// 总检数量
///
- public int RegisterCount { get; set; }
+ public int SumCheckCount { get; set; }
///
/// 占百分比
diff --git a/src/Shentun.Peis.Application.Contracts/InternalReports/GetSumCheckDoctorWorkLoadReportRequestDto.cs b/src/Shentun.Peis.Application.Contracts/InternalReports/GetSumCheckDoctorWorkLoadReportRequestDto.cs
index 52e7b2c..c55c7de 100644
--- a/src/Shentun.Peis.Application.Contracts/InternalReports/GetSumCheckDoctorWorkLoadReportRequestDto.cs
+++ b/src/Shentun.Peis.Application.Contracts/InternalReports/GetSumCheckDoctorWorkLoadReportRequestDto.cs
@@ -9,15 +9,15 @@ namespace Shentun.Peis.InternalReports
///
/// 总检医生ID 集合
///
- public List UserIds { get; set; }
+ public List UserIds { get; set; }
///
- /// 开始登记日期
+ /// 开始总检日期
///
public string StartDate { get; set; }
///
- /// 结束登记日期
+ /// 结束总检日期
///
public string EndDate { get; set; }
}
diff --git a/src/Shentun.Peis.Application/InternalReports/InternalReportAppService.cs b/src/Shentun.Peis.Application/InternalReports/InternalReportAppService.cs
index 87ff198..f1ffc79 100644
--- a/src/Shentun.Peis.Application/InternalReports/InternalReportAppService.cs
+++ b/src/Shentun.Peis.Application/InternalReports/InternalReportAppService.cs
@@ -18,25 +18,34 @@ namespace Shentun.Peis.InternalReports
/// 内部报表
///
[ApiExplorerSettings(GroupName = "Work")]
- //[Authorize]
+ [Authorize]
public class InternalReportAppService : ApplicationService
{
private readonly IRepository _userRepository;
private readonly IRepository _patientRegisterRepository;
private readonly IRepository _registerAsbitemRepository;
+ private readonly IRepository _registerCheckRepository;
private readonly IRepository _asbitemRepository;
+ private readonly IRepository _itemTypeRepository;
+ private readonly IRepository _customerOrgRepository;
public InternalReportAppService(
IRepository userRepository,
IRepository patientRegisterRepository,
IRepository registerAsbitemRepository,
- IRepository asbitemRepository
+ IRepository registerCheckRepository,
+ IRepository asbitemRepository,
+ IRepository itemTypeRepository,
+ IRepository customerOrgRepository
)
{
this._userRepository = userRepository;
this._patientRegisterRepository = patientRegisterRepository;
this._registerAsbitemRepository = registerAsbitemRepository;
+ this._registerCheckRepository = registerCheckRepository;
this._asbitemRepository = asbitemRepository;
+ this._itemTypeRepository = itemTypeRepository;
+ this._customerOrgRepository = customerOrgRepository;
}
///
@@ -83,22 +92,25 @@ namespace Shentun.Peis.InternalReports
public async Task> GetDoctorPersonnelWorkLoadReportAsync(GetDoctorPersonnelWorkLoadReportRequestDto input)
{
var query = (from a in await _registerAsbitemRepository.GetQueryableAsync()
- join b in await _userRepository.GetQueryableAsync() on a.CreatorId equals b.Id into bb
- from ab in bb.DefaultIfEmpty()
join c in await _asbitemRepository.GetQueryableAsync() on a.AsbitemId equals c.Id into cc
from ac in cc.DefaultIfEmpty()
+ join d in await _registerCheckRepository.GetQueryableAsync() on a.RegisterCheckId equals d.Id into dd
+ from ad in dd.DefaultIfEmpty()
+ join b in await _userRepository.GetQueryableAsync() on ad.CheckDoctorId equals b.Id.ToString() into bb
+ from ab in bb.DefaultIfEmpty()
where (a.CreationTime >= Convert.ToDateTime(input.StartDate) &&
a.CreationTime < Convert.ToDateTime(input.EndDate).AddDays(1))
select new
{
a,
+ CheckDoctorId = ad.CheckDoctorId,
DoctorName = ab != null ? ab.UserName : "",
AsbitemName = ac != null ? ac.DisplayName : ""
});
if (input.UserIds.Count > 0)
{
- query = query.Where(m => input.UserIds.Contains(m.a.CreatorId.Value));
+ query = query.Where(m => input.UserIds.Contains(m.CheckDoctorId));
}
@@ -112,8 +124,8 @@ namespace Shentun.Peis.InternalReports
DoctorName = s.FirstOrDefault().DoctorName,
AvgChargePrice = Math.Round(s.Average(v => v.a.ChargePrice.Value), 2),
AvgStandardPrice = Math.Round(s.Average(v => v.a.StandardPrice.Value), 2),
- SumChargePrice = Math.Round(s.Sum(v => v.a.ChargePrice.Value), 2),
- SumStandardPrice = Math.Round(s.Sum(v => v.a.StandardPrice.Value), 2)
+ SumChargePrice = Math.Round(s.Sum(v => v.a.ChargePrice.Value * v.a.Amount.Value), 2),
+ SumStandardPrice = Math.Round(s.Sum(v => v.a.StandardPrice.Value * v.a.Amount.Value), 2)
}).ToList();
@@ -122,16 +134,248 @@ namespace Shentun.Peis.InternalReports
- /////
- ///// 总检医生工作量统计
- /////
- /////
- /////
- //[HttpPost("api/app/internalreport/getsumcheckdoctorworkloadreport")]
- //public async Task> GetSumCheckDoctorWorkLoadReportAsync(GetSumCheckDoctorWorkLoadReportRequestDto input)
- //{
-
- //}
+ ///
+ /// 总检医生工作量统计
+ ///
+ ///
+ ///
+ [HttpPost("api/app/internalreport/getsumcheckdoctorworkloadreport")]
+ public async Task> GetSumCheckDoctorWorkLoadReportAsync(GetSumCheckDoctorWorkLoadReportRequestDto input)
+ {
+ var query = (from a in await _patientRegisterRepository.GetQueryableAsync()
+ join b in await _userRepository.GetQueryableAsync() on a.SummaryDoctor equals b.Id.ToString() into bb
+ from ab in bb.DefaultIfEmpty()
+ where (!string.IsNullOrEmpty(a.SummaryDoctor) && a.SummaryDate != null && a.SummaryDate.Value.ToDateTime(TimeOnly.MinValue) >= Convert.ToDateTime(input.StartDate) &&
+ a.SummaryDate.Value.ToDateTime(TimeOnly.MinValue) < Convert.ToDateTime(input.EndDate).AddDays(1))
+ select new
+ {
+ a,
+ SumCheckDoctorName = ab != null ? ab.UserName : ""
+ });
+
+
+ var sumCount = query.Count(); //总数
+
+ if (input.UserIds.Count > 0)
+ {
+ query = query.Where(m => input.UserIds.ToString().Contains(m.a.SummaryDoctor));
+ }
+
+ var entlistdto = query.GroupBy(g => new { g.a.SummaryDoctor, g.SumCheckDoctorName })
+ .Select(s => new GetSumCheckDoctorWorkLoadReportDto
+ {
+ SumCheckDoctorName = s.Key.SumCheckDoctorName,
+ SumCheckCount = s.Count(),
+ Percentage = Math.Round(Convert.ToDecimal(s.Count() * 100) / sumCount, 2).ToString()
+ }).ToList();
+
+ return entlistdto;
+ }
+
+
+ ///
+ /// 审核医生工作量统计
+ ///
+ ///
+ ///
+ [HttpPost("api/app/internalreport/getauditdoctorworkloadreport")]
+ public async Task> GetAuditDoctorWorkLoadReportAsync(GetAuditDoctorWorkLoadReportRequestDto input)
+ {
+ var query = (from a in await _patientRegisterRepository.GetQueryableAsync()
+ join b in await _userRepository.GetQueryableAsync() on a.SummaryDoctor equals b.Id.ToString() into bb
+ from ab in bb.DefaultIfEmpty()
+ where (!string.IsNullOrEmpty(a.AuditDoctor) && a.AuditDate != null && a.AuditDate.Value.ToDateTime(TimeOnly.MinValue) >= Convert.ToDateTime(input.StartDate) &&
+ a.AuditDate.Value.ToDateTime(TimeOnly.MinValue) < Convert.ToDateTime(input.EndDate).AddDays(1))
+ select new
+ {
+ a,
+ AuditDoctorName = ab != null ? ab.UserName : ""
+ });
+
+
+ var sumCount = query.Count(); //总数
+
+ if (input.UserIds.Count > 0)
+ {
+ query = query.Where(m => input.UserIds.ToString().Contains(m.a.AuditDoctor));
+ }
+
+ var entlistdto = query.GroupBy(g => new { g.a.AuditDoctor, g.AuditDoctorName })
+ .Select(s => new GetAuditDoctorWorkLoadReportDto
+ {
+ AuditDoctorName = s.Key.AuditDoctorName,
+ AuditCount = s.Count(),
+ Percentage = Math.Round(Convert.ToDecimal(s.Count() * 100) / sumCount, 2).ToString()
+ }).ToList();
+
+ return entlistdto;
+ }
+
+
+
+ ///
+ /// 科室工作量统计 标准格式 只统计RegisterCheck表标记检查了的数据
+ ///
+ ///
+ ///
+ [HttpPost("api/app/internalreport/getitemtypeworkloadinstandard")]
+ public async Task> GetItemTypeWorkLoadInStandardAsync(GetItemTypeWorkLoadInStandardRequestDto input)
+ {
+
+ var qeruy = from a in await _registerAsbitemRepository.GetQueryableAsync()
+ join b in await _asbitemRepository.GetQueryableAsync() on a.AsbitemId equals b.Id
+ join c in await _itemTypeRepository.GetQueryableAsync() on b.ItemTypeId equals c.Id
+ join d in await _registerCheckRepository.GetQueryableAsync() on a.RegisterCheckId equals d.Id into dd
+ from ad in dd.DefaultIfEmpty()
+ where (!string.IsNullOrEmpty(ad.CheckDoctorId) && ad.CheckDate != null)
+ select new
+ {
+ a.AsbitemId,
+ a.StandardPrice,
+ a.ChargePrice,
+ a.Amount,
+ AsbitemName = b.DisplayName,
+ ItemTypeId = b.ItemTypeId,
+ ItemTypeName = c.DisplayName,
+ ad.CheckDate
+ };
+
+ if (input.ItemTypeId.Any())
+ {
+ qeruy = qeruy.Where(m => input.ItemTypeId.Contains(m.ItemTypeId));
+ }
+
+ if (!string.IsNullOrEmpty(input.StartDate) && !string.IsNullOrEmpty(input.EndDate))
+ {
+ qeruy = qeruy.Where(m => m.CheckDate.Value.ToDateTime(TimeOnly.MinValue) >= Convert.ToDateTime(input.StartDate) &&
+ m.CheckDate.Value.ToDateTime(TimeOnly.MinValue) < Convert.ToDateTime(input.EndDate).AddDays(1));
+ }
+
+ var entlist = qeruy.GroupBy(g => new { g.ItemTypeId, g.AsbitemId })
+ .Select(s => new GetItemTypeWorkLoadInStandardDto
+ {
+ AsbitemName = s.First().AsbitemName,
+ AsbitemCount = s.Count(),
+ ItemTypeName = s.First().ItemTypeName,
+ AvgChargePrice = Math.Round(s.Average(v => v.ChargePrice.Value), 2),
+ AvgStandardPrice = Math.Round(s.Average(v => v.StandardPrice.Value), 2),
+ SumChargePrice = Math.Round(s.Sum(v => v.ChargePrice.Value * v.Amount.Value), 2),
+ SumStandardPrice = Math.Round(s.Sum(v => v.StandardPrice.Value * v.Amount.Value), 2)
+ }).ToList();
+
+ return entlist;
+
+
+ }
+
+
+ ///
+ /// 科室工作量统计 单位和医生
+ ///
+ ///
+ ///
+ [HttpPost("api/app/internalreport/getitemtypeworkloadincustomeranddoctor")]
+ public async Task> GetItemTypeWorkLoadInCustomerAndDoctorAsync(GetItemTypeWorkLoadInCustomerAndDoctorRequestDto input)
+ {
+ var qeruy = from a in await _registerAsbitemRepository.GetQueryableAsync()
+ join b in await _asbitemRepository.GetQueryableAsync() on a.AsbitemId equals b.Id
+ join c in await _itemTypeRepository.GetQueryableAsync() on b.ItemTypeId equals c.Id
+ join d in await _registerCheckRepository.GetQueryableAsync() on a.RegisterCheckId equals d.Id into dd
+ from ad in dd.DefaultIfEmpty()
+ join e in await _patientRegisterRepository.GetQueryableAsync() on a.PatientRegisterId equals e.Id
+ join f in await _customerOrgRepository.GetQueryableAsync() on e.CustomerOrgId equals f.Id into ff
+ from af in ff.DefaultIfEmpty()
+ join g in await _userRepository.GetQueryableAsync() on ad.CheckDoctorId equals g.Id.ToString() into gg
+ from ag in gg.DefaultIfEmpty()
+ where (!string.IsNullOrEmpty(ad.CheckDoctorId) && ad.CheckDate != null)
+ select new
+ {
+ a.AsbitemId,
+ AsbitemName = b.DisplayName,
+ ItemTypeId = b.ItemTypeId,
+ ItemTypeName = c.DisplayName,
+ CustomerName = af.DisplayName,
+ CustomerOrgId = e.CustomerOrgId,
+ ad.CheckDoctorId,
+ ad.CheckDate,
+ DoctorName = ag != null ? ag.UserName : ""
+ };
+
+ if (input.ItemTypeId.Any())
+ {
+ qeruy = qeruy.Where(m => input.ItemTypeId.Contains(m.ItemTypeId));
+ }
+
+ if (!string.IsNullOrEmpty(input.StartDate) && !string.IsNullOrEmpty(input.EndDate))
+ {
+ qeruy = qeruy.Where(m => m.CheckDate.Value.ToDateTime(TimeOnly.MinValue) >= Convert.ToDateTime(input.StartDate) &&
+ m.CheckDate.Value.ToDateTime(TimeOnly.MinValue) < Convert.ToDateTime(input.EndDate).AddDays(1));
+ }
+
+ var entlist = qeruy.GroupBy(g => new { g.CustomerOrgId, g.ItemTypeId, g.AsbitemId, g.CheckDoctorId })
+ .Select(s => new GetItemTypeWorkLoadInCustomerAndDoctorDto
+ {
+ AsbitemName = s.First().AsbitemName,
+ DoctorCheckCount = s.Count(),
+ ItemTypeName = s.First().ItemTypeName,
+ CustomerName = s.First().CustomerName,
+ DoctorName = s.First().DoctorName
+ }).ToList();
+
+ return entlist;
+ }
+
+
+ ///
+ /// 科室工作量统计 单位和组合项目
+ ///
+ ///
+ ///
+ [HttpPost("api/app/internalreport/getitemtypeworkloadincustomerandasbitem")]
+ public async Task> GetItemTypeWorkLoadInCustomerAndAsbitemAsync(GetItemTypeWorkLoadInCustomerAndAsbitemRequestDto input)
+ {
+ var qeruy = from a in await _registerAsbitemRepository.GetQueryableAsync()
+ join b in await _asbitemRepository.GetQueryableAsync() on a.AsbitemId equals b.Id
+ join c in await _itemTypeRepository.GetQueryableAsync() on b.ItemTypeId equals c.Id
+ join d in await _registerCheckRepository.GetQueryableAsync() on a.RegisterCheckId equals d.Id into dd
+ from ad in dd.DefaultIfEmpty()
+ join e in await _patientRegisterRepository.GetQueryableAsync() on a.PatientRegisterId equals e.Id
+ join f in await _customerOrgRepository.GetQueryableAsync() on e.CustomerOrgId equals f.Id into ff
+ from af in ff.DefaultIfEmpty()
+ where (!string.IsNullOrEmpty(ad.CheckDoctorId) && ad.CheckDate != null)
+ select new
+ {
+ a.AsbitemId,
+ AsbitemName = b.DisplayName,
+ ItemTypeId = b.ItemTypeId,
+ ItemTypeName = c.DisplayName,
+ CustomerName = af.DisplayName,
+ CustomerOrgId = e.CustomerOrgId,
+ ad.CheckDate
+ };
+
+ if (input.ItemTypeId.Any())
+ {
+ qeruy = qeruy.Where(m => input.ItemTypeId.Contains(m.ItemTypeId));
+ }
+
+ if (!string.IsNullOrEmpty(input.StartDate) && !string.IsNullOrEmpty(input.EndDate))
+ {
+ qeruy = qeruy.Where(m => m.CheckDate.Value.ToDateTime(TimeOnly.MinValue) >= Convert.ToDateTime(input.StartDate) &&
+ m.CheckDate.Value.ToDateTime(TimeOnly.MinValue) < Convert.ToDateTime(input.EndDate).AddDays(1));
+ }
+
+ var entlist = qeruy.GroupBy(g => new { g.CustomerOrgId, g.ItemTypeId, g.AsbitemId })
+ .Select(s => new GetItemTypeWorkLoadInCustomerAndAsbitemDto
+ {
+ AsbitemName = s.First().AsbitemName,
+ DoctorCheckCount = s.Count(),
+ ItemTypeName = s.First().ItemTypeName,
+ CustomerName = s.First().CustomerName
+ }).ToList();
+
+ return entlist;
+ }
}
}