Compare commits
85
Commits
da86cb2bc6
...
dev
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
88590db60d | ||
|
|
ae5f1b13a1 | ||
|
|
b66ee7d09f | ||
|
|
f4cfd5d9c2 | ||
|
|
a142e87094 | ||
|
|
ff3ac2623d | ||
|
|
ea12d1548a | ||
|
|
8986231d72 | ||
|
|
8eaa7041ee | ||
|
|
918bbaa315 | ||
|
|
1bc59c23be | ||
|
|
28bc7f9838 | ||
|
|
c644f85fe8 | ||
|
|
f592595297 | ||
|
|
5fab0d7bce | ||
|
|
281c95bdfd | ||
|
|
500d9da591 | ||
|
|
c22b7ff20f | ||
|
|
0b8ee04f77 | ||
|
|
043ad16e89 | ||
|
|
2818dfe86f | ||
|
|
b1a21fbe36 | ||
|
|
5e80b49bc5 | ||
|
|
8b06e969ca | ||
|
|
0b69c1dc7c | ||
|
|
fcf9fb8aa4 | ||
|
|
9102136f89 | ||
|
|
bc9f311e51 | ||
|
|
4e649eff58 | ||
|
|
8560d82d54 | ||
|
|
eea6bc7700 | ||
|
|
a87eed7eaa | ||
|
|
10ae092334 | ||
|
|
c64ba0b508 | ||
|
|
cfdfac223f | ||
|
|
d21cae7ded | ||
|
|
1ec7cf517e | ||
|
|
87baa898f6 | ||
|
|
44b37e2d49 | ||
|
|
f5568dfc61 | ||
|
|
ec2a02dffd | ||
|
|
46f85ea7ac | ||
|
|
bafd7dbeb0 | ||
|
|
b840f801c8 | ||
|
|
ba4283a020 | ||
|
|
b41a3d00a7 | ||
|
|
1c6292158d | ||
|
|
6daa97459b | ||
|
|
58db5b5043 | ||
|
|
0e7d50265d | ||
|
|
191a850bde | ||
|
|
d5023bd93c | ||
|
|
ad7cb3c42a | ||
|
|
f651a185b3 | ||
|
|
e46cdb7835 | ||
|
|
42adec6bb6 | ||
|
|
a8c83f9547 | ||
|
|
aa3877c68e | ||
|
|
ee3413e15b | ||
|
|
158e57f6f2 | ||
|
|
125c43bc66 | ||
|
|
2011b318ca | ||
|
|
bc1209a270 | ||
|
|
233918cecf | ||
|
|
a892e5ee43 | ||
|
|
261f3cdeb3 | ||
|
|
c7f2876e6e | ||
|
|
37f2c215ef | ||
|
|
4a62316548 | ||
|
|
2c22acc556 | ||
|
|
4214bd00bd | ||
|
|
2e70cd727c | ||
|
|
be34c66ffd | ||
|
|
69cfda6f63 | ||
|
|
ecdf270738 | ||
|
|
45d883e0b7 | ||
|
|
cef816ecb6 | ||
|
|
befc121563 | ||
|
|
b8e7a53f97 | ||
|
|
5763aa69f8 | ||
|
|
cb950e63e9 | ||
|
|
b454f52039 | ||
|
|
95afff0c4e | ||
|
|
d5583eaf15 | ||
|
|
2cbc2c638a |
No files matched your search
@@ -27,8 +27,6 @@ go.work.sum
|
|||||||
# env file
|
# env file
|
||||||
.env
|
.env
|
||||||
config.yml
|
config.yml
|
||||||
Dockerfile-main-api
|
|
||||||
Dockerfile-sync-api
|
|
||||||
**/atlas.hcl
|
**/atlas.hcl
|
||||||
!**/atlas.hcl.example
|
!**/atlas.hcl.example
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ RUN CGO_ENABLED=0 GOOS=linux go build -o ./cmd/main-api/main-api ./cmd/main-api/
|
|||||||
|
|
||||||
FROM alpine:latest
|
FROM alpine:latest
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY --from=builder /src/assets .
|
COPY --from=builder /src/assets ./assets
|
||||||
COPY --from=builder /src/cmd/main-api/main-api .
|
COPY --from=builder /src/cmd/main-api/main-api .
|
||||||
COPY --from=builder /src/cmd/main-api/config.yml .
|
COPY --from=builder /src/cmd/main-api/config.yml .
|
||||||
EXPOSE 8010
|
EXPOSE 8010
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
FROM golang:1.24.10 AS builder
|
||||||
|
WORKDIR /src
|
||||||
|
COPY go.mod go.sum ./
|
||||||
|
RUN go mod download
|
||||||
|
COPY . .
|
||||||
|
RUN CGO_ENABLED=0 GOOS=linux go build -o ./cmd/sync-api/sync-api ./cmd/sync-api/main.go
|
||||||
|
|
||||||
|
FROM alpine:latest
|
||||||
|
WORKDIR /app
|
||||||
|
COPY --from=builder /src/assets ./assets
|
||||||
|
COPY --from=builder /src/cmd/sync-api/sync-api .
|
||||||
|
COPY --from=builder /src/cmd/sync-api/config.yml .
|
||||||
|
EXPOSE 8011
|
||||||
|
CMD ["./sync-api"]
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
FROM golang:1.24.10 AS builder
|
|
||||||
WORKDIR /src
|
|
||||||
COPY go.mod go.sum ./
|
|
||||||
RUN go mod download
|
|
||||||
COPY . .
|
|
||||||
RUN CGO_ENABLED=0 GOOS=linux go build -o ./cmd/simgos-sync-api/simgos-sync-api ./cmd/simgos-sync-api/main.go
|
|
||||||
|
|
||||||
FROM alpine:latest
|
|
||||||
WORKDIR /app
|
|
||||||
COPY --from=builder /src/assets .
|
|
||||||
COPY --from=builder /src/cmd/simgos-sync-api/simgos-sync-api .
|
|
||||||
COPY --from=builder /src/cmd/simgos-sync-api/config.yml .
|
|
||||||
EXPOSE 8011
|
|
||||||
CMD ["./simgos-sync-api"]
|
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 766 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 67 KiB |
+11
-11
@@ -48,27 +48,27 @@
|
|||||||
<table style="width: 100%; border-collapse: collapse">
|
<table style="width: 100%; border-collapse: collapse">
|
||||||
<tr>
|
<tr>
|
||||||
<td style="text-align: center">
|
<td style="text-align: center">
|
||||||
<img src="logo-1.png" alt="logo" style="height: 70px" />
|
<img src="{{ .JatimLogo }}" alt="logo" style="height: 70px" />
|
||||||
</td>
|
</td>
|
||||||
<td style="text-align: center">
|
<td style="text-align: center">
|
||||||
<div style="font-size: 14px; font-weight: bold">
|
<div style="font-size: 24px; font-weight: bold">
|
||||||
PEMERINTAH PROVINSI JAWA TIMUR
|
PEMERINTAH PROVINSI JAWA TIMUR
|
||||||
</div>
|
</div>
|
||||||
<div style="font-size: 14px; font-weight: bold">
|
<div style="font-size: 16px; font-weight: bold">
|
||||||
RUMAH SAKIT UMUM DAERAH Dr. SAIFUL ANWAR
|
RUMAH SAKIT UMUM DAERAH Dr. SAIFUL ANWAR
|
||||||
</div>
|
</div>
|
||||||
<div style="font-size: 13px">
|
<div style="font-size: 13px">
|
||||||
TERAKREDITASI KARS VERSI 2012 TINGKAT PARIPURNA
|
TERAKREDITASI PARIPURNA
|
||||||
</div>
|
</div>
|
||||||
<div style="margin-top: 8px">
|
<div style="margin-top: 8px">
|
||||||
Jl. Jaksa Agung Suprapto No. 2 MALANG 65111
|
Jalan Jaksa Agung Suprapto No. 2 MALANG 65111
|
||||||
</div>
|
</div>
|
||||||
<div>Telp. (0341) 362101, Fax. (0341) 362110</div>
|
<div>Telp. (0341) 362101, Fax. (0341) 362110</div>
|
||||||
<div>Email: [email protected]</div>
|
<div>Email: [email protected]</div>
|
||||||
<div>Website: www.rsudsaifulanwar.jatimprov.go.id</div>
|
<div>Website: www.rsudsaifulanwar.jatimprov.go.id</div>
|
||||||
</td>
|
</td>
|
||||||
<td style="text-align: center">
|
<td style="text-align: center">
|
||||||
<img src="logo-rssa.png" alt="logo" style="height: 70px" />
|
<img src="{{ .RssaLogo }}" alt="logo" style="height: 70px" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
@@ -79,7 +79,7 @@
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
">
|
">
|
||||||
IDENTITAS PASIEN
|
IDENTITAS PASIEN
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -88,7 +88,7 @@
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
margin-top: 20px;
|
margin-top: 20px;
|
||||||
border-collapse: collapse;
|
border-collapse: collapse;
|
||||||
">
|
">
|
||||||
<tr>
|
<tr>
|
||||||
<td style="width: 10rem;">
|
<td style="width: 10rem;">
|
||||||
No. RM
|
No. RM
|
||||||
@@ -627,17 +627,17 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td style="width: 4rem;">Fasyankes</td>
|
<td style="width: 4rem;">Fasyankes</td>
|
||||||
<td class="data-colon">: </td>
|
<td class="data-colon">: </td>
|
||||||
<td>{{ .NIK }}</td>
|
<td>{{ .ControlHealthcare }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Tanggal</td>
|
<td>Tanggal</td>
|
||||||
<td>: </td>
|
<td>: </td>
|
||||||
<td>{{ .NIK }}</td>
|
<td>{{ .ControlDate }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Klinik</td>
|
<td>Klinik</td>
|
||||||
<td>: </td>
|
<td>: </td>
|
||||||
<td>{{ .NIK }}</td>
|
<td>{{ .ControlUnit }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@@ -0,0 +1,59 @@
|
|||||||
|
appCfg:
|
||||||
|
fullName: SIMRS-X Main API
|
||||||
|
codeName: simrs-x-mapi
|
||||||
|
version: 0.1.0
|
||||||
|
env: development
|
||||||
|
lang: en
|
||||||
|
|
||||||
|
httpCfg:
|
||||||
|
host: 127.0.0.1
|
||||||
|
port: 8000
|
||||||
|
|
||||||
|
loggerCfg:
|
||||||
|
hideTime: true
|
||||||
|
hideLevel: true
|
||||||
|
|
||||||
|
langCfg:
|
||||||
|
active: en
|
||||||
|
path: ../../assets/language/id
|
||||||
|
fileName: data.json
|
||||||
|
|
||||||
|
dbCfg:
|
||||||
|
dsn: host=localhost user=user password=password dbname=simrs-main port=5432 sslmode=disable TimeZone=Asia/Jakarta
|
||||||
|
maxOpenConns: 5
|
||||||
|
maxIdleConns: 5
|
||||||
|
maxIdleTime: 100
|
||||||
|
|
||||||
|
msCfg:
|
||||||
|
dsn: 127.0.0.1:6379
|
||||||
|
|
||||||
|
minioCfg:
|
||||||
|
endpoint: localhost:9000
|
||||||
|
region: ap-southeast-1
|
||||||
|
accessKey: admin
|
||||||
|
secretKey: 12341234
|
||||||
|
useSsl: false
|
||||||
|
bucketName:
|
||||||
|
- patient
|
||||||
|
- encounter
|
||||||
|
|
||||||
|
corsCfg:
|
||||||
|
allowedOrigin:
|
||||||
|
allowedMethod:
|
||||||
|
|
||||||
|
satuSehatCfg:
|
||||||
|
host: localhost:8200
|
||||||
|
|
||||||
|
bpjsCfg:
|
||||||
|
baseUrl:
|
||||||
|
|
||||||
|
syncUrlCfg:
|
||||||
|
enable: false
|
||||||
|
targetHost:
|
||||||
|
prefix: new-to-old
|
||||||
|
source: old-app
|
||||||
|
secretKey: new-world-order!!
|
||||||
|
|
||||||
|
docsCfg:
|
||||||
|
path: ../../assets/docs/
|
||||||
|
domain: redacted
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
appCfg:
|
||||||
|
fullName: SIMRS-X Main API
|
||||||
|
codeName: simrs-x-main-api
|
||||||
|
version: 0.1.0
|
||||||
|
env: development
|
||||||
|
lang: en
|
||||||
|
|
||||||
|
httpCfg:
|
||||||
|
host: 0.0.0.0
|
||||||
|
port: 8000
|
||||||
|
|
||||||
|
loggerCfg:
|
||||||
|
hideTime: true
|
||||||
|
hideLevel: true
|
||||||
|
|
||||||
|
langCfg:
|
||||||
|
active: en
|
||||||
|
path: assets/language/id
|
||||||
|
fileName: data.json
|
||||||
|
|
||||||
|
dbCfg:
|
||||||
|
dsn: host=simrs-x-main-db user=rssa password=Wh4t-A-Beautiful-D@y dbname=default port=5432 sslmode=disable TimeZone=Asia/Jakarta
|
||||||
|
maxOpenConns: 5
|
||||||
|
maxIdleConns: 5
|
||||||
|
maxIdleTime: 100
|
||||||
|
|
||||||
|
msCfg:
|
||||||
|
dsn: simrs-x-redis:6379
|
||||||
|
|
||||||
|
minioCfg:
|
||||||
|
endpoint: simrs-x-minio:9000
|
||||||
|
region: ap-southeast-1
|
||||||
|
accessKey: admin
|
||||||
|
secretKey: 12341234
|
||||||
|
useSsl: false
|
||||||
|
bucketName:
|
||||||
|
- patient
|
||||||
|
- encounter
|
||||||
|
|
||||||
|
corsCfg:
|
||||||
|
allowedOrigin:
|
||||||
|
allowedMethod:
|
||||||
|
|
||||||
|
satuSehatCfg:
|
||||||
|
host: simrs-x-satusehat-api:8001
|
||||||
|
|
||||||
|
bpjsCfg:
|
||||||
|
baseUrl: simrs-x-bpjs-api:8002
|
||||||
|
|
||||||
|
syncConsumerUrlCfg:
|
||||||
|
enable: false
|
||||||
|
targetHost: http://simrs-x-sync-api:8009/
|
||||||
|
prefix: new-to-old
|
||||||
|
source: old-app
|
||||||
|
secretKey: new-world-order!!
|
||||||
|
|
||||||
|
docsCfg:
|
||||||
|
path: assets/docs/
|
||||||
|
domain: simrs-x-main-api
|
||||||
@@ -1,76 +0,0 @@
|
|||||||
appCfg:
|
|
||||||
fullName: BPJS Bridge
|
|
||||||
codeName: simrs-vx
|
|
||||||
version: 0.1.0
|
|
||||||
env: development
|
|
||||||
lang: en
|
|
||||||
|
|
||||||
httpCfg:
|
|
||||||
host:
|
|
||||||
port:
|
|
||||||
|
|
||||||
dbCfg:
|
|
||||||
dsn:
|
|
||||||
maxOpenConns: 5
|
|
||||||
maxIdleConns: 5
|
|
||||||
maxIdleTime: 100
|
|
||||||
|
|
||||||
multiDbCfg:
|
|
||||||
- dbs :
|
|
||||||
name:
|
|
||||||
dsn:
|
|
||||||
maxOpenConns:
|
|
||||||
maxIdleConns:
|
|
||||||
maxIdleTime:
|
|
||||||
- bpjs
|
|
||||||
name: bpjs
|
|
||||||
dsn:
|
|
||||||
maxOpenConns:
|
|
||||||
maxIdleConns:
|
|
||||||
maxIdleTime:
|
|
||||||
|
|
||||||
loggerCfg:
|
|
||||||
hideTime:
|
|
||||||
hideLevel:
|
|
||||||
|
|
||||||
msCfg:
|
|
||||||
dsn:
|
|
||||||
|
|
||||||
langCfg:
|
|
||||||
active:
|
|
||||||
path:
|
|
||||||
fileName:
|
|
||||||
|
|
||||||
minioCfg:
|
|
||||||
endpoint:
|
|
||||||
region:
|
|
||||||
accessKey:
|
|
||||||
secretKey:
|
|
||||||
useSsl:
|
|
||||||
bucketName:
|
|
||||||
- patient
|
|
||||||
|
|
||||||
corsCfg:
|
|
||||||
allowedOrigin:
|
|
||||||
allowedMethod:
|
|
||||||
|
|
||||||
satuSehatCfg:
|
|
||||||
host: localhost:8200
|
|
||||||
|
|
||||||
corsCfg:
|
|
||||||
allowedOrigins:
|
|
||||||
- http://example.com
|
|
||||||
allowedMethod:
|
|
||||||
|
|
||||||
bpjsCfg:
|
|
||||||
baseUrl:
|
|
||||||
|
|
||||||
syncUrlCfg:
|
|
||||||
enable: false
|
|
||||||
targetHost:
|
|
||||||
prefix: new-to-old
|
|
||||||
source: old-app
|
|
||||||
secretKey: new-world-order!!
|
|
||||||
|
|
||||||
docsCfg:
|
|
||||||
path: ../../assets/docs/
|
|
||||||
@@ -1,22 +1,22 @@
|
|||||||
data "external_schema" "gorm" {
|
data "external_schema" "gorm" {
|
||||||
program = [
|
program = [
|
||||||
"go",
|
"go",
|
||||||
"run",
|
"run",
|
||||||
"-mod=mod",
|
"-mod=mod",
|
||||||
".",
|
".",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
env "gorm" {
|
env "gorm" {
|
||||||
src = data.external_schema.gorm.url
|
src = data.external_schema.gorm.url
|
||||||
dev = "" // dsn db to check the diff
|
dev = "postgresql://user:password@localhost:5432/simrs-dev?sslmode=disable" // dsn db to check the diff
|
||||||
migration {
|
migration {
|
||||||
dir = "file://migrations"
|
dir = "file://migrations"
|
||||||
}
|
}
|
||||||
url = "" // dsn db to apply
|
url = "postgresql://user:password@localhost:5432/simrs-main?sslmode=disable" // dsn db to apply
|
||||||
format {
|
format {
|
||||||
migrate {
|
migrate {
|
||||||
diff = "{{ sql . \" \" }}"
|
diff = "{{ sql . \" \" }}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
data "external_schema" "gorm" {
|
||||||
|
program = [
|
||||||
|
"go",
|
||||||
|
"run",
|
||||||
|
"-mod=mod",
|
||||||
|
".",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
env "gorm" {
|
||||||
|
src = data.external_schema.gorm.url
|
||||||
|
dev = "postgresql://user:password@simrs-x-main-db:5432/dev?sslmode=disable" // dsn db to check the diff
|
||||||
|
migration {
|
||||||
|
dir = "file://migrations"
|
||||||
|
}
|
||||||
|
url = "postgresql://user:password@simrs-x-main-db:5432/default?sslmode=disable" // dsn db to apply
|
||||||
|
format {
|
||||||
|
migrate {
|
||||||
|
diff = "{{ sql . \" \" }}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
-- Create "VaccineData" table
|
||||||
|
CREATE TABLE "public"."VaccineData" (
|
||||||
|
"Id" bigserial NOT NULL,
|
||||||
|
"CreatedAt" timestamptz NULL,
|
||||||
|
"UpdatedAt" timestamptz NULL,
|
||||||
|
"DeletedAt" timestamptz NULL,
|
||||||
|
"Type" character varying(25) NULL,
|
||||||
|
"Encounter_Id" bigint NULL,
|
||||||
|
"BatchNumber" text NULL,
|
||||||
|
"Dose" numeric NULL,
|
||||||
|
"DoseOrder" bigint NULL,
|
||||||
|
"InjectionLocation" text NULL,
|
||||||
|
"GivenDate" timestamptz NULL,
|
||||||
|
"ExpirationDate" timestamptz NULL,
|
||||||
|
PRIMARY KEY ("Id"),
|
||||||
|
CONSTRAINT "fk_Encounter_Vaccines" FOREIGN KEY ("Encounter_Id") REFERENCES "public"."Encounter" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION
|
||||||
|
);
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
-- Create "KFR" table
|
||||||
|
CREATE TABLE "public"."KFR" (
|
||||||
|
"Id" bigserial NOT NULL,
|
||||||
|
"CreatedAt" timestamptz NULL,
|
||||||
|
"UpdatedAt" timestamptz NULL,
|
||||||
|
"DeletedAt" timestamptz NULL,
|
||||||
|
"Encounter_Id" bigint NULL,
|
||||||
|
"CreatedBy_Employee_Id" bigint NULL,
|
||||||
|
"Type" character varying(15) NULL,
|
||||||
|
"Subjective" text NULL,
|
||||||
|
"Objective" text NULL,
|
||||||
|
"Assessment" text NULL,
|
||||||
|
"TreatmentGoals" text NULL,
|
||||||
|
"Education" text NULL,
|
||||||
|
"Action" text NULL,
|
||||||
|
"Frequency" bigint NULL,
|
||||||
|
"IntervalUnit_Code" character varying(10) NULL,
|
||||||
|
"FollowUpType" character varying(10) NULL,
|
||||||
|
"FollowUpNote" text NULL,
|
||||||
|
"Status_Code" character varying(10) NOT NULL,
|
||||||
|
PRIMARY KEY ("Id"),
|
||||||
|
CONSTRAINT "fk_KFR_CreatedBy_Employee" FOREIGN KEY ("CreatedBy_Employee_Id") REFERENCES "public"."Employee" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION,
|
||||||
|
CONSTRAINT "fk_KFR_Encounter" FOREIGN KEY ("Encounter_Id") REFERENCES "public"."Encounter" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION
|
||||||
|
);
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
h1:IfSOZ5RxGCWboRtqCJrYxCJa1HYSrlROJLXcElq1P3I=
|
h1:w6tFa/NMDQdQDXl91m3KqSaPSa9ktGQH7la07Gu6eoc=
|
||||||
20250904105930.sql h1:MEM6blCgke9DzWQSTnLzasbPIrcHssNNrJqZpSkEo6k=
|
20250904105930.sql h1:MEM6blCgke9DzWQSTnLzasbPIrcHssNNrJqZpSkEo6k=
|
||||||
20250904141448.sql h1:J8cmYNk4ZrG9fhfbi2Z1IWz7YkfvhFqTzrLFo58BPY0=
|
20250904141448.sql h1:J8cmYNk4ZrG9fhfbi2Z1IWz7YkfvhFqTzrLFo58BPY0=
|
||||||
20250908062237.sql h1:Pu23yEW/aKkwozHoOuROvHS/GK4ngARJGdO7FB7HZuI=
|
20250908062237.sql h1:Pu23yEW/aKkwozHoOuROvHS/GK4ngARJGdO7FB7HZuI=
|
||||||
@@ -75,91 +75,93 @@ h1:IfSOZ5RxGCWboRtqCJrYxCJa1HYSrlROJLXcElq1P3I=
|
|||||||
20251106040137.sql h1:ppcqkVoT0o9jZcjI/TN7LuaPxXhJQhnIXEJtloP/46o=
|
20251106040137.sql h1:ppcqkVoT0o9jZcjI/TN7LuaPxXhJQhnIXEJtloP/46o=
|
||||||
20251106041333.sql h1:2JkxyelQ/EeB+boL5bfpnzefw32ttEGKvKchtQjWmAU=
|
20251106041333.sql h1:2JkxyelQ/EeB+boL5bfpnzefw32ttEGKvKchtQjWmAU=
|
||||||
20251106042006.sql h1:ruppYa1kAJQUU3ufQBbKGMcXrGbGJJiRPclT+dNc/YQ=
|
20251106042006.sql h1:ruppYa1kAJQUU3ufQBbKGMcXrGbGJJiRPclT+dNc/YQ=
|
||||||
20251106050412.sql h1:1002KYtHd8AwrQTMewbs/PPHDylHDghigE/3S7PVdMA=
|
20251106050412.sql h1:MiEMJ1HCFYnalKuq3Z38xJeogfBAMqsTv2sG4EF8dDw=
|
||||||
20251106063418.sql h1:jPW/gBnbFl4RO39lQ0ZMDtYA6xbhyD6CgQupT50HmaY=
|
20251106063418.sql h1:y3veDJPjKekOWLCZek/LgQwXPRhZtOppTfUXiqoL95s=
|
||||||
20251106071906.sql h1:leYGKxR3EQn794aOehf0sd/ZPmOnvBMZPy5/anGmRB4=
|
20251106071906.sql h1:/TUZA3XpMY23qEJXdkTwlzrNMvSSl6JJniPcgAttBaw=
|
||||||
20251106073157.sql h1:KASMzjjjk5UB7Zj8lCRtM1utc4ZnDjlnpZbtTe3vONE=
|
20251106073157.sql h1:78txeibJ602DMD7huD618ZSMt6phSRzDNPTlo0PGyrc=
|
||||||
20251106074218.sql h1:Z5q5deOvLaZDPhiVTN9st3/s56RepBa2YOyrMXBdj4A=
|
20251106074218.sql h1:8Xz7WywrtUnSxOHhlal53gG9rE7r86LFUt5zBFe/mIs=
|
||||||
20251106081846.sql h1:P+VsWwhGt60adDIZuE/Aa38JVp/yX1rnsdpXpxASodw=
|
20251106081846.sql h1:jp91Bf5bxGXMiUB1VIuN6y768vb2iWwow44WfCE5J5k=
|
||||||
20251106082844.sql h1:Dmi5A8i9frQZvdXYPwc7f8CisZtBH8liSXq1rI6z1iM=
|
20251106082844.sql h1:RHYzRO4G1fSWwf+xc/3QezZ/Iil67cZPIgNpNz3TNhQ=
|
||||||
20251106090021.sql h1:4JwdKgO8T46YhyWVJUxpRIwudBDlG8QN1brSOYmgQ20=
|
20251106090021.sql h1:dFDk6mq+zjbYWmfWIrHf9DiKvvoXHjrr0++zssMTWP8=
|
||||||
20251106144745.sql h1:nqnQCzGrVJaq8ilOEOGXeRUL1dolj+OPWKuP8A92FRA=
|
20251106144745.sql h1:aHcr23iBFqCHer5D/SsPMXBCLjGqUYvWYfRU8jSJgIw=
|
||||||
20251107012049.sql h1:Pff4UqltGS3clSlGr0qq8CQM56L29wyxY0FC/N/YAhU=
|
20251107012049.sql h1:hu/7NHhnAkT4xK0RNtqmMDdH1Bo5EZbl7itDRjiCT+g=
|
||||||
20251107064812.sql h1:GB9a0ZfMYTIoGNmKUG+XcYUsTnRMFfT4/dAD71uCPc4=
|
20251107064812.sql h1:sfCXDQYnMf0ddrQ9oYljWJLLSt9NJjJV6o8VS3p7aZE=
|
||||||
20251107064937.sql h1:IC5pw1Ifj30hiE6dr5NMHXaSHoQI+vRd40N5ABgBHRI=
|
20251107064937.sql h1:DlYGJ9LZFwZyR7jBP5zaGB128aIc4HAixBKPYCz9EkY=
|
||||||
20251107071420.sql h1:9NO3iyLEXEtWa2kSRjM/8LyzuVIk6pdFL2SuheWjB08=
|
20251107071420.sql h1:ynCdZAd2utLl+FhtWZwtahNXgIVOvuk3s/rOq7lfXA4=
|
||||||
20251107074318.sql h1:7fHbSRrdjOmHh/xwnjCLwoiB5cW5zeH+uxLV0vZbkIA=
|
20251107074318.sql h1:WE9cPhibWtZ0dbu1VEGirTeY6ijFYGMNhHdBtM32kOc=
|
||||||
20251107075050.sql h1:np+3uTOnU9QNtK7Knaw8eRMhkyB9AwrtSNHphOBxbHY=
|
20251107075050.sql h1:8tvneruqdynDOaJK1+0z4CH7YXZStZpGdqwIeOMLik4=
|
||||||
20251107080604.sql h1:cXDBLPJDVWLTG6yEJqkJsOQ7p7VYxLM2SY+mwO8qSHo=
|
20251107080604.sql h1:8c4jd4Tql7tcdhbI9NS0tgvN+ADu9FnCf8wMUbmW7A0=
|
||||||
20251107081830.sql h1:/S7OQZo4ZnK80t28g/JyiOTZtmWG/dP5Wg2zXNMQ/iE=
|
20251107081830.sql h1:SAAe3lmsm9vGXuSEsDdl7ad0EAxP5CMmFRDEgp9M7yY=
|
||||||
20251107091033.sql h1:/cbkF1nO/IjNSIfDJJx456KJtQ9rWFXOBFAkR/M2xiE=
|
20251107091033.sql h1:JLdX/u7GUdBfjrPrMSNAqc8HtSoj0YA9iW9Vc6FJZdw=
|
||||||
20251107091209.sql h1:jrLQOUeV8ji2fg0pnEcs1bw4ANUxzTSMXC/rrHLIY+M=
|
20251107091209.sql h1:CzhYtwAwT+GHrbqcagnJE+v3mbl/rObf1IJaLCKlzrs=
|
||||||
20251107091541.sql h1:6UqbhQQRmzA2+eKu5lIvkwOkk+lH70QLZC8Pjpjcq68=
|
20251107091541.sql h1:+3ZyWJTftDY2JeWThXuIxGWpUBnyMPyOyY4jBjdWYJI=
|
||||||
20251110012217.sql h1:C9HpX0iyHzKjyNv/5DSAn2MCHj6MX4p5UQ/NrY7QD0w=
|
20251110012217.sql h1:f4Z8TuGc+XMSJ+Ekn4/PeHRE2FlHWkc5gKPJB0hAX7c=
|
||||||
20251110012306.sql h1:J54yb27d30LBbYp9n1P66gFVRlxPguKu0kxmWIBBG8g=
|
20251110012306.sql h1:ENPyI6Kjdk6qKJQb0yJ6MCTDPAmO1WD/uhKuCSl+jYo=
|
||||||
20251110052049.sql h1:232T2x8xTczJl9nk4jxJpZXhoOGYthhxjJ7nK8Jd8vg=
|
20251110052049.sql h1:OrQ0acnyoQLKnTitZfnBcVr5jDslF59OFLaqT7SpdVs=
|
||||||
20251110062042.sql h1:WnfVUXrzYoj8qdkkjO9/JQQ8agGd4GfSHQdMjo7LDAg=
|
20251110062042.sql h1:9KwldQt0NpVPR86L0T4hlkfHAGau+7CiZYgu5rF+yhg=
|
||||||
20251110063202.sql h1:hSzGfwVMWa6q3vwIQZUkxKgBNCzHjB+6GKy54zfV+oQ=
|
20251110063202.sql h1:A117DuZmZ6U0jWHA3DISnr+yvBjKIr1ObrUr047YezQ=
|
||||||
20251110063633.sql h1:/VpofIAqNS1CnazEnpW/+evbzn9Kew3xDW48r57M+Xg=
|
20251110063633.sql h1:qTiC0F19JnhUIXF4LGJQ21jEV6kKGyhTr1x2kimFqPQ=
|
||||||
20251110085551.sql h1:bFZwSmfvVbTUr/enWB82WqjG88gpqcZ6s45btUvO0uo=
|
20251110085551.sql h1:HZcJM0RSC6HBaUSjKBE8MgDG8Vn9f3LmwA/OnT9Cp7I=
|
||||||
20251110091516.sql h1:KkJMwPQuaZQhiqnKrNQrgP12gw9rV8T3P2o3mtGTcvY=
|
20251110091516.sql h1:W3AQhQLgirEWuCObbLl+Prdrbq6k6EEY1xcoWsmbog4=
|
||||||
20251110091948.sql h1:I4odAYrJdvNf1jPw6ppDC0XdI7v6vKBACg/ABwUgA7I=
|
20251110091948.sql h1:3tsITMrZr/T+L4wqUMz8sHS229jCJl4T0Nu3dMccxH8=
|
||||||
20251110092729.sql h1:l1out8soEmVP6dNjaIOtGYo6QDcoJZRI8X1sjZ5ZGmo=
|
20251110092729.sql h1:uU+k88RH/e0Ns4/SmJl03RVYPscBAPuiLfxR6CJqaf0=
|
||||||
20251110093522.sql h1:nsz8jCxGjEdr/bz9g+4ozfZzIP803xONjVmucad1GMc=
|
20251110093522.sql h1:O7upSj8VNjzvroL4IU59bfxKATOkAVGBArcUbVNq9aM=
|
||||||
20251110100258.sql h1:IBqt1VZj5WjQ+l9aAFGHOCCBtzb03KlLLihFLut7itg=
|
20251110100258.sql h1://JSArUMNI3/gAtYDx2VN94C198SFW0ANjgs+p6eCRM=
|
||||||
20251110100545.sql h1:6/LV7751iyKxE2xI6vO1zly+aHUwxXD/IBwLcVpKxqM=
|
20251110100545.sql h1:ENPOqeJYRpMI4e8VCKwaQgaql8se6pIidAhG2cjskBg=
|
||||||
20251110155448.sql h1:kFPobJB+cpflsXBAWUwy3lohuWvrb/VRlXnhJWl7i3Y=
|
20251110155448.sql h1:VW9KE0jxWy4flZ28sdXmhY6JWd6eKAX/cVL8KWRVii4=
|
||||||
20251111072601.sql h1:ch8F+yVhsSM5xY+TwMLY3PxdLa4Wuhtj76oyw79R7Js=
|
20251111072601.sql h1:99WWzGjcDDFNC2cHRfPu4MBLWNrgPMY5HAYUbmIcVRA=
|
||||||
20251111073546.sql h1:cCv0NPscADAOBahRVqtDWFs6G2t7n+4a+RwlF8vk/c4=
|
20251111073546.sql h1:iIGwFNfUgStdczw/PXTH3SD84xAyxrbZICofc3M8TMk=
|
||||||
20251111074148.sql h1:70TsV83u1gQ5TktI13K7NQiyCCa35Td2aR6CNtKUa4U=
|
20251111074148.sql h1:mzkezSKwCV2bTZ/0BHiTCX5qAy4uHpwar1xzwAH15Ko=
|
||||||
20251111074652.sql h1:ddfQ/sRKMezPM75xBFTGytUQX5AwZ3znrJVpg73gKPA=
|
20251111074652.sql h1:lYh4/3BHV24pgPC0pP4RUKb+XtL/6AsZGPItRpnzBiQ=
|
||||||
20251111082257.sql h1:ZsdLY1ROouos0l3oS0lkeSiuKLEUGbVvBhpcM2AVhkw=
|
20251111082257.sql h1:+cIZ1lf8HYGSL6t6U88plLKk8nOO1YVdV7h3YOM84ds=
|
||||||
20251111111017.sql h1:qrJ93dNtQwcuAvpsP/lAK/H63C4cinXrsVaPmWsTqkU=
|
20251111111017.sql h1:xzlhR2xLfOj4ddYlesS+bpEeDrxiAf5ILNOspsbZjBU=
|
||||||
20251113101344.sql h1:xaOZvAUP1fFfnO+syEFOzJUIg5lTfBe5AWHPbBWuCLA=
|
20251113101344.sql h1:vSzThY3p6XYTj0dJ2uFVkHmlytyrFAnGE58CJLx364I=
|
||||||
20251113120533.sql h1:f3/U1Ve2yF2zSMhkt+xtwF8wUYfUKYwgbNeGfE37EW4=
|
20251113120533.sql h1:lfjgdqRGo/EohrVw8sWlFbDjh3ASTsfQ6pr3qjafqvc=
|
||||||
20251114062746.sql h1:FInLaEFQByESEwFJKuKnuUSTKmcDpi3ZXaxkKwz2+D8=
|
20251114062746.sql h1:6DLYjfJ60PkAABZTXvOwSE+xrU25oyoX7gpYlBnA9cw=
|
||||||
20251117005942.sql h1:wD3BWrUSmo1HlW16V3lkaBkJvbAZ0fNk77te7J9NhOc=
|
20251117005942.sql h1:0XoJKca8IOaB9QKFVF/qPY7jKcIgh6m/LODQuE06SAs=
|
||||||
20251117075427.sql h1:TqU9VKZa3I8YNXUGQWY3WVBYN+1FvyyaKy0hB1jgAho=
|
20251117075427.sql h1:LhY2urosfoSu1/vkHmgsNP4JA4DuWBs9gL59yMqcF8M=
|
||||||
20251118074929.sql h1:p1KsWqCuR1JXA/jVO5BmOhCcaQ8clT7t0YRszAhPFbg=
|
20251118074929.sql h1:3RWBD6BziQVw6WSfthgoVuhTELHER9NrIuZm4hY/F1A=
|
||||||
20251119063438.sql h1:NVGM0X/LHD37EaPl8SNzkNiZDJ7AB1QR+LLwLh6WRdg=
|
20251119063438.sql h1:EVTG3ZrHjCmM95YPASZTRPiwHrG6e33A2vO4hLSAaBQ=
|
||||||
20251119065730.sql h1:U5lzk1WvMB0bw3kwckou7jkEt4bwdYItwHr2Vxqe7w4=
|
20251119065730.sql h1:s98wnZOCW6NbnwDS3H53XIQ60u6B9bDwBLNvy5+Rn64=
|
||||||
20251119072302.sql h1:qCuI2WMEMF/XNbjV+RXPjBnuCKLu1Fia+mR9HiLWBIs=
|
20251119072302.sql h1:ZL+VHekLYqgNtOFKlj02WHrAk11dtTxQkmyTKE8IOzY=
|
||||||
20251119072450.sql h1:Xg+bTwqGyKPNFEQhJylvpz1wifdfmDJvcAq6vmNf0Ng=
|
20251119072450.sql h1:SiJy2vpSvoPFw4J1SW7HjGSJzrqR62NsjRYAeabV+kc=
|
||||||
20251120005512.sql h1:Ek6qpacAI/qVuTYxKno+uJyzn7s5z9pf3t7VA8gTzm4=
|
20251120005512.sql h1:hJUaWXYJ3HiSquBTw8OKhymjA4O43ehAMGfiOY8W87Q=
|
||||||
20251120074415.sql h1:NNUeJVA03EeBHJhHqPXEZoDv/PnC6yK1/cRhmukyaJo=
|
20251120074415.sql h1:dNmcqZHqfZwi/wtYvO/pSFgImN2scXL0p/7g0+HLp0s=
|
||||||
20251121033803.sql h1:/vfvFX/3pzSCIHnSbMUT9EMBDykOpVkvyfeTEle9Vas=
|
20251121033803.sql h1:onlddYGo+tQdGaEdJPqdsx3sncGnwEvqMSCksF6vjjI=
|
||||||
20251124071457.sql h1:qg2dhCL9YwD13xnfJ175lW/p6MGfzFKaBqd908FByRc=
|
20251124071457.sql h1:ikQLIXFikUbkUd55uJBmEvqLGEC9t0db+Om4TQsWP7M=
|
||||||
20251125125303.sql h1:4JSFv1Pmhbe9tqpLXgO63OwYnGsalStgUXKVWPyc1YE=
|
20251125125303.sql h1:OLKbNPO36AHtIDursW9AeBvf60sahQKC1iOjHmpx0MA=
|
||||||
20251126064057.sql h1:vAdhz5Nn/gGJy0UKZAEldeXv8HpHtJU/t8ygDVIbTsU=
|
20251126064057.sql h1:6al3PTWbw/WGiBcrRrVWppOMLtG+eRaH/qSLbnmh1kQ=
|
||||||
20251201081333.sql h1:PoC8ADRdwDuohDTB74yW/DaB42igdYa4B6humbrEJBk=
|
20251201081333.sql h1:dD+jcisoUYnxRYWdtVcnxbDeYjUW12/R/qarYQr+utg=
|
||||||
20251201104439.sql h1:tpqdrOf9d2aGwZshqm62nG6SXnfVaO/g6A7z0efPS14=
|
20251201104439.sql h1:h4tz5uetbCKeOI3agSVmAeh6jUfECYy0LhQ7HooYhzg=
|
||||||
20251201113804.sql h1:kIEmVoETJXBkab2Q+b3y/pP84eF8W2BdQ47amHCnc+c=
|
20251201113804.sql h1:DdUzqfLdy4AUpVSRFDrIJXntGmtKgZrtvv8MAT4mMxs=
|
||||||
20251201113858.sql h1:KLXKZO5XTQPoEU0YLHE8Fhg9WPKpSN3wNgYPJ+RGFcg=
|
20251201113858.sql h1:XSpicm4aWjrfeY5EYIiw8Ios9v7BGfzZJxpW/57Qwqs=
|
||||||
20251201114751.sql h1:HM17diiPknfSHAmP+kJGP6GzToaPU9/NT+KQBpf3Jq0=
|
20251201114751.sql h1:qx+ShdHLacVFcRwwGrW1zMKFHOjMGdnusk7CEfyV8ig=
|
||||||
20251201114913.sql h1:gqucFgHFFLA6n/Rdz486cZH5xkaJuwefESLJMJLDue8=
|
20251201114913.sql h1:6l/m2/6fmTIjFmKio0QmB8oTwBDCHTIkbuYTODQ7Gwk=
|
||||||
20251202030445.sql h1:QWBVfTepT7DaXP5E0BYoxNM0JwKIQ2qIMXzI4kbz/qE=
|
20251202030445.sql h1:5+6ss5KdN6pll8Qtf0RGGyy/BURNO3dBgIBJOzDb624=
|
||||||
20251202044430.sql h1:4QZH9lz0GrQ9rzP1AJ+hJgGalNpp+8FCRckNK7xaTbU=
|
20251202044430.sql h1:nJtlQDGj7ZJtJ07NYcF41JCn9ck50GyDPoitTOe8P/s=
|
||||||
20251202064000.sql h1:/EN7sT1ol/91qW1aXWrzX+Mc3XOC/7f/LtfA0JRHpbg=
|
20251202063820.sql h1:dXGXAp2Aq1PUuwAT5FtBquZUeEv5Pdb81/bFt+KR274=
|
||||||
20251202130629.sql h1:9mvalqfhqGCdkcJepJDzHprU2xb0i5sYys1Htf62ioo=
|
20251202064000.sql h1:+W5j/AipU7qnFLCTaS7jVd/SIbIPo4k5rRScAvu0L44=
|
||||||
20251202160848.sql h1:Kd2/TziKSMezrt4XgbjQcYvY/Lo9rX0qw7/Lz0/oyKk=
|
20251202130629.sql h1:rB/+hjwgQnHoA/uOv4pJbB0iXAeaPMinlzRI/755raY=
|
||||||
20251202180207.sql h1:IHmSMIO3ia+YV5GULixbdlV1joaUAWtnjQHPd8+HKiM=
|
20251202160848.sql h1:KbTqHicChkfszdW9pQzoPlnvtECKDPmwpV3Rc7+5a8o=
|
||||||
20251202231005.sql h1:lua0KKoeBptSfs/6ehZE6Azo6YUlNkOJwGFyb1HQWkY=
|
20251202180207.sql h1:4DMAex+Go7MuMt15Di/J1C/ag15KwgWW1u8KDFmbJ9M=
|
||||||
20251203205052.sql h1:nk0VK2Uv4bHE3SBfHo/aevVZxtHzr7zAzvmMU8TCCtk=
|
20251202231005.sql h1:4GcnNRFZnjY1nASBj1IUkzLYCYIfnSE9s6kcWXZSiO8=
|
||||||
20251205073858.sql h1:46qqXnArgJmzGE/WO7v7Ev8Jh7BudDiGbdANexq/5Dk=
|
20251203205052.sql h1:0TZ4D3YKO2lmOAa60nhkJAQSx8QHgd+Zj4R39bPdU8Y=
|
||||||
20251205211957.sql h1:3fvtZ/mBWsTIXllXMFOuCLJsp4MivVP56dunehlU0yo=
|
20251205073858.sql h1:F4o2SDJ/deNjvKaimBGccZ9t4Fir01YocT6emhEoqiU=
|
||||||
20251205214433.sql h1:rn3++FEfX7ntcJcOmCEuOMnr27TZqH0KMGRppzFwFTc=
|
20251205211957.sql h1:rJLemdhIo7NQRgsl5DANVuz8pAee7HciyGVET7V/DMk=
|
||||||
20251205221124.sql h1:CRruUvGZqlVDBmbQSVEl4wFm+uq30AurMMDI6sb8jxg=
|
20251205214433.sql h1:1axU9bZaXW+sASNXQn08dKBX+fDEj1qHGiigEoJQXjY=
|
||||||
20251206021053.sql h1:bpuEocu4lOhZ7oLuxd//22dzjfNgU2iaWEqSD1mVwoU=
|
20251205221124.sql h1:TEy3NdLtM8+BkHwVT11kKvX3V28PP1bDMocZ0404Tm4=
|
||||||
20251207020537.sql h1:m6uh4NHVF3EKNTVMqOmuBSDFD9oCQk5mAwo05fT46G4=
|
20251206021053.sql h1:cEmwbMKPz8DY2OUsr3ym3blyp823418qMnx/AJFFYqY=
|
||||||
20251207212015.sql h1:UPelYGTeUR6rm8mU8dfNzgRDEDun0UQ4tkgsaDljn30=
|
20251207020537.sql h1:hCENQuZ6jXSp3LrmZ7FgLxvI1gJNgBa+F39/RosKfgk=
|
||||||
20251207221222.sql h1:bTfUCvCf2UPh+BA2IY2PHQafb9DwY9nhH5FRuMEHy+0=
|
20251207212015.sql h1:uhNmVl9qXZnqwy3GXfxh5JJjjXK4mztmL19ioezZwVQ=
|
||||||
20251209022744.sql h1:y5/PAiZH/fYCpDJpkQdNRJwWICHH2iNIwM1V+S1P6KA=
|
20251207221222.sql h1:QMxCwIwb4M9jA9z8BJ9aNsOcMVwuZ1ZSsx0FjOlQjek=
|
||||||
20251209025908.sql h1:p3kZA8kyEj+mQZSrdY3k2K1NojQzFJh/MlZJ0Oy6t/k=
|
20251209022744.sql h1:BBb5VV+hUGtKW+nZhu/C6OhBgiQhs84vMYfLM51V+VA=
|
||||||
20251209030538.sql h1:zltV6/Fu2zJW0/lVBl7MdnWuJcqNTUIRcqYYZ8Fi1wo=
|
20251209025908.sql h1:42z/3wPoOt/nkS92xZ9PHeu7m0IWgVICETkf6Ugtx7w=
|
||||||
20251209051742.sql h1:BBNSmWfkamWrcKdxWjPiBS9yJ8yyQQUQIj3kip53nuE=
|
20251209030538.sql h1:M2zy92ZTBTHLzbKs7cv1S5epLbJPQPVxME5E8nrPL2w=
|
||||||
20251209064304.sql h1:Xs73yQbuJvuQ0OnW1FAZpeytmUl/bGTlJFrwGOsTF4w=
|
20251209051742.sql h1:AKCu0xgzUlH5MjjBQLiHq6Gw54HA0j++Eknj1i6FHAw=
|
||||||
20251209070128.sql h1:fPGE6xOV6uCiVOqnvwn2L/GsBbgp2wxgmZOhF3bSGGM=
|
20251209064304.sql h1:MSMSfF2HVU7Qg/nyHmh89i7+oAj3V2wbPv/5AQcYNYM=
|
||||||
20251209084929.sql h1:u4LPMvkGAH4RfGC2IlBTIm7T7paMHoBSvTQ0w5Br7d0=
|
20251209070128.sql h1:CU3U33jEhzNFa2yc7aBGHv/XcyFEHRkjHUJFLTKZRjc=
|
||||||
20251210145148.sql h1:rejGrnTpaygxPv06v0vxMytF4rk1OJBXaw3ttSmidgc=
|
20251209084929.sql h1:5H1z+0hOmDHQastabHLaxN5d6YWiD2p4+nUf1Fmthrc=
|
||||||
20251211101547.sql h1:+jT5yRCEsSRExzoawrqymS/I7lVfwUQQSgSzbxCxgRk=
|
20251210145148.sql h1:tAs3iNEHnASYEQ4/h8XDXmKPvVASgfP6oTjnFdmBqFA=
|
||||||
20251211113942.sql h1:F8go8XaJf4GFa4RuoMlo4U/NtbDtbDkVYHZOJz7GYhM=
|
20251211101547.sql h1:hGxvjf2XLoHJIQQlCoSOgqOrIkGjk1A7CLdDV1R4pgc=
|
||||||
|
20251211113942.sql h1:uxNunwWePW7UpR+8KtdvqQ4mUofJascWOOUEyRCKIEI=
|
||||||
|
20251216074834.sql h1:jja2bz2dtaC4327V2iqs9LP7MsW6ycz68BM0KPld9xs=
|
||||||
@@ -5,23 +5,9 @@ appCfg:
|
|||||||
env: development
|
env: development
|
||||||
lang: en
|
lang: en
|
||||||
|
|
||||||
dbCfg:
|
|
||||||
dsn:
|
|
||||||
maxOpenConns: 5
|
|
||||||
maxIdleConns: 5
|
|
||||||
maxIdleTime: 100
|
|
||||||
|
|
||||||
multiDbCfg:
|
|
||||||
dbs :
|
|
||||||
- name: simrs_sync
|
|
||||||
dsn:
|
|
||||||
maxOpenConns: 5
|
|
||||||
maxIdleConns: 5
|
|
||||||
maxIdleTime: 100
|
|
||||||
|
|
||||||
httpCfg:
|
httpCfg:
|
||||||
host: 127.0.0.1
|
host: 127.0.0.1
|
||||||
port: 8002
|
port: 8009
|
||||||
|
|
||||||
loggerCfg:
|
loggerCfg:
|
||||||
hideTime: true
|
hideTime: true
|
||||||
@@ -32,6 +18,25 @@ langCfg:
|
|||||||
path: ../../assets/language/en
|
path: ../../assets/language/en
|
||||||
fileName: data.json
|
fileName: data.json
|
||||||
|
|
||||||
|
dbCfg:
|
||||||
|
dsn: host=simrs-x-main-db user=user password=password dbname=simrs-sync port=5439 sslmode=disable TimeZone=Asia/Jakarta
|
||||||
|
maxOpenConns: 5
|
||||||
|
maxIdleConns: 5
|
||||||
|
maxIdleTime: 100
|
||||||
|
|
||||||
|
multiDbCfg:
|
||||||
|
dbs :
|
||||||
|
- name: simrs
|
||||||
|
dsn: postgres://simrs:[email protected]/simrs?sslmode=disable
|
||||||
|
maxOpenConns: 5
|
||||||
|
maxIdleConns: 5
|
||||||
|
maxIdleTime: 100
|
||||||
|
- name: satu
|
||||||
|
dsn: postgres://postgres:[email protected]:5023/satu_db?sslmode=disable
|
||||||
|
maxOpenConns: 5
|
||||||
|
maxIdleConns: 5
|
||||||
|
maxIdleTime: 100
|
||||||
|
|
||||||
corsCfg:
|
corsCfg:
|
||||||
allowedOrigin:
|
allowedOrigin:
|
||||||
allowedMethod: GET, POST, PUT, PATCH, DELETE, OPTIONS
|
allowedMethod: GET, POST, PUT, PATCH, DELETE, OPTIONS
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
appCfg:
|
||||||
|
fullName: SIMRS Sync
|
||||||
|
codeName: simrs-sync
|
||||||
|
version: 0.1.0
|
||||||
|
env: development
|
||||||
|
lang: en
|
||||||
|
|
||||||
|
httpCfg:
|
||||||
|
host: 0.0.0.0
|
||||||
|
port: 8009
|
||||||
|
|
||||||
|
loggerCfg:
|
||||||
|
hideTime: true
|
||||||
|
hideLevel: true
|
||||||
|
|
||||||
|
langCfg:
|
||||||
|
active: en
|
||||||
|
path: assets/language/en
|
||||||
|
fileName: data.json
|
||||||
|
|
||||||
|
dbCfg:
|
||||||
|
dsn: host=simrs-x-sync-db user=rssa password=Th3-N3xt-Level-C0d3 dbname=default port=5432 sslmode=disable TimeZone=Asia/Jakarta
|
||||||
|
maxOpenConns: 5
|
||||||
|
maxIdleConns: 5
|
||||||
|
maxIdleTime: 100
|
||||||
|
|
||||||
|
multiDbCfg:
|
||||||
|
dbs :
|
||||||
|
- name: simrs
|
||||||
|
dsn: postgres://simrs:[email protected]/simrs?sslmode=disable
|
||||||
|
maxOpenConns: 5
|
||||||
|
maxIdleConns: 5
|
||||||
|
maxIdleTime: 100
|
||||||
|
- name: satu
|
||||||
|
dsn: postgres://postgres:[email protected]:5023/satu_db?sslmode=disable
|
||||||
|
maxOpenConns: 5
|
||||||
|
maxIdleConns: 5
|
||||||
|
maxIdleTime: 100
|
||||||
|
|
||||||
|
corsCfg:
|
||||||
|
allowedOrigin:
|
||||||
|
allowedMethod: GET, POST, PUT, PATCH, DELETE, OPTIONS
|
||||||
|
|
||||||
|
syncPartnerCfg:
|
||||||
|
oldSource:
|
||||||
|
oldSecretKey:
|
||||||
|
oldHost:
|
||||||
|
newSource:
|
||||||
|
newSecretKey:
|
||||||
|
newHost:
|
||||||
+2
-2
@@ -9,11 +9,11 @@ data "external_schema" "gorm" {
|
|||||||
|
|
||||||
env "gorm" {
|
env "gorm" {
|
||||||
src = data.external_schema.gorm.url
|
src = data.external_schema.gorm.url
|
||||||
dev = "" // dsn db to check the diff
|
dev = "postgresql://user:password@localhost:5439/dev?sslmode=disable" // dsn db to check the diff
|
||||||
migration {
|
migration {
|
||||||
dir = "file://migrations"
|
dir = "file://migrations"
|
||||||
}
|
}
|
||||||
url = "" // dsn db to apply
|
url = "postgresql://user:password@localhost:5439/simrs-sync?sslmode=disable" // dsn db to apply
|
||||||
format {
|
format {
|
||||||
migrate {
|
migrate {
|
||||||
diff = "{{ sql . \" \" }}"
|
diff = "{{ sql . \" \" }}"
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
data "external_schema" "gorm" {
|
||||||
|
program = [
|
||||||
|
"go",
|
||||||
|
"run",
|
||||||
|
"-mod=mod",
|
||||||
|
".",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
env "gorm" {
|
||||||
|
src = data.external_schema.gorm.url
|
||||||
|
dev = "postgresql://user:password@simrs-x-sync-db:5432/dev?sslmode=disable" // dsn db to check the diff
|
||||||
|
migration {
|
||||||
|
dir = "file://migrations"
|
||||||
|
}
|
||||||
|
url = "postgresql://user:password@simrs-x-sync-db:5432/default?sslmode=disable" // dsn db to apply
|
||||||
|
format {
|
||||||
|
migrate {
|
||||||
|
diff = "{{ sql . \" \" }}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -13,7 +13,7 @@ require (
|
|||||||
github.com/jackc/pgx/v5 v5.5.5
|
github.com/jackc/pgx/v5 v5.5.5
|
||||||
github.com/karincake/apem v0.0.17
|
github.com/karincake/apem v0.0.17
|
||||||
github.com/karincake/dodol v0.0.1
|
github.com/karincake/dodol v0.0.1
|
||||||
github.com/karincake/getuk v0.3.1
|
github.com/karincake/getuk v0.3.2
|
||||||
github.com/karincake/hongkue v0.0.4
|
github.com/karincake/hongkue v0.0.4
|
||||||
github.com/karincake/lepet v0.0.1
|
github.com/karincake/lepet v0.0.1
|
||||||
github.com/karincake/risoles v0.0.3
|
github.com/karincake/risoles v0.0.3
|
||||||
|
|||||||
@@ -81,8 +81,8 @@ github.com/karincake/apem v0.0.17 h1:y3WXCr9GWLFFFH4Qyq/VWlWWpijHh5zpTc3Lm96twa4
|
|||||||
github.com/karincake/apem v0.0.17/go.mod h1:cQP2sJfDrLRIiwWoaLWw/z8uAya+DWu/FpmYeinMQXM=
|
github.com/karincake/apem v0.0.17/go.mod h1:cQP2sJfDrLRIiwWoaLWw/z8uAya+DWu/FpmYeinMQXM=
|
||||||
github.com/karincake/dodol v0.0.1 h1:jUXmJh1r0Ei4fmHPZ6IUkoplW/V9d27L63JEl6zudL0=
|
github.com/karincake/dodol v0.0.1 h1:jUXmJh1r0Ei4fmHPZ6IUkoplW/V9d27L63JEl6zudL0=
|
||||||
github.com/karincake/dodol v0.0.1/go.mod h1:2f1NcvkvY0J3GMUkwILNDYVvRUpz0W3lpPp/Ha/Ld24=
|
github.com/karincake/dodol v0.0.1/go.mod h1:2f1NcvkvY0J3GMUkwILNDYVvRUpz0W3lpPp/Ha/Ld24=
|
||||||
github.com/karincake/getuk v0.3.1 h1:yRqBTrwpnjYcZD3gPDoSxFlsLgI9/GKCr3ZCsS4TtYQ=
|
github.com/karincake/getuk v0.3.2 h1:Qe+PRQ2qdgdiJlWiVEq37N8rrgS654nUnY0PWS6pMzA=
|
||||||
github.com/karincake/getuk v0.3.1/go.mod h1:NVnvxSGAkQ/xuq99FzWACvY5efyKPLFla1cKB8czm7c=
|
github.com/karincake/getuk v0.3.2/go.mod h1:nFl133aKQqxRbe5q9lo8q7BxlYBavmbkpglBhq/dNWk=
|
||||||
github.com/karincake/hongkue v0.0.4 h1:oWthq6cDg5DvDm1Z3e7mCLOATQf+oAdtHxN9OPnCfA8=
|
github.com/karincake/hongkue v0.0.4 h1:oWthq6cDg5DvDm1Z3e7mCLOATQf+oAdtHxN9OPnCfA8=
|
||||||
github.com/karincake/hongkue v0.0.4/go.mod h1:YVi5Lyh3DE+GRHx2OSODOr7FwvLi8U4idvcPHO7yeag=
|
github.com/karincake/hongkue v0.0.4/go.mod h1:YVi5Lyh3DE+GRHx2OSODOr7FwvLi8U4idvcPHO7yeag=
|
||||||
github.com/karincake/lepet v0.0.1 h1:eq/cwn5BBg0jWZ1c/MmvhFIBma0zBpVs2LwkfDOncy4=
|
github.com/karincake/lepet v0.0.1 h1:eq/cwn5BBg0jWZ1c/MmvhFIBma0zBpVs2LwkfDOncy4=
|
||||||
|
|||||||
@@ -40,8 +40,9 @@ type UpdateDto struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type DeleteDto struct {
|
type DeleteDto struct {
|
||||||
Id uint `json:"id"`
|
Id uint `json:"id"`
|
||||||
Number *string `json:"number"`
|
Number *string `json:"number"`
|
||||||
|
RequestPayload string `json:"requestPayload" validate:"maxLength=1024"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type MetaDto struct {
|
type MetaDto struct {
|
||||||
@@ -52,10 +53,11 @@ type MetaDto struct {
|
|||||||
|
|
||||||
type ResponseDto struct {
|
type ResponseDto struct {
|
||||||
ecore.Main
|
ecore.Main
|
||||||
VclaimSep_Number *string `json:"vclaimSep_number"`
|
VclaimSep_Number *string `json:"vclaimSep_number"`
|
||||||
Number *string `json:"number"`
|
Number *string `json:"number"`
|
||||||
Value *string `json:"value"`
|
Value *string `json:"value"`
|
||||||
FileUrl *string `json:"fileUrl"`
|
FileUrl *string `json:"fileUrl"`
|
||||||
|
Detail *FullResponse `json:"detail,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d VclaimSepControlLetter) ToResponse() ResponseDto {
|
func (d VclaimSepControlLetter) ToResponse() ResponseDto {
|
||||||
@@ -64,6 +66,7 @@ func (d VclaimSepControlLetter) ToResponse() ResponseDto {
|
|||||||
Number: d.Number,
|
Number: d.Number,
|
||||||
Value: d.Value,
|
Value: d.Value,
|
||||||
FileUrl: d.FileUrl,
|
FileUrl: d.FileUrl,
|
||||||
|
Detail: d.Detail,
|
||||||
}
|
}
|
||||||
resp.Main = d.Main
|
resp.Main = d.Main
|
||||||
return resp
|
return resp
|
||||||
@@ -77,6 +80,15 @@ func ToResponseList(data []VclaimSepControlLetter) []ResponseDto {
|
|||||||
return resp
|
return resp
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (d DeleteDto) RequestPayloadIntoJson() ([]byte, error) {
|
||||||
|
payload := map[string]interface{}{}
|
||||||
|
err := json.Unmarshal([]byte(d.RequestPayload), &payload)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return json.Marshal(payload)
|
||||||
|
}
|
||||||
|
|
||||||
func (c CreateDto) RequestPayloadIntoJson() ([]byte, error) {
|
func (c CreateDto) RequestPayloadIntoJson() ([]byte, error) {
|
||||||
payload := map[string]interface{}{}
|
payload := map[string]interface{}{}
|
||||||
err := json.Unmarshal([]byte(c.RequestPayload), &payload)
|
err := json.Unmarshal([]byte(c.RequestPayload), &payload)
|
||||||
@@ -122,3 +134,154 @@ func (v ResponseForPDF) GenerateBirthDate() string {
|
|||||||
t, _ := time.Parse("2006-01-02", v.VclaimSep.VclaimMember.BirthDate)
|
t, _ := time.Parse("2006-01-02", v.VclaimSep.VclaimMember.BirthDate)
|
||||||
return pu.FormatIndonesianDate(t)
|
return pu.FormatIndonesianDate(t)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type SuratKontrol struct {
|
||||||
|
NoSuratKontrol string `json:"noSuratKontrol"`
|
||||||
|
TglRencanaKontrol string `json:"tglRencanaKontrol"`
|
||||||
|
TglTerbit string `json:"tglTerbit"`
|
||||||
|
JnsKontrol string `json:"jnsKontrol"`
|
||||||
|
PoliTujuan string `json:"poliTujuan"`
|
||||||
|
NamaPoliTujuan string `json:"namaPoliTujuan"`
|
||||||
|
KodeDokter string `json:"kodeDokter"`
|
||||||
|
NamaDokter string `json:"namaDokter"`
|
||||||
|
FlagKontrol string `json:"flagKontrol"`
|
||||||
|
KodeDokterPembuat *string `json:"kodeDokterPembuat"`
|
||||||
|
NamaDokterPembuat *string `json:"namaDokterPembuat"`
|
||||||
|
NamaJnsKontrol string `json:"namaJnsKontrol"`
|
||||||
|
Sep Sep `json:"sep"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type Sep struct {
|
||||||
|
NoSep string `json:"noSep"`
|
||||||
|
TglSep string `json:"tglSep"`
|
||||||
|
JnsPelayanan string `json:"jnsPelayanan"`
|
||||||
|
Poli string `json:"poli"`
|
||||||
|
Diagnosa string `json:"diagnosa"`
|
||||||
|
Peserta Peserta `json:"peserta"`
|
||||||
|
ProvUmum ProvUmum `json:"provUmum"`
|
||||||
|
ProvPerujuk ProvPerujuk `json:"provPerujuk"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type Peserta struct {
|
||||||
|
NoKartu string `json:"noKartu"`
|
||||||
|
Nama string `json:"nama"`
|
||||||
|
TglLahir string `json:"tglLahir"`
|
||||||
|
Kelamin string `json:"kelamin"`
|
||||||
|
HakKelas string `json:"hakKelas"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ProvUmum struct {
|
||||||
|
KdProvider string `json:"kdProvider"`
|
||||||
|
NmProvider string `json:"nmProvider"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ProvPerujuk struct {
|
||||||
|
KdProviderPerujuk string `json:"kdProviderPerujuk"`
|
||||||
|
NmProviderPerujuk string `json:"nmProviderPerujuk"`
|
||||||
|
AsalRujukan string `json:"asalRujukan"`
|
||||||
|
NoRujukan string `json:"noRujukan"`
|
||||||
|
TglRujukan string `json:"tglRujukan"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type VclaimResponse struct {
|
||||||
|
MetaData MetaData `json:"metaData"`
|
||||||
|
Response *SuratKontrol `json:"response"` // nullable
|
||||||
|
}
|
||||||
|
|
||||||
|
type DetailVclaimResponse struct {
|
||||||
|
MetaData MetaData `json:"metaData"`
|
||||||
|
Response *FullResponse `json:"response"` // nullable
|
||||||
|
}
|
||||||
|
|
||||||
|
type MetaData struct {
|
||||||
|
Code string `json:"code"`
|
||||||
|
Message string `json:"message"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r VclaimResponse) ToPDFNeeds() ([]byte, error) {
|
||||||
|
response := ResponseForPDF{
|
||||||
|
Number: r.Response.Sep.NoSep,
|
||||||
|
PlannedControlDate: r.Response.TglRencanaKontrol,
|
||||||
|
IssuedDate: r.Response.TglTerbit,
|
||||||
|
Doctor_Name: r.Response.NamaDokter,
|
||||||
|
DstUnit_Name: r.Response.NamaPoliTujuan,
|
||||||
|
ResponsibleDoctor_Name: *r.Response.NamaDokterPembuat,
|
||||||
|
VclaimSep: VclaimSep{
|
||||||
|
VclaimMember: VclaimMember{
|
||||||
|
CardNumber: r.Response.Sep.Peserta.NoKartu,
|
||||||
|
Name: r.Response.Sep.Peserta.Nama,
|
||||||
|
BirthDate: r.Response.Sep.Peserta.TglLahir,
|
||||||
|
Gender: r.Response.Sep.Peserta.Kelamin,
|
||||||
|
},
|
||||||
|
Diagnose: r.Response.Sep.Diagnosa,
|
||||||
|
Number: r.Response.Sep.NoSep,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
return json.Marshal(response)
|
||||||
|
}
|
||||||
|
|
||||||
|
type FullResponse struct {
|
||||||
|
NoSuratKontrol string `json:"noSuratKontrol"`
|
||||||
|
TglRencanaKontrol string `json:"tglRencanaKontrol"`
|
||||||
|
TglTerbit string `json:"tglTerbit"`
|
||||||
|
JnsKontrol string `json:"jnsKontrol"`
|
||||||
|
PoliTujuan string `json:"poliTujuan"`
|
||||||
|
NamaPoliTujuan string `json:"namaPoliTujuan"`
|
||||||
|
KodeDokter string `json:"kodeDokter"`
|
||||||
|
NamaDokter string `json:"namaDokter"`
|
||||||
|
FlagKontrol string `json:"flagKontrol"`
|
||||||
|
KodeDokterPembuat string `json:"kodeDokterPembuat"`
|
||||||
|
NamaDokterPembuat string `json:"namaDokterPembuat"`
|
||||||
|
NamaJnsKontrol string `json:"namaJnsKontrol"`
|
||||||
|
Sep Sep `json:"sep"`
|
||||||
|
FormPRB FormPRB `json:"formPRB"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type Provider struct {
|
||||||
|
KdProvider string `json:"kdProvider"`
|
||||||
|
NmProvider string `json:"nmProvider"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type FormPRB struct {
|
||||||
|
KdStatusPRB *string `json:"kdStatusPRB"`
|
||||||
|
Data PRBData `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type PRBData struct {
|
||||||
|
HBA1C *string `json:"HBA1C"`
|
||||||
|
GDP *string `json:"GDP"`
|
||||||
|
GD2JPP *string `json:"GD2JPP"`
|
||||||
|
EGFR *string `json:"eGFR"`
|
||||||
|
TD_Sistolik *string `json:"TD_Sistolik"`
|
||||||
|
TD_Diastolik *string `json:"TD_Diastolik"`
|
||||||
|
LDL *string `json:"LDL"`
|
||||||
|
Rata_TD_Sistolik *string `json:"Rata_TD_Sistolik"`
|
||||||
|
Rata_TD_Diastolik *string `json:"Rata_TD_Diastolik"`
|
||||||
|
JantungKoroner *string `json:"JantungKoroner"`
|
||||||
|
Stroke *string `json:"Stroke"`
|
||||||
|
VaskularPerifer *string `json:"VaskularPerifer"`
|
||||||
|
Aritmia *string `json:"Aritmia"`
|
||||||
|
AtrialFibrilasi *string `json:"AtrialFibrilasi"`
|
||||||
|
SesakNapas3Bulan *string `json:"SesakNapas3Bulan"`
|
||||||
|
NyeriDada3Bulan *string `json:"NyeriDada3Bulan"`
|
||||||
|
Terkontrol *string `json:"Terkontrol"`
|
||||||
|
Gejala2xMinggu *string `json:"Gejala2xMinggu"`
|
||||||
|
BangunMalam *string `json:"BangunMalam"`
|
||||||
|
KeterbatasanFisik *string `json:"KeterbatasanFisik"`
|
||||||
|
FungsiParu *string `json:"FungsiParu"`
|
||||||
|
SkorMMRC *string `json:"SkorMMRC"`
|
||||||
|
Eksaserbasi1Tahun *string `json:"Eksaserbasi1Tahun"`
|
||||||
|
MampuAktivitas *string `json:"MampuAktivitas"`
|
||||||
|
Epileptik6Bulan *string `json:"Epileptik6Bulan"`
|
||||||
|
EfekSampingOAB *string `json:"EfekSampingOAB"`
|
||||||
|
HamilMenyusui *string `json:"HamilMenyusui"`
|
||||||
|
Remisi *string `json:"Remisi"`
|
||||||
|
TerapiRumatan *string `json:"TerapiRumatan"`
|
||||||
|
Usia *string `json:"Usia"`
|
||||||
|
AsamUrat *string `json:"AsamUrat"`
|
||||||
|
RemisiSLE *string `json:"RemisiSLE"`
|
||||||
|
Hamil *string `json:"Hamil"`
|
||||||
|
NadiIstirahat *string `json:"NadiIstirahat"`
|
||||||
|
SesakNapasAktivitas *string `json:"SesakNapasAktivitas"`
|
||||||
|
NyeriDadaAktivitas *string `json:"NyeriDadaAktivitas"`
|
||||||
|
}
|
||||||
@@ -10,4 +10,6 @@ type VclaimSepControlLetter struct {
|
|||||||
Number *string `json:"number" gorm:"unique;size:20"`
|
Number *string `json:"number" gorm:"unique;size:20"`
|
||||||
Value *string `json:"value"`
|
Value *string `json:"value"`
|
||||||
FileUrl *string `json:"fileUrl" gorm:"unique;size:1024"`
|
FileUrl *string `json:"fileUrl" gorm:"unique;size:1024"`
|
||||||
|
|
||||||
|
Detail *FullResponse `json:"detail,omitempty" gorm:"-"`
|
||||||
}
|
}
|
||||||
@@ -11,13 +11,14 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type CreateDto struct {
|
type CreateDto struct {
|
||||||
Parent_Id *uint `json:"parent_id"`
|
Parent_Id *uint `json:"parent_id"`
|
||||||
SeriesNumber *uint16 `json:"seriesNumber"`
|
SeriesNumber *uint16 `json:"seriesNumber"`
|
||||||
CycleNumber *uint `json:"cycleNumber"`
|
CycleNumber *uint `json:"cycleNumber"`
|
||||||
PlanDate *time.Time `json:"planDate"`
|
PlanDate *time.Time `json:"planDate"`
|
||||||
RealizationDate *time.Time `json:"realizationDate"`
|
RealizationDate *time.Time `json:"realizationDate"`
|
||||||
Notes *string `json:"notes"`
|
Notes *string `json:"notes"`
|
||||||
Status ere.StatusProtocolChemo `json:"status"`
|
Status *ere.StatusProtocolChemo `json:"status"`
|
||||||
|
Encounter_Id *uint `json:"encounter_id"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ReadListDto struct {
|
type ReadListDto struct {
|
||||||
@@ -32,17 +33,27 @@ type FilterDto struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ReadDetailDto struct {
|
type ReadDetailDto struct {
|
||||||
Id uint16 `json:"id"`
|
Id uint `json:"id"`
|
||||||
Includes string `json:"includes"`
|
Includes string `json:"includes"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type UpdateDto struct {
|
type UpdateDto struct {
|
||||||
Id uint16 `json:"id"`
|
Id uint `json:"id"`
|
||||||
CreateDto
|
CreateDto
|
||||||
}
|
}
|
||||||
|
|
||||||
type DeleteDto struct {
|
type DeleteDto struct {
|
||||||
Id uint16 `json:"id"`
|
Id uint `json:"id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type FailDto struct {
|
||||||
|
Id uint `json:"id"`
|
||||||
|
Reasons string `json:"reasons" validate:"required"`
|
||||||
|
}
|
||||||
|
type FailReason struct {
|
||||||
|
Date *time.Time `json:"date"`
|
||||||
|
FailReason string `json:"failReason"`
|
||||||
|
Encounter_Id *uint `json:"encounter_id"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type MetaDto struct {
|
type MetaDto struct {
|
||||||
@@ -53,15 +64,15 @@ type MetaDto struct {
|
|||||||
|
|
||||||
type ResponseDto struct {
|
type ResponseDto struct {
|
||||||
ecore.Main
|
ecore.Main
|
||||||
Parent_Id *uint `json:"parent_id"` // chemo.Id
|
Parent_Id *uint `json:"parent_id"` // chemo.Id
|
||||||
Protocol_Id *uint `json:"protocol_id"`
|
Protocol_Id *uint `json:"protocol_id"`
|
||||||
SeriesNumber *uint16 `json:"seriesNumber"` // series ke -
|
SeriesNumber *uint16 `json:"seriesNumber"` // series ke -
|
||||||
CycleNumber *uint `json:"cycleNumber"` // cycle ke -
|
CycleNumber *uint `json:"cycleNumber"` // cycle ke -
|
||||||
PlanDate *time.Time `json:"planDate"`
|
PlanDate *time.Time `json:"planDate"`
|
||||||
RealizationDate *time.Time `json:"realizationDate"`
|
RealizationDate *time.Time `json:"realizationDate"`
|
||||||
Notes *string `json:"notes"`
|
Notes *string `json:"notes"`
|
||||||
Status ere.StatusProtocolChemo `json:"status"`
|
Status *ere.StatusProtocolChemo `json:"status"`
|
||||||
Reasons *string `json:"reasons"`
|
Reasons *string `json:"reasons"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d ChemoPlan) ToResponse() ResponseDto {
|
func (d ChemoPlan) ToResponse() ResponseDto {
|
||||||
|
|||||||
@@ -11,15 +11,15 @@ import (
|
|||||||
|
|
||||||
type ChemoPlan struct {
|
type ChemoPlan struct {
|
||||||
ecore.Main
|
ecore.Main
|
||||||
Parent_Id *uint `json:"parent_id"` // chemo.Id
|
Parent_Id *uint `json:"parent_id"` // chemo.Id
|
||||||
Protocol_Id *uint `json:"protocol_id"`
|
Protocol_Id *uint `json:"protocol_id"`
|
||||||
SeriesNumber *uint16 `json:"seriesNumber"` // series ke -
|
SeriesNumber *uint16 `json:"seriesNumber"` // series ke -
|
||||||
CycleNumber *uint `json:"cycleNumber"` // cycle ke -
|
CycleNumber *uint `json:"cycleNumber"` // cycle ke -
|
||||||
PlanDate *time.Time `json:"planDate"`
|
PlanDate *time.Time `json:"planDate"`
|
||||||
RealizationDate *time.Time `json:"realizationDate"`
|
RealizationDate *time.Time `json:"realizationDate"`
|
||||||
Notes *string `json:"notes"`
|
Notes *string `json:"notes"`
|
||||||
Status ere.StatusProtocolChemo `json:"status"`
|
Status *ere.StatusProtocolChemo `json:"status"`
|
||||||
Encounter_Id *uint `json:"encounter_id"`
|
Encounter_Id *uint `json:"encounter_id"`
|
||||||
Encounter *ee.Encounter `json:"encounter,omitempty" gorm:"foreignKey:Encounter_Id;references:Id"`
|
Encounter *ee.Encounter `json:"encounter,omitempty" gorm:"foreignKey:Encounter_Id;references:Id"`
|
||||||
Reasons *string `json:"reasons"` // json
|
Reasons *string `json:"reasons"` // json
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
package chemo_protocol
|
package chemo_protocol
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
eus "simrs-vx/internal/domain/main-entities/user"
|
||||||
|
pa "simrs-vx/internal/lib/auth"
|
||||||
// std
|
// std
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@@ -11,19 +13,25 @@ import (
|
|||||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||||
|
|
||||||
ec "simrs-vx/internal/domain/main-entities/chemo"
|
ec "simrs-vx/internal/domain/main-entities/chemo"
|
||||||
|
ep "simrs-vx/internal/domain/main-entities/chemo-plan"
|
||||||
)
|
)
|
||||||
|
|
||||||
type CreateDto struct {
|
type CreateDto struct {
|
||||||
Chemo_Id *uint `json:"chemo_id"`
|
Encounter_Id *uint `json:"encounter_id" validate:"required"`
|
||||||
Patient_Weight *float32 `json:"patient_weight"`
|
Chemo_Id *uint `json:"chemo_id" validate:"required"`
|
||||||
Patient_Height *float32 `json:"patient_height"`
|
Patient_Weight *float32 `json:"patient_weight"`
|
||||||
Diagnoses *string `json:"diagnoses"`
|
Patient_Height *float32 `json:"patient_height"`
|
||||||
Interval *uint `json:"interval"`
|
Diagnoses *string `json:"diagnoses" validate:"required"`
|
||||||
Cycle *uint `json:"cycle"`
|
Interval *uint `json:"interval" validate:"required"`
|
||||||
Series *uint16 `json:"series"`
|
Cycle *uint `json:"cycle" validate:"required"`
|
||||||
StartDate *time.Time `json:"startDate"`
|
Series *uint16 `json:"series" validate:"required"`
|
||||||
EndDate *time.Time `json:"endDate"`
|
StartDate *time.Time `json:"startDate"`
|
||||||
Status_Code erc.DataVerifiedCode `json:"-"`
|
EndDate *time.Time `json:"endDate"`
|
||||||
|
Patient_Id *uint `json:"patient_id"`
|
||||||
|
ChemoPlans *[]ep.CreateDto `json:"chemoPlans" validate:"required"`
|
||||||
|
|
||||||
|
Id *uint `json:"-"`
|
||||||
|
Status_Code erc.DataVerifiedCode `json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ReadListDto struct {
|
type ReadListDto struct {
|
||||||
@@ -33,21 +41,29 @@ type ReadListDto struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type FilterDto struct {
|
type FilterDto struct {
|
||||||
Chemo_Id *uint `json:"chemo-id"`
|
Chemo_Id *uint `json:"chemo-id"`
|
||||||
|
Patient_Id *uint `json:"patient-id"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ReadDetailDto struct {
|
type ReadDetailDto struct {
|
||||||
Id uint16 `json:"id"`
|
Id uint `json:"id"`
|
||||||
Includes string `json:"includes"`
|
Includes string `json:"includes"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type UpdateDto struct {
|
type UpdateDto struct {
|
||||||
Id uint16 `json:"id"`
|
Id uint `json:"id"`
|
||||||
CreateDto
|
CreateDto
|
||||||
}
|
}
|
||||||
|
|
||||||
type DeleteDto struct {
|
type DeleteDto struct {
|
||||||
Id uint16 `json:"id"`
|
Id uint `json:"id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type VerifyDto struct {
|
||||||
|
Id uint `json:"id"`
|
||||||
|
Status_Code erc.DataVerifiedCode `json:"-"`
|
||||||
|
|
||||||
|
pa.AuthInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
type MetaDto struct {
|
type MetaDto struct {
|
||||||
@@ -58,32 +74,42 @@ type MetaDto struct {
|
|||||||
|
|
||||||
type ResponseDto struct {
|
type ResponseDto struct {
|
||||||
ecore.Main
|
ecore.Main
|
||||||
Chemo_Id *uint `json:"chemo_id"`
|
Chemo_Id *uint `json:"chemo_id"`
|
||||||
Chemo *ec.Chemo `json:"chemo,omitempty"`
|
Chemo *ec.Chemo `json:"chemo,omitempty"`
|
||||||
Patient_Weight *float32 `json:"patient_weight"`
|
Patient_Weight *float32 `json:"patient_weight"`
|
||||||
Patient_Height *float32 `json:"patient_height"`
|
Patient_Height *float32 `json:"patient_height"`
|
||||||
Diagnoses *string `json:"diagnoses"`
|
Diagnoses *string `json:"diagnoses"`
|
||||||
Interval *uint `json:"interval"`
|
Interval *uint `json:"interval"`
|
||||||
Cycle *uint `json:"cycle"`
|
Cycle *uint `json:"cycle"`
|
||||||
Series *uint16 `json:"series"`
|
Series *uint16 `json:"series"`
|
||||||
StartDate *time.Time `json:"startDate"`
|
StartDate *time.Time `json:"startDate"`
|
||||||
EndDate *time.Time `json:"endDate"`
|
EndDate *time.Time `json:"endDate"`
|
||||||
Status_Code erc.DataVerifiedCode `json:"status_code"`
|
Status_Code erc.DataVerifiedCode `json:"status_code"`
|
||||||
|
VerifiedAt *time.Time `json:"verifiedAt"`
|
||||||
|
VerifiedBy_User_Id *uint `json:"verifiedBy_user_id"`
|
||||||
|
VerifiedBy *eus.User `json:"verifiedBy,omitempty"`
|
||||||
|
ChemoPlans *[]ep.ChemoPlan `json:"chemoPlans,omitempty"`
|
||||||
|
Patient_Id *uint `json:"patient_id"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d ChemoProtocol) ToResponse() ResponseDto {
|
func (d ChemoProtocol) ToResponse() ResponseDto {
|
||||||
resp := ResponseDto{
|
resp := ResponseDto{
|
||||||
Chemo_Id: d.Chemo_Id,
|
Chemo_Id: d.Chemo_Id,
|
||||||
Chemo: d.Chemo,
|
Chemo: d.Chemo,
|
||||||
Patient_Weight: d.Patient_Weight,
|
Patient_Weight: d.Patient_Weight,
|
||||||
Patient_Height: d.Patient_Height,
|
Patient_Height: d.Patient_Height,
|
||||||
Diagnoses: d.Diagnoses,
|
Diagnoses: d.Diagnoses,
|
||||||
Interval: d.Interval,
|
Interval: d.Interval,
|
||||||
Cycle: d.Cycle,
|
Cycle: d.Cycle,
|
||||||
Series: d.Series,
|
Series: d.Series,
|
||||||
StartDate: d.StartDate,
|
StartDate: d.StartDate,
|
||||||
EndDate: d.EndDate,
|
EndDate: d.EndDate,
|
||||||
Status_Code: d.Status_Code,
|
Status_Code: d.Status_Code,
|
||||||
|
VerifiedAt: d.VerifiedAt,
|
||||||
|
VerifiedBy_User_Id: d.VerifiedBy_User_Id,
|
||||||
|
VerifiedBy: d.VerifiedBy,
|
||||||
|
ChemoPlans: d.ChemoPlans,
|
||||||
|
Patient_Id: d.Patient_Id,
|
||||||
}
|
}
|
||||||
resp.Main = d.Main
|
resp.Main = d.Main
|
||||||
return resp
|
return resp
|
||||||
|
|||||||
@@ -3,6 +3,9 @@ package chemo
|
|||||||
import (
|
import (
|
||||||
ed "simrs-vx/internal/domain/main-entities/doctor"
|
ed "simrs-vx/internal/domain/main-entities/doctor"
|
||||||
es "simrs-vx/internal/domain/main-entities/specialist"
|
es "simrs-vx/internal/domain/main-entities/specialist"
|
||||||
|
ere "simrs-vx/internal/domain/references/encounter"
|
||||||
|
|
||||||
|
// std
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
// internal - lib
|
// internal - lib
|
||||||
@@ -21,6 +24,7 @@ type CreateDto struct {
|
|||||||
Encounter_Id *uint `json:"encounter_id"`
|
Encounter_Id *uint `json:"encounter_id"`
|
||||||
Status_Code erc.DataVerifiedCode `json:"status_code"`
|
Status_Code erc.DataVerifiedCode `json:"status_code"`
|
||||||
Specialist_Code *string `json:"specialist_code"`
|
Specialist_Code *string `json:"specialist_code"`
|
||||||
|
Class_Code ere.ChemoClassCode `json:"class_code"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ReadListDto struct {
|
type ReadListDto struct {
|
||||||
@@ -34,28 +38,32 @@ type FilterDto struct {
|
|||||||
Status_Code *erc.DataVerifiedCode `json:"status-code"`
|
Status_Code *erc.DataVerifiedCode `json:"status-code"`
|
||||||
VerifiedBy_User_Id *uint `json:"verifiedBy-user-id"`
|
VerifiedBy_User_Id *uint `json:"verifiedBy-user-id"`
|
||||||
Specialist_Code *string `json:"specialist-code"`
|
Specialist_Code *string `json:"specialist-code"`
|
||||||
|
Patient_Id *uint `json:"patient-id"`
|
||||||
|
Class_Code ere.ChemoClassCode `json:"class-code"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ReadDetailDto struct {
|
type ReadDetailDto struct {
|
||||||
Id uint16 `json:"id"`
|
Id uint `json:"id"`
|
||||||
|
Includes string `json:"includes"`
|
||||||
|
FilterDto
|
||||||
}
|
}
|
||||||
|
|
||||||
type UpdateDto struct {
|
type UpdateDto struct {
|
||||||
Id uint16 `json:"id"`
|
Id uint `json:"id"`
|
||||||
CreateDto
|
CreateDto
|
||||||
}
|
}
|
||||||
|
|
||||||
type DeleteDto struct {
|
type DeleteDto struct {
|
||||||
Id uint16 `json:"id"`
|
Id uint `json:"id"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type VerifyDto struct {
|
type VerifyDto struct {
|
||||||
Id uint16 `json:"id"`
|
Id uint `json:"id"`
|
||||||
Status_Code erc.DataVerifiedCode `json:"status_code"`
|
Status_Code erc.DataVerifiedCode `json:"status_code"`
|
||||||
Bed *string `json:"bed"`
|
Bed *string `json:"bed"`
|
||||||
Needs *string `json:"needs"`
|
Needs *string `json:"needs"`
|
||||||
Doctor_Code *string `json:"doctor_code" validate:"required"`
|
Doctor_Code *string `json:"doctor_code" validate:"required"`
|
||||||
NextChemoDate *time.Time `json:"nextChemoDate"`
|
NextChemoDate *time.Time `json:"nextChemoDate" validate:"required"`
|
||||||
|
|
||||||
pa.AuthInfo
|
pa.AuthInfo
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,14 +26,15 @@ type ReadListDto struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type FilterDto struct {
|
type FilterDto struct {
|
||||||
Code *string `json:"code"`
|
Code *string `json:"code"`
|
||||||
Employee_Id *uint `json:"employee-id"`
|
Employee_Id *uint `json:"employee-id"`
|
||||||
IHS_Number *string `json:"ihs-number" validate:"maxLength=20"`
|
IHS_Number *string `json:"ihs-number" validate:"maxLength=20"`
|
||||||
SIP_Number *string `json:"sip-number" validate:"maxLength=20"`
|
SIP_Number *string `json:"sip-number" validate:"maxLength=20"`
|
||||||
SIP_ExpiredDate *string `json:"sip-expiredDate"`
|
SIP_ExpiredDate *string `json:"sip-expiredDate"`
|
||||||
Unit_Code *string `json:"unit-code"`
|
Unit_Code *string `json:"unit-code"`
|
||||||
Specialist_Code *string `json:"specialist-code"`
|
Specialist_Code *string `json:"specialist-code"`
|
||||||
Subspecialist_Code *string `json:"subspecialist-code"`
|
Specialist_Code_Opt *string `json:"specialist-code-opt"`
|
||||||
|
Subspecialist_Code *string `json:"subspecialist-code"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ReadDetailDto struct {
|
type ReadDetailDto struct {
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ import (
|
|||||||
er "simrs-vx/internal/domain/main-entities/rehab/base"
|
er "simrs-vx/internal/domain/main-entities/rehab/base"
|
||||||
es "simrs-vx/internal/domain/main-entities/specialist"
|
es "simrs-vx/internal/domain/main-entities/specialist"
|
||||||
ess "simrs-vx/internal/domain/main-entities/subspecialist"
|
ess "simrs-vx/internal/domain/main-entities/subspecialist"
|
||||||
|
evd "simrs-vx/internal/domain/main-entities/vaccine-data"
|
||||||
)
|
)
|
||||||
|
|
||||||
type CreateDto struct {
|
type CreateDto struct {
|
||||||
@@ -105,6 +106,7 @@ type FilterDto struct {
|
|||||||
RegisteredAt *time.Time `json:"registeredAt"`
|
RegisteredAt *time.Time `json:"registeredAt"`
|
||||||
Class_Code ere.EncounterClassCode `json:"class-code" validate:"maxLength=10"`
|
Class_Code ere.EncounterClassCode `json:"class-code" validate:"maxLength=10"`
|
||||||
Specialist_Code *string `json:"specialist-code"`
|
Specialist_Code *string `json:"specialist-code"`
|
||||||
|
Specialist_Code_Opt *string `json:"specialist-code-opt"`
|
||||||
Subspecialist_Code *string `json:"subspecialist-code"`
|
Subspecialist_Code *string `json:"subspecialist-code"`
|
||||||
VisitDate time.Time `json:"visitDate"`
|
VisitDate time.Time `json:"visitDate"`
|
||||||
Appoinment_Doctor_Code *string `json:"appointment-doctor-code"`
|
Appoinment_Doctor_Code *string `json:"appointment-doctor-code"`
|
||||||
@@ -116,6 +118,7 @@ type FilterDto struct {
|
|||||||
MedicalDischargeEducation *string `json:"medicalDischargeEducation"`
|
MedicalDischargeEducation *string `json:"medicalDischargeEducation"`
|
||||||
AdmDischargeEducation *string `json:"admDischargeEducation"`
|
AdmDischargeEducation *string `json:"admDischargeEducation"`
|
||||||
DischargeReason *string `json:"dischargeReason"`
|
DischargeReason *string `json:"dischargeReason"`
|
||||||
|
ChemoClass *ere.ChemoClassCode `json:"chemo-class"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ReadDetailDto struct {
|
type ReadDetailDto struct {
|
||||||
@@ -232,6 +235,7 @@ type ResponseDto struct {
|
|||||||
EncounterDocuments *[]eed.EncounterDocument `json:"encounterDocuments,omitempty"`
|
EncounterDocuments *[]eed.EncounterDocument `json:"encounterDocuments,omitempty"`
|
||||||
Responsible_Nurse_Code *string `json:"responsible_nurse_code"`
|
Responsible_Nurse_Code *string `json:"responsible_nurse_code"`
|
||||||
Responsible_Nurse *en.Nurse `json:"responsible_nurse,omitempty"`
|
Responsible_Nurse *en.Nurse `json:"responsible_nurse,omitempty"`
|
||||||
|
Vaccines *evd.VaccineData `json:"vaccines,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d Encounter) ToResponse() ResponseDto {
|
func (d Encounter) ToResponse() ResponseDto {
|
||||||
@@ -279,6 +283,7 @@ func (d Encounter) ToResponse() ResponseDto {
|
|||||||
EncounterDocuments: d.EncounterDocuments,
|
EncounterDocuments: d.EncounterDocuments,
|
||||||
Responsible_Nurse_Code: d.Responsible_Nurse_Code,
|
Responsible_Nurse_Code: d.Responsible_Nurse_Code,
|
||||||
Responsible_Nurse: d.Responsible_Nurse,
|
Responsible_Nurse: d.Responsible_Nurse,
|
||||||
|
Vaccines: d.Vaccines,
|
||||||
}
|
}
|
||||||
resp.Main = d.Main
|
resp.Main = d.Main
|
||||||
return resp
|
return resp
|
||||||
@@ -293,6 +298,6 @@ func ToResponseList(data []Encounter) []ResponseDto {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type CreateWithPatientDto struct {
|
type CreateWithPatientDto struct {
|
||||||
Encounter CreateDto `json:"encounter"`
|
CreateDto
|
||||||
Patient ep.CreateDto `json:"patient"`
|
Patient ep.CreateDto `json:"patient"`
|
||||||
}
|
}
|
||||||
@@ -25,6 +25,7 @@ import (
|
|||||||
er "simrs-vx/internal/domain/main-entities/rehab/base"
|
er "simrs-vx/internal/domain/main-entities/rehab/base"
|
||||||
es "simrs-vx/internal/domain/main-entities/specialist"
|
es "simrs-vx/internal/domain/main-entities/specialist"
|
||||||
ess "simrs-vx/internal/domain/main-entities/subspecialist"
|
ess "simrs-vx/internal/domain/main-entities/subspecialist"
|
||||||
|
evd "simrs-vx/internal/domain/main-entities/vaccine-data"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Encounter struct {
|
type Encounter struct {
|
||||||
@@ -77,6 +78,7 @@ type Encounter struct {
|
|||||||
VclaimReference *evr.VclaimReference `json:"vclaimReference,omitempty" gorm:"foreignKey:Encounter_Id;references:Id"`
|
VclaimReference *evr.VclaimReference `json:"vclaimReference,omitempty" gorm:"foreignKey:Encounter_Id;references:Id"`
|
||||||
Responsible_Nurse_Code *string `json:"responsible_nurse_code"`
|
Responsible_Nurse_Code *string `json:"responsible_nurse_code"`
|
||||||
Responsible_Nurse *en.Nurse `json:"responsible_nurse,omitempty" gorm:"foreignKey:Responsible_Nurse_Code;references:Code"`
|
Responsible_Nurse *en.Nurse `json:"responsible_nurse,omitempty" gorm:"foreignKey:Responsible_Nurse_Code;references:Code"`
|
||||||
|
Vaccines *evd.VaccineData `json:"vaccines,omitempty" gorm:"foreignKey:Encounter_Id;references:Id"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d Encounter) IsDone() bool {
|
func (d Encounter) IsDone() bool {
|
||||||
|
|||||||
@@ -14,6 +14,10 @@ type CreateDto struct {
|
|||||||
EncounterClass_Code ere.EncounterClassCode `json:"encounterClass_code" validate:"maxLength=20"`
|
EncounterClass_Code ere.EncounterClassCode `json:"encounterClass_code" validate:"maxLength=20"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type CreateBulkDto struct {
|
||||||
|
Value []CreateDto `json:"value"`
|
||||||
|
}
|
||||||
|
|
||||||
type ReadListDto struct {
|
type ReadListDto struct {
|
||||||
FilterDto
|
FilterDto
|
||||||
Includes string `json:"includes"`
|
Includes string `json:"includes"`
|
||||||
|
|||||||
@@ -0,0 +1,126 @@
|
|||||||
|
package kfr
|
||||||
|
|
||||||
|
import (
|
||||||
|
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||||
|
erc "simrs-vx/internal/domain/references/common"
|
||||||
|
ere "simrs-vx/internal/domain/references/encounter"
|
||||||
|
|
||||||
|
eem "simrs-vx/internal/domain/main-entities/employee"
|
||||||
|
ee "simrs-vx/internal/domain/main-entities/encounter"
|
||||||
|
|
||||||
|
pa "simrs-vx/internal/lib/auth"
|
||||||
|
|
||||||
|
pu "simrs-vx/pkg/use-case-helper"
|
||||||
|
)
|
||||||
|
|
||||||
|
type CreateDto struct {
|
||||||
|
Encounter_Id *uint `json:"encounter_id"`
|
||||||
|
CreatedBy_Employee_Id *uint `json:"createdBy_employee_id"`
|
||||||
|
Type ere.KFRTypeCode `json:"type" gorm:"size:15"`
|
||||||
|
Subjective string `json:"subjective"`
|
||||||
|
Objective string `json:"objective"`
|
||||||
|
Assessment string `json:"assessment"`
|
||||||
|
TreatmentGoals string `json:"treatmentGoals"`
|
||||||
|
Education string `json:"education"`
|
||||||
|
Action string `json:"action"`
|
||||||
|
Frequency *uint `json:"frequency"`
|
||||||
|
IntervalUnit_Code *erc.TimeUnitCode `json:"intervalUnit_code" gorm:"size:10"`
|
||||||
|
FollowUpType ere.KFRFollowUpTypeCode `json:"followUpType" gorm:"size:10"`
|
||||||
|
FollowUpNote string `json:"followUpNote"`
|
||||||
|
Status_Code erc.DataVerifiedCode `json:"status_code" gorm:"not null;size:10"`
|
||||||
|
|
||||||
|
pa.AuthInfo
|
||||||
|
}
|
||||||
|
|
||||||
|
type ReadListDto struct {
|
||||||
|
FilterDto
|
||||||
|
Includes string `json:"includes"`
|
||||||
|
Pagination ecore.Pagination
|
||||||
|
}
|
||||||
|
|
||||||
|
type FilterDto struct {
|
||||||
|
Encounter_Id *uint `json:"encounter-id"`
|
||||||
|
CreatedBy_Employee_Id *uint `json:"createdBy_employee-id"`
|
||||||
|
Type ere.KFRTypeCode `json:"type" gorm:"size:15"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ReadDetailDto struct {
|
||||||
|
Id uint `json:"id"`
|
||||||
|
Includes string `json:"includes"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type UpdateDto struct {
|
||||||
|
Id uint `json:"id"`
|
||||||
|
CreateDto
|
||||||
|
}
|
||||||
|
|
||||||
|
type DeleteDto struct {
|
||||||
|
Id uint `json:"id"`
|
||||||
|
|
||||||
|
pa.AuthInfo
|
||||||
|
}
|
||||||
|
|
||||||
|
type MetaDto struct {
|
||||||
|
PageNumber int `json:"page_number"`
|
||||||
|
PageSize int `json:"page_size"`
|
||||||
|
Count int `json:"count"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ResponseDto struct {
|
||||||
|
ecore.Main
|
||||||
|
Encounter_Id *uint `json:"encounter_id"`
|
||||||
|
Encounter *ee.Encounter `json:"encounter,omitempty" gorm:"foreignKey:Encounter_Id;references:Id"`
|
||||||
|
CreatedBy_Employee_Id *uint `json:"createdBy_employee_id"`
|
||||||
|
CreatedBy_Employee *eem.Employee `json:"createdBy_employee,omitempty" gorm:"foreignKey:CreatedBy_Employee_Id;references:Id"`
|
||||||
|
Type ere.KFRTypeCode `json:"type" gorm:"size:15"`
|
||||||
|
Subjective string `json:"subjective"`
|
||||||
|
Objective string `json:"objective"`
|
||||||
|
Assessment string `json:"assessment"`
|
||||||
|
TreatmentGoals string `json:"treatmentGoals"`
|
||||||
|
Education string `json:"education"`
|
||||||
|
Action string `json:"action"`
|
||||||
|
Frequency *uint `json:"frequency"`
|
||||||
|
IntervalUnit_Code *erc.TimeUnitCode `json:"intervalUnit_code" gorm:"size:10"`
|
||||||
|
FollowUpType ere.KFRFollowUpTypeCode `json:"followUpType" gorm:"size:10"`
|
||||||
|
FollowUpNote string `json:"followUpNote"`
|
||||||
|
Status_Code erc.DataVerifiedCode `json:"status_code" gorm:"not null;size:10"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d KFR) ToResponse() ResponseDto {
|
||||||
|
resp := ResponseDto{
|
||||||
|
Encounter_Id: d.Encounter_Id,
|
||||||
|
Encounter: d.Encounter,
|
||||||
|
CreatedBy_Employee_Id: d.CreatedBy_Employee_Id,
|
||||||
|
CreatedBy_Employee: d.CreatedBy_Employee,
|
||||||
|
Type: d.Type,
|
||||||
|
Subjective: d.Subjective,
|
||||||
|
Objective: d.Objective,
|
||||||
|
Assessment: d.Assessment,
|
||||||
|
TreatmentGoals: d.TreatmentGoals,
|
||||||
|
Education: d.Education,
|
||||||
|
Action: d.Action,
|
||||||
|
Frequency: d.Frequency,
|
||||||
|
IntervalUnit_Code: d.IntervalUnit_Code,
|
||||||
|
FollowUpType: d.FollowUpType,
|
||||||
|
FollowUpNote: d.FollowUpNote,
|
||||||
|
Status_Code: d.Status_Code,
|
||||||
|
}
|
||||||
|
resp.Main = d.Main
|
||||||
|
return resp
|
||||||
|
}
|
||||||
|
|
||||||
|
func ToResponseList(data []KFR) []ResponseDto {
|
||||||
|
resp := make([]ResponseDto, len(data))
|
||||||
|
for i, u := range data {
|
||||||
|
resp[i] = u.ToResponse()
|
||||||
|
}
|
||||||
|
return resp
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c CreateDto) IsCorrectType() bool {
|
||||||
|
return pu.Contains([]ere.KFRTypeCode{ere.KFRAssessment, ere.KFRTherapy, ere.KFRReAssessment}, c.Type)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c CreateDto) IsCorrectFollowUpType() bool {
|
||||||
|
return pu.Contains([]ere.KFRFollowUpTypeCode{ere.KFUTCEva, ere.KFUTCRef, ere.KFUTCFin}, c.FollowUpType)
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
package kfr
|
||||||
|
|
||||||
|
import (
|
||||||
|
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||||
|
erc "simrs-vx/internal/domain/references/common"
|
||||||
|
ere "simrs-vx/internal/domain/references/encounter"
|
||||||
|
|
||||||
|
eem "simrs-vx/internal/domain/main-entities/employee"
|
||||||
|
ee "simrs-vx/internal/domain/main-entities/encounter"
|
||||||
|
)
|
||||||
|
|
||||||
|
type KFR struct {
|
||||||
|
ecore.Main
|
||||||
|
Encounter_Id *uint `json:"encounter_id"`
|
||||||
|
Encounter *ee.Encounter `json:"encounter,omitempty" gorm:"foreignKey:Encounter_Id;references:Id"`
|
||||||
|
CreatedBy_Employee_Id *uint `json:"createdBy_employee_id"`
|
||||||
|
CreatedBy_Employee *eem.Employee `json:"createdBy_employee,omitempty" gorm:"foreignKey:CreatedBy_Employee_Id;references:Id"`
|
||||||
|
Type ere.KFRTypeCode `json:"type" gorm:"size:15"`
|
||||||
|
Subjective string `json:"subjective"`
|
||||||
|
Objective string `json:"objective"`
|
||||||
|
Assessment string `json:"assessment"`
|
||||||
|
TreatmentGoals string `json:"treatmentGoals"`
|
||||||
|
Education string `json:"education"`
|
||||||
|
Action string `json:"action"`
|
||||||
|
Frequency *uint `json:"frequency"`
|
||||||
|
IntervalUnit_Code *erc.TimeUnitCode `json:"intervalUnit_code" gorm:"size:10"`
|
||||||
|
FollowUpType ere.KFRFollowUpTypeCode `json:"followUpType" gorm:"size:10"`
|
||||||
|
FollowUpNote string `json:"followUpNote"`
|
||||||
|
Status_Code erc.DataVerifiedCode `json:"status_code" gorm:"not null;size:10"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d KFR) IsNew() bool {
|
||||||
|
return d.Status_Code == erc.DVCNew
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d KFR) IsVerified() bool {
|
||||||
|
return d.Status_Code == erc.DVCVerified
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d KFR) IsValidated() bool {
|
||||||
|
return d.Status_Code == erc.DVCValidated
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@ package resume
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||||
|
ed "simrs-vx/internal/domain/main-entities/doctor"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
erc "simrs-vx/internal/domain/references/common"
|
erc "simrs-vx/internal/domain/references/common"
|
||||||
@@ -54,6 +55,7 @@ type ResponseDto struct {
|
|||||||
ecore.Main
|
ecore.Main
|
||||||
Encounter_Id *uint `json:"encounter_id"`
|
Encounter_Id *uint `json:"encounter_id"`
|
||||||
Doctor_Code *string `json:"doctor_code"`
|
Doctor_Code *string `json:"doctor_code"`
|
||||||
|
Doctor *ed.Doctor `json:"doctor,omitempty" gorm:"foreignKey:Doctor_Code;references:Code"`
|
||||||
Value *string `json:"value"`
|
Value *string `json:"value"`
|
||||||
FileUrl *string `json:"fileUrl"`
|
FileUrl *string `json:"fileUrl"`
|
||||||
Status_Code erc.DataVerifiedCode `json:"status_code"`
|
Status_Code erc.DataVerifiedCode `json:"status_code"`
|
||||||
@@ -63,6 +65,7 @@ func (d Resume) ToResponse() ResponseDto {
|
|||||||
resp := ResponseDto{
|
resp := ResponseDto{
|
||||||
Encounter_Id: d.Encounter_Id,
|
Encounter_Id: d.Encounter_Id,
|
||||||
Doctor_Code: d.Doctor_Code,
|
Doctor_Code: d.Doctor_Code,
|
||||||
|
Doctor: d.Doctor,
|
||||||
Value: d.Value,
|
Value: d.Value,
|
||||||
FileUrl: d.FileUrl,
|
FileUrl: d.FileUrl,
|
||||||
Status_Code: d.Status_Code,
|
Status_Code: d.Status_Code,
|
||||||
|
|||||||
@@ -7,10 +7,10 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type CreateDto struct {
|
type CreateDto struct {
|
||||||
Id *uint `json:"id"`
|
Id *uint `json:"id"`
|
||||||
Installation_Code string `json:"installation_code"`
|
Installation_Code *string `json:"installation_code"`
|
||||||
Code string `json:"code" validate:"maxLength=10"`
|
Code string `json:"code" validate:"maxLength=10"`
|
||||||
Name string `json:"name" validate:"maxLength=50"`
|
Name string `json:"name" validate:"maxLength=50"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ReadListDto struct {
|
type ReadListDto struct {
|
||||||
@@ -42,6 +42,10 @@ type DeleteDto struct {
|
|||||||
Code *string `json:"code"`
|
Code *string `json:"code"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type CreateBulkDto struct {
|
||||||
|
Value []CreateDto `json:"value"`
|
||||||
|
}
|
||||||
|
|
||||||
type MetaDto struct {
|
type MetaDto struct {
|
||||||
PageNumber int `json:"page_number"`
|
PageNumber int `json:"page_number"`
|
||||||
PageSize int `json:"page_size"`
|
PageSize int `json:"page_size"`
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ type Specialist struct {
|
|||||||
ecore.SmallMain // adjust this according to the needs
|
ecore.SmallMain // adjust this according to the needs
|
||||||
Code string `json:"code" gorm:"unique;size:20"`
|
Code string `json:"code" gorm:"unique;size:20"`
|
||||||
Name string `json:"name" gorm:"size:50"`
|
Name string `json:"name" gorm:"size:50"`
|
||||||
Installation_Code string `json:"installation_code" gorm:"size:20"`
|
Installation_Code *string `json:"installation_code" gorm:"size:20"`
|
||||||
Installation *ei.Installation `json:"installation,omitempty" gorm:"foreignKey:Installation_Code;references:Code"`
|
Installation *ei.Installation `json:"installation,omitempty" gorm:"foreignKey:Installation_Code;references:Code"`
|
||||||
SpecialistPositions []eub.Basic `json:"specialistPositions,omitempty" gorm:"foreignKey:Specialist_Code;references:Code"`
|
SpecialistPositions []eub.Basic `json:"specialistPositions,omitempty" gorm:"foreignKey:Specialist_Code;references:Code"`
|
||||||
Subspecialists []essb.Basic `json:"subspecialists,omitempty" gorm:"foreignKey:Specialist_Code;references:Code"`
|
Subspecialists []essb.Basic `json:"subspecialists,omitempty" gorm:"foreignKey:Specialist_Code;references:Code"`
|
||||||
|
|||||||
@@ -43,6 +43,10 @@ type DeleteDto struct {
|
|||||||
Code *string `json:"code"`
|
Code *string `json:"code"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type CreateBulkDto struct {
|
||||||
|
Value []CreateDto `json:"value"`
|
||||||
|
}
|
||||||
|
|
||||||
type MetaDto struct {
|
type MetaDto struct {
|
||||||
PageNumber int `json:"page_number"`
|
PageNumber int `json:"page_number"`
|
||||||
PageSize int `json:"page_size"`
|
PageSize int `json:"page_size"`
|
||||||
|
|||||||
@@ -0,0 +1,96 @@
|
|||||||
|
package vaccinedata
|
||||||
|
|
||||||
|
import (
|
||||||
|
// std
|
||||||
|
"time"
|
||||||
|
|
||||||
|
// internal - lib
|
||||||
|
erc "simrs-vx/internal/domain/references/clinical"
|
||||||
|
|
||||||
|
// internal - domain - base-entities
|
||||||
|
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||||
|
// internal - domain - main-entities
|
||||||
|
)
|
||||||
|
|
||||||
|
type CreateDto struct {
|
||||||
|
Type *erc.VaccineTypeCode `json:"type"`
|
||||||
|
Encounter_Id *uint `json:"encounter_id"`
|
||||||
|
BatchNumber *string `json:"batchNumber"`
|
||||||
|
Dose *float64 `json:"dose"`
|
||||||
|
DoseOrder *uint `json:"doseOrder"`
|
||||||
|
InjectionLocation *string `json:"injectionLocation"`
|
||||||
|
GivenDate *time.Time `json:"givenDate"`
|
||||||
|
ExpirationDate *time.Time `json:"expirationDate"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ReadListDto struct {
|
||||||
|
FilterDto
|
||||||
|
Includes string `json:"includes"`
|
||||||
|
Pagination ecore.Pagination
|
||||||
|
}
|
||||||
|
|
||||||
|
type FilterDto struct {
|
||||||
|
Type *erc.VaccineTypeCode `json:"type"`
|
||||||
|
Encounter_Id *uint `json:"encounter_id"`
|
||||||
|
BatchNumber *string `json:"batchNumber"`
|
||||||
|
Dose *float64 `json:"dose"`
|
||||||
|
DoseOrder *uint `json:"doseOrder"`
|
||||||
|
InjectionLocation *string `json:"injectionLocation"`
|
||||||
|
GivenDate *time.Time `json:"givenDate"`
|
||||||
|
ExpirationDate *time.Time `json:"expirationDate"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ReadDetailDto struct {
|
||||||
|
Id uint16 `json:"id"`
|
||||||
|
Includes string `json:"includes"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type UpdateDto struct {
|
||||||
|
Id uint `json:"id"`
|
||||||
|
CreateDto
|
||||||
|
}
|
||||||
|
|
||||||
|
type DeleteDto struct {
|
||||||
|
Id uint `json:"id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type MetaDto struct {
|
||||||
|
PageNumber int `json:"page_number"`
|
||||||
|
PageSize int `json:"page_size"`
|
||||||
|
Count int `json:"count"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ResponseDto struct {
|
||||||
|
ecore.Main
|
||||||
|
Type *erc.VaccineTypeCode `json:"type"`
|
||||||
|
Encounter_Id *uint `json:"encounter_id"`
|
||||||
|
BatchNumber *string `json:"batchNumber"`
|
||||||
|
Dose *float64 `json:"dose"`
|
||||||
|
DoseOrder *uint `json:"doseOrder"`
|
||||||
|
InjectionLocation *string `json:"injectionLocation"`
|
||||||
|
GivenDate *time.Time `json:"givenDate"`
|
||||||
|
ExpirationDate *time.Time `json:"expirationDate"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d VaccineData) ToResponse() ResponseDto {
|
||||||
|
resp := ResponseDto{
|
||||||
|
Type: d.Type,
|
||||||
|
Encounter_Id: d.Encounter_Id,
|
||||||
|
BatchNumber: d.BatchNumber,
|
||||||
|
Dose: d.Dose,
|
||||||
|
DoseOrder: d.DoseOrder,
|
||||||
|
InjectionLocation: d.InjectionLocation,
|
||||||
|
GivenDate: d.GivenDate,
|
||||||
|
ExpirationDate: d.ExpirationDate,
|
||||||
|
}
|
||||||
|
resp.Main = d.Main
|
||||||
|
return resp
|
||||||
|
}
|
||||||
|
|
||||||
|
func ToResponseList(data []VaccineData) []ResponseDto {
|
||||||
|
resp := make([]ResponseDto, len(data))
|
||||||
|
for i, u := range data {
|
||||||
|
resp[i] = u.ToResponse()
|
||||||
|
}
|
||||||
|
return resp
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package vaccinedata
|
||||||
|
|
||||||
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
|
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||||
|
|
||||||
|
erc "simrs-vx/internal/domain/references/clinical"
|
||||||
|
)
|
||||||
|
|
||||||
|
type VaccineData struct {
|
||||||
|
ecore.Main // adjust this according to the needs
|
||||||
|
Type *erc.VaccineTypeCode `json:"type" gorm:"size:25"`
|
||||||
|
Encounter_Id *uint `json:"encounter_id"`
|
||||||
|
BatchNumber *string `json:"batchNumber"`
|
||||||
|
Dose *float64 `json:"dose"`
|
||||||
|
DoseOrder *uint `json:"doseOrder"`
|
||||||
|
InjectionLocation *string `json:"injectionLocation"`
|
||||||
|
GivenDate *time.Time `json:"givenDate"`
|
||||||
|
ExpirationDate *time.Time `json:"expirationDate"`
|
||||||
|
}
|
||||||
@@ -32,6 +32,7 @@ type (
|
|||||||
BornLocationCode string
|
BornLocationCode string
|
||||||
SpecimentDestCode string
|
SpecimentDestCode string
|
||||||
ProcedureReportType string
|
ProcedureReportType string
|
||||||
|
VaccineTypeCode string
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -243,6 +244,21 @@ const (
|
|||||||
|
|
||||||
PRTProcedure ProcedureReportType = "procedure"
|
PRTProcedure ProcedureReportType = "procedure"
|
||||||
PRTSurgery ProcedureReportType = "surgery"
|
PRTSurgery ProcedureReportType = "surgery"
|
||||||
|
|
||||||
|
VaccineBCG VaccineTypeCode = "BCG" // BCG
|
||||||
|
VaccineIPV VaccineTypeCode = "IPV" // IPV
|
||||||
|
VaccineTD VaccineTypeCode = "TD" // TD
|
||||||
|
VaccinePCVPneumoni VaccineTypeCode = "PCVPneumoni" // PCV pneumoni
|
||||||
|
VaccineRotavirus VaccineTypeCode = "ROTAVIRUS" // ROTAVIRUS
|
||||||
|
VaccineDT VaccineTypeCode = "DT" // DT
|
||||||
|
VaccineTT VaccineTypeCode = "TT" // TT
|
||||||
|
VaccineMRCampak VaccineTypeCode = "MRCampak" // MR / Campak
|
||||||
|
VaccineHB VaccineTypeCode = "HB" // HB
|
||||||
|
VaccineHIV VaccineTypeCode = "HIV" // HIV
|
||||||
|
VaccineDPT VaccineTypeCode = "DPT" // DPT
|
||||||
|
VaccineInfluenzaBType VaccineTypeCode = "INFLUENZABType" // INFLUENSA tipe B
|
||||||
|
VaccinePolioOPV VaccineTypeCode = "PolioOPV" // Polio OPV
|
||||||
|
VaccinePolioDrops VaccineTypeCode = "PolioDrops" // Polio Tetes
|
||||||
)
|
)
|
||||||
|
|
||||||
type Soapi struct {
|
type Soapi struct {
|
||||||
|
|||||||
@@ -23,6 +23,8 @@ type (
|
|||||||
DocTypeCode string
|
DocTypeCode string
|
||||||
EntityTypeCode string
|
EntityTypeCode string
|
||||||
StatusProtocolChemo string
|
StatusProtocolChemo string
|
||||||
|
KFRTypeCode string
|
||||||
|
KFRFollowUpTypeCode string
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -70,7 +72,7 @@ const (
|
|||||||
OCCHcu OutpatientClassCode = "hcu" // HCU
|
OCCHcu OutpatientClassCode = "hcu" // HCU
|
||||||
OCCVk OutpatientClassCode = "vk" // Verlos kamer
|
OCCVk OutpatientClassCode = "vk" // Verlos kamer
|
||||||
|
|
||||||
ACCReg AmbulatoryClassCode = "reg" // Regular
|
ACCReg AmbulatoryClassCode = "regular" // Regular
|
||||||
// ACCRehab ACCRme AmbulatoryClassCode = "rme" // Rehab Medik
|
// ACCRehab ACCRme AmbulatoryClassCode = "rme" // Rehab Medik
|
||||||
// ACCCad AmbulatoryClassCode = "chemo-adm" // Chemotherapy
|
// ACCCad AmbulatoryClassCode = "chemo-adm" // Chemotherapy
|
||||||
// ACCCac AmbulatoryClassCode = "chemo-act" // Chemotherapy
|
// ACCCac AmbulatoryClassCode = "chemo-act" // Chemotherapy
|
||||||
@@ -130,9 +132,17 @@ const (
|
|||||||
ETCEncounter EntityTypeCode = "encounter"
|
ETCEncounter EntityTypeCode = "encounter"
|
||||||
ETCMCU EntityTypeCode = "mcu"
|
ETCMCU EntityTypeCode = "mcu"
|
||||||
|
|
||||||
SPCComplete StatusProtocolChemo = "complete"
|
SPCComplete StatusProtocolChemo = "complete" // Terealisasi
|
||||||
SPCPlanned StatusProtocolChemo = "planned"
|
SPCPlanned StatusProtocolChemo = "planned" // Terencana
|
||||||
SPCSchedule StatusProtocolChemo = "schedule"
|
SPCSchedule StatusProtocolChemo = "schedule" // Terjadwal
|
||||||
|
|
||||||
|
KFRAssessment KFRTypeCode = "assessment"
|
||||||
|
KFRTherapy KFRTypeCode = "therapy"
|
||||||
|
KFRReAssessment KFRTypeCode = "reassessment"
|
||||||
|
|
||||||
|
KFUTCEva KFRFollowUpTypeCode = "evaluation"
|
||||||
|
KFUTCRef KFRFollowUpTypeCode = "referral"
|
||||||
|
KFUTCFin KFRFollowUpTypeCode = "finish"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (ec EncounterClassCode) Code() string {
|
func (ec EncounterClassCode) Code() string {
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package daftar_specialist
|
||||||
|
|
||||||
|
type DaftarSpesialis struct {
|
||||||
|
ID uint `json:"id" gorm:"column:id;primaryKey;autoIncrement"`
|
||||||
|
Kode string `json:"kode" gorm:"column:Kode"`
|
||||||
|
Spesialis string `json:"spesialis" gorm:"column:Spesialis"`
|
||||||
|
IdGroupLocationSimgos *string `json:"id_group_location_simgos" gorm:"column:Id_group_location_simgos"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (DaftarSpesialis) TableName() string {
|
||||||
|
return "daftar_spesialis"
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package m_ruang
|
||||||
|
|
||||||
|
type MRuang struct {
|
||||||
|
No uint `json:"no" gorm:"column:no;primaryKey;autoIncrement"`
|
||||||
|
Nama string `json:"nama" gorm:"column:nama"`
|
||||||
|
Kelas string `json:"kelas" gorm:"column:kelas"`
|
||||||
|
IdxRuang string `json:"idx_ruang" gorm:"column:idx_ruang"`
|
||||||
|
Kelompok string `json:"kelompok" gorm:"column:kelompok"`
|
||||||
|
Ruang *string `json:"ruang" gorm:"column:ruang"`
|
||||||
|
KdUnit int `json:"kdunit" gorm:"column:kdunit"`
|
||||||
|
JumlahTT int `json:"jumlah_tt" gorm:"column:jumlah_tt"`
|
||||||
|
KetRuang *string `json:"ket_ruang" gorm:"column:ket_ruang"`
|
||||||
|
Fasilitas *string `json:"fasilitas" gorm:"column:fasilitas"`
|
||||||
|
Keterangan *string `json:"keterangan" gorm:"column:keterangan"`
|
||||||
|
SubSistem string `json:"subsistem" gorm:"column:subsistem"`
|
||||||
|
StAktif int16 `json:"st_aktif" gorm:"column:st_aktif"`
|
||||||
|
KodeRuang *string `json:"kode_ruang" gorm:"column:kode_ruang"`
|
||||||
|
IsPartial *string `json:"is_partial" gorm:"column:is_partial"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Nama tabel (opsional jika nama struct ≠ nama tabel)
|
||||||
|
func (MRuang) TableName() string {
|
||||||
|
return "m_ruang"
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
package assets
|
||||||
|
|
||||||
|
import (
|
||||||
|
"log"
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
)
|
||||||
|
|
||||||
|
func exeDir() string {
|
||||||
|
exe, err := os.Executable()
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return filepath.Dir(exe)
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetAssetsDir() string {
|
||||||
|
exe, err := os.Executable()
|
||||||
|
if err != nil {
|
||||||
|
log.Println(
|
||||||
|
"[ASSETS][ERROR] Failed to resolve executable path.",
|
||||||
|
"This should never happen in a built binary.",
|
||||||
|
"Error:", err,
|
||||||
|
)
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
exeDir := filepath.Dir(exe)
|
||||||
|
assets := filepath.Join(exeDir, "assets")
|
||||||
|
|
||||||
|
if _, err := os.Stat(assets); err != nil {
|
||||||
|
log.Println(
|
||||||
|
"[ASSETS][ERROR] Assets directory not found next to binary.",
|
||||||
|
"This error ONLY occurs when the application is running from a built binary.",
|
||||||
|
"Expected path:", assets,
|
||||||
|
"Executable path:", exe,
|
||||||
|
)
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
log.Println(
|
||||||
|
"[ASSETS][OK] Static assets enabled.",
|
||||||
|
"Mode: production (binary execution).",
|
||||||
|
"Assets path:", assets,
|
||||||
|
)
|
||||||
|
|
||||||
|
return assets
|
||||||
|
}
|
||||||
@@ -3,7 +3,8 @@ package docscfg
|
|||||||
import a "github.com/karincake/apem"
|
import a "github.com/karincake/apem"
|
||||||
|
|
||||||
type DocsCfg struct {
|
type DocsCfg struct {
|
||||||
Path string
|
Path string
|
||||||
|
Domain string
|
||||||
}
|
}
|
||||||
|
|
||||||
var O DocsCfg = DocsCfg{}
|
var O DocsCfg = DocsCfg{}
|
||||||
@@ -15,3 +16,7 @@ func ParseCfg() {
|
|||||||
func (c DocsCfg) GetPath() string {
|
func (c DocsCfg) GetPath() string {
|
||||||
return c.Path
|
return c.Path
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c DocsCfg) GetDomain() string {
|
||||||
|
return c.Domain
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package simgos_db
|
||||||
|
|
||||||
|
import (
|
||||||
|
dg "github.com/karincake/apem/db-gorm-pg"
|
||||||
|
)
|
||||||
|
|
||||||
|
func SetInstance() {
|
||||||
|
I = dg.IS["satu"]
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
package simgos_db
|
||||||
|
|
||||||
|
import "gorm.io/gorm"
|
||||||
|
|
||||||
|
var I *gorm.DB
|
||||||
@@ -0,0 +1,88 @@
|
|||||||
|
package chemo_protocol
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
rw "github.com/karincake/risoles"
|
||||||
|
sf "github.com/karincake/semprit"
|
||||||
|
|
||||||
|
e "simrs-vx/internal/domain/main-entities/chemo-plan"
|
||||||
|
ep "simrs-vx/internal/domain/main-entities/chemo-protocol"
|
||||||
|
u "simrs-vx/internal/use-case/main-use-case/chemo-plan"
|
||||||
|
)
|
||||||
|
|
||||||
|
type myBase struct{}
|
||||||
|
|
||||||
|
var O myBase
|
||||||
|
|
||||||
|
func (obj myBase) Create(w http.ResponseWriter, r *http.Request) {
|
||||||
|
dto := ep.CreateDto{}
|
||||||
|
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
res, err := u.Create(dto)
|
||||||
|
rw.DataResponse(w, res, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (obj myBase) GetList(w http.ResponseWriter, r *http.Request) {
|
||||||
|
dto := e.ReadListDto{}
|
||||||
|
sf.UrlQueryParam(&dto, *r.URL)
|
||||||
|
res, err := u.ReadList(dto)
|
||||||
|
rw.DataResponse(w, res, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) {
|
||||||
|
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||||
|
if id <= 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
dto := e.ReadDetailDto{}
|
||||||
|
sf.UrlQueryParam(&dto, *r.URL)
|
||||||
|
|
||||||
|
dto.Id = uint(id)
|
||||||
|
res, err := u.ReadDetail(dto)
|
||||||
|
rw.DataResponse(w, res, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (obj myBase) Update(w http.ResponseWriter, r *http.Request) {
|
||||||
|
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||||
|
if id <= 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
dto := e.UpdateDto{}
|
||||||
|
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
dto.Id = uint(id)
|
||||||
|
res, err := u.Update(dto)
|
||||||
|
rw.DataResponse(w, res, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (obj myBase) Delete(w http.ResponseWriter, r *http.Request) {
|
||||||
|
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||||
|
if id <= 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
dto := e.DeleteDto{}
|
||||||
|
dto.Id = uint(id)
|
||||||
|
res, err := u.Delete(dto)
|
||||||
|
rw.DataResponse(w, res, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (obj myBase) Fail(w http.ResponseWriter, r *http.Request) {
|
||||||
|
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||||
|
if id <= 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
dto := e.FailDto{}
|
||||||
|
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
dto.Id = uint(id)
|
||||||
|
res, err := u.Fail(dto)
|
||||||
|
rw.DataResponse(w, res, err)
|
||||||
|
}
|
||||||
@@ -2,7 +2,10 @@ package chemo_protocol
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
erc "simrs-vx/internal/domain/references/common"
|
||||||
|
pa "simrs-vx/internal/lib/auth"
|
||||||
|
|
||||||
|
d "github.com/karincake/dodol"
|
||||||
rw "github.com/karincake/risoles"
|
rw "github.com/karincake/risoles"
|
||||||
sf "github.com/karincake/semprit"
|
sf "github.com/karincake/semprit"
|
||||||
|
|
||||||
@@ -39,7 +42,7 @@ func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) {
|
|||||||
dto := e.ReadDetailDto{}
|
dto := e.ReadDetailDto{}
|
||||||
sf.UrlQueryParam(&dto, *r.URL)
|
sf.UrlQueryParam(&dto, *r.URL)
|
||||||
|
|
||||||
dto.Id = uint16(id)
|
dto.Id = uint(id)
|
||||||
res, err := u.ReadDetail(dto)
|
res, err := u.ReadDetail(dto)
|
||||||
rw.DataResponse(w, res, err)
|
rw.DataResponse(w, res, err)
|
||||||
}
|
}
|
||||||
@@ -54,7 +57,7 @@ func (obj myBase) Update(w http.ResponseWriter, r *http.Request) {
|
|||||||
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
|
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
dto.Id = uint16(id)
|
dto.Id = uint(id)
|
||||||
res, err := u.Update(dto)
|
res, err := u.Update(dto)
|
||||||
rw.DataResponse(w, res, err)
|
rw.DataResponse(w, res, err)
|
||||||
}
|
}
|
||||||
@@ -66,7 +69,46 @@ func (obj myBase) Delete(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dto := e.DeleteDto{}
|
dto := e.DeleteDto{}
|
||||||
dto.Id = uint16(id)
|
dto.Id = uint(id)
|
||||||
res, err := u.Delete(dto)
|
res, err := u.Delete(dto)
|
||||||
rw.DataResponse(w, res, err)
|
rw.DataResponse(w, res, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (obj myBase) Verify(w http.ResponseWriter, r *http.Request) {
|
||||||
|
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||||
|
if id <= 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
dto := e.VerifyDto{}
|
||||||
|
dto.Id = uint(id)
|
||||||
|
|
||||||
|
authInfo, err := pa.GetAuthInfo(r)
|
||||||
|
if err != nil {
|
||||||
|
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": err.Error()}, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
dto.AuthInfo = *authInfo
|
||||||
|
dto.Status_Code = erc.DVCVerified
|
||||||
|
res, err := u.Verify(dto)
|
||||||
|
rw.DataResponse(w, res, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (obj myBase) Reject(w http.ResponseWriter, r *http.Request) {
|
||||||
|
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||||
|
if id <= 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
dto := e.VerifyDto{}
|
||||||
|
dto.Id = uint(id)
|
||||||
|
authInfo, err := pa.GetAuthInfo(r)
|
||||||
|
if err != nil {
|
||||||
|
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": err.Error()}, nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
dto.AuthInfo = *authInfo
|
||||||
|
dto.Status_Code = erc.DVCRejected
|
||||||
|
res, err := u.Verify(dto)
|
||||||
|
rw.DataResponse(w, res, err)
|
||||||
|
}
|
||||||
@@ -3,20 +3,16 @@ package chemo
|
|||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
rw "github.com/karincake/risoles"
|
|
||||||
sf "github.com/karincake/semprit"
|
|
||||||
|
|
||||||
// ua "github.com/karincake/tumpeng/auth/svc"
|
|
||||||
|
|
||||||
e "simrs-vx/internal/domain/main-entities/chemo"
|
|
||||||
|
|
||||||
erc "simrs-vx/internal/domain/references/common"
|
|
||||||
|
|
||||||
u "simrs-vx/internal/use-case/main-use-case/chemo"
|
|
||||||
|
|
||||||
pa "simrs-vx/internal/lib/auth"
|
pa "simrs-vx/internal/lib/auth"
|
||||||
|
|
||||||
d "github.com/karincake/dodol"
|
d "github.com/karincake/dodol"
|
||||||
|
rw "github.com/karincake/risoles"
|
||||||
|
sf "github.com/karincake/semprit"
|
||||||
|
|
||||||
|
erc "simrs-vx/internal/domain/references/common"
|
||||||
|
|
||||||
|
e "simrs-vx/internal/domain/main-entities/chemo"
|
||||||
|
u "simrs-vx/internal/use-case/main-use-case/chemo"
|
||||||
)
|
)
|
||||||
|
|
||||||
type myBase struct{}
|
type myBase struct{}
|
||||||
@@ -45,7 +41,8 @@ func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
dto := e.ReadDetailDto{}
|
dto := e.ReadDetailDto{}
|
||||||
dto.Id = uint16(id)
|
sf.UrlQueryParam(&dto, *r.URL)
|
||||||
|
dto.Id = uint(id)
|
||||||
res, err := u.ReadDetail(dto)
|
res, err := u.ReadDetail(dto)
|
||||||
rw.DataResponse(w, res, err)
|
rw.DataResponse(w, res, err)
|
||||||
}
|
}
|
||||||
@@ -60,7 +57,7 @@ func (obj myBase) Update(w http.ResponseWriter, r *http.Request) {
|
|||||||
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
|
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
dto.Id = uint16(id)
|
dto.Id = uint(id)
|
||||||
res, err := u.Update(dto)
|
res, err := u.Update(dto)
|
||||||
rw.DataResponse(w, res, err)
|
rw.DataResponse(w, res, err)
|
||||||
}
|
}
|
||||||
@@ -72,7 +69,7 @@ func (obj myBase) Delete(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dto := e.DeleteDto{}
|
dto := e.DeleteDto{}
|
||||||
dto.Id = uint16(id)
|
dto.Id = uint(id)
|
||||||
res, err := u.Delete(dto)
|
res, err := u.Delete(dto)
|
||||||
rw.DataResponse(w, res, err)
|
rw.DataResponse(w, res, err)
|
||||||
}
|
}
|
||||||
@@ -88,7 +85,7 @@ func (obj myBase) Verify(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
dto.Id = uint16(id)
|
dto.Id = uint(id)
|
||||||
authInfo, err := pa.GetAuthInfo(r)
|
authInfo, err := pa.GetAuthInfo(r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": err.Error()}, nil)
|
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": err.Error()}, nil)
|
||||||
@@ -107,7 +104,7 @@ func (obj myBase) Reject(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dto := e.VerifyDto{}
|
dto := e.VerifyDto{}
|
||||||
dto.Id = uint16(id)
|
dto.Id = uint(id)
|
||||||
authInfo, err := pa.GetAuthInfo(r)
|
authInfo, err := pa.GetAuthInfo(r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": err.Error()}, nil)
|
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": err.Error()}, nil)
|
||||||
|
|||||||
@@ -325,7 +325,7 @@ func (obj myBase) CreateWithPatient(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// validate SubClass
|
// validate SubClass
|
||||||
if err := verifyClassCode(dto.Encounter); err != nil {
|
if err := verifyClassCode(dto.CreateDto); err != nil {
|
||||||
rw.DataResponse(w, nil, d.FieldError{
|
rw.DataResponse(w, nil, d.FieldError{
|
||||||
Code: dataValidationFail,
|
Code: dataValidationFail,
|
||||||
Message: err.Error(),
|
Message: err.Error(),
|
||||||
@@ -333,7 +333,7 @@ func (obj myBase) CreateWithPatient(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
dto.Encounter.AuthInfo = *authInfo
|
dto.AuthInfo = *authInfo
|
||||||
dto.Patient.AuthInfo = *authInfo
|
dto.Patient.AuthInfo = *authInfo
|
||||||
res, err := u.CreateWithPatient(dto)
|
res, err := u.CreateWithPatient(dto)
|
||||||
rw.DataResponse(w, res, err)
|
rw.DataResponse(w, res, err)
|
||||||
|
|||||||
@@ -71,3 +71,12 @@ func (obj myBase) Delete(w http.ResponseWriter, r *http.Request) {
|
|||||||
res, err := u.Delete(dto)
|
res, err := u.Delete(dto)
|
||||||
rw.DataResponse(w, res, err)
|
rw.DataResponse(w, res, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (obj myBase) CreateBulk(w http.ResponseWriter, r *http.Request) {
|
||||||
|
dto := e.CreateBulkDto{}
|
||||||
|
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
res, err := u.CreateBulk(dto)
|
||||||
|
rw.DataResponse(w, res, err)
|
||||||
|
}
|
||||||
@@ -0,0 +1,146 @@
|
|||||||
|
package kfr
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
d "github.com/karincake/dodol"
|
||||||
|
rw "github.com/karincake/risoles"
|
||||||
|
sf "github.com/karincake/semprit"
|
||||||
|
|
||||||
|
// ua "github.com/karincake/tumpeng/auth/svc"
|
||||||
|
|
||||||
|
e "simrs-vx/internal/domain/main-entities/kfr"
|
||||||
|
u "simrs-vx/internal/use-case/main-use-case/kfr"
|
||||||
|
|
||||||
|
erc "simrs-vx/internal/domain/references/common"
|
||||||
|
|
||||||
|
pa "simrs-vx/internal/lib/auth"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Create(w http.ResponseWriter, r *http.Request) {
|
||||||
|
authInfo, err := pa.GetAuthInfo(r)
|
||||||
|
if err != nil {
|
||||||
|
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": err.Error()}, nil)
|
||||||
|
}
|
||||||
|
dto := e.CreateDto{}
|
||||||
|
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if !dto.IsCorrectType() {
|
||||||
|
rw.WriteJSON(w, http.StatusBadRequest, d.IS{"message": "invalid kfr type"}, nil)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if !dto.IsCorrectFollowUpType() {
|
||||||
|
rw.WriteJSON(w, http.StatusBadRequest, d.IS{"message": "invalid kfr followUpType"}, nil)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
dto.AuthInfo = *authInfo
|
||||||
|
res, err := u.Create(dto)
|
||||||
|
rw.DataResponse(w, res, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetList(w http.ResponseWriter, r *http.Request) {
|
||||||
|
dto := e.ReadListDto{}
|
||||||
|
sf.UrlQueryParam(&dto, *r.URL)
|
||||||
|
res, err := u.ReadList(dto)
|
||||||
|
rw.DataResponse(w, res, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetDetail(w http.ResponseWriter, r *http.Request) {
|
||||||
|
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||||
|
if id <= 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
dto := e.ReadDetailDto{}
|
||||||
|
sf.UrlQueryParam(&dto, *r.URL)
|
||||||
|
dto.Id = uint(id)
|
||||||
|
res, err := u.ReadDetail(dto)
|
||||||
|
rw.DataResponse(w, res, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
func Update(w http.ResponseWriter, r *http.Request) {
|
||||||
|
authInfo, err := pa.GetAuthInfo(r)
|
||||||
|
if err != nil {
|
||||||
|
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": err.Error()}, nil)
|
||||||
|
}
|
||||||
|
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||||
|
if id <= 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
dto := e.UpdateDto{}
|
||||||
|
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if !dto.IsCorrectType() {
|
||||||
|
rw.WriteJSON(w, http.StatusBadRequest, d.IS{"message": "invalid kfr type"}, nil)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if !dto.IsCorrectFollowUpType() {
|
||||||
|
rw.WriteJSON(w, http.StatusBadRequest, d.IS{"message": "invalid kfr followUpType"}, nil)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
dto.Id = uint(id)
|
||||||
|
dto.AuthInfo = *authInfo
|
||||||
|
res, err := u.Update(dto)
|
||||||
|
rw.DataResponse(w, res, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
func Delete(w http.ResponseWriter, r *http.Request) {
|
||||||
|
authInfo, err := pa.GetAuthInfo(r)
|
||||||
|
if err != nil {
|
||||||
|
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": err.Error()}, nil)
|
||||||
|
}
|
||||||
|
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||||
|
if id <= 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
dto := e.DeleteDto{}
|
||||||
|
dto.Id = uint(id)
|
||||||
|
dto.AuthInfo = *authInfo
|
||||||
|
res, err := u.Delete(dto)
|
||||||
|
rw.DataResponse(w, res, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
func Verify(w http.ResponseWriter, r *http.Request) {
|
||||||
|
authInfo, err := pa.GetAuthInfo(r)
|
||||||
|
if err != nil {
|
||||||
|
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": err.Error()}, nil)
|
||||||
|
}
|
||||||
|
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||||
|
if id <= 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
dto := e.UpdateDto{}
|
||||||
|
dto.Id = uint(id)
|
||||||
|
dto.Status_Code = erc.DVCVerified
|
||||||
|
dto.AuthInfo = *authInfo
|
||||||
|
res, err := u.UpdateStatusCode(dto)
|
||||||
|
rw.DataResponse(w, res, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
func Validate(w http.ResponseWriter, r *http.Request) {
|
||||||
|
authInfo, err := pa.GetAuthInfo(r)
|
||||||
|
if err != nil {
|
||||||
|
rw.WriteJSON(w, http.StatusUnauthorized, d.IS{"message": err.Error()}, nil)
|
||||||
|
}
|
||||||
|
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||||
|
if id <= 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
dto := e.UpdateDto{}
|
||||||
|
dto.Id = uint(id)
|
||||||
|
dto.Status_Code = erc.DVCValidated
|
||||||
|
dto.AuthInfo = *authInfo
|
||||||
|
res, err := u.UpdateStatusCode(dto)
|
||||||
|
rw.DataResponse(w, res, err)
|
||||||
|
}
|
||||||
@@ -9,7 +9,6 @@ import (
|
|||||||
ambulancetransportrequest "simrs-vx/internal/interface/main-handler/ambulance-transport-req"
|
ambulancetransportrequest "simrs-vx/internal/interface/main-handler/ambulance-transport-req"
|
||||||
auth "simrs-vx/internal/interface/main-handler/authentication"
|
auth "simrs-vx/internal/interface/main-handler/authentication"
|
||||||
chemo "simrs-vx/internal/interface/main-handler/chemo"
|
chemo "simrs-vx/internal/interface/main-handler/chemo"
|
||||||
chemoprotocol "simrs-vx/internal/interface/main-handler/chemo-protocol"
|
|
||||||
consultation "simrs-vx/internal/interface/main-handler/consultation"
|
consultation "simrs-vx/internal/interface/main-handler/consultation"
|
||||||
controlletter "simrs-vx/internal/interface/main-handler/control-letter"
|
controlletter "simrs-vx/internal/interface/main-handler/control-letter"
|
||||||
counter "simrs-vx/internal/interface/main-handler/counter"
|
counter "simrs-vx/internal/interface/main-handler/counter"
|
||||||
@@ -20,6 +19,7 @@ import (
|
|||||||
generalconsent "simrs-vx/internal/interface/main-handler/general-consent"
|
generalconsent "simrs-vx/internal/interface/main-handler/general-consent"
|
||||||
generatefile "simrs-vx/internal/interface/main-handler/generate-file"
|
generatefile "simrs-vx/internal/interface/main-handler/generate-file"
|
||||||
internalreference "simrs-vx/internal/interface/main-handler/internal-reference"
|
internalreference "simrs-vx/internal/interface/main-handler/internal-reference"
|
||||||
|
kfr "simrs-vx/internal/interface/main-handler/kfr"
|
||||||
materialorder "simrs-vx/internal/interface/main-handler/material-order"
|
materialorder "simrs-vx/internal/interface/main-handler/material-order"
|
||||||
materialorderitem "simrs-vx/internal/interface/main-handler/material-order-item"
|
materialorderitem "simrs-vx/internal/interface/main-handler/material-order-item"
|
||||||
mcuorder "simrs-vx/internal/interface/main-handler/mcu-order"
|
mcuorder "simrs-vx/internal/interface/main-handler/mcu-order"
|
||||||
@@ -43,6 +43,7 @@ import (
|
|||||||
screening "simrs-vx/internal/interface/main-handler/screening"
|
screening "simrs-vx/internal/interface/main-handler/screening"
|
||||||
soapi "simrs-vx/internal/interface/main-handler/soapi"
|
soapi "simrs-vx/internal/interface/main-handler/soapi"
|
||||||
uploadfile "simrs-vx/internal/interface/main-handler/upload-file"
|
uploadfile "simrs-vx/internal/interface/main-handler/upload-file"
|
||||||
|
vaccineData "simrs-vx/internal/interface/main-handler/vaccine-data"
|
||||||
|
|
||||||
/******************** actor ********************/
|
/******************** actor ********************/
|
||||||
authpartner "simrs-vx/internal/interface/main-handler/auth-partner"
|
authpartner "simrs-vx/internal/interface/main-handler/auth-partner"
|
||||||
@@ -64,6 +65,7 @@ import (
|
|||||||
hk "github.com/karincake/hongkue"
|
hk "github.com/karincake/hongkue"
|
||||||
|
|
||||||
/******************** infra ********************/
|
/******************** infra ********************/
|
||||||
|
assets "simrs-vx/internal/infra/assets"
|
||||||
ibpjs "simrs-vx/internal/infra/bpjs"
|
ibpjs "simrs-vx/internal/infra/bpjs"
|
||||||
docscfg "simrs-vx/internal/infra/docs-cfg"
|
docscfg "simrs-vx/internal/infra/docs-cfg"
|
||||||
gs "simrs-vx/internal/infra/gorm-setting"
|
gs "simrs-vx/internal/infra/gorm-setting"
|
||||||
@@ -82,6 +84,8 @@ import (
|
|||||||
/******************** sources ********************/
|
/******************** sources ********************/
|
||||||
antibioticsrc "simrs-vx/internal/interface/main-handler/antibiotic-src"
|
antibioticsrc "simrs-vx/internal/interface/main-handler/antibiotic-src"
|
||||||
antibioticsrccat "simrs-vx/internal/interface/main-handler/antibiotic-src-category"
|
antibioticsrccat "simrs-vx/internal/interface/main-handler/antibiotic-src-category"
|
||||||
|
chemoplan "simrs-vx/internal/interface/main-handler/chemo-plan"
|
||||||
|
chemoprotocol "simrs-vx/internal/interface/main-handler/chemo-protocol"
|
||||||
device "simrs-vx/internal/interface/main-handler/device"
|
device "simrs-vx/internal/interface/main-handler/device"
|
||||||
diagnosesrc "simrs-vx/internal/interface/main-handler/diagnose-src"
|
diagnosesrc "simrs-vx/internal/interface/main-handler/diagnose-src"
|
||||||
division "simrs-vx/internal/interface/main-handler/division"
|
division "simrs-vx/internal/interface/main-handler/division"
|
||||||
@@ -158,6 +162,12 @@ func SetRoutes() http.Handler {
|
|||||||
|
|
||||||
r := http.NewServeMux()
|
r := http.NewServeMux()
|
||||||
|
|
||||||
|
r.Handle("/assets/",
|
||||||
|
http.StripPrefix("/assets/",
|
||||||
|
http.FileServer(http.Dir(assets.GetAssetsDir())),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
/******************** Main ********************/
|
/******************** Main ********************/
|
||||||
r.HandleFunc("/", home.Home)
|
r.HandleFunc("/", home.Home)
|
||||||
|
|
||||||
@@ -314,8 +324,20 @@ func SetRoutes() http.Handler {
|
|||||||
"PATCH /{id}/verify": therapyprotocol.O.Verify,
|
"PATCH /{id}/verify": therapyprotocol.O.Verify,
|
||||||
"PATCH /{id}/reject": therapyprotocol.O.Reject,
|
"PATCH /{id}/reject": therapyprotocol.O.Reject,
|
||||||
})
|
})
|
||||||
hc.RegCrud(r, "/v1/chemo-protocol", chemoprotocol.O)
|
hk.GroupRoutes("/v1/chemo-protocol", r, auth.GuardMW, hk.MapHandlerFunc{
|
||||||
|
"GET /": chemoprotocol.O.GetList,
|
||||||
|
"GET /{id}": chemoprotocol.O.GetDetail,
|
||||||
|
"POST /": chemoprotocol.O.Create,
|
||||||
|
"PATCH /{id}": chemoprotocol.O.Update,
|
||||||
|
"DELETE /{id}": chemoprotocol.O.Delete,
|
||||||
|
"PATCH /{id}/verify": chemoprotocol.O.Verify,
|
||||||
|
"PATCH /{id}/reject": chemoprotocol.O.Reject,
|
||||||
|
})
|
||||||
|
hk.GroupRoutes("/v1/chemo-plan", r, auth.GuardMW, hk.MapHandlerFunc{
|
||||||
|
"PATCH /{id}/fail": chemoplan.O.Fail,
|
||||||
|
})
|
||||||
hc.RegCrud(r, "/v1/upload-file", uploadfile.O)
|
hc.RegCrud(r, "/v1/upload-file", uploadfile.O)
|
||||||
|
hc.RegCrud(r, "/v1/vaccine-data", vaccineData.O)
|
||||||
hc.RegCrud(r, "/v1/encounter-document", encounterdocument.O)
|
hc.RegCrud(r, "/v1/encounter-document", encounterdocument.O)
|
||||||
hc.RegCrud(r, "/v1/general-consent", generalconsent.O)
|
hc.RegCrud(r, "/v1/general-consent", generalconsent.O)
|
||||||
r.HandleFunc("POST /v1/generate-file", generatefile.Generate)
|
r.HandleFunc("POST /v1/generate-file", generatefile.Generate)
|
||||||
@@ -333,6 +355,15 @@ func SetRoutes() http.Handler {
|
|||||||
"GET /": screening.O.GetList,
|
"GET /": screening.O.GetList,
|
||||||
"GET /{id}": screening.O.GetDetail,
|
"GET /{id}": screening.O.GetDetail,
|
||||||
})
|
})
|
||||||
|
hk.GroupRoutes("/v1/kfr", r, auth.GuardMW, hk.MapHandlerFunc{
|
||||||
|
"POST /": kfr.Create,
|
||||||
|
"GET /": kfr.GetList,
|
||||||
|
"GET /{id}": kfr.GetDetail,
|
||||||
|
"PATCH /{id}": kfr.Update,
|
||||||
|
"DELETE /{id}": kfr.Delete,
|
||||||
|
"PATCH /{id}/verify": kfr.Verify,
|
||||||
|
"PATCH /{id}/validate": kfr.Validate,
|
||||||
|
})
|
||||||
/******************** actor ********************/
|
/******************** actor ********************/
|
||||||
hc.RegCrud(r, "/v1/person", person.O)
|
hc.RegCrud(r, "/v1/person", person.O)
|
||||||
hc.RegCrud(r, "/v1/person-address", personaddress.O)
|
hc.RegCrud(r, "/v1/person-address", personaddress.O)
|
||||||
@@ -366,10 +397,31 @@ func SetRoutes() http.Handler {
|
|||||||
/******************** sources ********************/
|
/******************** sources ********************/
|
||||||
hc.RegCrudByCode(r, "/v1/division", division.O)
|
hc.RegCrudByCode(r, "/v1/division", division.O)
|
||||||
hc.RegCrudByCode(r, "/v1/division-position", divisionposition.O)
|
hc.RegCrudByCode(r, "/v1/division-position", divisionposition.O)
|
||||||
hc.RegCrudByCode(r, "/v1/installation", installation.O)
|
hk.GroupRoutes("/v1/installation", r, hk.MapHandlerFunc{
|
||||||
|
"GET /": installation.O.GetList,
|
||||||
|
"GET /{id}": installation.O.GetDetail,
|
||||||
|
"POST /": installation.O.Create,
|
||||||
|
"PATCH /{id}": installation.O.Update,
|
||||||
|
"DELETE /{id}": installation.O.Delete,
|
||||||
|
"POST /bulk": installation.O.CreateBulk,
|
||||||
|
})
|
||||||
hc.RegCrudByCode(r, "/v1/installation-position", installationposition.O)
|
hc.RegCrudByCode(r, "/v1/installation-position", installationposition.O)
|
||||||
hc.RegCrudByCode(r, "/v1/specialist", specialist.O)
|
hk.GroupRoutes("/v1/specialist", r, hk.MapHandlerFunc{
|
||||||
hc.RegCrudByCode(r, "/v1/subspecialist", subspecialist.O)
|
"GET /": specialist.O.GetList,
|
||||||
|
"GET /{id}": specialist.O.GetDetail,
|
||||||
|
"POST /": specialist.O.Create,
|
||||||
|
"PATCH /{id}": specialist.O.Update,
|
||||||
|
"DELETE /{id}": specialist.O.Delete,
|
||||||
|
"POST /bulk": specialist.O.CreateBulk,
|
||||||
|
})
|
||||||
|
hk.GroupRoutes("/v1/subspecialist", r, hk.MapHandlerFunc{
|
||||||
|
"GET /": subspecialist.O.GetList,
|
||||||
|
"GET /{id}": subspecialist.O.GetDetail,
|
||||||
|
"POST /": subspecialist.O.Create,
|
||||||
|
"PATCH /{id}": subspecialist.O.Update,
|
||||||
|
"DELETE /{id}": subspecialist.O.Delete,
|
||||||
|
"POST /bulk": subspecialist.O.CreateBulk,
|
||||||
|
})
|
||||||
hc.RegCrudByCode(r, "/v1/specialist-position", specialistposition.O)
|
hc.RegCrudByCode(r, "/v1/specialist-position", specialistposition.O)
|
||||||
hc.RegCrudByCode(r, "/v1/subspecialist-position", subspecialistposition.O)
|
hc.RegCrudByCode(r, "/v1/subspecialist-position", subspecialistposition.O)
|
||||||
hc.RegCrudByCode(r, "/v1/infra", infra.O)
|
hc.RegCrudByCode(r, "/v1/infra", infra.O)
|
||||||
@@ -413,7 +465,9 @@ func SetRoutes() http.Handler {
|
|||||||
})
|
})
|
||||||
|
|
||||||
hk.GroupRoutes("/v1/vclaim-sep-control-letter", r, hk.MapHandlerFunc{
|
hk.GroupRoutes("/v1/vclaim-sep-control-letter", r, hk.MapHandlerFunc{
|
||||||
"POST /": vclaimsepcontrolletter.O.Create,
|
"POST /": vclaimsepcontrolletter.O.Create,
|
||||||
|
"GET /{number}": vclaimsepcontrolletter.O.GetDetail,
|
||||||
|
"DELETE /{number}": vclaimsepcontrolletter.O.Delete,
|
||||||
})
|
})
|
||||||
|
|
||||||
hk.GroupRoutes("/v1/vclaim-sep-hist", r, hk.MapHandlerFunc{
|
hk.GroupRoutes("/v1/vclaim-sep-hist", r, hk.MapHandlerFunc{
|
||||||
|
|||||||
@@ -71,3 +71,12 @@ func (obj myBase) Delete(w http.ResponseWriter, r *http.Request) {
|
|||||||
res, err := u.Delete(dto)
|
res, err := u.Delete(dto)
|
||||||
rw.DataResponse(w, res, err)
|
rw.DataResponse(w, res, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (obj myBase) CreateBulk(w http.ResponseWriter, r *http.Request) {
|
||||||
|
dto := e.CreateBulkDto{}
|
||||||
|
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
res, err := u.CreateBulk(dto)
|
||||||
|
rw.DataResponse(w, res, err)
|
||||||
|
}
|
||||||
@@ -71,3 +71,12 @@ func (obj myBase) Delete(w http.ResponseWriter, r *http.Request) {
|
|||||||
res, err := u.Delete(dto)
|
res, err := u.Delete(dto)
|
||||||
rw.DataResponse(w, res, err)
|
rw.DataResponse(w, res, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (obj myBase) CreateBulk(w http.ResponseWriter, r *http.Request) {
|
||||||
|
dto := e.CreateBulkDto{}
|
||||||
|
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
res, err := u.CreateBulk(dto)
|
||||||
|
rw.DataResponse(w, res, err)
|
||||||
|
}
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
package vaccinedata
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
rw "github.com/karincake/risoles"
|
||||||
|
sf "github.com/karincake/semprit"
|
||||||
|
|
||||||
|
// ua "github.com/karincake/tumpeng/auth/svc"
|
||||||
|
|
||||||
|
e "simrs-vx/internal/domain/main-entities/vaccine-data"
|
||||||
|
u "simrs-vx/internal/use-case/main-use-case/vaccine-data"
|
||||||
|
)
|
||||||
|
|
||||||
|
type myBase struct{}
|
||||||
|
|
||||||
|
var O myBase
|
||||||
|
|
||||||
|
func (obj myBase) Create(w http.ResponseWriter, r *http.Request) {
|
||||||
|
dto := e.CreateDto{}
|
||||||
|
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
res, err := u.Create(dto)
|
||||||
|
rw.DataResponse(w, res, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (obj myBase) GetList(w http.ResponseWriter, r *http.Request) {
|
||||||
|
dto := e.ReadListDto{}
|
||||||
|
sf.UrlQueryParam(&dto, *r.URL)
|
||||||
|
res, err := u.ReadList(dto)
|
||||||
|
rw.DataResponse(w, res, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) {
|
||||||
|
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||||
|
if id <= 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
dto := e.ReadDetailDto{}
|
||||||
|
sf.UrlQueryParam(&dto, *r.URL)
|
||||||
|
dto.Id = uint16(id)
|
||||||
|
res, err := u.ReadDetail(dto)
|
||||||
|
rw.DataResponse(w, res, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (obj myBase) Update(w http.ResponseWriter, r *http.Request) {
|
||||||
|
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||||
|
if id <= 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
dto := e.UpdateDto{}
|
||||||
|
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
dto.Id = uint(id)
|
||||||
|
res, err := u.Update(dto)
|
||||||
|
rw.DataResponse(w, res, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (obj myBase) Delete(w http.ResponseWriter, r *http.Request) {
|
||||||
|
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||||
|
if id <= 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
dto := e.DeleteDto{}
|
||||||
|
dto.Id = uint(id)
|
||||||
|
res, err := u.Delete(dto)
|
||||||
|
rw.DataResponse(w, res, err)
|
||||||
|
}
|
||||||
@@ -29,16 +29,16 @@ func (obj myBase) Create(w http.ResponseWriter, r *http.Request) {
|
|||||||
// rw.DataResponse(w, res, err)
|
// rw.DataResponse(w, res, err)
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) {
|
func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) {
|
||||||
// number := rw.ValidateString(w, "number", r.PathValue("number"))
|
number := rw.ValidateString(w, "number", r.PathValue("number"))
|
||||||
// if number <= "" {
|
if number == "" {
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
// dto := e.ReadDetailDto{}
|
dto := e.ReadDetailDto{}
|
||||||
// dto.Number = &number
|
dto.Number = &number
|
||||||
// res, err := u.ReadDetail(dto)
|
res, err := u.ReadDetail(dto)
|
||||||
// rw.DataResponse(w, res, err)
|
rw.DataResponse(w, res, err)
|
||||||
// }
|
}
|
||||||
|
|
||||||
// func (obj myBase) Update(w http.ResponseWriter, r *http.Request) {
|
// func (obj myBase) Update(w http.ResponseWriter, r *http.Request) {
|
||||||
// number := rw.ValidateString(w, "number", r.PathValue("number"))
|
// number := rw.ValidateString(w, "number", r.PathValue("number"))
|
||||||
@@ -55,13 +55,13 @@ func (obj myBase) Create(w http.ResponseWriter, r *http.Request) {
|
|||||||
// rw.DataResponse(w, res, err)
|
// rw.DataResponse(w, res, err)
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// func (obj myBase) Delete(w http.ResponseWriter, r *http.Request) {
|
func (obj myBase) Delete(w http.ResponseWriter, r *http.Request) {
|
||||||
// id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
number := rw.ValidateString(w, "number", r.PathValue("number"))
|
||||||
// if id <= 0 {
|
if number == "" {
|
||||||
// return
|
return
|
||||||
// }
|
}
|
||||||
// dto := e.DeleteDto{}
|
dto := e.DeleteDto{}
|
||||||
// dto.Id = uint(id)
|
dto.Number = &number
|
||||||
// res, err := u.Delete(dto)
|
res, err := u.Delete(dto)
|
||||||
// rw.DataResponse(w, res, err)
|
rw.DataResponse(w, res, err)
|
||||||
// }
|
}
|
||||||
@@ -46,6 +46,7 @@ import (
|
|||||||
internalreference "simrs-vx/internal/domain/main-entities/internal-reference"
|
internalreference "simrs-vx/internal/domain/main-entities/internal-reference"
|
||||||
item "simrs-vx/internal/domain/main-entities/item"
|
item "simrs-vx/internal/domain/main-entities/item"
|
||||||
itemprice "simrs-vx/internal/domain/main-entities/item-price"
|
itemprice "simrs-vx/internal/domain/main-entities/item-price"
|
||||||
|
kfr "simrs-vx/internal/domain/main-entities/kfr"
|
||||||
laborant "simrs-vx/internal/domain/main-entities/laborant"
|
laborant "simrs-vx/internal/domain/main-entities/laborant"
|
||||||
language "simrs-vx/internal/domain/main-entities/language"
|
language "simrs-vx/internal/domain/main-entities/language"
|
||||||
material "simrs-vx/internal/domain/main-entities/material"
|
material "simrs-vx/internal/domain/main-entities/material"
|
||||||
@@ -112,6 +113,7 @@ import (
|
|||||||
uom "simrs-vx/internal/domain/main-entities/uom"
|
uom "simrs-vx/internal/domain/main-entities/uom"
|
||||||
user "simrs-vx/internal/domain/main-entities/user"
|
user "simrs-vx/internal/domain/main-entities/user"
|
||||||
userfes "simrs-vx/internal/domain/main-entities/user-fes"
|
userfes "simrs-vx/internal/domain/main-entities/user-fes"
|
||||||
|
vaccinedata "simrs-vx/internal/domain/main-entities/vaccine-data"
|
||||||
vehicle "simrs-vx/internal/domain/main-entities/vehicle"
|
vehicle "simrs-vx/internal/domain/main-entities/vehicle"
|
||||||
vehiclehist "simrs-vx/internal/domain/main-entities/vehicle-hist"
|
vehiclehist "simrs-vx/internal/domain/main-entities/vehicle-hist"
|
||||||
village "simrs-vx/internal/domain/main-entities/village"
|
village "simrs-vx/internal/domain/main-entities/village"
|
||||||
@@ -241,6 +243,7 @@ func getMainEntities() []any {
|
|||||||
&vclaimmember.VclaimMember{},
|
&vclaimmember.VclaimMember{},
|
||||||
&controlletter.ControlLetter{},
|
&controlletter.ControlLetter{},
|
||||||
&rehab.Rehab{},
|
&rehab.Rehab{},
|
||||||
|
&vaccinedata.VaccineData{},
|
||||||
&chemoprotocol.ChemoProtocol{},
|
&chemoprotocol.ChemoProtocol{},
|
||||||
&fileattachemnt.EncounterDocument{},
|
&fileattachemnt.EncounterDocument{},
|
||||||
&vclaimsepcontrolletter.VclaimSepControlLetter{},
|
&vclaimsepcontrolletter.VclaimSepControlLetter{},
|
||||||
@@ -249,5 +252,6 @@ func getMainEntities() []any {
|
|||||||
&screening.Screening{},
|
&screening.Screening{},
|
||||||
&procedurereport.ProcedureReport{},
|
&procedurereport.ProcedureReport{},
|
||||||
&chemoplan.ChemoPlan{},
|
&chemoplan.ChemoPlan{},
|
||||||
|
&kfr.KFR{},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5,6 +5,7 @@ import (
|
|||||||
|
|
||||||
/******************** infra ********************/
|
/******************** infra ********************/
|
||||||
gs "simrs-vx/internal/infra/gorm-setting"
|
gs "simrs-vx/internal/infra/gorm-setting"
|
||||||
|
satudb "simrs-vx/internal/infra/satu-db"
|
||||||
simgosdb "simrs-vx/internal/infra/simgos-db"
|
simgosdb "simrs-vx/internal/infra/simgos-db"
|
||||||
sync "simrs-vx/internal/infra/sync-cfg"
|
sync "simrs-vx/internal/infra/sync-cfg"
|
||||||
|
|
||||||
@@ -43,6 +44,7 @@ func SetRoutes() http.Handler {
|
|||||||
a.RegisterExtCall(lh.Populate)
|
a.RegisterExtCall(lh.Populate)
|
||||||
a.RegisterExtCall(sync.SetConfig)
|
a.RegisterExtCall(sync.SetConfig)
|
||||||
a.RegisterExtCall(simgosdb.SetInstance)
|
a.RegisterExtCall(simgosdb.SetInstance)
|
||||||
|
a.RegisterExtCall(satudb.SetInstance)
|
||||||
|
|
||||||
r := http.NewServeMux()
|
r := http.NewServeMux()
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ func CreateSepControlLetter(input *e.CreateDto, data *e.VclaimSepControlLetter,
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
var vresp Response
|
var vresp e.VclaimResponse
|
||||||
if err := json.Unmarshal(body, &vresp); err != nil {
|
if err := json.Unmarshal(body, &vresp); err != nil {
|
||||||
return fmt.Errorf("failed to parse response JSON: %w", err)
|
return fmt.Errorf("failed to parse response JSON: %w", err)
|
||||||
}
|
}
|
||||||
@@ -55,71 +55,68 @@ func CreateSepControlLetter(input *e.CreateDto, data *e.VclaimSepControlLetter,
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// func ReadDetailSep(input *e.ReadDetailDto, data *e.VclaimSep, tx *gorm.DB) error {
|
func DeleteSepControlLetter(input *e.DeleteDto, data *e.VclaimSepControlLetter, tx *gorm.DB) error {
|
||||||
// endpoint := fmt.Sprintf("sep/%s", input.Number)
|
payload, err := input.RequestPayloadIntoJson()
|
||||||
// req, err := http.NewRequest("GET", ibpjs.O.BaseUrl+endpoint, nil)
|
if err != nil {
|
||||||
// if err != nil {
|
return err
|
||||||
// return err
|
}
|
||||||
// }
|
req, err := http.NewRequest("DELETE", ibpjs.O.BaseUrl+"RencanaKontrol/Delete", bytes.NewBuffer(payload))
|
||||||
// req.Header.Set("Content-Type", "application/json")
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
req.Header.Set("Content-Type", "application/json")
|
||||||
|
|
||||||
// resp, err := http.DefaultClient.Do(req)
|
resp, err := http.DefaultClient.Do(req)
|
||||||
// if err != nil {
|
if err != nil {
|
||||||
// return err
|
return err
|
||||||
// }
|
}
|
||||||
// defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
|
|
||||||
// body, err := io.ReadAll(resp.Body)
|
body, err := io.ReadAll(resp.Body)
|
||||||
// if err != nil {
|
if err != nil {
|
||||||
// return err
|
return err
|
||||||
// }
|
}
|
||||||
|
|
||||||
// var detail e.SepResponse
|
var vresp e.VclaimResponse
|
||||||
// if err := json.Unmarshal(body, &detail); err != nil {
|
if err := json.Unmarshal(body, &vresp); err != nil {
|
||||||
// return fmt.Errorf("failed to parse response JSON: %w", err)
|
return fmt.Errorf("failed to parse response JSON: %w", err)
|
||||||
// }
|
}
|
||||||
|
|
||||||
// data.Detail = detail.Response
|
if vresp.MetaData.Code != "200" {
|
||||||
|
return fmt.Errorf("failed to delete sep control letter: %s", vresp.MetaData.Message)
|
||||||
|
}
|
||||||
|
|
||||||
// return nil
|
return nil
|
||||||
// }
|
}
|
||||||
|
|
||||||
// func DeleteSep(input *e.DeleteDto, data *e.VclaimSep, tx *gorm.DB) error {
|
func GetDetailSepControlLetterByNumber(input *e.ReadDetailDto, data *e.VclaimSepControlLetter, tx *gorm.DB) error {
|
||||||
// payload := e.SepDeleteRequest{}
|
req, err := http.NewRequest("GET", ibpjs.O.BaseUrl+"RencanaKontrol/noSuratKontrol/"+*input.Number, nil)
|
||||||
// payload.Request.TSep.NoSep = *input.Number
|
if err != nil {
|
||||||
// payload.Request.TSep.User = "Coba Ws"
|
return err
|
||||||
|
}
|
||||||
|
req.Header.Set("Content-Type", "application/json")
|
||||||
|
|
||||||
// jsonPayload, err := json.Marshal(payload)
|
resp, err := http.DefaultClient.Do(req)
|
||||||
// if err != nil {
|
if err != nil {
|
||||||
// return err
|
return err
|
||||||
// }
|
}
|
||||||
|
defer resp.Body.Close()
|
||||||
|
|
||||||
// req, err := http.NewRequest("DELETE", ibpjs.O.BaseUrl+"sep", bytes.NewBuffer(jsonPayload))
|
body, err := io.ReadAll(resp.Body)
|
||||||
// if err != nil {
|
if err != nil {
|
||||||
// return err
|
return err
|
||||||
// }
|
}
|
||||||
|
|
||||||
// req.Header.Set("Content-Type", "application/json")
|
var vresp e.DetailVclaimResponse
|
||||||
|
if err := json.Unmarshal(body, &vresp); err != nil {
|
||||||
|
return fmt.Errorf("failed to parse response JSON: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
// resp, err := http.DefaultClient.Do(req)
|
if vresp.MetaData.Code != "200" {
|
||||||
// if err != nil {
|
return fmt.Errorf("failed to get detail sep control letter by number: %s", vresp.MetaData.Message)
|
||||||
// return err
|
}
|
||||||
// }
|
|
||||||
// defer resp.Body.Close()
|
|
||||||
|
|
||||||
// body, err := io.ReadAll(resp.Body)
|
data.Detail = vresp.Response
|
||||||
// if err != nil {
|
|
||||||
// return err
|
|
||||||
// }
|
|
||||||
|
|
||||||
// var detail e.SepResponse
|
return nil
|
||||||
// if err := json.Unmarshal(body, &detail); err != nil {
|
}
|
||||||
// return fmt.Errorf("failed to parse response JSON: %w", err)
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if detail.MetaData.Message == SepNotFound {
|
|
||||||
// return fmt.Errorf("sep with number %s not found", *data.Number)
|
|
||||||
// }
|
|
||||||
|
|
||||||
// return nil
|
|
||||||
// }
|
|
||||||
@@ -1,87 +0,0 @@
|
|||||||
package vclaimsepcontrolletter
|
|
||||||
|
|
||||||
import (
|
|
||||||
"encoding/json"
|
|
||||||
|
|
||||||
e "simrs-vx/internal/domain/bpjs-entities/vclaim-sep-control-letter"
|
|
||||||
)
|
|
||||||
|
|
||||||
type SuratKontrol struct {
|
|
||||||
NoSuratKontrol string `json:"noSuratKontrol"`
|
|
||||||
TglRencanaKontrol string `json:"tglRencanaKontrol"`
|
|
||||||
TglTerbit string `json:"tglTerbit"`
|
|
||||||
JnsKontrol string `json:"jnsKontrol"`
|
|
||||||
PoliTujuan string `json:"poliTujuan"`
|
|
||||||
NamaPoliTujuan string `json:"namaPoliTujuan"`
|
|
||||||
KodeDokter string `json:"kodeDokter"`
|
|
||||||
NamaDokter string `json:"namaDokter"`
|
|
||||||
FlagKontrol string `json:"flagKontrol"`
|
|
||||||
KodeDokterPembuat *string `json:"kodeDokterPembuat"`
|
|
||||||
NamaDokterPembuat *string `json:"namaDokterPembuat"`
|
|
||||||
NamaJnsKontrol string `json:"namaJnsKontrol"`
|
|
||||||
Sep Sep `json:"sep"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type Sep struct {
|
|
||||||
NoSep string `json:"noSep"`
|
|
||||||
TglSep string `json:"tglSep"`
|
|
||||||
JnsPelayanan string `json:"jnsPelayanan"`
|
|
||||||
Poli string `json:"poli"`
|
|
||||||
Diagnosa string `json:"diagnosa"`
|
|
||||||
Peserta Peserta `json:"peserta"`
|
|
||||||
ProvUmum ProvUmum `json:"provUmum"`
|
|
||||||
ProvPerujuk ProvPerujuk `json:"provPerujuk"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type Peserta struct {
|
|
||||||
NoKartu string `json:"noKartu"`
|
|
||||||
Nama string `json:"nama"`
|
|
||||||
TglLahir string `json:"tglLahir"`
|
|
||||||
Kelamin string `json:"kelamin"`
|
|
||||||
HakKelas string `json:"hakKelas"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type ProvUmum struct {
|
|
||||||
KdProvider string `json:"kdProvider"`
|
|
||||||
NmProvider string `json:"nmProvider"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type ProvPerujuk struct {
|
|
||||||
KdProviderPerujuk string `json:"kdProviderPerujuk"`
|
|
||||||
NmProviderPerujuk string `json:"nmProviderPerujuk"`
|
|
||||||
AsalRujukan string `json:"asalRujukan"`
|
|
||||||
NoRujukan string `json:"noRujukan"`
|
|
||||||
TglRujukan string `json:"tglRujukan"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type Response struct {
|
|
||||||
MetaData MetaData `json:"metaData"`
|
|
||||||
Response *SuratKontrol `json:"response"` // nullable
|
|
||||||
}
|
|
||||||
|
|
||||||
type MetaData struct {
|
|
||||||
Code string `json:"code"`
|
|
||||||
Message string `json:"message"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r Response) ToPDFNeeds() ([]byte, error) {
|
|
||||||
response := e.ResponseForPDF{
|
|
||||||
Number: r.Response.Sep.NoSep,
|
|
||||||
PlannedControlDate: r.Response.TglRencanaKontrol,
|
|
||||||
IssuedDate: r.Response.TglTerbit,
|
|
||||||
Doctor_Name: r.Response.NamaDokter,
|
|
||||||
DstUnit_Name: r.Response.NamaPoliTujuan,
|
|
||||||
ResponsibleDoctor_Name: *r.Response.NamaDokterPembuat,
|
|
||||||
VclaimSep: e.VclaimSep{
|
|
||||||
VclaimMember: e.VclaimMember{
|
|
||||||
CardNumber: r.Response.Sep.Peserta.NoKartu,
|
|
||||||
Name: r.Response.Sep.Peserta.Nama,
|
|
||||||
BirthDate: r.Response.Sep.Peserta.TglLahir,
|
|
||||||
Gender: r.Response.Sep.Peserta.Kelamin,
|
|
||||||
},
|
|
||||||
Diagnose: r.Response.Sep.Diagnosa,
|
|
||||||
Number: r.Response.Sep.NoSep,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
return json.Marshal(response)
|
|
||||||
}
|
|
||||||
@@ -9,4 +9,10 @@ func init() {
|
|||||||
createPreMw = append(createPreMw,
|
createPreMw = append(createPreMw,
|
||||||
createMw{Name: "create-sep-control-letter", Func: pvscl.CreateSepControlLetter},
|
createMw{Name: "create-sep-control-letter", Func: pvscl.CreateSepControlLetter},
|
||||||
)
|
)
|
||||||
|
readDetailPreMw = append(readDetailPreMw,
|
||||||
|
readDetailMw{Name: "get-detail-sep-control-letter-by-number", Func: pvscl.GetDetailSepControlLetterByNumber},
|
||||||
|
)
|
||||||
|
deletePreMw = append(deletePreMw,
|
||||||
|
DeleteMw{Name: "delete-sep-control-letter", Func: pvscl.DeleteSepControlLetter},
|
||||||
|
)
|
||||||
}
|
}
|
||||||
@@ -30,7 +30,10 @@ type readDetailMw struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type UpdateMw = readDetailMw
|
type UpdateMw = readDetailMw
|
||||||
type DeleteMw = readDetailMw
|
type DeleteMw struct {
|
||||||
|
Name string
|
||||||
|
Func func(input *e.DeleteDto, data *e.VclaimSepControlLetter, tx *gorm.DB) error
|
||||||
|
}
|
||||||
|
|
||||||
var createPreMw []createMw // preprocess middleware
|
var createPreMw []createMw // preprocess middleware
|
||||||
var createPostMw []createMw // postprocess middleware
|
var createPostMw []createMw // postprocess middleware
|
||||||
@@ -40,5 +43,5 @@ var readDetailPreMw []readDetailMw
|
|||||||
var readDetailPostMw []readDetailMw
|
var readDetailPostMw []readDetailMw
|
||||||
var updatePreMw []readDetailMw
|
var updatePreMw []readDetailMw
|
||||||
var updatePostMw []readDetailMw
|
var updatePostMw []readDetailMw
|
||||||
var deletePreMw []readDetailMw
|
var deletePreMw []DeleteMw
|
||||||
var deletePostMw []readDetailMw
|
var deletePostMw []DeleteMw
|
||||||
@@ -0,0 +1,317 @@
|
|||||||
|
package chemo_plan
|
||||||
|
|
||||||
|
import (
|
||||||
|
ere "simrs-vx/internal/domain/references/encounter"
|
||||||
|
pl "simrs-vx/pkg/logger"
|
||||||
|
pu "simrs-vx/pkg/use-case-helper"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
dg "github.com/karincake/apem/db-gorm-pg"
|
||||||
|
d "github.com/karincake/dodol"
|
||||||
|
"gorm.io/gorm"
|
||||||
|
|
||||||
|
erc "simrs-vx/internal/domain/references/common"
|
||||||
|
|
||||||
|
e "simrs-vx/internal/domain/main-entities/chemo-plan"
|
||||||
|
ep "simrs-vx/internal/domain/main-entities/chemo-protocol"
|
||||||
|
)
|
||||||
|
|
||||||
|
const source = "chemo-plan"
|
||||||
|
|
||||||
|
func Create(input ep.CreateDto) (*d.Data, error) {
|
||||||
|
data := []e.ChemoPlan{}
|
||||||
|
|
||||||
|
event := pl.Event{
|
||||||
|
Feature: "Create",
|
||||||
|
Source: source,
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start log
|
||||||
|
pl.SetLogInfo(&event, input, "started", "create")
|
||||||
|
|
||||||
|
err := dg.I.Transaction(func(tx *gorm.DB) error {
|
||||||
|
input.Status_Code = erc.DVCNew
|
||||||
|
|
||||||
|
if resData, err := CreateData(&input, &event, tx); err != nil {
|
||||||
|
return err
|
||||||
|
} else {
|
||||||
|
data = *resData
|
||||||
|
}
|
||||||
|
|
||||||
|
pl.SetLogInfo(&event, nil, "complete")
|
||||||
|
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return &d.Data{
|
||||||
|
Meta: d.II{
|
||||||
|
"source": source,
|
||||||
|
"structure": "single-data",
|
||||||
|
"status": "created",
|
||||||
|
},
|
||||||
|
Data: e.ToResponseList(data),
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func ReadList(input e.ReadListDto) (*d.Data, error) {
|
||||||
|
var data *e.ChemoPlan
|
||||||
|
var dataList []e.ChemoPlan
|
||||||
|
var metaList *e.MetaDto
|
||||||
|
var err error
|
||||||
|
|
||||||
|
event := pl.Event{
|
||||||
|
Feature: "ReadList",
|
||||||
|
Source: source,
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start log
|
||||||
|
pl.SetLogInfo(&event, input, "started", "readList")
|
||||||
|
|
||||||
|
err = dg.I.Transaction(func(tx *gorm.DB) error {
|
||||||
|
mwRunner := newMiddlewareRunner(&event, tx)
|
||||||
|
mwRunner.setMwType(pu.MWTPre)
|
||||||
|
// Run pre-middleware
|
||||||
|
if err := mwRunner.RunReadListMiddleware(readListPreMw, &input, data); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if dataList, metaList, err = ReadListData(input, &event, tx); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
mwRunner.setMwType(pu.MWTPost)
|
||||||
|
// Run post-middleware
|
||||||
|
if err := mwRunner.RunReadListMiddleware(readListPostMw, &input, data); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return &d.Data{
|
||||||
|
Meta: d.IS{
|
||||||
|
"source": source,
|
||||||
|
"structure": "list-data",
|
||||||
|
"status": "fetched",
|
||||||
|
"page_number": strconv.Itoa(metaList.PageNumber),
|
||||||
|
"page_size": strconv.Itoa(metaList.PageSize),
|
||||||
|
"record_totalCount": strconv.Itoa(metaList.Count),
|
||||||
|
"record_currentCount": strconv.Itoa(len(dataList)),
|
||||||
|
},
|
||||||
|
Data: e.ToResponseList(dataList),
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func ReadDetail(input e.ReadDetailDto) (*d.Data, error) {
|
||||||
|
var data *e.ChemoPlan
|
||||||
|
var err error
|
||||||
|
|
||||||
|
event := pl.Event{
|
||||||
|
Feature: "ReadDetail",
|
||||||
|
Source: source,
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start log
|
||||||
|
pl.SetLogInfo(&event, input, "started", "readDetail")
|
||||||
|
|
||||||
|
err = dg.I.Transaction(func(tx *gorm.DB) error {
|
||||||
|
mwRunner := newMiddlewareRunner(&event, tx)
|
||||||
|
mwRunner.setMwType(pu.MWTPre)
|
||||||
|
// Run pre-middleware
|
||||||
|
if err := mwRunner.RunReadDetailMiddleware(readDetailPreMw, &input, data); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if data, err = ReadDetailData(input, &event, tx); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
mwRunner.setMwType(pu.MWTPost)
|
||||||
|
// Run post-middleware
|
||||||
|
if err := mwRunner.RunReadDetailMiddleware(readDetailPostMw, &input, data); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return &d.Data{
|
||||||
|
Meta: d.IS{
|
||||||
|
"source": source,
|
||||||
|
"structure": "single-data",
|
||||||
|
"status": "fetched",
|
||||||
|
},
|
||||||
|
Data: data.ToResponse(),
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func Update(input e.UpdateDto) (*d.Data, error) {
|
||||||
|
rdDto := e.ReadDetailDto{Id: input.Id}
|
||||||
|
var data *e.ChemoPlan
|
||||||
|
var err error
|
||||||
|
|
||||||
|
event := pl.Event{
|
||||||
|
Feature: "Update",
|
||||||
|
Source: source,
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start log
|
||||||
|
pl.SetLogInfo(&event, input, "started", "update")
|
||||||
|
|
||||||
|
err = dg.I.Transaction(func(tx *gorm.DB) error {
|
||||||
|
pl.SetLogInfo(&event, rdDto, "started", "DBReadDetail")
|
||||||
|
if data, err = ReadDetailData(rdDto, &event, tx); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := UpdateData(data, "", &event, tx); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
pl.SetLogInfo(&event, nil, "complete")
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return &d.Data{
|
||||||
|
Meta: d.IS{
|
||||||
|
"source": source,
|
||||||
|
"structure": "single-data",
|
||||||
|
"status": "updated",
|
||||||
|
},
|
||||||
|
Data: data.ToResponse(),
|
||||||
|
}, nil
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func Delete(input e.DeleteDto) (*d.Data, error) {
|
||||||
|
rdDto := e.ReadDetailDto{Id: input.Id}
|
||||||
|
var data *e.ChemoPlan
|
||||||
|
var err error
|
||||||
|
|
||||||
|
event := pl.Event{
|
||||||
|
Feature: "Delete",
|
||||||
|
Source: source,
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start log
|
||||||
|
pl.SetLogInfo(&event, input, "started", "delete")
|
||||||
|
|
||||||
|
err = dg.I.Transaction(func(tx *gorm.DB) error {
|
||||||
|
pl.SetLogInfo(&event, rdDto, "started", "DBReadDetail")
|
||||||
|
if data, err = ReadDetailData(rdDto, &event, tx); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
mwRunner := newMiddlewareRunner(&event, tx)
|
||||||
|
mwRunner.setMwType(pu.MWTPre)
|
||||||
|
// Run pre-middleware
|
||||||
|
if err := mwRunner.RunDeleteMiddleware(readDetailPreMw, &rdDto, data); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := DeleteData(data, &event, tx); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
mwRunner.setMwType(pu.MWTPost)
|
||||||
|
// Run post-middleware
|
||||||
|
if err := mwRunner.RunDeleteMiddleware(readDetailPostMw, &rdDto, data); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return &d.Data{
|
||||||
|
Meta: d.IS{
|
||||||
|
"source": source,
|
||||||
|
"structure": "single-data",
|
||||||
|
"status": "deleted",
|
||||||
|
},
|
||||||
|
Data: data.ToResponse(),
|
||||||
|
}, nil
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func Fail(input e.FailDto) (*d.Data, error) {
|
||||||
|
rdDto := e.ReadDetailDto{Id: input.Id}
|
||||||
|
var data *e.ChemoPlan
|
||||||
|
var err error
|
||||||
|
|
||||||
|
event := pl.Event{
|
||||||
|
Feature: "Chemo-Fail",
|
||||||
|
Source: source,
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start log
|
||||||
|
pl.SetLogInfo(&event, input, "started", "update")
|
||||||
|
|
||||||
|
if data, err = ReadDetailData(rdDto, &event); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
dataSoapi, err := getSoapiByEncounterId(*data.Encounter_Id, &event)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if dataSoapi != nil && len(*dataSoapi) > 0 {
|
||||||
|
event.Status = "failed"
|
||||||
|
event.ErrInfo = pl.ErrorInfo{
|
||||||
|
Code: "soapi-exist",
|
||||||
|
Detail: "cancel soapi to proceed",
|
||||||
|
}
|
||||||
|
return nil, pl.SetLogError(&event, data)
|
||||||
|
}
|
||||||
|
|
||||||
|
if *data.Status != ere.SPCPlanned {
|
||||||
|
event.Status = "failed"
|
||||||
|
event.ErrInfo = pl.ErrorInfo{
|
||||||
|
Code: "invalid-chemo-status",
|
||||||
|
Detail: "only chemo plans with status 'planned' can be deleted.",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
err = dg.I.Transaction(func(tx *gorm.DB) error {
|
||||||
|
if err := UpdateFailData(input, data, &event, tx); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
pl.SetLogInfo(&event, nil, "complete")
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return &d.Data{
|
||||||
|
Meta: d.IS{
|
||||||
|
"source": source,
|
||||||
|
"structure": "single-data",
|
||||||
|
"status": "updated",
|
||||||
|
},
|
||||||
|
Data: data.ToResponse(),
|
||||||
|
}, nil
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,90 @@
|
|||||||
|
/*
|
||||||
|
DESCRIPTION:
|
||||||
|
Any functions that are used internally by the use-case
|
||||||
|
*/
|
||||||
|
package chemo_plan
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
pl "simrs-vx/pkg/logger"
|
||||||
|
pu "simrs-vx/pkg/use-case-helper"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
dg "github.com/karincake/apem/db-gorm-pg"
|
||||||
|
|
||||||
|
ere "simrs-vx/internal/domain/references/encounter"
|
||||||
|
|
||||||
|
e "simrs-vx/internal/domain/main-entities/chemo-plan"
|
||||||
|
ep "simrs-vx/internal/domain/main-entities/chemo-protocol"
|
||||||
|
es "simrs-vx/internal/domain/main-entities/soapi"
|
||||||
|
)
|
||||||
|
|
||||||
|
var now = time.Now()
|
||||||
|
|
||||||
|
func setDataCreate(input *ep.CreateDto) (data []e.ChemoPlan) {
|
||||||
|
for _, c := range *input.ChemoPlans {
|
||||||
|
data = append(data, e.ChemoPlan{
|
||||||
|
Parent_Id: input.Chemo_Id,
|
||||||
|
Protocol_Id: input.Id,
|
||||||
|
SeriesNumber: c.SeriesNumber,
|
||||||
|
CycleNumber: c.CycleNumber,
|
||||||
|
PlanDate: c.PlanDate,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func setDataCreateSoapi(data *e.ChemoPlan) {
|
||||||
|
data.RealizationDate = &now
|
||||||
|
|
||||||
|
status := ere.SPCComplete
|
||||||
|
data.Status = &status
|
||||||
|
}
|
||||||
|
|
||||||
|
func setDataDeleteSoapi(data *e.ChemoPlan) {
|
||||||
|
status := ere.SPCPlanned
|
||||||
|
data.Status = &status
|
||||||
|
}
|
||||||
|
|
||||||
|
func setDatafail(input e.FailDto, data *e.ChemoPlan) {
|
||||||
|
data.RealizationDate = nil
|
||||||
|
|
||||||
|
status := ere.SPCSchedule
|
||||||
|
data.Status = &status
|
||||||
|
|
||||||
|
var reasons []e.FailReason
|
||||||
|
|
||||||
|
if data.Reasons != nil {
|
||||||
|
json.Unmarshal([]byte(*data.Reasons), &reasons)
|
||||||
|
}
|
||||||
|
|
||||||
|
reasons = append(reasons, e.FailReason{
|
||||||
|
FailReason: input.Reasons,
|
||||||
|
Date: &now,
|
||||||
|
Encounter_Id: data.Encounter_Id,
|
||||||
|
})
|
||||||
|
|
||||||
|
if b, err := json.Marshal(reasons); err == nil {
|
||||||
|
jsonStr := string(b)
|
||||||
|
data.Reasons = &jsonStr
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func getSoapiByEncounterId(encounterId uint, event *pl.Event) (*[]es.Soapi, error) {
|
||||||
|
pl.SetLogInfo(event, encounterId, "started", "DBReadDetail")
|
||||||
|
var data []es.Soapi
|
||||||
|
|
||||||
|
var tx = dg.I
|
||||||
|
|
||||||
|
if err := tx.
|
||||||
|
Model(&es.Soapi{}).
|
||||||
|
Where(`"Encounter_Id" = ?`, encounterId).
|
||||||
|
Find(&data).Error; err != nil {
|
||||||
|
if processedErr := pu.HandleReadError(err, event, source, encounterId, data); processedErr != nil {
|
||||||
|
return nil, processedErr
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pl.SetLogInfo(event, nil, "complete")
|
||||||
|
return &data, nil
|
||||||
|
}
|
||||||
@@ -0,0 +1,178 @@
|
|||||||
|
package chemo_plan
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
|
||||||
|
plh "simrs-vx/pkg/lib-helper"
|
||||||
|
pl "simrs-vx/pkg/logger"
|
||||||
|
pu "simrs-vx/pkg/use-case-helper"
|
||||||
|
|
||||||
|
"gorm.io/gorm"
|
||||||
|
|
||||||
|
dg "github.com/karincake/apem/db-gorm-pg"
|
||||||
|
gh "github.com/karincake/getuk"
|
||||||
|
|
||||||
|
e "simrs-vx/internal/domain/main-entities/chemo-plan"
|
||||||
|
ep "simrs-vx/internal/domain/main-entities/chemo-protocol"
|
||||||
|
)
|
||||||
|
|
||||||
|
func CreateData(input *ep.CreateDto, event *pl.Event, dbx ...*gorm.DB) (*[]e.ChemoPlan, error) {
|
||||||
|
pl.SetLogInfo(event, nil, "started", "DBCreate")
|
||||||
|
|
||||||
|
data := setDataCreate(input)
|
||||||
|
|
||||||
|
var tx *gorm.DB
|
||||||
|
if len(dbx) > 0 {
|
||||||
|
tx = dbx[0]
|
||||||
|
} else {
|
||||||
|
tx = dg.I
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := tx.Create(&data).Error; err != nil {
|
||||||
|
return nil, plh.HandleCreateError(input, event, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
pl.SetLogInfo(event, nil, "complete")
|
||||||
|
return &data, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.ChemoPlan, *e.MetaDto, error) {
|
||||||
|
pl.SetLogInfo(event, input, "started", "DBReadList")
|
||||||
|
data := []e.ChemoPlan{}
|
||||||
|
pagination := gh.Pagination{}
|
||||||
|
count := int64(0)
|
||||||
|
meta := e.MetaDto{}
|
||||||
|
|
||||||
|
var tx *gorm.DB
|
||||||
|
if len(dbx) > 0 {
|
||||||
|
tx = dbx[0]
|
||||||
|
} else {
|
||||||
|
tx = dg.I
|
||||||
|
}
|
||||||
|
|
||||||
|
tx = tx.
|
||||||
|
Model(&e.ChemoPlan{}).
|
||||||
|
Scopes(gh.Preload(input.Includes)).
|
||||||
|
Scopes(gh.Filter(input.FilterDto)).
|
||||||
|
Count(&count).
|
||||||
|
Scopes(gh.Paginate(input, &pagination)).
|
||||||
|
Order("\"CreatedAt\" DESC")
|
||||||
|
|
||||||
|
if err := tx.Find(&data).Error; err != nil {
|
||||||
|
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||||
|
return nil, &meta, nil
|
||||||
|
}
|
||||||
|
return nil, nil, plh.HandleListError(input, event, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
meta.Count = int(count)
|
||||||
|
meta.PageNumber = pagination.PageNumber
|
||||||
|
meta.PageSize = pagination.PageSize
|
||||||
|
|
||||||
|
pl.SetLogInfo(event, nil, "complete")
|
||||||
|
return data, &meta, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func ReadDetailData(input e.ReadDetailDto, event *pl.Event, dbx ...*gorm.DB) (*e.ChemoPlan, error) {
|
||||||
|
pl.SetLogInfo(event, input, "started", "DBReadDetail")
|
||||||
|
data := e.ChemoPlan{}
|
||||||
|
|
||||||
|
var tx *gorm.DB
|
||||||
|
if len(dbx) > 0 {
|
||||||
|
tx = dbx[0]
|
||||||
|
} else {
|
||||||
|
tx = dg.I
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := tx.
|
||||||
|
Scopes(gh.Preload(input.Includes)).
|
||||||
|
First(&data, input.Id).
|
||||||
|
Error; err != nil {
|
||||||
|
|
||||||
|
if processedErr := pu.HandleReadError(err, event, source, input.Id, data); processedErr != nil {
|
||||||
|
return nil, processedErr
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pl.SetLogInfo(event, nil, "complete")
|
||||||
|
return &data, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func UpdateData(data *e.ChemoPlan, method string, event *pl.Event, dbx ...*gorm.DB) error {
|
||||||
|
pl.SetLogInfo(event, data, "started", "DBUpdate")
|
||||||
|
|
||||||
|
switch method {
|
||||||
|
case "c":
|
||||||
|
setDataCreateSoapi(data)
|
||||||
|
case "d":
|
||||||
|
setDataDeleteSoapi(data)
|
||||||
|
}
|
||||||
|
|
||||||
|
var tx *gorm.DB
|
||||||
|
if len(dbx) > 0 {
|
||||||
|
tx = dbx[0]
|
||||||
|
} else {
|
||||||
|
tx = dg.I
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := tx.Save(&data).Error; err != nil {
|
||||||
|
event.Status = "failed"
|
||||||
|
event.ErrInfo = pl.ErrorInfo{
|
||||||
|
Code: "data-update-fail",
|
||||||
|
Detail: "Database update failed",
|
||||||
|
Raw: err,
|
||||||
|
}
|
||||||
|
return pl.SetLogError(event, data)
|
||||||
|
}
|
||||||
|
|
||||||
|
pl.SetLogInfo(event, nil, "complete")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func DeleteData(data *e.ChemoPlan, event *pl.Event, dbx ...*gorm.DB) error {
|
||||||
|
pl.SetLogInfo(event, data, "started", "DBDelete")
|
||||||
|
var tx *gorm.DB
|
||||||
|
if len(dbx) > 0 {
|
||||||
|
tx = dbx[0]
|
||||||
|
} else {
|
||||||
|
tx = dg.I
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := tx.Delete(&data).Error; err != nil {
|
||||||
|
event.Status = "failed"
|
||||||
|
event.ErrInfo = pl.ErrorInfo{
|
||||||
|
Code: "data-delete-fail",
|
||||||
|
Detail: "Database delete failed",
|
||||||
|
Raw: err,
|
||||||
|
}
|
||||||
|
return pl.SetLogError(event, data)
|
||||||
|
}
|
||||||
|
|
||||||
|
pl.SetLogInfo(event, nil, "complete")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func UpdateFailData(input e.FailDto, data *e.ChemoPlan, event *pl.Event, dbx ...*gorm.DB) error {
|
||||||
|
pl.SetLogInfo(event, data, "started", "DBUpdate")
|
||||||
|
setDatafail(input, data)
|
||||||
|
|
||||||
|
var tx *gorm.DB
|
||||||
|
if len(dbx) > 0 {
|
||||||
|
tx = dbx[0]
|
||||||
|
} else {
|
||||||
|
tx = dg.I
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := tx.Save(&data).Error; err != nil {
|
||||||
|
event.Status = "failed"
|
||||||
|
event.ErrInfo = pl.ErrorInfo{
|
||||||
|
Code: "data-update-fail",
|
||||||
|
Detail: "Database update failed",
|
||||||
|
Raw: err,
|
||||||
|
}
|
||||||
|
return pl.SetLogError(event, data)
|
||||||
|
}
|
||||||
|
|
||||||
|
pl.SetLogInfo(event, nil, "complete")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
@@ -0,0 +1,103 @@
|
|||||||
|
package chemo_plan
|
||||||
|
|
||||||
|
import (
|
||||||
|
e "simrs-vx/internal/domain/main-entities/chemo-plan"
|
||||||
|
pl "simrs-vx/pkg/logger"
|
||||||
|
pu "simrs-vx/pkg/use-case-helper"
|
||||||
|
|
||||||
|
"gorm.io/gorm"
|
||||||
|
)
|
||||||
|
|
||||||
|
type middlewareRunner struct {
|
||||||
|
Event *pl.Event
|
||||||
|
Tx *gorm.DB
|
||||||
|
MwType pu.MWType
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewMiddlewareExecutor creates a new middleware executor
|
||||||
|
func newMiddlewareRunner(event *pl.Event, tx *gorm.DB) *middlewareRunner {
|
||||||
|
return &middlewareRunner{
|
||||||
|
Event: event,
|
||||||
|
Tx: tx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExecuteCreateMiddleware executes create middleware
|
||||||
|
func (me *middlewareRunner) RunCreateMiddleware(middlewares []createMw, input *e.CreateDto, data *e.ChemoPlan) error {
|
||||||
|
for _, middleware := range middlewares {
|
||||||
|
logData := pu.GetLogData(input, data)
|
||||||
|
|
||||||
|
pl.SetLogInfo(me.Event, logData, "started", middleware.Name)
|
||||||
|
|
||||||
|
if err := middleware.Func(input, data, me.Tx); err != nil {
|
||||||
|
return pu.HandleMiddlewareError(me.Event, string(me.MwType), middleware.Name, logData, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
pl.SetLogInfo(me.Event, nil, "complete")
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (me *middlewareRunner) RunReadListMiddleware(middlewares []readListMw, input *e.ReadListDto, data *e.ChemoPlan) error {
|
||||||
|
for _, middleware := range middlewares {
|
||||||
|
logData := pu.GetLogData(input, data)
|
||||||
|
|
||||||
|
pl.SetLogInfo(me.Event, logData, "started", middleware.Name)
|
||||||
|
|
||||||
|
if err := middleware.Func(input, data, me.Tx); err != nil {
|
||||||
|
return pu.HandleMiddlewareError(me.Event, string(me.MwType), middleware.Name, logData, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
pl.SetLogInfo(me.Event, nil, "complete")
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (me *middlewareRunner) RunReadDetailMiddleware(middlewares []readDetailMw, input *e.ReadDetailDto, data *e.ChemoPlan) error {
|
||||||
|
for _, middleware := range middlewares {
|
||||||
|
logData := pu.GetLogData(input, data)
|
||||||
|
|
||||||
|
pl.SetLogInfo(me.Event, logData, "started", middleware.Name)
|
||||||
|
|
||||||
|
if err := middleware.Func(input, data, me.Tx); err != nil {
|
||||||
|
return pu.HandleMiddlewareError(me.Event, string(me.MwType), middleware.Name, logData, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
pl.SetLogInfo(me.Event, nil, "complete")
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (me *middlewareRunner) RunUpdateMiddleware(middlewares []readDetailMw, input *e.ReadDetailDto, data *e.ChemoPlan) error {
|
||||||
|
for _, middleware := range middlewares {
|
||||||
|
logData := pu.GetLogData(input, data)
|
||||||
|
|
||||||
|
pl.SetLogInfo(me.Event, logData, "started", middleware.Name)
|
||||||
|
|
||||||
|
if err := middleware.Func(input, data, me.Tx); err != nil {
|
||||||
|
return pu.HandleMiddlewareError(me.Event, string(me.MwType), middleware.Name, logData, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
pl.SetLogInfo(me.Event, nil, "complete")
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (me *middlewareRunner) RunDeleteMiddleware(middlewares []readDetailMw, input *e.ReadDetailDto, data *e.ChemoPlan) error {
|
||||||
|
for _, middleware := range middlewares {
|
||||||
|
logData := pu.GetLogData(input, data)
|
||||||
|
|
||||||
|
pl.SetLogInfo(me.Event, logData, "started", middleware.Name)
|
||||||
|
|
||||||
|
if err := middleware.Func(input, data, me.Tx); err != nil {
|
||||||
|
return pu.HandleMiddlewareError(me.Event, string(me.MwType), middleware.Name, logData, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
pl.SetLogInfo(me.Event, nil, "complete")
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (me *middlewareRunner) setMwType(mwType pu.MWType) {
|
||||||
|
me.MwType = mwType
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package chemo_plan
|
||||||
|
|
||||||
|
// example of middleware
|
||||||
|
// func init() {
|
||||||
|
// createPreMw = append(createPreMw,
|
||||||
|
// CreateMw{Name: "modif-input", Func: pm.ModifInput},
|
||||||
|
// CreateMw{Name: "check-data", Func: pm.CheckData},
|
||||||
|
// )
|
||||||
|
// }
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
/*
|
||||||
|
DESCRIPTION:
|
||||||
|
A sample, part of the package that contains type, constants, and/or variables.
|
||||||
|
|
||||||
|
In this sample it also provides type and variable regarding the needs of the
|
||||||
|
middleware to separate from main use-case which has the basic CRUD
|
||||||
|
functionality. The purpose of this is to make the code more maintainable.
|
||||||
|
*/
|
||||||
|
package chemo_plan
|
||||||
|
|
||||||
|
import (
|
||||||
|
"gorm.io/gorm"
|
||||||
|
|
||||||
|
e "simrs-vx/internal/domain/main-entities/chemo-plan"
|
||||||
|
)
|
||||||
|
|
||||||
|
type createMw struct {
|
||||||
|
Name string
|
||||||
|
Func func(input *e.CreateDto, data *e.ChemoPlan, tx *gorm.DB) error
|
||||||
|
}
|
||||||
|
|
||||||
|
type readListMw struct {
|
||||||
|
Name string
|
||||||
|
Func func(input *e.ReadListDto, data *e.ChemoPlan, tx *gorm.DB) error
|
||||||
|
}
|
||||||
|
|
||||||
|
type readDetailMw struct {
|
||||||
|
Name string
|
||||||
|
Func func(input *e.ReadDetailDto, data *e.ChemoPlan, tx *gorm.DB) error
|
||||||
|
}
|
||||||
|
|
||||||
|
type UpdateMw = readDetailMw
|
||||||
|
type DeleteMw = readDetailMw
|
||||||
|
|
||||||
|
var createPreMw []createMw // preprocess middleware
|
||||||
|
var createPostMw []createMw // postprocess middleware
|
||||||
|
var readListPreMw []readListMw // ..
|
||||||
|
var readListPostMw []readListMw // ..
|
||||||
|
var readDetailPreMw []readDetailMw
|
||||||
|
var readDetailPostMw []readDetailMw
|
||||||
|
var updatePreMw []readDetailMw
|
||||||
|
var updatePostMw []readDetailMw
|
||||||
|
var deletePreMw []readDetailMw
|
||||||
|
var deletePostMw []readDetailMw
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
package chemo_protocol
|
package chemo_protocol
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
dg "github.com/karincake/apem/db-gorm-pg"
|
dg "github.com/karincake/apem/db-gorm-pg"
|
||||||
@@ -11,13 +12,22 @@ import (
|
|||||||
|
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
|
|
||||||
|
erc "simrs-vx/internal/domain/references/common"
|
||||||
|
|
||||||
|
ec "simrs-vx/internal/domain/main-entities/chemo"
|
||||||
e "simrs-vx/internal/domain/main-entities/chemo-protocol"
|
e "simrs-vx/internal/domain/main-entities/chemo-protocol"
|
||||||
|
ee "simrs-vx/internal/domain/main-entities/encounter"
|
||||||
|
|
||||||
|
uc "simrs-vx/internal/use-case/main-use-case/chemo"
|
||||||
|
ucp "simrs-vx/internal/use-case/main-use-case/chemo-plan"
|
||||||
|
ue "simrs-vx/internal/use-case/main-use-case/encounter"
|
||||||
)
|
)
|
||||||
|
|
||||||
const source = "chemo-protocol"
|
const source = "chemo-protocol"
|
||||||
|
|
||||||
func Create(input e.CreateDto) (*d.Data, error) {
|
func Create(input e.CreateDto) (*d.Data, error) {
|
||||||
data := e.ChemoProtocol{}
|
data := e.ChemoProtocol{}
|
||||||
|
var err error
|
||||||
|
|
||||||
event := pl.Event{
|
event := pl.Event{
|
||||||
Feature: "Create",
|
Feature: "Create",
|
||||||
@@ -27,23 +37,43 @@ func Create(input e.CreateDto) (*d.Data, error) {
|
|||||||
// Start log
|
// Start log
|
||||||
pl.SetLogInfo(&event, input, "started", "create")
|
pl.SetLogInfo(&event, input, "started", "create")
|
||||||
|
|
||||||
err := dg.I.Transaction(func(tx *gorm.DB) error {
|
if input.Patient_Id == nil {
|
||||||
mwRunner := newMiddlewareRunner(&event, tx)
|
// get encounter
|
||||||
mwRunner.setMwType(pu.MWTPre)
|
dataEncounter, err := ue.ReadDetailData(ee.ReadDetailDto{Id: *input.Encounter_Id}, &event)
|
||||||
// Run pre-middleware
|
if err != nil {
|
||||||
if err := mwRunner.RunCreateMiddleware(createPreMw, &input, &data); err != nil {
|
return nil, err
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
input.Patient_Id = dataEncounter.Patient_Id
|
||||||
|
input.Status_Code = erc.DVCNew
|
||||||
|
}
|
||||||
|
|
||||||
|
// get chemo
|
||||||
|
dataChemo, err := uc.ReadDetailData(ec.ReadDetailDto{Id: *input.Chemo_Id}, &event)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if dataChemo.Status_Code != erc.DVCVerified {
|
||||||
|
event.Status = "failed"
|
||||||
|
event.ErrInfo = pl.ErrorInfo{
|
||||||
|
Code: "data-validation-fail",
|
||||||
|
Detail: "chemo must be verified",
|
||||||
|
}
|
||||||
|
return nil, pl.SetLogError(&event, input)
|
||||||
|
}
|
||||||
|
|
||||||
|
err = dg.I.Transaction(func(tx *gorm.DB) error {
|
||||||
|
// Insert Chemo-Protocol
|
||||||
if resData, err := CreateData(input, &event, tx); err != nil {
|
if resData, err := CreateData(input, &event, tx); err != nil {
|
||||||
return err
|
return err
|
||||||
} else {
|
} else {
|
||||||
data = *resData
|
data = *resData
|
||||||
}
|
}
|
||||||
|
|
||||||
mwRunner.setMwType(pu.MWTPost)
|
// Insert Chemo-Plans
|
||||||
// Run post-middleware
|
input.Id = &data.Id
|
||||||
if err := mwRunner.RunCreateMiddleware(createPostMw, &input, &data); err != nil {
|
if data.ChemoPlans, err = ucp.CreateData(&input, &event, tx); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,6 +110,15 @@ func ReadList(input e.ReadListDto) (*d.Data, error) {
|
|||||||
// Start log
|
// Start log
|
||||||
pl.SetLogInfo(&event, input, "started", "readList")
|
pl.SetLogInfo(&event, input, "started", "readList")
|
||||||
|
|
||||||
|
if input.Patient_Id == nil {
|
||||||
|
event.Status = "failed"
|
||||||
|
event.ErrInfo = pl.ErrorInfo{
|
||||||
|
Code: "data-validation-fail",
|
||||||
|
Detail: "patient-id is required",
|
||||||
|
}
|
||||||
|
return nil, pl.SetLogError(&event, input)
|
||||||
|
}
|
||||||
|
|
||||||
err = dg.I.Transaction(func(tx *gorm.DB) error {
|
err = dg.I.Transaction(func(tx *gorm.DB) error {
|
||||||
mwRunner := newMiddlewareRunner(&event, tx)
|
mwRunner := newMiddlewareRunner(&event, tx)
|
||||||
mwRunner.setMwType(pu.MWTPre)
|
mwRunner.setMwType(pu.MWTPre)
|
||||||
@@ -275,3 +314,65 @@ func Delete(input e.DeleteDto) (*d.Data, error) {
|
|||||||
}, nil
|
}, nil
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func Verify(input e.VerifyDto) (*d.Data, error) {
|
||||||
|
rdDto := e.ReadDetailDto{Id: input.Id}
|
||||||
|
var data *e.ChemoProtocol
|
||||||
|
var err error
|
||||||
|
|
||||||
|
event := pl.Event{
|
||||||
|
Feature: "Verify",
|
||||||
|
Source: source,
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start log
|
||||||
|
pl.SetLogInfo(&event, input, "started", "verify")
|
||||||
|
|
||||||
|
err = dg.I.Transaction(func(tx *gorm.DB) error {
|
||||||
|
pl.SetLogInfo(&event, rdDto, "started", "DBReadDetail")
|
||||||
|
if data, err = ReadDetailData(rdDto, &event, tx); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if data.Status_Code != erc.DVCNew {
|
||||||
|
event.Status = "failed"
|
||||||
|
event.ErrInfo = pl.ErrorInfo{
|
||||||
|
Code: "data-state-mismatch",
|
||||||
|
Detail: "data is not new",
|
||||||
|
Raw: errors.New("data is not new"),
|
||||||
|
}
|
||||||
|
return pl.SetLogError(&event, input)
|
||||||
|
}
|
||||||
|
|
||||||
|
data.VerifiedAt = pu.GetTimeNow()
|
||||||
|
data.Status_Code = erc.DVCVerified
|
||||||
|
data.VerifiedBy_User_Id = &input.AuthInfo.User_Id
|
||||||
|
|
||||||
|
err = tx.Save(&data).Error
|
||||||
|
if err != nil {
|
||||||
|
event.Status = "failed"
|
||||||
|
event.ErrInfo = pl.ErrorInfo{
|
||||||
|
Code: "data-update-fail",
|
||||||
|
Detail: "Database update failed",
|
||||||
|
Raw: err,
|
||||||
|
}
|
||||||
|
return pl.SetLogError(&event, input)
|
||||||
|
}
|
||||||
|
|
||||||
|
pl.SetLogInfo(&event, nil, "complete")
|
||||||
|
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
}
|
||||||
|
|
||||||
|
return &d.Data{
|
||||||
|
Meta: d.IS{
|
||||||
|
"source": source,
|
||||||
|
"structure": "single-data",
|
||||||
|
"status": "verify",
|
||||||
|
},
|
||||||
|
Data: data.ToResponse(),
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
@@ -17,9 +17,15 @@ func setData[T *e.CreateDto | *e.UpdateDto](input T, data *e.ChemoProtocol) {
|
|||||||
inputSrc = &inputTemp.CreateDto
|
inputSrc = &inputTemp.CreateDto
|
||||||
}
|
}
|
||||||
|
|
||||||
|
data.Chemo_Id = inputSrc.Chemo_Id
|
||||||
data.Patient_Weight = inputSrc.Patient_Weight
|
data.Patient_Weight = inputSrc.Patient_Weight
|
||||||
data.Patient_Height = inputSrc.Patient_Height
|
data.Patient_Height = inputSrc.Patient_Height
|
||||||
data.Diagnoses = inputSrc.Diagnoses
|
data.Diagnoses = inputSrc.Diagnoses
|
||||||
|
data.Interval = inputSrc.Interval
|
||||||
|
data.Cycle = inputSrc.Cycle
|
||||||
|
data.Series = inputSrc.Series
|
||||||
data.StartDate = inputSrc.StartDate
|
data.StartDate = inputSrc.StartDate
|
||||||
data.EndDate = inputSrc.EndDate
|
data.EndDate = inputSrc.EndDate
|
||||||
|
data.Status_Code = inputSrc.Status_Code
|
||||||
|
data.Patient_Id = inputSrc.Patient_Id
|
||||||
}
|
}
|
||||||
@@ -2,7 +2,6 @@ package chemo_protocol
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
|
||||||
plh "simrs-vx/pkg/lib-helper"
|
plh "simrs-vx/pkg/lib-helper"
|
||||||
pl "simrs-vx/pkg/logger"
|
pl "simrs-vx/pkg/logger"
|
||||||
pu "simrs-vx/pkg/use-case-helper"
|
pu "simrs-vx/pkg/use-case-helper"
|
||||||
|
|||||||
@@ -4,10 +4,6 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
e "simrs-vx/internal/domain/main-entities/chemo"
|
|
||||||
|
|
||||||
erc "simrs-vx/internal/domain/references/common"
|
|
||||||
|
|
||||||
dg "github.com/karincake/apem/db-gorm-pg"
|
dg "github.com/karincake/apem/db-gorm-pg"
|
||||||
d "github.com/karincake/dodol"
|
d "github.com/karincake/dodol"
|
||||||
|
|
||||||
@@ -15,9 +11,13 @@ import (
|
|||||||
pu "simrs-vx/pkg/use-case-helper"
|
pu "simrs-vx/pkg/use-case-helper"
|
||||||
|
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
|
|
||||||
|
erc "simrs-vx/internal/domain/references/common"
|
||||||
|
|
||||||
|
e "simrs-vx/internal/domain/main-entities/chemo"
|
||||||
)
|
)
|
||||||
|
|
||||||
const source = "division"
|
const source = "chemo"
|
||||||
|
|
||||||
func Create(input e.CreateDto) (*d.Data, error) {
|
func Create(input e.CreateDto) (*d.Data, error) {
|
||||||
data := e.Chemo{}
|
data := e.Chemo{}
|
||||||
@@ -70,7 +70,6 @@ func Create(input e.CreateDto) (*d.Data, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func ReadList(input e.ReadListDto) (*d.Data, error) {
|
func ReadList(input e.ReadListDto) (*d.Data, error) {
|
||||||
var data *e.Chemo
|
|
||||||
var dataList []e.Chemo
|
var dataList []e.Chemo
|
||||||
var metaList *e.MetaDto
|
var metaList *e.MetaDto
|
||||||
var err error
|
var err error
|
||||||
@@ -83,28 +82,17 @@ func ReadList(input e.ReadListDto) (*d.Data, error) {
|
|||||||
// Start log
|
// Start log
|
||||||
pl.SetLogInfo(&event, input, "started", "readList")
|
pl.SetLogInfo(&event, input, "started", "readList")
|
||||||
|
|
||||||
err = dg.I.Transaction(func(tx *gorm.DB) error {
|
if input.Patient_Id == nil {
|
||||||
mwRunner := newMiddlewareRunner(&event, tx)
|
event.Status = "failed"
|
||||||
mwRunner.setMwType(pu.MWTPre)
|
event.ErrInfo = pl.ErrorInfo{
|
||||||
// Run pre-middleware
|
Code: "data-validation-fail",
|
||||||
if err := mwRunner.RunReadListMiddleware(readListPreMw, &input, data); err != nil {
|
Detail: "patient-id is required",
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
|
return nil, pl.SetLogError(&event, input)
|
||||||
|
}
|
||||||
|
|
||||||
if dataList, metaList, err = ReadListData(input, &event, tx); err != nil {
|
input.Encounter_Id = nil
|
||||||
return err
|
if dataList, metaList, err = ReadListData(input, &event); err != nil {
|
||||||
}
|
|
||||||
|
|
||||||
mwRunner.setMwType(pu.MWTPost)
|
|
||||||
// Run post-middleware
|
|
||||||
if err := mwRunner.RunReadListMiddleware(readListPostMw, &input, data); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
})
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -134,6 +122,15 @@ func ReadDetail(input e.ReadDetailDto) (*d.Data, error) {
|
|||||||
// Start log
|
// Start log
|
||||||
pl.SetLogInfo(&event, input, "started", "readDetail")
|
pl.SetLogInfo(&event, input, "started", "readDetail")
|
||||||
|
|
||||||
|
if input.Encounter_Id == nil {
|
||||||
|
event.Status = "failed"
|
||||||
|
event.ErrInfo = pl.ErrorInfo{
|
||||||
|
Code: "data-validation-fail",
|
||||||
|
Detail: "Encounter-Id is required",
|
||||||
|
}
|
||||||
|
return nil, pl.SetLogError(&event, input)
|
||||||
|
}
|
||||||
|
|
||||||
err = dg.I.Transaction(func(tx *gorm.DB) error {
|
err = dg.I.Transaction(func(tx *gorm.DB) error {
|
||||||
mwRunner := newMiddlewareRunner(&event, tx)
|
mwRunner := newMiddlewareRunner(&event, tx)
|
||||||
mwRunner.setMwType(pu.MWTPre)
|
mwRunner.setMwType(pu.MWTPre)
|
||||||
@@ -309,10 +306,12 @@ func Verify(input e.VerifyDto) (*d.Data, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
data.VerifiedAt = pu.GetTimeNow()
|
data.VerifiedAt = pu.GetTimeNow()
|
||||||
data.Status_Code = input.Status_Code
|
data.Status_Code = erc.DVCVerified
|
||||||
data.VerifiedBy_User_Id = &input.AuthInfo.User_Id
|
data.VerifiedBy_User_Id = &input.AuthInfo.User_Id
|
||||||
data.Bed = input.Bed
|
data.Bed = input.Bed
|
||||||
data.Needs = input.Needs
|
data.Needs = input.Needs
|
||||||
|
data.Doctor_Code = input.Doctor_Code
|
||||||
|
data.NextChemoDate = input.NextChemoDate
|
||||||
|
|
||||||
err = tx.Save(&data).Error
|
err = tx.Save(&data).Error
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -20,4 +20,5 @@ func setData[T *e.CreateDto | *e.UpdateDto](input T, data *e.Chemo) {
|
|||||||
data.Encounter_Id = inputSrc.Encounter_Id
|
data.Encounter_Id = inputSrc.Encounter_Id
|
||||||
data.Status_Code = inputSrc.Status_Code
|
data.Status_Code = inputSrc.Status_Code
|
||||||
data.Specialist_Code = inputSrc.Specialist_Code
|
data.Specialist_Code = inputSrc.Specialist_Code
|
||||||
|
data.Class_Code = inputSrc.Class_Code
|
||||||
}
|
}
|
||||||
@@ -47,8 +47,16 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.Ch
|
|||||||
tx = dg.I
|
tx = dg.I
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if input.Class_Code != "" {
|
||||||
|
tx = tx.Where(`"Chemo"."Class_Code" = ?`, input.Class_Code)
|
||||||
|
input.Class_Code = ""
|
||||||
|
}
|
||||||
|
|
||||||
tx = tx.
|
tx = tx.
|
||||||
Model(&e.Chemo{}).
|
Model(&e.Chemo{}).
|
||||||
|
Joins(`LEFT JOIN "Encounter" "e" ON "e"."Id" = "Chemo"."Encounter_Id"`).
|
||||||
|
Joins(`LEFT JOIN "Patient" "p" ON "e"."Patient_Id" = "p"."Id"`).
|
||||||
|
Where(`"p"."Id" = ?`, input.Patient_Id).
|
||||||
Scopes(gh.Preload(input.Includes)).
|
Scopes(gh.Preload(input.Includes)).
|
||||||
Scopes(gh.Filter(input.FilterDto)).
|
Scopes(gh.Filter(input.FilterDto)).
|
||||||
Count(&count).
|
Count(&count).
|
||||||
@@ -81,7 +89,10 @@ func ReadDetailData(input e.ReadDetailDto, event *pl.Event, dbx ...*gorm.DB) (*e
|
|||||||
tx = dg.I
|
tx = dg.I
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := tx.First(&data, input.Id).Error; err != nil {
|
if err := tx.
|
||||||
|
Scopes(gh.Preload(input.Includes)).
|
||||||
|
Scopes(gh.Filter(input.FilterDto)).
|
||||||
|
First(&data, input.Id).Error; err != nil {
|
||||||
if processedErr := pu.HandleReadError(err, event, source, input.Id, data); processedErr != nil {
|
if processedErr := pu.HandleReadError(err, event, source, input.Id, data); processedErr != nil {
|
||||||
return nil, processedErr
|
return nil, processedErr
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -889,7 +889,7 @@ func ApproveSwitchSpecialist(input e.ApproveCancelSpecialistDto) (*d.Data, error
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set doctor_code; nil indicates no change.
|
// Set doctor_code; nil indicates no change.
|
||||||
if input.Dst_Doctor_Code == nil {
|
if input.Dst_Doctor_Code == nil || *input.Dst_Doctor_Code == "" {
|
||||||
input.Dst_Doctor_Code = irData.Doctor_Code
|
input.Dst_Doctor_Code = irData.Doctor_Code
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1094,17 +1094,17 @@ func CreateWithPatient(input e.CreateWithPatientDto) (*d.Data, error) {
|
|||||||
pl.SetLogInfo(&event, input, "started", "create")
|
pl.SetLogInfo(&event, input, "started", "create")
|
||||||
|
|
||||||
roleAllowed := []string{string(erg.EPCReg)}
|
roleAllowed := []string{string(erg.EPCReg)}
|
||||||
err = validateAuth(input.Encounter.AuthInfo, roleAllowed, "create-encounter", &event)
|
err = validateAuth(input.AuthInfo, roleAllowed, "create-encounter", &event)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// validate rehab by bpjs
|
// validate rehab by bpjs
|
||||||
if input.Encounter.RefTypeCode == ere.RTCBpjs &&
|
if input.RefTypeCode == ere.RTCBpjs &&
|
||||||
input.Encounter.Class_Code == ere.ECAmbulatory &&
|
input.Class_Code == ere.ECAmbulatory &&
|
||||||
ere.AmbulatoryClassCode(*input.Encounter.SubClass_Code) == ere.ACCRehab {
|
ere.AmbulatoryClassCode(*input.SubClass_Code) == ere.ACCRehab {
|
||||||
// get latest rehab data
|
// get latest rehab data
|
||||||
recentRehabData, err := getLatestRehabData(input.Encounter, &event)
|
recentRehabData, err := getLatestRehabData(input.CreateDto, &event)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -1115,18 +1115,18 @@ func CreateWithPatient(input e.CreateWithPatientDto) (*d.Data, error) {
|
|||||||
// If the mode is "series", verify whether the visit count still remains
|
// If the mode is "series", verify whether the visit count still remains
|
||||||
// and whether the series has not expired.
|
// and whether the series has not expired.
|
||||||
// If visitMode is "series", then get encounterAdm
|
// If visitMode is "series", then get encounterAdm
|
||||||
input.Encounter.VisitMode_Code, input.Encounter.RecentEncounterAdm, err = determineVisitMode(recentRehabData, input.Encounter, &event)
|
input.VisitMode_Code, input.RecentEncounterAdm, err = determineVisitMode(recentRehabData, input.CreateDto, &event)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
input.Encounter.VisitMode_Code = ere.VMCAdm
|
input.VisitMode_Code = ere.VMCAdm
|
||||||
}
|
}
|
||||||
|
|
||||||
// When visitMode_Code is "series", load the associated SOAPI record to copy its values.
|
// When visitMode_Code is "series", load the associated SOAPI record to copy its values.
|
||||||
if input.Encounter.VisitMode_Code == ere.VMCSeries {
|
if input.VisitMode_Code == ere.VMCSeries {
|
||||||
// get data soapi
|
// get data soapi
|
||||||
recentSoapiDataforCopy, err = getSoapiEncounterAdm(*input.Encounter.RecentEncounterAdm, &event)
|
recentSoapiDataforCopy, err = getSoapiEncounterAdm(*input.RecentEncounterAdm, &event)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -1134,13 +1134,13 @@ func CreateWithPatient(input e.CreateWithPatientDto) (*d.Data, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// check if patient is new in the hospital
|
// check if patient is new in the hospital
|
||||||
input.Encounter.NewStatus, err = identifyPatientStatus(input.Encounter)
|
input.NewStatus, err = identifyPatientStatus(input.CreateDto)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
input.Encounter.Adm_Employee_Id = input.Encounter.AuthInfo.Employee_Id
|
input.Adm_Employee_Id = input.AuthInfo.Employee_Id
|
||||||
|
|
||||||
mwRunner := newMiddlewareRunner(&event, input.Encounter.Sync)
|
mwRunner := newMiddlewareRunner(&event, input.Sync)
|
||||||
|
|
||||||
err = dg.I.Transaction(func(tx *gorm.DB) error {
|
err = dg.I.Transaction(func(tx *gorm.DB) error {
|
||||||
// create patient
|
// create patient
|
||||||
@@ -1155,28 +1155,28 @@ func CreateWithPatient(input e.CreateWithPatientDto) (*d.Data, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// create encounter
|
// create encounter
|
||||||
input.Encounter.Patient_Id = &patientId
|
input.Patient_Id = &patientId
|
||||||
if resData, err := CreateData(input.Encounter, &event, tx); err != nil {
|
if resData, err := CreateData(input.CreateDto, &event, tx); err != nil {
|
||||||
return err
|
return err
|
||||||
} else {
|
} else {
|
||||||
data = *resData
|
data = *resData
|
||||||
input.Encounter.Id = data.Id
|
input.Id = data.Id
|
||||||
}
|
}
|
||||||
|
|
||||||
// insert ambulatory/emergency/inpatient
|
// insert ambulatory/emergency/inpatient
|
||||||
err = insertdataClassCode(input.Encounter, recentSoapiDataforCopy, &event, tx)
|
err = insertdataClassCode(input.CreateDto, recentSoapiDataforCopy, &event, tx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// insert vclaimReference
|
// insert vclaimReference
|
||||||
if vr := input.Encounter.VclaimReference; vr != nil {
|
if vr := input.VclaimReference; vr != nil {
|
||||||
t, _ := time.Parse("2006-01-02", vr.TglRujukan)
|
t, _ := time.Parse("2006-01-02", vr.TglRujukan)
|
||||||
_, err = uv.CreateData(ev.CreateDto{
|
_, err = uv.CreateData(ev.CreateDto{
|
||||||
Encounter_Id: &data.Id,
|
Encounter_Id: &data.Id,
|
||||||
Date: &t,
|
Date: &t,
|
||||||
SrcCode: input.Encounter.Ref_Number,
|
SrcCode: input.Ref_Number,
|
||||||
SrcName: input.Encounter.RefSource_Name,
|
SrcName: input.RefSource_Name,
|
||||||
Number: &vr.NoSep}, &event, tx)
|
Number: &vr.NoSep}, &event, tx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ package encounter
|
|||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
un "simrs-vx/internal/use-case/main-use-case/nurse"
|
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@@ -24,9 +23,10 @@ import (
|
|||||||
ere "simrs-vx/internal/domain/references/encounter"
|
ere "simrs-vx/internal/domain/references/encounter"
|
||||||
erg "simrs-vx/internal/domain/references/organization"
|
erg "simrs-vx/internal/domain/references/organization"
|
||||||
|
|
||||||
eaeh "simrs-vx/internal/domain/main-entities/adm-employee-hist"
|
|
||||||
ea "simrs-vx/internal/domain/main-entities/ambulatory"
|
ea "simrs-vx/internal/domain/main-entities/ambulatory"
|
||||||
ec "simrs-vx/internal/domain/main-entities/chemo"
|
ec "simrs-vx/internal/domain/main-entities/chemo"
|
||||||
|
ecpl "simrs-vx/internal/domain/main-entities/chemo-plan"
|
||||||
|
ecp "simrs-vx/internal/domain/main-entities/chemo-protocol"
|
||||||
edo "simrs-vx/internal/domain/main-entities/device-order"
|
edo "simrs-vx/internal/domain/main-entities/device-order"
|
||||||
ed "simrs-vx/internal/domain/main-entities/doctor"
|
ed "simrs-vx/internal/domain/main-entities/doctor"
|
||||||
ee "simrs-vx/internal/domain/main-entities/emergency"
|
ee "simrs-vx/internal/domain/main-entities/emergency"
|
||||||
@@ -42,12 +42,9 @@ import (
|
|||||||
ep "simrs-vx/internal/domain/main-entities/prescription"
|
ep "simrs-vx/internal/domain/main-entities/prescription"
|
||||||
epi "simrs-vx/internal/domain/main-entities/prescription-item"
|
epi "simrs-vx/internal/domain/main-entities/prescription-item"
|
||||||
er "simrs-vx/internal/domain/main-entities/rehab"
|
er "simrs-vx/internal/domain/main-entities/rehab"
|
||||||
erdh "simrs-vx/internal/domain/main-entities/responsible-doctor-hist"
|
|
||||||
es "simrs-vx/internal/domain/main-entities/soapi"
|
es "simrs-vx/internal/domain/main-entities/soapi"
|
||||||
esp "simrs-vx/internal/domain/main-entities/specialist"
|
esp "simrs-vx/internal/domain/main-entities/specialist"
|
||||||
|
|
||||||
// udo "simrs-vx/internal/use-case/main-use-case/device-order"
|
|
||||||
uaeh "simrs-vx/internal/use-case/main-use-case/adm-employee-hist"
|
|
||||||
ua "simrs-vx/internal/use-case/main-use-case/ambulatory"
|
ua "simrs-vx/internal/use-case/main-use-case/ambulatory"
|
||||||
uc "simrs-vx/internal/use-case/main-use-case/chemo"
|
uc "simrs-vx/internal/use-case/main-use-case/chemo"
|
||||||
ud "simrs-vx/internal/use-case/main-use-case/doctor"
|
ud "simrs-vx/internal/use-case/main-use-case/doctor"
|
||||||
@@ -58,10 +55,10 @@ import (
|
|||||||
umi "simrs-vx/internal/use-case/main-use-case/medicine-mix"
|
umi "simrs-vx/internal/use-case/main-use-case/medicine-mix"
|
||||||
ummi "simrs-vx/internal/use-case/main-use-case/medicine-mix-item"
|
ummi "simrs-vx/internal/use-case/main-use-case/medicine-mix-item"
|
||||||
_ "simrs-vx/internal/use-case/main-use-case/nurse"
|
_ "simrs-vx/internal/use-case/main-use-case/nurse"
|
||||||
|
un "simrs-vx/internal/use-case/main-use-case/nurse"
|
||||||
up "simrs-vx/internal/use-case/main-use-case/prescription"
|
up "simrs-vx/internal/use-case/main-use-case/prescription"
|
||||||
upi "simrs-vx/internal/use-case/main-use-case/prescription-item"
|
upi "simrs-vx/internal/use-case/main-use-case/prescription-item"
|
||||||
ur "simrs-vx/internal/use-case/main-use-case/rehab"
|
ur "simrs-vx/internal/use-case/main-use-case/rehab"
|
||||||
urdh "simrs-vx/internal/use-case/main-use-case/responsible-doctor-hist"
|
|
||||||
us "simrs-vx/internal/use-case/main-use-case/soapi"
|
us "simrs-vx/internal/use-case/main-use-case/soapi"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -396,192 +393,6 @@ func getMcuOrders(encounter_id uint, event *pl.Event, tx *gorm.DB) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func upsertResponsibleDoctorHist(input erdh.CreateDto, event *pl.Event, dbx ...*gorm.DB) error {
|
|
||||||
pl.SetLogInfo(event, nil, "started", "DBCreate")
|
|
||||||
|
|
||||||
var tx *gorm.DB
|
|
||||||
if len(dbx) > 0 {
|
|
||||||
tx = dbx[0]
|
|
||||||
} else {
|
|
||||||
tx = dg.I
|
|
||||||
}
|
|
||||||
|
|
||||||
var latest erdh.ResponsibleDoctorHist
|
|
||||||
err := tx.
|
|
||||||
Where("\"Encounter_Id\" = ?", input.Encounter_Id).
|
|
||||||
Order("\"CreatedAt\" DESC").
|
|
||||||
Limit(1).
|
|
||||||
First(&latest).Error
|
|
||||||
|
|
||||||
switch {
|
|
||||||
case errors.Is(err, gorm.ErrRecordNotFound):
|
|
||||||
// Insert
|
|
||||||
if _, err = urdh.CreateData(input, event, tx); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
case err != nil:
|
|
||||||
event.Status = "failed"
|
|
||||||
event.ErrInfo = pl.ErrorInfo{
|
|
||||||
Code: "read-fail",
|
|
||||||
Detail: "Failed to read responsible doctor history",
|
|
||||||
Raw: err,
|
|
||||||
}
|
|
||||||
return pl.SetLogError(event, input)
|
|
||||||
default:
|
|
||||||
// Update
|
|
||||||
if err := tx.Model(&latest).Updates(map[string]interface{}{
|
|
||||||
"Doctor_Code": input.Doctor_Code,
|
|
||||||
"StartedAt": input.StartedAt,
|
|
||||||
"UpdatedAt": time.Now(),
|
|
||||||
}).Error; err != nil {
|
|
||||||
event.Status = "failed"
|
|
||||||
event.ErrInfo = pl.ErrorInfo{
|
|
||||||
Code: "update-fail",
|
|
||||||
Detail: "Failed to update responsible doctor history",
|
|
||||||
Raw: err,
|
|
||||||
}
|
|
||||||
return pl.SetLogError(event, input)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pl.SetLogInfo(event, input, "complete")
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func upsertAdmEmployeeHist(input eaeh.CreateDto, event *pl.Event, dbx ...*gorm.DB) error {
|
|
||||||
pl.SetLogInfo(event, nil, "started", "DBCreate")
|
|
||||||
|
|
||||||
var tx *gorm.DB
|
|
||||||
if len(dbx) > 0 {
|
|
||||||
tx = dbx[0]
|
|
||||||
} else {
|
|
||||||
tx = dg.I
|
|
||||||
}
|
|
||||||
|
|
||||||
var latest eaeh.AdmEmployeeHist
|
|
||||||
err := tx.
|
|
||||||
Where("\"Encounter_Id\" = ?", input.Encounter_Id).
|
|
||||||
Order("\"CreatedAt\" DESC").
|
|
||||||
Limit(1).
|
|
||||||
First(&latest).Error
|
|
||||||
|
|
||||||
switch {
|
|
||||||
case errors.Is(err, gorm.ErrRecordNotFound):
|
|
||||||
// Insert
|
|
||||||
if _, err = uaeh.CreateData(input, event, tx); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
case err != nil:
|
|
||||||
event.Status = "failed"
|
|
||||||
event.ErrInfo = pl.ErrorInfo{
|
|
||||||
Code: "read-fail",
|
|
||||||
Detail: "Failed to read responsible doctor history",
|
|
||||||
Raw: err,
|
|
||||||
}
|
|
||||||
return pl.SetLogError(event, input)
|
|
||||||
|
|
||||||
default:
|
|
||||||
// Update
|
|
||||||
if err := tx.Model(&latest).Updates(map[string]interface{}{
|
|
||||||
"Employee_Id": input.Employee_Id,
|
|
||||||
"StartedAt": input.StartedAt,
|
|
||||||
"UpdatedAt": time.Now(),
|
|
||||||
}).Error; err != nil {
|
|
||||||
event.Status = "failed"
|
|
||||||
event.ErrInfo = pl.ErrorInfo{
|
|
||||||
Code: "update-fail",
|
|
||||||
Detail: "Failed to update responsible doctor history",
|
|
||||||
Raw: err,
|
|
||||||
}
|
|
||||||
return pl.SetLogError(event, input)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pl.SetLogInfo(event, input, "complete")
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func updateLatestResponsibleDoctorHist(input e.CheckinDto, event *pl.Event, dbx ...*gorm.DB) error {
|
|
||||||
pl.SetLogInfo(event, "started", "DBUpdate")
|
|
||||||
|
|
||||||
var tx *gorm.DB
|
|
||||||
if len(dbx) > 0 {
|
|
||||||
tx = dbx[0]
|
|
||||||
} else {
|
|
||||||
tx = dg.I
|
|
||||||
}
|
|
||||||
|
|
||||||
subQuery := tx.
|
|
||||||
Select("\"Id\"").
|
|
||||||
Model(&erdh.ResponsibleDoctorHist{}).
|
|
||||||
Where("\"Encounter_Id\" = ?", input.Id).
|
|
||||||
Order("\"CreatedAt\" DESC").
|
|
||||||
Limit(1)
|
|
||||||
|
|
||||||
result := tx.
|
|
||||||
Model(&erdh.ResponsibleDoctorHist{}).
|
|
||||||
Where("\"Id\" = (?)", subQuery).
|
|
||||||
Update("\"FinishedAt\"", input.FinishedAt)
|
|
||||||
|
|
||||||
if result.Error != nil {
|
|
||||||
event.Status = "failed"
|
|
||||||
event.ErrInfo = pl.ErrorInfo{
|
|
||||||
Code: "data-update-fail",
|
|
||||||
Detail: "Database update failed",
|
|
||||||
Raw: result.Error,
|
|
||||||
}
|
|
||||||
return pl.SetLogError(event, input)
|
|
||||||
}
|
|
||||||
|
|
||||||
if result.RowsAffected == 0 {
|
|
||||||
pl.SetLogInfo(event, input, "no previous data found to update")
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
pl.SetLogInfo(event, nil, "complete")
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func updateLatestAdmEmployeeHist(input e.CheckinDto, event *pl.Event, dbx ...*gorm.DB) error {
|
|
||||||
pl.SetLogInfo(event, "started", "DBUpdate")
|
|
||||||
|
|
||||||
var tx *gorm.DB
|
|
||||||
if len(dbx) > 0 {
|
|
||||||
tx = dbx[0]
|
|
||||||
} else {
|
|
||||||
tx = dg.I
|
|
||||||
}
|
|
||||||
|
|
||||||
subQuery := tx.
|
|
||||||
Select("\"Id\"").
|
|
||||||
Model(&eaeh.AdmEmployeeHist{}).
|
|
||||||
Where("\"Encounter_Id\" = ?", input.Id).
|
|
||||||
Order("\"CreatedAt\" DESC").
|
|
||||||
Limit(1)
|
|
||||||
|
|
||||||
result := tx.
|
|
||||||
Model(&eaeh.AdmEmployeeHist{}).
|
|
||||||
Where("\"Id\" = (?)", subQuery).
|
|
||||||
Update("\"FinishedAt\"", input.FinishedAt)
|
|
||||||
|
|
||||||
if result.Error != nil {
|
|
||||||
event.Status = "failed"
|
|
||||||
event.ErrInfo = pl.ErrorInfo{
|
|
||||||
Code: "data-update-fail",
|
|
||||||
Detail: "Database update failed",
|
|
||||||
Raw: result.Error,
|
|
||||||
}
|
|
||||||
return pl.SetLogError(event, input)
|
|
||||||
}
|
|
||||||
|
|
||||||
if result.RowsAffected == 0 {
|
|
||||||
pl.SetLogInfo(event, input, "no previous data found to update")
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
pl.SetLogInfo(event, nil, "complete")
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func getSoapiByResponsibleDoctor(enc e.Encounter, event *pl.Event) (data []es.Soapi, err error) {
|
func getSoapiByResponsibleDoctor(enc e.Encounter, event *pl.Event) (data []es.Soapi, err error) {
|
||||||
pl.SetLogInfo(event, enc, "started", "DBReadList")
|
pl.SetLogInfo(event, enc, "started", "DBReadList")
|
||||||
|
|
||||||
@@ -849,13 +660,31 @@ func insertdataClassCode(input e.CreateDto, soapiData []es.CreateDto, event *pl.
|
|||||||
|
|
||||||
func insertDataSubClassAmbulatory(input e.CreateDto, soapiData []es.CreateDto, event *pl.Event, tx *gorm.DB) (err error) {
|
func insertDataSubClassAmbulatory(input e.CreateDto, soapiData []es.CreateDto, event *pl.Event, tx *gorm.DB) (err error) {
|
||||||
subCode := ere.AmbulatoryClassCode(*input.SubClass_Code)
|
subCode := ere.AmbulatoryClassCode(*input.SubClass_Code)
|
||||||
|
var chemoPlan *ecpl.ChemoPlan
|
||||||
|
|
||||||
switch {
|
switch {
|
||||||
case subCode == ere.ACCChemo:
|
case subCode == ere.ACCChemo:
|
||||||
|
// validate if encounter Chemo valid
|
||||||
|
chemoPlan, err = validateChemo(*input.Patient_Id, event)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if chemoPlan == nil {
|
||||||
|
event.Status = "failed"
|
||||||
|
event.ErrInfo = pl.ErrorInfo{
|
||||||
|
Code: "data-not-found",
|
||||||
|
Detail: "chemo plan not found",
|
||||||
|
}
|
||||||
|
|
||||||
|
return pl.SetLogError(event, input)
|
||||||
|
}
|
||||||
|
|
||||||
chemoCreate := ec.CreateDto{
|
chemoCreate := ec.CreateDto{
|
||||||
Encounter_Id: &input.Id,
|
Encounter_Id: &input.Id,
|
||||||
Status_Code: erc.DVCNew,
|
Status_Code: erc.DVCVerified,
|
||||||
Specialist_Code: input.Specialist_Code,
|
Specialist_Code: input.Specialist_Code,
|
||||||
|
Class_Code: ere.CCCAct,
|
||||||
}
|
}
|
||||||
|
|
||||||
// create data chemo
|
// create data chemo
|
||||||
@@ -864,6 +693,13 @@ func insertDataSubClassAmbulatory(input e.CreateDto, soapiData []es.CreateDto, e
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// set chemo-plan to planned
|
||||||
|
chemoPlan.Encounter_Id = &input.Id
|
||||||
|
err = updateChemoPlan(chemoPlan, event, tx)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
case subCode == ere.ACCRehab:
|
case subCode == ere.ACCRehab:
|
||||||
rehabData := er.CreateDto{
|
rehabData := er.CreateDto{
|
||||||
Encounter_Id: &input.Id,
|
Encounter_Id: &input.Id,
|
||||||
@@ -1009,18 +845,18 @@ func getDoctors(doctorIds []string, event *pl.Event) ([]ed.Doctor, error) {
|
|||||||
return doctors, nil
|
return doctors, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func validateSpecialistCodes(unitCodes map[string]struct{}, event *pl.Event) error {
|
func validateSpecialistCodes(speCodes map[string]struct{}, event *pl.Event) error {
|
||||||
if len(unitCodes) > 0 {
|
if len(speCodes) > 0 {
|
||||||
var codes []string
|
var codes []string
|
||||||
for code := range unitCodes {
|
for code := range speCodes {
|
||||||
codes = append(codes, code)
|
codes = append(codes, code)
|
||||||
}
|
}
|
||||||
|
|
||||||
units, err := getSpecialists(codes, event)
|
specialists, err := getSpecialists(codes, event)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to fetch units: %w", err)
|
return fmt.Errorf("failed to fetch units: %w", err)
|
||||||
}
|
}
|
||||||
if len(units) != len(codes) {
|
if len(specialists) != len(codes) {
|
||||||
event.Status = "failed"
|
event.Status = "failed"
|
||||||
event.ErrInfo = pl.ErrorInfo{
|
event.ErrInfo = pl.ErrorInfo{
|
||||||
Code: "data-validation-fail",
|
Code: "data-validation-fail",
|
||||||
@@ -1056,3 +892,127 @@ func validateDoctorCodes(doctorCodes map[string]struct{}, event *pl.Event) error
|
|||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func updateChemoPlan(data *ecpl.ChemoPlan, event *pl.Event, dbx ...*gorm.DB) error {
|
||||||
|
pl.SetLogInfo(event, nil, "started", "getChemoFromEncounter")
|
||||||
|
var tx *gorm.DB
|
||||||
|
if len(dbx) > 0 {
|
||||||
|
tx = dbx[0]
|
||||||
|
} else {
|
||||||
|
tx = dg.I
|
||||||
|
}
|
||||||
|
|
||||||
|
err := tx.Model(&data).Updates(map[string]interface{}{
|
||||||
|
`"Status"`: ere.SPCPlanned,
|
||||||
|
`"Encounter_Id"`: data.Encounter_Id}).Error
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
pl.SetLogInfo(event, nil, "complete")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func getChemoProtocol(patientId uint, event *pl.Event) (*ecp.ChemoProtocol, error) {
|
||||||
|
pl.SetLogInfo(event, nil, "started", "getChemoProtocol")
|
||||||
|
data := ecp.ChemoProtocol{}
|
||||||
|
|
||||||
|
var tx = dg.I
|
||||||
|
|
||||||
|
tx = tx.Model(&ecp.ChemoProtocol{}).
|
||||||
|
Joins(`LEFT JOIN "ChemoPlan" cp ON cp."Protocol_Id" = "ChemoProtocol"."Id"`).
|
||||||
|
Where(`"ChemoProtocol"."Patient_Id" = ?`, patientId).
|
||||||
|
Preload("ChemoPlans", func(db *gorm.DB) *gorm.DB {
|
||||||
|
return db.
|
||||||
|
Where(`"Status" IS NULL OR "Status" = ?`, ere.SPCSchedule).
|
||||||
|
Order(`"Id" ASC`).
|
||||||
|
Limit(1)
|
||||||
|
}).
|
||||||
|
Order(`"CreatedAt" DESC`).
|
||||||
|
First(&data)
|
||||||
|
|
||||||
|
if err := tx.Error; err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
pl.SetLogInfo(event, nil, "complete")
|
||||||
|
return &data, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func validateChemo(patientId uint, event *pl.Event) (*ecpl.ChemoPlan, error) {
|
||||||
|
// get chemo adm
|
||||||
|
chemoAdm, err := getChemoAdm(patientId, event)
|
||||||
|
if err != nil {
|
||||||
|
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||||
|
event.Status = "failed"
|
||||||
|
event.ErrInfo = pl.ErrorInfo{
|
||||||
|
Code: "data-not-found",
|
||||||
|
Detail: "patient doesn't have active chemo",
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil, pl.SetLogError(event, patientId)
|
||||||
|
}
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// validate is chemo verified
|
||||||
|
if chemoAdm.Status_Code != erc.DVCVerified {
|
||||||
|
event.Status = "failed"
|
||||||
|
event.ErrInfo = pl.ErrorInfo{
|
||||||
|
Code: "data-not-match",
|
||||||
|
Detail: fmt.Sprintf("chemo not yet verified"),
|
||||||
|
}
|
||||||
|
return nil, pl.SetLogError(event, chemoAdm)
|
||||||
|
}
|
||||||
|
|
||||||
|
// get chemo protocol
|
||||||
|
chemoProtocol, err := getChemoProtocol(patientId, event)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if chemoProtocol.Status_Code != erc.DVCVerified {
|
||||||
|
event.Status = "failed"
|
||||||
|
event.ErrInfo = pl.ErrorInfo{
|
||||||
|
Code: "data-not-match",
|
||||||
|
Detail: fmt.Sprintf("protocol chemo not yet verified"),
|
||||||
|
}
|
||||||
|
return nil, pl.SetLogError(event, chemoProtocol)
|
||||||
|
}
|
||||||
|
|
||||||
|
if now.Before(*chemoProtocol.StartDate) || now.After(*chemoProtocol.EndDate) {
|
||||||
|
event.Status = "failed"
|
||||||
|
event.ErrInfo = pl.ErrorInfo{
|
||||||
|
Code: "invalid-date-range",
|
||||||
|
Detail: "chemo cannot be performed because the current date is outside the allowed treatment window.",
|
||||||
|
}
|
||||||
|
return nil, pl.SetLogError(event, chemoProtocol)
|
||||||
|
}
|
||||||
|
|
||||||
|
if chemoProtocol.ChemoPlans == nil || len(*chemoProtocol.ChemoPlans) == 0 {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return the first chemo plan
|
||||||
|
return &(*chemoProtocol.ChemoPlans)[0], nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func getChemoAdm(patientId uint, event *pl.Event) (*ec.Chemo, error) {
|
||||||
|
pl.SetLogInfo(event, nil, "started", "getChemoProtocol")
|
||||||
|
data := ec.Chemo{}
|
||||||
|
|
||||||
|
var tx = dg.I
|
||||||
|
|
||||||
|
tx = tx.Model(&ec.Chemo{}).
|
||||||
|
Joins(`LEFT JOIN "Encounter" e ON e."Id" = "Chemo"."Encounter_Id"`).
|
||||||
|
Where(`e."Patient_Id" = ? AND "Chemo"."Class_Code" = ?`, patientId, ere.CCCAdm).
|
||||||
|
Order(`"CreatedAt" DESC`).
|
||||||
|
First(&data)
|
||||||
|
|
||||||
|
if err := tx.Error; err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
pl.SetLogInfo(event, nil, "complete")
|
||||||
|
return &data, nil
|
||||||
|
}
|
||||||
@@ -59,10 +59,11 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.En
|
|||||||
} else {
|
} else {
|
||||||
tx = dg.I
|
tx = dg.I
|
||||||
}
|
}
|
||||||
|
|
||||||
tx = tx.Model(&e.Encounter{})
|
tx = tx.Model(&e.Encounter{})
|
||||||
|
|
||||||
if input.AuthInfo.Doctor_Code != nil {
|
if input.AuthInfo.Doctor_Code != nil {
|
||||||
tx.Where("\"Responsible_Doctor_Code\" = ?", *input.AuthInfo.Doctor_Code) //
|
tx = tx.Where("\"Responsible_Doctor_Code\" = ?", *input.AuthInfo.Doctor_Code) //
|
||||||
}
|
}
|
||||||
|
|
||||||
if input.StartDate != nil && input.EndDate != nil {
|
if input.StartDate != nil && input.EndDate != nil {
|
||||||
@@ -75,7 +76,8 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.En
|
|||||||
|
|
||||||
if input.Patient_Identifier != nil {
|
if input.Patient_Identifier != nil {
|
||||||
tx = tx.Joins("JOIN \"Patient\" ON \"Patient\".\"Id\" = \"Encounter\".\"Patient_Id\"").
|
tx = tx.Joins("JOIN \"Patient\" ON \"Patient\".\"Id\" = \"Encounter\".\"Patient_Id\"").
|
||||||
Joins("JOIN \"Person\" ON \"Person\".\"Id\" = \"Patient\".\"Person_Id\"").Where("\"Person\".\"Name\" ILIKE ? OR \"Patient\".\"Number\" = ?", "%"+*input.Patient_Identifier+"%", *input.Patient_Identifier)
|
Joins("JOIN \"Person\" ON \"Person\".\"Id\" = \"Patient\".\"Person_Id\"").
|
||||||
|
Where("\"Person\".\"Name\" ILIKE ? OR \"Patient\".\"Number\" = ?", "%"+*input.Patient_Identifier+"%", *input.Patient_Identifier)
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: getuk lib need to be updated to support this
|
// TODO: getuk lib need to be updated to support this
|
||||||
@@ -91,10 +93,15 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.En
|
|||||||
tx = tx.Where("\"Encounter\".\"PaymentMethod_Code\" = ?", *input.PaymentMethod_Code)
|
tx = tx.Where("\"Encounter\".\"PaymentMethod_Code\" = ?", *input.PaymentMethod_Code)
|
||||||
}
|
}
|
||||||
|
|
||||||
tx = tx.Scopes(gh.Preload(input.Includes)).
|
if input.ChemoClass != nil {
|
||||||
Count(&count).
|
tx = tx.Joins(`RIGHT JOIN "Chemo" "c" ON "c"."Encounter_Id" = "Encounter"."Id"`).
|
||||||
Scopes(gh.Paginate(input, &pagination)).
|
Where(`"c"."Class_Code" = ?`, *input.ChemoClass)
|
||||||
Order("\"CreatedAt\" DESC")
|
}
|
||||||
|
|
||||||
|
// count
|
||||||
|
if err := tx.Count(&count).Error; err != nil {
|
||||||
|
return nil, nil, plh.HandleListError(input, event, err)
|
||||||
|
}
|
||||||
|
|
||||||
// tx.Debug().Scopes(gh.Preload(input.Includes)).
|
// tx.Debug().Scopes(gh.Preload(input.Includes)).
|
||||||
// Scopes(gh.Filter(input.FilterDto)).
|
// Scopes(gh.Filter(input.FilterDto)).
|
||||||
@@ -102,7 +109,11 @@ func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.En
|
|||||||
// Scopes(gh.Paginate(input, &pagination)).
|
// Scopes(gh.Paginate(input, &pagination)).
|
||||||
// Order("\"CreatedAt\" DESC")
|
// Order("\"CreatedAt\" DESC")
|
||||||
|
|
||||||
if err := tx.Find(&data).Error; err != nil {
|
if err := tx.
|
||||||
|
Scopes(gh.Preload(input.Includes)).
|
||||||
|
Scopes(gh.Paginate(input, &pagination)).
|
||||||
|
Order("\"CreatedAt\" DESC").
|
||||||
|
Find(&data).Error; err != nil {
|
||||||
if err == gorm.ErrRecordNotFound {
|
if err == gorm.ErrRecordNotFound {
|
||||||
return nil, &meta, nil
|
return nil, &meta, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -328,6 +328,12 @@ func generateResumeTemplateData(resume er.Resume, event pl.Event, tx *gorm.DB) (
|
|||||||
templateData.DischargeMethod = rData.Management.DischargeMethod
|
templateData.DischargeMethod = rData.Management.DischargeMethod
|
||||||
templateData.Medications = rData.Medication.Medications
|
templateData.Medications = rData.Medication.Medications
|
||||||
templateData.Date = pu.GetTimeNow().Format("02-01-2006")
|
templateData.Date = pu.GetTimeNow().Format("02-01-2006")
|
||||||
|
// this below is just my guess
|
||||||
|
// templateData.ControlHealthcare = get from vclaim sep eg. III
|
||||||
|
// templateData.ControlUnit = get from vclaim sep eg. R.KERINCI - KLS 3
|
||||||
|
// templateData.ControlDate = get from vclaim sep eg. 2022-01-01
|
||||||
|
templateData.RssaLogo = docscfg.O.GetDomain() + "assets/docs/logo-rssa.png"
|
||||||
|
templateData.JatimLogo = docscfg.O.GetDomain() + "assets/docs/logo-provinsi-jawa-timur.png"
|
||||||
|
|
||||||
return &templateData, nil
|
return &templateData, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,10 +62,12 @@ type ResumePDF struct {
|
|||||||
ConditionOnDischarge string
|
ConditionOnDischarge string
|
||||||
DischargeMethod string
|
DischargeMethod string
|
||||||
Medications []er.MedicationEntry
|
Medications []er.MedicationEntry
|
||||||
// fasyankes
|
ControlHealthcare string
|
||||||
// date
|
ControlUnit string
|
||||||
// klinik
|
ControlDate string
|
||||||
Date string
|
Date string
|
||||||
|
RssaLogo string
|
||||||
|
JatimLogo string
|
||||||
}
|
}
|
||||||
|
|
||||||
type ScreeningPDF struct {
|
type ScreeningPDF struct {
|
||||||
|
|||||||
@@ -241,6 +241,40 @@ func Delete(input e.DeleteDto) (*d.Data, error) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func CreateBulk(input e.CreateBulkDto) (*d.Data, error) {
|
||||||
|
var data []e.Installation
|
||||||
|
|
||||||
|
event := pl.Event{
|
||||||
|
Feature: "Create",
|
||||||
|
Source: source,
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start log
|
||||||
|
pl.SetLogInfo(&event, input, "started", "create")
|
||||||
|
err := dg.I.Transaction(func(tx *gorm.DB) error {
|
||||||
|
if resData, err := CreateBulkData(input.Value, &event, tx); err != nil {
|
||||||
|
return err
|
||||||
|
} else {
|
||||||
|
data = *resData
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
pl.SetLogInfo(&event, nil, "complete")
|
||||||
|
|
||||||
|
return &d.Data{
|
||||||
|
Meta: d.II{
|
||||||
|
"source": source,
|
||||||
|
"structure": "single-data",
|
||||||
|
"status": "created",
|
||||||
|
},
|
||||||
|
Data: e.ToResponseList(data),
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
func runLogMiddleware(err error, input any, mwRunner *middlewareRunner) error {
|
func runLogMiddleware(err error, input any, mwRunner *middlewareRunner) error {
|
||||||
var errMsg string
|
var errMsg string
|
||||||
inputLog := esync.SimxLogDto{
|
inputLog := esync.SimxLogDto{
|
||||||
|
|||||||
@@ -21,3 +21,15 @@ func setData[T *e.CreateDto | *e.UpdateDto](input T, data *e.Installation) {
|
|||||||
data.Name = inputSrc.Name
|
data.Name = inputSrc.Name
|
||||||
data.EncounterClass_Code = inputSrc.EncounterClass_Code
|
data.EncounterClass_Code = inputSrc.EncounterClass_Code
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func setBulkData(input []e.CreateDto) (data []e.Installation) {
|
||||||
|
for _, i := range input {
|
||||||
|
data = append(data, e.Installation{
|
||||||
|
Code: *i.Code,
|
||||||
|
Name: i.Name,
|
||||||
|
EncounterClass_Code: i.EncounterClass_Code,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
return data
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
package installation
|
package installation
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
e "simrs-vx/internal/domain/main-entities/installation"
|
e "simrs-vx/internal/domain/main-entities/installation"
|
||||||
|
|
||||||
plh "simrs-vx/pkg/lib-helper"
|
plh "simrs-vx/pkg/lib-helper"
|
||||||
@@ -147,3 +148,26 @@ func DeleteData(data *e.Installation, event *pl.Event, dbx ...*gorm.DB) error {
|
|||||||
pl.SetLogInfo(event, nil, "complete")
|
pl.SetLogInfo(event, nil, "complete")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func CreateBulkData(input []e.CreateDto, event *pl.Event, dbx ...*gorm.DB) (*[]e.Installation, error) {
|
||||||
|
pl.SetLogInfo(event, nil, "started", "DBBulkCreate")
|
||||||
|
|
||||||
|
data := setBulkData(input)
|
||||||
|
|
||||||
|
var tx *gorm.DB
|
||||||
|
if len(dbx) > 0 {
|
||||||
|
tx = dbx[0]
|
||||||
|
} else {
|
||||||
|
tx = dg.I
|
||||||
|
}
|
||||||
|
|
||||||
|
result := tx.Create(&data)
|
||||||
|
if err := result.Error; err != nil {
|
||||||
|
return nil, plh.HandleCreateError(input, event, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Println("Inserted:", result.RowsAffected)
|
||||||
|
|
||||||
|
pl.SetLogInfo(event, nil, "complete")
|
||||||
|
return &data, nil
|
||||||
|
}
|
||||||
@@ -0,0 +1,397 @@
|
|||||||
|
package kfr
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
erc "simrs-vx/internal/domain/references/common"
|
||||||
|
|
||||||
|
// main entities
|
||||||
|
ee "simrs-vx/internal/domain/main-entities/encounter"
|
||||||
|
e "simrs-vx/internal/domain/main-entities/kfr"
|
||||||
|
|
||||||
|
ue "simrs-vx/internal/use-case/main-use-case/encounter"
|
||||||
|
|
||||||
|
pl "simrs-vx/pkg/logger"
|
||||||
|
pu "simrs-vx/pkg/use-case-helper"
|
||||||
|
|
||||||
|
dg "github.com/karincake/apem/db-gorm-pg"
|
||||||
|
d "github.com/karincake/dodol"
|
||||||
|
"gorm.io/gorm"
|
||||||
|
)
|
||||||
|
|
||||||
|
const source = "kfr"
|
||||||
|
|
||||||
|
func Create(input e.CreateDto) (*d.Data, error) {
|
||||||
|
data := e.KFR{}
|
||||||
|
|
||||||
|
event := pl.Event{
|
||||||
|
Feature: "Create",
|
||||||
|
Source: source,
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start log
|
||||||
|
pl.SetLogInfo(&event, input, "started", "create")
|
||||||
|
|
||||||
|
err := dg.I.Transaction(func(tx *gorm.DB) error {
|
||||||
|
if !input.AuthInfo.IsDoctor() {
|
||||||
|
return errors.New("user is not a doctor")
|
||||||
|
}
|
||||||
|
|
||||||
|
mwRunner := newMiddlewareRunner(&event, tx)
|
||||||
|
mwRunner.setMwType(pu.MWTPre)
|
||||||
|
// Run pre-middleware
|
||||||
|
if err := mwRunner.RunCreateMiddleware(createPreMw, &input, &data); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// check if encounter is done
|
||||||
|
if ue.IsDone(*input.Encounter_Id, &event, tx) {
|
||||||
|
return errors.New("encounter is already done")
|
||||||
|
}
|
||||||
|
|
||||||
|
if input.AuthInfo.Employee_Id == nil {
|
||||||
|
return errors.New("user is not an employee")
|
||||||
|
}
|
||||||
|
|
||||||
|
input.CreatedBy_Employee_Id = input.AuthInfo.Employee_Id
|
||||||
|
|
||||||
|
if resData, err := CreateData(input, &event, tx); err != nil {
|
||||||
|
return err
|
||||||
|
} else {
|
||||||
|
data = *resData
|
||||||
|
}
|
||||||
|
|
||||||
|
mwRunner.setMwType(pu.MWTPost)
|
||||||
|
// Run post-middleware
|
||||||
|
if err := mwRunner.RunCreateMiddleware(createPostMw, &input, &data); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
pl.SetLogInfo(&event, nil, "complete")
|
||||||
|
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return &d.Data{
|
||||||
|
Meta: d.II{
|
||||||
|
"source": source,
|
||||||
|
"structure": "single-data",
|
||||||
|
"status": "created",
|
||||||
|
},
|
||||||
|
Data: data.ToResponse(),
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func ReadList(input e.ReadListDto) (*d.Data, error) {
|
||||||
|
var data *e.KFR
|
||||||
|
var dataList []e.KFR
|
||||||
|
var metaList *e.MetaDto
|
||||||
|
var err error
|
||||||
|
|
||||||
|
event := pl.Event{
|
||||||
|
Feature: "ReadList",
|
||||||
|
Source: source,
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start log
|
||||||
|
pl.SetLogInfo(&event, input, "started", "readList")
|
||||||
|
|
||||||
|
err = dg.I.Transaction(func(tx *gorm.DB) error {
|
||||||
|
mwRunner := newMiddlewareRunner(&event, tx)
|
||||||
|
mwRunner.setMwType(pu.MWTPre)
|
||||||
|
// Run pre-middleware
|
||||||
|
if err := mwRunner.RunReadListMiddleware(readListPreMw, &input, data); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if dataList, metaList, err = ReadListData(input, &event, tx); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
mwRunner.setMwType(pu.MWTPost)
|
||||||
|
// Run post-middleware
|
||||||
|
if err := mwRunner.RunReadListMiddleware(readListPostMw, &input, data); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return &d.Data{
|
||||||
|
Meta: d.IS{
|
||||||
|
"source": source,
|
||||||
|
"structure": "list-data",
|
||||||
|
"status": "fetched",
|
||||||
|
"page_number": strconv.Itoa(metaList.PageNumber),
|
||||||
|
"page_size": strconv.Itoa(metaList.PageSize),
|
||||||
|
"record_totalCount": strconv.Itoa(metaList.Count),
|
||||||
|
"record_currentCount": strconv.Itoa(len(dataList)),
|
||||||
|
},
|
||||||
|
Data: e.ToResponseList(dataList),
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func ReadDetail(input e.ReadDetailDto) (*d.Data, error) {
|
||||||
|
var data *e.KFR
|
||||||
|
var err error
|
||||||
|
|
||||||
|
event := pl.Event{
|
||||||
|
Feature: "ReadDetail",
|
||||||
|
Source: source,
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start log
|
||||||
|
pl.SetLogInfo(&event, input, "started", "readDetail")
|
||||||
|
|
||||||
|
err = dg.I.Transaction(func(tx *gorm.DB) error {
|
||||||
|
mwRunner := newMiddlewareRunner(&event, tx)
|
||||||
|
mwRunner.setMwType(pu.MWTPre)
|
||||||
|
// Run pre-middleware
|
||||||
|
if err := mwRunner.RunReadDetailMiddleware(readDetailPreMw, &input, data); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if data, err = ReadDetailData(input, &event, tx); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
mwRunner.setMwType(pu.MWTPost)
|
||||||
|
// Run post-middleware
|
||||||
|
if err := mwRunner.RunReadDetailMiddleware(readDetailPostMw, &input, data); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return &d.Data{
|
||||||
|
Meta: d.IS{
|
||||||
|
"source": source,
|
||||||
|
"structure": "single-data",
|
||||||
|
"status": "fetched",
|
||||||
|
},
|
||||||
|
Data: data.ToResponse(),
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func Update(input e.UpdateDto) (*d.Data, error) {
|
||||||
|
rdDto := e.ReadDetailDto{Id: input.Id}
|
||||||
|
var data *e.KFR
|
||||||
|
var err error
|
||||||
|
|
||||||
|
event := pl.Event{
|
||||||
|
Feature: "Update",
|
||||||
|
Source: source,
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start log
|
||||||
|
pl.SetLogInfo(&event, input, "started", "update")
|
||||||
|
|
||||||
|
err = dg.I.Transaction(func(tx *gorm.DB) error {
|
||||||
|
if !input.AuthInfo.IsDoctor() {
|
||||||
|
return errors.New("user is not a doctor")
|
||||||
|
}
|
||||||
|
|
||||||
|
pl.SetLogInfo(&event, rdDto, "started", "DBReadDetail")
|
||||||
|
if data, err = ReadDetailData(rdDto, &event, tx); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
mwRunner := newMiddlewareRunner(&event, tx)
|
||||||
|
mwRunner.setMwType(pu.MWTPre)
|
||||||
|
// Run pre-middleware
|
||||||
|
if err := mwRunner.RunUpdateMiddleware(readDetailPreMw, &rdDto, data); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// check if encounter is done
|
||||||
|
if ue.IsDone(*input.Encounter_Id, &event, tx) {
|
||||||
|
return errors.New("encounter is already done")
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := UpdateData(input, data, &event, tx); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get Updated Data
|
||||||
|
if data, err = ReadDetailData(rdDto, &event, tx); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
pl.SetLogInfo(&event, nil, "complete")
|
||||||
|
|
||||||
|
mwRunner.setMwType(pu.MWTPost)
|
||||||
|
// Run post-middleware
|
||||||
|
if err := mwRunner.RunUpdateMiddleware(readDetailPostMw, &rdDto, data); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return &d.Data{
|
||||||
|
Meta: d.IS{
|
||||||
|
"source": source,
|
||||||
|
"structure": "single-data",
|
||||||
|
"status": "updated",
|
||||||
|
},
|
||||||
|
Data: data.ToResponse(),
|
||||||
|
}, nil
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func Delete(input e.DeleteDto) (*d.Data, error) {
|
||||||
|
rdDto := e.ReadDetailDto{Id: uint(input.Id)}
|
||||||
|
var data *e.KFR
|
||||||
|
var err error
|
||||||
|
|
||||||
|
event := pl.Event{
|
||||||
|
Feature: "Delete",
|
||||||
|
Source: source,
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start log
|
||||||
|
pl.SetLogInfo(&event, input, "started", "delete")
|
||||||
|
|
||||||
|
err = dg.I.Transaction(func(tx *gorm.DB) error {
|
||||||
|
if !input.AuthInfo.IsDoctor() {
|
||||||
|
return errors.New("user is not a doctor")
|
||||||
|
}
|
||||||
|
|
||||||
|
pl.SetLogInfo(&event, rdDto, "started", "DBReadDetail")
|
||||||
|
if data, err = ReadDetailData(rdDto, &event, tx); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
mwRunner := newMiddlewareRunner(&event, tx)
|
||||||
|
mwRunner.setMwType(pu.MWTPre)
|
||||||
|
// Run pre-middleware
|
||||||
|
if err := mwRunner.RunDeleteMiddleware(readDetailPreMw, &rdDto, data); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := DeleteData(data, &event, tx); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
mwRunner.setMwType(pu.MWTPost)
|
||||||
|
// Run post-middleware
|
||||||
|
if err := mwRunner.RunDeleteMiddleware(readDetailPostMw, &rdDto, data); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return &d.Data{
|
||||||
|
Meta: d.IS{
|
||||||
|
"source": source,
|
||||||
|
"structure": "single-data",
|
||||||
|
"status": "deleted",
|
||||||
|
},
|
||||||
|
Data: data.ToResponse(),
|
||||||
|
}, nil
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func UpdateStatusCode(input e.UpdateDto) (*d.Data, error) {
|
||||||
|
rdDto := e.ReadDetailDto{Id: input.Id}
|
||||||
|
var data *e.KFR
|
||||||
|
var err error
|
||||||
|
|
||||||
|
event := pl.Event{
|
||||||
|
Feature: "UpdateStatusCode",
|
||||||
|
Source: source,
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start log
|
||||||
|
pl.SetLogInfo(&event, input, "started", "updateStatusCode")
|
||||||
|
|
||||||
|
err = dg.I.Transaction(func(tx *gorm.DB) error {
|
||||||
|
if !input.AuthInfo.IsDoctor() {
|
||||||
|
return errors.New("user is not a doctor")
|
||||||
|
}
|
||||||
|
|
||||||
|
pl.SetLogInfo(&event, rdDto, "started", "DBReadDetail")
|
||||||
|
if data, err = ReadDetailData(rdDto, &event, tx); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
enc, err := ue.ReadDetailData(ee.ReadDetailDto{Id: *data.Encounter_Id}, &event, tx)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// check if encounter is done
|
||||||
|
if enc.IsDone() {
|
||||||
|
return errors.New("encounter is already done")
|
||||||
|
}
|
||||||
|
|
||||||
|
switch input.Status_Code {
|
||||||
|
case erc.DVCValidated:
|
||||||
|
if data.IsNew() {
|
||||||
|
return errors.New("resume need to be verified first")
|
||||||
|
}
|
||||||
|
if data.IsValidated() {
|
||||||
|
return errors.New("resume already validated")
|
||||||
|
}
|
||||||
|
if !enc.IsSameResponsibleDoctor(input.AuthInfo.Doctor_Code) {
|
||||||
|
return errors.New("validation doctor is not the same as encounter responsible doctor")
|
||||||
|
}
|
||||||
|
|
||||||
|
data.Status_Code = erc.DVCValidated
|
||||||
|
err = tx.Save(&data).Error
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
case erc.DVCVerified:
|
||||||
|
if data.IsValidated() {
|
||||||
|
return errors.New("resume already validated")
|
||||||
|
}
|
||||||
|
if data.IsVerified() {
|
||||||
|
return errors.New("resume already verified")
|
||||||
|
}
|
||||||
|
data.Status_Code = erc.DVCVerified
|
||||||
|
err = tx.Save(&data).Error
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return &d.Data{
|
||||||
|
Meta: d.IS{
|
||||||
|
"source": source,
|
||||||
|
"structure": "single-data",
|
||||||
|
"status": "updated",
|
||||||
|
},
|
||||||
|
Data: data.ToResponse(),
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
/*
|
||||||
|
DESCRIPTION:
|
||||||
|
Any functions that are used internally by the use-case
|
||||||
|
*/
|
||||||
|
package kfr
|
||||||
|
|
||||||
|
import (
|
||||||
|
e "simrs-vx/internal/domain/main-entities/kfr"
|
||||||
|
|
||||||
|
erc "simrs-vx/internal/domain/references/common"
|
||||||
|
)
|
||||||
|
|
||||||
|
func setData[T *e.CreateDto | *e.UpdateDto](input T, data *e.KFR) {
|
||||||
|
var inputSrc *e.CreateDto
|
||||||
|
if inputT, ok := any(input).(*e.CreateDto); ok {
|
||||||
|
inputSrc = inputT
|
||||||
|
data.Status_Code = erc.DVCNew
|
||||||
|
} else {
|
||||||
|
inputTemp := any(input).(*e.UpdateDto)
|
||||||
|
inputSrc = &inputTemp.CreateDto
|
||||||
|
}
|
||||||
|
|
||||||
|
data.Encounter_Id = inputSrc.Encounter_Id
|
||||||
|
data.CreatedBy_Employee_Id = inputSrc.CreatedBy_Employee_Id
|
||||||
|
data.Type = inputSrc.Type
|
||||||
|
data.Subjective = inputSrc.Subjective
|
||||||
|
data.Objective = inputSrc.Objective
|
||||||
|
data.Assessment = inputSrc.Assessment
|
||||||
|
data.TreatmentGoals = inputSrc.TreatmentGoals
|
||||||
|
data.Education = inputSrc.Education
|
||||||
|
data.Action = inputSrc.Action
|
||||||
|
data.Frequency = inputSrc.Frequency
|
||||||
|
data.IntervalUnit_Code = inputSrc.IntervalUnit_Code
|
||||||
|
data.FollowUpType = inputSrc.FollowUpType
|
||||||
|
data.FollowUpNote = inputSrc.FollowUpNote
|
||||||
|
}
|
||||||
@@ -0,0 +1,140 @@
|
|||||||
|
package kfr
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
e "simrs-vx/internal/domain/main-entities/kfr"
|
||||||
|
plh "simrs-vx/pkg/lib-helper"
|
||||||
|
pl "simrs-vx/pkg/logger"
|
||||||
|
pu "simrs-vx/pkg/use-case-helper"
|
||||||
|
|
||||||
|
dg "github.com/karincake/apem/db-gorm-pg"
|
||||||
|
gh "github.com/karincake/getuk"
|
||||||
|
"gorm.io/gorm"
|
||||||
|
)
|
||||||
|
|
||||||
|
func CreateData(input e.CreateDto, event *pl.Event, dbx ...*gorm.DB) (*e.KFR, error) {
|
||||||
|
pl.SetLogInfo(event, nil, "started", "DBCreate")
|
||||||
|
|
||||||
|
data := e.KFR{}
|
||||||
|
setData(&input, &data)
|
||||||
|
|
||||||
|
var tx *gorm.DB
|
||||||
|
if len(dbx) > 0 {
|
||||||
|
tx = dbx[0]
|
||||||
|
} else {
|
||||||
|
tx = dg.I
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := tx.Create(&data).Error; err != nil {
|
||||||
|
return nil, plh.HandleCreateError(input, event, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
pl.SetLogInfo(event, nil, "complete")
|
||||||
|
return &data, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func ReadListData(input e.ReadListDto, event *pl.Event, dbx ...*gorm.DB) ([]e.KFR, *e.MetaDto, error) {
|
||||||
|
pl.SetLogInfo(event, input, "started", "DBReadList")
|
||||||
|
data := []e.KFR{}
|
||||||
|
pagination := gh.Pagination{}
|
||||||
|
count := int64(0)
|
||||||
|
meta := e.MetaDto{}
|
||||||
|
|
||||||
|
var tx *gorm.DB
|
||||||
|
if len(dbx) > 0 {
|
||||||
|
tx = dbx[0]
|
||||||
|
} else {
|
||||||
|
tx = dg.I
|
||||||
|
}
|
||||||
|
|
||||||
|
tx = tx.
|
||||||
|
Model(&e.KFR{}).
|
||||||
|
Scopes(gh.Preload(input.Includes)).
|
||||||
|
Scopes(gh.Filter(input.FilterDto)).
|
||||||
|
Count(&count).
|
||||||
|
Scopes(gh.Paginate(input, &pagination)).
|
||||||
|
Order("\"CreatedAt\" DESC")
|
||||||
|
|
||||||
|
if err := tx.Find(&data).Error; err != nil {
|
||||||
|
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||||
|
return nil, &meta, nil
|
||||||
|
}
|
||||||
|
return nil, nil, plh.HandleListError(input, event, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
meta.Count = int(count)
|
||||||
|
meta.PageNumber = pagination.PageNumber
|
||||||
|
meta.PageSize = pagination.PageSize
|
||||||
|
|
||||||
|
pl.SetLogInfo(event, nil, "complete")
|
||||||
|
return data, &meta, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func ReadDetailData(input e.ReadDetailDto, event *pl.Event, dbx ...*gorm.DB) (*e.KFR, error) {
|
||||||
|
pl.SetLogInfo(event, input, "started", "DBReadDetail")
|
||||||
|
data := e.KFR{}
|
||||||
|
|
||||||
|
var tx *gorm.DB
|
||||||
|
if len(dbx) > 0 {
|
||||||
|
tx = dbx[0]
|
||||||
|
} else {
|
||||||
|
tx = dg.I
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := tx.Scopes(gh.Preload(input.Includes)).First(&data, input.Id).Error; err != nil {
|
||||||
|
if processedErr := pu.HandleReadError(err, event, source, input.Id, data); processedErr != nil {
|
||||||
|
return nil, processedErr
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pl.SetLogInfo(event, nil, "complete")
|
||||||
|
return &data, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func UpdateData(input e.UpdateDto, data *e.KFR, event *pl.Event, dbx ...*gorm.DB) error {
|
||||||
|
pl.SetLogInfo(event, data, "started", "DBUpdate")
|
||||||
|
setData(&input, data)
|
||||||
|
|
||||||
|
var tx *gorm.DB
|
||||||
|
if len(dbx) > 0 {
|
||||||
|
tx = dbx[0]
|
||||||
|
} else {
|
||||||
|
tx = dg.I
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := tx.Save(&data).Error; err != nil {
|
||||||
|
event.Status = "failed"
|
||||||
|
event.ErrInfo = pl.ErrorInfo{
|
||||||
|
Code: "data-update-fail",
|
||||||
|
Detail: "Database update failed",
|
||||||
|
Raw: err,
|
||||||
|
}
|
||||||
|
return pl.SetLogError(event, input)
|
||||||
|
}
|
||||||
|
|
||||||
|
pl.SetLogInfo(event, nil, "complete")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func DeleteData(data *e.KFR, event *pl.Event, dbx ...*gorm.DB) error {
|
||||||
|
pl.SetLogInfo(event, data, "started", "DBDelete")
|
||||||
|
var tx *gorm.DB
|
||||||
|
if len(dbx) > 0 {
|
||||||
|
tx = dbx[0]
|
||||||
|
} else {
|
||||||
|
tx = dg.I
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := tx.Delete(&data).Error; err != nil {
|
||||||
|
event.Status = "failed"
|
||||||
|
event.ErrInfo = pl.ErrorInfo{
|
||||||
|
Code: "data-delete-fail",
|
||||||
|
Detail: "Database delete failed",
|
||||||
|
Raw: err,
|
||||||
|
}
|
||||||
|
return pl.SetLogError(event, data)
|
||||||
|
}
|
||||||
|
|
||||||
|
pl.SetLogInfo(event, nil, "complete")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
Loaded 100 of 130 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in New Issue
Block a user