แจ้งเตือนร้องทุกข์
This commit is contained in:
parent
a0b7be76ae
commit
b8c5f88142
11 changed files with 3533 additions and 458 deletions
|
|
@ -79,151 +79,151 @@ namespace BMA.EHR.DisciplineInvestigate.Service.Controllers
|
|||
return Success(new { data, total = data_search.Count() });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// get รายการวินัยเรื่องร้องเรียน
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpGet("complaint/{id:guid}")]
|
||||
public async Task<ActionResult<ResponseObject>> GetByDisciplineInvestigateComplaint(Guid id)
|
||||
{
|
||||
var _data = await _context.DisciplineInvestigates
|
||||
.Select(x => new
|
||||
{
|
||||
Id = x.Id,//id ข้อมูลเรื่องสืบสวน
|
||||
IdComplaint = x.DisciplineComplaint.Id,//id ข้อมูลเรื่องร้องเรียน
|
||||
RespondentType = x.RespondentType,//ผู้ถูกสืบสวน
|
||||
Persons = x.DisciplineInvestigate_ProfileComplaints.Select(p => new
|
||||
{
|
||||
Id = p.Id,
|
||||
Idcard = p.CitizenId,
|
||||
Name = $"{p.Prefix}{p.FirstName} {p.LastName}",
|
||||
Prefix = p.Prefix,
|
||||
FirstName = p.FirstName,
|
||||
LastName = p.LastName,
|
||||
Position = p.Position,
|
||||
PositionLevel = p.PositionLevel,
|
||||
Salary = p.Salary,
|
||||
PersonId = p.PersonId,
|
||||
PosNo = p.PosNo,
|
||||
Organization = p.Organization,
|
||||
IsSend = p.IsReport,
|
||||
}),//รายการข้อมูลบุคลผู้ถูกสืบสวน
|
||||
OrganizationId = x.Organization,//id หน่วยงานกรณี type เป็นหน่วยงาน
|
||||
ConsideredAgency = x.ConsideredAgency,//หน่วยงานที่พิจารณา จะเปลี่ยนไปตามผู้ถูกร้องดูรายละเอียดด้านล่าง
|
||||
Title = x.Title,//ชื่อเรื่อง
|
||||
Description = x.Description,//รายละเอียด
|
||||
DateReceived = x.DateReceived,//วันที่รับเรื่อง
|
||||
LevelConsideration = x.LevelConsideration,//ระดับการพัฒนา
|
||||
DateConsideration = x.DateConsideration,//วันที่กำหนดพิจารณา
|
||||
OffenseDetails = x.OffenseDetails,//ลักษณะความผิด
|
||||
DateNotification = x.DateNotification,//วันแจ้งเตือนล่วงหน้า
|
||||
ComplaintFrom = x.ComplaintFrom,//รับเรื่องสืบสวนจาก
|
||||
Appellant = x.Appellant,//ผู้ถูกสืบสวน
|
||||
Result = x.ResultComplaint,//ผลการตรวจสอบ
|
||||
Status = x.Status,//สถานะเรื่องสืบสวน
|
||||
DisciplineInvestigateDocComplaints = x.DisciplineInvestigate_DocComplaints.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), StatusCodes.Status404NotFound);
|
||||
// /// <summary>
|
||||
// /// get รายการวินัยเรื่องร้องเรียน
|
||||
// /// </summary>
|
||||
// /// <returns></returns>
|
||||
// /// <response code="200"></response>
|
||||
// /// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
// /// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
// /// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
// [HttpGet("complaint/{id:guid}")]
|
||||
// public async Task<ActionResult<ResponseObject>> GetByDisciplineInvestigateComplaint(Guid id)
|
||||
// {
|
||||
// var _data = await _context.DisciplineInvestigates
|
||||
// .Select(x => new
|
||||
// {
|
||||
// Id = x.Id,//id ข้อมูลเรื่องสืบสวน
|
||||
// IdComplaint = x.DisciplineComplaint.Id,//id ข้อมูลเรื่องร้องเรียน
|
||||
// RespondentType = x.RespondentType,//ผู้ถูกสืบสวน
|
||||
// Persons = x.DisciplineInvestigate_ProfileComplaints.Select(p => new
|
||||
// {
|
||||
// Id = p.Id,
|
||||
// Idcard = p.CitizenId,
|
||||
// Name = $"{p.Prefix}{p.FirstName} {p.LastName}",
|
||||
// Prefix = p.Prefix,
|
||||
// FirstName = p.FirstName,
|
||||
// LastName = p.LastName,
|
||||
// Position = p.Position,
|
||||
// PositionLevel = p.PositionLevel,
|
||||
// Salary = p.Salary,
|
||||
// PersonId = p.PersonId,
|
||||
// PosNo = p.PosNo,
|
||||
// Organization = p.Organization,
|
||||
// IsSend = p.IsReport,
|
||||
// }),//รายการข้อมูลบุคลผู้ถูกสืบสวน
|
||||
// OrganizationId = x.Organization,//id หน่วยงานกรณี type เป็นหน่วยงาน
|
||||
// ConsideredAgency = x.ConsideredAgency,//หน่วยงานที่พิจารณา จะเปลี่ยนไปตามผู้ถูกร้องดูรายละเอียดด้านล่าง
|
||||
// Title = x.Title,//ชื่อเรื่อง
|
||||
// Description = x.Description,//รายละเอียด
|
||||
// DateReceived = x.DateReceived,//วันที่รับเรื่อง
|
||||
// LevelConsideration = x.LevelConsideration,//ระดับการพัฒนา
|
||||
// DateConsideration = x.DateConsideration,//วันที่กำหนดพิจารณา
|
||||
// OffenseDetails = x.OffenseDetails,//ลักษณะความผิด
|
||||
// DateNotification = x.DateNotification,//วันแจ้งเตือนล่วงหน้า
|
||||
// ComplaintFrom = x.ComplaintFrom,//รับเรื่องสืบสวนจาก
|
||||
// Appellant = x.Appellant,//ผู้ถูกสืบสวน
|
||||
// Result = x.ResultComplaint,//ผลการตรวจสอบ
|
||||
// Status = x.Status,//สถานะเรื่องสืบสวน
|
||||
// DisciplineInvestigateDocComplaints = x.DisciplineInvestigate_DocComplaints.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), StatusCodes.Status404NotFound);
|
||||
|
||||
var disciplineInvestigateDocComplaints = new List<dynamic>();
|
||||
foreach (var doc in _data.DisciplineInvestigateDocComplaints)
|
||||
{
|
||||
var _doc = new
|
||||
{
|
||||
doc.Id,
|
||||
doc.FileName,
|
||||
PathName = await _documentService.ImagesPath(doc.Id)
|
||||
};
|
||||
disciplineInvestigateDocComplaints.Add(_doc);
|
||||
}
|
||||
var data = new
|
||||
{
|
||||
_data.Id,
|
||||
_data.IdComplaint,
|
||||
_data.RespondentType,
|
||||
_data.Persons,
|
||||
_data.OrganizationId,
|
||||
_data.ConsideredAgency,
|
||||
_data.Title,
|
||||
_data.Description,
|
||||
_data.DateReceived,
|
||||
_data.LevelConsideration,
|
||||
_data.DateConsideration,
|
||||
_data.OffenseDetails,
|
||||
_data.DateNotification,
|
||||
_data.ComplaintFrom,
|
||||
_data.Appellant,
|
||||
_data.Result,
|
||||
_data.Status,
|
||||
disciplineInvestigateDocComplaints,
|
||||
};
|
||||
return Success(data);
|
||||
}
|
||||
// var disciplineInvestigateDocComplaints = new List<dynamic>();
|
||||
// foreach (var doc in _data.DisciplineInvestigateDocComplaints)
|
||||
// {
|
||||
// var _doc = new
|
||||
// {
|
||||
// doc.Id,
|
||||
// doc.FileName,
|
||||
// PathName = await _documentService.ImagesPath(doc.Id)
|
||||
// };
|
||||
// disciplineInvestigateDocComplaints.Add(_doc);
|
||||
// }
|
||||
// var data = new
|
||||
// {
|
||||
// _data.Id,
|
||||
// _data.IdComplaint,
|
||||
// _data.RespondentType,
|
||||
// _data.Persons,
|
||||
// _data.OrganizationId,
|
||||
// _data.ConsideredAgency,
|
||||
// _data.Title,
|
||||
// _data.Description,
|
||||
// _data.DateReceived,
|
||||
// _data.LevelConsideration,
|
||||
// _data.DateConsideration,
|
||||
// _data.OffenseDetails,
|
||||
// _data.DateNotification,
|
||||
// _data.ComplaintFrom,
|
||||
// _data.Appellant,
|
||||
// _data.Result,
|
||||
// _data.Status,
|
||||
// disciplineInvestigateDocComplaints,
|
||||
// };
|
||||
// return Success(data);
|
||||
// }
|
||||
|
||||
/// <summary>
|
||||
/// แก้ไขรายการวินัยเรื่องร้องเรียน
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPut("complaint/{id:guid}")]
|
||||
public async Task<ActionResult<ResponseObject>> UpdateDisciplineInvestigateComplaint([FromBody] DisciplineInvestigateComplaintRequest req, Guid id)
|
||||
{
|
||||
var data = await _context.DisciplineInvestigates.Include(x => x.DisciplineInvestigate_ProfileComplaints).Where(x => x.Id == id).FirstOrDefaultAsync();
|
||||
if (data == null)
|
||||
return Error(new Exception(GlobalMessages.DataNotFound), StatusCodes.Status404NotFound);
|
||||
if (data.Status.Trim().ToUpper() != "NEW")
|
||||
return Error(new Exception("ไม่สามารถแก้ไขข้อมูลนี้ได้"), StatusCodes.Status500InternalServerError);
|
||||
// /// <summary>
|
||||
// /// แก้ไขรายการวินัยเรื่องร้องเรียน
|
||||
// /// </summary>
|
||||
// /// <returns></returns>
|
||||
// /// <response code="200"></response>
|
||||
// /// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
// /// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
// /// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
// [HttpPut("complaint/{id:guid}")]
|
||||
// public async Task<ActionResult<ResponseObject>> UpdateDisciplineInvestigateComplaint([FromBody] DisciplineInvestigateComplaintRequest req, Guid id)
|
||||
// {
|
||||
// var data = await _context.DisciplineInvestigates.Include(x => x.DisciplineInvestigate_ProfileComplaints).Where(x => x.Id == id).FirstOrDefaultAsync();
|
||||
// if (data == null)
|
||||
// return Error(new Exception(GlobalMessages.DataNotFound), StatusCodes.Status404NotFound);
|
||||
// if (data.Status.Trim().ToUpper() != "NEW")
|
||||
// return Error(new Exception("ไม่สามารถแก้ไขข้อมูลนี้ได้"), StatusCodes.Status500InternalServerError);
|
||||
|
||||
data.Title = req.title;
|
||||
data.Description = req.description;
|
||||
data.OffenseDetails = req.offenseDetails.Trim().ToUpper();
|
||||
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
|
||||
{
|
||||
CitizenId = item.idcard,
|
||||
Prefix = item.prefix,
|
||||
FirstName = item.firstName,
|
||||
LastName = item.lastName,
|
||||
Organization = item.organization,
|
||||
Position = item.position,
|
||||
PositionLevel = item.positionLevel,
|
||||
Salary = item.salary,
|
||||
PersonId = item.personId,
|
||||
PosNo = item.posNo,
|
||||
IsReport = isReport == null ? false : isReport.IsReport,
|
||||
CreatedFullName = FullName ?? "System Administrator",
|
||||
CreatedUserId = UserId ?? "",
|
||||
CreatedAt = DateTime.Now,
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
await _context.SaveChangesAsync();
|
||||
return Success(data.Id);
|
||||
}
|
||||
// data.Title = req.title;
|
||||
// data.Description = req.description;
|
||||
// data.OffenseDetails = req.offenseDetails.Trim().ToUpper();
|
||||
// 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
|
||||
// {
|
||||
// CitizenId = item.idcard,
|
||||
// Prefix = item.prefix,
|
||||
// FirstName = item.firstName,
|
||||
// LastName = item.lastName,
|
||||
// Organization = item.organization,
|
||||
// Position = item.position,
|
||||
// PositionLevel = item.positionLevel,
|
||||
// Salary = item.salary,
|
||||
// PersonId = item.personId,
|
||||
// PosNo = item.posNo,
|
||||
// IsReport = isReport == null ? false : isReport.IsReport,
|
||||
// CreatedFullName = FullName ?? "System Administrator",
|
||||
// CreatedUserId = UserId ?? "",
|
||||
// CreatedAt = DateTime.Now,
|
||||
// LastUpdateFullName = FullName ?? "System Administrator",
|
||||
// LastUpdateUserId = UserId ?? "",
|
||||
// LastUpdatedAt = DateTime.Now,
|
||||
// }
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
// await _context.SaveChangesAsync();
|
||||
// return Success(data.Id);
|
||||
// }
|
||||
|
||||
/// <summary>
|
||||
/// get รายการวินัยเรื่องสืบสวน
|
||||
|
|
@ -269,7 +269,7 @@ namespace BMA.EHR.DisciplineInvestigate.Service.Controllers
|
|||
LastName = d.DisciplineDirector.LastName,
|
||||
Position = d.DisciplineDirector.Position,
|
||||
Email = d.DisciplineDirector.Email,
|
||||
Duty = "",
|
||||
Duty = d.Duty,
|
||||
Phone = d.DisciplineDirector.Phone,
|
||||
// Total = d.DisciplineDirector.DisciplineInvestigate_Directors.Count(),
|
||||
}).ToList(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue