บันทึกสรุปผลวินัย

This commit is contained in:
Kittapath 2023-12-19 21:40:32 +07:00
parent 7c2a4c0280
commit 6b7a5bfa06
15 changed files with 24038 additions and 0 deletions

View file

@ -125,6 +125,7 @@ namespace BMA.EHR.DisciplineComplaint_Appeal.Service.Controllers
{
Status = p.Status,
CreatedAt = p.CreatedAt,
CreatedFullName = p.CreatedFullName,
}),
DisciplineComplaint_Appeal_Docs = x.DisciplineComplaint_Appeal_Docs.Where(d => d.Document != null).Select(d => new { d.Document.Id, d.Document.FileName }),
})

View file

@ -113,6 +113,7 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers
PersonId = p.PersonId,
PosNo = p.PosNo,
Organization = p.Organization,
IsSend = p.IsReport,
}),//รายการข้อมูลบุคลผู้ถูกสืบสวน
OrganizationId = x.Organization,//id หน่วยงานกรณี type เป็นหน่วยงาน
ConsideredAgency = x.ConsideredAgency,//หน่วยงานที่พิจารณา จะเปลี่ยนไปตามผู้ถูกร้องดูรายละเอียดด้านล่าง
@ -193,11 +194,13 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers
data.LastUpdateFullName = FullName ?? "System Administrator";
data.LastUpdateUserId = UserId ?? "";
data.LastUpdatedAt = DateTime.Now;
var hisprofile = data.DisciplineDisciplinary_ProfileComplaintInvestigates;
_context.DisciplineDisciplinary_ProfileComplaintInvestigates.RemoveRange(data.DisciplineDisciplinary_ProfileComplaintInvestigates);
if (data.RespondentType.Trim().ToUpper() == "PERSON")
{
foreach (var item in req.persons)
{
var isReport = hisprofile.Where(x => x.PersonId == item.personId).FirstOrDefault();
data.DisciplineDisciplinary_ProfileComplaintInvestigates.Add(
new DisciplineDisciplinary_ProfileComplaintInvestigate
{
@ -212,6 +215,7 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers
PersonId = item.personId,
PosNo = item.posNo,
Status = "NEW",
IsReport = isReport == null ? false : isReport.IsReport,
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
@ -454,6 +458,7 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers
PersonId = p.PersonId,
PosNo = p.PosNo,
Organization = p.Organization,
IsSend = p.IsReport,
Report = p.DisciplineReport_Profiles.Count() > 0 ? true : false,
}),//รายการข้อมูลบุคลผู้ถูกสืบสวน
OrganizationId = x.Organization,//id หน่วยงานกรณี type เป็นหน่วยงาน
@ -651,11 +656,13 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers
}
data.Organization = req.organizationId;
data.RespondentType = req.respondentType;
var hisprofile = data.DisciplineDisciplinary_ProfileComplaintInvestigates;
_context.DisciplineDisciplinary_ProfileComplaintInvestigates.RemoveRange(data.DisciplineDisciplinary_ProfileComplaintInvestigates);
if (data.RespondentType.Trim().ToUpper() == "PERSON")
{
foreach (var item in req.persons)
{
var isReport = hisprofile.Where(x => x.PersonId == item.personId).FirstOrDefault();
data.DisciplineDisciplinary_ProfileComplaintInvestigates.Add(
new DisciplineDisciplinary_ProfileComplaintInvestigate
{
@ -670,6 +677,7 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers
PersonId = item.personId,
PosNo = item.posNo,
Status = "NEW",
IsReport = isReport == null ? false : isReport.IsReport,
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
@ -1528,5 +1536,35 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers
.ToListAsync();
return Success(data);
}
/// <summary>
/// สั่งรายชื่อไปออกคำสั่งยุตื
/// </summary>
/// <returns></returns>
/// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("report")]
// [HttpPut("report/{commandTypeId:length(36)}")]
public async Task<ActionResult<ResponseObject>> PostToReport([FromBody] DisciplineProfileRequest req)
{
foreach (var item in req.Id)
{
var uppdated = await _context.DisciplineDisciplinary_ProfileComplaintInvestigates
.FirstOrDefaultAsync(x => x.Id == item);
if (uppdated == null)
continue;
// uppdated.CommandTypeId = commandTypeId;
uppdated.IsReport = true;
uppdated.LastUpdateFullName = FullName ?? "System Administrator";
uppdated.LastUpdateUserId = UserId ?? "";
uppdated.LastUpdatedAt = DateTime.Now;
}
await _context.SaveChangesAsync();
return Success();
}
}
}

View file

@ -110,6 +110,7 @@ namespace BMA.EHR.DisciplineInvestigate.Service.Controllers
PersonId = p.PersonId,
PosNo = p.PosNo,
Organization = p.Organization,
IsSend = p.IsReport,
}),//รายการข้อมูลบุคลผู้ถูกสืบสวน
OrganizationId = x.Organization,//id หน่วยงานกรณี type เป็นหน่วยงาน
ConsideredAgency = x.ConsideredAgency,//หน่วยงานที่พิจารณา จะเปลี่ยนไปตามผู้ถูกร้องดูรายละเอียดด้านล่าง
@ -189,11 +190,13 @@ namespace BMA.EHR.DisciplineInvestigate.Service.Controllers
data.LastUpdateFullName = FullName ?? "System Administrator";
data.LastUpdateUserId = UserId ?? "";
data.LastUpdatedAt = DateTime.Now;
var hisprofile = data.DisciplineInvestigate_ProfileComplaints;
_context.DisciplineInvestigate_ProfileComplaints.RemoveRange(data.DisciplineInvestigate_ProfileComplaints);
if (data.RespondentType.Trim().ToUpper() == "PERSON")
{
foreach (var item in req.persons)
{
var isReport = hisprofile.Where(x => x.PersonId == item.personId).FirstOrDefault();
data.DisciplineInvestigate_ProfileComplaints.Add(
new DisciplineInvestigate_ProfileComplaint
{
@ -207,6 +210,7 @@ namespace BMA.EHR.DisciplineInvestigate.Service.Controllers
Salary = item.salary,
PersonId = item.personId,
PosNo = item.posNo,
IsReport = isReport == null ? false : isReport.IsReport,
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
@ -284,6 +288,7 @@ namespace BMA.EHR.DisciplineInvestigate.Service.Controllers
PersonId = p.PersonId,
PosNo = p.PosNo,
Organization = p.Organization,
IsSend = p.IsReport,
}),//รายการข้อมูลบุคลผู้ถูกสืบสวน
OrganizationId = x.Organization,//id หน่วยงานกรณี type เป็นหน่วยงาน
DisciplineInvestigateDocs = x.DisciplineInvestigate_Docs.Where(d => d.Document != null).Select(d => new { d.Document.Id, d.Document.FileName }),
@ -423,11 +428,13 @@ namespace BMA.EHR.DisciplineInvestigate.Service.Controllers
}
data.Organization = req.organizationId;
data.RespondentType = req.respondentType;
var hisprofile = data.DisciplineInvestigate_ProfileComplaints;
_context.DisciplineInvestigate_ProfileComplaints.RemoveRange(data.DisciplineInvestigate_ProfileComplaints);
if (data.RespondentType.Trim().ToUpper() == "PERSON")
{
foreach (var item in req.persons)
{
var isReport = hisprofile.Where(x => x.PersonId == item.personId).FirstOrDefault();
data.DisciplineInvestigate_ProfileComplaints.Add(
new DisciplineInvestigate_ProfileComplaint
{
@ -441,6 +448,7 @@ namespace BMA.EHR.DisciplineInvestigate.Service.Controllers
Salary = item.salary,
PersonId = item.personId,
PosNo = item.posNo,
IsReport = isReport == null ? false : isReport.IsReport,
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
@ -563,6 +571,7 @@ namespace BMA.EHR.DisciplineInvestigate.Service.Controllers
Position = item.Position,
PositionLevel = item.PositionLevel,
Status = "NEW",
IsReport = false,
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
@ -939,5 +948,35 @@ namespace BMA.EHR.DisciplineInvestigate.Service.Controllers
.ToListAsync();
return Success(data);
}
/// <summary>
/// สั่งรายชื่อไปออกคำสั่งยุตื
/// </summary>
/// <returns></returns>
/// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("report")]
// [HttpPut("report/{commandTypeId:length(36)}")]
public async Task<ActionResult<ResponseObject>> PostToReport([FromBody] DisciplineProfileRequest req)
{
foreach (var item in req.Id)
{
var uppdated = await _context.DisciplineInvestigate_ProfileComplaints
.FirstOrDefaultAsync(x => x.Id == item);
if (uppdated == null)
continue;
// uppdated.CommandTypeId = commandTypeId;
uppdated.IsReport = true;
uppdated.LastUpdateFullName = FullName ?? "System Administrator";
uppdated.LastUpdateUserId = UserId ?? "";
uppdated.LastUpdatedAt = DateTime.Now;
}
await _context.SaveChangesAsync();
return Success();
}
}
}

View file

@ -116,12 +116,44 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
}),//รายการข้อมูลบุคลผู้ถูกสืบสวน
OrganizationId = x.Organization,//id หน่วยงานกรณี type เป็นหน่วยงาน
ResultDescription = x.ResultDescription,//สรุปผลการพิจารณา
ResultOc = x.ResultOc,//
ResultDisciplineType = x.ResultDisciplineType,//
ResultTitleType = x.ResultTitleType,//
ResultYear = x.ResultYear,//
Status = x.Status,//สถานะหรือผลการสอบสวน
DisciplineDisciplinary_DocResults = x.DisciplineDisciplinary_DocResults.Where(d => d.Document != null).Select(d => new { d.Document.Id, d.Document.FileName }),
})
.Where(x => x.Id == id)
.FirstOrDefaultAsync();
if (_data == null)
return Error(new Exception(GlobalMessages.DataNotFound), (int)StatusCodes.Status404NotFound);
var disciplineDisciplinary_DocResults = new List<dynamic>();
foreach (var doc in _data.DisciplineDisciplinary_DocResults)
{
var _doc = new
{
doc.Id,
doc.FileName,
PathName = await _documentService.ImagesPath(doc.Id)
};
disciplineDisciplinary_DocResults.Add(_doc);
}
var data = new
{
_data.Id,
_data.IdInvestigate,
_data.IdComplaint,
_data.RespondentType,
_data.Persons,
_data.OrganizationId,
_data.ResultDescription,
_data.ResultOc,
_data.ResultDisciplineType,
_data.ResultTitleType,
_data.ResultYear,
_data.Status,
disciplineDisciplinary_DocResults,
};
return Success(_data);
}
@ -142,6 +174,10 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
return Error(new Exception(GlobalMessages.DataNotFound), (int)StatusCodes.Status404NotFound);
data.ResultDescription = req.resultDescription;
data.ResultOc = req.oc;
data.ResultDisciplineType = req.disciplineType;
data.ResultTitleType = req.titleType;
data.ResultYear = req.year;
data.LastUpdateFullName = FullName ?? "System Administrator";
data.LastUpdateUserId = UserId ?? "";
data.LastUpdatedAt = DateTime.Now;
@ -177,5 +213,88 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
await _context.SaveChangesAsync();
return Success();
}
/// <summary>
/// อัพไฟล์เอกสารสืบสวนวินัย
/// </summary>
/// <returns></returns>
/// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPut("file/{id:guid}")]
public async Task<ActionResult<ResponseObject>> UploadFileDisciplineDisciplinaryInvestigate([FromForm] DisciplineFileRequest req, Guid id)
{
var data = await _context.DisciplineDisciplinarys
.Where(x => x.Id == id)
.FirstOrDefaultAsync();
if (data == null)
return Error(new Exception(GlobalMessages.DataNotFound), (int)StatusCodes.Status404NotFound);
// if (data.Status.Trim().ToUpper() != "NEW")
// return Error(new Exception("ไม่สามารถแก้ไขข้อมูลนี้ได้"), (int)StatusCodes.Status500InternalServerError);
if (Request.Form.Files != null && Request.Form.Files.Count != 0)
{
foreach (var file in Request.Form.Files)
{
var fileExtension = Path.GetExtension(file.FileName);
var doc = await _documentService.UploadFileAsync(file, file.FileName);
var _doc = await _context.Documents.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == doc.Id);
if (_doc != null)
{
var disciplineDisciplinary_DocResult = new DisciplineDisciplinary_DocResult
{
DisciplineDisciplinary = data,
Document = _doc,
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",
LastUpdatedAt = DateTime.Now,
};
await _context.DisciplineDisciplinary_DocResults.AddAsync(disciplineDisciplinary_DocResult);
}
}
}
await _context.SaveChangesAsync();
return Success();
}
/// <summary>
/// ลบไฟล์เอกสารสืบสวนวินัย
/// </summary>
/// <returns></returns>
/// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpDelete("file/{id:guid}/{docId:guid}")]
public async Task<ActionResult<ResponseObject>> DeleteFileDisciplineDisciplinaryInvestigate(Guid id, Guid docId)
{
var data = await _context.DisciplineDisciplinarys
.Include(x => x.DisciplineDisciplinary_DocResults)
.ThenInclude(x => x.Document)
.Where(x => x.Id == id)
.FirstOrDefaultAsync();
if (data == null)
return Error(new Exception(GlobalMessages.DataNotFound), (int)StatusCodes.Status404NotFound);
// if (data.Status.Trim().ToUpper() != "NEW")
// return Error(new Exception("ไม่สามารถแก้ไขข้อมูลนี้ได้"), (int)StatusCodes.Status500InternalServerError);
var dataDoc = data.DisciplineDisciplinary_DocResults.Where(x => x.Document.Id == docId).FirstOrDefault();
if (dataDoc != null)
{
_context.DisciplineDisciplinary_DocResults.Remove(dataDoc);
await _context.SaveChangesAsync();
await _documentService.DeleteFileAsync(docId);
await _context.SaveChangesAsync();
return Success();
}
else
{
return Error(new Exception("ไม่พบไฟล์นี้ในระบบ"), (int)StatusCodes.Status404NotFound);
}
}
}
}

