Add optimized doctor search endpoint

This commit is contained in:
2026-09-07 10:50:19 +07:00
parent 9afd5b792c
commit aae3c733ae
5 changed files with 329 additions and 0 deletions

View File

@@ -55,6 +55,10 @@ type PerusahaanRepository interface {
GetPerusahaanGroupTarif(ctx context.Context, id, groupTarifID string) (*repository.PerusahaanGroupTarifDetail, error)
}
type DokterRepository interface {
ListDokter(ctx context.Context, params repository.DokterListParams) (repository.DokterPage, error)
}
type Handler struct {
layananRepo LayananRepository
labRepo LabRegistrationRepository
@@ -65,6 +69,7 @@ type Handler struct {
periodeTarifRepo PeriodeTarifRepository
periodeTarifDetailRepo PeriodeTarifDetailRepository
perusahaanRepo PerusahaanRepository
dokterRepo DokterRepository
hospitalCode string
}
@@ -78,6 +83,7 @@ type CPONERepository interface {
PeriodeTarifRepository
PeriodeTarifDetailRepository
PerusahaanRepository
DokterRepository
}
func NewHandler(repo CPONERepository) Handler {
@@ -85,6 +91,7 @@ func NewHandler(repo CPONERepository) Handler {
layananRepo: repo, labRepo: repo, patientRepo: repo,
labResultRepo: repo, paketRepo: repo, tarifRepo: repo,
periodeTarifRepo: repo, periodeTarifDetailRepo: repo, perusahaanRepo: repo,
dokterRepo: repo,
}
}
@@ -155,6 +162,13 @@ func (h Handler) perusahaanRepository(ctx context.Context) PerusahaanRepository
return h.perusahaanRepo
}
func (h Handler) dokterRepository(ctx context.Context) DokterRepository {
if repo, ok := selectedRepository(ctx); ok {
return repo
}
return h.dokterRepo
}
func (h Handler) MappingHarga(w http.ResponseWriter, r *http.Request) {
layananIDs := parseLayananIDs(r)
if len(layananIDs) == 0 {