Browse Source

会员卡有效期、体检中心

bjmzak
wxd 2 years ago
parent
commit
2dd7720404
  1. 2
      src/Shentun.Peis.Application.Contracts/CardBills/CardBillDto.cs
  2. 2
      src/Shentun.Peis.Application.Contracts/CardRegisters/CreateCardRegisterDto.cs
  3. 2
      src/Shentun.Peis.Application.Contracts/CardRegisters/UpdateCardRegisterDto.cs
  4. 6
      src/Shentun.Peis.Application/CardBills/CardBillAppService.cs
  5. 8
      src/Shentun.Peis.Application/CardRegisters/CardRegisterAppService.cs
  6. 2
      src/Shentun.Peis.Application/PageHelper.cs
  7. 4
      src/Shentun.Peis.Application/PeisApplicationAutoMapperProfile.cs
  8. 13
      src/Shentun.Peis.Domain/CardRegisters/CardRegister.cs
  9. 6
      src/Shentun.Peis.Domain/CardRegisters/CardRegisterManager.cs
  10. 17
      src/Shentun.Peis.Domain/DataHelper.cs
  11. 13431
      src/Shentun.Peis.EntityFrameworkCore/Migrations/20240412013631_init20240412001.Designer.cs
  12. 36
      src/Shentun.Peis.EntityFrameworkCore/Migrations/20240412013631_init20240412001.cs
  13. 13431
      src/Shentun.Peis.EntityFrameworkCore/Migrations/20240412014555_init20240412002.Designer.cs
  14. 25
      src/Shentun.Peis.EntityFrameworkCore/Migrations/20240412014555_init20240412002.cs
  15. 13
      src/Shentun.Peis.EntityFrameworkCore/Migrations/PeisDbContextModelSnapshot.cs

2
src/Shentun.Peis.Application.Contracts/CardBills/CardBillDto.cs

@ -62,7 +62,7 @@ namespace Shentun.Peis.CardBills
/// <summary>
/// 有效期
/// </summary>
public string? ExpiryDate { get; set; }
public string ExpiryDate { get; set; }
/// <summary>
/// 领用者
/// </summary>

2
src/Shentun.Peis.Application.Contracts/CardRegisters/CreateCardRegisterDto.cs

@ -11,7 +11,7 @@ namespace Shentun.Peis.CardRegisters
/// <summary>
/// 体检中心ID
/// </summary>
public Guid OrganizationUnitId { get; set; }
public Guid MedicalCenterId { get; set; }
/// <summary>
/// 卡类型

2
src/Shentun.Peis.Application.Contracts/CardRegisters/UpdateCardRegisterDto.cs

@ -9,7 +9,7 @@ namespace Shentun.Peis.CardRegisters
/// <summary>
/// 体检中心ID
/// </summary>
public Guid OrganizationUnitId { get; set; }
public Guid MedicalCenterId { get; set; }
/// <summary>
/// 卡类型

6
src/Shentun.Peis.Application/CardBills/CardBillAppService.cs

@ -114,12 +114,12 @@ namespace Shentun.Peis.CardBills
CreatorId = s.CreatorId,
CustomerName = s.CardRegister.CustomerName,
Discount = s.CardRegister.Discount,
ExpiryDate = s.CardRegister.ExpiryDate.ToString(),
ExpiryDate = DataHelper.ConversionDateToString(s.CardRegister.ExpiryDate),
Id = s.Id,
IdNo = s.CardRegister.IdNo,
LastModificationTime = s.LastModificationTime,
LastModifierId = s.LastModifierId,
OrganizationUnitId = s.CardRegister.OrganizationUnitId,
OrganizationUnitId = s.CardRegister.MedicalCenterId,
PayModeId = s.PayModeId,
Remark = s.CardRegister.Remark,
Telephone = s.CardRegister.Telephone,
@ -154,7 +154,7 @@ namespace Shentun.Peis.CardBills
var chargeBackPayQueryable = await _chargeBackPayRepository.GetQueryableAsync();
var userQueryable = await _userRepository.GetQueryableAsync();
var queryCharge = from a in cardBillQueryable.Where(m => m.CardRegisterId == CardRegisterId && m.BillFlag ==CardBillFlag.Deduction)
var queryCharge = from a in cardBillQueryable.Where(m => m.CardRegisterId == CardRegisterId && m.BillFlag == CardBillFlag.Deduction)
join b in chargePayQueryable on a.Id equals b.CardBillId into bb
from ab in bb.DefaultIfEmpty()
join c in chargeQueryable on ab.ChargeId equals c.Id into cc

8
src/Shentun.Peis.Application/CardRegisters/CardRegisterAppService.cs