View file

@ -5,5 +5,9 @@ namespace BMA.EHR.Discipline.Service.Requests
public class DisciplineResultRequest
{
public string resultDescription { get; set; }// *สรุปผลการพิจารณา
public string? oc { get; set; }//
public string? disciplineType { get; set; }//
public string? titleType { get; set; }//
public int? year { get; set; }//
}
}

View file

@ -126,11 +126,20 @@ namespace BMA.EHR.Domain.Models.Discipline
[Comment("สรุปผลการพิจารณา")]
public string? ResultDescription { get; set; }
[Comment("หน่วยงาย/ส่วนราชการ")]
public string? ResultOc { get; set; }
[Comment("ประเภทวินัย")]
public string? ResultDisciplineType { get; set; }
[Comment("ประเภทของเรื่อง")]
public string? ResultTitleType { get; set; }
[Comment("ปีงบประมาณ")]
public int? ResultYear { get; set; }
public DisciplineInvestigate DisciplineInvestigate { get; set; }
public virtual List<DisciplineDisciplinary_ProfileComplaintInvestigate> DisciplineDisciplinary_ProfileComplaintInvestigates { get; set; } = new List<DisciplineDisciplinary_ProfileComplaintInvestigate>();
public virtual List<DisciplineDisciplinary_DocComplaintInvestigate> DisciplineDisciplinary_DocComplaintInvestigates { get; set; } = new List<DisciplineDisciplinary_DocComplaintInvestigate>();
public virtual List<DisciplineDisciplinary_DocInvestigate> DisciplineDisciplinary_DocInvestigates { get; set; } = new List<DisciplineDisciplinary_DocInvestigate>();
public virtual List<DisciplineDisciplinary_DocResult> DisciplineDisciplinary_DocResults { get; set; } = new List<DisciplineDisciplinary_DocResult>();
public virtual List<DisciplineDisciplinary_DocInvestigateRelevant> DisciplineDisciplinary_DocInvestigateRelevants { get; set; } = new List<DisciplineDisciplinary_DocInvestigateRelevant>();
public virtual List<DisciplineDisciplinary_DirectorInvestigate> DisciplineDisciplinary_DirectorInvestigates { get; set; } = new List<DisciplineDisciplinary_DirectorInvestigate>();

