first commit

This commit is contained in:
meninjar
2026-04-14 01:21:54 +00:00
commit 35c101725f
443 changed files with 1245931 additions and 0 deletions
@@ -0,0 +1,35 @@
package immunization
import (
"encoding/json"
"fmt"
"time"
)
// TODO: Sesuaikan dengan payload internal API Immunization
func MapToInternalAPI(dbData *ImmunizationDB, orgID string) map[string]interface{} {
waktu := time.Now()
if dbData.TglImunisasi.Valid {
waktu = dbData.TglImunisasi.Time
}
payload := map[string]interface{}{
"immunization_id": fmt.Sprintf("%d", dbData.IdxImunisasi),
"encounter_id": fmt.Sprintf("%d", dbData.IdxDaftar),
"patient_id": dbData.NoMR.String,
"vaccine_code": dbData.KodeVaksin.String,
"occurrence_date": waktu.Format(time.RFC3339),
}
return payload
}
func MapToSyncLog(idx int64, fhirID string, reqPayload interface{}, respBody []byte, status string, errMsg string) ImmunizationSyncLog {
reqBytes, _ := json.MarshalIndent(reqPayload, "", " ")
return ImmunizationSyncLog{
IdxImunisasi: idx,
ImmunizationID: fhirID,
RequestPayload: string(reqBytes),
ResponsePayload: string(respBody),
Status: status,
ErrorMessage: errMsg,
}
}