diff --git a/src/Shentun.Peis.Application.Contracts/CardRegisters/CardRegisterRechargeDto.cs b/src/Shentun.Peis.Application.Contracts/CardRegisters/CardRegisterRechargeDto.cs
new file mode 100644
index 0000000..2a323a4
--- /dev/null
+++ b/src/Shentun.Peis.Application.Contracts/CardRegisters/CardRegisterRechargeDto.cs
@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations.Schema;
+using System.ComponentModel.DataAnnotations;
+using System.Text;
+
+namespace Shentun.Peis.CardRegisters
+{
+ public class CardRegisterRechargeDto
+ {
+ ///
+ /// 会员卡ID
+ ///
+ public Guid CardRegisterId { get; set; }
+
+ ///
+ /// 支付方式
+ ///
+ public string PayModeId { get; set; }
+
+ ///
+ /// 充值金额
+ ///
+ public decimal RechargeAmount { get; set; }
+ }
+}
diff --git a/src/Shentun.Peis.Application.Contracts/InternalReports/GetDoctorPersonnelWorkLoadReportDto.cs b/src/Shentun.Peis.Application.Contracts/InternalReports/GetDoctorPersonnelWorkLoadReportDto.cs
new file mode 100644
index 0000000..7813b36
--- /dev/null
+++ b/src/Shentun.Peis.Application.Contracts/InternalReports/GetDoctorPersonnelWorkLoadReportDto.cs
@@ -0,0 +1,44 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations.Schema;
+using System.Text;
+
+namespace Shentun.Peis.InternalReports
+{
+ public class GetDoctorPersonnelWorkLoadReportDto
+ {
+ ///
+ /// 医生名称
+ ///
+ public string DoctorName { get; set; }
+
+ ///
+ /// 组合项目名称
+ ///
+ public string AsbitemName { get; set; }
+
+ ///
+ /// 检查人数
+ ///
+ public int CheckCount { get; set; }
+
+ ///
+ /// 标准均价
+ ///
+ public decimal AvgStandardPrice { get; set; }
+ ///
+ /// 实收均价
+ ///
+ public decimal AvgChargePrice { get; set; }
+
+
+ ///
+ /// 标准价格总金额
+ ///
+ public decimal SumStandardPrice { get; set; }
+ ///
+ /// 实收价格总金额
+ ///
+ public decimal SumChargePrice { get; set; }
+ }
+}
diff --git a/src/Shentun.Peis.Application.Contracts/InternalReports/GetDoctorPersonnelWorkLoadReportRequestDto.cs b/src/Shentun.Peis.Application.Contracts/InternalReports/GetDoctorPersonnelWorkLoadReportRequestDto.cs
new file mode 100644
index 0000000..ed2eb77
--- /dev/null
+++ b/src/Shentun.Peis.Application.Contracts/InternalReports/GetDoctorPersonnelWorkLoadReportRequestDto.cs
@@ -0,0 +1,25 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Shentun.Peis.InternalReports
+{
+
+ public class GetDoctorPersonnelWorkLoadReportRequestDto
+ {
+ ///
+ /// 医生ID 集合
+ ///
+ public List UserIds { get; set; }
+
+ ///
+ /// 开始检查日期
+ ///
+ public string StartDate { get; set; }
+
+ ///
+ /// 结束检查日期
+ ///
+ public string EndDate { get; set; }
+ }
+}
diff --git a/src/Shentun.Peis.Application.Contracts/InternalReports/GetSumCheckDoctorWorkLoadReportDto.cs b/src/Shentun.Peis.Application.Contracts/InternalReports/GetSumCheckDoctorWorkLoadReportDto.cs
new file mode 100644
index 0000000..01f7628
--- /dev/null
+++ b/src/Shentun.Peis.Application.Contracts/InternalReports/GetSumCheckDoctorWorkLoadReportDto.cs
@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Shentun.Peis.InternalReports
+{
+ public class GetSumCheckDoctorWorkLoadReportDto
+ {
+ ///
+ /// 人员名称
+ ///
+ public string PersonnelName { get; set; }
+
+ ///
+ /// 登记数量
+ ///
+ public int RegisterCount { get; set; }
+
+ ///
+ /// 占百分比
+ ///
+ public string Percentage { get; set; }
+ }
+}
diff --git a/src/Shentun.Peis.Application.Contracts/InternalReports/GetSumCheckDoctorWorkLoadReportRequestDto.cs b/src/Shentun.Peis.Application.Contracts/InternalReports/GetSumCheckDoctorWorkLoadReportRequestDto.cs
new file mode 100644
index 0000000..52e7b2c
--- /dev/null
+++ b/src/Shentun.Peis.Application.Contracts/InternalReports/GetSumCheckDoctorWorkLoadReportRequestDto.cs
@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Shentun.Peis.InternalReports
+{
+ public class GetSumCheckDoctorWorkLoadReportRequestDto
+ {
+ ///
+ /// 总检医生ID 集合
+ ///
+ public List UserIds { get; set; }
+
+ ///
+ /// 开始登记日期
+ ///
+ public string StartDate { get; set; }
+
+ ///
+ /// 结束登记日期
+ ///
+ public string EndDate { get; set; }
+ }
+}
diff --git a/src/Shentun.Peis.Application/CardRegisters/CardRegisterAppService.cs b/src/Shentun.Peis.Application/CardRegisters/CardRegisterAppService.cs
index 7b49666..c37e8e7 100644
--- a/src/Shentun.Peis.Application/CardRegisters/CardRegisterAppService.cs
+++ b/src/Shentun.Peis.Application/CardRegisters/CardRegisterAppService.cs
@@ -22,16 +22,19 @@ namespace Shentun.Peis.CardRegisters
public class CardRegisterAppService : ApplicationService
{
private readonly IRepository _cardRegisterRepository;
+ private readonly IRepository _cardBillRepository;
private readonly IRepository _userRepository;
private readonly IRepository _organizationUnitRepository;
public CardRegisterAppService(
IRepository cardRegisterRepository,
+ IRepository cardBillRepository,
IRepository userRepository,
IRepository organizationUnitRepository
)
{
this._cardRegisterRepository = cardRegisterRepository;
+ this._cardBillRepository = cardBillRepository;
this._userRepository = userRepository;
this._organizationUnitRepository = organizationUnitRepository;
}
@@ -235,5 +238,44 @@ namespace Shentun.Peis.CardRegisters
await _cardRegisterRepository.DeleteAsync(id);
}
+
+ ///
+ /// 会员卡充值
+ ///
+ ///
+ [HttpPost("api/app/cardregister/cardregisterrecharge")]
+ public async Task CardRegisterRechargeAsync(CardRegisterRechargeDto input)
+ {
+ if (input != null)
+ {
+ var cardRegisterEnt = await _cardRegisterRepository.FindAsync(m => m.Id == input.CardRegisterId);
+ if (cardRegisterEnt != null)
+ {
+ cardRegisterEnt.CardBalance += input.RechargeAmount;
+ await _cardRegisterRepository.UpdateAsync(cardRegisterEnt);
+
+ //增加充值记录
+ var cardBill = new CardBill
+ {
+ BillFlag = '2',
+ BillMoney = input.RechargeAmount,
+ CardRegisterId = input.CardRegisterId,
+ PayModeId = input.PayModeId
+ };
+
+ await _cardBillRepository.InsertAsync(cardBill);
+
+ }
+ else
+ {
+ throw new UserFriendlyException("会员卡不存在");
+ }
+ }
+ else
+ {
+ throw new UserFriendlyException("参数有误");
+ }
+ }
+
}
}
diff --git a/src/Shentun.Peis.Application/InternalReports/InternalReportAppService.cs b/src/Shentun.Peis.Application/InternalReports/InternalReportAppService.cs
index 8f376a8..ebf041f 100644
--- a/src/Shentun.Peis.Application/InternalReports/InternalReportAppService.cs
+++ b/src/Shentun.Peis.Application/InternalReports/InternalReportAppService.cs
@@ -1,6 +1,7 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
+using NUglify.Helpers;
using Shentun.Peis.Models;
using System;
using System.Collections.Generic;
@@ -17,19 +18,25 @@ namespace Shentun.Peis.InternalReports
/// 内部报表
///
[ApiExplorerSettings(GroupName = "Work")]
- [Authorize]
+ //[Authorize]
public class InternalReportAppService : ApplicationService
{
private readonly IRepository _userRepository;
private readonly IRepository _patientRegisterRepository;
+ private readonly IRepository _registerAsbitemRepository;
+ private readonly IRepository _asbitemRepository;
public InternalReportAppService(
IRepository userRepository,
- IRepository patientRegisterRepository
+ IRepository patientRegisterRepository,
+ IRepository registerAsbitemRepository,
+ IRepository asbitemRepository
)
{
this._userRepository = userRepository;
this._patientRegisterRepository = patientRegisterRepository;
+ this._registerAsbitemRepository = registerAsbitemRepository;
+ this._asbitemRepository = asbitemRepository;
}
///
@@ -65,5 +72,66 @@ namespace Shentun.Peis.InternalReports
return entlistdto;
}
+
+
+ ///
+ /// 医生工作量统计
+ ///
+ ///
+ ///
+ [HttpPost("api/app/internalreport/getdoctorpersonnelworkloadreport")]
+ public async Task> GetDoctorPersonnelWorkLoadReportAsync(GetDoctorPersonnelWorkLoadReportRequestDto input)
+ {
+ var query = (from a in await _registerAsbitemRepository.GetQueryableAsync()
+ join b in await _userRepository.GetQueryableAsync() on a.CreatorId equals b.Id into bb
+ from ab in bb.DefaultIfEmpty()
+ join c in await _asbitemRepository.GetQueryableAsync() on a.AsbitemId equals c.Id into cc
+ from ac in cc.DefaultIfEmpty()
+ where (a.CreationTime >= Convert.ToDateTime(input.StartDate) &&
+ a.CreationTime < Convert.ToDateTime(input.EndDate).AddDays(1))
+ select new
+ {
+ a,
+ DoctorName = ab != null ? ab.UserName : "",
+ AsbitemName = ac != null ? ac.DisplayName : ""
+ });
+
+ if (input.UserIds.Count > 0)
+ {
+ query = query.Where(m => input.UserIds.Contains(m.a.CreatorId.Value));
+ }
+
+
+ var ssd = query.ToQueryString();
+
+ var entlistdto = query.GroupBy(g => new { g.a.AsbitemId, g.a.CreatorId, })
+ .Select(s => new GetDoctorPersonnelWorkLoadReportDto
+ {
+ AsbitemName = s.FirstOrDefault().AsbitemName,
+ CheckCount = s.Count(),
+ DoctorName = s.FirstOrDefault().DoctorName,
+ AvgChargePrice = Math.Round(s.Average(v => v.a.ChargePrice.Value), 2),
+ AvgStandardPrice = Math.Round(s.Average(v => v.a.StandardPrice.Value), 2),
+ SumChargePrice = Math.Round(s.Sum(v => v.a.ChargePrice.Value), 2),
+ SumStandardPrice = Math.Round(s.Sum(v => v.a.StandardPrice.Value), 2)
+ }).ToList();
+
+
+ return entlistdto;
+ }
+
+
+
+ ///
+ /// 总检医生工作量统计
+ ///
+ ///
+ ///
+ [HttpPost("api/app/internalreport/getsumcheckdoctorworkloadreport")]
+ public async Task> GetSumCheckDoctorWorkLoadReportAsync(GetSumCheckDoctorWorkLoadReportRequestDto input)
+ {
+
+ }
+
}
}