View file

@ -0,0 +1,16 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using BMA.EHR.Domain.Models.Base;
using BMA.EHR.Domain.Models.Organizations;
using Microsoft.EntityFrameworkCore;
namespace BMA.EHR.Domain.Models.Discipline
{
public class DisciplineDisciplinary_DocResult : EntityBase
{
[Required, Comment("อ้างอิงรหัสเอกสาร")]
public Document Document { get; set; }
[Required, Comment("อ้างอิงเรื่องสอบสวน")]
public DisciplineDisciplinary DisciplineDisciplinary { get; set; }
}
}

View file

@ -33,6 +33,8 @@ namespace BMA.EHR.Domain.Models.Discipline
public string? Status { get; set; }
[Comment("ประเภทออกคำสั่ง")]
public Guid? CommandTypeId { get; set; }
[Comment("ส่งไปยุติเรื่อง")]
public bool IsReport { get; set; } = false;
[Required, Comment("Id เรื่องสอบสวน")]
public DisciplineDisciplinary DisciplineDisciplinary { get; set; }
public virtual List<DisciplineReport_Profile> DisciplineReport_Profiles { get; set; } = new List<DisciplineReport_Profile>();

View file

@ -29,6 +29,8 @@ namespace BMA.EHR.Domain.Models.Discipline
public string? PositionLevel { get; set; }
[Comment("เงินเดือน")]
public double? Salary { get; set; }
[Comment("ส่งไปยุติเรื่อง")]
public bool IsReport { get; set; } = false;
[Required, Comment("Id เรื่องสืบสวน")]
public DisciplineInvestigate DisciplineInvestigate { get; set; }
}

