noti หนังสือเวียน
This commit is contained in:
parent
390eb7296b
commit
d96ad94299
12 changed files with 16809 additions and 7 deletions
87
.github/workflows/release_Retirement.yaml
vendored
Normal file
87
.github/workflows/release_Retirement.yaml
vendored
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
name: release-dev
|
||||
run-name: release-dev ${{ github.actor }}
|
||||
on:
|
||||
# push:
|
||||
# tags:
|
||||
# - 'v[0-9]+.[0-9]+.[0-9]+'
|
||||
# tags-ignore:
|
||||
# - '2.*'
|
||||
# Allow run workflow manually from Action tab
|
||||
workflow_dispatch:
|
||||
env:
|
||||
REGISTRY: docker.frappet.com
|
||||
IMAGE_NAME: ehr/bma-ehr-retirement-service
|
||||
DEPLOY_HOST: frappet.com
|
||||
COMPOSE_PATH: /home/frappet/docker/bma-ehr-retirement
|
||||
TOKEN_LINE: uxuK5hDzS2DsoC5piJBrWRLiz8GgY7iMZZldOWsDDF0
|
||||
|
||||
jobs:
|
||||
# act workflow_dispatch -W .github/workflows/release_retirement.yaml --input IMAGE_VER=test-v6.1 -s DOCKER_USER=sorawit -s DOCKER_PASS=P@ssword -s SSH_PASSWORD=P@ssw0rd
|
||||
release-dev:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
# skip Set up QEMU because it fail on act and container
|
||||
- name: Gen Version
|
||||
id: gen_ver
|
||||
run: |
|
||||
if [[ $GITHUB_REF == 'refs/tags/'* ]]; then
|
||||
IMAGE_VER='${GITHUB_REF/refs\/tags\//}'
|
||||
else
|
||||
IMAGE_VER=${{ github.event.inputs.IMAGE_VER }}
|
||||
fi
|
||||
if [[ $IMAGE_VER == '' ]]; then
|
||||
IMAGE_VER='test-vBeta'
|
||||
fi
|
||||
echo '::set-output name=image_ver::'$IMAGE_VER
|
||||
- name: Test Version
|
||||
run: |
|
||||
echo $GITHUB_REF
|
||||
echo ${{ steps.gen_ver.outputs.image_ver }}
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
- name: Login in to registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ${{env.REGISTRY}}
|
||||
username: ${{secrets.DOCKER_USER}}
|
||||
password: ${{secrets.DOCKER_PASS}}
|
||||
- name: Build and load local docker image
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64
|
||||
file: BMA.EHR.Retirement.Service/Dockerfile
|
||||
push: true
|
||||
tags: ${{env.REGISTRY}}/${{env.IMAGE_NAME}}:${{ steps.gen_ver.outputs.image_ver }},${{env.REGISTRY}}/${{env.IMAGE_NAME}}:latest
|
||||
|
||||
- name: Reload docker compose
|
||||
uses: appleboy/ssh-action@v0.1.8
|
||||
with:
|
||||
host: ${{env.DEPLOY_HOST}}
|
||||
username: frappet
|
||||
password: ${{ secrets.SSH_PASSWORD }}
|
||||
port: 22
|
||||
script: |
|
||||
cd "${{env.COMPOSE_PATH}}"
|
||||
docker-compose pull
|
||||
docker-compose up -d
|
||||
echo "${{ steps.gen_ver.outputs.image_ver }}"> success
|
||||
- uses: snow-actions/line-notify@v1.1.0
|
||||
if: success()
|
||||
with:
|
||||
access_token: ${{ env.TOKEN_LINE }}
|
||||
message: |
|
||||
-Success✅✅✅
|
||||
Image: ${{env.IMAGE_NAME}}
|
||||
Version: ${{ github.event.inputs.IMAGE_VER }}
|
||||
By: ${{secrets.DOCKER_USER}}
|
||||
- uses: snow-actions/line-notify@v1.1.0
|
||||
if: failure()
|
||||
with:
|
||||
access_token: ${{ env.TOKEN_LINE }}
|
||||
message: |
|
||||
-Failure❌❌❌
|
||||
Image: ${{env.IMAGE_NAME}}
|
||||
Version: ${{ github.event.inputs.IMAGE_VER }}
|
||||
By: ${{secrets.DOCKER_USER}}
|
||||
87
.github/workflows/release_insignia.yaml
vendored
Normal file
87
.github/workflows/release_insignia.yaml
vendored
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
name: release-dev
|
||||
run-name: release-dev ${{ github.actor }}
|
||||
on:
|
||||
# push:
|
||||
# tags:
|
||||
# - 'v[0-9]+.[0-9]+.[0-9]+'
|
||||
# tags-ignore:
|
||||
# - '2.*'
|
||||
# Allow run workflow manually from Action tab
|
||||
workflow_dispatch:
|
||||
env:
|
||||
REGISTRY: docker.frappet.com
|
||||
IMAGE_NAME: ehr/bma-ehr-insignia-service
|
||||
DEPLOY_HOST: frappet.com
|
||||
COMPOSE_PATH: /home/frappet/docker/bma-ehr-insignia
|
||||
TOKEN_LINE: uxuK5hDzS2DsoC5piJBrWRLiz8GgY7iMZZldOWsDDF0
|
||||
|
||||
jobs:
|
||||
# act workflow_dispatch -W .github/workflows/release_insignia.yaml --input IMAGE_VER=test-v6.1 -s DOCKER_USER=sorawit -s DOCKER_PASS=P@ssword -s SSH_PASSWORD=P@ssw0rd
|
||||
release-dev:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
# skip Set up QEMU because it fail on act and container
|
||||
- name: Gen Version
|
||||
id: gen_ver
|
||||
run: |
|
||||
if [[ $GITHUB_REF == 'refs/tags/'* ]]; then
|
||||
IMAGE_VER='${GITHUB_REF/refs\/tags\//}'
|
||||
else
|
||||
IMAGE_VER=${{ github.event.inputs.IMAGE_VER }}
|
||||
fi
|
||||
if [[ $IMAGE_VER == '' ]]; then
|
||||
IMAGE_VER='test-vBeta'
|
||||
fi
|
||||
echo '::set-output name=image_ver::'$IMAGE_VER
|
||||
- name: Test Version
|
||||
run: |
|
||||
echo $GITHUB_REF
|
||||
echo ${{ steps.gen_ver.outputs.image_ver }}
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
- name: Login in to registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ${{env.REGISTRY}}
|
||||
username: ${{secrets.DOCKER_USER}}
|
||||
password: ${{secrets.DOCKER_PASS}}
|
||||
- name: Build and load local docker image
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64
|
||||
file: BMA.EHR.Insignia.Service/Dockerfile
|
||||
push: true
|
||||
tags: ${{env.REGISTRY}}/${{env.IMAGE_NAME}}:${{ steps.gen_ver.outputs.image_ver }},${{env.REGISTRY}}/${{env.IMAGE_NAME}}:latest
|
||||
|
||||
- name: Reload docker compose
|
||||
uses: appleboy/ssh-action@v0.1.8
|
||||
with:
|
||||
host: ${{env.DEPLOY_HOST}}
|
||||
username: frappet
|
||||
password: ${{ secrets.SSH_PASSWORD }}
|
||||
port: 22
|
||||
script: |
|
||||
cd "${{env.COMPOSE_PATH}}"
|
||||
docker-compose pull
|
||||
docker-compose up -d
|
||||
echo "${{ steps.gen_ver.outputs.image_ver }}"> success
|
||||
- uses: snow-actions/line-notify@v1.1.0
|
||||
if: success()
|
||||
with:
|
||||
access_token: ${{ env.TOKEN_LINE }}
|
||||
message: |
|
||||
-Success✅✅✅
|
||||
Image: ${{env.IMAGE_NAME}}
|
||||
Version: ${{ github.event.inputs.IMAGE_VER }}
|
||||
By: ${{secrets.DOCKER_USER}}
|
||||
- uses: snow-actions/line-notify@v1.1.0
|
||||
if: failure()
|
||||
with:
|
||||
access_token: ${{ env.TOKEN_LINE }}
|
||||
message: |
|
||||
-Failure❌❌❌
|
||||
Image: ${{env.IMAGE_NAME}}
|
||||
Version: ${{ github.event.inputs.IMAGE_VER }}
|
||||
By: ${{secrets.DOCKER_USER}}
|
||||
87
.github/workflows/release_orgEmployee.yaml
vendored
Normal file
87
.github/workflows/release_orgEmployee.yaml
vendored
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
name: release-dev
|
||||
run-name: release-dev ${{ github.actor }}
|
||||
on:
|
||||
# push:
|
||||
# tags:
|
||||
# - 'v[0-9]+.[0-9]+.[0-9]+'
|
||||
# tags-ignore:
|
||||
# - '2.*'
|
||||
# Allow run workflow manually from Action tab
|
||||
workflow_dispatch:
|
||||
env:
|
||||
REGISTRY: docker.frappet.com
|
||||
IMAGE_NAME: ehr/bma-ehr-ore-employee-service
|
||||
DEPLOY_HOST: frappet.com
|
||||
COMPOSE_PATH: /home/frappet/docker/bma-ehr-ore-employee
|
||||
TOKEN_LINE: uxuK5hDzS2DsoC5piJBrWRLiz8GgY7iMZZldOWsDDF0
|
||||
|
||||
jobs:
|
||||
# act workflow_dispatch -W .github/workflows/release_ore-employee.yaml --input IMAGE_VER=test-v6.1 -s DOCKER_USER=sorawit -s DOCKER_PASS=P@ssword -s SSH_PASSWORD=P@ssw0rd
|
||||
release-dev:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
# skip Set up QEMU because it fail on act and container
|
||||
- name: Gen Version
|
||||
id: gen_ver
|
||||
run: |
|
||||
if [[ $GITHUB_REF == 'refs/tags/'* ]]; then
|
||||
IMAGE_VER='${GITHUB_REF/refs\/tags\//}'
|
||||
else
|
||||
IMAGE_VER=${{ github.event.inputs.IMAGE_VER }}
|
||||
fi
|
||||
if [[ $IMAGE_VER == '' ]]; then
|
||||
IMAGE_VER='test-vBeta'
|
||||
fi
|
||||
echo '::set-output name=image_ver::'$IMAGE_VER
|
||||
- name: Test Version
|
||||
run: |
|
||||
echo $GITHUB_REF
|
||||
echo ${{ steps.gen_ver.outputs.image_ver }}
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
- name: Login in to registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ${{env.REGISTRY}}
|
||||
username: ${{secrets.DOCKER_USER}}
|
||||
password: ${{secrets.DOCKER_PASS}}
|
||||
- name: Build and load local docker image
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64
|
||||
file: BMA.EHR.OrganizationEmployee.Service/Dockerfile
|
||||
push: true
|
||||
tags: ${{env.REGISTRY}}/${{env.IMAGE_NAME}}:${{ steps.gen_ver.outputs.image_ver }},${{env.REGISTRY}}/${{env.IMAGE_NAME}}:latest
|
||||
|
||||
- name: Reload docker compose
|
||||
uses: appleboy/ssh-action@v0.1.8
|
||||
with:
|
||||
host: ${{env.DEPLOY_HOST}}
|
||||
username: frappet
|
||||
password: ${{ secrets.SSH_PASSWORD }}
|
||||
port: 22
|
||||
script: |
|
||||
cd "${{env.COMPOSE_PATH}}"
|
||||
docker-compose pull
|
||||
docker-compose up -d
|
||||
echo "${{ steps.gen_ver.outputs.image_ver }}"> success
|
||||
- uses: snow-actions/line-notify@v1.1.0
|
||||
if: success()
|
||||
with:
|
||||
access_token: ${{ env.TOKEN_LINE }}
|
||||
message: |
|
||||
-Success✅✅✅
|
||||
Image: ${{env.IMAGE_NAME}}
|
||||
Version: ${{ github.event.inputs.IMAGE_VER }}
|
||||
By: ${{secrets.DOCKER_USER}}
|
||||
- uses: snow-actions/line-notify@v1.1.0
|
||||
if: failure()
|
||||
with:
|
||||
access_token: ${{ env.TOKEN_LINE }}
|
||||
message: |
|
||||
-Failure❌❌❌
|
||||
Image: ${{env.IMAGE_NAME}}
|
||||
Version: ${{ github.event.inputs.IMAGE_VER }}
|
||||
By: ${{secrets.DOCKER_USER}}
|
||||
87
.github/workflows/release_placement.yaml
vendored
Normal file
87
.github/workflows/release_placement.yaml
vendored
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
name: release-dev
|
||||
run-name: release-dev ${{ github.actor }}
|
||||
on:
|
||||
# push:
|
||||
# tags:
|
||||
# - 'v[0-9]+.[0-9]+.[0-9]+'
|
||||
# tags-ignore:
|
||||
# - '2.*'
|
||||
# Allow run workflow manually from Action tab
|
||||
workflow_dispatch:
|
||||
env:
|
||||
REGISTRY: docker.frappet.com
|
||||
IMAGE_NAME: ehr/bma-ehr-placement-service
|
||||
DEPLOY_HOST: frappet.com
|
||||
COMPOSE_PATH: /home/frappet/docker/bma-ehr-placement
|
||||
TOKEN_LINE: uxuK5hDzS2DsoC5piJBrWRLiz8GgY7iMZZldOWsDDF0
|
||||
|
||||
jobs:
|
||||
# act workflow_dispatch -W .github/workflows/release_placement.yaml --input IMAGE_VER=test-v6.1 -s DOCKER_USER=sorawit -s DOCKER_PASS=P@ssword -s SSH_PASSWORD=P@ssw0rd
|
||||
release-dev:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
# skip Set up QEMU because it fail on act and container
|
||||
- name: Gen Version
|
||||
id: gen_ver
|
||||
run: |
|
||||
if [[ $GITHUB_REF == 'refs/tags/'* ]]; then
|
||||
IMAGE_VER='${GITHUB_REF/refs\/tags\//}'
|
||||
else
|
||||
IMAGE_VER=${{ github.event.inputs.IMAGE_VER }}
|
||||
fi
|
||||
if [[ $IMAGE_VER == '' ]]; then
|
||||
IMAGE_VER='test-vBeta'
|
||||
fi
|
||||
echo '::set-output name=image_ver::'$IMAGE_VER
|
||||
- name: Test Version
|
||||
run: |
|
||||
echo $GITHUB_REF
|
||||
echo ${{ steps.gen_ver.outputs.image_ver }}
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
- name: Login in to registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ${{env.REGISTRY}}
|
||||
username: ${{secrets.DOCKER_USER}}
|
||||
password: ${{secrets.DOCKER_PASS}}
|
||||
- name: Build and load local docker image
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64
|
||||
file: BMA.EHR.Placement.Service/Dockerfile
|
||||
push: true
|
||||
tags: ${{env.REGISTRY}}/${{env.IMAGE_NAME}}:${{ steps.gen_ver.outputs.image_ver }},${{env.REGISTRY}}/${{env.IMAGE_NAME}}:latest
|
||||
|
||||
- name: Reload docker compose
|
||||
uses: appleboy/ssh-action@v0.1.8
|
||||
with:
|
||||
host: ${{env.DEPLOY_HOST}}
|
||||
username: frappet
|
||||
password: ${{ secrets.SSH_PASSWORD }}
|
||||
port: 22
|
||||
script: |
|
||||
cd "${{env.COMPOSE_PATH}}"
|
||||
docker-compose pull
|
||||
docker-compose up -d
|
||||
echo "${{ steps.gen_ver.outputs.image_ver }}"> success
|
||||
- uses: snow-actions/line-notify@v1.1.0
|
||||
if: success()
|
||||
with:
|
||||
access_token: ${{ env.TOKEN_LINE }}
|
||||
message: |
|
||||
-Success✅✅✅
|
||||
Image: ${{env.IMAGE_NAME}}
|
||||
Version: ${{ github.event.inputs.IMAGE_VER }}
|
||||
By: ${{secrets.DOCKER_USER}}
|
||||
- uses: snow-actions/line-notify@v1.1.0
|
||||
if: failure()
|
||||
with:
|
||||
access_token: ${{ env.TOKEN_LINE }}
|
||||
message: |
|
||||
-Failure❌❌❌
|
||||
Image: ${{env.IMAGE_NAME}}
|
||||
Version: ${{ github.event.inputs.IMAGE_VER }}
|
||||
By: ${{secrets.DOCKER_USER}}
|
||||
|
|
@ -1,8 +1,11 @@
|
|||
using BMA.EHR.Application.Common.Interfaces;
|
||||
using System.Reflection.Metadata;
|
||||
using BMA.EHR.Application.Common.Interfaces;
|
||||
using BMA.EHR.Domain.Extensions;
|
||||
using BMA.EHR.Domain.Models.Organizations;
|
||||
using BMA.EHR.Domain.Models.Retirement;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace BMA.EHR.Application.Repositories.Reports
|
||||
|
|
@ -18,11 +21,11 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
|
||||
#region " Constructor and Destructor "
|
||||
|
||||
public RetireReportRepository(IApplicationDBContext dbContext, IWebHostEnvironment hostEnvironment)
|
||||
public RetireReportRepository(IApplicationDBContext dbContext,
|
||||
IWebHostEnvironment hostEnvironment)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
_hostingEnvironment = hostEnvironment;
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
@ -239,6 +242,18 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
}
|
||||
#endregion
|
||||
|
||||
#region บันทึกหนังสือเวียน
|
||||
public async Task UploadFileRetirementDeceasedAsync(Guid id, Domain.Models.Documents.Document file)
|
||||
{
|
||||
var data = await _dbContext.Set<RetirementDeceased>().AsQueryable()
|
||||
.Include(x => x.Profile)
|
||||
.Where(x => x.Id == id)
|
||||
.FirstOrDefaultAsync();
|
||||
if (data != null)
|
||||
data.Document = file;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,5 +41,8 @@ namespace BMA.EHR.Domain.Models.Retirement
|
|||
|
||||
[Comment("ชื่อตำแหน่งของผู้รับสำเนาคำสั่ง")]
|
||||
public string PositionName { get; set; } = string.Empty;
|
||||
|
||||
[Comment("Fk Table Document")]
|
||||
public Document? Document { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
16292
BMA.EHR.Infrastructure/Migrations/20230913144418_update table retirementperiod add Document.Designer.cs
generated
Normal file
16292
BMA.EHR.Infrastructure/Migrations/20230913144418_update table retirementperiod add Document.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,50 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace BMA.EHR.Infrastructure.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class updatetableretirementperiodaddDocument : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "DocumentId",
|
||||
table: "RetirementDeceasedNotis",
|
||||
type: "char(36)",
|
||||
nullable: true,
|
||||
collation: "ascii_general_ci");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_RetirementDeceasedNotis_DocumentId",
|
||||
table: "RetirementDeceasedNotis",
|
||||
column: "DocumentId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_RetirementDeceasedNotis_Documents_DocumentId",
|
||||
table: "RetirementDeceasedNotis",
|
||||
column: "DocumentId",
|
||||
principalTable: "Documents",
|
||||
principalColumn: "Id");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_RetirementDeceasedNotis_Documents_DocumentId",
|
||||
table: "RetirementDeceasedNotis");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_RetirementDeceasedNotis_DocumentId",
|
||||
table: "RetirementDeceasedNotis");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "DocumentId",
|
||||
table: "RetirementDeceasedNotis");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -12801,6 +12801,9 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
.HasColumnOrder(101)
|
||||
.HasComment("User Id ที่สร้างข้อมูล");
|
||||
|
||||
b.Property<Guid?>("DocumentId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<string>("FirstName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
|
|
@ -12868,6 +12871,8 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("DocumentId");
|
||||
|
||||
b.HasIndex("ReceiveUserId");
|
||||
|
||||
b.HasIndex("RetirementDeceasedId");
|
||||
|
|
@ -15761,6 +15766,10 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Retirement.RetirementDeceasedNoti", b =>
|
||||
{
|
||||
b.HasOne("BMA.EHR.Domain.Models.Documents.Document", "Document")
|
||||
.WithMany()
|
||||
.HasForeignKey("DocumentId");
|
||||
|
||||
b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "ReceiveUser")
|
||||
.WithMany()
|
||||
.HasForeignKey("ReceiveUserId")
|
||||
|
|
@ -15773,6 +15782,8 @@ namespace BMA.EHR.Infrastructure.Migrations
|
|||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Document");
|
||||
|
||||
b.Navigation("ReceiveUser");
|
||||
|
||||
b.Navigation("RetirementDeceased");
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@ using DocumentFormat.OpenXml.Drawing;
|
|||
using Telerik.Reporting;
|
||||
using Telerik.Reporting.Processing;
|
||||
using System.IO;
|
||||
using BMA.EHR.Application.Repositories;
|
||||
using BMA.EHR.Report.Service.Requests;
|
||||
|
||||
namespace BMA.EHR.Report.Service.Controllers
|
||||
{
|
||||
|
|
@ -27,18 +29,24 @@ namespace BMA.EHR.Report.Service.Controllers
|
|||
private readonly IConfiguration _configuration;
|
||||
private readonly GenericReportGenerator _reportGenerator;
|
||||
private readonly RetireReportRepository _repository;
|
||||
private readonly MinIOService _documentService;
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Constuctor and Destructor "
|
||||
|
||||
public DeceasedReportController(IWebHostEnvironment hostingEnvironment, IConfiguration configuration, GenericReportGenerator reportGenerator, RetireReportRepository repository)
|
||||
public DeceasedReportController(IWebHostEnvironment hostingEnvironment,
|
||||
IConfiguration configuration,
|
||||
MinIOService documentService,
|
||||
GenericReportGenerator reportGenerator,
|
||||
RetireReportRepository repository)
|
||||
{
|
||||
|
||||
|
||||
_hostingEnvironment = hostingEnvironment;
|
||||
_configuration = configuration;
|
||||
_reportGenerator = reportGenerator;
|
||||
_repository = repository;
|
||||
_documentService = documentService;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
@ -98,6 +106,38 @@ namespace BMA.EHR.Report.Service.Controllers
|
|||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// อัปไฟล์บันทึกเวียนแจ้งการถึงแก่กรรม
|
||||
/// </summary>
|
||||
/// <param name="id">id </param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpPut("attachment/36/{id}")]
|
||||
public async Task<ActionResult<ResponseObject>> UploadDeceasedReportAsync([FromForm] FileRequest req, Guid id)
|
||||
{
|
||||
try
|
||||
{
|
||||
var data = await _repository.GetRetirementDeceasedAsync(id);
|
||||
if (data == null)
|
||||
return NotFound();
|
||||
// check upload file
|
||||
if (Request.Form.Files == null || Request.Form.Files.Count == 0)
|
||||
{
|
||||
return Error(GlobalMessages.NoFileToUpload);
|
||||
}
|
||||
var file = Request.Form.Files[0];
|
||||
var cover = await _documentService.UploadFileAsync(file);
|
||||
await _repository.UploadFileRetirementDeceasedAsync(id, cover);
|
||||
return Success();
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
|
|
|||
10
BMA.EHR.Report.Service/Requests/FileRequest.cs
Normal file
10
BMA.EHR.Report.Service/Requests/FileRequest.cs
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
using BMA.EHR.Domain.Models.MetaData;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace BMA.EHR.Report.Service.Requests
|
||||
{
|
||||
public class FileRequest
|
||||
{
|
||||
public List<FormFile>? File { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,7 @@
|
|||
using BMA.EHR.Application.Repositories;
|
||||
using BMA.EHR.Application.Repositories.MessageQueue;
|
||||
using BMA.EHR.Application.Repositories.Reports;
|
||||
using BMA.EHR.Application.Responses;
|
||||
using BMA.EHR.Domain.Common;
|
||||
using BMA.EHR.Domain.Extensions;
|
||||
using BMA.EHR.Domain.Models.HR;
|
||||
|
|
@ -12,6 +14,7 @@ using BMA.EHR.Retirement.Service.Requests;
|
|||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Newtonsoft.Json;
|
||||
using Swashbuckle.AspNetCore.Annotations;
|
||||
using System.Reflection.Metadata;
|
||||
using System.Security.Claims;
|
||||
|
|
@ -29,21 +32,27 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
{
|
||||
private readonly RetirementRepository _repository;
|
||||
private readonly NotificationRepository _repositoryNoti;
|
||||
private readonly RetireReportRepository _repositoryRetireReport;
|
||||
private readonly ApplicationDBContext _context;
|
||||
private readonly MinIOService _documentService;
|
||||
private readonly IConfiguration _configuration;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
|
||||
public RetirementDeceasedController(RetirementRepository repository,
|
||||
NotificationRepository repositoryNoti,
|
||||
RetireReportRepository repositoryRetireReport,
|
||||
ApplicationDBContext context,
|
||||
MinIOService documentService,
|
||||
IConfiguration configuration,
|
||||
IHttpContextAccessor httpContextAccessor)
|
||||
{
|
||||
_repository = repository;
|
||||
_repositoryNoti = repositoryNoti;
|
||||
_repositoryRetireReport = repositoryRetireReport;
|
||||
_context = context;
|
||||
_documentService = documentService;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
_configuration = configuration;
|
||||
}
|
||||
|
||||
#region " Properties "
|
||||
|
|
@ -527,6 +536,30 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
.ThenInclude(x => x.Prefix)
|
||||
.Where(x => x.RetirementDeceased.Id == id)
|
||||
.ToListAsync();
|
||||
|
||||
var retirementDeceased = await _context.RetirementDeceaseds.AsQueryable()
|
||||
.Include(x => x.Document)
|
||||
.Where(x => x.Id == id)
|
||||
.FirstOrDefaultAsync();
|
||||
if (retirementDeceased == null)
|
||||
return Error(GlobalMessages.RetirementDeceasedNotFound, 404);
|
||||
if (retirementDeceased.Document == null)
|
||||
return Error(GlobalMessages.NoFileToUpload, 404);
|
||||
|
||||
// create command payload
|
||||
var payload_attach = new List<PayloadAttachment>();
|
||||
payload_attach.Add(new PayloadAttachment
|
||||
{
|
||||
name = "หนังสือเวียนถึงแก่กรรม",
|
||||
url = $"{_configuration["API"]}/order/download/attachment/{retirementDeceased.Document.Id}"
|
||||
});
|
||||
|
||||
var payload = new CommandPayload()
|
||||
{
|
||||
attachments = payload_attach
|
||||
};
|
||||
|
||||
var payload_str = JsonConvert.SerializeObject(payload);
|
||||
foreach (var item in items)
|
||||
{
|
||||
var prefix = item.RetirementDeceased.Profile.Prefix == null ? "" : item.RetirementDeceased.Profile.Prefix.Name;
|
||||
|
|
@ -537,7 +570,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
item.ReceiveUser.Id,
|
||||
$"หนังสือเวียนถึงแก่กรรมของ {prefix}{item.RetirementDeceased.Profile.FirstName} {item.RetirementDeceased.Profile.LastName}",
|
||||
$"แจ้งข่าวการถึงแก่กรรมของ {prefix}{item.RetirementDeceased.Profile.FirstName} {item.RetirementDeceased.Profile.LastName}",
|
||||
"",
|
||||
payload_str,
|
||||
profile.IsSendInbox,
|
||||
profile.IsSendMail
|
||||
);
|
||||
|
|
@ -551,7 +584,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
|||
item.ReceiveUser.Id,
|
||||
$"หนังสือเวียนถึงแก่กรรมของ {prefix}{item.RetirementDeceased.Profile.FirstName} {item.RetirementDeceased.Profile.LastName}",
|
||||
$"แจ้งข่าวการถึงแก่กรรมของ {prefix}{item.RetirementDeceased.Profile.FirstName} {item.RetirementDeceased.Profile.LastName}",
|
||||
"",
|
||||
payload_str,
|
||||
item.IsSendInbox,
|
||||
item.IsSendMail
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue