Update Worker Satu Sehat

This commit is contained in:
meninjar
2026-04-14 05:14:09 +00:00
parent 35c101725f
commit 9a15d74283
162 changed files with 538 additions and 9489 deletions
+2 -125
View File
@@ -10,30 +10,12 @@ import (
"syscall"
"service/internal/auth"
antrol "service/internal/bpjs/antrol/reference"
aplicareBed "service/internal/bpjs/aplicare/bed"
apotekDpho "service/internal/bpjs/apotek/reference/dpho"
apotekPoli "service/internal/bpjs/apotek/reference/poli"
"service/internal/bpjs/vclaim/peserta"
"service/internal/bpjs/vclaim/sep"
"service/internal/infrastructure/cache"
"service/internal/infrastructure/config"
"service/internal/infrastructure/database"
grpcHandlers "service/internal/infrastructure/transport/grpc/handlers"
httpServer "service/internal/infrastructure/transport/http/servers"
bpjsFactory "service/internal/interfaces/bpjs"
"service/internal/interfaces/minio"
satuSehatFactory "service/internal/interfaces/satusehat"
satuSehatAuth "service/internal/satusehat/reference/auth"
satuSehatKfa "service/internal/satusehat/reference/kfa"
satuSehatLocation "service/internal/satusehat/reference/location"
satuSehatOrganization "service/internal/satusehat/reference/organization"
satuSehatPatient "service/internal/satusehat/reference/patient"
satuSehatPractitioner "service/internal/satusehat/reference/practitioner"
satuSehatCondition "service/internal/satusehat/usecase/condition"
satuSehatEncounter "service/internal/satusehat/usecase/encounter"
satuSehatProcedure "service/internal/satusehat/usecase/procedure"
"service/pkg/logger"
imagingStudyWorker "service/internal/worker/satusehat/imagingstudy"
@@ -169,69 +151,6 @@ func main() {
// roleComponentCmdRepo := roleComponent.NewCommandRepository(dbService, "postgres")
// roleComponentQueryRepo := roleComponent.NewQueryRepository(dbService, "postgres")
// roleComponentService := roleComponent.NewService(roleComponentCmdRepo, roleComponentQueryRepo)
// --- [NEW] Inisialisasi Modul CQRS Baru (Memanfaatkan DB Service) ---
// Contoh ketika mengimplementasikan entity "Province" atau "Person":
// provinceCmdRepo := province.NewCommandRepository(dbService, "default")
// provinceQueryRepo := province.NewQueryRepository(dbService, "default")
// provinceSvc := province.NewService(provinceCmdRepo, provinceQueryRepo)
// --- [NEW] Inisialisasi Factory BPJS ---
bpjsServices := bpjsFactory.NewBPJSFactory(cfg.Bpjs)
// 1. Modul VClaim (Lama)
vclaimServiceEngine := bpjsServices.VClaim()
sepRepo := sep.NewRepository(vclaimServiceEngine)
sepService := sep.NewService(sepRepo)
pesertaRepo := peserta.NewRepository(vclaimServiceEngine)
pesertaService := peserta.NewService(pesertaRepo)
// 2. Modul Antrean RS (Baru)
antreanClient := bpjsServices.AntreanRS()
antrolRepo := antrol.NewRepository(antreanClient)
antrolService := antrol.NewService(antrolRepo)
// 3. Modul Aplicares (Bed Ketersediaan Tempat Tidur)
aplicareClient := bpjsServices.Aplicare()
bedRepo := aplicareBed.NewRepository(aplicareClient)
bedService := aplicareBed.NewService(bedRepo)
// 4. Modul Apotek (Referensi DPHO dan Poli)
apotekClient := bpjsServices.Apotek()
dphoRepo := apotekDpho.NewRepository(apotekClient)
dphoService := apotekDpho.NewService(dphoRepo)
poliApotekRepo := apotekPoli.NewRepository(apotekClient)
poliApotekService := apotekPoli.NewService(poliApotekRepo)
// --- [NEW] Inisialisasi Modul Satu Sehat ---
satusehatFact := satuSehatFactory.NewSatuSehatFactory(cfg.SatuSehat)
satusehatClient := satusehatFact.Client()
satuSehatAuthSvc := satuSehatAuth.NewService(satusehatClient, cacheManager)
satuSehatPatientRepo := satuSehatPatient.NewRepository(satusehatClient)
satuSehatPatientSvc := satuSehatPatient.NewService(satuSehatPatientRepo)
satuSehatPractitionerRepo := satuSehatPractitioner.NewRepository(satusehatClient)
satuSehatPractitionerSvc := satuSehatPractitioner.NewService(satuSehatPractitionerRepo)
satuSehatOrganizationRepo := satuSehatOrganization.NewRepository(satusehatClient)
satuSehatOrganizationSvc := satuSehatOrganization.NewService(satuSehatOrganizationRepo)
satuSehatLocationRepo := satuSehatLocation.NewRepository(satusehatClient)
satuSehatLocationSvc := satuSehatLocation.NewService(satuSehatLocationRepo)
satuSehatKfaRepo := satuSehatKfa.NewRepository(satusehatClient)
satuSehatKfaSvc := satuSehatKfa.NewService(satuSehatKfaRepo)
satuSehatEncounterRepo := satuSehatEncounter.NewRepository(satusehatClient, dbService)
satuSehatEncounterSvc := satuSehatEncounter.NewService(satuSehatEncounterRepo)
satuSehatProcedureRepo := satuSehatProcedure.NewRepository(satusehatClient)
satuSehatProcedureSvc := satuSehatProcedure.NewService(satuSehatProcedureRepo)
satuSehatConditionRepo := satuSehatCondition.NewRepository(satusehatClient)
satuSehatConditionSvc := satuSehatCondition.NewService(satuSehatConditionRepo)
// 6. Server Orchestration (Dual Protocol & Background Workers)
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
@@ -273,48 +192,6 @@ func main() {
RolePermission: rolePermissionService,
RoleMaster: roleMasterService,
},
VClaim: &httpServer.VClaimServices{
Sep: sepService,
Peserta: pesertaService,
},
Antrol: &httpServer.AntrolServices{
Reference: antrolService,
},
Aplicare: &httpServer.AplicaresServices{
Bed: bedService,
},
Apotek: &httpServer.ApotekServices{
DPHO: dphoService,
Poli: poliApotekService,
},
SatuSehat: &httpServer.SatuSehatServices{
Auth: satuSehatAuthSvc,
Patient: satuSehatPatientSvc,
Practitioner: satuSehatPractitionerSvc,
Organization: satuSehatOrganizationSvc,
Location: satuSehatLocationSvc,
KFA: satuSehatKfaSvc,
Encounter: satuSehatEncounterSvc,
Procedure: satuSehatProcedureSvc,
Condition: satuSehatConditionSvc,
// TODO: Inisialisasi service sisanya di sini saat repo & service usecase lainnya sudah Anda buat, contoh:
// AllergyIntolerance: allergySvc,
// CarePlan: careplanSvc,
// ClinicalImpression: clinicalImpressionSvc,
// Composition: compositionSvc,
// DiagnosticReport: diagnosticReportSvc,
// EpisodeOfCare: episodeOfCareSvc,
// ImagingStudy: imagingStudySvc,
// Immunization: immunizationSvc,
// Medication: medicationSvc,
// MedicationDispense: medicationDispenseSvc,
// MedicationRequest: medicationRequestSvc,
// MedicationStatement: medicationStatementSvc,
// Observation: observationSvc,
// QuestionnaireResponse: questionnaireResponseSvc,
// ServiceRequest: serviceRequestSvc,
// Specimen: specimenSvc,
},
}
restSrv := httpServer.NewHTTPServer(&cfg.Server.REST, registry)
@@ -334,10 +211,10 @@ func main() {
serverCount++
// 1. Buat gRPC handlers
permissionHandler := grpcHandlers.NewPermissionHandler(rolePermissionService)
// permissionHandler := grpcHandlers.NewPermissionHandler(rolePermissionService)
// 2. Buat dan isi gRPC service registry
grpcRegistry := &grpcServers.ServiceRegistry{
PermissionHandler: permissionHandler,
// PermissionHandler: permissionHandler,
}
// 3. Buat gRPC server dengan registry yang sudah diisi