diff --git a/cmd/main-migration/migrations/20251031082443.sql b/cmd/main-migration/migrations/20251031082443.sql deleted file mode 100644 index deec65bb..00000000 --- a/cmd/main-migration/migrations/20251031082443.sql +++ /dev/null @@ -1,2 +0,0 @@ --- Modify "Ambulatory" table -ALTER TABLE "public"."Ambulatory" ADD COLUMN "VisitMode_Code" text NULL; diff --git a/cmd/main-migration/migrations/20251031084657.sql b/cmd/main-migration/migrations/20251031084657.sql deleted file mode 100644 index 30974d75..00000000 --- a/cmd/main-migration/migrations/20251031084657.sql +++ /dev/null @@ -1,13 +0,0 @@ --- Create "Rehab" table -CREATE TABLE "public"."Rehab" ( - "Id" bigserial NOT NULL, - "CreatedAt" timestamptz NULL, - "UpdatedAt" timestamptz NULL, - "DeletedAt" timestamptz NULL, - "Encounter_Id" bigint NULL, - "Doctor_Id" bigint NULL, - "AllocatedVisitCount" bigint NULL, - PRIMARY KEY ("Id"), - CONSTRAINT "fk_Rehab_Doctor" FOREIGN KEY ("Doctor_Id") REFERENCES "public"."Doctor" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION, - CONSTRAINT "fk_Rehab_Encounter" FOREIGN KEY ("Encounter_Id") REFERENCES "public"."Encounter" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION -); diff --git a/cmd/main-migration/migrations/20251102115856.sql b/cmd/main-migration/migrations/20251102115856.sql deleted file mode 100644 index 1593eb5a..00000000 --- a/cmd/main-migration/migrations/20251102115856.sql +++ /dev/null @@ -1,2 +0,0 @@ --- Modify "Ambulatory" table -ALTER TABLE "public"."Ambulatory" DROP CONSTRAINT "fk_Ambulatory_Encounter", ADD CONSTRAINT "fk_Encounter_Ambulatory" FOREIGN KEY ("Encounter_Id") REFERENCES "public"."Encounter" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION; diff --git a/cmd/main-migration/migrations/20251102141135.sql b/cmd/main-migration/migrations/20251102141135.sql deleted file mode 100644 index 4dafef17..00000000 --- a/cmd/main-migration/migrations/20251102141135.sql +++ /dev/null @@ -1,4 +0,0 @@ --- Modify "Emergency" table -ALTER TABLE "public"."Emergency" DROP CONSTRAINT "fk_Emergency_Encounter", ADD CONSTRAINT "fk_Encounter_Emergency" FOREIGN KEY ("Encounter_Id") REFERENCES "public"."Encounter" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION; --- Modify "Inpatient" table -ALTER TABLE "public"."Inpatient" DROP CONSTRAINT "fk_Inpatient_Encounter", ADD CONSTRAINT "fk_Encounter_Inpatient" FOREIGN KEY ("Encounter_Id") REFERENCES "public"."Encounter" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION; diff --git a/cmd/main-migration/migrations/20251104042334.sql b/cmd/main-migration/migrations/20251104042334.sql new file mode 100644 index 00000000..7628d821 --- /dev/null +++ b/cmd/main-migration/migrations/20251104042334.sql @@ -0,0 +1,2 @@ +-- Modify "Chemo" table +ALTER TABLE "public"."Chemo" DROP COLUMN "Class_Code", ADD COLUMN "Bed" character varying(1024) NULL, ADD COLUMN "Needs" character varying(2048) NULL; diff --git a/cmd/main-migration/migrations/20251104043530.sql b/cmd/main-migration/migrations/20251104043530.sql new file mode 100644 index 00000000..0d34792a --- /dev/null +++ b/cmd/main-migration/migrations/20251104043530.sql @@ -0,0 +1,19 @@ +-- Modify "Ambulatory" table +ALTER TABLE "public"."Ambulatory" DROP CONSTRAINT "fk_Ambulatory_Encounter", ADD COLUMN "VisitMode_Code" text NULL, ADD CONSTRAINT "fk_Encounter_Ambulatory" FOREIGN KEY ("Encounter_Id") REFERENCES "public"."Encounter" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION; +-- Modify "Emergency" table +ALTER TABLE "public"."Emergency" DROP CONSTRAINT "fk_Emergency_Encounter", ADD CONSTRAINT "fk_Encounter_Emergency" FOREIGN KEY ("Encounter_Id") REFERENCES "public"."Encounter" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION; +-- Modify "Inpatient" table +ALTER TABLE "public"."Inpatient" DROP CONSTRAINT "fk_Inpatient_Encounter", ADD CONSTRAINT "fk_Encounter_Inpatient" FOREIGN KEY ("Encounter_Id") REFERENCES "public"."Encounter" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION; +-- Create "Rehab" table +CREATE TABLE "public"."Rehab" ( + "Id" bigserial NOT NULL, + "CreatedAt" timestamptz NULL, + "UpdatedAt" timestamptz NULL, + "DeletedAt" timestamptz NULL, + "Encounter_Id" bigint NULL, + "Doctor_Id" bigint NULL, + "AllocatedVisitCount" bigint NULL, + PRIMARY KEY ("Id"), + CONSTRAINT "fk_Rehab_Doctor" FOREIGN KEY ("Doctor_Id") REFERENCES "public"."Doctor" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION, + CONSTRAINT "fk_Rehab_Encounter" FOREIGN KEY ("Encounter_Id") REFERENCES "public"."Encounter" ("Id") ON UPDATE NO ACTION ON DELETE NO ACTION +); diff --git a/cmd/main-migration/migrations/atlas.sum b/cmd/main-migration/migrations/atlas.sum index 34cc6a1f..c701690e 100644 --- a/cmd/main-migration/migrations/atlas.sum +++ b/cmd/main-migration/migrations/atlas.sum @@ -1,4 +1,4 @@ -h1:zJVjtCkiWEF41JV7lzbRtI5mPZGz5bC8FaVruh3fmkY= +h1:DapfqgPn4h3ozXgxIdxW/bzPLHdc//0uHjK+W42/jic= 20250904105930.sql h1:MEM6blCgke9DzWQSTnLzasbPIrcHssNNrJqZpSkEo6k= 20250904141448.sql h1:J8cmYNk4ZrG9fhfbi2Z1IWz7YkfvhFqTzrLFo58BPY0= 20250908062237.sql h1:Pu23yEW/aKkwozHoOuROvHS/GK4ngARJGdO7FB7HZuI= @@ -64,8 +64,6 @@ h1:zJVjtCkiWEF41JV7lzbRtI5mPZGz5bC8FaVruh3fmkY= 20251027091406.sql h1:eCZGtUkxAzEAqpC9UsGpP8Df9mS0DEOqSl885LgqpvM= 20251102002037.sql h1:lFJbuoZ2LMQnUNGdcwHVY3Xlfslgzu9t2WByT8yfOZI= 20251102091932.sql h1:rmdhb5m+P+fU8jROBZNyeYgZKuQvucsuljXv4ZVzvks= -20251103081637.sql h1:jqpMnygFceOJn0rI30GYWI2CKbOu6RzVqw2/Pji2Ka8= -20251031082443.sql h1:ajvi2G8OGvcmB2pJ1SoX/09ALHLWKNh84RSonVhJqAc= -20251031084657.sql h1:86mNMS/oMNhewetTvLMFvEz1J6AANePHkE0fOztqHTM= -20251102115856.sql h1:H1pqgG/uonIc8iHVZVBR2CLg/iRR4alsvC4Rty/GXH8= -20251102141135.sql h1:icypnR4c5x7v6rKZNyhUREh3udLz5iX2yk7yEfRF7xM= +20251103081637.sql h1:tf3BcwTeIw+oxMEisKDDfyKnBfalTLs8b0PJA8JWYxY= +20251104042334.sql h1:a76eSmiEVviWWjsfAkiriDxRYGhlg8qIjZ2CVQZDnbA= +20251104043530.sql h1:tGP1AhyYzPZAA05IwfJfWWhNISrud3xCmeRFdZ/28SQ= diff --git a/internal/domain/main-entities/chemo/entity.go b/internal/domain/main-entities/chemo/entity.go index 4052ea72..a56dae76 100644 --- a/internal/domain/main-entities/chemo/entity.go +++ b/internal/domain/main-entities/chemo/entity.go @@ -9,7 +9,6 @@ import ( eus "simrs-vx/internal/domain/main-entities/user" erc "simrs-vx/internal/domain/references/common" - ere "simrs-vx/internal/domain/references/encounter" ) type Chemo struct { @@ -22,5 +21,6 @@ type Chemo struct { VerifiedBy *eus.User `json:"verifiedBy,omitempty" gorm:"foreignKey:VerifiedBy_User_Id;references:Id"` SrcUnit_Id *uint `json:"src_unit_id"` SrcUnit *eun.Unit `json:"src_unit,omitempty" gorm:"foreignKey:SrcUnit_Id;references:Id"` - Class_Code ere.ChemoClassCode `json:"class_code"` + Bed *string `json:"bed" gorm:"size:1024"` + Needs *string `json:"needs" gorm:"size:2048"` } diff --git a/internal/domain/references/clinical/clinical.go b/internal/domain/references/clinical/clinical.go index c0eb3594..8120adb3 100644 --- a/internal/domain/references/clinical/clinical.go +++ b/internal/domain/references/clinical/clinical.go @@ -113,11 +113,12 @@ const ( MULCPF McuUrgencyLevelCode = "priority-form" // Form Prioritas MULCRT McuUrgencyLevelCode = "routine" // Pemeriksaan Rutin - STCEarlyNurse SoapiTypeCode = "early-nurse" // Kajian Awal Medis + //STCEarlyNurse SoapiTypeCode = "early-nurse" // Kajian Awal Medis STCEEarlyMedic SoapiTypeCode = "early-medic" // Kajian Awal Rehab Medis STCEarlyRehab SoapiTypeCode = "early-rehab" // Kajian Awal Rehab Medik STCFunc SoapiTypeCode = "function" // Assessment Fungsi STCProgress SoapiTypeCode = "progress" // CPPT + STCDevRecord SoapiTypeCode = "dev-record" // Catatan Perkembangan MAChemo MedicalAction = "chemo" MAHemo MedicalAction = "hemo" diff --git a/internal/domain/references/encounter/encounter.go b/internal/domain/references/encounter/encounter.go index fb133473..97eae05b 100644 --- a/internal/domain/references/encounter/encounter.go +++ b/internal/domain/references/encounter/encounter.go @@ -70,10 +70,12 @@ const ( CSCPLab CheckupScopeCode = "pa-lab" // Patology Anatomy Laboratorium CSCRad CheckupScopeCode = "radiology" // Radiology - ACCReg AmbulatoryClassCode = "reg" // Regular - ACCRme AmbulatoryClassCode = "rme" // Rehab Medik - ACCCad AmbulatoryClassCode = "chemo-adm" // Chemotherapy - ACCCac AmbulatoryClassCode = "chemo-act" // Chemotherapy + ACCReg AmbulatoryClassCode = "reg" // Regular + // ACCRehab ACCRme AmbulatoryClassCode = "rme" // Rehab Medik + // ACCCad AmbulatoryClassCode = "chemo-adm" // Chemotherapy + // ACCCac AmbulatoryClassCode = "chemo-act" // Chemotherapy + ACCRehab AmbulatoryClassCode = "rehab" // Rehab Medik + ACCChemo AmbulatoryClassCode = "chemo" // Rehab Medik ICCIp InpatientClassCode = "ip" // Regular Rawat Inap ICCICU InpatientClassCode = "icu" // ICU diff --git a/internal/use-case/main-use-case/ambulatory/helper.go b/internal/use-case/main-use-case/ambulatory/helper.go index bdd9b106..a8a00e0d 100644 --- a/internal/use-case/main-use-case/ambulatory/helper.go +++ b/internal/use-case/main-use-case/ambulatory/helper.go @@ -29,7 +29,7 @@ func CheckClassCode(input *string) (ere.AmbulatoryClassCode, error) { if input != nil { subCode := ere.AmbulatoryClassCode(*input) switch subCode { - case ere.ACCReg, ere.ACCRme, ere.ACCCad, ere.ACCCac: + case ere.ACCReg, ere.ACCRehab, ere.ACCChemo: return subCode, nil default: return "", errors.New("unknown sub class code") diff --git a/internal/use-case/main-use-case/encounter/case.go b/internal/use-case/main-use-case/encounter/case.go index 8cff1e21..fa55f222 100644 --- a/internal/use-case/main-use-case/encounter/case.go +++ b/internal/use-case/main-use-case/encounter/case.go @@ -138,7 +138,7 @@ func Create(input e.CreateDto) (*d.Data, error) { return err } - if subCodeAmbulatory == ere.ACCCac || subCodeAmbulatory == ere.ACCCad { + if subCodeAmbulatory == ere.ACCChemo { chemoCreate := ec.CreateDto{ Encounter_Id: &data.Id, Status_Code: erc.DVCNew,