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.

139 lines
7.2 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
2 years ago
2 years ago
3 years ago
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
2 years ago
2 years ago
2 years ago
1 year ago
5 months ago
5 months ago
4 months ago
1 month ago
5 months ago
3 years ago
  1. using Microsoft.EntityFrameworkCore;
  2. using Microsoft.EntityFrameworkCore.Metadata.Builders;
  3. using Shentun.Peis.EntityFrameworkCore;
  4. using Shentun.Peis.Models;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. namespace Shentun.Peis.DbMapping
  11. {
  12. internal class PatientRegisterDbMapping : IEntityTypeConfiguration<PatientRegister>
  13. {
  14. public void Configure(EntityTypeBuilder<PatientRegister> entity)
  15. {
  16. entity.HasComment("体检登记主档");
  17. entity.Property(e => e.Id)
  18. .ValueGeneratedNever()
  19. .HasComment("登记流水号").IsRequired();
  20. entity.Property(e => e.Age).HasComment("年龄");
  21. entity.Property(e => e.CompleteFlag)
  22. .HasDefaultValueSql("'0'::bpchar")
  23. .HasComment("完成标志").IsRequired();
  24. entity.Property(e => e.CustomerOrgGroupId)
  25. .IsFixedLength()
  26. .HasComment("分组");
  27. entity.Property(e => e.CustomerOrgId)
  28. .IsFixedLength()
  29. .HasComment("单位编号");
  30. entity.Property(e => e.MaritalStatusId)
  31. .HasDefaultValueSql("'9'")
  32. .HasComment("婚姻状况").IsRequired();
  33. entity.Property(e => e.MedicalConclusionId)
  34. .IsFixedLength()
  35. .HasComment("体检结论");
  36. entity.Property(e => e.MedicalPackageId)
  37. .IsFixedLength()
  38. .HasComment("套餐");
  39. entity.Property(e => e.MedicalStartDate)
  40. .HasDefaultValueSql("date(timezone('UTC-8'::text, now()))")
  41. .HasComment("体检开始日期").IsRequired();
  42. entity.Property(e => e.MedicalTimes).HasComment("体检次数").IsRequired();
  43. entity.Property(e => e.MedicalTypeId)
  44. .IsFixedLength()
  45. .HasComment("体检类别");
  46. entity.Property(e => e.PersonnelTypeId)
  47. .IsFixedLength()
  48. .HasComment("人员类别");
  49. entity.Property(t => t.PatientRegisterNo).HasComment("条码号").IsRequired();
  50. entity.Property(t => t.PatientId).HasComment("档案号").IsRequired();
  51. entity.Property(t => t.PatientName).HasComment("姓名").IsRequired();
  52. entity.Property(t => t.SexId).HasComment("性别").IsRequired().HasDefaultValueSql("'U'");
  53. entity.Property(t => t.BirthDate).HasComment("出生日期");
  54. entity.Property(t => t.JobCardNo).HasComment("工卡号");
  55. entity.Property(t => t.MedicalCardNo).HasComment("体检卡号");
  56. entity.Property(t => t.JobPost).HasComment("职务");
  57. entity.Property(t => t.JobTitle).HasComment("职称");
  58. entity.Property(t => t.Photo).HasComment("照片");
  59. entity.Property(t => t.Salesman).HasComment("介绍人");
  60. entity.Property(t => t.SexHormoneTermId).HasComment("性激素期限");
  61. entity.Property(t => t.InterposeMeasure).HasComment("干预措施");
  62. entity.Property(t => t.ReportPrintTimes).HasComment("体检报告打印次数").IsRequired().HasDefaultValue((short)0);
  63. entity.Property(t => t.IsUpload).HasComment("是否上传到WEB").IsRequired().HasDefaultValueSql("'N'");
  64. entity.Property(t => t.IsUploadAppoint).HasComment("是否上传预约备单到WEB").IsRequired().HasDefaultValueSql("'N'");
  65. entity.Property(t => t.IsMedicalStart).HasComment("体检开始标志").IsRequired().HasDefaultValueSql("'N'");
  66. entity.Property(t => t.IsRecoverGuide).HasComment("指引单收回").IsRequired().HasDefaultValueSql("'N'");
  67. entity.Property(t => t.SummaryDate).HasComment("总检日期");
  68. entity.Property(t => t.SummaryDoctorId).HasComment("总检医生");
  69. entity.Property(t => t.IsAudit).HasComment("审核").IsRequired().HasDefaultValueSql("'N'");
  70. entity.Property(t => t.AuditDoctorId).HasComment("审核医生");
  71. entity.Property(t => t.AuditDate).HasComment("审核日期");
  72. entity.Property(t => t.IsLock).HasComment("锁住").IsRequired().HasDefaultValueSql("'N'");
  73. entity.Property(t => t.IsNameHide).HasComment("隐藏姓名").IsRequired().HasDefaultValueSql("'N'");
  74. entity.Property(t => t.IsPhoneFollow).HasComment("电话随访").IsRequired().HasDefaultValueSql("'N'");
  75. entity.Property(t => t.IsVip).HasComment("vip客户").IsRequired().HasDefaultValueSql("'N'");
  76. entity.Property(t => t.ThirdInfo).HasComment("附加第三方信息");
  77. entity.Property(t => t.GuidePrintTimes).HasComment("指引单打印次数").IsRequired().HasDefaultValue((short)0);
  78. entity.Property(t => t.Remark).HasComment("备注");
  79. entity.Property(t => t.MedicalCenterId).HasComment("体检中心ID").IsRequired();
  80. entity.Property(t => t.CustomerOrgRegisterId).HasComment("客户单位登记ID").HasDefaultValue(Guid.Empty);
  81. entity.Property(t => t.AppointPatientRegisterId).HasMaxLength(40).HasComment("预约人员登记ID");
  82. entity.Property(t => t.DeviceReportPrintTimes).HasComment("设备体检报告打印次数").IsRequired().HasDefaultValue((short)0);
  83. entity.Property(t => t.DeviceGuidePrintTimes).HasComment("设备体检报告打印次数").IsRequired().HasDefaultValue((short)0);
  84. entity.Property(t => t.ReportPrintOperating).HasComment("体检报告打印操作者");
  85. entity.Property(t => t.SummaryHistoricalReview).HasComment("总检历次综述内容");
  86. entity.Property(t => t.IsReceiveReport).HasComment("报告是否领取").HasDefaultValueSql("'N'");
  87. entity.Property(t => t.ReportReceiveName).HasComment("报告领取人");
  88. entity.Property(t => t.ReportReceiveDate).HasComment("报告领取时间");
  89. entity.Property(t => t.IsPushThirdResult).HasComment("是否推送第三方结果").HasDefaultValueSql("'N'");
  90. //entity.HasOne(d => d.CustomerOrgRegister)
  91. // .WithMany(p => p.PatientRegisters)
  92. // .HasForeignKey(d => d.CustomerOrgRegisterId)
  93. // .OnDelete(DeleteBehavior.ClientSetNull)
  94. // .HasConstraintName("fk_patient_register_org_register");
  95. entity.HasOne(d => d.MaritalStatus)
  96. .WithMany(p => p.PatientRegisters)
  97. .HasForeignKey(d => d.MaritalStatusId)
  98. .OnDelete(DeleteBehavior.ClientSetNull)
  99. .HasConstraintName("fk_patient_register_marital_status_id");
  100. //9527
  101. //entity.HasOne(d => d.OrganizationUnit)
  102. // .WithMany(p => p.PatientRegisters)
  103. // .HasForeignKey(d => d.OrganizationUnitId)
  104. // .OnDelete(DeleteBehavior.ClientSetNull)
  105. // .HasConstraintName("fk_patient_register_ororganization_unit");
  106. entity.HasOne(d => d.Patient)
  107. .WithMany(p => p.PatientRegisters)
  108. .HasForeignKey(d => d.PatientId)
  109. .HasConstraintName("fk_patient_register_patient");
  110. entity.ConfigureByConvention();
  111. }
  112. }
  113. }