@ -99,8 +99,8 @@ namespace Shentun.Peis.CardRegisters
}
else if (input.DateType == '2')
{
cardRegisterList = cardRegisterList.Where(m => m.ExpiryDate != null && m.ExpiryDate.Value.ToDateTime(TimeOnly.MinValue) >= Convert.ToDateTime(input.StartDate) &&
m.ExpiryDate.Value.ToDateTime(TimeOnly.MinValue) < Convert.ToDateTime(input.EndDate).AddDays(1));
cardRegisterList = cardRegisterList.Where(m => m.ExpiryDate != null && m.ExpiryDate >= Convert.ToDateTime(input.StartDate) &&
m.ExpiryDate < Convert.ToDateTime(input.EndDate).AddDays(1));
}
}
}
@ -114,7 +114,7 @@ namespace Shentun.Peis.CardRegisters
from ab in bb.DefaultIfEmpty()
join c in userQueryable on a.LastModifierId equals c.Id into cc
from ac in cc.DefaultIfEmpty()
join d in organizationUnitQueryable on a.OrganizationUnitId equals d.Id into dd
join d in organizationUnitQueryable on a.MedicalCenterId equals d.Id into dd
from ad in dd.DefaultIfEmpty()
select new { a, CreatorName = ab != null ? ab.UserName : "", LastModifierName = ac != null ? ac.UserName : "", OrganizationUnitName = ad != null ? ad.DisplayName : "" };
@ -131,7 +131,7 @@ namespace Shentun.Peis.CardRegisters
CreationTime = s.a.CreationTime,
CreatorId = s.a.CreatorId,
Discount = s.a.Discount,
ExpiryDate = s.a.ExpiryDate.ToString(),
ExpiryDate = DataHelper.ConversionDateToString(s.a.ExpiryDate),
Id = s.a.Id,
IdNo = s.a.IdNo,
LastModificationTime = s.a.LastModificationTime,

2
src/Shentun.Peis.Application/PageHelper.cs

