29 lines
874 B
Go
29 lines
874 B
Go
package diagnosticreport
|
|
|
|
import (
|
|
"encoding/json"
|
|
"fmt"
|
|
)
|
|
|
|
// TODO: Sesuaikan dengan payload internal API DiagnosticReport
|
|
func MapToInternalAPI(dbData *DiagnosticReportDB, orgID string) map[string]interface{} {
|
|
payload := map[string]interface{}{
|
|
"diagnosticreport_id": fmt.Sprintf("%d", dbData.IdxHasil),
|
|
"encounter_id": fmt.Sprintf("%d", dbData.IdxDaftar),
|
|
"patient_id": dbData.NoMR.String,
|
|
}
|
|
return payload
|
|
}
|
|
|
|
func MapToSyncLog(idx int64, fhirID string, reqPayload interface{}, respBody []byte, status string, errMsg string) DiagnosticReportSyncLog {
|
|
reqBytes, _ := json.MarshalIndent(reqPayload, "", " ")
|
|
return DiagnosticReportSyncLog{
|
|
IdxHasil: idx,
|
|
DiagnosticReportID: fhirID,
|
|
RequestPayload: string(reqBytes),
|
|
ResponsePayload: string(respBody),
|
|
Status: status,
|
|
ErrorMessage: errMsg,
|
|
}
|
|
}
|