Add MCU report endpoint and deployment tooling

This commit is contained in:
2026-09-25 06:49:58 +07:00
parent d881872206
commit dd62728316
14 changed files with 3841 additions and 2 deletions

View File

@@ -64,6 +64,10 @@ type DokterRepository interface {
ListDokter(ctx context.Context, params repository.DokterListParams) (repository.DokterPage, error)
}
type LaporanMCURepository interface {
ListLaporanMCU(ctx context.Context, params repository.LaporanMCUParams) ([]repository.LaporanMCURow, error)
}
type Handler struct {
layananRepo LayananRepository
labRepo LabRegistrationRepository
@@ -76,6 +80,7 @@ type Handler struct {
periodeTarifDetailRepo PeriodeTarifDetailRepository
perusahaanRepo PerusahaanRepository
dokterRepo DokterRepository
laporanMCURepo LaporanMCURepository
hospitalCode string
departmentID string
}
@@ -95,12 +100,19 @@ type CPONERepository interface {
}
func NewHandler(repo CPONERepository) Handler {
return Handler{
handler := Handler{
layananRepo: repo, labRepo: repo, patientRepo: repo, registrationRepo: repo,
labResultRepo: repo, paketRepo: repo, tarifRepo: repo,
periodeTarifRepo: repo, periodeTarifDetailRepo: repo, perusahaanRepo: repo,
dokterRepo: repo,
}
// Keep NewHandler source-compatible with repositories created before the
// MCU report was added. The concrete MySQL repository implements this
// optional capability and the dynamic production handler uses it.
if reportRepo, ok := any(repo).(LaporanMCURepository); ok {
handler.laporanMCURepo = reportRepo
}
return handler
}
func NewDynamicHandler(hospitalCode string, departmentID string) Handler {
@@ -187,6 +199,13 @@ func (h Handler) dokterRepository(ctx context.Context) DokterRepository {
return h.dokterRepo
}
func (h Handler) laporanMCURepository(ctx context.Context) LaporanMCURepository {
if repo, ok := selectedRepository(ctx); ok {
return repo
}
return h.laporanMCURepo
}
func (h Handler) MappingHarga(w http.ResponseWriter, r *http.Request) {
layananIDs := parseLayananIDs(r)
if len(layananIDs) == 0 {