เพิ่มคำสั่งในกรรมการ
This commit is contained in:
parent
b371717f89
commit
bcd4a6bd87
9 changed files with 3121 additions and 0 deletions
|
|
@ -190,5 +190,79 @@ namespace BMA.EHR.DisciplineDirector.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>
|
||||
[HttpGet("investigate/{id:guid}")]
|
||||
public async Task<ActionResult<ResponseObject>> GetHistoryDisciplineInvestigate(Guid id)
|
||||
{
|
||||
var director = await _context.DisciplineDirectors.Where(x => x.Id == id).FirstOrDefaultAsync();
|
||||
if (director == null)
|
||||
return Error(new Exception(GlobalMessages.DataNotFound), StatusCodes.Status404NotFound);
|
||||
|
||||
var data = await _context.DisciplineInvestigates
|
||||
.Where(x => x.DisciplineInvestigate_Directors
|
||||
.Where(x => x.DisciplineDirector == director)
|
||||
.FirstOrDefault() != null
|
||||
)
|
||||
.Select(x => new
|
||||
{
|
||||
Title = x.Title,
|
||||
Director = x.DisciplineInvestigate_Directors.Select(y => new
|
||||
{
|
||||
CommandNo = y.CommandNo,
|
||||
Duty = y.Duty,
|
||||
Prefix = y.DisciplineDirector.Prefix,
|
||||
FirstName = y.DisciplineDirector.FirstName,
|
||||
LastName = y.DisciplineDirector.LastName,
|
||||
}),
|
||||
})
|
||||
.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>
|
||||
[HttpGet("disciplinary/{id:guid}")]
|
||||
public async Task<ActionResult<ResponseObject>> GetHistoryDisciplineDisciplinary(Guid id)
|
||||
{
|
||||
var director = await _context.DisciplineDirectors.Where(x => x.Id == id).FirstOrDefaultAsync();
|
||||
if (director == null)
|
||||
return Error(new Exception(GlobalMessages.DataNotFound), StatusCodes.Status404NotFound);
|
||||
|
||||
var data = await _context.DisciplineDisciplinarys
|
||||
.Where(x => x.DisciplineDisciplinary_DirectorInvestigates
|
||||
.Where(x => x.DisciplineDirector == director)
|
||||
.FirstOrDefault() != null
|
||||
)
|
||||
.Select(x => new
|
||||
{
|
||||
Title = x.Title,
|
||||
Director = x.DisciplineDisciplinary_DirectorInvestigates.Select(y => new
|
||||
{
|
||||
CommandNo = y.CommandNo,
|
||||
Duty = y.Duty,
|
||||
Prefix = y.DisciplineDirector.Prefix,
|
||||
FirstName = y.DisciplineDirector.FirstName,
|
||||
LastName = y.DisciplineDirector.LastName,
|
||||
}),
|
||||
})
|
||||
.ToListAsync();
|
||||
|
||||
return Success(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -442,6 +442,7 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers
|
|||
Position = d.DisciplineDirector.Position,
|
||||
Email = d.DisciplineDirector.Email,
|
||||
Duty = d.Duty,
|
||||
CommandNo = d.CommandNo,
|
||||
Phone = d.DisciplineDirector.Phone,
|
||||
// Total = d.DisciplineDirector.DisciplineDisciplinary_DirectorInvestigates.Count(),
|
||||
}).ToList(),
|
||||
|
|
@ -655,6 +656,7 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers
|
|||
{
|
||||
DisciplineDirector = director,
|
||||
Duty = isDirector == null ? "" : isDirector.Duty,
|
||||
CommandNo = isDirector == null ? "" : isDirector.CommandNo,
|
||||
CreatedFullName = FullName ?? "System Administrator",
|
||||
CreatedUserId = UserId ?? "",
|
||||
CreatedAt = DateTime.Now,
|
||||
|
|
@ -1718,6 +1720,7 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers
|
|||
if (director == null)
|
||||
return Error(new Exception(GlobalMessages.DataNotFound), StatusCodes.Status404NotFound);
|
||||
director.Duty = req.duty;
|
||||
director.CommandNo = req.commandNo;
|
||||
director.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
director.LastUpdateUserId = UserId ?? "";
|
||||
director.LastUpdatedAt = DateTime.Now;
|
||||
|
|
|
|||
|
|
@ -272,6 +272,7 @@ namespace BMA.EHR.DisciplineInvestigate.Service.Controllers
|
|||
Position = d.DisciplineDirector.Position,
|
||||
Email = d.DisciplineDirector.Email,
|
||||
Duty = d.Duty,
|
||||
CommandNo = d.CommandNo,
|
||||
Phone = d.DisciplineDirector.Phone,
|
||||
// Total = d.DisciplineDirector.DisciplineInvestigate_Directors.Count(),
|
||||
}).ToList(),
|
||||
|
|
@ -422,6 +423,7 @@ namespace BMA.EHR.DisciplineInvestigate.Service.Controllers
|
|||
{
|
||||
DisciplineDirector = director,
|
||||
Duty = isDirector == null ? "" : isDirector.Duty,
|
||||
CommandNo = isDirector == null ? "" : isDirector.CommandNo,
|
||||
CreatedFullName = FullName ?? "System Administrator",
|
||||
CreatedUserId = UserId ?? "",
|
||||
CreatedAt = DateTime.Now,
|
||||
|
|
@ -1010,6 +1012,7 @@ namespace BMA.EHR.DisciplineInvestigate.Service.Controllers
|
|||
if (director == null)
|
||||
return Error(new Exception(GlobalMessages.DataNotFound), StatusCodes.Status404NotFound);
|
||||
director.Duty = req.duty;
|
||||
director.CommandNo = req.commandNo;
|
||||
director.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
director.LastUpdateUserId = UserId ?? "";
|
||||
director.LastUpdatedAt = DateTime.Now;
|
||||
|
|
|
|||
|
|
@ -5,5 +5,6 @@ namespace BMA.EHR.Discipline.Service.Requests
|
|||
public class DisciplineDutyRequest
|
||||
{
|
||||
public string duty { get; set; }//
|
||||
public string commandNo { get; set; }//
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,5 +14,7 @@ namespace BMA.EHR.Domain.Models.Discipline
|
|||
public DisciplineDisciplinary DisciplineDisciplinary { get; set; }
|
||||
[Comment("หน้าที่")]
|
||||
public string Duty { get; set; } = string.Empty;
|
||||
[Comment("เลขที่คำสั่ง")]
|
||||
public string CommandNo { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,5 +14,7 @@ namespace BMA.EHR.Domain.Models.Discipline
|
|||
public DisciplineInvestigate DisciplineInvestigate { get; set; }
|
||||
[Comment("หน้าที่")]
|
||||
public string Duty { get; set; } = string.Empty;
|
||||
[Comment("เลขที่คำสั่ง")]
|
||||
public string CommandNo { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,42 @@
|
|||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class updatetableDisciplineDisciplinary_DirectorInvestigatesaddCommandNo : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "CommandNo",
|
||||
table: "DisciplineInvestigate_Directors",
|
||||
type: "longtext",
|
||||
nullable: false,
|
||||
comment: "เลขที่คำสั่ง")
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "CommandNo",
|
||||
table: "DisciplineDisciplinary_DirectorInvestigates",
|
||||
type: "longtext",
|
||||
nullable: false,
|
||||
comment: "เลขที่คำสั่ง")
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "CommandNo",
|
||||
table: "DisciplineInvestigate_Directors");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "CommandNo",
|
||||
table: "DisciplineDisciplinary_DirectorInvestigates");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1002,6 +1002,11 @@ namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb
|
|||
.HasComment("PrimaryKey")
|
||||
.HasAnnotation("Relational:JsonPropertyName", "id");
|
||||
|
||||
b.Property<string>("CommandNo")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("เลขที่คำสั่ง");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("datetime(6)")
|
||||
.HasColumnOrder(100)
|
||||
|
|
@ -2048,6 +2053,11 @@ namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb
|
|||
.HasComment("PrimaryKey")
|
||||
.HasAnnotation("Relational:JsonPropertyName", "id");
|
||||
|
||||
b.Property<string>("CommandNo")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("เลขที่คำสั่ง");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("datetime(6)")
|
||||
.HasColumnOrder(100)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue