diff --git a/BMA.EHR.Application/Repositories/InsigniaPeriodsRepository.cs b/BMA.EHR.Application/Repositories/InsigniaPeriodsRepository.cs
index b126d408..00708c0c 100644
--- a/BMA.EHR.Application/Repositories/InsigniaPeriodsRepository.cs
+++ b/BMA.EHR.Application/Repositories/InsigniaPeriodsRepository.cs
@@ -5738,9 +5738,9 @@ namespace BMA.EHR.Application.Repositories
ProfileId = h.Profile.Id,
ProfileType = h.Profile.ProfileType,
FullName = $"{h.Profile.Prefix?.Name}{h.Profile.FirstName} {h.Profile.LastName}",
- Position = h.Profile.ProfileType == " officer" ? h.Profile.Position?.Name : h.Profile.PositionEmployeePosition?.Name,
- PosNo = h.Profile.ProfileType == " officer" ? h.Profile.PosNo?.Name : h.Profile.PosNoEmployee,
- Rank = h.Profile.ProfileType == " officer" ? $"{h.Profile.PositionType?.Name}/{h.Profile.PositionLevel?.Name}" : $"-",
+ Position = h.Profile.ProfileType == "officer" ? h.Profile.Position?.Name : h.Profile.PositionEmployeePosition?.Name,
+ PosNo = h.Profile.ProfileType == "officer" ? h.Profile.PosNo?.Name : h.Profile.PosNoEmployee,
+ Rank = h.Profile.ProfileType == "officer" ? $"{h.Profile.PositionType?.Name}/{h.Profile.PositionLevel?.Name}" : $"-",
Salary = h.Salary.ToString(),
LastInsignia = h.Profile.Insignias.Count == 0 ? "" : h.Profile.Insignias.OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name,
RequestInsignia = h.RequestInsignia.Name,
diff --git a/BMA.EHR.Application/Requests/InsigniaRequestItem.cs b/BMA.EHR.Application/Requests/InsigniaRequestItem.cs
index 9a0d44e4..ab0252e7 100644
--- a/BMA.EHR.Application/Requests/InsigniaRequestItem.cs
+++ b/BMA.EHR.Application/Requests/InsigniaRequestItem.cs
@@ -7,7 +7,7 @@
public string? ProfileType { get; set; }
public Guid ProfileId { get; set; }
public string FullName { get; set; }
- public string Position { get; set; }
+ public dynamic Position { get; set; }
public string PosNo { get; set; }
public string Rank { get; set; }
public string Salary { get; set; }
diff --git a/BMA.EHR.Domain/Shared/GlobalMessages.cs b/BMA.EHR.Domain/Shared/GlobalMessages.cs
index 2678c379..4267f231 100644
--- a/BMA.EHR.Domain/Shared/GlobalMessages.cs
+++ b/BMA.EHR.Domain/Shared/GlobalMessages.cs
@@ -89,6 +89,7 @@
public static readonly string OCNotFound = "ไม่พบหน่วยงานที่ระบุในระบบ";
public static readonly string InsigniaManageOrgLimit = "จำนวนการจัดสรรเครื่องราชฯ หน่วยงานเกินจำนวน";
public static readonly string InsigniaBorrowOrgLimit = "จำนวนการจัดสรรเครื่องราชฯ หน่วยงานเกินจำนวนของหน่วยงานที่ได้รับ";
+ public static readonly string InsigniaNoBorrow = "ไม่สามารถยืมเครื่องราชฯ นี้ได้เนื่องจากสถานะรอการบันทึกข้อมูล";
public static readonly string InsigniaBorrowNotFound = "ไม่พบรายการยืมเครื่องราชฯ";
public static readonly string InsigniaNotReturn = "รายการยืมเครื่องราชนี้ได้ทำการยืมไว้แล้ว";
#endregion
diff --git a/BMA.EHR.Insignia.Service/Controllers/InsigniaManageController.cs b/BMA.EHR.Insignia.Service/Controllers/InsigniaManageController.cs
index c793201e..8fc7fba3 100644
--- a/BMA.EHR.Insignia.Service/Controllers/InsigniaManageController.cs
+++ b/BMA.EHR.Insignia.Service/Controllers/InsigniaManageController.cs
@@ -420,6 +420,8 @@ namespace BMA.EHR.Insignia.Service.Controllers
.FirstOrDefaultAsync(x => x.Id == req.InsigniaNoteProfileId);
if (insigniaNoteProfile == null)
return Error(GlobalMessages.InsigniaRequestProfileNotFound);
+ if (insigniaNoteProfile.Status != "DONE")
+ return Error(GlobalMessages.InsigniaNoBorrow);
var insigniaManage = await _context.InsigniaManages.AsQueryable()
.FirstOrDefaultAsync(x => x.Year == insigniaNoteProfile.InsigniaNote.Year && x.Insignia == insigniaNoteProfile.RequestInsignia);
@@ -433,7 +435,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
return Error(GlobalMessages.InsigniaManageOrgNotFound);
var insigniaManageProfile = await _context.InsigniaManageProfiles.AsQueryable()
- .FirstOrDefaultAsync(x => x.InsigniaNoteProfile == insigniaNoteProfile && x.InsigniaManageOrganiation == insigniaManageOrganiation && x.Status == false);
+ .FirstOrDefaultAsync(x => x.InsigniaNoteProfile == insigniaNoteProfile && x.Status == false);
if (insigniaManageProfile != null)
return Error(GlobalMessages.InsigniaNotReturn);
diff --git a/BMA.EHR.Insignia.Service/appsettings.json b/BMA.EHR.Insignia.Service/appsettings.json
index 952a70c0..85a25b5c 100644
--- a/BMA.EHR.Insignia.Service/appsettings.json
+++ b/BMA.EHR.Insignia.Service/appsettings.json
@@ -18,7 +18,7 @@
},
"Jwt": {
"Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI",
- "Issuer": "https://identity.frappet.com/realms/bma-ehr"
+ "Issuer": "https://id.frappet.synology.me/realms/bma-ehr"
},
"EPPlus": {
"ExcelPackage": {
diff --git a/BMA.EHR.Insignia.Service/wwwroot/keycloak.json b/BMA.EHR.Insignia.Service/wwwroot/keycloak.json
index 9eba3b39..a023eb38 100644
--- a/BMA.EHR.Insignia.Service/wwwroot/keycloak.json
+++ b/BMA.EHR.Insignia.Service/wwwroot/keycloak.json
@@ -1,6 +1,6 @@
{
"realm": "bma-ehr",
- "auth-server-url": "https://identity.frappet.com",
+ "auth-server-url": "https://id.frappet.synology.me",
"ssl-required": "external",
"resource": "bma-ehr",
"public-client": true
diff --git a/BMA.EHR.Report.Service/Controllers/DeceasedReportController.cs b/BMA.EHR.Report.Service/Controllers/DeceasedReportController.cs
index 71aa2855..9d7fb5e1 100644
--- a/BMA.EHR.Report.Service/Controllers/DeceasedReportController.cs
+++ b/BMA.EHR.Report.Service/Controllers/DeceasedReportController.cs
@@ -123,6 +123,75 @@ namespace BMA.EHR.Report.Service.Controllers
}
}
+ ///
+ /// 36-บันทึกเวียนแจ้งการถึงแก่กรรม
+ ///
+ /// Id รายการบันทึกเวียนแจ้งการถึงแก่กรรม
+ /// pdf, docx หรือ xlsx
+ ///
+ /// เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ
+ /// ไม่ได้ Login เข้าระบบ
+ /// เมื่อเกิดข้อผิดพลาดในการทำงาน
+ [HttpGet("copy/36/{exportType}/{id}")]
+ public async Task> GetDeceasedReportCopyAsync(Guid id, string exportType = "pdf")
+ {
+ try
+ {
+ var head = await _repository.GetHeadRetirementDeceasedAsync(id);
+ var data = await _repository.GetRetirementDeceasedAsync(id);
+ if (data != null || head != null)
+ {
+ var mergeData = new
+ {
+ Oc = head.GetType().GetProperty("Oc").GetValue(head),
+ Number = head.GetType().GetProperty("Number").GetValue(head),
+ Date = head.GetType().GetProperty("Date").GetValue(head),
+ Subject = head.GetType().GetProperty("Subject").GetValue(head),
+ Send = head.GetType().GetProperty("Send").GetValue(head),
+ FullName = data.GetType().GetProperty("FullName").GetValue(data),
+ Position = data.GetType().GetProperty("Position").GetValue(data),
+ Reason = data.GetType().GetProperty("Reason").GetValue(data),
+ DeceasedDate = data.GetType().GetProperty("Date").GetValue(data),
+ CurrentDate = data.GetType().GetProperty("CurrentDate").GetValue(data),
+ DeceasedNumber = data.GetType().GetProperty("Number").GetValue(data),
+ Location = data.GetType().GetProperty("Location").GetValue(data),
+ };
+ var mimeType = "";
+ switch (exportType.Trim().ToLower())
+ {
+ case "pdf": mimeType = "application/pdf"; break;
+ case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
+ case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
+ }
+
+ var rptFile = System.IO.Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"36-บันทึกเวียนแจ้งการถึงแก่กรรม.trdp");
+ ReportPackager reportPacker = new ReportPackager();
+ Telerik.Reporting.Report? report = null;
+ using (var sourceStream = System.IO.File.OpenRead(rptFile))
+ {
+ report = (Telerik.Reporting.Report)reportPacker.UnpackageDocument(sourceStream);
+ }
+ report.DataSource = mergeData;
+ System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
+ InstanceReportSource instanceReportSource = new InstanceReportSource()
+ {
+ ReportDocument = report,
+ };
+ ReportProcessor reportProcessor = new ReportProcessor(_configuration);
+ RenderingResult result = reportProcessor.RenderReport($"{exportType}", instanceReportSource, deviceInfo);
+ return File(result.DocumentBytes, mimeType, $"รายละเอียดบันทึกเวียนแจ้งการถึงแก่กรรม.{exportType.Trim().ToLower()}");
+ }
+ else
+ {
+ return NotFound();
+ }
+ }
+ catch
+ {
+ throw;
+ }
+ }
+
///
/// อัปไฟล์บันทึกเวียนแจ้งการถึงแก่กรรม
///
diff --git a/BMA.EHR.Retirement.Service/Controllers/RetirementDeceasedController.cs b/BMA.EHR.Retirement.Service/Controllers/RetirementDeceasedController.cs
index 9b73dce3..e1e5eaad 100644
--- a/BMA.EHR.Retirement.Service/Controllers/RetirementDeceasedController.cs
+++ b/BMA.EHR.Retirement.Service/Controllers/RetirementDeceasedController.cs
@@ -551,7 +551,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
payload_attach.Add(new PayloadAttachment
{
name = "หนังสือเวียนถึงแก่กรรม",
- url = $"{_configuration["API"]}/order/download/attachment/{retirementDeceased.DocumentForward.Id}"
+ url = $"{_configuration["API"]}/copy/36/pdf/{retirementDeceased.Id}"
});
var payload = new CommandPayload()
diff --git a/BMA.EHR.Retirement.Service/Requests/RetirementDeceasedAddNotiPersonRequest.cs b/BMA.EHR.Retirement.Service/Requests/RetirementDeceasedAddNotiPersonRequest.cs
index e087ce7c..ad996306 100644
--- a/BMA.EHR.Retirement.Service/Requests/RetirementDeceasedAddNotiPersonRequest.cs
+++ b/BMA.EHR.Retirement.Service/Requests/RetirementDeceasedAddNotiPersonRequest.cs
@@ -10,8 +10,8 @@ namespace BMA.EHR.Retirement.Service.Requests
public class RetirementDeceasedAddNotiPerson
{
public Guid ProfileId { get; set; }
- public bool IsSendMail { get; set; }
- public bool IsSendInbox { get; set; }
- public bool IsSendNotification { get; set; }
+ public bool IsSendMail { get; set; } = true;
+ public bool IsSendInbox { get; set; } = true;
+ public bool IsSendNotification { get; set; } = true;
}
}