แก้ บันทึกวันที่สร้าง บันทึกค่าผิดฟิว
This commit is contained in:
parent
a886825bb1
commit
42b1ae87fa
26 changed files with 252 additions and 136 deletions
|
|
@ -12,6 +12,9 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Hangfire" Version="1.8.5" />
|
||||
<PackageReference Include="Hangfire.AspNetCore" Version="1.8.5" />
|
||||
<PackageReference Include="Hangfire.MySqlStorage" Version="2.0.3" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="7.0.9" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="7.0.9" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning" Version="5.1.0" />
|
||||
|
|
|
|||
|
|
@ -146,8 +146,8 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
Insignia = insignia,
|
||||
Year = req.Year,
|
||||
Total = req.Total,
|
||||
CreatedUserId = FullName ?? "",
|
||||
CreatedFullName = UserId ?? "System Administrator",
|
||||
CreatedUserId = UserId ?? "System Administrator",
|
||||
CreatedFullName = FullName ?? "",
|
||||
CreatedAt = DateTime.Now,
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
|
|
@ -291,8 +291,8 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
OrganizationOrganization = organization.OrganizationOrganization,
|
||||
Total = req.Total,
|
||||
InsigniaManage = insigniaManage,
|
||||
CreatedUserId = FullName ?? "",
|
||||
CreatedFullName = UserId ?? "System Administrator",
|
||||
CreatedUserId = UserId ?? "System Administrator",
|
||||
CreatedFullName = FullName ?? "",
|
||||
CreatedAt = DateTime.Now,
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
|
|
@ -448,8 +448,8 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
BorrowOrganization = organization.OrganizationOrganization,
|
||||
BorrowDate = req.BorrowDate,
|
||||
InsigniaNoteProfile = insigniaNoteProfile,
|
||||
CreatedUserId = FullName ?? "",
|
||||
CreatedFullName = UserId ?? "System Administrator",
|
||||
CreatedUserId = UserId ?? "System Administrator",
|
||||
CreatedFullName = FullName ?? "",
|
||||
CreatedAt = DateTime.Now,
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
|
|
|
|||
|
|
@ -180,8 +180,8 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
EndDate = req.EndDate,
|
||||
Amount = req.Amount,
|
||||
IsActive = true,
|
||||
CreatedUserId = FullName ?? "",
|
||||
CreatedFullName = UserId ?? "System Administrator",
|
||||
CreatedUserId = UserId ?? "System Administrator",
|
||||
CreatedFullName = FullName ?? "",
|
||||
CreatedAt = DateTime.Now,
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
|
|
@ -290,5 +290,22 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
|
||||
return Success();
|
||||
}
|
||||
|
||||
public async Task NotifyInsignia()
|
||||
{
|
||||
var insigniaPeriods = await _context.InsigniaPeriods.AsQueryable()
|
||||
.ToListAsync();
|
||||
foreach (var insigniaPeriod in insigniaPeriods)
|
||||
{
|
||||
if (insigniaPeriod.StartDate.AddDays(-insigniaPeriod.Amount).Date == DateTime.Now.Date)
|
||||
{
|
||||
await _repositoryNoti.PushNotificationAsync(
|
||||
Guid.Parse("08db721d-ae67-4ed1-8b3c-490f44a73e65"),
|
||||
$"แจ้งเตือนรอบการเสนอขอ {insigniaPeriod.Name} รอบที่{insigniaPeriod.Round}",
|
||||
$"แจ้งเตือนรอบการเสนอขอ {insigniaPeriod.Name} รอบที่{insigniaPeriod.Round}"
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -976,8 +976,8 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
Organization = org,
|
||||
RequestStatus = "st1",
|
||||
RequestNote = "",
|
||||
CreatedUserId = FullName ?? "",
|
||||
CreatedFullName = UserId ?? "System Administrator",
|
||||
CreatedUserId = UserId ?? "System Administrator",
|
||||
CreatedFullName = FullName ?? "",
|
||||
CreatedAt = DateTime.Now,
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
|
|
@ -993,8 +993,8 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
Request = insigniaRequest,
|
||||
RequestDate = DateTime.Now,
|
||||
MatchingConditions = System.Text.Json.JsonSerializer.Serialize(new List<dynamic>()), // serialize to string
|
||||
CreatedUserId = FullName ?? "",
|
||||
CreatedFullName = UserId ?? "System Administrator",
|
||||
CreatedUserId = UserId ?? "System Administrator",
|
||||
CreatedFullName = FullName ?? "",
|
||||
CreatedAt = DateTime.Now,
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
|
|
@ -1067,8 +1067,8 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
// EndDate = insigniaPeriod.EndDate,
|
||||
// Amount = insigniaPeriod.Amount,
|
||||
// ReliefDoc = insigniaPeriod.ReliefDoc,
|
||||
CreatedUserId = FullName ?? "",
|
||||
CreatedFullName = UserId ?? "System Administrator",
|
||||
CreatedUserId = UserId ?? "System Administrator",
|
||||
CreatedFullName = FullName ?? "",
|
||||
CreatedAt = DateTime.Now,
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
|
|
@ -1108,8 +1108,8 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
noreProfileOld.Salary = profileOld.Salary;
|
||||
noreProfileOld.IsApprove = profileOld.IsApprove;
|
||||
noreProfileOld.RequestInsignia = profileOld.RequestInsignia;
|
||||
noreProfileOld.CreatedUserId = FullName ?? "";
|
||||
noreProfileOld.CreatedFullName = UserId ?? "System Administrator";
|
||||
noreProfileOld.CreatedUserId = UserId ?? "System Administrator";
|
||||
noreProfileOld.CreatedFullName = FullName ?? "";
|
||||
noreProfileOld.CreatedAt = DateTime.Now;
|
||||
noreProfileOld.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
noreProfileOld.LastUpdateUserId = UserId ?? "";
|
||||
|
|
@ -1129,8 +1129,8 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
RequestInsignia = profileOld.RequestInsignia,
|
||||
OrganizationOrganizationSend = profileOld.Profile == null || profileOld.Profile.OcId == null ? null : FindOCFullPath(profileOld.Profile.OcId.Value, true),
|
||||
InsigniaNote = insigniaNote,
|
||||
CreatedUserId = FullName ?? "",
|
||||
CreatedFullName = UserId ?? "System Administrator",
|
||||
CreatedUserId = UserId ?? "System Administrator",
|
||||
CreatedFullName = FullName ?? "",
|
||||
CreatedAt = DateTime.Now,
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
|
|
@ -1424,8 +1424,8 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
OrganizationOrganizationReceive = req.OrganizationOrganizationReceive,
|
||||
OrganizationOrganizationSend = req.OrganizationOrganizationSend,
|
||||
InsigniaNote = insigniaNote,
|
||||
CreatedUserId = FullName ?? "",
|
||||
CreatedFullName = UserId ?? "System Administrator",
|
||||
CreatedUserId = UserId ?? "System Administrator",
|
||||
CreatedFullName = FullName ?? "",
|
||||
CreatedAt = DateTime.Now,
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
|
|
@ -1450,8 +1450,8 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
// RefCommandNo = req.RefCommandNo,
|
||||
// RefCommandDate = req.RefCommandDate,
|
||||
Profile = profile,
|
||||
CreatedUserId = FullName ?? "",
|
||||
CreatedFullName = UserId ?? "System Administrator",
|
||||
CreatedUserId = UserId ?? "System Administrator",
|
||||
CreatedFullName = FullName ?? "",
|
||||
CreatedAt = DateTime.Now,
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
|
|
@ -1498,8 +1498,8 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
// RefCommandNo = req.RefCommandNo,
|
||||
// RefCommandDate = req.RefCommandDate,
|
||||
Profile = profile,
|
||||
CreatedUserId = FullName ?? "",
|
||||
CreatedFullName = UserId ?? "System Administrator",
|
||||
CreatedUserId = UserId ?? "System Administrator",
|
||||
CreatedFullName = FullName ?? "",
|
||||
CreatedAt = DateTime.Now,
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
|
|
@ -1545,8 +1545,8 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
Reason = req.Reason,
|
||||
Document = _doc,
|
||||
InsigniaNote = insigniaNote,
|
||||
CreatedUserId = FullName ?? "",
|
||||
CreatedFullName = UserId ?? "System Administrator",
|
||||
CreatedUserId = UserId ?? "System Administrator",
|
||||
CreatedFullName = FullName ?? "",
|
||||
CreatedAt = DateTime.Now,
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
|
|
@ -1701,8 +1701,8 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
// RefCommandNo = req.RefCommandNo,
|
||||
// RefCommandDate = req.RefCommandDate,
|
||||
Profile = profile.Profile,
|
||||
CreatedUserId = FullName ?? "",
|
||||
CreatedFullName = UserId ?? "System Administrator",
|
||||
CreatedUserId = UserId ?? "System Administrator",
|
||||
CreatedFullName = FullName ?? "",
|
||||
CreatedAt = DateTime.Now,
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
|
|
|
|||
|
|
@ -3,6 +3,9 @@ using BMA.EHR.Domain.Middlewares;
|
|||
using BMA.EHR.Infrastructure;
|
||||
using BMA.EHR.Infrastructure.Persistence;
|
||||
using BMA.EHR.Insignia.Service;
|
||||
using BMA.EHR.Insignia.Service.Controllers;
|
||||
using Hangfire;
|
||||
using Hangfire.Common;
|
||||
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.ApiExplorer;
|
||||
|
|
@ -120,6 +123,11 @@ var app = builder.Build();
|
|||
app.UseStaticFiles();
|
||||
app.MapControllers();
|
||||
app.UseMiddleware<ErrorHandlerMiddleware>();
|
||||
var manager = new RecurringJobManager();
|
||||
if (manager != null)
|
||||
{
|
||||
manager.AddOrUpdate("SendNotifyFirstRound", Job.FromExpression<InsigniaPeriodController>(x => x.NotifyInsignia()), Cron.Daily(Int32.Parse(builder.Configuration["KeycloakCron:Hour"]), Int32.Parse(builder.Configuration["KeycloakCron:Minute"])), TimeZoneInfo.Local);
|
||||
}
|
||||
|
||||
// apply migrations
|
||||
await using var scope = app.Services.CreateAsyncScope();
|
||||
|
|
|
|||
77
BMA.EHR.Insignia.Service/Services/NotifyService.cs
Normal file
77
BMA.EHR.Insignia.Service/Services/NotifyService.cs
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
// using System.Net.Http.Headers;
|
||||
// using BMA.EHR.Domain.Extensions;
|
||||
// using Microsoft.EntityFrameworkCore;
|
||||
// using Newtonsoft.Json;
|
||||
|
||||
// namespace BMA.EHR.Insignia.Service.Services
|
||||
// {
|
||||
// public class NotifyService
|
||||
// {
|
||||
// private readonly ApplicationDbContext _context;
|
||||
// private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
// private readonly IConfiguration _configuration;
|
||||
// private readonly AppointmentService _serviceAppoint;
|
||||
// private readonly AppointmentReserveLineService _serviceAppointRe;
|
||||
// public NotifyService(ApplicationDbContext context, IHttpContextAccessor httpContextAccessor, IConfiguration configuration, AppointmentService serviceAppoint, AppointmentReserveLineService serviceAppointRe) : base(httpContextAccessor)
|
||||
// {
|
||||
// _context = context;
|
||||
// _httpContextAccessor = httpContextAccessor;
|
||||
// _configuration = configuration;
|
||||
// _serviceAppoint = serviceAppoint;
|
||||
// _serviceAppointRe = serviceAppointRe;
|
||||
// }
|
||||
// public async Task<dynamic> notiAppointments()
|
||||
// {
|
||||
// Console.WriteLine("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
|
||||
// var data = await _context.Tb15AppointmentReserve.Where(x => x.AppointDate.ToDateTime(x.AppointTimeStart).Date == DateTime.Now.AddDays(1).Date).ToListAsync();
|
||||
// foreach (var _data in data)
|
||||
// {
|
||||
// var message = new
|
||||
// {
|
||||
// type = "text",
|
||||
// text = $"เรียน อาสาสมัคร\n พรุ่งนี้ท่านมีนัดกับโครงการศิริราชวันเฮลท์ที่ ชั้น 1 ตึกศูนย์วิจัยการแพทย์ศิริราช (SiMR) โครงการดำเนินการ เวลา {(_data.AppointDate).ToDateTime(_data.AppointTimeStart).ToShortTimeString()} - {(_data.AppointDate).ToDateTime(_data.AppointTimeEnd).ToShortTimeString()} น. ขอความกรุณา ดังนี้\n 1. 'ไม่ต้องงด' อาหารและเครื่องดื่ม\nท่านจะได้รับการตรวจน้ำตาลสะสม (A1C) และอื่น ๆ ตามปกติ ยกเว้น น้ำตาลในเลือดและอินซูลิน\n 2. ทำแบบสอบถาม ที่แถบเมนู “ทำแบบสอบถาม” ให้ครบ\n 3. แจ้งชื่อ-นามสกุล ณ จุดลงทะเบียน และแจ้งสถานะการเข้าร่วมโครงการจีโนมิกส์ประเทศไทย (จากรูปที่แคปไว้)\n 4. ดำเนินกิจกรรมทั้งหมด 6 ฐาน\n*เนื่องจากมีการวัดองค์ประกอบร่างกายด้วยเครื่อง BIA รบกวนหลีกเลี่ยงการใส่เครื่องประดับที่มีโลหะ\n\nหลังวันนัด\n 1. อาสาสมัครที่ผ่านเกณฑ์การตรวจอุจจาระ เจ้าหน้าที่จะติดต่อเพื่อนัดรับอุปกรณ์อีกครั้ง\n 2. เจ้าหน้าที่จะแจ้งผลตรวจตามที่อาสาสมัครตรวจจริงภายใน 2-3 เดือน"
|
||||
// };
|
||||
// if (_data.AppointTimeStart == TimeOnly.Parse("08:00"))
|
||||
// {
|
||||
// message = new
|
||||
// {
|
||||
// type = "text",
|
||||
// text = $"เรียน อาสาสมัคร\n พรุ่งนี้ท่านมีนัดกับโครงการศิริราชวันเฮลท์ที่ ชั้น 1 ตึกศูนย์วิจัยการแพทย์ศิริราช (SiMR) โครงการดำเนินการ เวลา {(_data.AppointDate).ToDateTime(_data.AppointTimeStart).ToShortTimeString()} - {(_data.AppointDate).ToDateTime(_data.AppointTimeEnd).ToShortTimeString()} น. ขอความกรุณา ดังนี้\n 1. งดอาหารและเครื่องดื่ม ยกเว้นน้ำเปล่า หลังเที่ยงคืน (หากท่านไม่สะดวกงดอาหาร ท่านจะไม่ได้รับการตรวจน้ำตาลในเลือดและอินซูลิน)\n 2. ทำแบบสอบถาม ที่แถบเมนู “ทำแบบสอบถาม” ให้ครบ\n 3. แจ้งชื่อ-นามสกุล ณ จุดลงทะเบียน และแจ้งสถานะการเข้าร่วมโครงการจีโนมิกส์ประเทศไทย (จากรูปที่แคปไว้)\n 4. ดำเนินกิจกรรมทั้งหมด 6 ฐาน\n*เนื่องจากมีการวัดองค์ประกอบร่างกายด้วยเครื่อง BIA รบกวนหลีกเลี่ยงการใส่เครื่องประดับที่มีโลหะ\n\nหลังวันนัด\n 1. อาสาสมัครที่ผ่านเกณฑ์การตรวจอุจจาระ เจ้าหน้าที่จะติดต่อเพื่อนัดรับอุปกรณ์อีกครั้ง\n 2. เจ้าหน้าที่จะแจ้งผลตรวจตามที่อาสาสมัครตรวจจริงภายใน 2-3 เดือน"
|
||||
// };
|
||||
// }
|
||||
// else if (_data.AppointTimeStart == TimeOnly.Parse("09:00"))
|
||||
// {
|
||||
// message = new
|
||||
// {
|
||||
// type = "text",
|
||||
// text = $"เรียน อาสาสมัคร\n พรุ่งนี้ท่านมีนัดกับโครงการศิริราชวันเฮลท์ที่ ชั้น 1 ตึกศูนย์วิจัยการแพทย์ศิริราช (SiMR) โครงการดำเนินการ เวลา {(_data.AppointDate).ToDateTime(_data.AppointTimeStart).ToShortTimeString()} - {(_data.AppointDate).ToDateTime(_data.AppointTimeEnd).ToShortTimeString()} น. ขอความกรุณา ดังนี้\n 1. 'ไม่ต้องงด' อาหารและเครื่องดื่ม\nท่านจะได้รับการตรวจน้ำตาลสะสม (A1C) และอื่น ๆ ตามปกติ ยกเว้น น้ำตาลในเลือดและอินซูลิน\n 2. ทำแบบสอบถาม ที่แถบเมนู “ทำแบบสอบถาม” ให้ครบ\n 3. แจ้งชื่อ-นามสกุล ณ จุดลงทะเบียน และแจ้งสถานะการเข้าร่วมโครงการจีโนมิกส์ประเทศไทย (จากรูปที่แคปไว้)\n 4. ดำเนินกิจกรรมทั้งหมด 6 ฐาน\n*เนื่องจากมีการวัดองค์ประกอบร่างกายด้วยเครื่อง BIA รบกวนหลีกเลี่ยงการใส่เครื่องประดับที่มีโลหะ\n\nหลังวันนัด\n 1. อาสาสมัครที่ผ่านเกณฑ์การตรวจอุจจาระ เจ้าหน้าที่จะติดต่อเพื่อนัดรับอุปกรณ์อีกครั้ง\n 2. เจ้าหน้าที่จะแจ้งผลตรวจตามที่อาสาสมัครตรวจจริงภายใน 2-3 เดือน"
|
||||
// };
|
||||
// }
|
||||
// Object[] messageArray = new Object[] { message };
|
||||
|
||||
// var profile = await _context.Tb1Profile.FirstOrDefaultAsync(x => x.UserId == _data.UserId);
|
||||
// if (profile != null && profile.LineId != null)
|
||||
// {
|
||||
// var result = new
|
||||
// {
|
||||
// to = profile.LineId,
|
||||
// messages = messageArray
|
||||
// };
|
||||
// using (var client = new HttpClient())
|
||||
// {
|
||||
// var json = JsonConvert.SerializeObject(result);
|
||||
// var _result = new StringContent(json, null, "application/json");
|
||||
// var url = "https://api.line.me/v2/bot/message/push";
|
||||
// // //HTTP POST
|
||||
// client.DefaultRequestHeaders.Authorization
|
||||
// = new AuthenticationHeaderValue("Bearer", _configuration["ACCESS_TOKEN"]);
|
||||
// var responseTask = client.PostAsync(url, _result);
|
||||
// var results = responseTask.Result;
|
||||
// // Console.WriteLine(results.Content.ReadAsStringAsync().Result);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return data;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
|
@ -31,5 +31,9 @@
|
|||
"SecretKey": "FPTadmin2357",
|
||||
"BucketName": "bma-ehr-fpt"
|
||||
},
|
||||
"KeycloakCron": {
|
||||
"Hour": "15",
|
||||
"Minute": "00"
|
||||
},
|
||||
"Protocol": "HTTPS"
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue