update All feture and service

This commit is contained in:
meninjar
2026-06-03 02:54:26 +00:00
parent af32d9cfdd
commit ce0fa1a291
98 changed files with 272469 additions and 1606 deletions

No files matched your search

+22 -33
View File
@@ -1,7 +1,6 @@
package condition
import (
"os"
"time"
"service/internal/interfaces/satusehat"
@@ -10,14 +9,9 @@ import (
func MapRequestToFHIR(req ConditionRequest) satusehat.FHIRPayload {
payload := satusehat.NewFHIRPayload("Condition")
orgID := os.Getenv("SATUSEHAT_ORG_ID")
if orgID == "" {
orgID = req.OrganizationID
}
if orgID != "" && req.ConditionID != "" {
if req.OrganizationID != "" && req.ConditionID != "" {
payload.Set("identifier", []map[string]interface{}{
{"system": "http://sys-ids.kemkes.go.id/condition/" + orgID, "use": "official", "value": req.ConditionID},
{"system": "http://sys-ids.kemkes.go.id/condition/" + req.OrganizationID, "use": "official", "value": req.ConditionID},
})
}
@@ -28,48 +22,41 @@ func MapRequestToFHIR(req ConditionRequest) satusehat.FHIRPayload {
},
})
}
if req.Category != nil {
sys := req.Category.System
if req.CategoryCode != "" {
sys := req.CategorySystem
if sys == "" {
sys = "http://terminology.hl7.org/CodeSystem/condition-category"
}
coding := map[string]interface{}{
"system": sys,
"code": req.Category.Code,
"code": req.CategoryCode,
}
if req.Category.Display != "" {
coding["display"] = req.Category.Display
if req.CategoryDisplay != "" {
coding["display"] = req.CategoryDisplay
}
payload.Set("category", []map[string]interface{}{
{
"coding": []map[string]interface{}{
coding,
},
},
{"coding": []map[string]interface{}{coding}},
})
}
if req.Code != nil {
sys := req.Code.System
if req.Code != "" {
sys := req.CodeSystem
if sys == "" {
sys = "http://snomed.info/sct" // Default value jika tidak diset
sys = "http://hl7.org/fhir/sid/icd-10"
}
coding := map[string]interface{}{
"system": sys,
"code": req.Code.Code,
"code": req.Code,
}
if req.Code.Display != "" {
coding["display"] = req.Code.Display
if req.CodeDisplay != "" {
coding["display"] = req.CodeDisplay
}
codeConcept := map[string]interface{}{
"coding": []map[string]interface{}{
coding,
},
}
if req.Code.Text != "" {
codeConcept["text"] = req.Code.Text
}
payload.Set("code", codeConcept)
payload.Set("code", map[string]interface{}{
"coding": []map[string]interface{}{coding},
})
}
if req.PatientID != "" {
subject := map[string]interface{}{"reference": "Patient/" + req.PatientID}
if req.PatientName != "" {
@@ -77,9 +64,11 @@ func MapRequestToFHIR(req ConditionRequest) satusehat.FHIRPayload {
}
payload.Set("subject", subject)
}
if req.EncounterID != "" {
payload.Set("encounter", map[string]interface{}{"reference": "Encounter/" + req.EncounterID})
}
if req.OnsetDateTime != nil && !req.OnsetDateTime.IsZero() {
payload.Set("onsetDateTime", req.OnsetDateTime.Format(time.RFC3339))
}