diff --git a/src/Shentun.Peis.Application.Contracts/ChargeReports/GetPersonalFeeDetailsReportInFeeDetailsDto.cs b/src/Shentun.Peis.Application.Contracts/ChargeReports/GetPersonalFeeDetailsReportInFeeDetailsDto.cs
new file mode 100644
index 0000000..39d5354
--- /dev/null
+++ b/src/Shentun.Peis.Application.Contracts/ChargeReports/GetPersonalFeeDetailsReportInFeeDetailsDto.cs
@@ -0,0 +1,69 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations.Schema;
+using System.Text;
+
+namespace Shentun.Peis.ChargeReports
+{
+ public class GetPersonalFeeDetailsReportInFeeDetailsDto
+ {
+ ///
+ /// 档案号
+ ///
+ public string PatientNo { get; set; }
+
+ ///
+ /// 体检次数
+ ///
+ public short MedicalTimes { get; set; }
+
+ ///
+ /// 姓名
+ ///
+ public string PatientName { get; set; }
+
+ ///
+ /// 性别
+ ///
+ public string SexName { get; set; }
+
+
+ ///
+ /// 年龄
+ ///
+ public short? Age { get; set; }
+
+ ///
+ /// 组合项目名称
+ ///
+ public string AsbitemName { get; set; }
+
+
+ ///
+ /// 标准金额
+ ///
+ public decimal StandardPrice { get; set; }
+
+ ///
+ /// 实收金额
+ ///
+ public decimal CharePrice { get; set; }
+
+ ///
+ /// 折扣
+ ///
+ public string Discount { get; set;}
+
+
+
+ ///
+ /// 记账人
+ ///
+ public string BookKeepingName { get; set; }
+
+ ///
+ /// 记账时间
+ ///
+ public string BookkeepingTiem { get; set; }
+ }
+}
diff --git a/src/Shentun.Peis.Application.Contracts/ChargeReports/GetPersonalFeeDetailsReportInFeeDetailsRequestDto.cs b/src/Shentun.Peis.Application.Contracts/ChargeReports/GetPersonalFeeDetailsReportInFeeDetailsRequestDto.cs
new file mode 100644
index 0000000..fe1fd14
--- /dev/null
+++ b/src/Shentun.Peis.Application.Contracts/ChargeReports/GetPersonalFeeDetailsReportInFeeDetailsRequestDto.cs
@@ -0,0 +1,37 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.Text;
+
+namespace Shentun.Peis.ChargeReports
+{
+ public class GetPersonalFeeDetailsReportInFeeDetailsRequestDto
+ {
+ ///
+ /// 收费员ID 集合
+ ///
+ public List UserIds { get; set; } = new List();
+
+ ///
+ /// 档案号
+ ///
+ public string PatientNo { get; set; }
+
+ ///
+ /// 姓名
+ ///
+ public string PatientName { 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/GetPersonalFeeDetailsReportInFeeSummaryDto.cs b/src/Shentun.Peis.Application.Contracts/ChargeReports/GetPersonalFeeDetailsReportInFeeSummaryDto.cs
new file mode 100644
index 0000000..4dce734
--- /dev/null
+++ b/src/Shentun.Peis.Application.Contracts/ChargeReports/GetPersonalFeeDetailsReportInFeeSummaryDto.cs
@@ -0,0 +1,115 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Shentun.Peis.ChargeReports
+{
+ public class GetPersonalFeeDetailsReportInFeeSummaryDto
+ {
+ ///
+ /// 应收总金额
+ ///
+ public decimal SumChargeMoney { get; set; }
+
+ ///
+ /// 折扣总金额
+ ///
+ public decimal SumDiscountMoney { get; set; }
+
+ ///
+ /// 实收总金额
+ ///
+ public decimal SumReceivedChargeMoney { get; set; }
+
+
+ ///
+ /// 收费人数
+ ///
+ public int ChargeCount { get; set; }
+
+ ///
+ /// 明细
+ ///
+ public List Details { get; set; }
+ }
+
+ public class GetPersonalFeeDetailsReportInFeeSummary_Detail
+ {
+ ///
+ /// 档案号
+ ///
+ public string PatientNo { get; set; }
+
+
+
+ ///
+ /// 姓名
+ ///
+ public string PatientName { get; set; }
+
+ ///
+ /// 性别
+ ///
+ public string SexName { get; set; }
+
+
+ ///
+ /// 年龄
+ ///
+ public short? Age { get; set; }
+
+
+
+
+ ///
+ /// 应收金额
+ ///
+ public decimal ChargeMoney { get; set; }
+
+
+
+ ///
+ /// 折扣金额
+ ///
+ public decimal DiscountMoney { get; set; }
+
+ ///
+ /// 实收金额
+ ///
+ public decimal ReceivedChargeMoney { get; set; }
+
+ ///
+ /// 收费人
+ ///
+ public string BookKeepingName { get; set; }
+
+ ///
+ /// 收费时间
+ ///
+ public string BookkeepingTiem { get; set; }
+
+
+ ///
+ /// 记账模式 收费/退费
+ ///
+ public string ChargeFlagName { get; set; }
+
+ ///
+ /// 支付方式明细
+ ///
+ public List PayModes { get; set; }
+ }
+
+ public class GetPersonalFeeDetailsReportInFeeSummary_PayMode
+ {
+ ///
+ /// 支付方式
+ ///
+ public string PayModeName { get; set; }
+
+ ///
+ /// 实收金额
+ ///
+ public decimal ReceivedChargeMoney { get; set; }
+ }
+}
diff --git a/src/Shentun.Peis.Application.Contracts/ChargeReports/GetPersonalFeeDetailsReportInFeeSummaryRequestDto.cs b/src/Shentun.Peis.Application.Contracts/ChargeReports/GetPersonalFeeDetailsReportInFeeSummaryRequestDto.cs
new file mode 100644
index 0000000..5171f14
--- /dev/null
+++ b/src/Shentun.Peis.Application.Contracts/ChargeReports/GetPersonalFeeDetailsReportInFeeSummaryRequestDto.cs
@@ -0,0 +1,37 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.Text;
+
+namespace Shentun.Peis.ChargeReports
+{
+ public class GetPersonalFeeDetailsReportInFeeSummaryRequestDto
+ {
+ ///
+ /// 收费员ID 集合
+ ///
+ public List UserIds { get; set; } = new List();
+
+ ///
+ /// 档案号
+ ///
+ public string PatientNo { get; set; }
+
+ ///
+ /// 姓名
+ ///
+ public string PatientName { 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/GetPersonalFeeDetailsReportInRefundDetailsDto.cs b/src/Shentun.Peis.Application.Contracts/ChargeReports/GetPersonalFeeDetailsReportInRefundDetailsDto.cs
new file mode 100644
index 0000000..fab356a
--- /dev/null
+++ b/src/Shentun.Peis.Application.Contracts/ChargeReports/GetPersonalFeeDetailsReportInRefundDetailsDto.cs
@@ -0,0 +1,68 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Shentun.Peis.ChargeReports
+{
+ public class GetPersonalFeeDetailsReportInRefundDetailsDto
+ {
+ ///
+ /// 档案号
+ ///
+ public string PatientNo { get; set; }
+
+ ///
+ /// 体检次数
+ ///
+ public short MedicalTimes { get; set; }
+
+ ///
+ /// 姓名
+ ///
+ public string PatientName { get; set; }
+
+ ///
+ /// 性别
+ ///
+ public string SexName { get; set; }
+
+
+ ///
+ /// 年龄
+ ///
+ public short? Age { get; set; }
+
+ ///
+ /// 组合项目名称
+ ///
+ public string AsbitemName { get; set; }
+
+
+ ///
+ /// 标准金额
+ ///
+ public decimal StandardPrice { get; set; }
+
+ ///
+ /// 实收金额
+ ///
+ public decimal CharePrice { get; set; }
+
+ ///
+ /// 折扣
+ ///
+ public string Discount { get; set; }
+
+
+
+ ///
+ /// 记账人
+ ///
+ public string BookKeepingName { get; set; }
+
+ ///
+ /// 记账时间
+ ///
+ public string BookkeepingTiem { get; set; }
+ }
+}
diff --git a/src/Shentun.Peis.Application.Contracts/ChargeReports/GetPersonalFeeDetailsReportInRefundDetailsRequestDto.cs b/src/Shentun.Peis.Application.Contracts/ChargeReports/GetPersonalFeeDetailsReportInRefundDetailsRequestDto.cs
new file mode 100644
index 0000000..c70cca0
--- /dev/null
+++ b/src/Shentun.Peis.Application.Contracts/ChargeReports/GetPersonalFeeDetailsReportInRefundDetailsRequestDto.cs
@@ -0,0 +1,37 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.Text;
+
+namespace Shentun.Peis.ChargeReports
+{
+ public class GetPersonalFeeDetailsReportInRefundDetailsRequestDto
+ {
+ ///
+ /// 收费员ID 集合
+ ///
+ public List UserIds { get; set; } = new List();
+
+ ///
+ /// 档案号
+ ///
+ public string PatientNo { get; set; }
+
+ ///
+ /// 姓名
+ ///
+ public string PatientName { 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/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/GetTollCollectorFeeReportInAsbitemDto.cs b/src/Shentun.Peis.Application.Contracts/ChargeReports/GetTollCollectorFeeReportInAsbitemDto.cs
new file mode 100644
index 0000000..14b8cc2
--- /dev/null
+++ b/src/Shentun.Peis.Application.Contracts/ChargeReports/GetTollCollectorFeeReportInAsbitemDto.cs
@@ -0,0 +1,42 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Shentun.Peis.ChargeReports
+{
+ public class GetTollCollectorFeeReportInAsbitemDto
+ {
+ ///
+ /// 项目类别==科室名字
+ ///
+ public string ItemTypeName { get; set; }
+
+ ///
+ /// 小计
+ ///
+ public decimal TotalMoney { get; set; }
+
+ ///
+ /// 明细
+ ///
+ public List Details { get; set; }
+ }
+
+ public class GetTollCollectorFeeReportInAsbitem_Detail
+ {
+ ///
+ /// 项目类别==科室名字
+ ///
+ public string ItemTypeName { get; set; }
+
+ ///
+ /// 组合项目名称
+ ///
+ public string AsbitemName { get; set; }
+
+ ///
+ /// 收款金额
+ ///
+ public decimal ChargeMoney { get; set; }
+ }
+}
diff --git a/src/Shentun.Peis.Application.Contracts/ChargeReports/GetTollCollectorFeeReportInAsbitemRequestDto.cs b/src/Shentun.Peis.Application.Contracts/ChargeReports/GetTollCollectorFeeReportInAsbitemRequestDto.cs
new file mode 100644
index 0000000..c95aed7
--- /dev/null
+++ b/src/Shentun.Peis.Application.Contracts/ChargeReports/GetTollCollectorFeeReportInAsbitemRequestDto.cs
@@ -0,0 +1,27 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.Text;
+
+namespace Shentun.Peis.ChargeReports
+{
+ public class GetTollCollectorFeeReportInAsbitemRequestDto
+ {
+ ///
+ /// 收费员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/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..bd6873d
--- /dev/null
+++ b/src/Shentun.Peis.Application.Contracts/ChargeReports/GetTollCollectorFeeReportInInvoiceTypeRequestDto.cs
@@ -0,0 +1,27 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.Text;
+
+namespace Shentun.Peis.ChargeReports
+{
+ public class GetTollCollectorFeeReportInInvoiceTypeRequestDto
+ {
+ ///
+ /// 收费员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/ChargeReports/GetTollCollectorFeeReportInPayModeDto.cs b/src/Shentun.Peis.Application.Contracts/ChargeReports/GetTollCollectorFeeReportInPayModeDto.cs
new file mode 100644
index 0000000..bb51f34
--- /dev/null
+++ b/src/Shentun.Peis.Application.Contracts/ChargeReports/GetTollCollectorFeeReportInPayModeDto.cs
@@ -0,0 +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
new file mode 100644
index 0000000..35f2026
--- /dev/null
+++ b/src/Shentun.Peis.Application.Contracts/ChargeReports/GetTollCollectorFeeReportInPayModeRequestDto.cs
@@ -0,0 +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/ChargeReports/GetTollcollectorFeeSummaryReportDto.cs b/src/Shentun.Peis.Application.Contracts/ChargeReports/GetTollcollectorFeeSummaryReportDto.cs
new file mode 100644
index 0000000..f14d548
--- /dev/null
+++ b/src/Shentun.Peis.Application.Contracts/ChargeReports/GetTollcollectorFeeSummaryReportDto.cs
@@ -0,0 +1,56 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Shentun.Peis.ChargeReports
+{
+ public class GetTollcollectorFeeSummaryReportDto
+ {
+ ///
+ /// 实收总金额
+ ///
+ public decimal SumChargeMoney { get; set; }
+
+ ///
+ /// 退费总金额
+ ///
+ public decimal SumChargeBackMoney { get; set; }
+
+
+ ///
+ /// 合计总金额
+ ///
+ public decimal SumTotalMoney { get; set; }
+
+
+ ///
+ /// 明细
+ ///
+ public List Details { get; set; }
+ }
+
+
+ public class GetTollcollectorFeeSummaryReport_Detail
+ {
+ ///
+ /// 收费员
+ ///
+ public string ChargeName { 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/GetTollcollectorFeeSummaryReportRequestDto.cs b/src/Shentun.Peis.Application.Contracts/ChargeReports/GetTollcollectorFeeSummaryReportRequestDto.cs
new file mode 100644
index 0000000..c4de0ab
--- /dev/null
+++ b/src/Shentun.Peis.Application.Contracts/ChargeReports/GetTollcollectorFeeSummaryReportRequestDto.cs
@@ -0,0 +1,27 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.Text;
+
+namespace Shentun.Peis.ChargeReports
+{
+ public class GetTollcollectorFeeSummaryReportRequestDto
+ {
+ ///
+ /// 收费员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
new file mode 100644
index 0000000..52caea0
--- /dev/null
+++ b/src/Shentun.Peis.Application.Contracts/Charges/ChargeAndChargeBackSettlementRequestDto.cs
@@ -0,0 +1,25 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Shentun.Peis.Charges
+{
+ public class ChargeAndChargeBackSettlementRequestDto
+ {
+ ///
+ /// 收费员ID 集合
+ ///
+ public List UserIds { get; set; } = new List();
+
+ ///
+ /// 开始日期
+ ///
+ public string StartDate { get; set; }
+
+ ///
+ /// 结束日期
+ ///
+ 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
new file mode 100644
index 0000000..e5263b9
--- /dev/null
+++ b/src/Shentun.Peis.Application.Contracts/Charges/GetChargeAndChargeBackSummaryDto.cs
@@ -0,0 +1,58 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Shentun.Peis.Charges
+{
+ public class GetChargeAndChargeBackSummaryDto
+ {
+ ///
+ /// 收费汇总
+ ///
+ public List ChargeDetails { get; set; }
+
+ ///
+ /// 退费汇总
+ ///
+ public List ChargeBackDetails { get; set; }
+ }
+
+ public class GetChargeAndChargeBackSummary_ChargeDetail
+ {
+ ///
+ /// 收费员
+ ///
+ public string UserName { get; set; }
+
+ ///
+ /// 收费明细
+ ///
+ public List PayModeDetails { get; set; }
+ }
+
+ public class GetChargeAndChargeBackSummary_ChargeBackDetail
+ {
+ ///
+ /// 退费员
+ ///
+ public string UserName { get; set; }
+
+ ///
+ /// 退费明细
+ ///
+ public List PayModeDetails { get; set; }
+ }
+
+ public class GetChargeAndChargeBackSummary_PayModeDetail
+ {
+ ///
+ /// 支付方式
+ ///
+ public string PayModeName { get; set; }
+
+ ///
+ /// 收费或退费金额
+ ///
+ public decimal Money { get; set; }
+ }
+}
diff --git a/src/Shentun.Peis.Application.Contracts/Charges/GetChargeAndChargeBackSummaryRequestDto.cs b/src/Shentun.Peis.Application.Contracts/Charges/GetChargeAndChargeBackSummaryRequestDto.cs
new file mode 100644
index 0000000..4ecb233
--- /dev/null
+++ b/src/Shentun.Peis.Application.Contracts/Charges/GetChargeAndChargeBackSummaryRequestDto.cs
@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Shentun.Peis.Charges
+{
+ public class GetChargeAndChargeBackSummaryRequestDto
+ {
+ ///
+ /// 收费员ID 集合
+ ///
+ public List UserIds { get; set; } = new List();
+
+ ///
+ /// 开始日期
+ ///
+ public string StartDate { get; set; }
+
+ ///
+ /// 结束日期
+ ///
+ public string EndDate { get; set; }
+ }
+}
diff --git a/src/Shentun.Peis.Application/ChargeReports/ChargeReportAppService.cs b/src/Shentun.Peis.Application/ChargeReports/ChargeReportAppService.cs
new file mode 100644
index 0000000..dc4cc99
--- /dev/null
+++ b/src/Shentun.Peis.Application/ChargeReports/ChargeReportAppService.cs
@@ -0,0 +1,1183 @@
+using JetBrains.Annotations;
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Mvc;
+using NPOI.SS.Formula.Functions;
+using Shentun.Peis.Charges;
+using Shentun.Peis.Enums;
+using Shentun.Peis.ItemTypes;
+using Shentun.Peis.Models;
+using Shentun.Peis.Patients;
+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.OpenIddict.Applications;
+using Volo.Abp.Users;
+
+namespace Shentun.Peis.ChargeReports
+{
+ ///
+ /// 收费统计报表
+ ///
+ [Authorize]
+ [ApiExplorerSettings(GroupName = "Work")]
+ 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 IRepository _patientRepository;
+ private readonly IRepository _sexRepository;
+ private readonly ItemTypeManager _itemTypeManager;
+ public ChargeReportAppService(
+ IRepository chargeRepository,
+ IRepository chargeBackRepository,
+ IRepository chargePayRepository,
+ IRepository payModeRepository,
+ IRepository chargeBackPayRepository,
+ IRepository userRepository,
+ IRepository chargeAsbitemRepository,
+ IRepository asbitemRepository,
+ IRepository invoiceItemTypeRepository,
+ IRepository patientRegisterRepository,
+ IRepository registerAsbitemRepository,
+ IRepository customerOrgRegisterRepository,
+ IRepository customerOrgRepository,
+ IRepository itemTypeRepository,
+ ItemTypeManager itemTypeManager
+,
+ IRepository patientRepository,
+ IRepository sexRepository)
+ {
+ _chargeRepository = chargeRepository;
+ _chargeBackRepository = chargeBackRepository;
+ _chargePayRepository = chargePayRepository;
+ _payModeRepository = payModeRepository;
+ _chargeBackPayRepository = chargeBackPayRepository;
+ _userRepository = userRepository;
+ _chargeAsbitemRepository = chargeAsbitemRepository;
+ _asbitemRepository = asbitemRepository;
+ _invoiceItemTypeRepository = invoiceItemTypeRepository;
+ _patientRegisterRepository = patientRegisterRepository;
+ _registerAsbitemRepository = registerAsbitemRepository;
+ _customerOrgRegisterRepository = customerOrgRegisterRepository;
+ _customerOrgRepository = customerOrgRepository;
+ _itemTypeRepository = itemTypeRepository;
+ _itemTypeManager = itemTypeManager;
+ _patientRepository = patientRepository;
+ _sexRepository = sexRepository;
+ }
+
+
+
+ ///
+ /// 收费员收费报表 按支付方式
+ ///
+ ///
+ ///
+ [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 = DataHelper.DecimalRetainDecimals(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 = DataHelper.DecimalRetainDecimals(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() ? DataHelper.DecimalRetainDecimals(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 = DataHelper.DecimalRetainDecimals(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 = DataHelper.DecimalRetainDecimals(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() ? DataHelper.DecimalRetainDecimals(chargeDetails.Sum(s => s.InvoiceTypeMoney), 2) : 0;
+
+ //退费合计
+ decimal chargeBackTotalMoney = chargeBackDetails.Any() ? DataHelper.DecimalRetainDecimals(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-toll-collector-fee-report-in-asbitem")]
+ public async Task> GetTollCollectorFeeReportInAsbitemAsync(GetTollCollectorFeeReportInAsbitemRequestDto input)
+ {
+ var query = 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 d in await _itemTypeRepository.GetQueryableAsync() on ac.ItemTypeId equals d.Id into dd
+ from ad in dd.DefaultIfEmpty()
+ select new
+ {
+ a,
+ b,
+ AsbitemName = ac != null ? ac.DisplayName : "",
+ ItemTypeName = ad != null ? ad.DisplayName : ""
+ };
+
+ if (input.UserIds.Any())
+ {
+ query = query.Where(m => input.UserIds.Contains(m.a.CreatorId.Value));
+ }
+
+ 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 asbitemGroup = query.GroupBy(g => g.b.AsbitemId).Select(s => new GetTollCollectorFeeReportInAsbitem_Detail
+ {
+ AsbitemName = s.FirstOrDefault().AsbitemName,
+ ChargeMoney = DataHelper.DecimalRetainDecimals(s.Sum(ss => ss.b.ChargePrice * ss.b.Amount), 2),
+ ItemTypeName = s.FirstOrDefault().ItemTypeName
+ }).ToList();
+
+ var tollCollectorFeeReportInAsbitemDtos = asbitemGroup.GroupBy(g => g.ItemTypeName).Select(s => new GetTollCollectorFeeReportInAsbitemDto
+ {
+ Details = s.ToList(),
+ ItemTypeName = s.FirstOrDefault().ItemTypeName,
+ TotalMoney = DataHelper.DecimalRetainDecimals(s.Sum(ss => ss.ChargeMoney), 2)
+
+ }).ToList();
+
+ return tollCollectorFeeReportInAsbitemDtos;
+
+
+ }
+
+
+ ///
+ /// 个人收费明细报表 按收费明细
+ ///
+ ///
+ ///
+ [HttpPost("api/app/charge-report/get-Personal-Fee-Details-report-in-fee-details")]
+ public async Task> GetPersonalFeeDetailsReportInFeeDetailsAsync(GetPersonalFeeDetailsReportInFeeDetailsRequestDto input)
+ {
+ var query = from a in await _chargeRepository.GetQueryableAsync()
+ join b in await _chargeAsbitemRepository.GetQueryableAsync() on a.Id equals b.ChargeId
+ join c in await _patientRegisterRepository.GetQueryableAsync() on a.PatientRegisterId equals c.Id
+ join d in await _patientRepository.GetQueryableAsync() on c.PatientId equals d.Id into dd
+ from ad in dd.DefaultIfEmpty()
+ join e in await _sexRepository.GetQueryableAsync() on c.SexId equals e.Id into ee
+ from ae in ee.DefaultIfEmpty()
+ join f in await _registerAsbitemRepository.GetQueryableAsync() on c.Id equals f.PatientRegisterId
+ join g in await _asbitemRepository.GetQueryableAsync() on f.AsbitemId equals g.Id into gg
+ from ag in gg.DefaultIfEmpty()
+ join h in await _userRepository.GetQueryableAsync() on a.CreatorId equals h.Id into hh
+ from ah in hh.DefaultIfEmpty()
+ where c.CustomerOrgId == GuidFlag.PersonCustomerOrgId && a.ChargeFlag == ChargeFlag.Charge
+ select new
+ {
+ a,
+ b,
+ c,
+ f,
+ PatientNo = ad != null ? ad.PatientNo : "",
+ SexName = ae != null ? ae.DisplayName : "",
+ AsbitemName = ag != null ? ag.DisplayName : "",
+ BookKeepingName = ah != null ? ah.UserName : ""
+ };
+
+ if (input.UserIds.Any())
+ {
+ query = query.Where(m => input.UserIds.Contains(m.a.CreatorId.Value));
+ }
+
+ 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));
+ }
+
+ if (!string.IsNullOrWhiteSpace(input.PatientName))
+ {
+ query = query.Where(m => m.c.PatientName == input.PatientName);
+ }
+
+ if (!string.IsNullOrWhiteSpace(input.PatientNo))
+ {
+ query = query.Where(m => m.PatientNo == input.PatientNo);
+ }
+
+ var patientRegisterGroup = query.Select(s => new GetPersonalFeeDetailsReportInFeeDetailsDto
+ {
+ Age = s.c.Age,
+ AsbitemName = s.AsbitemName,
+ BookKeepingName = s.BookKeepingName,
+ BookkeepingTiem = s.a.CreationTime.ToString("yyyy-MM-dd HH:mm"),
+ CharePrice = DataHelper.DecimalRetainDecimals(s.b.ChargePrice * s.b.Amount, 2),
+ MedicalTimes = s.c.MedicalTimes,
+ PatientName = s.c.PatientName,
+ PatientNo = s.PatientNo,
+ SexName = s.SexName,
+ StandardPrice = DataHelper.DecimalRetainDecimals(s.f.StandardPrice * s.f.Amount, 2),
+ Discount = Math.Floor((s.b.ChargePrice * s.b.Amount) / (s.f.StandardPrice.Value * s.f.Amount.Value)) + "%"
+ }).ToList();
+
+ return patientRegisterGroup;
+ }
+
+
+ ///
+ /// 个人收费明细报表 按退费明细
+ ///
+ ///
+ ///
+ [HttpPost("api/app/charge-report/get-Personal-Fee-Details-report-in-refund-details")]
+ public async Task> GetPersonalFeeDetailsReportInRefundDetailsAsync(GetPersonalFeeDetailsReportInRefundDetailsRequestDto input)
+ {
+ var query = from a in await _chargeRepository.GetQueryableAsync()
+ join b in await _chargeAsbitemRepository.GetQueryableAsync() on a.Id equals b.ChargeId
+ join c in await _patientRegisterRepository.GetQueryableAsync() on a.PatientRegisterId equals c.Id
+ join d in await _patientRepository.GetQueryableAsync() on c.PatientId equals d.Id into dd
+ from ad in dd.DefaultIfEmpty()
+ join e in await _sexRepository.GetQueryableAsync() on c.SexId equals e.Id into ee
+ from ae in ee.DefaultIfEmpty()
+ join f in await _registerAsbitemRepository.GetQueryableAsync() on c.Id equals f.PatientRegisterId
+ join g in await _asbitemRepository.GetQueryableAsync() on f.AsbitemId equals g.Id into gg
+ from ag in gg.DefaultIfEmpty()
+ join h in await _userRepository.GetQueryableAsync() on a.CreatorId equals h.Id into hh
+ from ah in hh.DefaultIfEmpty()
+ where c.CustomerOrgId == GuidFlag.PersonCustomerOrgId && a.ChargeFlag == ChargeFlag.ChargeBack
+ select new
+ {
+ a,
+ b,
+ c,
+ f,
+ PatientNo = ad != null ? ad.PatientNo : "",
+ SexName = ae != null ? ae.DisplayName : "",
+ AsbitemName = ag != null ? ag.DisplayName : "",
+ BookKeepingName = ah != null ? ah.UserName : ""
+ };
+
+ if (input.UserIds.Any())
+ {
+ query = query.Where(m => input.UserIds.Contains(m.a.CreatorId.Value));
+ }
+
+ 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));
+ }
+
+ if (!string.IsNullOrWhiteSpace(input.PatientName))
+ {
+ query = query.Where(m => m.c.PatientName == input.PatientName);
+ }
+
+ if (!string.IsNullOrWhiteSpace(input.PatientNo))
+ {
+ query = query.Where(m => m.PatientNo == input.PatientNo);
+ }
+
+ var patientRegisterGroup = query.Select(s => new GetPersonalFeeDetailsReportInRefundDetailsDto
+ {
+ Age = s.c.Age,
+ AsbitemName = s.AsbitemName,
+ BookKeepingName = s.BookKeepingName,
+ BookkeepingTiem = s.a.CreationTime.ToString("yyyy-MM-dd HH:mm"),
+ CharePrice = DataHelper.DecimalRetainDecimals(s.b.ChargePrice * s.b.Amount, 2),
+ MedicalTimes = s.c.MedicalTimes,
+ PatientName = s.c.PatientName,
+ PatientNo = s.PatientNo,
+ SexName = s.SexName,
+ StandardPrice = DataHelper.DecimalRetainDecimals(s.f.StandardPrice * s.f.Amount, 2),
+ Discount = Math.Floor((s.b.ChargePrice * s.b.Amount) / (s.f.StandardPrice.Value * s.f.Amount.Value)) + "%"
+ }).ToList();
+
+ return patientRegisterGroup;
+ }
+
+
+
+ ///
+ /// 个人收费明细报表 按收费汇总
+ ///
+ ///
+ ///
+ [HttpPost("api/app/charge-report/get-Personal-Fee-Details-report-in-fee-summary")]
+ public async Task GetPersonalFeeDetailsReportInFeeSummaryAsync(GetPersonalFeeDetailsReportInFeeSummaryRequestDto 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 c in await _sexRepository.GetQueryableAsync() on a.SexId equals c.Id into cc
+ from ac in cc.DefaultIfEmpty()
+ join d in (await _registerAsbitemRepository.GetQueryableAsync()).Where(m => m.IsCharge == 'Y')
+ .GroupBy(g => g.PatientRegisterId)
+ .Select(s => new
+ {
+ PatientRegisterId = s.Key,
+ AsbitemChargeMoney = DataHelper.DecimalRetainDecimals(s.Sum(ss => ss.ChargePrice.Value * ss.Amount.Value), 2)
+ }) on a.Id equals d.PatientRegisterId
+ join e in await _chargeRepository.GetQueryableAsync() on a.Id equals e.PatientRegisterId
+ join f in await _chargePayRepository.GetQueryableAsync() on e.Id equals f.ChargeId
+ join g in await _payModeRepository.GetQueryableAsync() on f.PayModeId equals g.Id into gg
+ from ag in gg.DefaultIfEmpty()
+ join h in await _userRepository.GetQueryableAsync() on e.CreatorId equals h.Id into hh
+ from ah in hh.DefaultIfEmpty()
+ where a.CustomerOrgGroupId == GuidFlag.PersonCustomerOrgId
+ select new
+ {
+ a,
+ e,
+ f,
+ PatientName = a.PatientName,
+ Age = a.Age,
+ PatientNo = ab != null ? ab.PatientNo : "",
+ SexName = ac != null ? ac.DisplayName : "",
+ AsbitemChargeMoney = d.AsbitemChargeMoney,
+ BookKeepingName = ah != null ? ah.UserName : "",
+ PayModeName = ag != null ? ag.DisplayName : ""
+ };
+
+
+
+
+
+ if (input.UserIds.Any())
+ {
+ query = query.Where(m => input.UserIds.Contains(m.e.CreatorId.Value));
+ }
+
+ if (!string.IsNullOrWhiteSpace(input.StartDate) && !string.IsNullOrWhiteSpace(input.EndDate))
+ {
+ query = query.Where(m => m.e.CreationTime >= Convert.ToDateTime(input.StartDate)
+ && m.e.CreationTime < Convert.ToDateTime(input.EndDate).AddDays(1));
+ }
+
+ if (!string.IsNullOrWhiteSpace(input.PatientName))
+ {
+ query = query.Where(m => m.PatientName == input.PatientName);
+ }
+
+ if (!string.IsNullOrWhiteSpace(input.PatientNo))
+ {
+ query = query.Where(m => m.PatientNo == input.PatientNo);
+ }
+
+ var personalFeeDetailsReportInFeeSummary_Details = query.GroupBy(g => g.e.Id).Select(s => new GetPersonalFeeDetailsReportInFeeSummary_Detail
+ {
+ Age = s.FirstOrDefault().Age,
+ BookKeepingName = s.FirstOrDefault().BookKeepingName,
+ BookkeepingTiem = s.FirstOrDefault().e.CreationTime.ToString("yyyy-MM-dd HH:mm"),
+ ChargeFlagName = s.FirstOrDefault().e.ChargeFlag == ChargeFlag.Charge ? "收费" : "退费",
+ ChargeMoney = s.FirstOrDefault().AsbitemChargeMoney,
+ PatientName = s.FirstOrDefault().PatientName,
+ PatientNo = s.FirstOrDefault().PatientNo,
+ ReceivedChargeMoney = DataHelper.DecimalRetainDecimals(s.Sum(ss => ss.f.ChargeMoney), 2),
+ SexName = s.FirstOrDefault().SexName,
+ DiscountMoney = s.FirstOrDefault().AsbitemChargeMoney - DataHelper.DecimalRetainDecimals(s.Sum(ss => ss.f.ChargeMoney), 2),
+ PayModes = s.Select(ss => new GetPersonalFeeDetailsReportInFeeSummary_PayMode
+ {
+ PayModeName = ss.PayModeName,
+ ReceivedChargeMoney = ss.f.ChargeMoney
+ }).ToList()
+ }).ToList();
+
+
+ decimal sumChargeMoney = personalFeeDetailsReportInFeeSummary_Details.Any() ? DataHelper.DecimalRetainDecimals(personalFeeDetailsReportInFeeSummary_Details.Sum(s => s.ChargeMoney), 2) : 0;
+ decimal sumDiscountMoney = personalFeeDetailsReportInFeeSummary_Details.Any() ? DataHelper.DecimalRetainDecimals(personalFeeDetailsReportInFeeSummary_Details.Sum(s => s.DiscountMoney), 2) : 0;
+ decimal sumReceivedChargeMoney = personalFeeDetailsReportInFeeSummary_Details.Any() ? DataHelper.DecimalRetainDecimals(personalFeeDetailsReportInFeeSummary_Details.Sum(s => s.ReceivedChargeMoney), 2) : 0;
+
+ var personalFeeDetailsReportInFeeSummaryDto = new GetPersonalFeeDetailsReportInFeeSummaryDto
+ {
+ ChargeCount = personalFeeDetailsReportInFeeSummary_Details.Count,
+ Details = personalFeeDetailsReportInFeeSummary_Details,
+ SumChargeMoney = sumChargeMoney,
+ SumDiscountMoney = sumDiscountMoney,
+ SumReceivedChargeMoney = sumReceivedChargeMoney
+ };
+
+ return personalFeeDetailsReportInFeeSummaryDto;
+ }
+
+
+
+ ///
+ /// 收费人收费汇总报表
+ ///
+ ///
+ ///
+ [HttpPost("api/app/charge-report/get-toll-collector-fee-summary-report")]
+ public async Task GetTollcollectorFeeSummaryReportAsync(GetTollcollectorFeeSummaryReportRequestDto input)
+ {
+ #region 收费
+ var chargeQuery = from a in await _chargeRepository.GetQueryableAsync()
+ join b in await _chargePayRepository.GetQueryableAsync() on a.Id equals b.ChargeId
+ join d in await _userRepository.GetQueryableAsync() on a.CreatorId equals d.Id into dd
+ from ad in dd.DefaultIfEmpty()
+ select new
+ {
+ a,
+ b,
+ 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 GetTollcollectorFeeSummaryReport_Detail
+ {
+ ChargeBackMoney = 0,
+ ChargeMoney = DataHelper.DecimalRetainDecimals(s.Sum(ss => ss.b.ChargeMoney), 2),
+ ChargeName = s.FirstOrDefault().UserName,
+ TotalMoney = 0
+ }).ToList();
+ #endregion
+
+ #region 退费
+
+ var chargeBackQuery = from a in await _chargeBackRepository.GetQueryableAsync()
+ join b in await _chargeBackPayRepository.GetQueryableAsync() on a.Id equals b.ChargeBackId
+ join d in await _userRepository.GetQueryableAsync() on a.CreatorId equals d.Id into dd
+ from ad in dd.DefaultIfEmpty()
+ select new
+ {
+ a,
+ b,
+ 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 GetTollcollectorFeeSummaryReport_Detail
+ {
+ ChargeBackMoney = DataHelper.DecimalRetainDecimals(s.Sum(ss => ss.b.BackMoeny), 2),
+ ChargeMoney = 0,
+ ChargeName = s.FirstOrDefault().UserName,
+ TotalMoney = 0
+ }).ToList();
+ #endregion
+
+
+
+ #region 拼接收费数据
+
+ List tollcollectorFeeSummaryReport_Detail = new List();
+
+ //去重科室Id
+ var ChargeNameList = chargeDetails.Select(s => s.ChargeName).Union(chargeBackDetails.Select(s => s.ChargeName));
+
+ foreach (var item in ChargeNameList)
+ {
+
+ var tempData = chargeDetails.Where(m => m.ChargeName == item).FirstOrDefault();
+
+ if (tempData != null)
+ {
+ var chargeBackDetail = chargeBackDetails.Where(m => m.ChargeName == item).FirstOrDefault();
+ if (chargeBackDetail != null)
+ {
+ tempData.ChargeBackMoney = chargeBackDetail.ChargeBackMoney;
+ }
+ }
+ else
+ {
+ tempData = chargeBackDetails.Where(m => m.ChargeName == item).FirstOrDefault();
+ }
+
+
+ tempData.TotalMoney = tempData.ChargeMoney - tempData.ChargeBackMoney;
+
+ tollcollectorFeeSummaryReport_Detail.Add(tempData);
+ }
+
+ #endregion
+
+
+ decimal sumChargeMoney = tollcollectorFeeSummaryReport_Detail.Any() ? DataHelper.DecimalRetainDecimals(tollcollectorFeeSummaryReport_Detail.Sum(s => s.ChargeMoney), 2) : 0;
+ decimal sumChargeBackMoney = tollcollectorFeeSummaryReport_Detail.Any() ? DataHelper.DecimalRetainDecimals(tollcollectorFeeSummaryReport_Detail.Sum(s => s.ChargeBackMoney), 2) : 0;
+ decimal sumTotalMoney = tollcollectorFeeSummaryReport_Detail.Any() ? DataHelper.DecimalRetainDecimals(tollcollectorFeeSummaryReport_Detail.Sum(s => s.TotalMoney), 2) : 0;
+
+ var tollcollectorFeeSummaryReportDto = new GetTollcollectorFeeSummaryReportDto
+ {
+ Details = tollcollectorFeeSummaryReport_Detail,
+ SumChargeMoney = sumChargeMoney,
+ SumChargeBackMoney = sumChargeBackMoney,
+ SumTotalMoney = sumTotalMoney
+ };
+
+ return tollcollectorFeeSummaryReportDto;
+
+ }
+
+
+ ///
+ /// 项目收费报表
+ ///
+ ///
+ ///
+ [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 = DataHelper.DecimalRetainDecimals(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 = DataHelper.DecimalRetainDecimals(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() ? DataHelper.DecimalRetainDecimals(projectFeesReport_Details.Sum(s => s.ChargeMoney), 2) : 0;
+ decimal sumDiscountMoney = projectFeesReport_Details.Any() ? DataHelper.DecimalRetainDecimals(projectFeesReport_Details.Sum(s => s.DiscountMoney), 2) : 0;
+ decimal sumReceivedChargeMoney = projectFeesReport_Details.Any() ? DataHelper.DecimalRetainDecimals(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 = DataHelper.DecimalRetainDecimals(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 = DataHelper.DecimalRetainDecimals(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() ? DataHelper.DecimalRetainDecimals(summaryOfDepartmentalFeesReport_Details.Sum(s => s.ChargeMoney), 2) : 0;
+ decimal sumDiscountMoney = summaryOfDepartmentalFeesReport_Details.Any() ? DataHelper.DecimalRetainDecimals(summaryOfDepartmentalFeesReport_Details.Sum(s => s.DiscountMoney), 2) : 0;
+ decimal sumReceivedChargeMoney = summaryOfDepartmentalFeesReport_Details.Any() ? DataHelper.DecimalRetainDecimals(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-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 = DataHelper.DecimalRetainDecimals(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 ccb13e1..609cb51 100644
--- a/src/Shentun.Peis.Application/Charges/ChargeAppService.cs
+++ b/src/Shentun.Peis.Application/Charges/ChargeAppService.cs
@@ -1,17 +1,218 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
+using Shentun.Peis.Books;
+using Shentun.Peis.Models;
using System;
using System.Collections.Generic;
+using System.Collections.Immutable;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Application.Services;
+using Volo.Abp.Domain.Repositories;
+using Volo.Abp.Identity;
+using Volo.Abp.Users;
namespace Shentun.Peis.Charges
{
+ ///
+ /// 收费
+ ///
[ApiExplorerSettings(GroupName = "Work")]
[Authorize]
public class ChargeAppService : ApplicationService
{
+
+ private readonly IRepository _chargeRepository;
+ private readonly IRepository _chargePayRepository;
+ private readonly IRepository _payModeRepository;
+ private readonly IRepository _chargeBackRepository;
+ private readonly IRepository _chargeBackPayRepository;
+ private readonly IRepository _userRepository;
+ private readonly ICurrentUser _currentUser;
+
+
+ public ChargeAppService(
+ IRepository chargeRepository,
+ IRepository chargeBackRepository,
+ IRepository chargePayRepository,
+ IRepository payModeRepository,
+ IRepository chargeBackPayRepository,
+ IRepository userRepository,
+ ICurrentUser currentUser)
+ {
+ _chargeRepository = chargeRepository;
+ _chargeBackRepository = chargeBackRepository;
+ _chargePayRepository = chargePayRepository;
+ _payModeRepository = payModeRepository;
+ _chargeBackPayRepository = chargeBackPayRepository;
+ _userRepository = userRepository;
+ _currentUser = currentUser;
+ }
+
+
+
+ ///
+ /// 查询收费、退费信息汇总 结算钱展示
+ ///
+ ///
+ [HttpPost("api/app/charge/get-charge-and-charge-back-summary")]
+ public async Task GetChargeAndChargeBackSummaryAsync(GetChargeAndChargeBackSummaryRequestDto 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
+
+ var chargeAndChargeBackSummaryDto = new GetChargeAndChargeBackSummaryDto
+ {
+ ChargeBackDetails = ChargeBackDetails.ToList(),
+ ChargeDetails = ChargeDetails.ToList()
+ };
+
+ return chargeAndChargeBackSummaryDto;
+
+ }
+
+
+
+
+ ///
+ /// 财务结算接口
+ ///
+ ///
+ [HttpPost("api/app/charge/charge-and-charge-back-settlement")]
+ public async Task ChargeAndChargeBackSettlementAsync(ChargeAndChargeBackSettlementRequestDto input)
+ {
+ if (_currentUser.Id != null && _currentUser.Id != Guid.Empty)
+ {
+ #region 收费
+ var chargeQuery = (await _chargeRepository.GetQueryableAsync()).Where(m => m.SettleAccountId == null || m.SettleAccountId == Guid.Empty);
+
+ if (input.UserIds.Any())
+ {
+ chargeQuery = chargeQuery.Where(m => input.UserIds.Contains(m.CreatorId.Value));
+ }
+
+ if (!string.IsNullOrWhiteSpace(input.StartDate) && !string.IsNullOrWhiteSpace(input.EndDate))
+ {
+ chargeQuery = chargeQuery.Where(m => m.CreationTime >= Convert.ToDateTime(input.StartDate)
+ && m.CreationTime < Convert.ToDateTime(input.EndDate).AddDays(1));
+ }
+
+ var chargeList = chargeQuery.ToList();
+ if (chargeList.Any())
+ {
+ foreach (var charge in chargeList)
+ {
+ charge.SettleAccountId = _currentUser.Id;
+ charge.SettleTime = DateTime.Now;
+ }
+ }
+ #endregion
+
+ #region 退费
+ var chargeBackQuery = (await _chargeBackRepository.GetQueryableAsync()).Where(m => m.SettleAccountId == null || m.SettleAccountId == Guid.Empty);
+
+ if (input.UserIds.Any())
+ {
+ chargeBackQuery = chargeBackQuery.Where(m => input.UserIds.Contains(m.CreatorId.Value));
+ }
+
+ if (!string.IsNullOrWhiteSpace(input.StartDate) && !string.IsNullOrWhiteSpace(input.EndDate))
+ {
+ chargeBackQuery = chargeBackQuery.Where(m => m.CreationTime >= Convert.ToDateTime(input.StartDate)
+ && m.CreationTime < Convert.ToDateTime(input.EndDate).AddDays(1));
+ }
+
+ var chargeBackList = chargeBackQuery.ToList();
+ if (chargeBackList.Any())
+ {
+ foreach (var chargeBack in chargeBackList)
+ {
+ chargeBack.SettleAccountId = _currentUser.Id;
+ chargeBack.SettleTime = DateTime.Now;
+ }
+ }
+ #endregion
+
+ await _chargeRepository.UpdateManyAsync(chargeList);
+
+ await _chargeBackRepository.UpdateManyAsync(chargeBackList);
+ }
+
+ }
}
-}
+}
\ No newline at end of file
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/DataHelper.cs b/src/Shentun.Peis.Domain/DataHelper.cs
index 717e61f..92f1cee 100644
--- a/src/Shentun.Peis.Domain/DataHelper.cs
+++ b/src/Shentun.Peis.Domain/DataHelper.cs
@@ -357,7 +357,21 @@ namespace Shentun.Peis
return birthday;
}
-
+ ///
+ /// 保留小数 转换decimal
+ ///
+ ///
+ ///
+ ///
+ public static decimal DecimalRetainDecimals(decimal? value, int decimalLength)
+ {
+ decimal newValue = 0;
+ if (value != null)
+ {
+ Math.Round(value.Value, decimalLength);
+ }
+ return newValue;
+ }
#region 数据检查
@@ -512,7 +526,7 @@ namespace Shentun.Peis
///
public static void CheckDecimalIsNull(decimal? value, string parameterName, string ExceptionMessage = "不能为空")
{
- if (value == null )
+ if (value == null)
{
throw new UserFriendlyException($"{parameterName}{ExceptionMessage}");
}
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;
+ }
+
+
}
}