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.

65 lines
3.6 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 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 ItemDbMapping : IEntityTypeConfiguration<Item>
  13. {
  14. public void Configure(EntityTypeBuilder<Item> entity)
  15. {
  16. entity.HasComment("项目设置");
  17. entity.Property(t => t.DisplayName).HasComment("名称").IsRequired();
  18. entity.Property(t => t.EnglishShortName).HasComment("英文缩写");
  19. entity.Property(t => t.ItemTypeId).HasComment("项目类别").IsRequired().IsFixedLength();
  20. entity.Property(t => t.Price).HasComment("价格").IsRequired().HasDefaultValueSql("0");
  21. entity.Property(t => t.PriceItemId).HasComment("价表项目编码");
  22. entity.Property(t => t.UnitId).HasComment("单位");
  23. entity.Property(t => t.DefaultResult).HasComment("默认结果");
  24. entity.Property(t => t.ReferenceRangeTypeFlag).
  25. HasComment("参考范围类别0-无参考范围,1-数字型,2-字符型,3-性激素").IsRequired().
  26. HasDefaultValueSql("'0'::bpchar");
  27. entity.Property(t => t.IsProduceSummary).HasComment("是生成小结").IsRequired().HasDefaultValueSql("'Y'");
  28. entity.Property(t => t.IsNameIntoSummary).HasComment("名称进入小结").IsRequired().HasDefaultValueSql("'N'");
  29. entity.Property(t => t.IsDiagnosisFunction).HasComment("启用诊断函数").IsRequired().HasDefaultValueSql("'N'");
  30. entity.Property(t => t.DiagnosisFunction).HasComment("诊断函数");
  31. entity.Property(t => t.IsCalculationItem).HasComment("是计算项目").IsRequired().HasDefaultValueSql("'N'");
  32. entity.Property(t => t.CalculationFunction).HasComment("计算函数");
  33. entity.Property(t => t.IsContinueProcess).HasComment("是继续处理").IsRequired().HasDefaultValueSql("'Y'");
  34. entity.Property(t => t.ResultTemplateTypeFlag).HasComment("结果模板类别标志").HasDefaultValueSql("0");
  35. entity.Property(t => t.InputCheck).HasComment("输入结果校验公式");
  36. entity.Property(t => t.IsActive).HasComment("启用").IsRequired().HasDefaultValueSql("'Y'");
  37. entity.Property(t => t.LineModeFlag).HasComment("项目结果行模式").HasDefaultValue('2').IsRequired();
  38. entity.Property(t => t.IsCriticalValueFunction).HasComment("是否启用危急值函数").IsRequired().HasDefaultValueSql("'N'");
  39. entity.Property(t => t.CriticalValueFunction).HasComment("危急值函数");
  40. entity.Property(t => t.IsFollowUpFunction).HasComment("是否启用随访函数").IsRequired().HasDefaultValueSql("'N'");
  41. entity.Property(t => t.FollowUpFunction).HasComment("随访函数");
  42. entity.Property(e => e.Id).IsFixedLength();
  43. //entity.Property(e => e.CreationTime).HasDefaultValueSql("(date(timezone('UTC-8'::text, now())) - 1)");
  44. //entity.Property(e => e.LastModificationTime).HasDefaultValueSql("(date(timezone('UTC-8'::text, now())) - 1)");
  45. //entity.Property(e => e.PriceItemId).IsFixedLength();
  46. //entity.Property(e => e.UnitId).IsFixedLength();
  47. entity.HasOne(d => d.ItemType)
  48. .WithMany(p => p.Items)
  49. .HasForeignKey(d => d.ItemTypeId)
  50. .HasConstraintName("fk_item_item_type");
  51. entity.ConfigureByConvention();
  52. }
  53. }
  54. }