Merge branch 'migration-vanilia' of https://github.com/dikstub-rssa/simrs-be into feat/improve-uploads-154
# Conflicts: # internal/use-case/main-use-case/authentication/case.go
This commit is contained in:
@@ -1,17 +0,0 @@
|
||||
-- Create "FileAttachment" table
|
||||
CREATE TABLE "public"."FileAttachment" (
|
||||
"Id" bigserial NOT NULL,
|
||||
"CreatedAt" timestamptz NULL,
|
||||
"UpdatedAt" timestamptz NULL,
|
||||
"DeletedAt" timestamptz NULL,
|
||||
"EntityType_Code" text NULL,
|
||||
"Ref_Id" bigint NULL,
|
||||
"Type_Code" text NULL,
|
||||
"Name" text NULL,
|
||||
"FilePath" text NULL,
|
||||
"FileName" text NULL,
|
||||
"Upload_Employee_Id" bigint NULL,
|
||||
PRIMARY KEY ("Id"),
|
||||
CONSTRAINT "fk_Encounter_FileAttachments" FOREIGN KEY ("Ref_Id") REFERENCES "public"."Encounter" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION,
|
||||
CONSTRAINT "fk_FileAttachment_Upload_Employee" FOREIGN KEY ("Upload_Employee_Id") REFERENCES "public"."Employee" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION
|
||||
);
|
||||
@@ -0,0 +1,12 @@
|
||||
-- Drop index "idx_order_src" from table: "McuOrderItem"
|
||||
DROP INDEX "public"."idx_order_src";
|
||||
-- Modify "McuOrderItem" table
|
||||
ALTER TABLE "public"."McuOrderItem" ADD COLUMN "McuSrc_Code" text NULL;
|
||||
-- Create index "idx_order_src" to table: "McuOrderItem"
|
||||
CREATE UNIQUE INDEX "idx_order_src" ON "public"."McuOrderItem" ("McuOrder_Id", "McuSrc_Id", "McuSrc_Code");
|
||||
-- Drop index "idx_order_sub_src" from table: "McuOrderSubItem"
|
||||
DROP INDEX "public"."idx_order_sub_src";
|
||||
-- Modify "McuOrderSubItem" table
|
||||
ALTER TABLE "public"."McuOrderSubItem" ADD COLUMN "McuSubSrc_Code" text NULL;
|
||||
-- Create index "idx_order_sub_src" to table: "McuOrderSubItem"
|
||||
CREATE UNIQUE INDEX "idx_order_sub_src" ON "public"."McuOrderSubItem" ("McuSubSrc_Id", "McuSubSrc_Code", "McuOrderItem_Id");
|
||||
@@ -0,0 +1,12 @@
|
||||
-- Drop index "idx_order_src" from table: "McuOrderItem"
|
||||
DROP INDEX "public"."idx_order_src";
|
||||
-- Modify "McuOrderItem" table
|
||||
ALTER TABLE "public"."McuOrderItem" DROP CONSTRAINT "fk_McuOrderItem_McuSrc", DROP COLUMN "McuSrc_Id", ALTER COLUMN "McuSrc_Code" TYPE character varying(20), ADD CONSTRAINT "fk_McuOrderItem_McuSrc" FOREIGN KEY ("McuSrc_Code") REFERENCES "public"."McuSrc" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION;
|
||||
-- Create index "idx_order_src" to table: "McuOrderItem"
|
||||
CREATE UNIQUE INDEX "idx_order_src" ON "public"."McuOrderItem" ("McuOrder_Id", "McuSrc_Code");
|
||||
-- Drop index "idx_order_sub_src" from table: "McuOrderSubItem"
|
||||
DROP INDEX "public"."idx_order_sub_src";
|
||||
-- Modify "McuOrderSubItem" table
|
||||
ALTER TABLE "public"."McuOrderSubItem" DROP CONSTRAINT "fk_McuOrderSubItem_McuSubSrc", DROP COLUMN "McuSubSrc_Id", ALTER COLUMN "McuSubSrc_Code" TYPE character varying(20), ADD CONSTRAINT "fk_McuOrderSubItem_McuSubSrc" FOREIGN KEY ("McuSubSrc_Code") REFERENCES "public"."McuSubSrc" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION;
|
||||
-- Create index "idx_order_sub_src" to table: "McuOrderSubItem"
|
||||
CREATE UNIQUE INDEX "idx_order_sub_src" ON "public"."McuOrderSubItem" ("McuSubSrc_Code", "McuOrderItem_Id");
|
||||
@@ -0,0 +1,2 @@
|
||||
-- Modify "Medicine" table
|
||||
ALTER TABLE "public"."Medicine" DROP CONSTRAINT "fk_Medicine_Infra", DROP CONSTRAINT "fk_Medicine_Item", DROP COLUMN "Infra_Id", DROP COLUMN "Item_Id", ADD CONSTRAINT "fk_Medicine_Infra" FOREIGN KEY ("Infra_Code") REFERENCES "public"."Infra" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION, ADD CONSTRAINT "fk_Medicine_Item" FOREIGN KEY ("Item_Code") REFERENCES "public"."Item" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION;
|
||||
@@ -0,0 +1,10 @@
|
||||
-- Modify "Medication" table
|
||||
ALTER TABLE "public"."Medication" ADD COLUMN "Pharmacist_Code" text NULL;
|
||||
-- Modify "MedicationItem" table
|
||||
ALTER TABLE "public"."MedicationItem" ADD COLUMN "Medicine_Code" text NULL;
|
||||
-- Modify "MedicationItemDist" table
|
||||
ALTER TABLE "public"."MedicationItemDist" ADD COLUMN "Nurse_Code" text NULL;
|
||||
-- Modify "MedicineMixItem" table
|
||||
ALTER TABLE "public"."MedicineMixItem" ADD COLUMN "Medicine_Code" text NULL;
|
||||
-- Modify "PrescriptionItem" table
|
||||
ALTER TABLE "public"."PrescriptionItem" ADD COLUMN "Medicine_Code" text NULL;
|
||||
@@ -0,0 +1,10 @@
|
||||
-- Modify "Medication" table
|
||||
ALTER TABLE "public"."Medication" DROP CONSTRAINT "fk_Medication_Pharmacist", DROP COLUMN "Pharmacist_Id", ALTER COLUMN "Pharmacist_Code" TYPE character varying(20), ADD CONSTRAINT "fk_Medication_Pharmacist" FOREIGN KEY ("Pharmacist_Code") REFERENCES "public"."Pharmacist" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION;
|
||||
-- Modify "MedicationItem" table
|
||||
ALTER TABLE "public"."MedicationItem" DROP CONSTRAINT "fk_MedicationItem_Medicine", DROP COLUMN "Medicine_Id", ALTER COLUMN "Medicine_Code" TYPE character varying(10), ADD CONSTRAINT "fk_MedicationItem_Medicine" FOREIGN KEY ("Medicine_Code") REFERENCES "public"."Medicine" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION;
|
||||
-- Modify "MedicationItemDist" table
|
||||
ALTER TABLE "public"."MedicationItemDist" DROP CONSTRAINT "fk_MedicationItemDist_Nurse", DROP COLUMN "Nurse_Id", ALTER COLUMN "Nurse_Code" TYPE character varying(20), ADD CONSTRAINT "fk_MedicationItemDist_Nurse" FOREIGN KEY ("Nurse_Code") REFERENCES "public"."Nurse" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION;
|
||||
-- Modify "MedicineMixItem" table
|
||||
ALTER TABLE "public"."MedicineMixItem" DROP CONSTRAINT "fk_MedicineMixItem_Medicine", DROP COLUMN "Medicine_Id", ALTER COLUMN "Medicine_Code" TYPE character varying(10), ADD CONSTRAINT "fk_MedicineMixItem_Medicine" FOREIGN KEY ("Medicine_Code") REFERENCES "public"."Medicine" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION;
|
||||
-- Modify "PrescriptionItem" table
|
||||
ALTER TABLE "public"."PrescriptionItem" DROP CONSTRAINT "fk_PrescriptionItem_Medicine", DROP COLUMN "Medicine_Id", ALTER COLUMN "Medicine_Code" TYPE character varying(10), ADD CONSTRAINT "fk_PrescriptionItem_Medicine" FOREIGN KEY ("Medicine_Code") REFERENCES "public"."Medicine" ("Code") ON UPDATE NO ACTION ON DELETE NO ACTION;
|
||||
@@ -1,2 +0,0 @@
|
||||
-- Modify "FileAttachment" table
|
||||
ALTER TABLE "public"."FileAttachment" DROP CONSTRAINT "fk_Encounter_FileAttachments";
|
||||
@@ -0,0 +1,16 @@
|
||||
-- Create "EncounterDocument" table
|
||||
CREATE TABLE "public"."EncounterDocument" (
|
||||
"Id" bigserial NOT NULL,
|
||||
"CreatedAt" timestamptz NULL,
|
||||
"UpdatedAt" timestamptz NULL,
|
||||
"DeletedAt" timestamptz NULL,
|
||||
"Encounter_Id" bigint NULL,
|
||||
"Type_Code" text NULL,
|
||||
"Name" text NULL,
|
||||
"FilePath" text NULL,
|
||||
"FileName" text NULL,
|
||||
"Upload_Employee_Id" bigint NULL,
|
||||
PRIMARY KEY ("Id"),
|
||||
CONSTRAINT "fk_EncounterDocument_Upload_Employee" FOREIGN KEY ("Upload_Employee_Id") REFERENCES "public"."Employee" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION,
|
||||
CONSTRAINT "fk_Encounter_EncounterDocuments" FOREIGN KEY ("Encounter_Id") REFERENCES "public"."Encounter" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION
|
||||
);
|
||||
@@ -1,4 +1,4 @@
|
||||
h1:bPQtdFQustm+bzfbxrIgoD7sYhMS7+D4qaSmiyN6LUA=
|
||||
h1:G7XwMRXjqZGaTeOozryI7WRd+FUJqE+DYsSfura7viU=
|
||||
20250904105930.sql h1:MEM6blCgke9DzWQSTnLzasbPIrcHssNNrJqZpSkEo6k=
|
||||
20250904141448.sql h1:J8cmYNk4ZrG9fhfbi2Z1IWz7YkfvhFqTzrLFo58BPY0=
|
||||
20250908062237.sql h1:Pu23yEW/aKkwozHoOuROvHS/GK4ngARJGdO7FB7HZuI=
|
||||
@@ -108,5 +108,9 @@ h1:bPQtdFQustm+bzfbxrIgoD7sYhMS7+D4qaSmiyN6LUA=
|
||||
20251110093522.sql h1:nsz8jCxGjEdr/bz9g+4ozfZzIP803xONjVmucad1GMc=
|
||||
20251110100258.sql h1:IBqt1VZj5WjQ+l9aAFGHOCCBtzb03KlLLihFLut7itg=
|
||||
20251110100545.sql h1:6/LV7751iyKxE2xI6vO1zly+aHUwxXD/IBwLcVpKxqM=
|
||||
20251111040358.sql h1:c/RQSoA8yZl7cAcOv7n1RchmudPj7LdL3PEBdNvCUrA=
|
||||
20251111085815.sql h1:zY86Sl4p7yLEHvn9oJTjsK+yo5HfF4LsPa+uRHzsAeU=
|
||||
20251111072601.sql h1:dEhwrkT0hJ06/YcvQd5alvdskimcHcYT27QKAzVY5+8=
|
||||
20251111073546.sql h1:JnJZ4SdOObSe6Jf8v/i/KiRxoCz5KMeXCYytQMZgkZM=
|
||||
20251111074148.sql h1:95Ui1eo1P68itOz5kZDNFi2ha0ZhUF4gMYiYVcip6fo=
|
||||
20251111074652.sql h1:vUZbN0qgktRQ2GAlCpdYrbld2grPiSbvcMePEQMfxPs=
|
||||
20251111082257.sql h1:Zr3Xg5n+p4C8F6Evqm5PVC0pqUvPTBcq692PiUEJlT8=
|
||||
20251111111017.sql h1:RNLwrUNguAy/m2h3oYwMd5VuL1juRJMS1Taqujvye08=
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package encounter_document
|
||||
|
||||
import (
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
ee "simrs-vx/internal/domain/main-entities/employee"
|
||||
eru "simrs-vx/internal/domain/references/upload"
|
||||
)
|
||||
|
||||
type EncounterDocument struct {
|
||||
ecore.Main
|
||||
Encounter_Id *uint `json:"encounter_id"`
|
||||
Type_Code eru.UploadCode `json:"type_code"`
|
||||
Name string `json:"name"`
|
||||
FilePath *string `json:"filePath"`
|
||||
FileName *string `json:"fileName"`
|
||||
Upload_Employee_Id *uint `json:"upload_employee_id"`
|
||||
Upload_Employee *ee.Employee `json:"upload_employee,omitempty" gorm:"foreignKey:Upload_Employee_Id;references:Id"`
|
||||
}
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
ed "simrs-vx/internal/domain/main-entities/doctor"
|
||||
eem "simrs-vx/internal/domain/main-entities/emergency"
|
||||
ee "simrs-vx/internal/domain/main-entities/employee"
|
||||
eed "simrs-vx/internal/domain/main-entities/encounter-document"
|
||||
eip "simrs-vx/internal/domain/main-entities/inpatient"
|
||||
ei "simrs-vx/internal/domain/main-entities/insurance-company"
|
||||
eir "simrs-vx/internal/domain/main-entities/internal-reference"
|
||||
@@ -70,6 +71,7 @@ type Encounter struct {
|
||||
Inpatient *eip.Inpatient `json:"inpatient,omitempty" gorm:"foreignKey:Encounter_Id;references:Id"`
|
||||
Rehab *er.Basic `json:"rehab,omitempty" gorm:"foreignKey:Encounter_Id;references:Id"`
|
||||
RehabChildren *[]er.Basic `json:"rehabChildren,omitempty" gorm:"foreignKey:Parent_Encounter_Id;references:Id"`
|
||||
EncounterDocuments *[]eed.EncounterDocument `json:"encounterDocuments,omitempty" gorm:"foreignKey:Encounter_Id;references:Id"`
|
||||
}
|
||||
|
||||
func (d Encounter) IsDone() bool {
|
||||
|
||||
@@ -5,8 +5,8 @@ import (
|
||||
)
|
||||
|
||||
type CreateDto struct {
|
||||
Code string `json:"code" validate:"maxLength=20"`
|
||||
Name string `json:"name" validate:"maxLength=50"`
|
||||
Code *string `json:"code" validate:"maxLength=20"`
|
||||
Name string `json:"name" validate:"maxLength=50"`
|
||||
}
|
||||
|
||||
type ReadListDto struct {
|
||||
@@ -23,17 +23,18 @@ type FilterDto struct {
|
||||
}
|
||||
|
||||
type ReadDetailDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
Id *uint16 `json:"id"`
|
||||
Code *string `json:"code"`
|
||||
}
|
||||
|
||||
type UpdateDto struct {
|
||||
Id uint `json:"id"`
|
||||
Id *uint `json:"id"`
|
||||
CreateDto
|
||||
}
|
||||
|
||||
type DeleteDto struct {
|
||||
Id uint `json:"id"`
|
||||
Id *uint `json:"id"`
|
||||
Code *string `json:"code"`
|
||||
}
|
||||
|
||||
type MetaDto struct {
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
package file_attachment
|
||||
|
||||
import (
|
||||
ecore "simrs-vx/internal/domain/base-entities/core"
|
||||
ee "simrs-vx/internal/domain/main-entities/employee"
|
||||
eru "simrs-vx/internal/domain/references/upload"
|
||||
)
|
||||
|
||||
type FileAttachment struct {
|
||||
ecore.Main
|
||||
EntityType_Code eru.EntityTypeCode `json:"entityType_code"`
|
||||
Ref_Id *uint `json:"ref_id"`
|
||||
Type_Code eru.UploadCode `json:"type_code"`
|
||||
Name string `json:"name"`
|
||||
FilePath *string `json:"filePath"`
|
||||
FileName *string `json:"fileName"`
|
||||
Upload_Employee_Id *uint `json:"upload_employee_id"`
|
||||
Upload_Employee *ee.Employee `json:"upload_employee,omitempty" gorm:"foreignKey:Upload_Employee_Id;references:Id"`
|
||||
}
|
||||
@@ -5,8 +5,8 @@ import (
|
||||
)
|
||||
|
||||
type CreateDto struct {
|
||||
Code string `json:"code" validate:"maxLength=10"`
|
||||
Name string `json:"name" validate:"maxLength=50"`
|
||||
Code *string `json:"code" validate:"maxLength=10"`
|
||||
Name string `json:"name" validate:"maxLength=50"`
|
||||
}
|
||||
|
||||
type ReadListDto struct {
|
||||
@@ -23,18 +23,19 @@ type FilterDto struct {
|
||||
}
|
||||
|
||||
type ReadDetailDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
Code string `json:"code"`
|
||||
Name string `json:"name"`
|
||||
Id *uint16 `json:"id"`
|
||||
Code *string `json:"code"`
|
||||
Name *string `json:"name"`
|
||||
}
|
||||
|
||||
type UpdateDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
Id *uint16 `json:"id"`
|
||||
CreateDto
|
||||
}
|
||||
|
||||
type DeleteDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
Id *uint16 `json:"id"`
|
||||
Code *string `json:"code"`
|
||||
}
|
||||
|
||||
type MetaDto struct {
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
|
||||
type CreateDto struct {
|
||||
McuOrder_Id *uint `json:"mcuOrder_id"`
|
||||
McuSrc_Id *uint `json:"mcuSrc_id"`
|
||||
McuSrc_Code *string `json:"mcuSrc_code"`
|
||||
Result *string `json:"result"`
|
||||
Status_Code erc.DataStatusCode `json:"status_code"`
|
||||
ExaminationDate *time.Time `json:"examinationDate"`
|
||||
@@ -24,7 +24,7 @@ type ReadListDto struct {
|
||||
|
||||
type FilterDto struct {
|
||||
McuOrder_Id *uint `json:"mcu-order-id"`
|
||||
McuSrc_Id *uint `json:"mcu-src-id"`
|
||||
McuSrc_Code *string `json:"mcu-src-code"`
|
||||
Result *string `json:"result"`
|
||||
Status_Code erc.DataStatusCode `json:"status-code"`
|
||||
}
|
||||
@@ -56,7 +56,7 @@ type ResponseDto struct {
|
||||
ecore.Main
|
||||
McuOrder_Id *uint `json:"mcuOrder_id"`
|
||||
McuOrder *emo.McuOrder `json:"mcuOrder,omitempty"`
|
||||
McuSrc_Id *uint `json:"mcuSrc_id"`
|
||||
McuSrc_Code *string `json:"mcuSrc_code"`
|
||||
McuSrc *ems.McuSrc `json:"mcuSrc,omitempty"`
|
||||
Result *string `json:"result"`
|
||||
Status_Code erc.DataStatusCode `json:"status_code"`
|
||||
@@ -67,7 +67,7 @@ func (d McuOrderItem) ToResponse() ResponseDto {
|
||||
resp := ResponseDto{
|
||||
McuOrder_Id: d.McuOrder_Id,
|
||||
McuOrder: d.McuOrder,
|
||||
McuSrc_Id: d.McuSrc_Id,
|
||||
McuSrc_Code: d.McuSrc_Code,
|
||||
McuSrc: d.McuSrc,
|
||||
Result: d.Result,
|
||||
Status_Code: d.Status_Code,
|
||||
|
||||
@@ -13,8 +13,8 @@ type McuOrderItem struct {
|
||||
ecore.Main // adjust this according to the needs
|
||||
McuOrder_Id *uint `json:"mcuOrder_id" gorm:"uniqueIndex:idx_order_src"`
|
||||
McuOrder *emo.McuOrder `json:"mcuOrder,omitempty" gorm:"foreignKey:McuOrder_Id;references:Id"`
|
||||
McuSrc_Id *uint `json:"mcuSrc_id" gorm:"uniqueIndex:idx_order_src"`
|
||||
McuSrc *ems.McuSrc `json:"mcuSrc,omitempty" gorm:"foreignKey:McuSrc_Id;references:Id"`
|
||||
McuSrc_Code *string `json:"mcuSrc_code" gorm:"uniqueIndex:idx_order_src"`
|
||||
McuSrc *ems.McuSrc `json:"mcuSrc,omitempty" gorm:"foreignKey:McuSrc_Code;references:Code"`
|
||||
ExaminationDate *time.Time `json:"examinationDate"`
|
||||
Result *string `json:"result"`
|
||||
Status_Code erc.DataStatusCode `json:"status_code"`
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
)
|
||||
|
||||
type CreateDto struct {
|
||||
McuSubSrc_Id *uint `json:"mcuSubSrc_id"`
|
||||
McuSubSrc_Code *string `json:"mcuSubSrc_code"`
|
||||
McuOrderItem_Id *uint `json:"mcuOrderItem_id"`
|
||||
Result *string `json:"result"`
|
||||
Status_Code erc.DataStatusCode `json:"status_code"`
|
||||
@@ -22,7 +22,7 @@ type ReadListDto struct {
|
||||
|
||||
type FilterDto struct {
|
||||
McuOrder_Id *uint `json:"mcuOrder-id"`
|
||||
McuSrc_Id *uint `json:"mcuSrc-id"`
|
||||
McuSrc_Code *string `json:"mcuSrc-code"`
|
||||
Result *string `json:"result"`
|
||||
Status_Code erc.DataStatusCode `json:"status-code"`
|
||||
}
|
||||
@@ -47,7 +47,7 @@ type MetaDto struct {
|
||||
|
||||
type ResponseDto struct {
|
||||
ecore.Main
|
||||
McuSubSrc_Id *uint `json:"mcuSubSrc_id"`
|
||||
McuSubSrc_Code *string `json:"mcuSubSrc_code"`
|
||||
McuSubSrc *emss.McuSubSrc `json:"mcuSubSrc,omitempty"`
|
||||
McuOrderItem_Id *uint `json:"mcuOrderItem_id"`
|
||||
McuOrderItem *emoi.McuOrderItem `json:"mcuOrderItem,omitempty"`
|
||||
@@ -57,7 +57,7 @@ type ResponseDto struct {
|
||||
|
||||
func (d McuOrderSubItem) ToResponse() ResponseDto {
|
||||
resp := ResponseDto{
|
||||
McuSubSrc_Id: d.McuSubSrc_Id,
|
||||
McuSubSrc_Code: d.McuSubSrc_Code,
|
||||
McuSubSrc: d.McuSubSrc,
|
||||
McuOrderItem_Id: d.McuOrderItem_Id,
|
||||
McuOrderItem: d.McuOrderItem,
|
||||
|
||||
@@ -10,8 +10,8 @@ import (
|
||||
|
||||
type McuOrderSubItem struct {
|
||||
ecore.Main // adjust this according to the needs
|
||||
McuSubSrc_Id *uint `json:"mcuSubSrc_id" gorm:"uniqueIndex:idx_order_sub_src"`
|
||||
McuSubSrc *emss.McuSubSrc `json:"mcuSubSrc,omitempty" gorm:"foreignKey:McuSubSrc_Id;references:Id"`
|
||||
McuSubSrc_Code *string `json:"mcuSubSrc_code" gorm:"uniqueIndex:idx_order_sub_src"`
|
||||
McuSubSrc *emss.McuSubSrc `json:"mcuSubSrc,omitempty" gorm:"foreignKey:McuSubSrc_Code;references:Code"`
|
||||
McuOrderItem_Id *uint `json:"mcuOrderItem_id" gorm:"uniqueIndex:idx_order_sub_src"`
|
||||
McuOrderItem *emoi.McuOrderItem `json:"mcuOrderItem,omitempty" gorm:"foreignKey:McuOrderItem_Id;references:Id"`
|
||||
Result *string `json:"result"`
|
||||
|
||||
@@ -18,7 +18,7 @@ type CreateDto struct {
|
||||
MedicationItem_Id *uint `json:"medicationItem_id"`
|
||||
DateTime *time.Time `json:"dateTime"`
|
||||
Remain float64 `json:"remain"`
|
||||
Nurse_Id *uint `json:"nurse_id"`
|
||||
Nurse_Code *string `json:"nurse_code"`
|
||||
}
|
||||
|
||||
type ReadListDto struct {
|
||||
@@ -31,7 +31,7 @@ type FilterDto struct {
|
||||
MedicationItem_Id *uint `json:"medicationItem-id"`
|
||||
DateTime *time.Time `json:"dateTime"`
|
||||
Remain float64 `json:"remain"`
|
||||
Nurse_Id *uint `json:"nurse-id"`
|
||||
Nurse_Code *string `json:"nurse-code"`
|
||||
}
|
||||
type ReadDetailDto struct {
|
||||
Id uint16 `json:"id"`
|
||||
@@ -65,7 +65,7 @@ type ResponseDto struct {
|
||||
MedicationItem *emi.MedicationItem `json:"medicationItem,omitempty"`
|
||||
DateTime *time.Time `json:"dateTime"`
|
||||
Remain float64 `json:"remain"`
|
||||
Nurse_Id *uint `json:"nurse_id"`
|
||||
Nurse_Code *string `json:"nurse_code"`
|
||||
}
|
||||
|
||||
func (d MedicationItemDist) ToResponse() ResponseDto {
|
||||
@@ -74,7 +74,7 @@ func (d MedicationItemDist) ToResponse() ResponseDto {
|
||||
MedicationItem: d.MedicationItem,
|
||||
DateTime: d.DateTime,
|
||||
Remain: d.Remain,
|
||||
Nurse_Id: d.Nurse_Id,
|
||||
Nurse_Code: d.Nurse_Code,
|
||||
}
|
||||
resp.Main = d.Main
|
||||
return resp
|
||||
|
||||
@@ -14,6 +14,6 @@ type MedicationItemDist struct {
|
||||
MedicationItem *emi.MedicationItem `json:"medicationItem,omitempty" gorm:"foreignKey:MedicationItem_Id;references:Id"`
|
||||
DateTime *time.Time `json:"dateTime"`
|
||||
Remain float64 `json:"remain"`
|
||||
Nurse_Id *uint `json:"nurse_id"`
|
||||
Nurse *en.Nurse `json:"nurse,omitempty" gorm:"foreignKey:Nurse_Id;references:Id"`
|
||||
Nurse_Code *string `json:"nurse_code"`
|
||||
Nurse *en.Nurse `json:"nurse,omitempty" gorm:"foreignKey:Nurse_Code;references:Code"`
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import (
|
||||
type CreateDto struct {
|
||||
Medication_Id *uint `json:"medication_id"`
|
||||
IsMix bool `json:"isMix"`
|
||||
Medicine_Id *uint `json:"medicine_id"`
|
||||
Medicine_Code *string `json:"medicine_code"`
|
||||
MedicineMix_Id *uint `json:"medicineMix_id"`
|
||||
Frequency *uint16 `json:"frequency"`
|
||||
Dose float64 `json:"dose"`
|
||||
@@ -35,7 +35,7 @@ type ReadListDto struct {
|
||||
type FilterDto struct {
|
||||
Medication_Id *uint `json:"medication-id"`
|
||||
IsMix bool `json:"isMix"`
|
||||
Medicine_Id *uint `json:"medicine-id"`
|
||||
Medicine_Code *string `json:"medicine-code"`
|
||||
MedicineMix_Id *uint `json:"medicineMix-id"`
|
||||
Usage float64 `json:"usage"`
|
||||
Interval uint8 `json:"interval"`
|
||||
@@ -68,7 +68,7 @@ type ResponseDto struct {
|
||||
Medication_Id *uint `json:"medication_id"`
|
||||
Medication *eme.Medication `json:"medication,omitempty"`
|
||||
IsMix bool `json:"isMix"`
|
||||
Medicine_Id *uint `json:"medicine_id"`
|
||||
Medicine_Code *string `json:"medicine_code"`
|
||||
Medicine *em.Medicine `json:"medicine,omitempty"`
|
||||
MedicineMix_Id *uint `json:"medicineMix_id"`
|
||||
MedicineMix *emm.MedicineMix `json:"medicineMix,omitempty"`
|
||||
@@ -85,7 +85,7 @@ func (d MedicationItem) ToResponse() ResponseDto {
|
||||
Medication_Id: d.Medication_Id,
|
||||
Medication: d.Medication,
|
||||
IsMix: d.IsMix,
|
||||
Medicine_Id: d.Medicine_Id,
|
||||
Medicine_Code: d.Medicine_Code,
|
||||
Medicine: d.Medicine,
|
||||
MedicineMix_Id: d.MedicineMix_Id,
|
||||
MedicineMix: d.MedicineMix,
|
||||
|
||||
@@ -14,8 +14,8 @@ type MedicationItem struct {
|
||||
Medication_Id *uint `json:"medication_id"`
|
||||
Medication *eme.Medication `json:"medication,omitempty" gorm:"foreignKey:Medication_Id;references:Id"`
|
||||
IsMix bool `json:"isMix"`
|
||||
Medicine_Id *uint `json:"medicine_id"`
|
||||
Medicine *em.Medicine `json:"medicine,omitempty" gorm:"foreignKey:Medicine_Id;references:Id"`
|
||||
Medicine_Code *string `json:"medicine_code"`
|
||||
Medicine *em.Medicine `json:"medicine,omitempty" gorm:"foreignKey:Medicine_Code;references:Code"`
|
||||
MedicineMix_Id *uint `json:"medicineMix_id"`
|
||||
MedicineMix *emm.MedicineMix `json:"medicineMix,omitempty" gorm:"foreignKey:MedicineMix_Id;references:Id"`
|
||||
Frequency *uint16 `json:"frequency"`
|
||||
|
||||
@@ -19,10 +19,10 @@ import (
|
||||
)
|
||||
|
||||
type CreateDto struct {
|
||||
Encounter_Id *uint `json:"encounter_id"`
|
||||
IssuedAt *time.Time `json:"issuedAt"`
|
||||
Pharmacist_Id *uint `json:"pharmacist_id"`
|
||||
Status_Code erc.DataStatusCode `json:"status_code"`
|
||||
Encounter_Id *uint `json:"encounter_id"`
|
||||
IssuedAt *time.Time `json:"issuedAt"`
|
||||
Pharmacist_Code *string `json:"pharmacist_code"`
|
||||
Status_Code erc.DataStatusCode `json:"status_code"`
|
||||
}
|
||||
|
||||
type ReadListDto struct {
|
||||
@@ -32,10 +32,10 @@ type ReadListDto struct {
|
||||
}
|
||||
|
||||
type FilterDto struct {
|
||||
Encounter_Id *uint `json:"encounter-id"`
|
||||
IssuedAt *time.Time `json:"issuedAt"`
|
||||
Pharmacist_Id *uint `json:"pharmacist-id"`
|
||||
Status_Code erc.DataStatusCode `json:"status-code"`
|
||||
Encounter_Id *uint `json:"encounter-id"`
|
||||
IssuedAt *time.Time `json:"issuedAt"`
|
||||
Pharmacist_Code *string `json:"pharmacist-code"`
|
||||
Status_Code erc.DataStatusCode `json:"status-code"`
|
||||
}
|
||||
type ReadDetailDto struct {
|
||||
Id uint `json:"id"`
|
||||
@@ -61,22 +61,22 @@ type MetaDto struct {
|
||||
|
||||
type ResponseDto struct {
|
||||
ecore.Main
|
||||
Encounter_Id *uint `json:"encounter_id"`
|
||||
Encounter *ee.Encounter `json:"encounter,omitempty"`
|
||||
IssuedAt *time.Time `json:"issuedAt"`
|
||||
Pharmacist_Id *uint `json:"pharmacist_id"`
|
||||
Pharmacist *ep.Pharmacist `json:"pharmacist,omitempty"`
|
||||
Status_Code erc.DataStatusCode `json:"status_code"`
|
||||
Encounter_Id *uint `json:"encounter_id"`
|
||||
Encounter *ee.Encounter `json:"encounter,omitempty"`
|
||||
IssuedAt *time.Time `json:"issuedAt"`
|
||||
Pharmacist_Code *string `json:"pharmacist_code"`
|
||||
Pharmacist *ep.Pharmacist `json:"pharmacist,omitempty"`
|
||||
Status_Code erc.DataStatusCode `json:"status_code"`
|
||||
}
|
||||
|
||||
func (d Medication) ToResponse() ResponseDto {
|
||||
resp := ResponseDto{
|
||||
Encounter_Id: d.Encounter_Id,
|
||||
Encounter: d.Encounter,
|
||||
IssuedAt: d.IssuedAt,
|
||||
Pharmacist_Id: d.Pharmacist_Id,
|
||||
Pharmacist: d.Pharmacist,
|
||||
Status_Code: d.Status_Code,
|
||||
Encounter_Id: d.Encounter_Id,
|
||||
Encounter: d.Encounter,
|
||||
IssuedAt: d.IssuedAt,
|
||||
Pharmacist_Code: d.Pharmacist_Code,
|
||||
Pharmacist: d.Pharmacist,
|
||||
Status_Code: d.Status_Code,
|
||||
}
|
||||
resp.Main = d.Main
|
||||
return resp
|
||||
|
||||
@@ -11,13 +11,13 @@ import (
|
||||
)
|
||||
|
||||
type Medication struct {
|
||||
ecore.Main // adjust this according to the needs
|
||||
Encounter_Id *uint `json:"encounter_id"`
|
||||
Encounter *ee.Encounter `json:"encounter,omitempty" gorm:"foreignKey:Encounter_Id;references:Id"`
|
||||
IssuedAt *time.Time `json:"issuedAt"`
|
||||
Pharmacist_Id *uint `json:"pharmacist_id"`
|
||||
Pharmacist *ep.Pharmacist `json:"pharmacist,omitempty" gorm:"foreignKey:Pharmacist_Id;references:Id"`
|
||||
Status_Code erc.DataStatusCode `json:"status_code"`
|
||||
ecore.Main // adjust this according to the needs
|
||||
Encounter_Id *uint `json:"encounter_id"`
|
||||
Encounter *ee.Encounter `json:"encounter,omitempty" gorm:"foreignKey:Encounter_Id;references:Id"`
|
||||
IssuedAt *time.Time `json:"issuedAt"`
|
||||
Pharmacist_Code *string `json:"pharmacist_code"`
|
||||
Pharmacist *ep.Pharmacist `json:"pharmacist,omitempty" gorm:"foreignKey:Pharmacist_Code;references:Code"`
|
||||
Status_Code erc.DataStatusCode `json:"status_code"`
|
||||
}
|
||||
|
||||
func (d Medication) IsCompleted() bool {
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
|
||||
type CreateDto struct {
|
||||
MedicineMix_Id *uint `json:"medicineMix_id"`
|
||||
Medicine_Id *uint `json:"medicine_id"`
|
||||
Medicine_Code *string `json:"medicine_code"`
|
||||
Dose *uint8 `json:"dose"`
|
||||
Note *string `json:"note" gom:"size:1024"`
|
||||
}
|
||||
@@ -20,7 +20,7 @@ type ReadListDto struct {
|
||||
|
||||
type FilterDto struct {
|
||||
MedicineMix_Id *uint `json:"medicineMix-id"`
|
||||
Medicine_Id *uint `json:"medicine-id"`
|
||||
Medicine_Code *string `json:"medicine-code"`
|
||||
Dose *uint8 `json:"dose"`
|
||||
Note *string `json:"note" gom:"size:1024"`
|
||||
}
|
||||
@@ -47,7 +47,7 @@ type MetaDto struct {
|
||||
type ResponseDto struct {
|
||||
ecore.Main
|
||||
MedicineMix_Id *uint `json:"medicineMix_id"`
|
||||
Medicine_Id *uint `json:"medicine_id"`
|
||||
Medicine_Code *string `json:"medicine_code"`
|
||||
Medicine *em.Medicine `json:"medicine,omitempty"`
|
||||
Dose *uint8 `json:"dose"`
|
||||
Note *string `json:"note" gom:"size:1024"`
|
||||
@@ -56,7 +56,7 @@ type ResponseDto struct {
|
||||
func (d MedicineMixItem) ToResponse() ResponseDto {
|
||||
resp := ResponseDto{
|
||||
MedicineMix_Id: d.MedicineMix_Id,
|
||||
Medicine_Id: d.Medicine_Id,
|
||||
Medicine_Code: d.Medicine_Code,
|
||||
Medicine: d.Medicine,
|
||||
Dose: d.Dose,
|
||||
Note: d.Note,
|
||||
|
||||
@@ -8,8 +8,8 @@ import (
|
||||
type MedicineMixItem struct {
|
||||
ecore.Main // adjust this according to the needs
|
||||
MedicineMix_Id *uint `json:"medicineMix_id"`
|
||||
Medicine_Id *uint `json:"medicine_id"`
|
||||
Medicine *em.Medicine `json:"medicine,omitempty" gorm:"foreignKey:Medicine_Id;references:Id"`
|
||||
Medicine_Code *string `json:"medicine_code"`
|
||||
Medicine *em.Medicine `json:"medicine,omitempty" gorm:"foreignKey:Medicine_Code;references:Code"`
|
||||
Dose *uint8 `json:"dose"`
|
||||
Note *string `json:"note" gom:"size:1024"`
|
||||
}
|
||||
|
||||
@@ -20,11 +20,9 @@ type Medicine struct {
|
||||
Uom_Code *string `json:"uom_code" gorm:"size:10"`
|
||||
Uom *eu.Uom `json:"uom" gorm:"foreignKey:Uom_Code;references:Code"`
|
||||
Dose uint8 `json:"dose"`
|
||||
Infra_Id *uint16 `json:"infra_id"`
|
||||
Infra_Code *string `json:"infra_code" gorm:"size:10"`
|
||||
Infra *ein.Infra `json:"infra,omitempty" gorm:"foreignKey:Infra_Id;references:Id"`
|
||||
Infra *ein.Infra `json:"infra,omitempty" gorm:"foreignKey:Infra_Code;references:Code"`
|
||||
Stock *int `json:"stock"`
|
||||
Item_Id *uint `json:"item_id"`
|
||||
Item_Code *string `json:"item_code" gorm:"size:50"`
|
||||
Item *eit.Item `json:"item,omitempty" gorm:"foreignKey:Item_Id;references:Id"`
|
||||
Item *eit.Item `json:"item,omitempty" gorm:"foreignKey:Item_Code;references:Code"`
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import (
|
||||
type CreateDto struct {
|
||||
Prescription_Id *uint `json:"prescription_id"`
|
||||
IsMix bool `json:"isMix"`
|
||||
Medicine_Id *uint `json:"medicine_id"`
|
||||
Medicine_Code *string `json:"medicine_code"`
|
||||
MedicineMix_Id *uint `json:"medicineMix_id"`
|
||||
Frequency *uint16 `json:"frequency" validate:"required"`
|
||||
Dose float64 `json:"dose" validate:"required"`
|
||||
@@ -32,7 +32,7 @@ type ReadListDto struct {
|
||||
type FilterDto struct {
|
||||
Prescription_Id *uint `json:"prescription-id"`
|
||||
IsMix bool `json:"isMix"`
|
||||
Medicine_Id *uint `json:"medicine-id"`
|
||||
Medicine_Code *string `json:"medicine-code"`
|
||||
MedicineMix_Id *uint `json:"medicineMix-id"`
|
||||
Usage float64 `json:"usage"`
|
||||
Interval uint8 `json:"interval"`
|
||||
@@ -63,7 +63,7 @@ type ResponseDto struct {
|
||||
Prescription_Id *uint `json:"prescription_id"`
|
||||
Prescription *ep.Prescription `json:"prescription,omitempty"`
|
||||
IsMix bool `json:"isMix"`
|
||||
Medicine_Id *uint `json:"medicine_id"`
|
||||
Medicine_Code *string `json:"medicine_code"`
|
||||
Medicine *em.Medicine `json:"medicine,omitempty"`
|
||||
MedicineMix_Id *uint `json:"medicineMix_id"`
|
||||
MedicineMix *emm.MedicineMix `json:"medicineMix,omitempty"`
|
||||
@@ -80,7 +80,7 @@ func (d PrescriptionItem) ToResponse() ResponseDto {
|
||||
Prescription_Id: d.Prescription_Id,
|
||||
Prescription: d.Prescription,
|
||||
IsMix: d.IsMix,
|
||||
Medicine_Id: d.Medicine_Id,
|
||||
Medicine_Code: d.Medicine_Code,
|
||||
Medicine: d.Medicine,
|
||||
MedicineMix_Id: d.MedicineMix_Id,
|
||||
MedicineMix: d.MedicineMix,
|
||||
|
||||
@@ -14,8 +14,8 @@ type PrescriptionItem struct {
|
||||
Prescription_Id *uint `json:"prescription_id"`
|
||||
Prescription *ep.Prescription `json:"prescription,omitempty" gorm:"foreignKey:Prescription_Id;references:Id"`
|
||||
IsMix bool `json:"isMix"`
|
||||
Medicine_Id *uint `json:"medicine_id"`
|
||||
Medicine *em.Medicine `json:"medicine,omitempty" gorm:"foreignKey:Medicine_Id;references:Id"`
|
||||
Medicine_Code *string `json:"medicine_code"`
|
||||
Medicine *em.Medicine `json:"medicine,omitempty" gorm:"foreignKey:Medicine_Code;references:Code"`
|
||||
MedicineMix_Id *uint `json:"medicineMix_id"`
|
||||
MedicineMix *emm.MedicineMix `json:"medicineMix,omitempty" gorm:"foreignKey:MedicineMix_Id;references:Id"`
|
||||
Frequency *uint16 `json:"frequency"`
|
||||
|
||||
@@ -33,19 +33,19 @@ func (obj myBase) GetList(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) {
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
code := rw.ValidateString(w, "code", r.PathValue("code"))
|
||||
if code == "" {
|
||||
return
|
||||
}
|
||||
dto := e.ReadDetailDto{}
|
||||
dto.Id = uint16(id)
|
||||
dto.Code = &code
|
||||
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 {
|
||||
code := rw.ValidateString(w, "code", r.PathValue("code"))
|
||||
if code == "" {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -53,19 +53,19 @@ func (obj myBase) Update(w http.ResponseWriter, r *http.Request) {
|
||||
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
|
||||
return
|
||||
}
|
||||
dto.Id = uint(id)
|
||||
dto.Code = &code
|
||||
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 {
|
||||
code := rw.ValidateString(w, "code", r.PathValue("code"))
|
||||
if code == "" {
|
||||
return
|
||||
}
|
||||
|
||||
dto := e.DeleteDto{}
|
||||
dto.Id = uint(id)
|
||||
dto.Code = &code
|
||||
res, err := u.Delete(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
@@ -33,19 +33,19 @@ func (obj myBase) GetList(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func (obj myBase) GetDetail(w http.ResponseWriter, r *http.Request) {
|
||||
id := rw.ValidateInt(w, "id", r.PathValue("id"))
|
||||
if id <= 0 {
|
||||
code := rw.ValidateString(w, "code", r.PathValue("code"))
|
||||
if code == "" {
|
||||
return
|
||||
}
|
||||
dto := e.ReadDetailDto{}
|
||||
dto.Id = uint16(id)
|
||||
dto.Code = &code
|
||||
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 {
|
||||
code := rw.ValidateString(w, "code", r.PathValue("code"))
|
||||
if code == "" {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -53,19 +53,19 @@ func (obj myBase) Update(w http.ResponseWriter, r *http.Request) {
|
||||
if res := rw.ValidateStructByIOR(w, r.Body, &dto); !res {
|
||||
return
|
||||
}
|
||||
dto.Id = uint16(id)
|
||||
dto.Code = &code
|
||||
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 {
|
||||
code := rw.ValidateString(w, "code", r.PathValue("code"))
|
||||
if code == "" {
|
||||
return
|
||||
}
|
||||
|
||||
dto := e.DeleteDto{}
|
||||
dto.Id = uint16(id)
|
||||
dto.Code = &code
|
||||
res, err := u.Delete(dto)
|
||||
rw.DataResponse(w, res, err)
|
||||
}
|
||||
|
||||
@@ -324,7 +324,7 @@ func SetRoutes() http.Handler {
|
||||
hc.RegCrud(r, "/v1/medicine-method", medicinemethod.O)
|
||||
hc.RegCrud(r, "/v1/mcu-src-category", mcusrccategory.O)
|
||||
hc.RegCrudByCode(r, "/v1/mcu-src", mcusrc.O)
|
||||
hc.RegCrud(r, "/v1/ethnic", ethnic.O)
|
||||
hc.RegCrudByCode(r, "/v1/ethnic", ethnic.O)
|
||||
hc.RegCrud(r, "/v1/insurance-company", insurancecompany.O)
|
||||
hc.RegCrudByCode(r, "/v1/medicine", medicine.O)
|
||||
hc.RegCrudByCode(r, "/v1/device", device.O)
|
||||
@@ -332,7 +332,7 @@ func SetRoutes() http.Handler {
|
||||
hc.RegCrud(r, "/v1/doctor-fee", doctorfee.O)
|
||||
hc.RegCrudByCode(r, "/v1/medical-action-src", medicalactionsrc.O)
|
||||
hc.RegCrud(r, "/v1/medical-action-src-item", medicalactionsrcitem.O)
|
||||
hc.RegCrud(r, "/v1/language", language.O)
|
||||
hc.RegCrudByCode(r, "/v1/language", language.O)
|
||||
hc.RegCrudByCode(r, "/v1/mcu-sub-src", mcusubsrc.O)
|
||||
hc.RegCrud(r, "/v1/vehicle", vehicle.O)
|
||||
hc.RegCrud(r, "/v1/vehicle-hist", vehiclehist.O)
|
||||
|
||||
@@ -28,8 +28,8 @@ import (
|
||||
emergency "simrs-vx/internal/domain/main-entities/emergency"
|
||||
employee "simrs-vx/internal/domain/main-entities/employee"
|
||||
encounter "simrs-vx/internal/domain/main-entities/encounter"
|
||||
fileattachemnt "simrs-vx/internal/domain/main-entities/encounter-document"
|
||||
ethnic "simrs-vx/internal/domain/main-entities/ethnic"
|
||||
fileattachemnt "simrs-vx/internal/domain/main-entities/file-attachment"
|
||||
generalconsent "simrs-vx/internal/domain/main-entities/general-consent"
|
||||
infra "simrs-vx/internal/domain/main-entities/infra"
|
||||
inpatient "simrs-vx/internal/domain/main-entities/inpatient"
|
||||
@@ -208,6 +208,6 @@ func getMainEntities() []any {
|
||||
&controlletter.ControlLetter{},
|
||||
&rehab.Rehab{},
|
||||
&chemoprotocol.ChemoProtocol{},
|
||||
&fileattachemnt.FileAttachment{},
|
||||
&fileattachemnt.EncounterDocument{},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -233,7 +233,7 @@ func createMedicineMixAndItem(input emi.MedicineMix, event *pl.Event, tx *gorm.D
|
||||
for _, medicineMixItem := range input.MixItems {
|
||||
medicineMixItemCreate := emmi.CreateDto{
|
||||
MedicineMix_Id: &medicineMix.Id,
|
||||
Medicine_Id: medicineMixItem.Medicine_Id,
|
||||
Medicine_Code: medicineMixItem.Medicine_Code,
|
||||
Dose: medicineMixItem.Dose,
|
||||
}
|
||||
_, err := ummi.CreateData(medicineMixItemCreate, event, tx)
|
||||
@@ -251,7 +251,7 @@ func createMedicationItem(medication_id uint, input epi.PrescriptionItem, event
|
||||
medicationItemCreate := emei.CreateDto{
|
||||
Medication_Id: &medication_id,
|
||||
IsMix: input.IsMix,
|
||||
Medicine_Id: input.Medicine_Id,
|
||||
Medicine_Code: input.Medicine_Code,
|
||||
MedicineMix_Id: input.MedicineMix_Id,
|
||||
Usage: input.Usage,
|
||||
Interval: input.Interval,
|
||||
|
||||
@@ -166,7 +166,7 @@ func ReadDetail(input e.ReadDetailDto) (*d.Data, error) {
|
||||
}
|
||||
|
||||
func Update(input e.UpdateDto) (*d.Data, error) {
|
||||
rdDto := e.ReadDetailDto{Id: uint16(input.Id)}
|
||||
rdDto := e.ReadDetailDto{Code: input.Code}
|
||||
var data *e.Ethnic
|
||||
var err error
|
||||
|
||||
@@ -222,7 +222,7 @@ func Update(input e.UpdateDto) (*d.Data, error) {
|
||||
}
|
||||
|
||||
func Delete(input e.DeleteDto) (*d.Data, error) {
|
||||
rdDto := e.ReadDetailDto{Id: uint16(input.Id)}
|
||||
rdDto := e.ReadDetailDto{Code: input.Code}
|
||||
var data *e.Ethnic
|
||||
var err error
|
||||
|
||||
|
||||
@@ -17,6 +17,6 @@ func setData[T *e.CreateDto | *e.UpdateDto](input T, data *e.Ethnic) {
|
||||
inputSrc = &inputTemp.CreateDto
|
||||
}
|
||||
|
||||
data.Code = inputSrc.Code
|
||||
data.Code = *inputSrc.Code
|
||||
data.Name = inputSrc.Name
|
||||
}
|
||||
|
||||
@@ -81,7 +81,14 @@ func ReadDetailData(input e.ReadDetailDto, event *pl.Event, dbx ...*gorm.DB) (*e
|
||||
tx = dg.I
|
||||
}
|
||||
|
||||
if err := tx.First(&data, input.Id).Error; err != nil {
|
||||
if input.Code != nil {
|
||||
tx = tx.Where("\"Code\" = ?", *input.Code)
|
||||
}
|
||||
if input.Id != nil {
|
||||
tx = tx.Where("\"Id\" = ?", input.Id)
|
||||
}
|
||||
|
||||
if err := tx.First(&data).Error; err != nil {
|
||||
if processedErr := pu.HandleReadError(err, event, source, input.Id, data); processedErr != nil {
|
||||
return nil, processedErr
|
||||
}
|
||||
|
||||
@@ -166,7 +166,7 @@ func ReadDetail(input e.ReadDetailDto) (*d.Data, error) {
|
||||
}
|
||||
|
||||
func Update(input e.UpdateDto) (*d.Data, error) {
|
||||
rdDto := e.ReadDetailDto{Id: input.Id}
|
||||
rdDto := e.ReadDetailDto{Code: input.Code}
|
||||
var data *e.Language
|
||||
var err error
|
||||
|
||||
@@ -222,7 +222,7 @@ func Update(input e.UpdateDto) (*d.Data, error) {
|
||||
}
|
||||
|
||||
func Delete(input e.DeleteDto) (*d.Data, error) {
|
||||
rdDto := e.ReadDetailDto{Id: input.Id}
|
||||
rdDto := e.ReadDetailDto{Code: input.Code}
|
||||
var data *e.Language
|
||||
var err error
|
||||
|
||||
|
||||
@@ -17,6 +17,6 @@ func setData[T *e.CreateDto | *e.UpdateDto](input T, data *e.Language) {
|
||||
inputSrc = &inputTemp.CreateDto
|
||||
}
|
||||
|
||||
data.Code = inputSrc.Code
|
||||
data.Code = *inputSrc.Code
|
||||
data.Name = inputSrc.Name
|
||||
}
|
||||
|
||||
@@ -81,7 +81,17 @@ func ReadDetailData(input e.ReadDetailDto, event *pl.Event, dbx ...*gorm.DB) (*e
|
||||
tx = dg.I
|
||||
}
|
||||
|
||||
if err := tx.First(&data, input.Id).Error; err != nil {
|
||||
if input.Code != nil {
|
||||
tx = tx.Where("\"Code\" = ?", *input.Code)
|
||||
}
|
||||
if input.Id != nil {
|
||||
tx = tx.Where("\"Id\" = ?", input.Id)
|
||||
}
|
||||
if input.Name != nil {
|
||||
tx = tx.Where("\"Name\" = ?", *input.Name)
|
||||
}
|
||||
|
||||
if err := tx.First(&data).Error; err != nil {
|
||||
if processedErr := pu.HandleReadError(err, event, source, input.Id, data); processedErr != nil {
|
||||
return nil, processedErr
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ func setData[T *e.CreateDto | *e.UpdateDto](input T, data *e.McuOrderItem) {
|
||||
}
|
||||
|
||||
data.McuOrder_Id = inputSrc.McuOrder_Id
|
||||
data.McuSrc_Id = inputSrc.McuSrc_Id
|
||||
data.McuSrc_Code = inputSrc.McuSrc_Code
|
||||
data.Result = inputSrc.Result
|
||||
data.Status_Code = inputSrc.Status_Code
|
||||
data.ExaminationDate = inputSrc.ExaminationDate
|
||||
|
||||
@@ -24,7 +24,7 @@ func CreateData(input e.CreateDto, event *pl.Event, dbx ...*gorm.DB) (*e.McuOrde
|
||||
|
||||
deletedData := e.McuOrderItem{}
|
||||
tx.Unscoped().
|
||||
Where("\"McuOrder_Id\" = ? AND \"McuSrc_Id\" = ?", *input.McuOrder_Id, input.McuSrc_Id).
|
||||
Where("\"McuOrder_Id\" = ? AND \"McuSrc_Code\" = ?", *input.McuOrder_Id, input.McuSrc_Code).
|
||||
First(&deletedData)
|
||||
if deletedData.Id != 0 {
|
||||
if err := tx.Unscoped().Model(e.McuOrderItem{}).Where("\"Id\" = ?", deletedData.Id).Update("\"DeletedAt\"", nil).Error; err != nil {
|
||||
|
||||
@@ -17,7 +17,7 @@ func setData[T *e.CreateDto | *e.UpdateDto](input T, data *e.McuOrderSubItem) {
|
||||
inputSrc = &inputTemp.CreateDto
|
||||
}
|
||||
|
||||
data.McuSubSrc_Id = inputSrc.McuSubSrc_Id
|
||||
data.McuSubSrc_Code = inputSrc.McuSubSrc_Code
|
||||
data.McuOrderItem_Id = inputSrc.McuOrderItem_Id
|
||||
data.Result = inputSrc.Result
|
||||
data.Status_Code = inputSrc.Status_Code
|
||||
|
||||
@@ -6,8 +6,6 @@ import (
|
||||
|
||||
e "simrs-vx/internal/domain/main-entities/medication-item-dist"
|
||||
|
||||
un "simrs-vx/internal/use-case/main-use-case/nurse"
|
||||
|
||||
dg "github.com/karincake/apem/db-gorm-pg"
|
||||
d "github.com/karincake/dodol"
|
||||
|
||||
@@ -303,11 +301,6 @@ func Consume(input e.ConsumeDto) (*d.Data, error) {
|
||||
return pl.SetLogError(&event, input)
|
||||
}
|
||||
|
||||
nurse_id, err := un.GetIdByUserId(&input.AuthInfo.User_Id, &event, tx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if data, err = ReadDetailData(rdDto, &event, tx); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -319,7 +312,18 @@ func Consume(input e.ConsumeDto) (*d.Data, error) {
|
||||
}
|
||||
|
||||
data.Remain -= input.Usage
|
||||
data.Nurse_Id = nurse_id
|
||||
|
||||
if input.AuthInfo.Nurse_Code == nil {
|
||||
event.Status = "failed"
|
||||
event.ErrInfo = pl.ErrorInfo{
|
||||
Code: "auth-noNurse",
|
||||
Detail: "user position is not allowed, only nurse can do action consume medication",
|
||||
Raw: errors.New("authentication failed"),
|
||||
}
|
||||
return pl.SetLogError(&event, input)
|
||||
}
|
||||
|
||||
data.Nurse_Code = input.AuthInfo.Nurse_Code
|
||||
|
||||
if err := tx.Save(&data).Error; err != nil {
|
||||
event.Status = "failed"
|
||||
|
||||
@@ -20,5 +20,5 @@ func setData[T *e.CreateDto | *e.UpdateDto](input T, data *e.MedicationItemDist)
|
||||
data.MedicationItem_Id = inputSrc.MedicationItem_Id
|
||||
data.DateTime = inputSrc.DateTime
|
||||
data.Remain = inputSrc.Remain
|
||||
data.Nurse_Id = inputSrc.Nurse_Id
|
||||
data.Nurse_Code = inputSrc.Nurse_Code
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ func setData[T *e.CreateDto | *e.UpdateDto](input T, data *e.MedicationItem) {
|
||||
|
||||
data.Medication_Id = inputSrc.Medication_Id
|
||||
data.IsMix = inputSrc.IsMix
|
||||
data.Medicine_Id = inputSrc.Medicine_Id
|
||||
data.Medicine_Code = inputSrc.Medicine_Code
|
||||
data.MedicineMix_Id = inputSrc.MedicineMix_Id
|
||||
data.Frequency = inputSrc.Frequency
|
||||
data.Dose = inputSrc.Dose
|
||||
|
||||
@@ -8,8 +8,6 @@ import (
|
||||
|
||||
erc "simrs-vx/internal/domain/references/common"
|
||||
|
||||
up "simrs-vx/internal/use-case/main-use-case/pharmacist"
|
||||
|
||||
dg "github.com/karincake/apem/db-gorm-pg"
|
||||
d "github.com/karincake/dodol"
|
||||
|
||||
@@ -313,13 +311,18 @@ func Complete(input e.ReadDetailDto) (*d.Data, error) {
|
||||
return pl.SetLogError(&event, input)
|
||||
}
|
||||
|
||||
pharmacist_id, err := up.GetIdByUserId(&input.AuthInfo.User_Id, &event, tx)
|
||||
if err != nil {
|
||||
return err
|
||||
if input.AuthInfo.Pharmachist_Code == nil {
|
||||
event.Status = "failed"
|
||||
event.ErrInfo = pl.ErrorInfo{
|
||||
Code: "auth-noPharmacist",
|
||||
Detail: "user position is not allowed, only pharmacist can do actioncomplete medication",
|
||||
Raw: errors.New("authentication failed"),
|
||||
}
|
||||
return pl.SetLogError(&event, input)
|
||||
}
|
||||
|
||||
data.Status_Code = erc.DSCDone
|
||||
data.Pharmacist_Id = pharmacist_id
|
||||
data.Pharmacist_Code = input.AuthInfo.Pharmachist_Code
|
||||
if err := tx.Save(&data).Error; err != nil {
|
||||
event.Status = "failed"
|
||||
event.ErrInfo = pl.ErrorInfo{
|
||||
|
||||
@@ -30,7 +30,7 @@ func setData[T *e.CreateDto | *e.UpdateDto](input T, data *e.Medication) {
|
||||
|
||||
data.Encounter_Id = inputSrc.Encounter_Id
|
||||
data.IssuedAt = inputSrc.IssuedAt
|
||||
data.Pharmacist_Id = inputSrc.Pharmacist_Id
|
||||
data.Pharmacist_Code = inputSrc.Pharmacist_Code
|
||||
data.Status_Code = inputSrc.Status_Code
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ func setData[T *e.CreateDto | *e.UpdateDto](input T, data *e.MedicineMixItem) {
|
||||
}
|
||||
|
||||
data.MedicineMix_Id = inputSrc.MedicineMix_Id
|
||||
data.Medicine_Id = inputSrc.Medicine_Id
|
||||
data.Medicine_Code = inputSrc.Medicine_Code
|
||||
data.Dose = inputSrc.Dose
|
||||
data.Note = inputSrc.Note
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ func setData[T *e.CreateDto | *e.UpdateDto](input T, data *e.PrescriptionItem) {
|
||||
|
||||
data.Prescription_Id = inputSrc.Prescription_Id
|
||||
data.IsMix = inputSrc.IsMix
|
||||
data.Medicine_Id = inputSrc.Medicine_Id
|
||||
data.Medicine_Code = inputSrc.Medicine_Code
|
||||
data.MedicineMix_Id = inputSrc.MedicineMix_Id
|
||||
data.Frequency = inputSrc.Frequency
|
||||
data.Dose = inputSrc.Dose
|
||||
|
||||
@@ -99,7 +99,7 @@ func createMedicineMixAndItem(input emi.MedicineMix, event *pl.Event, tx *gorm.D
|
||||
for _, medicineMixItem := range input.MixItems {
|
||||
medicineMixItemCreate := emmi.CreateDto{
|
||||
MedicineMix_Id: &medicineMix.Id,
|
||||
Medicine_Id: medicineMixItem.Medicine_Id,
|
||||
Medicine_Code: medicineMixItem.Medicine_Code,
|
||||
Dose: medicineMixItem.Dose,
|
||||
}
|
||||
_, err := ummi.CreateData(medicineMixItemCreate, event, tx)
|
||||
@@ -117,7 +117,7 @@ func createMedicationItem(medication_id uint, input epi.PrescriptionItem, event
|
||||
medicationItemCreate := emei.CreateDto{
|
||||
Medication_Id: &medication_id,
|
||||
IsMix: input.IsMix,
|
||||
Medicine_Id: input.Medicine_Id,
|
||||
Medicine_Code: input.Medicine_Code,
|
||||
MedicineMix_Id: input.MedicineMix_Id,
|
||||
Frequency: input.Frequency,
|
||||
Dose: input.Dose,
|
||||
|
||||
Reference in New Issue
Block a user