From 8a28646a4f5b2d0cdf18c365e6d6448d920aca58 Mon Sep 17 00:00:00 2001 From: wxd <123@qq.com> Date: Sun, 31 Mar 2024 15:56:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B6=E8=B4=B9=E6=8A=A5=E8=A1=A8=E3=80=81?= =?UTF-8?q?=E6=94=B6=E8=B4=B9=E7=B1=BB=E5=9E=8B=E5=B8=B8=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ChargeReports/GetProjectFeesReportDto.cs | 72 ++ .../GetProjectFeesReportRequestDto.cs | 32 + .../GetSummaryOfDepartmentalFeesReportDto.cs | 60 ++ ...mmaryOfDepartmentalFeesReportRequestDto.cs | 27 + ...OfPhysicalExaminationPersonnelReportDto.cs | 54 ++ ...calExaminationPersonnelReportRequestDto.cs | 22 + ...tTollCollectorFeeReportInInvoiceTypeDto.cs | 84 +++ ...llectorFeeReportInInvoiceTypeRequestDto.cs | 10 + .../GetTollCollectorFeeReportInPayModeDto.cs | 53 ++ ...llCollectorFeeReportInPayModeRequestDto.cs | 17 + ...ChargeAndChargeBackSettlementRequestDto.cs | 2 +- .../GetChargeAndChargeBackSummaryDto.cs | 2 +- .../ChargeReports/ChargeReportAppService.cs | 708 +++++++++++++++++- .../Charges/ChargeAppService.cs | 4 +- .../Enums/ChargeFlag.cs | 24 + .../ItemTypes/ItemTypeManager.cs | 24 + 16 files changed, 1176 insertions(+), 19 deletions(-) create mode 100644 src/Shentun.Peis.Application.Contracts/ChargeReports/GetProjectFeesReportDto.cs create mode 100644 src/Shentun.Peis.Application.Contracts/ChargeReports/GetProjectFeesReportRequestDto.cs create mode 100644 src/Shentun.Peis.Application.Contracts/ChargeReports/GetSummaryOfDepartmentalFeesReportDto.cs create mode 100644 src/Shentun.Peis.Application.Contracts/ChargeReports/GetSummaryOfDepartmentalFeesReportRequestDto.cs create mode 100644 src/Shentun.Peis.Application.Contracts/ChargeReports/GetSummaryOfPhysicalExaminationPersonnelReportDto.cs create mode 100644 src/Shentun.Peis.Application.Contracts/ChargeReports/GetSummaryOfPhysicalExaminationPersonnelReportRequestDto.cs create mode 100644 src/Shentun.Peis.Application.Contracts/ChargeReports/GetTollCollectorFeeReportInInvoiceTypeDto.cs create mode 100644 src/Shentun.Peis.Application.Contracts/ChargeReports/GetTollCollectorFeeReportInInvoiceTypeRequestDto.cs create mode 100644 src/Shentun.Peis.Domain.Shared/Enums/ChargeFlag.cs diff --git a/src/Shentun.Peis.Application.Contracts/ChargeReports/GetProjectFeesReportDto.cs b/src/Shentun.Peis.Application.Contracts/ChargeReports/GetProjectFeesReportDto.cs new file mode 100644 index 0000000..34fc37e --- /dev/null +++ b/src/Shentun.Peis.Application.Contracts/ChargeReports/GetProjectFeesReportDto.cs @@ -0,0 +1,72 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Shentun.Peis.ChargeReports +{ + + public class GetProjectFeesReportDto + { + /// + /// 应收总金额 + /// + public decimal SumChargeMoney { get; set; } + + + /// + /// 折扣金额 + /// + public decimal SumDiscountMoney { get; set; } + + + /// + /// 实收总金额 + /// + public decimal SumReceivedChargeMoney { get; set; } + + /// + /// 明细 + /// + public List Details { get; set; } + } + + public class GetProjectFeesReport_Detail + { + + /// + /// 项目类别Id 前端不需要 + /// + public Guid ItemTypeId { get; set; } + + /// + /// 项目类别名称==科室 + /// + public string ItemTypeName { get; set; } + + + /// + /// 组合项目Id 前端不需要 + /// + public Guid AsbitemId { get; set; } + + /// + /// 组合项目名称 + /// + public string AsbitemName { get; set; } + + /// + /// 应收金额 + /// + public decimal ChargeMoney { get; set; } + + /// + /// 折扣金额 + /// + public decimal DiscountMoney { get; set; } + + /// + /// 实收金额 + /// + public decimal ReceivedChargeMoney { get; set; } + } +} diff --git a/src/Shentun.Peis.Application.Contracts/ChargeReports/GetProjectFeesReportRequestDto.cs b/src/Shentun.Peis.Application.Contracts/ChargeReports/GetProjectFeesReportRequestDto.cs new file mode 100644 index 0000000..450c6f3 --- /dev/null +++ b/src/Shentun.Peis.Application.Contracts/ChargeReports/GetProjectFeesReportRequestDto.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Text; + +namespace Shentun.Peis.ChargeReports +{ + public class GetProjectFeesReportRequestDto + { + /// + /// 项目类别ID + /// + public Guid? ItemTypeId { get; set; } + + /// + /// 组合项目 可以多个 + /// + public List Asbitems { get; set; } = new List(); + + /// + /// 开始日期 + /// + [Required(ErrorMessage = "开始日期不能为空")] + public string StartDate { get; set; } + + /// + /// 结束日期 + /// + [Required(ErrorMessage = "结束日期不能为空")] + public string EndDate { get; set; } + } +} diff --git a/src/Shentun.Peis.Application.Contracts/ChargeReports/GetSummaryOfDepartmentalFeesReportDto.cs b/src/Shentun.Peis.Application.Contracts/ChargeReports/GetSummaryOfDepartmentalFeesReportDto.cs new file mode 100644 index 0000000..863ba84 --- /dev/null +++ b/src/Shentun.Peis.Application.Contracts/ChargeReports/GetSummaryOfDepartmentalFeesReportDto.cs @@ -0,0 +1,60 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Shentun.Peis.ChargeReports +{ + public class GetSummaryOfDepartmentalFeesReportDto + { + /// + /// 应收总金额 + /// + public decimal SumChargeMoney { get; set; } + + + /// + /// 折扣金额 + /// + public decimal SumDiscountMoney { get; set; } + + + /// + /// 实收总金额 + /// + public decimal SumReceivedChargeMoney { get; set; } + + /// + /// 明细 + /// + public List Details { get; set; } + } + + public class GetSummaryOfDepartmentalFeesReport_Detail + { + + /// + /// 项目类别Id 前端不需要 + /// + public Guid ItemTypeId { get; set; } + + /// + /// 项目类别名称==科室 + /// + public string ItemTypeName { get; set; } + + /// + /// 应收金额 + /// + public decimal ChargeMoney { get; set; } + + /// + /// 折扣金额 + /// + public decimal DiscountMoney { get; set; } + + /// + /// 实收金额 + /// + public decimal ReceivedChargeMoney { get; set; } + } +} diff --git a/src/Shentun.Peis.Application.Contracts/ChargeReports/GetSummaryOfDepartmentalFeesReportRequestDto.cs b/src/Shentun.Peis.Application.Contracts/ChargeReports/GetSummaryOfDepartmentalFeesReportRequestDto.cs new file mode 100644 index 0000000..d441dd1 --- /dev/null +++ b/src/Shentun.Peis.Application.Contracts/ChargeReports/GetSummaryOfDepartmentalFeesReportRequestDto.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Text; + +namespace Shentun.Peis.ChargeReports +{ + public class GetSummaryOfDepartmentalFeesReportRequestDto + { + /// + /// 项目类别ID + /// + public Guid? ItemTypeId { get; set; } + + /// + /// 开始日期 + /// + [Required(ErrorMessage = "开始日期不能为空")] + public string StartDate { get; set; } + + /// + /// 结束日期 + /// + [Required(ErrorMessage = "结束日期不能为空")] + public string EndDate { get; set; } + } +} diff --git a/src/Shentun.Peis.Application.Contracts/ChargeReports/GetSummaryOfPhysicalExaminationPersonnelReportDto.cs b/src/Shentun.Peis.Application.Contracts/ChargeReports/GetSummaryOfPhysicalExaminationPersonnelReportDto.cs new file mode 100644 index 0000000..4c3ca29 --- /dev/null +++ b/src/Shentun.Peis.Application.Contracts/ChargeReports/GetSummaryOfPhysicalExaminationPersonnelReportDto.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Shentun.Peis.ChargeReports +{ + public class GetSummaryOfPhysicalExaminationPersonnelReportDto + { + /// + /// 体检总人次 + /// + public int SumCount { get; set; } + + /// + /// 个人次数 + /// + public int PersonalCount { get; set; } + + /// + /// 单位次数 + /// + public int CustomerOrgCount { get; set; } + + + /// + /// 明细 + /// + public List Details { get; set; } + + } + + public class GetSummaryOfPhysicalExaminationPersonnelReport_Detail + { + /// + /// 单位ID + /// + public Guid CustomerOrgId { get; set; } + + /// + /// 单位名称 + /// + public string CustomerOrgName { get; set; } + + /// + /// 总检人数 + /// + public int SummaryCount { get; set; } + + /// + /// 应收总金额 ChargePrice*Amout + /// + public decimal ChargeMoney { get; set; } + } +} diff --git a/src/Shentun.Peis.Application.Contracts/ChargeReports/GetSummaryOfPhysicalExaminationPersonnelReportRequestDto.cs b/src/Shentun.Peis.Application.Contracts/ChargeReports/GetSummaryOfPhysicalExaminationPersonnelReportRequestDto.cs new file mode 100644 index 0000000..3e7bf33 --- /dev/null +++ b/src/Shentun.Peis.Application.Contracts/ChargeReports/GetSummaryOfPhysicalExaminationPersonnelReportRequestDto.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Text; + +namespace Shentun.Peis.ChargeReports +{ + public class GetSummaryOfPhysicalExaminationPersonnelReportRequestDto + { + /// + /// 开始日期 + /// + [Required(ErrorMessage = "开始日期不能为空")] + public string StartDate { get; set; } + + /// + /// 结束日期 + /// + [Required(ErrorMessage = "结束日期不能为空")] + public string EndDate { get; set; } + } +} diff --git a/src/Shentun.Peis.Application.Contracts/ChargeReports/GetTollCollectorFeeReportInInvoiceTypeDto.cs b/src/Shentun.Peis.Application.Contracts/ChargeReports/GetTollCollectorFeeReportInInvoiceTypeDto.cs new file mode 100644 index 0000000..c81dec2 --- /dev/null +++ b/src/Shentun.Peis.Application.Contracts/ChargeReports/GetTollCollectorFeeReportInInvoiceTypeDto.cs @@ -0,0 +1,84 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Shentun.Peis.ChargeReports +{ + public class GetTollCollectorFeeReportInInvoiceTypeDto + { + /// + /// 收费票据数量 + /// + public int ChargeCount { get; set; } + + /// + /// 退费票据数量 + /// + public int ChargeBackCount { get; set; } + + /// + /// 收费日期 + /// + public string ChargeDate { get; set; } + + /// + /// 收费明细 + /// + public GetTollCollectorFeeReportInInvoiceType_ChargeDetail ChargeDetails { get; set; } + + /// + /// 退费明细 + /// + public GetTollCollectorFeeReportInInvoiceType_ChargeBackDetail ChargeBackDetails { get; set; } + + /// + /// 总合计金额 + /// + public decimal SumTotalMoney { get; set; } + } + + /// + /// 收费 + /// + public class GetTollCollectorFeeReportInInvoiceType_ChargeDetail + { + /// + /// 小计金额 + /// + public decimal TotalMoney { get; set; } + + /// + /// 明细 + /// + public List InvoiceTypeDetails { get; set; } + } + + /// + /// 退费 + /// + public class GetTollCollectorFeeReportInInvoiceType_ChargeBackDetail + { + /// + /// 小计金额 + /// + public decimal TotalMoney { get; set; } + + /// + /// 明细 + /// + public List InvoiceTypeDetails { get; set; } + } + + public class GetTollCollectorFeeReportInInvoiceType_InvoiceTypeDetail + { + /// + /// 发票类型 + /// + public string InvoiceTypeName { get; set; } + + /// + /// 金额 + /// + public decimal InvoiceTypeMoney { get; set; } + } +} diff --git a/src/Shentun.Peis.Application.Contracts/ChargeReports/GetTollCollectorFeeReportInInvoiceTypeRequestDto.cs b/src/Shentun.Peis.Application.Contracts/ChargeReports/GetTollCollectorFeeReportInInvoiceTypeRequestDto.cs new file mode 100644 index 0000000..6081cb1 --- /dev/null +++ b/src/Shentun.Peis.Application.Contracts/ChargeReports/GetTollCollectorFeeReportInInvoiceTypeRequestDto.cs @@ -0,0 +1,10 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Shentun.Peis.ChargeReports +{ + public class GetTollCollectorFeeReportInInvoiceTypeRequestDto: GetTollCollectorFeeReportInPayModeRequestDto + { + } +} diff --git a/src/Shentun.Peis.Application.Contracts/ChargeReports/GetTollCollectorFeeReportInPayModeDto.cs b/src/Shentun.Peis.Application.Contracts/ChargeReports/GetTollCollectorFeeReportInPayModeDto.cs index 245dae4..bb51f34 100644 --- a/src/Shentun.Peis.Application.Contracts/ChargeReports/GetTollCollectorFeeReportInPayModeDto.cs +++ b/src/Shentun.Peis.Application.Contracts/ChargeReports/GetTollCollectorFeeReportInPayModeDto.cs @@ -1,10 +1,63 @@ using System; using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; using System.Text; namespace Shentun.Peis.ChargeReports { public class GetTollCollectorFeeReportInPayModeDto { + /// + /// 收费票据数量 + /// + public int ChargeCount { get; set; } + + /// + /// 退费票据数量 + /// + public int ChargeBackCount { get; set; } + + /// + /// 收费日期 + /// + public string ChargeDate { get; set;} + + /// + /// 收费明细 + /// + public List ChargeDetails { get; set; } + + /// + /// 总合计金额 + /// + public decimal SumTotalMoney { get; set; } + } + + public class GetTollCollectorFeeReportInPayMode_ChargeAndChargeBackDetail + { + /// + /// 收费员 + /// + public string ChargeName { get; set; } + + /// + /// 支付方式名称 + /// + public string PayModeName { get; set; } + + /// + /// 收费金额 + /// + public decimal ChargeMoney { get; set; } + + /// + /// 退费金额 + /// + public decimal ChargeBackMoney { get; set; } + + /// + /// 合计金额 + /// + public decimal TotalMoney { get; set; } } } diff --git a/src/Shentun.Peis.Application.Contracts/ChargeReports/GetTollCollectorFeeReportInPayModeRequestDto.cs b/src/Shentun.Peis.Application.Contracts/ChargeReports/GetTollCollectorFeeReportInPayModeRequestDto.cs index 8f4e13e..35f2026 100644 --- a/src/Shentun.Peis.Application.Contracts/ChargeReports/GetTollCollectorFeeReportInPayModeRequestDto.cs +++ b/src/Shentun.Peis.Application.Contracts/ChargeReports/GetTollCollectorFeeReportInPayModeRequestDto.cs @@ -1,10 +1,27 @@ using System; using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; using System.Text; namespace Shentun.Peis.ChargeReports { public class GetTollCollectorFeeReportInPayModeRequestDto { + /// + /// 收费员ID 集合 + /// + public List UserIds { get; set; } = new List(); + + /// + /// 开始日期 + /// + [Required(ErrorMessage = "开始日期不能为空")] + public string StartDate { get; set; } + + /// + /// 结束日期 + /// + [Required(ErrorMessage = "结束日期不能为空")] + public string EndDate { get; set; } } } diff --git a/src/Shentun.Peis.Application.Contracts/Charges/ChargeAndChargeBackSettlementRequestDto.cs b/src/Shentun.Peis.Application.Contracts/Charges/ChargeAndChargeBackSettlementRequestDto.cs index 2bde758..52caea0 100644 --- a/src/Shentun.Peis.Application.Contracts/Charges/ChargeAndChargeBackSettlementRequestDto.cs +++ b/src/Shentun.Peis.Application.Contracts/Charges/ChargeAndChargeBackSettlementRequestDto.cs @@ -21,5 +21,5 @@ namespace Shentun.Peis.Charges /// public string EndDate { get; set; } } -} + } diff --git a/src/Shentun.Peis.Application.Contracts/Charges/GetChargeAndChargeBackSummaryDto.cs b/src/Shentun.Peis.Application.Contracts/Charges/GetChargeAndChargeBackSummaryDto.cs index 2d59f56..e5263b9 100644 --- a/src/Shentun.Peis.Application.Contracts/Charges/GetChargeAndChargeBackSummaryDto.cs +++ b/src/Shentun.Peis.Application.Contracts/Charges/GetChargeAndChargeBackSummaryDto.cs @@ -53,6 +53,6 @@ namespace Shentun.Peis.Charges /// /// 收费或退费金额 /// - public string Money { get; set; } + public decimal Money { get; set; } } } diff --git a/src/Shentun.Peis.Application/ChargeReports/ChargeReportAppService.cs b/src/Shentun.Peis.Application/ChargeReports/ChargeReportAppService.cs index 61cf159..8c330c0 100644 --- a/src/Shentun.Peis.Application/ChargeReports/ChargeReportAppService.cs +++ b/src/Shentun.Peis.Application/ChargeReports/ChargeReportAppService.cs @@ -1,11 +1,17 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using Shentun.Peis.Charges; +using Shentun.Peis.Enums; +using Shentun.Peis.ItemTypes; using Shentun.Peis.Models; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using TencentCloud.Faceid.V20180301.Models; +using TencentCloud.Mrs.V20200910.Models; +using Volo.Abp.Application.Services; using Volo.Abp.Domain.Repositories; using Volo.Abp.Identity; using Volo.Abp.Users; @@ -17,25 +23,40 @@ namespace Shentun.Peis.ChargeReports /// [Authorize] [ApiExplorerSettings(GroupName = "Work")] - public class ChargeReportAppService + public class ChargeReportAppService : ApplicationService { private readonly IRepository _chargeRepository; private readonly IRepository _chargePayRepository; + private readonly IRepository _chargeAsbitemRepository; private readonly IRepository _payModeRepository; private readonly IRepository _chargeBackRepository; private readonly IRepository _chargeBackPayRepository; private readonly IRepository _userRepository; - - - + private readonly IRepository _asbitemRepository; + private readonly IRepository _invoiceItemTypeRepository; + private readonly IRepository _patientRegisterRepository; + private readonly IRepository _registerAsbitemRepository; + private readonly IRepository _customerOrgRegisterRepository; + private readonly IRepository _customerOrgRepository; + private readonly IRepository _itemTypeRepository; + private readonly ItemTypeManager _itemTypeManager; public ChargeReportAppService( IRepository chargeRepository, IRepository chargeBackRepository, IRepository chargePayRepository, IRepository payModeRepository, IRepository chargeBackPayRepository, - IRepository userRepository + IRepository userRepository, + IRepository chargeAsbitemRepository, + IRepository asbitemRepository, + IRepository invoiceItemTypeRepository, + IRepository patientRegisterRepository, + IRepository registerAsbitemRepository, + IRepository customerOrgRegisterRepository, + IRepository customerOrgRepository, + IRepository itemTypeRepository, + ItemTypeManager itemTypeManager ) { _chargeRepository = chargeRepository; @@ -44,20 +65,677 @@ namespace Shentun.Peis.ChargeReports _payModeRepository = payModeRepository; _chargeBackPayRepository = chargeBackPayRepository; _userRepository = userRepository; + _chargeAsbitemRepository = chargeAsbitemRepository; + _asbitemRepository = asbitemRepository; + _invoiceItemTypeRepository = invoiceItemTypeRepository; + _patientRegisterRepository = patientRegisterRepository; + _registerAsbitemRepository = registerAsbitemRepository; + _customerOrgRegisterRepository = customerOrgRegisterRepository; + _customerOrgRepository = customerOrgRepository; + _itemTypeRepository = itemTypeRepository; + _itemTypeManager = itemTypeManager; + } + + + + /// + /// 收费员收费报表 按支付方式 + /// + /// + /// + [HttpPost("api/app/charge-report/get-toll-collector-fee-report-in-pay-mode")] + public async Task GetTollCollectorFeeReportInPayModeAsync(GetTollCollectorFeeReportInPayModeRequestDto input) + { + #region 收费 + var chargeQuery = from a in await _chargeRepository.GetQueryableAsync() + join b in await _chargePayRepository.GetQueryableAsync() on a.Id equals b.ChargeId + join c in await _payModeRepository.GetQueryableAsync() on b.PayModeId equals c.Id into cc + from ac in cc.DefaultIfEmpty() + join d in await _userRepository.GetQueryableAsync() on a.CreatorId equals d.Id into dd + from ad in dd.DefaultIfEmpty() + select new + { + a, + b, + PayModeName = ac != null ? ac.DisplayName : "", + UserName = ad != null ? ad.UserName : "" + }; + + if (input.UserIds.Any()) + { + chargeQuery = chargeQuery.Where(m => input.UserIds.Contains(m.a.CreatorId.Value)); + } + + if (!string.IsNullOrWhiteSpace(input.StartDate) && !string.IsNullOrWhiteSpace(input.EndDate)) + { + chargeQuery = chargeQuery.Where(m => m.a.CreationTime >= Convert.ToDateTime(input.StartDate) + && m.a.CreationTime < Convert.ToDateTime(input.EndDate).AddDays(1)); + } + + //收费归总 + var chargeDetails = chargeQuery.GroupBy(g => g.a.CreatorId).Select(s => new GetChargeAndChargeBackSummary_ChargeDetail + { + UserName = s.FirstOrDefault().UserName, + PayModeDetails = s.GroupBy(gg => gg.b.PayModeId).Select(ss => new GetChargeAndChargeBackSummary_PayModeDetail + { + PayModeName = ss.FirstOrDefault().PayModeName, + Money = Math.Round(ss.Sum(sss => sss.b.ChargeMoney), 2) + }).ToList() + }); + #endregion + + #region 退费 + + var chargeBackQuery = from a in await _chargeBackRepository.GetQueryableAsync() + join b in await _chargeBackPayRepository.GetQueryableAsync() on a.Id equals b.ChargeBackId + join c in await _payModeRepository.GetQueryableAsync() on b.PayModeId equals c.Id into cc + from ac in cc.DefaultIfEmpty() + join d in await _userRepository.GetQueryableAsync() on a.CreatorId equals d.Id into dd + from ad in dd.DefaultIfEmpty() + select new + { + a, + b, + PayModeName = ac != null ? ac.DisplayName : "", + UserName = ad != null ? ad.UserName : "" + }; + + if (input.UserIds.Any()) + { + chargeBackQuery = chargeBackQuery.Where(m => input.UserIds.Contains(m.a.CreatorId.Value)); + } + + if (!string.IsNullOrWhiteSpace(input.StartDate) && !string.IsNullOrWhiteSpace(input.EndDate)) + { + chargeBackQuery = chargeBackQuery.Where(m => m.a.CreationTime >= Convert.ToDateTime(input.StartDate) + && m.a.CreationTime < Convert.ToDateTime(input.EndDate).AddDays(1)); + } + + //收费归总 + var chargeBackDetails = chargeBackQuery.GroupBy(g => g.a.CreatorId).Select(s => new GetChargeAndChargeBackSummary_ChargeBackDetail + { + UserName = s.FirstOrDefault().UserName, + PayModeDetails = s.GroupBy(gg => gg.b.PayModeId).Select(ss => new GetChargeAndChargeBackSummary_PayModeDetail + { + PayModeName = ss.FirstOrDefault().PayModeName, + Money = Math.Round(ss.Sum(sss => sss.b.BackMoeny), 2) + }).ToList() + }); + #endregion + + + + #region 拼接收费数据 + + List chargeAndChargeBackDetails = new List(); + + //去重所有收费员 + var userNameList = chargeDetails.ToList().Select(s => s.UserName).Union(chargeBackDetails.ToList().Select(s => s.UserName)); + + foreach (var userName in userNameList) + { + //添加收费数据 + foreach (var payMode in chargeDetails.Where(m => m.UserName == userName).FirstOrDefault().PayModeDetails) + { + chargeAndChargeBackDetails.Add(new GetTollCollectorFeeReportInPayMode_ChargeAndChargeBackDetail + { + ChargeName = userName, + PayModeName = payMode.PayModeName, + ChargeMoney = payMode.Money, + ChargeBackMoney = 0 + }); + } + //添加退费数据 + foreach (var payMode in chargeBackDetails.Where(m => m.UserName == userName).FirstOrDefault().PayModeDetails) + { + //支付方式是否已存在 + var isPayModeName = chargeAndChargeBackDetails.Where(m => m.ChargeName == userName && m.PayModeName == payMode.PayModeName).FirstOrDefault(); + if (isPayModeName != null) + { + //收费处已存在 + + chargeAndChargeBackDetails.ForEach(m => + { + if (m.PayModeName == payMode.PayModeName && m.ChargeName == userName) + { + m.ChargeBackMoney = payMode.Money; + m.TotalMoney = m.ChargeMoney - payMode.Money; + } + }); + } + else + { + chargeAndChargeBackDetails.Add(new GetTollCollectorFeeReportInPayMode_ChargeAndChargeBackDetail + { + ChargeName = userName, + PayModeName = payMode.PayModeName, + ChargeMoney = 0, + ChargeBackMoney = payMode.Money, + TotalMoney = 0 - payMode.Money + }); + } + + } + } + + #endregion + + + string chargeDate = Convert.ToDateTime(input.StartDate).ToString("yyyy年MM月dd日") + "到" + Convert.ToDateTime(input.EndDate).ToString("yyyy年MM月dd日"); + + var tollCollectorFeeReportInPayModeDto = new GetTollCollectorFeeReportInPayModeDto + { + ChargeDate = chargeDate, + ChargeCount = chargeQuery.GroupBy(g => g.a.Id).Count(), + ChargeBackCount = chargeBackQuery.GroupBy(g => g.a.Id).Count(), + ChargeDetails = chargeAndChargeBackDetails, + SumTotalMoney = chargeAndChargeBackDetails.Any() ? Math.Round(chargeAndChargeBackDetails.Sum(s => s.TotalMoney), 2) : 0 + }; + + + return tollCollectorFeeReportInPayModeDto; + + + } + + + /// + /// 收费员收费报表 按发票类型 + /// + /// + /// + [HttpPost("api/app/charge-report/get-toll-collector-fee-report-in-invoice-type")] + public async Task GetTollCollectorFeeReportInInvoiceTypeAsync(GetTollCollectorFeeReportInInvoiceTypeRequestDto input) + { + #region 收费 + var chargeQuery = from a in await _chargeRepository.GetQueryableAsync() + join b in await _chargeAsbitemRepository.GetQueryableAsync() on a.Id equals b.ChargeId + join c in await _asbitemRepository.GetQueryableAsync() on b.AsbitemId equals c.Id into cc + from ac in cc.DefaultIfEmpty() + join e in await _invoiceItemTypeRepository.GetQueryableAsync() on ac.InvoiceItemTypeId equals e.Id into ee + from ae in ee.DefaultIfEmpty() + join d in await _userRepository.GetQueryableAsync() on a.CreatorId equals d.Id into dd + from ad in dd.DefaultIfEmpty() + select new + { + a, + b, + ac, + InvoiceItemTypeName = ae != null ? ae.DisplayName : "", + UserName = ad != null ? ad.UserName : "" + }; + + if (input.UserIds.Any()) + { + chargeQuery = chargeQuery.Where(m => input.UserIds.Contains(m.a.CreatorId.Value)); + } + + if (!string.IsNullOrWhiteSpace(input.StartDate) && !string.IsNullOrWhiteSpace(input.EndDate)) + { + chargeQuery = chargeQuery.Where(m => m.a.CreationTime >= Convert.ToDateTime(input.StartDate) + && m.a.CreationTime < Convert.ToDateTime(input.EndDate).AddDays(1)); + } + + //收费归总 + var chargeDetails = chargeQuery.GroupBy(g => g.ac.InvoiceItemTypeId).Select(s => new GetTollCollectorFeeReportInInvoiceType_InvoiceTypeDetail + { + InvoiceTypeName = s.FirstOrDefault().InvoiceItemTypeName, + InvoiceTypeMoney = Math.Round(s.Sum(ss => ss.b.Amount * ss.b.ChargePrice), 2) + }).ToList(); + #endregion + + #region 退费 + + var chargeBackQuery = from a in await _chargeBackRepository.GetQueryableAsync() + join b in await _chargeRepository.GetQueryableAsync() on a.ChargeId equals b.Id + join c in await _chargeAsbitemRepository.GetQueryableAsync() on b.Id equals c.ChargeId + join d in await _asbitemRepository.GetQueryableAsync() on c.AsbitemId equals d.Id into dd + from ad in dd.DefaultIfEmpty() + join e in await _invoiceItemTypeRepository.GetQueryableAsync() on ad.InvoiceItemTypeId equals e.Id into ee + from ae in ee.DefaultIfEmpty() + join f in await _userRepository.GetQueryableAsync() on a.CreatorId equals f.Id into ff + from af in ff.DefaultIfEmpty() + select new + { + a, + c, + ad, + InvoiceItemTypeName = ae != null ? ae.DisplayName : "", + UserName = af != null ? af.UserName : "" + }; + + if (input.UserIds.Any()) + { + chargeBackQuery = chargeBackQuery.Where(m => input.UserIds.Contains(m.a.CreatorId.Value)); + } + + if (!string.IsNullOrWhiteSpace(input.StartDate) && !string.IsNullOrWhiteSpace(input.EndDate)) + { + chargeBackQuery = chargeBackQuery.Where(m => m.a.CreationTime >= Convert.ToDateTime(input.StartDate) + && m.a.CreationTime < Convert.ToDateTime(input.EndDate).AddDays(1)); + } + + //收费归总 + var chargeBackDetails = chargeBackQuery.GroupBy(g => g.ad.InvoiceItemTypeId).Select(s => new GetTollCollectorFeeReportInInvoiceType_InvoiceTypeDetail + { + InvoiceTypeName = s.FirstOrDefault().InvoiceItemTypeName, + InvoiceTypeMoney = Math.Round(s.Sum(ss => ss.c.Amount * ss.c.ChargePrice), 2) + }).ToList(); + + + #endregion + + + string chargeDate = Convert.ToDateTime(input.StartDate).ToString("yyyy年MM月dd日") + "到" + Convert.ToDateTime(input.EndDate).ToString("yyyy年MM月dd日"); + + //收款合计 + decimal chargeTotalMoney = chargeDetails.Any() ? Math.Round(chargeDetails.Sum(s => s.InvoiceTypeMoney), 2) : 0; + + //退费合计 + decimal chargeBackTotalMoney = chargeBackDetails.Any() ? Math.Round(chargeBackDetails.Sum(s => s.InvoiceTypeMoney), 2) : 0; + + var tollCollectorFeeReportInInvoiceTypeDto = new GetTollCollectorFeeReportInInvoiceTypeDto + { + ChargeDate = chargeDate, + ChargeCount = chargeQuery.GroupBy(g => g.a.Id).Count(), + ChargeBackCount = chargeBackQuery.GroupBy(g => g.a.Id).Count(), + ChargeDetails = new GetTollCollectorFeeReportInInvoiceType_ChargeDetail + { + InvoiceTypeDetails = chargeDetails, + TotalMoney = chargeTotalMoney + }, + ChargeBackDetails = new GetTollCollectorFeeReportInInvoiceType_ChargeBackDetail + { + InvoiceTypeDetails = chargeBackDetails, + TotalMoney = chargeBackTotalMoney + }, + SumTotalMoney = chargeTotalMoney - chargeBackTotalMoney + }; + + + return tollCollectorFeeReportInInvoiceTypeDto; + + + } + + + + + + /// + /// 项目收费报表 + /// + /// + /// + [HttpPost("api/app/charge-report/get-project-fees-report")] + public async Task GetProjectFeesReportAsync(GetProjectFeesReportRequestDto input) + { + + #region 查询项目类别ID + List itmeTypeIds = new List(); + + if (input.ItemTypeId != null) + { + itmeTypeIds = await _itemTypeManager.GetChildItemTypeIdsAsync(input.ItemTypeId.Value); + } + + #endregion + + #region 登记 + var query = from a in await _registerAsbitemRepository.GetQueryableAsync() + join b in await _asbitemRepository.GetQueryableAsync() on a.AsbitemId equals b.Id into bb + from ab in bb.DefaultIfEmpty() + join c in await _itemTypeRepository.GetQueryableAsync() on ab.ItemTypeId equals c.Id into cc + from ac in cc.DefaultIfEmpty() + where a.IsCharge == 'Y' + select new + { + a, + ab, + ac, + AsbitemName = ab != null ? ab.DisplayName : "", + ItemTypeName = ac != null ? ac.DisplayName : "" + }; + + if (itmeTypeIds.Any()) + { + query = query.Where(m => itmeTypeIds.Contains(m.ab.ItemTypeId)); + } + + if (input.Asbitems.Any()) + { + query = query.Where(m => input.Asbitems.Contains(m.a.AsbitemId)); + } + + if (!string.IsNullOrWhiteSpace(input.StartDate) && !string.IsNullOrWhiteSpace(input.EndDate)) + { + query = query.Where(m => m.a.CreationTime >= Convert.ToDateTime(input.StartDate) + && m.a.CreationTime < Convert.ToDateTime(input.EndDate).AddDays(1)); + } + + + //按项目类别分组 + var itemTypeGroups = query.GroupBy(g => new { g.ab.ItemTypeId, g.a.AsbitemId }).Select(s => new GetProjectFeesReport_Detail + { + ItemTypeId = s.Key.ItemTypeId, + AsbitemId = s.Key.AsbitemId, + ItemTypeName = s.FirstOrDefault().ItemTypeName, + AsbitemName = s.FirstOrDefault().AsbitemName, + ChargeMoney = Math.Round(s.Sum(ss => ss.a.Amount.Value * ss.a.ChargePrice.Value), 2), + ReceivedChargeMoney = 0 + }).ToList(); + + #endregion + + + #region 收费金额统计 + + + var chargeQuery = from a in await _chargeAsbitemRepository.GetQueryableAsync() + join d in await _chargeRepository.GetQueryableAsync() on a.ChargeId equals d.Id + join b in await _asbitemRepository.GetQueryableAsync() on a.AsbitemId equals b.Id into bb + from ab in bb.DefaultIfEmpty() + join c in await _itemTypeRepository.GetQueryableAsync() on ab.ItemTypeId equals c.Id into cc + from ac in cc.DefaultIfEmpty() + where d.ChargeFlag == ChargeFlag.Charge + select new + { + a, + ab, + AsbitemName = ab != null ? ab.DisplayName : "", + ItemTypeName = ac != null ? ac.DisplayName : "" + }; + + if (itmeTypeIds.Any()) + { + chargeQuery = chargeQuery.Where(m => itmeTypeIds.Contains(m.ab.ItemTypeId)); + } + + if (input.Asbitems.Any()) + { + query = query.Where(m => input.Asbitems.Contains(m.a.AsbitemId)); + } + + if (!string.IsNullOrWhiteSpace(input.StartDate) && !string.IsNullOrWhiteSpace(input.EndDate)) + { + chargeQuery = chargeQuery.Where(m => m.a.CreationTime >= Convert.ToDateTime(input.StartDate) + && m.a.CreationTime < Convert.ToDateTime(input.EndDate).AddDays(1)); + } + + + //按项目类别分组 收费 + var itemTypeGroupCharges = chargeQuery.GroupBy(g => new { g.ab.ItemTypeId, g.a.AsbitemId }).Select(s => new GetProjectFeesReport_Detail + { + ItemTypeId = s.Key.ItemTypeId, + AsbitemId = s.Key.AsbitemId, + ItemTypeName = s.FirstOrDefault().ItemTypeName, + AsbitemName = s.FirstOrDefault().AsbitemName, + ReceivedChargeMoney = Math.Round(s.Sum(ss => ss.a.Amount * ss.a.ChargePrice), 2), + ChargeMoney = 0 + }).ToList(); + + #endregion + + + #region 拼接收费数据 + + List projectFeesReport_Details = new List(); + + //去重科室Id + var itemTypeIdList = itemTypeGroups.Select(s => new { s.ItemTypeId, s.AsbitemId }).Union(itemTypeGroupCharges.Select(s => new { s.ItemTypeId, s.AsbitemId })); + + foreach (var item in itemTypeIdList) + { + + var tempData = itemTypeGroups.Where(m => m.ItemTypeId == item.ItemTypeId && m.AsbitemId == item.AsbitemId).FirstOrDefault(); + + if (tempData != null) + { + var itemTypeGroupCharge = itemTypeGroupCharges.Where(m => m.ItemTypeId == item.ItemTypeId && m.AsbitemId == item.AsbitemId).FirstOrDefault(); + if (itemTypeGroupCharge != null) + { + tempData.ReceivedChargeMoney = itemTypeGroupCharge.ReceivedChargeMoney; + } + } + else + { + tempData = itemTypeGroupCharges.Where(m => m.ItemTypeId == item.ItemTypeId && m.AsbitemId == item.AsbitemId).FirstOrDefault(); + } + + + tempData.DiscountMoney = tempData.ChargeMoney - tempData.ReceivedChargeMoney; + + projectFeesReport_Details.Add(tempData); + } + + #endregion + + + decimal sumChargeMoney = projectFeesReport_Details.Any() ? Math.Round(projectFeesReport_Details.Sum(s => s.ChargeMoney), 2) : 0; + decimal sumDiscountMoney = projectFeesReport_Details.Any() ? Math.Round(projectFeesReport_Details.Sum(s => s.DiscountMoney), 2) : 0; + decimal sumReceivedChargeMoney = projectFeesReport_Details.Any() ? Math.Round(projectFeesReport_Details.Sum(s => s.ReceivedChargeMoney), 2) : 0; + + + var projectFeesReportDto = new GetProjectFeesReportDto + { + Details = projectFeesReport_Details, + SumChargeMoney = sumChargeMoney, + SumDiscountMoney = sumDiscountMoney, + SumReceivedChargeMoney = sumReceivedChargeMoney + }; + + return projectFeesReportDto; + + } + + + /// + /// 科室收费汇总表 + /// + /// + /// + [HttpPost("api/app/charge-report/get-summary-of-departmental-fees-report")] + public async Task GetSummaryOfDepartmentalFeesReportAsync(GetSummaryOfDepartmentalFeesReportRequestDto input) + { + + #region 查询项目类别ID + List itmeTypeIds = new List(); + + if (input.ItemTypeId != null) + { + itmeTypeIds = await _itemTypeManager.GetChildItemTypeIdsAsync(input.ItemTypeId.Value); + } + #endregion + + #region 登记 + var query = from a in await _registerAsbitemRepository.GetQueryableAsync() + join b in await _asbitemRepository.GetQueryableAsync() on a.AsbitemId equals b.Id into bb + from ab in bb.DefaultIfEmpty() + join c in await _itemTypeRepository.GetQueryableAsync() on ab.ItemTypeId equals c.Id into cc + from ac in cc.DefaultIfEmpty() + where a.IsCharge == 'Y' + select new + { + a, + ab, + ac, + ItemTypeName = ac != null ? ac.DisplayName : "" + }; + + if (itmeTypeIds.Any()) + { + query = query.Where(m => itmeTypeIds.Contains(m.ab.ItemTypeId)); + } + + if (!string.IsNullOrWhiteSpace(input.StartDate) && !string.IsNullOrWhiteSpace(input.EndDate)) + { + query = query.Where(m => m.a.CreationTime >= Convert.ToDateTime(input.StartDate) + && m.a.CreationTime < Convert.ToDateTime(input.EndDate).AddDays(1)); + } + + + //按项目类别分组 + var itemTypeGroups = query.GroupBy(g => g.ab.ItemTypeId).Select(s => new GetSummaryOfDepartmentalFeesReport_Detail + { + ItemTypeId = s.Key, + ItemTypeName = s.FirstOrDefault().ItemTypeName, + ChargeMoney = Math.Round(s.Sum(ss => ss.a.Amount.Value * ss.a.ChargePrice.Value), 2), + ReceivedChargeMoney = 0 + }).ToList(); + + #endregion + + + #region 收费金额统计 + + + var chargeQuery = from a in await _chargeAsbitemRepository.GetQueryableAsync() + join d in await _chargeRepository.GetQueryableAsync() on a.ChargeId equals d.Id + join b in await _asbitemRepository.GetQueryableAsync() on a.AsbitemId equals b.Id into bb + from ab in bb.DefaultIfEmpty() + join c in await _itemTypeRepository.GetQueryableAsync() on ab.ItemTypeId equals c.Id into cc + from ac in cc.DefaultIfEmpty() + where d.ChargeFlag == ChargeFlag.Charge + select new + { + a, + ab, + ItemTypeName = ac != null ? ac.DisplayName : "" + }; + + if (itmeTypeIds.Any()) + { + chargeQuery = chargeQuery.Where(m => itmeTypeIds.Contains(m.ab.ItemTypeId)); + } + + if (!string.IsNullOrWhiteSpace(input.StartDate) && !string.IsNullOrWhiteSpace(input.EndDate)) + { + chargeQuery = chargeQuery.Where(m => m.a.CreationTime >= Convert.ToDateTime(input.StartDate) + && m.a.CreationTime < Convert.ToDateTime(input.EndDate).AddDays(1)); + } + + + //按项目类别分组 收费 + var itemTypeGroupCharges = chargeQuery.GroupBy(g => g.ab.ItemTypeId).Select(s => new GetSummaryOfDepartmentalFeesReport_Detail + { + ItemTypeId = s.Key, + ItemTypeName = s.FirstOrDefault().ItemTypeName, + ReceivedChargeMoney = Math.Round(s.Sum(ss => ss.a.Amount * ss.a.ChargePrice), 2), + ChargeMoney = 0 + }).ToList(); + + #endregion + + + #region 拼接收费数据 + + List summaryOfDepartmentalFeesReport_Details = new List(); + + //去重科室Id + var itemTypeIdList = itemTypeGroups.Select(s => s.ItemTypeId).Union(itemTypeGroupCharges.Select(s => s.ItemTypeId)); + + foreach (var itemTypeId in itemTypeIdList) + { + + var tempData = itemTypeGroups.Where(m => m.ItemTypeId == itemTypeId).FirstOrDefault(); + + if (tempData != null) + { + var itemTypeGroupCharge = itemTypeGroupCharges.Where(m => m.ItemTypeId == itemTypeId).FirstOrDefault(); + if (itemTypeGroupCharge != null) + { + tempData.ReceivedChargeMoney = itemTypeGroupCharge.ReceivedChargeMoney; + } + } + else + { + tempData = itemTypeGroupCharges.Where(m => m.ItemTypeId == itemTypeId).FirstOrDefault(); + } + + + tempData.DiscountMoney = tempData.ChargeMoney - tempData.ReceivedChargeMoney; + + summaryOfDepartmentalFeesReport_Details.Add(tempData); + } + + #endregion + + + decimal sumChargeMoney = summaryOfDepartmentalFeesReport_Details.Any() ? Math.Round(summaryOfDepartmentalFeesReport_Details.Sum(s => s.ChargeMoney), 2) : 0; + decimal sumDiscountMoney = summaryOfDepartmentalFeesReport_Details.Any() ? Math.Round(summaryOfDepartmentalFeesReport_Details.Sum(s => s.DiscountMoney), 2) : 0; + decimal sumReceivedChargeMoney = summaryOfDepartmentalFeesReport_Details.Any() ? Math.Round(summaryOfDepartmentalFeesReport_Details.Sum(s => s.ReceivedChargeMoney), 2) : 0; + + + var summaryOfDepartmentalFeesReportDto = new GetSummaryOfDepartmentalFeesReportDto + { + Details = summaryOfDepartmentalFeesReport_Details, + SumChargeMoney = sumChargeMoney, + SumDiscountMoney = sumDiscountMoney, + SumReceivedChargeMoney = sumReceivedChargeMoney + }; + + return summaryOfDepartmentalFeesReportDto; + } - ///// - ///// 收费员收费报表 按支付方式 - ///// - ///// - ///// - //[HttpPost("api/app/charge-report/get-toll-collector-fee-report-in-pay-mode")] - //public async Task GetTollCollectorFeeReportInPayModeAsync(GetTollCollectorFeeReportInPayModeRequestDto input) - //{ - - //} + /// + /// 体检人次汇总 + /// + /// + /// + [HttpPost("api/app/charge-report/get-summary-of-physical-examination-personnel-report")] + public async Task GetSummaryOfPhysicalExaminationPersonnelReportAsync(GetSummaryOfPhysicalExaminationPersonnelReportRequestDto input) + { + var query = from a in await _patientRegisterRepository.GetQueryableAsync() + join b in await _registerAsbitemRepository.GetQueryableAsync() on a.Id equals b.PatientRegisterId + join c in await _customerOrgRegisterRepository.GetQueryableAsync() on a.CustomerOrgRegisterId equals c.Id into cc + from ac in cc.DefaultIfEmpty() + join d in await _customerOrgRepository.GetQueryableAsync() on ac.CustomerOrgId equals d.Id into dd + from ad in dd.DefaultIfEmpty() + where a.CompleteFlag == PatientRegisterCompleteFlag.GeneralInspected + select new + { + a, + b, + ac, + CustomerOrgName = ad != null ? ad.DisplayName : "" + }; + + if (!string.IsNullOrWhiteSpace(input.StartDate) && !string.IsNullOrWhiteSpace(input.EndDate)) + { + query = query.Where(m => m.a.CreationTime >= Convert.ToDateTime(input.StartDate) + && m.a.CreationTime < Convert.ToDateTime(input.EndDate).AddDays(1)); + } + + //按单位分组 + var customerOrgGroup = query.GroupBy(g => g.ac.CustomerOrgId).Select(s => new GetSummaryOfPhysicalExaminationPersonnelReport_Detail + { + CustomerOrgName = s.FirstOrDefault().CustomerOrgName, + SummaryCount = s.Count(), + ChargeMoney = Math.Round(s.Sum(ss => ss.b.Amount.Value * ss.b.ChargePrice.Value), 2) + }).ToList(); + + + + //个人次数 + int personalCount = customerOrgGroup.Where(m => m.CustomerOrgId == GuidFlag.PersonCustomerOrgId).Count(); + //单位次数 + int customerOrgCount = customerOrgGroup.Count - personalCount; + + var summaryOfPhysicalExaminationPersonnelReportDto = new GetSummaryOfPhysicalExaminationPersonnelReportDto + { + CustomerOrgCount = customerOrgCount, + PersonalCount = personalCount, + Details = customerOrgGroup, + SumCount = customerOrgCount + personalCount + }; + + return summaryOfPhysicalExaminationPersonnelReportDto; + + } + } diff --git a/src/Shentun.Peis.Application/Charges/ChargeAppService.cs b/src/Shentun.Peis.Application/Charges/ChargeAppService.cs index 5570de2..609cb51 100644 --- a/src/Shentun.Peis.Application/Charges/ChargeAppService.cs +++ b/src/Shentun.Peis.Application/Charges/ChargeAppService.cs @@ -92,7 +92,7 @@ namespace Shentun.Peis.Charges PayModeDetails = s.GroupBy(gg => gg.b.PayModeId).Select(ss => new GetChargeAndChargeBackSummary_PayModeDetail { PayModeName = ss.FirstOrDefault().PayModeName, - Money = Math.Round(ss.Sum(sss => sss.b.ChargeMoney), 2).ToString() + Money = Math.Round(ss.Sum(sss => sss.b.ChargeMoney), 2) }).ToList() }); #endregion @@ -131,7 +131,7 @@ namespace Shentun.Peis.Charges PayModeDetails = s.GroupBy(gg => gg.b.PayModeId).Select(ss => new GetChargeAndChargeBackSummary_PayModeDetail { PayModeName = ss.FirstOrDefault().PayModeName, - Money = Math.Round(ss.Sum(sss => sss.b.BackMoeny), 2).ToString() + Money = Math.Round(ss.Sum(sss => sss.b.BackMoeny), 2) }).ToList() }); #endregion diff --git a/src/Shentun.Peis.Domain.Shared/Enums/ChargeFlag.cs b/src/Shentun.Peis.Domain.Shared/Enums/ChargeFlag.cs new file mode 100644 index 0000000..8db3d41 --- /dev/null +++ b/src/Shentun.Peis.Domain.Shared/Enums/ChargeFlag.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Text; + +namespace Shentun.Peis.Enums +{ + + public static class ChargeFlag + { + /// + /// 收费 + /// + [Description("收费")] + public const char Charge = '0'; + + + /// + /// 退费 + /// + [Description("退费")] + public const char ChargeBack = '1'; + } +} diff --git a/src/Shentun.Peis.Domain/ItemTypes/ItemTypeManager.cs b/src/Shentun.Peis.Domain/ItemTypes/ItemTypeManager.cs index 54b6894..a900e5b 100644 --- a/src/Shentun.Peis.Domain/ItemTypes/ItemTypeManager.cs +++ b/src/Shentun.Peis.Domain/ItemTypes/ItemTypeManager.cs @@ -200,5 +200,29 @@ namespace Shentun.Peis.ItemTypes } + + /// + /// 获取项目类别下级ID + /// + /// + /// + public async Task> GetChildItemTypeIdsAsync(Guid itemTypeId) + { + List itmeTypeIds = new List(); + + if (itemTypeId != Guid.Empty) + { + var itemTypeParent = await _repository.FirstOrDefaultAsync(m => m.Id == itemTypeId); + itmeTypeIds = (await _repository.GetListAsync(m => !string.IsNullOrEmpty(m.PathCode) + && !string.IsNullOrEmpty(itemTypeParent.PathCode) + && m.PathCode.Contains(itemTypeParent.PathCode))).Select(s => s.Id).ToList(); + + itmeTypeIds.Add(itemTypeId); + } + + return itmeTypeIds; + } + + } }