query report อุทธรณ์
This commit is contained in:
parent
f11f927f7e
commit
52af68a9a9
6 changed files with 11826 additions and 4 deletions
|
|
@ -2,6 +2,7 @@
|
||||||
using BMA.EHR.Application.Repositories.MessageQueue;
|
using BMA.EHR.Application.Repositories.MessageQueue;
|
||||||
using BMA.EHR.Discipline.Service.Requests;
|
using BMA.EHR.Discipline.Service.Requests;
|
||||||
using BMA.EHR.Domain.Common;
|
using BMA.EHR.Domain.Common;
|
||||||
|
using BMA.EHR.Domain.Extensions;
|
||||||
using BMA.EHR.Domain.Models.Discipline;
|
using BMA.EHR.Domain.Models.Discipline;
|
||||||
using BMA.EHR.Domain.Shared;
|
using BMA.EHR.Domain.Shared;
|
||||||
using BMA.EHR.Infrastructure.Persistence;
|
using BMA.EHR.Infrastructure.Persistence;
|
||||||
|
|
@ -120,11 +121,14 @@ namespace BMA.EHR.DisciplineComplaint_Appeal.Service.Controllers
|
||||||
Fullname = x.Fullname,
|
Fullname = x.Fullname,
|
||||||
CitizenId = x.CitizenId,
|
CitizenId = x.CitizenId,
|
||||||
ProfileId = x.ProfileId,
|
ProfileId = x.ProfileId,
|
||||||
|
Oc = x.Oc,
|
||||||
|
Position = x.Position,
|
||||||
LastUpdatedAt = x.LastUpdatedAt,
|
LastUpdatedAt = x.LastUpdatedAt,
|
||||||
HistoryStatus = x.DisciplineComplaint_Appeal_Historys.Select(p => new
|
HistoryStatus = x.DisciplineComplaint_Appeal_Historys.Select(p => new
|
||||||
{
|
{
|
||||||
Status = p.Status,
|
Status = p.Status,
|
||||||
CreatedAt = p.CreatedAt,
|
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 }),
|
DisciplineComplaint_Appeal_Docs = x.DisciplineComplaint_Appeal_Docs.Where(d => d.Document != null).Select(d => new { d.Document.Id, d.Document.FileName }),
|
||||||
})
|
})
|
||||||
|
|
@ -156,6 +160,8 @@ namespace BMA.EHR.DisciplineComplaint_Appeal.Service.Controllers
|
||||||
_data.Fullname,
|
_data.Fullname,
|
||||||
_data.CitizenId,
|
_data.CitizenId,
|
||||||
_data.ProfileId,
|
_data.ProfileId,
|
||||||
|
_data.Oc,
|
||||||
|
_data.Position,
|
||||||
_data.LastUpdatedAt,
|
_data.LastUpdatedAt,
|
||||||
_data.HistoryStatus,
|
_data.HistoryStatus,
|
||||||
disciplineComplaint_Appeal_Docs,
|
disciplineComplaint_Appeal_Docs,
|
||||||
|
|
@ -179,13 +185,15 @@ namespace BMA.EHR.DisciplineComplaint_Appeal.Service.Controllers
|
||||||
Title = req.Title,
|
Title = req.Title,
|
||||||
Description = req.Description,
|
Description = req.Description,
|
||||||
Status = "NEW",
|
Status = "NEW",
|
||||||
Type = req.Type,
|
Type = req.Type.Trim().ToUpper(),
|
||||||
Year = req.Year,
|
Year = req.Year == null ? DateTime.Now.Year : req.Year,
|
||||||
CaseType = req.CaseType,
|
CaseType = req.CaseType,
|
||||||
CaseNumber = req.CaseNumber,
|
CaseNumber = req.CaseNumber,
|
||||||
Fullname = req.Fullname,
|
Fullname = req.Fullname,
|
||||||
CitizenId = req.CitizenId,
|
CitizenId = req.CitizenId,
|
||||||
ProfileId = req.ProfileId,
|
ProfileId = req.ProfileId,
|
||||||
|
Position = req.Position,
|
||||||
|
Oc = req.Oc,
|
||||||
CreatedFullName = FullName ?? "System Administrator",
|
CreatedFullName = FullName ?? "System Administrator",
|
||||||
CreatedUserId = UserId ?? "",
|
CreatedUserId = UserId ?? "",
|
||||||
CreatedAt = DateTime.Now,
|
CreatedAt = DateTime.Now,
|
||||||
|
|
@ -233,7 +241,7 @@ namespace BMA.EHR.DisciplineComplaint_Appeal.Service.Controllers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesAsync();
|
||||||
return Success();
|
return Success(disciplineComplaint_Appeal.Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -408,7 +416,7 @@ namespace BMA.EHR.DisciplineComplaint_Appeal.Service.Controllers
|
||||||
await _context.DisciplineComplaint_Appeal_Historys.AddAsync(disciplineComplaint_Appeal_History);
|
await _context.DisciplineComplaint_Appeal_Historys.AddAsync(disciplineComplaint_Appeal_History);
|
||||||
}
|
}
|
||||||
data.Status = req.Status.Trim().ToUpper();
|
data.Status = req.Status.Trim().ToUpper();
|
||||||
data.Type = req.Type;
|
data.Type = req.Type.Trim().ToUpper();
|
||||||
data.Year = req.Year;
|
data.Year = req.Year;
|
||||||
data.CaseType = req.CaseType;
|
data.CaseType = req.CaseType;
|
||||||
data.CaseNumber = req.CaseNumber;
|
data.CaseNumber = req.CaseNumber;
|
||||||
|
|
@ -418,5 +426,39 @@ namespace BMA.EHR.DisciplineComplaint_Appeal.Service.Controllers
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesAsync();
|
||||||
return Success();
|
return Success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Export Report อุทธรณ์/ร้องทุกข์
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <response code="200"></response>
|
||||||
|
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||||
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
|
[HttpGet("report/{id:guid}")]
|
||||||
|
public async Task<ActionResult<ResponseObject>> ReportDiscipline(Guid id)
|
||||||
|
{
|
||||||
|
var data = await _context.DisciplineComplaint_Appeals
|
||||||
|
.Where(x => x.Id == id)
|
||||||
|
.Select(x => new
|
||||||
|
{
|
||||||
|
template = x.Type.Contains("APPEAL") ? "อุทธรณ์" : "ร้องทุกข์",
|
||||||
|
reportName = "docx-report",
|
||||||
|
data = new
|
||||||
|
{
|
||||||
|
Oc = x.Oc,
|
||||||
|
Position = x.Position,
|
||||||
|
Fullname = x.Fullname,
|
||||||
|
Title = x.Title,
|
||||||
|
Description = x.Description,
|
||||||
|
Date = DateTime.Now.ToThaiFullDate2(),
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.FirstOrDefaultAsync();
|
||||||
|
if (data == null)
|
||||||
|
return Error(new Exception(GlobalMessages.DataNotFound), StatusCodes.Status404NotFound);
|
||||||
|
|
||||||
|
return Success(data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,8 @@ namespace BMA.EHR.Discipline.Service.Requests
|
||||||
public Guid ProfileId { get; set; }
|
public Guid ProfileId { get; set; }
|
||||||
public string? CitizenId { get; set; }
|
public string? CitizenId { get; set; }
|
||||||
public string? Fullname { get; set; }
|
public string? Fullname { get; set; }
|
||||||
|
public string? Position { get; set; }
|
||||||
|
public string? Oc { get; set; }
|
||||||
public List<FormFile>? File { get; set; }
|
public List<FormFile>? File { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,12 @@ namespace BMA.EHR.Domain.Models.Discipline
|
||||||
[Comment("ชื่อ-นามสกุลผู้อุทธรณ์/ร้องทุกข์")]
|
[Comment("ชื่อ-นามสกุลผู้อุทธรณ์/ร้องทุกข์")]
|
||||||
public string? Fullname { get; set; }
|
public string? Fullname { get; set; }
|
||||||
|
|
||||||
|
[Comment("ตำแหน่งผู้อุทธรณ์/ร้องทุกข์")]
|
||||||
|
public string? Position { get; set; }
|
||||||
|
|
||||||
|
[Comment("สังกัดผู้อุทธรณ์/ร้องทุกข์")]
|
||||||
|
public string? Oc { get; set; }
|
||||||
|
|
||||||
public virtual List<DisciplineComplaint_Appeal_Doc> DisciplineComplaint_Appeal_Docs { get; set; } = new List<DisciplineComplaint_Appeal_Doc>();
|
public virtual List<DisciplineComplaint_Appeal_Doc> DisciplineComplaint_Appeal_Docs { get; set; } = new List<DisciplineComplaint_Appeal_Doc>();
|
||||||
public virtual List<DisciplineComplaint_Appeal_History> DisciplineComplaint_Appeal_Historys { get; set; } = new List<DisciplineComplaint_Appeal_History>();
|
public virtual List<DisciplineComplaint_Appeal_History> DisciplineComplaint_Appeal_Historys { get; set; } = new List<DisciplineComplaint_Appeal_History>();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
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 updatetableDisciplineComplaint_Appealsaddposition : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "Oc",
|
||||||
|
table: "DisciplineComplaint_Appeals",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "สังกัดผู้อุทธรณ์/ร้องทุกข์")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "Position",
|
||||||
|
table: "DisciplineComplaint_Appeals",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "ตำแหน่งผู้อุทธรณ์/ร้องทุกข์")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "Oc",
|
||||||
|
table: "DisciplineComplaint_Appeals");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "Position",
|
||||||
|
table: "DisciplineComplaint_Appeals");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -203,6 +203,14 @@ namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb
|
||||||
.HasColumnOrder(102)
|
.HasColumnOrder(102)
|
||||||
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
|
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
|
||||||
|
|
||||||
|
b.Property<string>("Oc")
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("สังกัดผู้อุทธรณ์/ร้องทุกข์");
|
||||||
|
|
||||||
|
b.Property<string>("Position")
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("ตำแหน่งผู้อุทธรณ์/ร้องทุกข์");
|
||||||
|
|
||||||
b.Property<Guid>("ProfileId")
|
b.Property<Guid>("ProfileId")
|
||||||
.HasColumnType("char(36)")
|
.HasColumnType("char(36)")
|
||||||
.HasComment("ProfileId");
|
.HasComment("ProfileId");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue