From 0fa7e8ccde3d4124a891886926f278154b453742 Mon Sep 17 00:00:00 2001 From: dpurbosakti Date: Fri, 29 Aug 2025 14:27:25 +0700 Subject: [PATCH] fix reference/constlist --- cmd/migration/migrations/atlas.sum | 4 +- .../domain/main-entities/doctor-fee/dto.go | 10 +-- .../domain/main-entities/doctor-fee/entity.go | 4 +- internal/domain/main-entities/employee/dto.go | 8 +- .../domain/main-entities/employee/entity.go | 2 +- .../domain/main-entities/installation/dto.go | 26 +++--- .../main-entities/installation/entity.go | 8 +- .../main-entities/mcu-src-category/dto.go | 10 +-- .../main-entities/mcu-src-category/entity.go | 4 +- .../main-entities/practice-schedule/dto.go | 10 +-- .../main-entities/practice-schedule/entity.go | 4 +- internal/domain/main-entities/user/dto.go | 20 ++--- internal/domain/main-entities/user/entity.go | 16 ++-- .../domain/references/clinical/clinical.go | 40 ++++++--- internal/domain/references/common/common.go | 79 ++++++++++++++--- .../digital-signature/digital-signature.go | 26 ------ .../domain/references/encounter/encounter.go | 78 +++++++++++------ internal/domain/references/finance/finance.go | 67 --------------- .../references/organization/organization.go | 46 ++++++++-- internal/domain/references/patient/patient.go | 85 ------------------- internal/domain/references/person/person.go | 52 ++++++------ internal/domain/references/queue/queue.go | 3 - internal/domain/references/xtime/xtime.go | 31 ------- .../main-use-case/authentication/case.go | 4 +- internal/use-case/main-use-case/user/case.go | 4 +- 25 files changed, 281 insertions(+), 360 deletions(-) delete mode 100644 internal/domain/references/digital-signature/digital-signature.go delete mode 100644 internal/domain/references/finance/finance.go delete mode 100644 internal/domain/references/patient/patient.go delete mode 100644 internal/domain/references/queue/queue.go delete mode 100644 internal/domain/references/xtime/xtime.go diff --git a/cmd/migration/migrations/atlas.sum b/cmd/migration/migrations/atlas.sum index d3527869..65ea4bd7 100644 --- a/cmd/migration/migrations/atlas.sum +++ b/cmd/migration/migrations/atlas.sum @@ -1,2 +1,2 @@ -h1:MMNuESyEk0KZHA2z+7AukfG/ATboITROipz2wK3YNPg= -20250828092003.sql h1:Rr221/6KN53t0eoEHK5+sPeMaVsnKjN4322WLulN8AQ= +h1:kBvWq4ulyP8Gz3UPNE/UdpYtWBIpEQskVnanFmaFCRc= +20250828092003.sql h1:ZxYlga6zF0PsTCMisoQo5yUVNwilr0njJQF8mZuVS64= diff --git a/internal/domain/main-entities/doctor-fee/dto.go b/internal/domain/main-entities/doctor-fee/dto.go index 4d35d903..6052f984 100644 --- a/internal/domain/main-entities/doctor-fee/dto.go +++ b/internal/domain/main-entities/doctor-fee/dto.go @@ -4,19 +4,19 @@ import ( ecore "simrs-vx/internal/domain/base-entities/core" ed "simrs-vx/internal/domain/main-entities/doctor" ei "simrs-vx/internal/domain/main-entities/item" - erc "simrs-vx/internal/domain/references/clinical" + ero "simrs-vx/internal/domain/references/organization" ) type CreateDto struct { Doctor_Id *uint `json:"doctor_id"` - FeeType_Code *erc.DoctorFeeTypeCode `json:"feeType_code"` + FeeType_Code *ero.DoctorFeeTypeCode `json:"feeType_code"` Price *float64 `json:"price"` Item_Id *uint `json:"item_id"` } type ReadListDto struct { Doctor_Id *uint `json:"doctor_id"` - FeeType_Code *erc.DoctorFeeTypeCode `json:"feeType_code"` + FeeType_Code *ero.DoctorFeeTypeCode `json:"feeType_code"` Price *float64 `json:"price"` Item_Id *uint `json:"item_id"` @@ -28,7 +28,7 @@ type ReadListDto struct { type ReadDetailDto struct { Id uint16 `json:"id"` Doctor_Id *uint `json:"doctor_id"` - FeeType_Code *erc.DoctorFeeTypeCode `json:"feeType_code"` + FeeType_Code *ero.DoctorFeeTypeCode `json:"feeType_code"` Price *float64 `json:"price"` Item_Id *uint `json:"item_id"` } @@ -52,7 +52,7 @@ type ResponseDto struct { ecore.Main Doctor_Id *uint `json:"doctor_id"` Doctor *ed.Doctor `json:"doctor,omitempty"` - FeeType_Code *erc.DoctorFeeTypeCode `json:"feeType_code"` + FeeType_Code *ero.DoctorFeeTypeCode `json:"feeType_code"` Price *float64 `json:"price"` Item_Id *uint `json:"item_id"` Item *ei.Item `json:"item,omitempty"` diff --git a/internal/domain/main-entities/doctor-fee/entity.go b/internal/domain/main-entities/doctor-fee/entity.go index af15173b..211e4148 100644 --- a/internal/domain/main-entities/doctor-fee/entity.go +++ b/internal/domain/main-entities/doctor-fee/entity.go @@ -4,14 +4,14 @@ import ( ecore "simrs-vx/internal/domain/base-entities/core" ed "simrs-vx/internal/domain/main-entities/doctor" ei "simrs-vx/internal/domain/main-entities/item" - erc "simrs-vx/internal/domain/references/clinical" + ero "simrs-vx/internal/domain/references/organization" ) type DoctorFee struct { ecore.Main // adjust this according to the needs Doctor_Id *uint `json:"doctor_id"` Doctor *ed.Doctor `json:"doctor,omitempty" gorm:"foreignKey:Doctor_Id;references:Id"` - FeeType_Code *erc.DoctorFeeTypeCode `json:"feeType_code" gorm:"size:11"` + FeeType_Code *ero.DoctorFeeTypeCode `json:"feeType_code" gorm:"size:11"` Price *float64 `json:"price"` Item_Id *uint `json:"item_id"` Item *ei.Item `json:"item,omitempty" gorm:"foreignKey:Item_Id;references:Id"` diff --git a/internal/domain/main-entities/employee/dto.go b/internal/domain/main-entities/employee/dto.go index ff650793..eb7432ec 100644 --- a/internal/domain/main-entities/employee/dto.go +++ b/internal/domain/main-entities/employee/dto.go @@ -13,7 +13,7 @@ type CreateDto struct { Position_Code ero.EmployeePosisitionCode `json:"position_code"` Division_Code *string `json:"division_code"` Number *string `json:"number"` - Status_Code erc.StatusCode `json:"status_code"` + Status_Code erc.ActiveStatusCode `json:"status_code"` } type ReadListDto struct { @@ -22,7 +22,7 @@ type ReadListDto struct { Position_Code ero.EmployeePosisitionCode `json:"position_code"` Division_Code *string `json:"division_code"` Number *string `json:"number"` - Status_Code erc.StatusCode `json:"status_code"` + Status_Code erc.ActiveStatusCode `json:"status_code"` Page int `json:"page"` PageSize int `json:"page_size"` @@ -36,7 +36,7 @@ type ReadDetailDto struct { Position_Code ero.EmployeePosisitionCode `json:"position_code"` Division_Code *string `json:"division_code"` Number *string `json:"number"` - Status_Code erc.StatusCode `json:"status_code"` + Status_Code erc.ActiveStatusCode `json:"status_code"` } type UpdateDto struct { @@ -62,7 +62,7 @@ type ResponseDto struct { Division_Code *string `json:"division_code"` Division *ed.Division `json:"division,omitempty"` Number *string `json:"number"` - Status_Code erc.StatusCode `json:"status_code"` + Status_Code erc.ActiveStatusCode `json:"status_code"` } func (d Employee) ToResponse() ResponseDto { diff --git a/internal/domain/main-entities/employee/entity.go b/internal/domain/main-entities/employee/entity.go index 55b829fa..15ca4ce9 100644 --- a/internal/domain/main-entities/employee/entity.go +++ b/internal/domain/main-entities/employee/entity.go @@ -15,5 +15,5 @@ type Employee struct { Division_Code *string `json:"division_code"` Division *ed.Division `json:"division,omitempty" gorm:"foreignKey:Division_Code;references:Code"` Number *string `json:"number" gorm:"size:20"` - Status_Code erc.StatusCode `json:"status_code" gorm:"not null;size:10"` + Status_Code erc.ActiveStatusCode `json:"status_code" gorm:"not null;size:10"` } diff --git a/internal/domain/main-entities/installation/dto.go b/internal/domain/main-entities/installation/dto.go index 66ce57ff..d3691c03 100644 --- a/internal/domain/main-entities/installation/dto.go +++ b/internal/domain/main-entities/installation/dto.go @@ -6,15 +6,15 @@ import ( ) type CreateDto struct { - Code string `json:"code"` - Name string `json:"name"` - EncounterClass_Code ere.EncounterClass `json:"encounterClass_code"` + Code string `json:"code"` + Name string `json:"name"` + EncounterClass_Code ere.EncounterClassCode `json:"encounterClass_code"` } type ReadListDto struct { - Code string `json:"code"` - Name string `json:"name"` - EncounterClass_Code ere.EncounterClass `json:"encounterClass_code"` + Code string `json:"code"` + Name string `json:"name"` + EncounterClass_Code ere.EncounterClassCode `json:"encounterClass_code"` Page int `json:"page"` PageSize int `json:"page_size"` @@ -22,10 +22,10 @@ type ReadListDto struct { } type ReadDetailDto struct { - Id uint16 `json:"id"` - Code string `json:"code"` - Name string `json:"name"` - EncounterClass_Code ere.EncounterClass `json:"encounterClass_code"` + Id uint16 `json:"id"` + Code string `json:"code"` + Name string `json:"name"` + EncounterClass_Code ere.EncounterClassCode `json:"encounterClass_code"` } type UpdateDto struct { @@ -45,9 +45,9 @@ type MetaDto struct { type ResponseDto struct { ecore.SmallMain - Code string `json:"code"` - Name string `json:"name"` - EncounterClass_Code ere.EncounterClass `json:"encounterClass_code"` + Code string `json:"code"` + Name string `json:"name"` + EncounterClass_Code ere.EncounterClassCode `json:"encounterClass_code"` } func (d Installation) ToResponse() ResponseDto { diff --git a/internal/domain/main-entities/installation/entity.go b/internal/domain/main-entities/installation/entity.go index 203b231c..0cd5b7dd 100644 --- a/internal/domain/main-entities/installation/entity.go +++ b/internal/domain/main-entities/installation/entity.go @@ -6,8 +6,8 @@ import ( ) type Installation struct { - ecore.SmallMain // adjust this according to the needs - Code string `json:"code" gorm:"unique;size:10"` - Name string `json:"name" gorm:"size:50"` - EncounterClass_Code ere.EncounterClass `json:"encounterClass_code" gorm:"size:10"` + ecore.SmallMain // adjust this according to the needs + Code string `json:"code" gorm:"unique;size:10"` + Name string `json:"name" gorm:"size:50"` + EncounterClass_Code ere.EncounterClassCode `json:"encounterClass_code" gorm:"size:10"` } diff --git a/internal/domain/main-entities/mcu-src-category/dto.go b/internal/domain/main-entities/mcu-src-category/dto.go index f78eb6a9..6c48beb3 100644 --- a/internal/domain/main-entities/mcu-src-category/dto.go +++ b/internal/domain/main-entities/mcu-src-category/dto.go @@ -2,19 +2,19 @@ package division import ( ecore "simrs-vx/internal/domain/base-entities/core" - erc "simrs-vx/internal/domain/references/clinical" + ere "simrs-vx/internal/domain/references/encounter" ) type CreateDto struct { Code string `json:"code"` Name string `json:"name"` - Scope_Code *erc.CheckupScopeCode `json:"scope_code"` + Scope_Code *ere.CheckupScopeCode `json:"scope_code"` } type ReadListDto struct { Code string `json:"code"` Name string `json:"name"` - Scope_Code *erc.CheckupScopeCode `json:"scope_code"` + Scope_Code *ere.CheckupScopeCode `json:"scope_code"` Page int `json:"page"` PageSize int `json:"page_size"` @@ -25,7 +25,7 @@ type ReadDetailDto struct { Id uint16 `json:"id"` Code string `json:"code"` Name string `json:"name"` - Scope_Code *erc.CheckupScopeCode `json:"scope_code"` + Scope_Code *ere.CheckupScopeCode `json:"scope_code"` } type UpdateDto struct { @@ -47,7 +47,7 @@ type ResponseDto struct { ecore.SmallMain Code string `json:"code"` Name string `json:"name"` - Scope_Code *erc.CheckupScopeCode `json:"scope_code"` + Scope_Code *ere.CheckupScopeCode `json:"scope_code"` } func (d McuSrcCategory) ToResponse() ResponseDto { diff --git a/internal/domain/main-entities/mcu-src-category/entity.go b/internal/domain/main-entities/mcu-src-category/entity.go index 61921168..21c266e3 100644 --- a/internal/domain/main-entities/mcu-src-category/entity.go +++ b/internal/domain/main-entities/mcu-src-category/entity.go @@ -2,12 +2,12 @@ package division import ( ecore "simrs-vx/internal/domain/base-entities/core" - erc "simrs-vx/internal/domain/references/clinical" + ere "simrs-vx/internal/domain/references/encounter" ) type McuSrcCategory struct { ecore.SmallMain // adjust this according to the needs Code string `json:"code" gorm:"unique;size:20"` Name string `json:"name" gorm:"size:50"` - Scope_Code *erc.CheckupScopeCode `json:"scope_code" gorm:"size:10"` + Scope_Code *ere.CheckupScopeCode `json:"scope_code" gorm:"size:10"` } diff --git a/internal/domain/main-entities/practice-schedule/dto.go b/internal/domain/main-entities/practice-schedule/dto.go index 2f6cda94..ea09c0d9 100644 --- a/internal/domain/main-entities/practice-schedule/dto.go +++ b/internal/domain/main-entities/practice-schedule/dto.go @@ -2,13 +2,13 @@ package practiceschedule import ( ecore "simrs-vx/internal/domain/base-entities/core" - erx "simrs-vx/internal/domain/references/xtime" + erc "simrs-vx/internal/domain/references/common" ) type CreateDto struct { Doctor_Id *uint `json:"doctor_id"` Unit_Code *string `json:"unit_code"` - Day_Code *erx.DayCode `json:"day_code"` + Day_Code *erc.DayCode `json:"day_code"` StartTime *string `json:"startTime"` EndTime *string `json:"endTime"` } @@ -16,7 +16,7 @@ type CreateDto struct { type ReadListDto struct { Doctor_Id *uint `json:"doctor_id"` Unit_Code *string `json:"unit_code"` - Day_Code *erx.DayCode `json:"day_code"` + Day_Code *erc.DayCode `json:"day_code"` StartTime *string `json:"startTime"` EndTime *string `json:"endTime"` @@ -29,7 +29,7 @@ type ReadDetailDto struct { Id uint16 `json:"id"` Doctor_Id *uint `json:"doctor_id"` Unit_Code *string `json:"unit_code"` - Day_Code *erx.DayCode `json:"day_code"` + Day_Code *erc.DayCode `json:"day_code"` StartTime *string `json:"startTime"` EndTime *string `json:"endTime"` } @@ -53,7 +53,7 @@ type ResponseDto struct { ecore.Main Doctor_Id *uint `json:"doctor_id"` Unit_Code *string `json:"unit_code"` - Day_Code *erx.DayCode `json:"day_code"` + Day_Code *erc.DayCode `json:"day_code"` StartTime *string `json:"startTime"` EndTime *string `json:"endTime"` } diff --git a/internal/domain/main-entities/practice-schedule/entity.go b/internal/domain/main-entities/practice-schedule/entity.go index 5bd1c006..524867c8 100644 --- a/internal/domain/main-entities/practice-schedule/entity.go +++ b/internal/domain/main-entities/practice-schedule/entity.go @@ -4,7 +4,7 @@ import ( ecore "simrs-vx/internal/domain/base-entities/core" ed "simrs-vx/internal/domain/main-entities/doctor" eu "simrs-vx/internal/domain/main-entities/unit" - erx "simrs-vx/internal/domain/references/xtime" + erc "simrs-vx/internal/domain/references/common" ) type PracticeSchedule struct { @@ -13,7 +13,7 @@ type PracticeSchedule struct { Doctor *ed.Doctor `json:"doctor,omitempty" gorm:"foreignKey:Doctor_Id;references:Id"` Unit_Code *string `json:"unit_code"` Unit *eu.Unit `json:"unit,omitempty" gorm:"foreignKey:Unit_Code;references:Code"` - Day_Code *erx.DayCode `json:"day_code"` + Day_Code *erc.DayCode `json:"day_code"` StartTime *string `json:"startTime" gorm:"size:5"` EndTime *string `json:"endTime" gorm:"size:5"` } diff --git a/internal/domain/main-entities/user/dto.go b/internal/domain/main-entities/user/dto.go index 98c3a2d1..7ac5715c 100644 --- a/internal/domain/main-entities/user/dto.go +++ b/internal/domain/main-entities/user/dto.go @@ -7,14 +7,14 @@ import ( ) type CreateDto struct { - Name string `json:"name"` - Password string `json:"password"` - Status_Code erc.StatusCode `json:"status_code"` + Name string `json:"name"` + Password string `json:"password"` + Status_Code erc.UserStatusCode `json:"status_code"` } type ReadListDto struct { - Name string `json:"name"` - Status_Code erc.StatusCode `json:"status_code"` + Name string `json:"name"` + Status_Code erc.UserStatusCode `json:"status_code"` Page int `json:"page"` PageSize int `json:"page_size"` @@ -49,11 +49,11 @@ type LoginDto struct { type ResponseDto struct { ecore.Main - Name string `json:"name"` - Status_Code erc.StatusCode `json:"status_code"` - FailedLoginCount uint8 `json:"failedLoginCount"` - LastSuccessLogin *time.Time `json:"lastSuccessLogin,omitempty"` - LastAllowdLogin *time.Time `json:"lastAllowdLogin,omitempty"` + Name string `json:"name"` + Status_Code erc.UserStatusCode `json:"status_code"` + FailedLoginCount uint8 `json:"failedLoginCount"` + LastSuccessLogin *time.Time `json:"lastSuccessLogin,omitempty"` + LastAllowdLogin *time.Time `json:"lastAllowdLogin,omitempty"` } func (d *User) ToResponse() ResponseDto { diff --git a/internal/domain/main-entities/user/entity.go b/internal/domain/main-entities/user/entity.go index f69e03ca..0db3beea 100644 --- a/internal/domain/main-entities/user/entity.go +++ b/internal/domain/main-entities/user/entity.go @@ -7,12 +7,12 @@ import ( ) type User struct { - ecore.Main // adjust this according to the needs - Name string `json:"name" gorm:"not null;size:25"` - Password string `json:"password" gorm:"not null;size:255"` - Status_Code erc.StatusCode `json:"status_code" gorm:"not null;size:10"` - FailedLoginCount uint8 `json:"failedLoginCount" gorm:"type:smallint"` - LoginAttemptCount int `json:"-"` - LastSuccessLogin *time.Time `json:"lastSuccessLogin,omitempty"` - LastAllowdLogin *time.Time `json:"lastAllowdLogin,omitempty"` + ecore.Main // adjust this according to the needs + Name string `json:"name" gorm:"not null;size:25"` + Password string `json:"password" gorm:"not null;size:255"` + Status_Code erc.UserStatusCode `json:"status_code" gorm:"not null;size:10"` + FailedLoginCount uint8 `json:"failedLoginCount" gorm:"type:smallint"` + LoginAttemptCount int `json:"-"` + LastSuccessLogin *time.Time `json:"lastSuccessLogin,omitempty"` + LastAllowdLogin *time.Time `json:"lastAllowdLogin,omitempty"` } diff --git a/internal/domain/references/clinical/clinical.go b/internal/domain/references/clinical/clinical.go index f1be0605..3998811b 100644 --- a/internal/domain/references/clinical/clinical.go +++ b/internal/domain/references/clinical/clinical.go @@ -1,18 +1,38 @@ package clinical type ( - CheckupScopeCode string - DoctorFeeTypeCode string + SubjectCode string + ObjectCode string + AssessmentCode string + InstructionCode string ) const ( - CSCLab CheckupScopeCode = "lab" // Laboratorium - CSCMLab CheckupScopeCode = "mic-lab" // Microbacterial Laboratorium - CSCPLab CheckupScopeCode = "pa-lab" // Patology Anatomy Laboratorium - CSCRad CheckupScopeCode = "radiology" // Radiology + SCPrimaryComplaint SubjectCode = "pri-compl" // Keluhan Utama + SCSecComplaint SubjectCode = "sec-compl" // Secondary Complaint + SCCurrentDiseaseHistory SubjectCode = "cur-disea-hist" // Current Disease History + SCPastDiseaseHistory SubjectCode = "pas-disea-hist" // Past Disease History + SCFamilyDiseaseHistory SubjectCode = "fam-disea-hist" // Family Disease History + SCAllergyHistory SubjectCode = "alg-hist" // Allergic History + SCAllergyReaction SubjectCode = "alg-react" // Allergic Reaction + SCMedicationHistory SubjectCode = "med-hist" // Medication History - DFTCOut DoctorFeeTypeCode = "outpatient" // Rawat Jalan - DFTCInp DoctorFeeTypeCode = "inpatient" // Rawat Inap - DFTCEme DoctorFeeTypeCode = "emergency" // Darurat - DFTCReh DoctorFeeTypeCode = "medic-rehab" // Rehab Medik + OCConsciousnessLevel ObjectCode = "consc-level" // Tingkat Kesadaran + OCConsciousnessLevelDet ObjectCode = "consc-level-det" // Detail Tingkat Kesadaran + OCSystolicBloodPressure ObjectCode = "syst-bp" // Tekanan Darah Systolic + OCDiastolicBloodPressure ObjectCode = "diast-bp" // Tekanan Darah Diastolic + OCHeartRate ObjectCode = "hear-rt" // Detak Jantung + OCTemperature ObjectCode = "temp" // Suhu + OCSpO2 ObjectCode = "spo2" // SpO2 + OCWeight ObjectCode = "weight" // Berat Badan + OCHeight ObjectCode = "height" // Tinggi Badan + + ACEarlyDiag AssessmentCode = "early-diag" // Diagnosis Awal + ACLateDiag AssessmentCode = "late-diag" // Diagnosis Akhir + ACSecDiag AssessmentCode = "sec-diag" // Diagnosis Sekunder + + ICDetail InstructionCode = "detail" // Detail instruksi + ICMedAct InstructionCode = "med-act" // Tindakan medis + ICMedication InstructionCode = "medication" // Obat + ICMaterial InstructionCode = "material" // BMHP ) diff --git a/internal/domain/references/common/common.go b/internal/domain/references/common/common.go index 7f6fed2b..d60ee8a3 100644 --- a/internal/domain/references/common/common.go +++ b/internal/domain/references/common/common.go @@ -1,12 +1,17 @@ package common type ( - YaTidakCode byte - SudahBelumCode byte - AktifSimpelCode byte - AktifAdvanceCode byte - TersediaCode byte - StatusCode string + YaTidakCode byte + SudahBelumCode byte + AktifSimpelCode byte + AktifAdvanceCode byte + TersediaCode byte + DayCode byte + ActiveStatusCode string + DataStatusCode string + UserStatusCode string + TimeUnitCode string + PaymentMethodCode string ) const ( @@ -35,9 +40,61 @@ const ( ) const ( - SCNew StatusCode = "new" - SCActive StatusCode = "active" - SCInactive StatusCode = "inactive" - SCBlocked StatusCode = "blocked" - SCSuspended StatusCode = "suspended" + DCMinggu DayCode = iota + DCSenin + DCSelasa + DCRabu + DCKamis + DCJumat + DCSabtu ) + +const ( + SCActive ActiveStatusCode = "active" // Aktif + SCInactive ActiveStatusCode = "inactive" // Tidak aktif + + DSCNew DataStatusCode = "new" // Baru + DSCReview DataStatusCode = "review" // Review + DSCProcess DataStatusCode = "process" // Proses + DSCDone DataStatusCode = "done" // Selesai + DSCCancel DataStatusCode = "cancel" // Dibatalkan + DSCRejected DataStatusCode = "rejected" // Ditolak + DSCSkipped DataStatusCode = "skipped" // Dilewati + + USCNew UserStatusCode = "new" // Baru + USCActive UserStatusCode = "active" // Aktif + USCInactive UserStatusCode = "inactive" // Tidak aktif + USCBlocked UserStatusCode = "blocked" // Diblokir + USCSuspended UserStatusCode = "suspended" // Dibekukan + + TUCSec TimeUnitCode = "sec" // Detik + TUCMin TimeUnitCode = "min" // Menit + TUCHour TimeUnitCode = "hour" // Jam + TUCDay TimeUnitCode = "day" // Hari + TUCWeek TimeUnitCode = "week" // Minggu + TUCMonth TimeUnitCode = "month" // Bulan + TUCYear TimeUnitCode = "year" // Tahun + + PMCCash PaymentMethodCode = "cash" // Tunai + PMCDebit PaymentMethodCode = "debit" // Debet + PMCCredit PaymentMethodCode = "credit" // Kredit + PMCInsurance PaymentMethodCode = "insurance" // Asuransi + PMCMembership PaymentMethodCode = "membership" // Member + +) + +func GetDayCodes() map[DayCode]string { + return map[DayCode]string{ + DCMinggu: "Minggu", + DCSenin: "Senin", + DCSelasa: "Selasa", + DCRabu: "Rabu", + DCKamis: "Kamis", + DCJumat: "Jumat", + DCSabtu: "Sabtu", + } +} + +func (obj DayCode) String() string { + return GetDayCodes()[obj] +} diff --git a/internal/domain/references/digital-signature/digital-signature.go b/internal/domain/references/digital-signature/digital-signature.go deleted file mode 100644 index 4c8f2fe9..00000000 --- a/internal/domain/references/digital-signature/digital-signature.go +++ /dev/null @@ -1,26 +0,0 @@ -package digitalsignature - -type ( - RMEType string - SignType string -) - -const ( - // modules - RMETypePrescription RMEType = "prescription" - RMETypeExamination RMEType = "examination" - RMETypeRadiology RMEType = "radiology" - RMETypeSick RMEType = "sick" - RMETypeReferral RMEType = "referral" - RMETypeEndOfLife RMEType = "endoflife" - RMETypeChangeDpjp RMEType = "changedpjp" - - // employee - SignTypeEmployee SignType = "employee" - - // doctor - SignTypeDoctor SignType = "doctor" - - // patient - SignTypePatient SignType = "patient" -) diff --git a/internal/domain/references/encounter/encounter.go b/internal/domain/references/encounter/encounter.go index 941b0cae..00b01236 100644 --- a/internal/domain/references/encounter/encounter.go +++ b/internal/domain/references/encounter/encounter.go @@ -1,32 +1,63 @@ package encounter type ( - EncounterStatus string - EncounterClass string - EmergencyClass string - InpatientClass string + EncounterClassCode string + QueueStatusCode string + DischargeMethodCode string + TransportationCode string + PersonConditionCode string + EmergencyClassCode string + OutpatientClassCode string + CheckupScopeCode string ) const ( - EncounterStatusNew EncounterStatus = "new" - EncounterStatusNurse EncounterStatus = "nurse assessment" - EncounterStatusDoctor EncounterStatus = "doctor assessment" - EncounterStatusDone EncounterStatus = "done" - EncounterStatusCancel EncounterStatus = "canceled" -) -const ( - IGD EmergencyClass = "igd" - Ponek EmergencyClass = "ponek" -) -const ( - ECAmbulatory EncounterClass = "ambulatory" - ECOutpatient EncounterClass = "outpatient" - ECInpatient EncounterClass = "inpatient" - ECEmergency EncounterClass = "emergency" - ECRadiology EncounterClass = "radiology" + ECOutpatient EncounterClassCode = "outpatient" + ECAmbulatory EncounterClassCode = "ambulatory" + ECEmergency EncounterClassCode = "emergency" + ECInpatient EncounterClassCode = "inpatient" + ECDraft EncounterClassCode = "draft" + ECDone EncounterClassCode = "done" + ECCancel EncounterClassCode = "cancel" + ECSkip EncounterClassCode = "skip" + + QSCWait QueueStatusCode = "wait" // Tunggu + QSCProc QueueStatusCode = "proc" // Proses + QSCDone QueueStatusCode = "done" // Selesai + QSCCancel QueueStatusCode = "cancel" // Dibatalkan + QSCSkip QueueStatusCode = "skip" // Dilewati + + DMCHome DischargeMethodCode = "home" // Rumah + DMCHomeReq DischargeMethodCode = "home-request" // Rumah (Dibutuhkan) + + TCAmbulance TransportationCode = "ambulance" + TCCar TransportationCode = "car" + TCMotorCycle TransportationCode = "motor-cycle" + TCOther TransportationCode = "other" + + PCCRes PersonConditionCode = "res" // Resutiasi + PCCEmg PersonConditionCode = "emg" // Darurat + PCCUrg PersonConditionCode = "urg" // Mendesak + PCCLurg PersonConditionCode = "lurg" // Kurang mendesak + PCCNurg PersonConditionCode = "nurg" // + PCCDoa PersonConditionCode = "doa" // Meninggal saat tiba + + ECCEmg EmergencyClassCode = "emg" // Darurat/Emergency biasa + ECCEon EmergencyClassCode = "eon" // Ponek/Emergency obstetri neonatal + + OCCOp OutpatientClassCode = "op" // Rawat Jalan + OCCIcu OutpatientClassCode = "icu" // ICU + OCCHcu OutpatientClassCode = "hcu" // HCU + OCCVk OutpatientClassCode = "vk" // Verlos kamer + + CSCLab CheckupScopeCode = "lab" // Laboratorium + CSCMLab CheckupScopeCode = "mic-lab" // Microbacterial Laboratorium + CSCPLab CheckupScopeCode = "pa-lab" // Patology Anatomy Laboratorium + CSCRad CheckupScopeCode = "radiology" // Radiology + ) -func (ec EncounterClass) Code() string { +func (ec EncounterClassCode) Code() string { switch ec { case ECAmbulatory, ECOutpatient: return "AMB" @@ -38,8 +69,3 @@ func (ec EncounterClass) Code() string { return "UNKNOWN" } } - -const ( - ICU InpatientClass = "ICU" - NonICU InpatientClass = "non ICU" -) diff --git a/internal/domain/references/finance/finance.go b/internal/domain/references/finance/finance.go deleted file mode 100644 index bbf405e7..00000000 --- a/internal/domain/references/finance/finance.go +++ /dev/null @@ -1,67 +0,0 @@ -package finance - -type ( - PaymentMethodCode string - TaxCode string - PaymentStatusCode string - ServiceType string -) - -const ( - PMCCash PaymentMethodCode = "cash" - PMCBPJS PaymentMethodCode = "bpjs" - PMCInsurance PaymentMethodCode = "insurance" - PMCMembership PaymentMethodCode = "membership" - PMCDebit PaymentMethodCode = "debit" - PMCCredit PaymentMethodCode = "credit" - PMCOther PaymentMethodCode = "other" -) - -const ( - TCCountry TaxCode = "country" -) - -const ( - PaymentStatusNew PaymentStatusCode = "new" - PaymentStatusUnpaid PaymentStatusCode = "unpaid" - PaymentStatusPaid PaymentStatusCode = "paid" - PaymentStatusCancel PaymentStatusCode = "cancel" - PaymentStatusFailed PaymentStatusCode = "failed" -) - -func GetTaxeCodes() map[TaxCode]float32 { - return map[TaxCode]float32{ - TCCountry: 0.11, - } -} - -var NonInsurancePaymentMethods = map[PaymentMethodCode]bool{ - PMCCash: true, - PMCDebit: true, - PMCCredit: true, -} - -func (p PaymentMethodCode) IsInsurance() bool { - switch p { - case PMCCash, PMCDebit, PMCCredit, PMCBPJS: - return true - default: - return false - } -} - -const ( - STInpatient = "Rawat Inap" - STAmbulatory = "Rawat Jalan" - STEmergency = "IGD" - STPonek = "PONEK" - STLab = "Laboratorium" - STRadiology = "Radiologi" -) - -const ( - AdminEmergencyFee = "Biaya Administrasi IGD" - DoctorEmergencyFee = "Biaya Dokter IGD" - AdminPediatricInternalFee = "Biaya Administrasi Poli Anak/Penyakit Dalam" - AdminGeneralPolyFee = "Biaya Administrasi Poli" -) diff --git a/internal/domain/references/organization/organization.go b/internal/domain/references/organization/organization.go index bad128d6..de9cff1c 100644 --- a/internal/domain/references/organization/organization.go +++ b/internal/domain/references/organization/organization.go @@ -2,15 +2,45 @@ package organization type ( EmployeePosisitionCode string + ItemGroupCoode string + InfraGroupCode string + UnitTypeCode string + DoctorFeeTypeCode string ) const ( - EPCDoc EmployeePosisitionCode = "doctor" - EPCNur EmployeePosisitionCode = "nurse" - EPCNut EmployeePosisitionCode = "nutritionist" - EPCLab EmployeePosisitionCode = "laborant" - EPCPha EmployeePosisitionCode = "pharmacy" - EPCPay EmployeePosisitionCode = "payment" - EPCPav EmployeePosisitionCode = "payment-verificator" - EPCMan EmployeePosisitionCode = "management" + EPCDoc EmployeePosisitionCode = "doctor" // Dokter + EPCNur EmployeePosisitionCode = "nurse" // Perawat + EPCNut EmployeePosisitionCode = "nutritionist" // Ahli gizi + EPCLab EmployeePosisitionCode = "laborant" // Laboran + EPCPha EmployeePosisitionCode = "pharmacy" // Farmasi + EPCPay EmployeePosisitionCode = "payment" // Pembayaran + EPCPav EmployeePosisitionCode = "payment-verificator" // Konfirmasi pembayaran + EPCMan EmployeePosisitionCode = "management" // Manajemen + + ITGCInfra ItemGroupCoode = "infra" + ITGCMedicine ItemGroupCoode = "medicine" + ITGCDevice ItemGroupCoode = "device" + ITGCMaterial ItemGroupCoode = "material" + ITGCEmpFee ItemGroupCoode = "employee-fee" + ITGCDocFee ItemGroupCoode = "doctor-fee" + + IFGCBuilding InfraGroupCode = "building" + IFGCFloor InfraGroupCode = "floor" + IFGCRoom InfraGroupCode = "room" + IFGCChamber InfraGroupCode = "chamber" + IFGCBed InfraGroupCode = "bed" + IFGCWarehouse InfraGroupCode = "warehouse" + + UTCReg UnitTypeCode = "reg" // Registrasi + UTCExa UnitTypeCode = "exa" // Pemeriksaan + UTCPay UnitTypeCode = "pay" // Pembayaran + UTCPha UnitTypeCode = "pha" // Farmasi + UTCLab UnitTypeCode = "lab" // Laboratorium + UTCRad UnitTypeCode = "rad" // Radiologi + + DFTCOut DoctorFeeTypeCode = "outpatient" // Rawat Jalan + DFTCInp DoctorFeeTypeCode = "inpatient" // Rawat Inap + DFTCEme DoctorFeeTypeCode = "emergency" // Darurat + DFTCReh DoctorFeeTypeCode = "medic-rehab" // Rehab Medik ) diff --git a/internal/domain/references/patient/patient.go b/internal/domain/references/patient/patient.go deleted file mode 100644 index 4332eca0..00000000 --- a/internal/domain/references/patient/patient.go +++ /dev/null @@ -1,85 +0,0 @@ -package patient - -type ( - ConsciousLevelCode string - StatusCode string - PaymentMethodCode string - EndAssessmentCode string - VisitTypeJknCode uint8 -) - -const ( - CLCAlert ConsciousLevelCode = "alert" - CLCVoice ConsciousLevelCode = "voice" - CLCPain ConsciousLevelCode = "pain" - CLCUnresponsive ConsciousLevelCode = "unresponsive" - CLCAnxious ConsciousLevelCode = "anxious" - CLCAcuteConfusional ConsciousLevelCode = "acute-confuncional" - - PMCCash PaymentMethodCode = "cash" - PMCDebit PaymentMethodCode = "debit" - PMCCredit PaymentMethodCode = "credit" - PMCBpjs PaymentMethodCode = "bpjs" - PMCMembership PaymentMethodCode = "membership" - PMCInsurance PaymentMethodCode = "insurance" - - SCDraft StatusCode = "draft" - SCActive StatusCode = "active" - SCInactive StatusCode = "inactive" - SCBlocked StatusCode = "blocked" - SCDead StatusCode = "dead" - - EACHomeRecom EndAssessmentCode = "home recommendation" - EACHomeReq EndAssessmentCode = "home request" - EACOtherPoly EndAssessmentCode = "others poly" - EACRefInt EndAssessmentCode = "referral internal" - EACRefExt EndAssessmentCode = "referral external" - EACDecease EndAssessmentCode = "decease" - - VTJCReference VisitTypeJknCode = 1 - VTJCInternalReference VisitTypeJknCode = 2 - VTJCControl VisitTypeJknCode = 3 - VTJCExternalReference VisitTypeJknCode = 4 -) - -func GetStatusCodes() map[StatusCode]string { - return map[StatusCode]string{ - SCDraft: "Draft", - SCActive: "Aktif", - SCInactive: "Tidak Aktif", - SCBlocked: "Diblokir", - SCDead: "Meninggal", - } -} - -func GetConsciousLevelCodes() map[ConsciousLevelCode]string { - return map[ConsciousLevelCode]string{ - CLCAlert: "Sadar Baik / Alert", - CLCVoice: "Berespon dengan kata-kata / Voice", - CLCPain: "Hanya beresponse jika dirangsang nyeri / pain", - CLCUnresponsive: "Pasien tidak sadar / unresponsive", - CLCAnxious: "Gelisah atau bingung", - CLCAcuteConfusional: "Acute Confusional States", - } -} - -func GetPaymentMethodCodes() map[PaymentMethodCode]string { - return map[PaymentMethodCode]string{ - PMCCash: "cash", - PMCDebit: "debit", - PMCCredit: "credit", - PMCBpjs: "bpjs", - PMCMembership: "membership", - PMCInsurance: "insurance"} -} - -func GetEndAssessments() map[EndAssessmentCode]string { - return map[EndAssessmentCode]string{ - EACHomeRecom: "home-recommendation", - EACHomeReq: "home-request", - EACOtherPoly: "other-poly", - EACRefInt: "referral-internal", - EACRefExt: "referral-external", - EACDecease: "decease", - } -} diff --git a/internal/domain/references/person/person.go b/internal/domain/references/person/person.go index eef0a7a2..74afbb8d 100644 --- a/internal/domain/references/person/person.go +++ b/internal/domain/references/person/person.go @@ -48,18 +48,18 @@ const ( ) const ( - ECTidakSekolah EducationCode = "TS" - ECTK EducationCode = "TK" - ECSD EducationCode = "SD" - ECSLTP EducationCode = "SMP" - ECSLTA EducationCode = "SMA" - ECD1 EducationCode = "D1" - ECD2 EducationCode = "D2" - ECD3 EducationCode = "D3" - ECD4 EducationCode = "D4" - ECS1 EducationCode = "S1" - ECS2 EducationCode = "S2" - ECS3 EducationCode = "S3" + ECTS EducationCode = "TS" + ECTK EducationCode = "TK" + ECSD EducationCode = "SD" + ECSLTP EducationCode = "SMP" + ECSLTA EducationCode = "SMA" + ECD1 EducationCode = "D1" + ECD2 EducationCode = "D2" + ECD3 EducationCode = "D3" + ECD4 EducationCode = "D4" + ECS1 EducationCode = "S1" + ECS2 EducationCode = "S2" + ECS3 EducationCode = "S3" ) const ( @@ -160,22 +160,22 @@ func GetReligionCodes() map[ReligionCode]string { func GetEducationCodes() map[EducationCode]string { return map[EducationCode]string{ - ECTidakSekolah: "Tidak Sekolah", - ECTK: "TK", - ECSD: "SD", - ECSLTP: "SMP sederajat", - ECSLTA: "SMP sederajat", - ECD1: "D1 sederajat", - ECD2: "D2 sederajat", - ECD3: "D3 sederajat", - ECD4: "D4 sederajat", - ECS1: "S1", - ECS2: "S3", - ECS3: "S3", + ECTS: "Tidak Sekolah", + ECTK: "TK", + ECSD: "SD", + ECSLTP: "SMP sederajat", + ECSLTA: "SMP sederajat", + ECD1: "D1 sederajat", + ECD2: "D2 sederajat", + ECD3: "D3 sederajat", + ECD4: "D4 sederajat", + ECS1: "S1", + ECS2: "S3", + ECS3: "S3", } } -func GetProfessions() map[OcupationCode]string { +func GetOcupationCodes() map[OcupationCode]string { return map[OcupationCode]string{ OCTidakBekerja: "Tidak Bekerja", OCPns: "PNS", @@ -259,7 +259,7 @@ func (obj EducationCode) String() string { } func (obj OcupationCode) String() string { - return GetProfessions()[obj] + return GetOcupationCodes()[obj] } func (obj AgeGroupCode) String() string { diff --git a/internal/domain/references/queue/queue.go b/internal/domain/references/queue/queue.go deleted file mode 100644 index b36aa415..00000000 --- a/internal/domain/references/queue/queue.go +++ /dev/null @@ -1,3 +0,0 @@ -package queue - -const QueueName = "SABBI-QUEUE-" diff --git a/internal/domain/references/xtime/xtime.go b/internal/domain/references/xtime/xtime.go deleted file mode 100644 index ae15bd32..00000000 --- a/internal/domain/references/xtime/xtime.go +++ /dev/null @@ -1,31 +0,0 @@ -package xtime - -type ( - DayCode byte -) - -const ( - DCMinggu DayCode = iota - DCSenin - DCSelasa - DCRabu - DCKamis - DCJumat - DCSabtu -) - -func GetDayCodes() map[DayCode]string { - return map[DayCode]string{ - DCMinggu: "Minggu", - DCSenin: "Senin", - DCSelasa: "Selasa", - DCRabu: "Rabu", - DCKamis: "Kamis", - DCJumat: "Jumat", - DCSabtu: "Sabtu", - } -} - -func (obj DayCode) String() string { - return GetDayCodes()[obj] -} diff --git a/internal/use-case/main-use-case/authentication/case.go b/internal/use-case/main-use-case/authentication/case.go index 069958c7..70925827 100644 --- a/internal/use-case/main-use-case/authentication/case.go +++ b/internal/use-case/main-use-case/authentication/case.go @@ -65,9 +65,9 @@ func GenToken(input mu.LoginDto) (*d.Data, error) { user.LoginAttemptCount++ dg.I.Save(&user) return nil, d.FieldErrors{"authentication": d.FieldError{Code: "auth-login-incorrect", Message: el.GenMessage("auth-login-incorrect")}} - } else if user.Status_Code == erc.SCBlocked { + } else if user.Status_Code == erc.USCBlocked { return nil, d.FieldErrors{"authentication": d.FieldError{Code: "auth-login-blocked", Message: el.GenMessage("auth-login-blocked")}} - } else if user.Status_Code == erc.SCNew { + } else if user.Status_Code == erc.USCNew { return nil, d.FieldErrors{"authentication": d.FieldError{Code: "auth-login-unverified", Message: el.GenMessage("auth-login-unverified")}} } diff --git a/internal/use-case/main-use-case/user/case.go b/internal/use-case/main-use-case/user/case.go index fd252bac..c4f55985 100644 --- a/internal/use-case/main-use-case/user/case.go +++ b/internal/use-case/main-use-case/user/case.go @@ -297,7 +297,7 @@ func Block(input e.ReadDetailDto) (*d.Data, error) { if data != nil { pl.SetLogInfo(&event, rdDto, "started", "DBUpdate") - data.Status_Code = erc.SCBlocked + data.Status_Code = erc.USCBlocked if err := tx.Save(&data).Error; err != nil { return err } @@ -343,7 +343,7 @@ func Active(input e.ReadDetailDto) (*d.Data, error) { if data != nil { pl.SetLogInfo(&event, rdDto, "started", "DBUpdate") - data.Status_Code = erc.SCActive + data.Status_Code = erc.USCActive if err := tx.Save(&data).Error; err != nil { return err }