View file

@ -0,0 +1,42 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb
{
/// <inheritdoc />
public partial class updatetableDisciplineComplaint_Appealsaddisreport : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "IsReport",
table: "DisciplineInvestigate_ProfileComplaints",
type: "tinyint(1)",
nullable: false,
defaultValue: false,
comment: "ส่งไปยุติเรื่อง");
migrationBuilder.AddColumn<bool>(
name: "IsReport",
table: "DisciplineDisciplinary_ProfileComplaintInvestigates",
type: "tinyint(1)",
nullable: false,
defaultValue: false,
comment: "ส่งไปยุติเรื่อง");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "IsReport",
table: "DisciplineInvestigate_ProfileComplaints");
migrationBuilder.DropColumn(
name: "IsReport",
table: "DisciplineDisciplinary_ProfileComplaintInvestigates");
}
}
}

View file

@ -0,0 +1,115 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb
{
/// <inheritdoc />
public partial class addtableDisciplineInvestigate_Docs : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "ResultDisciplineType",
table: "DisciplineDisciplinarys",
type: "longtext",
nullable: true,
comment: "ประเภทวินัย")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "ResultOc",
table: "DisciplineDisciplinarys",
type: "longtext",
nullable: true,
comment: "หน่วยงาย/ส่วนราชการ")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "ResultTitleType",
table: "DisciplineDisciplinarys",
type: "longtext",
nullable: true,
comment: "ประเภทของเรื่อง")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<int>(
name: "ResultYear",
table: "DisciplineDisciplinarys",
type: "int",
nullable: true,
comment: "ปีงบประมาณ");
migrationBuilder.CreateTable(
name: "DisciplineDisciplinary_DocResults",
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"),
DisciplineDisciplinaryId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci")
},
constraints: table =>
{
table.PrimaryKey("PK_DisciplineDisciplinary_DocResults", x => x.Id);
table.ForeignKey(
name: "FK_DisciplineDisciplinary_DocResults_DisciplineDisciplinarys_Di~",
column: x => x.DisciplineDisciplinaryId,
principalTable: "DisciplineDisciplinarys",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_DisciplineDisciplinary_DocResults_Documents_DocumentId",
column: x => x.DocumentId,
principalTable: "Documents",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateIndex(
name: "IX_DisciplineDisciplinary_DocResults_DisciplineDisciplinaryId",
table: "DisciplineDisciplinary_DocResults",
column: "DisciplineDisciplinaryId");
migrationBuilder.CreateIndex(
name: "IX_DisciplineDisciplinary_DocResults_DocumentId",
table: "DisciplineDisciplinary_DocResults",
column: "DocumentId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "DisciplineDisciplinary_DocResults");
migrationBuilder.DropColumn(
name: "ResultDisciplineType",
table: "DisciplineDisciplinarys");
migrationBuilder.DropColumn(
name: "ResultOc",
table: "DisciplineDisciplinarys");
migrationBuilder.DropColumn(
name: "ResultTitleType",
table: "DisciplineDisciplinarys");
migrationBuilder.DropColumn(
name: "ResultYear",
table: "DisciplineDisciplinarys");
}
}
}

