feat: add CPONE patient registration endpoint

This commit is contained in:
2026-09-07 16:25:32 +07:00
parent aae3c733ae
commit c5a959742b
11 changed files with 665 additions and 79 deletions

View File

@@ -27,6 +27,10 @@ type PatientRepository interface {
StoreMedrec(ctx context.Context, params repository.MedrecParams) (repository.MedrecOutcome, error)
}
type RegistrationRepository interface {
RegisterPatient(ctx context.Context, params repository.RegistrationParams) (repository.RegistrationOutcome, error)
}
type LabResultRepository interface {
GetLabResult(ctx context.Context, labNumber string) (repository.LabResultOutcome, error)
}
@@ -63,6 +67,7 @@ type Handler struct {
layananRepo LayananRepository
labRepo LabRegistrationRepository
patientRepo PatientRepository
registrationRepo RegistrationRepository
labResultRepo LabResultRepository
paketRepo PaketRepository
tarifRepo TarifKerjasamaRepository
@@ -71,12 +76,14 @@ type Handler struct {
perusahaanRepo PerusahaanRepository
dokterRepo DokterRepository
hospitalCode string
departmentID string
}
type CPONERepository interface {
LayananRepository
LabRegistrationRepository
PatientRepository
RegistrationRepository
LabResultRepository
PaketRepository
TarifKerjasamaRepository
@@ -88,15 +95,18 @@ type CPONERepository interface {
func NewHandler(repo CPONERepository) Handler {
return Handler{
layananRepo: repo, labRepo: repo, patientRepo: repo,
layananRepo: repo, labRepo: repo, patientRepo: repo, registrationRepo: repo,
labResultRepo: repo, paketRepo: repo, tarifRepo: repo,
periodeTarifRepo: repo, periodeTarifDetailRepo: repo, perusahaanRepo: repo,
dokterRepo: repo,
}
}
func NewDynamicHandler(hospitalCode string) Handler {
return Handler{hospitalCode: strings.ToUpper(strings.TrimSpace(hospitalCode))}
func NewDynamicHandler(hospitalCode string, departmentID string) Handler {
return Handler{
hospitalCode: strings.ToUpper(strings.TrimSpace(hospitalCode)),
departmentID: strings.TrimSpace(departmentID),
}
}
func (h Handler) layananRepository(ctx context.Context) LayananRepository {
@@ -120,6 +130,13 @@ func (h Handler) patientRepository(ctx context.Context) PatientRepository {
return h.patientRepo
}
func (h Handler) registrationRepository(ctx context.Context) RegistrationRepository {
if repo, ok := selectedRepository(ctx); ok {
return repo
}
return h.registrationRepo
}
func (h Handler) labResultRepository(ctx context.Context) LabResultRepository {
if repo, ok := selectedRepository(ctx); ok {
return repo