Browse Source

会员卡

master
wxd 4 weeks ago
parent
commit
d8ceb9c1df
  1. 1
      src/Shentun.Peis.Application.Contracts/RegisterCheckAsbitems/RegisterCheckAsbitemCheckChargeRequestDto.cs
  2. 2
      src/Shentun.Peis.Application/PrintReports/PrintReportAppService.cs
  3. 56
      src/Shentun.Peis.Application/RegisterCheckAsbitems/RegisterCheckAsbitemAppService.cs
  4. 2
      src/Shentun.Peis.Domain/ChargePays/ChargePay.cs
  5. 8
      src/Shentun.Peis.Domain/Charges/Charge.cs
  6. 1
      src/Shentun.Peis.EntityFrameworkCore/Migrations/PeisDbContextModelSnapshot.cs

1
src/Shentun.Peis.Application.Contracts/RegisterCheckAsbitems/RegisterCheckAsbitemCheckChargeRequestDto.cs

@ -56,7 +56,6 @@ namespace Shentun.Peis.RegisterAsbitems
/// <summary>
/// 组合项目
/// </summary>
[Column("asbitem_id")]
public Guid AsbitemId { get; set; }
/// <summary>

2
src/Shentun.Peis.Application/PrintReports/PrintReportAppService.cs

@ -1926,7 +1926,7 @@ namespace Shentun.Peis.PrintReports
ReportFontColor = (resultStatus == null) ? 0 : resultStatus.ReportFontColor,
ReportBackgroundColor = (resultStatus == null) ? 16579836 : resultStatus.ReportBackgroundColor,
ReportPrompt = (resultStatus == null) ? null : resultStatus.ReportPrompt,
DisplayOrder = registerCheckItemRow.item.DisplayOrder,
DisplayOrder = registerCheckItemRow.item.DisplayOrder
};
medicalReportRegisterCheckDto.Items.Add(medicalReportCheckItemDto);
}

56
src/Shentun.Peis.Application/RegisterCheckAsbitems/RegisterCheckAsbitemAppService.cs

@ -363,7 +363,7 @@ namespace Shentun.Peis.RegisterAsbitems
}).OrderBy(o => o.ItemType.DisplayOrder)
.OrderBy(o => o.Asbitem.DisplayOrder)
.ToList();
var chargeRequests = (
from registerCheckAsbitem in await _registerCheckAsbitemRepository.GetQueryableAsync()
join chargeRequest in await _chargeRequestRepository.GetQueryableAsync()
@ -565,13 +565,35 @@ namespace Shentun.Peis.RegisterAsbitems
{
if (input != null && input.Asbitems.Any() && input.ChargePays.Any())
{
#region 验证是否多张同样的卡
var cardList = input.ChargePays.Where(m => m.PayModeId == "05").ToList();
if (cardList.Any())
{
if (cardList.GroupBy(g => g.CardRegisterId).Count() < cardList.Count)
{
throw new UserFriendlyException("同一张会员卡不能重复提交");
}
}
#endregion
#region 验证项目金额跟收费的金额合计是否一致
if (input.Asbitems.Sum(s => s.ChargePrice * s.Amount) != input.ChargePays.Sum(s => s.ChargeMoney))
{
throw new UserFriendlyException("收费金额合计跟项目金额合计不一致");
}
#endregion
//更新收费状态
List<RegisterCheckAsbitem> registerAsbitems = await _registerCheckAsbitemRepository.GetListAsync(m => input.Asbitems.Select(s => s.RegisterAsbitemId).Contains(m.Id));
registerAsbitems.ForEach(f => f.IsCharge = 'Y');
#region 插入主表Charge
Guid chargeId = GuidGenerator.Create();
Charge charge = new Charge
Charge charge = new Charge(chargeId)
{
ChargeFlag = '0',
InvoiceNo = input.InvoiceNo,
@ -579,7 +601,7 @@ namespace Shentun.Peis.RegisterAsbitems
PatientRegisterId = input.PatientRegisterId
};
var charge_new = await _chargeRepository.InsertAsync(charge, true);
var charge_new = await _chargeRepository.InsertAsync(charge);
#region 收费项目
@ -591,7 +613,7 @@ namespace Shentun.Peis.RegisterAsbitems
{
Amount = item.Amount,
AsbitemId = item.AsbitemId,
ChargeId = charge_new.Id,
ChargeId = chargeId,
RegisterAsbitemId = item.RegisterAsbitemId,
ChargePrice = item.ChargePrice
});
@ -611,8 +633,11 @@ namespace Shentun.Peis.RegisterAsbitems
{
if (item.PayModeId == "05")
{
Guid cardBillId = GuidGenerator.Create();
//会员卡
CardBill cardBill = new CardBill(GuidGenerator.Create())
CardBill cardBill = new CardBill(cardBillId)
{
PayModeId = item.PayModeId,
BillFlag = CardBillFlag.Deduction,
@ -620,17 +645,18 @@ namespace Shentun.Peis.RegisterAsbitems
CardRegisterId = item.CardRegisterId.Value
};
cardBill = _cardBillManager.CreateAsync(cardBill);
var cardBill_new = await _cardBillRepository.InsertAsync(cardBill);
if (cardBill_new != null)
await _cardBillRepository.InsertAsync(cardBill);
chargePays.Add(new ChargePay
{
chargePays.Add(new ChargePay
{
ChargeMoney = item.ChargeMoney,
PayModeId = item.PayModeId,
ChargeId = charge_new.Id,
CardBillId = cardBill_new.Id
});
}
ChargeMoney = item.ChargeMoney,
PayModeId = item.PayModeId,
ChargeId = charge_new.Id,
CardBillId = cardBillId
});
#region 扣除会员卡余额

2
src/Shentun.Peis.Domain/ChargePays/ChargePay.cs

@ -11,7 +11,7 @@ namespace Shentun.Peis.Models
/// 收费支付方式
/// </summary>
[Table("charge_pay")]
[Index(nameof(ChargeId), nameof(PayModeId), Name = "IX_charge_pay_pay_mode_id", IsUnique = true)]
[Index(nameof(ChargeId), nameof(PayModeId), Name = "IX_charge_pay_pay_mode_id")]
public class ChargePay : Entity<Guid>, IHasConcurrencyStamp
{
/// <summary>

8
src/Shentun.Peis.Domain/Charges/Charge.cs

@ -16,6 +16,12 @@ namespace Shentun.Peis.Models
[Index(nameof(PatientRegisterId), Name = "ix_charge")]
public class Charge : AuditedEntity<Guid>, IHasConcurrencyStamp
{
public Charge(Guid id) : base(id) {
ChargeAsbitems = new HashSet<ChargeAsbitem>();
ChargeBacks = new HashSet<ChargeBack>();
ChargePays = new HashSet<ChargePay>();
}
public Charge()
{
ChargeAsbitems = new HashSet<ChargeAsbitem>();
@ -23,7 +29,7 @@ namespace Shentun.Peis.Models
ChargePays = new HashSet<ChargePay>();
}
/// <summary>
/// 登记流水号
/// </summary>

1
src/Shentun.Peis.EntityFrameworkCore/Migrations/PeisDbContextModelSnapshot.cs

@ -1770,7 +1770,6 @@ namespace Shentun.Peis.Migrations
b.HasIndex("PayModeId");
b.HasIndex(new[] { "ChargeId", "PayModeId" }, "IX_charge_pay_pay_mode_id")
.IsUnique()
.HasDatabaseName("IX_charge_pay_pay_mode_id1");
b.ToTable("charge_pay");

Loading…
Cancel
Save