Messages->Patient relationship
This commit is contained in:
parent
cbee21dae7
commit
fa45623f6e
170
Migrations/20241213124817_Patients got messages.Designer.cs
generated
Normal file
170
Migrations/20241213124817_Patients got messages.Designer.cs
generated
Normal file
@ -0,0 +1,170 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using SimpleLIS;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace SimpleLIS.Migrations
|
||||
{
|
||||
[DbContext(typeof(HL7DbContext))]
|
||||
[Migration("20241213124817_Patients got messages")]
|
||||
partial class Patientsgotmessages
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder.HasAnnotation("ProductVersion", "8.0.11");
|
||||
|
||||
modelBuilder.Entity("SimpleLIS.Models.Message", b =>
|
||||
{
|
||||
b.Property<int>("MessageId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("ControlId")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("MessageType")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("PatientId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("ReceivingApp")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("ReceivingFacility")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("SendingApp")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("SendingFacility")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("Timestamp")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Version")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("MessageId");
|
||||
|
||||
b.HasIndex("PatientId");
|
||||
|
||||
b.ToTable("Messages");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SimpleLIS.Models.Observation", b =>
|
||||
{
|
||||
b.Property<int>("ObservationId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("AbnormalFlag")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("MessageId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("ObservationCode")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("ObservationValue")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("ResultStatus")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Units")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("ObservationId");
|
||||
|
||||
b.HasIndex("MessageId");
|
||||
|
||||
b.ToTable("Observations");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SimpleLIS.Models.Patient", b =>
|
||||
{
|
||||
b.Property<int>("PatientId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<DateTime>("DateOfBirth")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("FirstName")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Gender")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("HL7PatientId")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("LastName")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("PatientId");
|
||||
|
||||
b.ToTable("Patients");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SimpleLIS.Models.Message", b =>
|
||||
{
|
||||
b.HasOne("SimpleLIS.Models.Patient", "Patient")
|
||||
.WithMany("Messages")
|
||||
.HasForeignKey("PatientId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Patient");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SimpleLIS.Models.Observation", b =>
|
||||
{
|
||||
b.HasOne("SimpleLIS.Models.Message", "Message")
|
||||
.WithMany("Observations")
|
||||
.HasForeignKey("MessageId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Message");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SimpleLIS.Models.Message", b =>
|
||||
{
|
||||
b.Navigation("Observations");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SimpleLIS.Models.Patient", b =>
|
||||
{
|
||||
b.Navigation("Messages");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
50
Migrations/20241213124817_Patients got messages.cs
Normal file
50
Migrations/20241213124817_Patients got messages.cs
Normal file
@ -0,0 +1,50 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace SimpleLIS.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Patientsgotmessages : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "PatientId",
|
||||
table: "Messages",
|
||||
type: "INTEGER",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Messages_PatientId",
|
||||
table: "Messages",
|
||||
column: "PatientId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Messages_Patients_PatientId",
|
||||
table: "Messages",
|
||||
column: "PatientId",
|
||||
principalTable: "Patients",
|
||||
principalColumn: "PatientId",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Messages_Patients_PatientId",
|
||||
table: "Messages");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Messages_PatientId",
|
||||
table: "Messages");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "PatientId",
|
||||
table: "Messages");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -31,6 +31,9 @@ namespace SimpleLIS.Migrations
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("PatientId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("ReceivingApp")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
@ -56,6 +59,8 @@ namespace SimpleLIS.Migrations
|
||||
|
||||
b.HasKey("MessageId");
|
||||
|
||||
b.HasIndex("PatientId");
|
||||
|
||||
b.ToTable("Messages");
|
||||
});
|
||||
|
||||
@ -125,6 +130,17 @@ namespace SimpleLIS.Migrations
|
||||
b.ToTable("Patients");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SimpleLIS.Models.Message", b =>
|
||||
{
|
||||
b.HasOne("SimpleLIS.Models.Patient", "Patient")
|
||||
.WithMany("Messages")
|
||||
.HasForeignKey("PatientId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Patient");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SimpleLIS.Models.Observation", b =>
|
||||
{
|
||||
b.HasOne("SimpleLIS.Models.Message", "Message")
|
||||
@ -140,6 +156,11 @@ namespace SimpleLIS.Migrations
|
||||
{
|
||||
b.Navigation("Observations");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SimpleLIS.Models.Patient", b =>
|
||||
{
|
||||
b.Navigation("Messages");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user