apiร้องเรียน

This commit is contained in:
Kittapath 2023-11-23 08:48:21 +07:00
parent 2cdf724d58
commit d06e1af217
24 changed files with 34538 additions and 91 deletions

View file

@ -0,0 +1,275 @@
// <auto-generated />
using System;
using BMA.EHR.Infrastructure.Persistence;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb
{
[DbContext(typeof(DisciplineDbContext))]
[Migration("20231120044819_update table disciplinedirector add prefix")]
partial class updatetabledisciplinedirectoraddprefix
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.9")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineComplaint", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)")
.HasColumnOrder(0)
.HasComment("PrimaryKey")
.HasAnnotation("Relational:JsonPropertyName", "id");
b.Property<string>("Appellant")
.IsRequired()
.HasColumnType("longtext")
.HasComment("ผู้ร้องเรียน");
b.Property<string>("ComplaintFrom")
.IsRequired()
.HasColumnType("longtext")
.HasComment("รับเรื่องร้องเรียนจาก ระบุว่ารับเรื่องมาจากใคร/หน่วยงานไหน (สตง., ปปช., ปปท., จดหมาย, อีเมล, โทรศัพท์, บอกกล่าว)");
b.Property<string>("ConsideredAgency")
.IsRequired()
.HasColumnType("longtext")
.HasComment("หน่วยงานที่พิจารณา จะเปลี่ยนไปตามผู้ถูกร้องดูรายละเอียดด้านล่าง");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(100)
.HasComment("สร้างข้อมูลเมื่อ");
b.Property<string>("CreatedFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(104)
.HasComment("ชื่อ User ที่สร้างข้อมูล");
b.Property<string>("CreatedUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(101)
.HasComment("User Id ที่สร้างข้อมูล");
b.Property<DateTime?>("DateConsideration")
.HasColumnType("datetime(6)")
.HasComment("วันที่กำหนดพิจารณา");
b.Property<DateTime>("DateNotification")
.HasColumnType("datetime(6)")
.HasComment("วันแจ้งเตือนล่วงหน้า");
b.Property<DateTime>("DateReceived")
.HasColumnType("datetime(6)")
.HasComment("วันที่รับเรื่อง เป็นวันที่ถือเป็นจุดเริ่มต้นของวินัยนั้น ๆ");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("longtext")
.HasComment("รายละเอียดของเรื่องร้องเรียน");
b.Property<string>("LastUpdateFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(105)
.HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
b.Property<string>("LastUpdateUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(103)
.HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
b.Property<DateTime?>("LastUpdatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(102)
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
b.Property<string>("LevelConsideration")
.IsRequired()
.HasColumnType("longtext")
.HasComment("ระดับการพิจารณา 'ยังไม่ระบุ' (NORMAL คือ ปกติ, URGENT คือ ด่วน, VERY_URGENT คือ ด่วนมาก)");
b.Property<string>("OffenseDetails")
.IsRequired()
.HasColumnType("longtext")
.HasComment("ลักษณะความผิดครั้งแรกจะเป็น 'ยังไม่ระบุ' (NOT_SPECIFIED คือ ยังไม่ระบุ, NOT_DEADLY คือ ไม่ร้ายแรง, DEADLY คือ ร้ายแรง)");
b.Property<string>("RespondentType")
.IsRequired()
.HasColumnType("longtext")
.HasComment("ผู้ถูกร้องเรียน (PERSON คือ บุคคล, ORGANIZATION คือ หน่วยงาน, BANGKOK คือ กรุงเทพมหานคร)");
b.Property<string>("Status")
.IsRequired()
.HasColumnType("longtext")
.HasComment("สถานะเรื่องร้องเรียน มีดังนี้ ใหม่ (NEW), ยุติเรื่อง (STOP), มีมูลส่งไปสืบสวนแล้ว (SEND_INVESTIGATE)");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("longtext")
.HasComment("เรื่องที่ร้องเรียน");
b.HasKey("Id");
b.ToTable("DisciplineComplaints");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineComplaint_Channel", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)")
.HasColumnOrder(0)
.HasComment("PrimaryKey")
.HasAnnotation("Relational:JsonPropertyName", "id");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(100)
.HasComment("สร้างข้อมูลเมื่อ");
b.Property<string>("CreatedFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(104)
.HasComment("ชื่อ User ที่สร้างข้อมูล");
b.Property<string>("CreatedUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(101)
.HasComment("User Id ที่สร้างข้อมูล");
b.Property<string>("LastUpdateFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(105)
.HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
b.Property<string>("LastUpdateUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(103)
.HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
b.Property<DateTime?>("LastUpdatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(102)
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("longtext")
.HasComment("ชื่อประเภทการร้องเรียน");
b.HasKey("Id");
b.ToTable("DisciplineComplaint_Channels");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDirector", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)")
.HasColumnOrder(0)
.HasComment("PrimaryKey")
.HasAnnotation("Relational:JsonPropertyName", "id");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(100)
.HasComment("สร้างข้อมูลเมื่อ");
b.Property<string>("CreatedFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(104)
.HasComment("ชื่อ User ที่สร้างข้อมูล");
b.Property<string>("CreatedUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(101)
.HasComment("User Id ที่สร้างข้อมูล");
b.Property<string>("Email")
.IsRequired()
.HasColumnType("longtext")
.HasComment("อีเมล");
b.Property<string>("FirstName")
.IsRequired()
.HasColumnType("longtext")
.HasComment("ชื่อ");
b.Property<string>("LastName")
.IsRequired()
.HasColumnType("longtext")
.HasComment("นามสกุล");
b.Property<string>("LastUpdateFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(105)
.HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
b.Property<string>("LastUpdateUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(103)
.HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
b.Property<DateTime?>("LastUpdatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(102)
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
b.Property<string>("Phone")
.IsRequired()
.HasColumnType("longtext")
.HasComment("เบอร์โทรศัพท์");
b.Property<string>("Position")
.IsRequired()
.HasColumnType("longtext")
.HasComment("ตำแหน่ง");
b.Property<string>("Prefix")
.IsRequired()
.HasColumnType("longtext")
.HasComment("คำนำหน้าชื่อ");
b.HasKey("Id");
b.ToTable("DisciplineDirectors");
});
#pragma warning restore 612, 618
}
}
}

View file

@ -0,0 +1,30 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb
{
/// <inheritdoc />
public partial class updatetabledisciplinedirectoraddprefix : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "Prefix",
table: "DisciplineDirectors",
type: "longtext",
nullable: false,
comment: "คำนำหน้าชื่อ")
.Annotation("MySql:CharSet", "utf8mb4");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Prefix",
table: "DisciplineDirectors");
}
}
}

View file

@ -0,0 +1,206 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb
{
/// <inheritdoc />
public partial class updatetableDisciplineComplaint_Profileadddocument : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Profile_Documents_AvatarId",
table: "Profile");
migrationBuilder.DropForeignKey(
name: "FK_ProfileAvatarHistory_Documents_AvatarFileId",
table: "ProfileAvatarHistory");
migrationBuilder.DropForeignKey(
name: "FK_ProfileChangeName_Documents_DocumentId",
table: "ProfileChangeName");
migrationBuilder.DropForeignKey(
name: "FK_ProfileChangeNameHistory_Documents_DocumentId",
table: "ProfileChangeNameHistory");
migrationBuilder.DropForeignKey(
name: "FK_ProfilePaper_Documents_DocumentId",
table: "ProfilePaper");
migrationBuilder.CreateTable(
name: "DisciplineComplaint_Docs",
columns: table => new
{
Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
CreatedUserId = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล")
.Annotation("MySql:CharSet", "utf8mb4"),
LastUpdatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
LastUpdateUserId = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด")
.Annotation("MySql:CharSet", "utf8mb4"),
CreatedFullName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล")
.Annotation("MySql:CharSet", "utf8mb4"),
LastUpdateFullName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด")
.Annotation("MySql:CharSet", "utf8mb4"),
DocumentId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
DisciplineComplaintId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci")
},
constraints: table =>
{
table.PrimaryKey("PK_DisciplineComplaint_Docs", x => x.Id);
table.ForeignKey(
name: "FK_DisciplineComplaint_Docs_DisciplineComplaints_DisciplineComp~",
column: x => x.DisciplineComplaintId,
principalTable: "DisciplineComplaints",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_DisciplineComplaint_Docs_Documents_DocumentId",
column: x => x.DocumentId,
principalTable: "Documents",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "Document",
columns: table => new
{
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
FileName = table.Column<string>(type: "varchar(255)", maxLength: 255, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
FileSize = table.Column<int>(type: "int", nullable: false),
FileType = table.Column<string>(type: "varchar(128)", maxLength: 128, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Detail = table.Column<string>(type: "text", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
ObjectRefId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
CreatedDate = table.Column<DateTime>(type: "datetime(6)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Document", x => x.Id);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateIndex(
name: "IX_DisciplineComplaint_Docs_DisciplineComplaintId",
table: "DisciplineComplaint_Docs",
column: "DisciplineComplaintId");
migrationBuilder.CreateIndex(
name: "IX_DisciplineComplaint_Docs_DocumentId",
table: "DisciplineComplaint_Docs",
column: "DocumentId");
migrationBuilder.AddForeignKey(
name: "FK_Profile_Document_AvatarId",
table: "Profile",
column: "AvatarId",
principalTable: "Document",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_ProfileAvatarHistory_Document_AvatarFileId",
table: "ProfileAvatarHistory",
column: "AvatarFileId",
principalTable: "Document",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_ProfileChangeName_Document_DocumentId",
table: "ProfileChangeName",
column: "DocumentId",
principalTable: "Document",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_ProfileChangeNameHistory_Document_DocumentId",
table: "ProfileChangeNameHistory",
column: "DocumentId",
principalTable: "Document",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_ProfilePaper_Document_DocumentId",
table: "ProfilePaper",
column: "DocumentId",
principalTable: "Document",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Profile_Document_AvatarId",
table: "Profile");
migrationBuilder.DropForeignKey(
name: "FK_ProfileAvatarHistory_Document_AvatarFileId",
table: "ProfileAvatarHistory");
migrationBuilder.DropForeignKey(
name: "FK_ProfileChangeName_Document_DocumentId",
table: "ProfileChangeName");
migrationBuilder.DropForeignKey(
name: "FK_ProfileChangeNameHistory_Document_DocumentId",
table: "ProfileChangeNameHistory");
migrationBuilder.DropForeignKey(
name: "FK_ProfilePaper_Document_DocumentId",
table: "ProfilePaper");
migrationBuilder.DropTable(
name: "DisciplineComplaint_Docs");
migrationBuilder.DropTable(
name: "Document");
migrationBuilder.AddForeignKey(
name: "FK_Profile_Documents_AvatarId",
table: "Profile",
column: "AvatarId",
principalTable: "Documents",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_ProfileAvatarHistory_Documents_AvatarFileId",
table: "ProfileAvatarHistory",
column: "AvatarFileId",
principalTable: "Documents",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_ProfileChangeName_Documents_DocumentId",
table: "ProfileChangeName",
column: "DocumentId",
principalTable: "Documents",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_ProfileChangeNameHistory_Documents_DocumentId",
table: "ProfileChangeNameHistory",
column: "DocumentId",
principalTable: "Documents",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_ProfilePaper_Documents_DocumentId",
table: "ProfilePaper",
column: "DocumentId",
principalTable: "Documents",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
}
}

View file

@ -1,5 +1,9 @@
using BMA.EHR.Application.Common.Interfaces;
using BMA.EHR.Domain.Models.Discipline;
using BMA.EHR.Domain.Models.MetaData;
using BMA.EHR.Domain.Models.Organizations;
// using BMA.EHR.Domain.Models.Discipline;
using Microsoft.EntityFrameworkCore;
@ -13,9 +17,113 @@ namespace BMA.EHR.Infrastructure.Persistence
public DbSet<DisciplineComplaint> DisciplineComplaints { get; set; }
public DbSet<DisciplineComplaint_Channel> DisciplineComplaint_Channels { get; set; }
public DbSet<DisciplineDirector> DisciplineDirectors { get; set; }
public DbSet<DisciplineComplaint_Profile> DisciplineComplaint_Profiles { get; set; }
public DbSet<DisciplineComplaint_Doc> DisciplineComplaint_Docs { get; set; }
public DbSet<Document> Documents { get; set; }
#endregion
#region " Meta Data "
public DbSet<Prefix> Prefixes { get; set; }
public DbSet<BloodGroup> BloodGroups { get; set; }
public DbSet<Gender> Genders { get; set; }
public DbSet<PhysicalStatus> PhysicalStatuses { get; set; }
public DbSet<Religion> Religions { get; set; }
public DbSet<EducationLevel> EducationLevels { get; set; }
public DbSet<PositionPath> PositionPaths { get; set; }
public DbSet<PositionType> PositionTypes { get; set; }
public DbSet<PositionEmployeePosition> PositionEmployeePositions { get; set; }
public DbSet<PositionEmployeePositionSide> PositionEmployeePositionSides { get; set; }
public DbSet<PositionEmployeeGroup> PositionEmployeeGroups { get; set; }
public DbSet<PositionEmployeeLine> PositionEmployeeLines { get; set; }
public DbSet<PositionEmployeeLevel> PositionEmployeeLevels { get; set; }
public DbSet<PositionEmployeeStatus> PositionEmployeeStatuses { get; set; }
public DbSet<PositionLine> PositionLines { get; set; }
public DbSet<PositionExecutive> PositionExecutives { get; set; }
public DbSet<PositionStatus> PositionStatuss { get; set; }
public DbSet<PositionLevel> PositionLevels { get; set; }
public DbSet<Relationship> Relationships { get; set; }
public DbSet<Position> Positions { get; set; }
public DbSet<PositionPathSide> PositionPathSides { get; set; }
public DbSet<PositionExecutiveSide> PositionExecutiveSides { get; set; }
public DbSet<InsigniaType> InsigniaTypes { get; set; }
public DbSet<Insignia> Insignias { get; set; }
public DbSet<Province> Provinces { get; set; }
public DbSet<District> Districts { get; set; }
public DbSet<SubDistrict> SubDistricts { get; set; }
public DbSet<Holiday> Holidays { get; set; }
public DbSet<OrganizationType> OrganizationTypes { get; set; }
public DbSet<OrganizationLevel> OrganizationLevels { get; set; }
public DbSet<OrganizationOrganization> OrganizationOrganizations { get; set; }
public DbSet<OrganizationShortName> OrganizationShortNames { get; set; }
public DbSet<OrganizationStatus> OrganizationStatuses { get; set; }
public DbSet<OrganizationAgency> OrganizationAgencys { get; set; }
public DbSet<OrganizationGovernmentAgency> OrganizationGovernmentAgencys { get; set; }
public DbSet<OrganizationTelExternal> OrganizationTelExternals { get; set; }
public DbSet<OrganizationTelInternal> OrganizationTelInternals { get; set; }
public DbSet<OrganizationFax> OrganizationFaxs { get; set; }
public DbSet<RoyalHierarchy> RoyalHierarchys { get; set; }
public DbSet<RoyalType> RoyalTypes { get; set; }
public DbSet<Royal> Royals { get; set; }
#endregion
#region " Organizations "
public DbSet<AvailablePositionLevelEntity> AvailablePositionLevels { get; set; }
public DbSet<PositionMasterEntity> PositionMasters { get; set; }
public DbSet<OrganizationEntity> Organizations { get; set; }
public DbSet<PositionNumberEntity> PositionNumbers { get; set; }
public DbSet<OrganizationPositionEntity> OrganizationPositions { get; set; }
public DbSet<ProfilePosition> ProfilePositions { get; set; }
#endregion
public DisciplineDbContext(DbContextOptions<DisciplineDbContext> options) : base(options)
{