Browse Source

自选金额

master
DESKTOP-G961P6V\Zhh 1 year ago
parent
commit
43f1e3c411
  1. 3
      src/Shentun.WebPeis.Application/AppointPatientRegisters/AppointPatientRegisterAppService.cs
  2. 21
      src/Shentun.WebPeis.Domain/AppointPatientRegisters/AppointPatientRegisterManager.cs
  3. 5
      src/Shentun.WebPeis.Domain/Models/CustomerOrgGroup.cs
  4. 9
      src/Shentun.WebPeis.EntityFrameworkCore/Configures/CustomerOrgGroupConfigure.cs

3
src/Shentun.WebPeis.Application/AppointPatientRegisters/AppointPatientRegisterAppService.cs

@ -296,7 +296,8 @@ namespace Shentun.WebPeis.AppointPatientRegisters
on appointRegisterAsbitem.AsbitemId equals asbitem.AsbitemId
join customerOrg in await _customerOrgRepository.GetQueryableAsync()
on appointPatientRegister.CustomerOrgId equals customerOrg.CustomerOrgId
where appointPatientRegister.PersonId == input.PersonId
where appointPatientRegister.PersonId == input.PersonId &&
appointPatientRegister.CompleteFlag != AppointPatientRegisterCompleteFlag.CancelAppoint
orderby appointPatientRegister.AppointDate
select new
{

21
src/Shentun.WebPeis.Domain/AppointPatientRegisters/AppointPatientRegisterManager.cs

@ -178,8 +178,29 @@ namespace Shentun.WebPeis.AppointPatientRegisters
throw new UserFriendlyException("单位分组项目不能取消");
}
});
foreach(var asbitem in entity.AppointRegisterAsbitems)
{
decimal addMoney = 0;
var customerOrgGroupDetail = customerOrgGroupDetails.Where(o => o.AsbitemId == asbitem.AsbitemId).FirstOrDefault();
if(customerOrgGroupDetail != null)
{
addMoney += customerOrgGroupDetail.Price;
}
if(addMoney > 0)
{
var customerOrgGroup = await _customerOrgGroupRepository.GetAsync(o => o.CustomerOrgGroupId == entity.CustomerOrgGroupId);
if(addMoney > customerOrgGroup.CanAddMoney)
{
throw new UserFriendlyException($"自选的单位支付金额能超过{customerOrgGroup.CanAddMoney}元");
}
}
}
}
var asbitems = await _asbitemRepository.GetListAsync();
foreach (var appointRegisterAsbitem in entity.AppointRegisterAsbitems)
{

5
src/Shentun.WebPeis.Domain/Models/CustomerOrgGroup.cs

@ -63,6 +63,11 @@ public partial class CustomerOrgGroup : AuditedEntity, IHasConcurrencyStamp
public int DisplayOrder { get; set; }
public Guid CustomerOrgRegisterId { get; set; }
/// <summary>
/// 可增加单位支付金额
/// </summary>
public decimal CanAddMoney { get; set; }
public string? ConcurrencyStamp { get; set; }

9
src/Shentun.WebPeis.EntityFrameworkCore/Configures/CustomerOrgGroupConfigure.cs

@ -69,12 +69,19 @@ namespace Shentun.WebPeis.Configures
entity.Property(e => e.Price)
.HasPrecision(10, 2)
.HasComment("价格")
.HasColumnName("price");
.HasColumnName("price")
.HasDefaultValueSql("0"); ;
entity.Property(e => e.Remark)
.HasMaxLength(100)
.HasComment("备注")
.HasColumnName("remark");
entity.Property(e => e.CanAddMoney)
.HasPrecision(10, 2)
.HasColumnName("can_add_money")
.HasComment("可增加单位支付金额")
.IsRequired().HasDefaultValueSql("0");
entity.HasOne(d => d.CustomerOrgRegister).WithMany(p => p.CustomerOrgGroups)
.HasForeignKey(d => d.CustomerOrgRegisterId)
.OnDelete(DeleteBehavior.ClientSetNull)

Loading…
Cancel
Save