24 lines
1.4 KiB
C#
24 lines
1.4 KiB
C#
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
|
|
public class AlertThresholdConfiguration : IEntityTypeConfiguration<AlertThreshold>
|
|
{
|
|
public void Configure(EntityTypeBuilder<AlertThreshold> builder)
|
|
{
|
|
builder.ToTable("alert_thresholds", "clinical");
|
|
builder.HasKey(t => t.Id);
|
|
builder.Property(t => t.Id).HasColumnName("id").HasDefaultValueSql("gen_random_uuid()");
|
|
builder.Property(t => t.ObservationCode).HasColumnName("observation_code").HasMaxLength(50).IsRequired();
|
|
builder.Property(t => t.DisplayName).HasColumnName("display_name").HasMaxLength(200).IsRequired();
|
|
builder.Property(t => t.Unit).HasColumnName("unit").HasMaxLength(20).IsRequired();
|
|
builder.Property(t => t.CriticalLow).HasColumnName("critical_low").HasColumnType("decimal(10,3)");
|
|
builder.Property(t => t.WarningLow).HasColumnName("warning_low").HasColumnType("decimal(10,3)");
|
|
builder.Property(t => t.WarningHigh).HasColumnName("warning_high").HasColumnType("decimal(10,3)");
|
|
builder.Property(t => t.CriticalHigh).HasColumnName("critical_high").HasColumnType("decimal(10,3)");
|
|
builder.Property(t => t.SuppressionWindowMinutes).HasColumnName("suppression_window_minutes");
|
|
builder.Property(t => t.CreatedAt).HasColumnName("created_at").HasDefaultValueSql("NOW()");
|
|
|
|
builder.HasIndex(t => t.ObservationCode).IsUnique();
|
|
}
|
|
}
|