ระบบวินัยเพิ่มค้นหาขั้นสูง #1628, #1629, #1630, #1631
Some checks failed
release-dev / release-dev (push) Failing after 12s
Some checks failed
release-dev / release-dev (push) Failing after 12s
This commit is contained in:
parent
6b73a0aa47
commit
1b861c1a65
8 changed files with 406 additions and 0 deletions
|
|
@ -120,6 +120,99 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
|
|||
return Success(new { data, total = data_search.Count() });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// list รายการสรุปผลการพิจารณาทางวินัย (ค้นหาขั้นสูง)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <response code="200"></response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPost("advance-search")]
|
||||
public async Task<ActionResult<ResponseObject>> GetAdvanceSearcDisciplineResult([FromBody] DisciplineResultAdvanceSearcRequest req)
|
||||
{
|
||||
var getPermission = await _permission.GetPermissionAPIAsync("LIST", "SYS_DISCIPLINE_RESULT");
|
||||
var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission);
|
||||
if (jsonData["status"]?.ToString() != "200")
|
||||
{
|
||||
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
|
||||
}
|
||||
|
||||
var page = req.page <= 0 ? 1 : req.page;
|
||||
var pageSize = req.pageSize <= 0 ? 25 : req.pageSize;
|
||||
var keyword = string.IsNullOrEmpty(req.keyword) ? string.Empty : req.keyword;
|
||||
var status = string.IsNullOrEmpty(req.status) ? string.Empty : req.status;
|
||||
|
||||
var data_search = await _context.DisciplineDisciplinarys.AsQueryable()
|
||||
.Where(x => x.Title.Contains(keyword))
|
||||
.Where(x => x.Status.Contains("DONE") || x.Status.Contains("REPORT"))
|
||||
.ToListAsync();
|
||||
if (status.Trim().ToUpper() != "ALL")
|
||||
data_search = data_search.Where(x => x.Status.Contains(status.Trim().ToUpper())).ToList();
|
||||
|
||||
if (
|
||||
(req.disciplinaryDateStart.HasValue && req.disciplinaryDateEnd.HasValue) ||
|
||||
(!string.IsNullOrEmpty(req.respondentType)) ||
|
||||
(!string.IsNullOrEmpty(req.offenseDetails)) ||
|
||||
(!string.IsNullOrEmpty(req.disciplinaryFaultLevel)) ||
|
||||
(!string.IsNullOrEmpty(req.disciplinaryCaseFault)) ||
|
||||
(!string.IsNullOrEmpty(req.resultDisciplineType)) ||
|
||||
(!string.IsNullOrEmpty(req.resultTitleType)) ||
|
||||
(!string.IsNullOrEmpty(req.resultOc)) ||
|
||||
(req.resultYear.HasValue)
|
||||
)
|
||||
{
|
||||
data_search = data_search
|
||||
.Where(x =>
|
||||
(!req.disciplinaryDateStart.HasValue || !req.disciplinaryDateEnd.HasValue ||
|
||||
(x.DateReceived.HasValue &&
|
||||
x.DateReceived.Value.Date >= req.disciplinaryDateStart.Value.Date &&
|
||||
x.DateReceived.Value.Date <= req.disciplinaryDateEnd.Value.Date))
|
||||
&&
|
||||
(string.IsNullOrEmpty(req.respondentType) || x.RespondentType == req.respondentType)
|
||||
&&
|
||||
(string.IsNullOrEmpty(req.offenseDetails) || x.OffenseDetails == req.offenseDetails)
|
||||
&&
|
||||
(string.IsNullOrEmpty(req.disciplinaryFaultLevel) || x.DisciplinaryFaultLevel == req.disciplinaryFaultLevel)
|
||||
&&
|
||||
(string.IsNullOrEmpty(req.disciplinaryCaseFault) || x.DisciplinaryCaseFault.Contains(req.disciplinaryCaseFault))
|
||||
&&
|
||||
(string.IsNullOrEmpty(req.resultDisciplineType) || x.ResultDisciplineType.Contains(req.resultDisciplineType))
|
||||
&&
|
||||
(string.IsNullOrEmpty(req.resultTitleType) || x.ResultTitleType.Contains(req.resultTitleType))
|
||||
&&
|
||||
(string.IsNullOrEmpty(req.resultOc) || x.ResultOc.Contains(req.resultOc))
|
||||
&&
|
||||
(!req.resultYear.HasValue || x.ResultYear == req.resultYear)
|
||||
)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
var data = data_search
|
||||
.Select(x => new
|
||||
{
|
||||
Id = x.Id,//id ข้อมูลเรื่องสอบสวน
|
||||
Title = x.Title,//ชื่อเรื่อง
|
||||
RespondentType = x.RespondentType,//ผู้ถูกสืบสวน
|
||||
OffenseDetails = x.OffenseDetails,//ลักษณะความผิด
|
||||
DisciplinaryFaultLevel = x.DisciplinaryFaultLevel,//ระดับโทษความผิด
|
||||
DisciplinaryCaseFault = x.DisciplinaryCaseFault,//กรณีความผิด
|
||||
Status = x.Status,//สถานะหรือผลการสอบสวน
|
||||
CreatedAt = x.CreatedAt,//วันที่สร้างเรื่องสอบสวน
|
||||
DisciplinaryDateStart = x.DisciplinaryDateStart, //วันที่เริ่มการสอบสวน
|
||||
DisciplinaryDateEnd = x.DisciplinaryDateEnd, //วันที่สิ้นสุดการสอบสวน
|
||||
ResultOc = x.ResultOc,//หน่วยงาย/ส่วนราชการ
|
||||
ResultDisciplineType = x.ResultDisciplineType,//หน่วยงาย/ส่วนราชการ
|
||||
ResultTitleType = x.ResultTitleType,//ประเภทของเรื่อง
|
||||
ResultYear = x.ResultYear,//ปีงบประมาณ
|
||||
})
|
||||
.OrderByDescending(x => x.CreatedAt)
|
||||
.Skip((page - 1) * pageSize)
|
||||
.Take(pageSize)
|
||||
.ToList();
|
||||
return Success(new { data, total = data_search.Count() });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// get รายการสรุปผลการพิจารณาทางวินัย
|
||||
/// </summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue