first commit
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
package allergyintolerance
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// TODO: Sesuaikan dengan payload internal API AllergyIntolerance
|
||||
func MapToInternalAPI(dbData *AllergyIntoleranceDB, orgID string) map[string]interface{} {
|
||||
payload := map[string]interface{}{
|
||||
"allergy_id": fmt.Sprintf("%d", dbData.IdxAlergi),
|
||||
"patient_id": dbData.NoMR.String, // Sebaiknya mapping ke IHS Number di service
|
||||
}
|
||||
return payload
|
||||
}
|
||||
|
||||
func MapToSyncLog(idx int64, fhirID string, reqPayload interface{}, respBody []byte, status string, errMsg string) AllergyIntoleranceSyncLog {
|
||||
reqBytes, _ := json.MarshalIndent(reqPayload, "", " ")
|
||||
return AllergyIntoleranceSyncLog{
|
||||
IdxAlergi: idx,
|
||||
AllergyIntoleranceID: fhirID,
|
||||
RequestPayload: string(reqBytes),
|
||||
ResponsePayload: string(respBody),
|
||||
Status: status,
|
||||
ErrorMessage: errMsg,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user