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

@@ -103,6 +103,36 @@ func TestRegisterLabValidPayloadAndResponseParity(t *testing.T) {
}
}
func TestRegisterLabUsesConfiguredDepartmentID(t *testing.T) {
repo := &fakeLabRegistrationRepository{outcome: repository.LabRegistrationOutcome{
HTTPStatus: http.StatusCreated,
Success: true,
Status: "registered",
Message: "Registrasi laboratorium berhasil disimpan",
}}
handler := Handler{labRepo: repo, departmentID: "MED-PNJ-LAB"}
body := `{
"medrec_id":"00001234",
"departemen_id":"DIABAIKAN",
"dokter_id":"DR01",
"dokter_pengirim_id":"DR02",
"jenis_pasien_id":"0",
"periode_tarif_id":10,
"diagnosa_kerja":"Pemeriksaan laboratorium"
}`
request := httptest.NewRequest(http.MethodPost, "/api/cpone/patients/lab-registration", strings.NewReader(body))
recorder := httptest.NewRecorder()
handler.RegisterLab(recorder, request)
if recorder.Code != http.StatusCreated {
t.Fatalf("status = %d; body=%s", recorder.Code, recorder.Body.String())
}
if repo.params.DepartmentID != "MED-PNJ-LAB" {
t.Fatalf("department ID = %q, want %q", repo.params.DepartmentID, "MED-PNJ-LAB")
}
}
func TestRegisterLabCompanyPayload(t *testing.T) {
repo := &fakeLabRegistrationRepository{outcome: repository.LabRegistrationOutcome{
HTTPStatus: http.StatusCreated,