@ -135,7 +135,7 @@ namespace Shentun.Peis
}
public static DateTime? ConvertDatetimeV(string? dateTime)
public static DateTime? ConvertDatetimeV(string dateTime)
{
if (string.IsNullOrEmpty(dateTime))
{

4
src/Shentun.Peis.Application/PeisApplicationAutoMapperProfile.cs

@ -434,8 +434,8 @@ public class PeisApplicationAutoMapperProfile : Profile
CreateMap<CardRegister, CardRegisterDto>();
CreateMap<CreateCardRegisterDto, CardRegister>().ForMember(d => d.ExpiryDate, opt => opt.MapFrom(src => PageHelper.ConvertDate(src.ExpiryDate)));
CreateMap<UpdateCardRegisterDto, CardRegister>().ForMember(d => d.ExpiryDate, opt => opt.MapFrom(src => PageHelper.ConvertDate(src.ExpiryDate)));
CreateMap<CreateCardRegisterDto, CardRegister>().ForMember(d => d.ExpiryDate, opt => opt.MapFrom(src => PageHelper.ConvertDatetimeV(src.ExpiryDate)));
CreateMap<UpdateCardRegisterDto, CardRegister>().ForMember(d => d.ExpiryDate, opt => opt.MapFrom(src => PageHelper.ConvertDatetimeV(src.ExpiryDate)));
CreateMap<MenuInfo, MenuInfoDto>();

13
src/Shentun.Peis.Domain/CardRegisters/CardRegister.cs

@ -13,21 +13,22 @@ namespace Shentun.Peis.Models
/// </summary>
[Table("card_register")]
[Index(nameof(CardNo), nameof(IsActive), Name = "ix_card_register", IsUnique = true)]
public class CardRegister : AuditedEntity<Guid>, IHasConcurrencyStamp
public class CardRegister : AuditedEntity<Guid>, IHasConcurrencyStamp
{
public CardRegister()
{
CardBills = new HashSet<CardBill>();
}
internal CardRegister(Guid id):base(id) {
internal CardRegister(Guid id) : base(id)
{
}
/// <summary>
/// 体检中心ID
/// </summary>
[Column("organization_unit_id")]
public Guid OrganizationUnitId { get; set; }
[Column("medical_center_id")]
public Guid MedicalCenterId { get; set; }
/// <summary>
/// 卡类型
@ -53,13 +54,13 @@ namespace Shentun.Peis.Models
/// 有效期
/// </summary>
[Column("expiry_date")]
public DateOnly? ExpiryDate { get; set; }
public DateTime ExpiryDate { get; set; }
/// <summary>
/// 领用者
/// </summary>
[Column("customer_name")]
[StringLength(20)]
public string? CustomerName { get; set; }
public string? CustomerName { get; set; }
/// <summary>
/// 身份证号
/// </summary>

6
src/Shentun.Peis.Domain/CardRegisters/CardRegisterManager.cs

@ -51,7 +51,7 @@ namespace Shentun.Peis.CardRegisters
ExpiryDate = entity.ExpiryDate,
IdNo = entity.IdNo,
MobileTelephone = entity.MobileTelephone,
OrganizationUnitId = entity.OrganizationUnitId,
MedicalCenterId = entity.MedicalCenterId,
Remark = entity.Remark,
Telephone = entity.Telephone
@ -88,7 +88,7 @@ namespace Shentun.Peis.CardRegisters
targetEntity.ExpiryDate = sourceEntity.ExpiryDate;
targetEntity.IdNo = sourceEntity.IdNo;
targetEntity.MobileTelephone = sourceEntity.MobileTelephone;
targetEntity.OrganizationUnitId = sourceEntity.OrganizationUnitId;
targetEntity.MedicalCenterId = sourceEntity.MedicalCenterId;
targetEntity.Remark = sourceEntity.Remark;
targetEntity.Telephone = sourceEntity.Telephone;
@ -197,7 +197,7 @@ namespace Shentun.Peis.CardRegisters
DataHelper.CheckStringIsNull(entity.IdNo, "身份证号");
DataHelper.CheckStringIsNull(entity.IdNo, "手机号");
DataHelper.CheckGuidIsDefaultValue(entity.CardTypeId, "卡类型");
DataHelper.CheckGuidIsDefaultValue(entity.OrganizationUnitId, "体检中心");
DataHelper.CheckGuidIsDefaultValue(entity.MedicalCenterId, "体检中心");
DataHelper.CheckCharIsYOrN(entity.IsActive, "使用标志");
}
}

17
src/Shentun.Peis.Domain/DataHelper.cs

@ -95,6 +95,23 @@ namespace Shentun.Peis
return msg.ToString();
}
/// <summary>
/// 统一转换日期为字符串格式
/// </summary>
/// <param name="dateTime"></param>
/// <returns></returns>
public static string ConversionDateToString(DateTime? dateTime)
{
if (dateTime == null)
{
return "";
}
else
{
return dateTime.Value.ToString("yyyy-MM-dd HH:mm:ss");
}
}
/// <summary>
/// 验证是否为空或者空字符串
/// </summary>

13431
src/Shentun.Peis.EntityFrameworkCore/Migrations/20240412013631_init20240412001.Designer.cs
File diff suppressed because it is too large
View File

36
src/Shentun.Peis.EntityFrameworkCore/Migrations/20240412013631_init20240412001.cs

@ -0,0 +1,36 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Shentun.Peis.Migrations
{
public partial class init20240412001 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<DateTime>(
name: "expiry_date",
table: "card_register",
type: "timestamp without time zone",
nullable: false,
comment: "有效期",
oldClrType: typeof(DateOnly),
oldType: "date",
oldComment: "有效期");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<DateOnly>(
name: "expiry_date",
table: "card_register",
type: "date",
nullable: false,
comment: "有效期",
oldClrType: typeof(DateTime),
oldType: "timestamp without time zone",
oldComment: "有效期");
}
}
}

13431
src/Shentun.Peis.EntityFrameworkCore/Migrations/20240412014555_init20240412002.Designer.cs
File diff suppressed because it is too large
View File

25
src/Shentun.Peis.EntityFrameworkCore/Migrations/20240412014555_init20240412002.cs

@ -0,0 +1,25 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Shentun.Peis.Migrations
{
public partial class init20240412002 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "organization_unit_id",
table: "card_register",
newName: "medical_center_id");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "medical_center_id",
table: "card_register",
newName: "organization_unit_id");
}
}
}

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

@ -1235,9 +1235,8 @@ namespace Shentun.Peis.Migrations
.HasDefaultValueSql("100")
.HasComment("折扣");
b.Property<DateOnly?>("ExpiryDate")
.IsRequired()
.HasColumnType("date")
b.Property<DateTime>("ExpiryDate")
.HasColumnType("timestamp without time zone")
.HasColumnName("expiry_date")
.HasComment("有效期");
@ -1266,6 +1265,10 @@ namespace Shentun.Peis.Migrations
.HasColumnType("uuid")
.HasColumnName("last_modifier_id");
b.Property<Guid>("MedicalCenterId")
.HasColumnType("uuid")
.HasColumnName("medical_center_id");
b.Property<string>("MobileTelephone")
.IsRequired()
.HasMaxLength(20)
@ -1273,10 +1276,6 @@ namespace Shentun.Peis.Migrations
.HasColumnName("mobile_telephone")
.HasComment("手机");
b.Property<Guid>("OrganizationUnitId")
.HasColumnType("uuid")
.HasColumnName("organization_unit_id");
b.Property<string>("Remark")
.HasMaxLength(50)
.HasColumnType("character varying(50)")

Loading…
Cancel
Save