View file

@ -877,10 +877,26 @@ namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb
.HasColumnType("longtext")
.HasComment("สรุปผลการพิจารณา");
b.Property<string>("ResultDisciplineType")
.HasColumnType("longtext")
.HasComment("ประเภทวินัย");
b.Property<string>("ResultInvestigate")
.HasColumnType("longtext")
.HasComment("ผลการตรวจสอบเรื่องสืบสวน");
b.Property<string>("ResultOc")
.HasColumnType("longtext")
.HasComment("หน่วยงาย/ส่วนราชการ");
b.Property<string>("ResultTitleType")
.HasColumnType("longtext")
.HasComment("ประเภทของเรื่อง");
b.Property<int?>("ResultYear")
.HasColumnType("int")
.HasComment("ปีงบประมาณ");
b.Property<string>("Status")
.IsRequired()
.HasColumnType("longtext")
@ -1409,6 +1425,68 @@ namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb
b.ToTable("DisciplineDisciplinary_DocRelevants");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary_DocResult", 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<Guid>("DisciplineDisciplinaryId")
.HasColumnType("char(36)");
b.Property<Guid>("DocumentId")
.HasColumnType("char(36)");
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.HasKey("Id");
b.HasIndex("DisciplineDisciplinaryId");
b.HasIndex("DocumentId");
b.ToTable("DisciplineDisciplinary_DocResults");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary_DocSummaryEvidence", b =>
{
b.Property<Guid>("Id")
@ -1579,6 +1657,10 @@ namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb
.HasColumnType("varchar(100)")
.HasComment("ชื่อ");
b.Property<bool>("IsReport")
.HasColumnType("tinyint(1)")
.HasComment("ส่งไปยุติเรื่อง");
b.Property<string>("LastName")
.IsRequired()
.HasMaxLength(100)
@ -2171,6 +2253,10 @@ namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb
.HasColumnType("varchar(100)")
.HasComment("ชื่อ");
b.Property<bool>("IsReport")
.HasColumnType("tinyint(1)")
.HasComment("ส่งไปยุติเรื่อง");
b.Property<string>("LastName")
.IsRequired()
.HasMaxLength(100)
@ -10525,6 +10611,25 @@ namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb
b.Navigation("Document");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary_DocResult", b =>
{
b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary", "DisciplineDisciplinary")
.WithMany("DisciplineDisciplinary_DocResults")
.HasForeignKey("DisciplineDisciplinaryId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("BMA.EHR.Domain.Models.Discipline.Document", "Document")
.WithMany()
.HasForeignKey("DocumentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("DisciplineDisciplinary");
b.Navigation("Document");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary_DocSummaryEvidence", b =>
{
b.HasOne("BMA.EHR.Domain.Models.Discipline.DisciplineDisciplinary", "DisciplineDisciplinary")
@ -11508,6 +11613,8 @@ namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb
b.Navigation("DisciplineDisciplinary_DocRelevants");
b.Navigation("DisciplineDisciplinary_DocResults");
b.Navigation("DisciplineDisciplinary_DocSummaryEvidences");
b.Navigation("DisciplineDisciplinary_DocWitnessess");

View file

@ -33,6 +33,7 @@ namespace BMA.EHR.Infrastructure.Persistence
public DbSet<DisciplineDisciplinary_ProfileComplaintInvestigate> DisciplineDisciplinary_ProfileComplaintInvestigates { get; set; }
public DbSet<DisciplineDisciplinary_DocInvestigateRelevant> DisciplineDisciplinary_DocInvestigateRelevants { get; set; }
public DbSet<DisciplineDisciplinary_DocInvestigate> DisciplineDisciplinary_DocInvestigates { get; set; }
public DbSet<DisciplineDisciplinary_DocResult> DisciplineDisciplinary_DocResults { get; set; }
public DbSet<DisciplineDisciplinary_DocComplaintInvestigate> DisciplineDisciplinary_DocComplaintInvestigates { get; set; }
public DbSet<DisciplineDisciplinary_DirectorInvestigate> DisciplineDisciplinary_DirectorInvestigates { get; set; }
public DbSet<DisciplineDisciplinary_DocSummaryEvidence> DisciplineDisciplinary_DocSummaryEvidences { get; set; }