You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

118 lines
4.6 KiB

1 year ago
  1. using Microsoft.EntityFrameworkCore;
  2. using Microsoft.EntityFrameworkCore.Metadata.Builders;
  3. using Shentun.WebPeis.Models;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using Volo.Abp.Domain.Entities;
  10. namespace Shentun.WebPeis.Configures
  11. {
  12. internal class PersonConfigure : IEntityTypeConfiguration<Person>
  13. {
  14. public void Configure(EntityTypeBuilder<Person> entity)
  15. {
  16. entity.HasKey(e => e.PersonId).HasName("PK_patient");
  17. entity.ToTable("person", tb => tb.HasComment("体检人员档案"));
  18. entity.HasIndex(e => e.PersonNo, "IX_person_person_no").IsUnique();
  19. entity.HasIndex(e => e.IdNo, "ix_person_id_no").IsUnique();
  20. entity.Property(e => e.PersonId)
  21. .ValueGeneratedNever()
  22. .HasColumnName("person_id");
  23. entity.Property(e => e.Address)
  24. .HasMaxLength(100)
  25. .HasComment("地址")
  26. .HasColumnName("address");
  27. entity.Property(e => e.BirthDate)
  28. .HasComment("出生日期")
  29. .HasColumnType("timestamp(6) without time zone")
  30. .HasColumnName("birth_date").IsRequired();
  31. entity.Property(e => e.BirthPlaceId)
  32. .HasComment("出生地")
  33. .HasColumnName("birth_place_id");
  34. entity.Property(e => e.ConcurrencyStamp)
  35. .HasMaxLength(40)
  36. .HasColumnName("concurrency_stamp");
  37. entity.Property(e => e.CountryCode)
  38. .HasMaxLength(3)
  39. .HasColumnName("country_code").IsRequired();
  40. entity.Property(e => e.CreationTime)
  41. .HasColumnType("timestamp(6) without time zone")
  42. .HasColumnName("creation_time");
  43. entity.Property(e => e.CreatorId).HasColumnName("creator_id");
  44. entity.Property(e => e.IdNo)
  45. .HasMaxLength(18)
  46. .HasComment("身份证号")
  47. .HasColumnName("id_no").IsRequired();
  48. entity.Property(e => e.IdTypeId)
  49. .HasMaxLength(2)
  50. .IsFixedLength()
  51. .HasColumnName("id_type_id").IsRequired();
  52. entity.Property(e => e.IsAllowBind)
  53. .HasMaxLength(1)
  54. .HasColumnName("is_allow_bind").IsRequired();
  55. entity.Property(e => e.LastModificationTime)
  56. .HasColumnType("timestamp(6) without time zone")
  57. .HasColumnName("last_modification_time");
  58. entity.Property(e => e.LastModifierId).HasColumnName("last_modifier_id");
  59. entity.Property(e => e.MaritalStatusId)
  60. .HasMaxLength(1)
  61. .HasDefaultValueSql("'9'::bpchar")
  62. .HasComment("婚姻状况")
  63. .HasColumnName("marital_status_id").IsRequired();
  64. entity.Property(e => e.MedicalCenterId)
  65. .HasComment("组织单位ID")
  66. .HasColumnName("medical_center_id").IsRequired();
  67. entity.Property(e => e.NationId)
  68. .HasComment("民族编号")
  69. .HasColumnName("nation_id").IsRequired().HasMaxLength(3);
  70. entity.Property(e => e.PersonNo)
  71. .HasMaxLength(30)
  72. .HasComment("档案号")
  73. .HasColumnName("person_no").IsRequired();
  74. entity.Property(e => e.PostalCode)
  75. .HasMaxLength(10)
  76. .HasComment("邮政编码")
  77. .HasColumnName("postal_code");
  78. entity.Property(e => e.SexId)
  79. .HasMaxLength(1)
  80. .HasDefaultValueSql("'U'::bpchar")
  81. .HasComment("性别")
  82. .HasColumnName("sex_id").IsRequired();
  83. entity.Property(e => e.SimpleCode)
  84. .HasMaxLength(30)
  85. .HasComment("简码")
  86. .HasColumnName("simple_code");
  87. entity.Property(e => e.WechatOpenId)
  88. .HasMaxLength(50)
  89. .HasColumnName("wechat_open_id");
  90. entity.Property(e => e.Height)
  91. .HasComment("身高")
  92. .HasPrecision(4, 1)
  93. .HasColumnName("height");
  94. entity.Property(e => e.Weight)
  95. .HasComment("体重")
  96. .HasPrecision(5, 2)
  97. .HasColumnName("weight");
  98. entity.Property(e => e.PregnantFlag)
  99. .HasComment("备孕标志")
  100. .HasDefaultValueSql("'0'::bpchar")
  101. .HasColumnName("pregnant_flag");
  102. }
  103. }
  104. }