From e364c742b2d0e04065d5bb96578da7ae1e2c21a3 Mon Sep 17 00:00:00 2001 From: dpurbosakti Date: Wed, 13 Aug 2025 14:26:41 +0700 Subject: [PATCH] add domain references --- internal/domain/references/common/common.go | 40 +++ .../digital-signature/digital-signature.go | 26 ++ .../references/examination/examination.go | 44 +++ 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 | 252 ++++++++++++++++++ internal/domain/references/queue/queue.go | 3 + internal/domain/references/xtime/xtime.go | 31 +++ 9 files changed, 594 insertions(+) create mode 100644 internal/domain/references/common/common.go create mode 100644 internal/domain/references/digital-signature/digital-signature.go create mode 100644 internal/domain/references/examination/examination.go create mode 100644 internal/domain/references/finance/finance.go create mode 100644 internal/domain/references/organization/organization.go create mode 100644 internal/domain/references/patient/patient.go create mode 100644 internal/domain/references/person/person.go create mode 100644 internal/domain/references/queue/queue.go create mode 100644 internal/domain/references/xtime/xtime.go diff --git a/internal/domain/references/common/common.go b/internal/domain/references/common/common.go new file mode 100644 index 00000000..3382267a --- /dev/null +++ b/internal/domain/references/common/common.go @@ -0,0 +1,40 @@ +package common + +type ( + YaTidakCode byte + SudahBelumCode byte + AktifSimpelCode byte + AktifAdvanceCode byte + TersediaCode byte + StatusCode string +) + +const ( + TTTidak YaTidakCode = iota + TTYa +) + +const ( + BSBelum SudahBelumCode = iota + BSSudah +) +const ( + ASCInaktif AktifSimpelCode = iota + ASCAktif +) +const ( + AACBaru AktifAdvanceCode = iota + AACAktif + AACBlokir + AACHapus +) + +const ( + TCTidakTersedia TersediaCode = iota + TCTersedia +) + +const ( + SCActive StatusCode = "active" + SCInactive StatusCode = "inactive" +) diff --git a/internal/domain/references/digital-signature/digital-signature.go b/internal/domain/references/digital-signature/digital-signature.go new file mode 100644 index 00000000..4c8f2fe9 --- /dev/null +++ b/internal/domain/references/digital-signature/digital-signature.go @@ -0,0 +1,26 @@ +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/examination/examination.go b/internal/domain/references/examination/examination.go new file mode 100644 index 00000000..4ca227db --- /dev/null +++ b/internal/domain/references/examination/examination.go @@ -0,0 +1,44 @@ +package examination + +type ( + ExaminationStatus string + ExaminationClass string + EmergencyClass string + InpatientClass string +) + +const ( + ExaminationStatusNew ExaminationStatus = "new" + ExaminationStatusNurse ExaminationStatus = "nurse assessment" + ExaminationStatusDoctor ExaminationStatus = "doctor assessment" + ExaminationStatusDone ExaminationStatus = "done" + ExaminationStatusCancel ExaminationStatus = "canceled" +) +const ( + IGD EmergencyClass = "igd" + Ponek EmergencyClass = "ponek" +) +const ( + ECAmbulatory ExaminationClass = "ambulatory" + ECInpatient ExaminationClass = "inpatient" + ECEmergency ExaminationClass = "emergency" + ECRadiology ExaminationClass = "radiology" +) + +func (ec ExaminationClass) Code() string { + switch ec { + case ECAmbulatory: + return "AMB" + case ECInpatient: + return "IMP" + case ECEmergency: + return "EMER" + default: + 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 new file mode 100644 index 00000000..bbf405e7 --- /dev/null +++ b/internal/domain/references/finance/finance.go @@ -0,0 +1,67 @@ +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 new file mode 100644 index 00000000..f8c7879e --- /dev/null +++ b/internal/domain/references/organization/organization.go @@ -0,0 +1,46 @@ +package organization + +type ( + PositionCode string + QueuePositionCode string +) + +const ( + PosReg PositionCode = "reg" + PosDoctor PositionCode = "doc" + PosNurse PositionCode = "nur" // DEPRECATED + PosAmbulatory PositionCode = "amb" // rawat jalan + PosEmergency PositionCode = "emg" // gawat darurat + PosNEC PositionCode = "eon" // ponek, cEONc + PosInpatient PositionCode = "inp" // rawat inap + PosICU PositionCode = "icu" + PosVK PositionCode = "vlk" + PosNeonatus PositionCode = "neo" + PosMidwife PositionCode = "mwf" + PosNutrition PositionCode = "nut" + PosAnesthesia PositionCode = "ans" + PosSurgery PositionCode = "sur" + + PosPharmacy PositionCode = "pha" + PosRadiology PositionCode = "rad" + PosLab PositionCode = "lab" + PosFinance PositionCode = "fin" + PosHRD PositionCode = "hrd" + PosOperator PositionCode = "opr" + PosAdmin PositionCode = "adm" + PosSystem PositionCode = "sys" +) + +const ( + CQPCRegistration QueuePositionCode = "reg" + CQPCPayment QueuePositionCode = "pay" + CQPCExamination QueuePositionCode = "exa" + CQPCMedicine QueuePositionCode = "med" + CQPCProcedure QueuePositionCode = "pro" + CQPCFinish QueuePositionCode = "fin" + CQPCRegSkip QueuePositionCode = "reg-ski" + CQPCPaySkip QueuePositionCode = "pay-ski" + CQPCExaSkip QueuePositionCode = "exa-ski" + CQPCMedSkip QueuePositionCode = "med-ski" + CQPCReschedule QueuePositionCode = "rse" +) diff --git a/internal/domain/references/patient/patient.go b/internal/domain/references/patient/patient.go new file mode 100644 index 00000000..4332eca0 --- /dev/null +++ b/internal/domain/references/patient/patient.go @@ -0,0 +1,85 @@ +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 new file mode 100644 index 00000000..fdd1a30b --- /dev/null +++ b/internal/domain/references/person/person.go @@ -0,0 +1,252 @@ +package person + +type ( + GenderCode string + BloodTypeCode string + MaritalStatusCode string + ReligionCode string + EducationCode string + ProfessionCode string + AgeGroupCode string + AgeGroupForMedicineCode string + RelativeCode string +) + +const ( + GCMale GenderCode = "male" + GCFemale GenderCode = "female" + GCOther GenderCode = "other" + GCUnknown GenderCode = "unknown" +) + +const ( + BTCAPositive BloodTypeCode = "A+" + BTCANegative BloodTypeCode = "A-" + BTCBPositive BloodTypeCode = "B+" + BTCBNegative BloodTypeCode = "B-" + BTCABPositive BloodTypeCode = "AB+" + BTCABNegative BloodTypeCode = "AB-" + BTCOPositive BloodTypeCode = "O+" + BTCONegative BloodTypeCode = "O-" +) + +const ( + MSCBelumKawin MaritalStatusCode = "S" + MSCKawin MaritalStatusCode = "M" + MSCCeraiHidup MaritalStatusCode = "D" + MSCCeraiMati MaritalStatusCode = "W" +) + +const ( + RCIslam ReligionCode = "islam" + RCProtestan ReligionCode = "protestan" + RCKatolik ReligionCode = "katolik" + RCHindu ReligionCode = "hindu" + RCBudha ReligionCode = "budha" + RCKonghucu ReligionCode = "konghucu" + RCPenghayat ReligionCode = "penghayat" +) + +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" +) + +const ( + PCTidakBekerja ProfessionCode = "-" + PCPns ProfessionCode = "pns" + PCTniPolri ProfessionCode = "tni-polri" + PCBumn ProfessionCode = "bumn" + PCWiraswasta ProfessionCode = "wiraswasta" + PCLainlain ProfessionCode = "lainnya" +) + +const ( + AGCEUnknown AgeGroupCode = "unkown" + AGCLTE5 AgeGroupCode = "LT5" + AGCEU19 AgeGroupCode = "UE19" + AGCEU29 AgeGroupCode = "UE29" + AGCEU39 AgeGroupCode = "UE39" + AGCEU49 AgeGroupCode = "UE49" + AGCEU59 AgeGroupCode = "UE50" + AGCGE60 AgeGroupCode = "E60" +) + +const ( + AGMCNew AgeGroupForMedicineCode = "new-born" + AGMCInfant AgeGroupForMedicineCode = "infant" + AGMCToddler AgeGroupForMedicineCode = "toddler" + AGMCKid AgeGroupForMedicineCode = "kid" + AGMCAdult AgeGroupForMedicineCode = "adult" +) + +const ( + RCMSuami RelativeCode = "suami" + RCMIstri RelativeCode = "istri" + RCMAnak RelativeCode = "anak" + RCMMenantu RelativeCode = "menantu" + RCMCucu RelativeCode = "cucu" + RCMOrangTua RelativeCode = "orang-tua" + RCMMertua RelativeCode = "mertua" + RCMAdik RelativeCode = "adik" + RCMKeponakan RelativeCode = "keponakan" + RCMKakak RelativeCode = "kakak" + RCMPaman RelativeCode = "paman" + RCMBibi RelativeCode = "bibi" + RCMPamanKakek RelativeCode = "kakek" + RCMPamanNenek RelativeCode = "nenek" +) + +func GetGenderCodes() map[GenderCode]string { + return map[GenderCode]string{ + GCMale: "Laki-laki", + GCFemale: "Perempuan", + GCOther: "Lainnya", + GCUnknown: "Tidak diketahui", + } +} + +func GetBloodTypeCodes() map[BloodTypeCode]string { + return map[BloodTypeCode]string{ + BTCAPositive: "A Positive", + BTCANegative: "A Negative", + BTCABPositive: "AB Positive", + BTCABNegative: "AB Negative", + BTCBPositive: "B Positive", + BTCBNegative: "B Negative", + BTCOPositive: "O Positive", + BTCONegative: "O Negative", + } +} + +func GetMaritalStatusCodes() map[MaritalStatusCode]string { + return map[MaritalStatusCode]string{ + MSCBelumKawin: "Belum Kawin", + MSCKawin: "Kawin", + MSCCeraiHidup: "Cerai Hidup", + MSCCeraiMati: "Cerai Mati", + } +} + +func GetReligionCodes() map[ReligionCode]string { + return map[ReligionCode]string{ + RCIslam: "Islam", + RCProtestan: "Kristen (Protestan)", + RCKatolik: "Katolik", + RCHindu: "Hindu", + RCBudha: "Budha", + RCKonghucu: "Konghucu", + RCPenghayat: "Penghayat", + } +} + +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", + } +} + +func GetProfessions() map[ProfessionCode]string { + return map[ProfessionCode]string{ + PCTidakBekerja: "Tidak Bekerja", + PCPns: "PNS", + PCTniPolri: "TNI/POLRI", + PCBumn: "BUMN", + PCWiraswasta: "Pegawai Swasta / Wirausaha", + PCLainlain: "Lain-lain", + } +} + +func GetAgeGroupCodes() map[AgeGroupCode]string { + return map[AgeGroupCode]string{ + AGCEUnknown: "unknown", + AGCLTE5: "<=5", + AGCEU19: "6-19", + AGCEU29: "20-29", + AGCEU39: "30-39", + AGCEU49: "40-49", + AGCEU59: "50-59", + AGCGE60: ">=60", + } +} + +func GetAgeGroupForMedicineCodes() map[AgeGroupForMedicineCode]string { + return map[AgeGroupForMedicineCode]string{ + AGMCNew: "new-born", + AGMCInfant: "infant", + AGMCToddler: "toddler", + AGMCKid: "kid", + AGMCAdult: "adult", + } +} + +func GetRelativeCodes() map[RelativeCode]string { + return map[RelativeCode]string{ + RCMSuami: "Suami", + RCMIstri: "Istri", + RCMAnak: "Anak", + RCMMenantu: "Menantu", + RCMCucu: "Cucu", + RCMOrangTua: "Orang Tua", + RCMMertua: "Mertua", + RCMAdik: "Adik", + RCMKeponakan: "Keponakan", + RCMKakak: "Kakak", + RCMPaman: "Paman", + RCMBibi: "Bibi", + RCMPamanKakek: "Kakek", + RCMPamanNenek: "Nenek", + } +} + +func (obj GenderCode) String() string { + return GetGenderCodes()[obj] +} + +func (obj BloodTypeCode) String() string { + return GetBloodTypeCodes()[obj] +} + +func (obj MaritalStatusCode) String() string { + return GetMaritalStatusCodes()[obj] +} + +func (obj ReligionCode) String() string { + return GetReligionCodes()[obj] +} +func (obj EducationCode) String() string { + return GetEducationCodes()[obj] +} + +func (obj ProfessionCode) String() string { + return GetProfessions()[obj] +} + +func (obj AgeGroupCode) String() string { + return GetAgeGroupCodes()[obj] +} + +func (obj RelativeCode) String() string { + return GetRelativeCodes()[obj] +} diff --git a/internal/domain/references/queue/queue.go b/internal/domain/references/queue/queue.go new file mode 100644 index 00000000..b36aa415 --- /dev/null +++ b/internal/domain/references/queue/queue.go @@ -0,0 +1,3 @@ +package queue + +const QueueName = "SABBI-QUEUE-" diff --git a/internal/domain/references/xtime/xtime.go b/internal/domain/references/xtime/xtime.go new file mode 100644 index 00000000..ae15bd32 --- /dev/null +++ b/internal/domain/references/xtime/xtime.go @@ -0,0 +1,31 @@ +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] +}