SATU SEHAT

This commit is contained in:
2025-09-02 05:28:55 +07:00
parent 2db9195c89
commit bd231b5919
3 changed files with 216 additions and 30 deletions

View File

@@ -1,5 +1,4 @@
// Code generated by swaggo/swag. DO NOT EDIT.
// Package docs Code generated by swaggo/swag. DO NOT EDIT
package docs
import "github.com/swaggo/swag"
@@ -1874,6 +1873,8 @@ var SwaggerInfo = &swag.Spec{
Description: "A comprehensive Go API service with Swagger documentation",
InfoInstanceName: "swagger",
SwaggerTemplate: docTemplate,
LeftDelim: "{{",
RightDelim: "}}",
}
func init() {

View File

@@ -0,0 +1,199 @@
# Satu Sehat FHIR Services Configuration
global:
module_name: "api-service"
output_dir: "internal/handlers"
enable_swagger: true
enable_logging: true
enable_metrics: true
enable_auth: true
base_url: "https://api-satusehat-stg.dto.kemkes.go.id/fhir-r4/v1"
version: "1.0.0"
environment: "staging"
fhir_version: "FHIR R4"
profile_url: "https://fhir.kemkes.go.id/r4/StructureDefinition"
services:
patient:
name: "Patient"
category: "fhir/patient"
package: "patient"
description: "FHIR Patient resource management for Satu Sehat ecosystem"
base_url: "https://api-satusehat-stg.dto.kemkes.go.id/fhir-r4/v1"
timeout: 30
retry_count: 3
fhir_resource: "Patient"
validation:
enable_fhir_validation: true
required_fields: ["resourceType", "identifier"]
custom_validators: ["validateNIK", "validateKTP"]
authentication:
type: "oauth2"
token_url: "https://api-satusehat-stg.dto.kemkes.go.id/oauth2/v1/accesstoken"
scopes: ["patient.read", "patient.write"]
endpoints:
patient:
basic:
methods: ["GET", "POST", "PUT", "PATCH", "DELETE", "SEARCH"]
get_path: "/:id"
post_path: ""
put_path: "/:id"
patch_path: "/:id"
delete_path: "/:id"
search_path: ""
model: "PatientCreateRequest"
response_model: "PatientResponse"
description: "Manage FHIR Patient resources"
summary: "Patient Resource Management"
tags: ["Patient", "FHIR"]
require_auth: true
cache_enabled: true
cache_ttl: 300
fhir_profiles: ["https://fhir.kemkes.go.id/r4/StructureDefinition/Patient"]
search_params: ["identifier", "name", "gender", "birthdate", "address"]
organization:
name: "Organization"
category: "fhir/organization"
package: "organization"
description: "FHIR Organization resource management for Satu Sehat ecosystem"
base_url: "https://api-satusehat-stg.dto.kemkes.go.id/fhir-r4/v1"
timeout: 30
retry_count: 3
fhir_resource: "Organization"
validation:
enable_fhir_validation: true
required_fields: ["resourceType", "name"]
authentication:
type: "oauth2"
token_url: "https://api-satusehat-stg.dto.kemkes.go.id/oauth2/v1/accesstoken"
scopes: ["organization.read", "organization.write"]
endpoints:
organization:
basic:
methods: ["GET", "POST", "PUT", "PATCH", "DELETE", "SEARCH"]
get_path: "/:id"
post_path: ""
put_path: "/:id"
patch_path: "/:id"
delete_path: "/:id"
search_path: ""
model: "OrganizationCreateRequest"
response_model: "OrganizationResponse"
description: "Manage FHIR Organization resources"
summary: "Organization Resource Management"
tags: ["Organization", "FHIR"]
require_auth: true
cache_enabled: true
cache_ttl: 600
fhir_profiles: ["https://fhir.kemkes.go.id/r4/StructureDefinition/Organization"]
search_params: ["identifier", "name", "type", "address"]
practitioner:
name: "Practitioner"
category: "fhir/practitioner"
package: "practitioner"
description: "FHIR Practitioner resource management for Satu Sehat ecosystem"
base_url: "https://api-satusehat-stg.dto.kemkes.go.id/fhir-r4/v1"
timeout: 30
retry_count: 3
fhir_resource: "Practitioner"
validation:
enable_fhir_validation: true
required_fields: ["resourceType", "name"]
authentication:
type: "oauth2"
token_url: "https://api-satusehat-stg.dto.kemkes.go.id/oauth2/v1/accesstoken"
scopes: ["practitioner.read", "practitioner.write"]
endpoints:
practitioner:
basic:
methods: ["GET", "POST", "PUT", "PATCH", "DELETE", "SEARCH"]
get_path: "/:id"
post_path: ""
put_path: "/:id"
patch_path: "/:id"
delete_path: "/:id"
search_path: ""
model: "PractitionerCreateRequest"
response_model: "PractitionerResponse"
description: "Manage FHIR Practitioner resources"
summary: "Practitioner Resource Management"
tags: ["Practitioner", "FHIR"]
require_auth: true
cache_enabled: true
cache_ttl: 600
fhir_profiles: ["https://fhir.kemkes.go.id/r4/StructureDefinition/Practitioner"]
search_params: ["identifier", "name", "qualification"]
encounter:
name: "Encounter"
category: "fhir/encounter"
package: "encounter"
description: "FHIR Encounter resource management for Satu Sehat ecosystem"
base_url: "https://api-satusehat-stg.dto.kemkes.go.id/fhir-r4/v1"
timeout: 45
retry_count: 3
fhir_resource: "Encounter"
validation:
enable_fhir_validation: true
required_fields: ["resourceType", "status", "subject"]
authentication:
type: "oauth2"
token_url: "https://api-satusehat-stg.dto.kemkes.go.id/oauth2/v1/accesstoken"
scopes: ["encounter.read", "encounter.write"]
endpoints:
encounter:
basic:
methods: ["GET", "POST", "PUT", "PATCH", "DELETE", "SEARCH"]
get_path: "/:id"
post_path: ""
put_path: "/:id"
patch_path: "/:id"
delete_path: "/:id"
search_path: ""
model: "EncounterCreateRequest"
response_model: "EncounterResponse"
description: "Manage FHIR Encounter resources"
summary: "Encounter Resource Management"
tags: ["Encounter", "FHIR"]
require_auth: true
cache_enabled: false
fhir_profiles: ["https://fhir.kemkes.go.id/r4/StructureDefinition/Encounter"]
search_params: ["patient", "subject", "status", "date", "practitioner"]
observation:
name: "Observation"
category: "fhir/observation"
package: "observation"
description: "FHIR Observation resource management for Satu Sehat ecosystem"
base_url: "https://api-satusehat-stg.dto.kemkes.go.id/fhir-r4/v1"
timeout: 30
retry_count: 3
fhir_resource: "Observation"
validation:
enable_fhir_validation: true
required_fields: ["resourceType", "status", "code", "subject"]
authentication:
type: "oauth2"
token_url: "https://api-satusehat-stg.dto.kemkes.go.id/oauth2/v1/accesstoken"
scopes: ["observation.read", "observation.write"]
endpoints:
observation:
basic:
methods: ["GET", "POST", "PUT", "PATCH", "DELETE", "SEARCH"]
get_path: "/:id"
post_path: ""
put_path: "/:id"
patch_path: "/:id"
delete_path: "/:id"
search_path: ""
model: "ObservationCreateRequest"
response_model: "ObservationResponse"
description: "Manage FHIR Observation resources"
summary: "Observation Resource Management"
tags: ["Observation", "FHIR"]
require_auth: true
cache_enabled: true
cache_ttl: 180
fhir_profiles: ["https://fhir.kemkes.go.id/r4/StructureDefinition/Observation"]
search_params: ["patient", "subject", "code", "date", "category"]

View File

@@ -188,14 +188,10 @@ func New{{.ServiceName}}Handler(cfg {{.ServiceName}}HandlerConfig) *{{.ServiceNa
// @Description {{.Description}}
// @Tags {{join .Tags ","}}
// @Accept json
// @Produce json
{{if .RequireAuth}}
// @Security ApiKeyAuth
{{end}}
// @Param X-Request-ID header string false "Request ID for tracking"
{{range .PathParams}}
// @Param {{.}} path string true "{{.}}" example("example_value")
{{end}}
// @Produce json {{if .RequireAuth}}
// @Security ApiKeyAuth {{end}}
// @Param X-Request-ID header string false "Request ID for tracking" {{range .PathParams}}
// @Param {{.}} path string true "{{.}}" example("example_value") {{end}}
// @Success 200 {object} {{.ModelPackage}}.{{.ResponseModel}} "Successfully retrieved {{.Name}} data"
// @Failure 400 {object} models.ErrorResponseBpjs "Bad request - invalid parameters"
// @Failure 401 {object} models.ErrorResponseBpjs "Unauthorized - invalid API credentials"
@@ -280,10 +276,8 @@ func (h *{{$.ServiceName}}Handler) Get{{.Name}}(c *gin.Context) {
// @Description {{.Description}}
// @Tags {{join .Tags ","}}
// @Accept json
// @Produce json
{{if .RequireAuth}}
// @Security ApiKeyAuth
{{end}}
// @Produce json {{if .RequireAuth}}
// @Security ApiKeyAuth {{end}}
// @Param X-Request-ID header string false "Request ID for tracking"
// @Param request body {{.ModelPackage}}.{{.Model}} true "{{.Name}} data"
// @Success 201 {object} {{.ModelPackage}}.{{.ResponseModel}} "Successfully created {{.Name}}"
@@ -371,14 +365,10 @@ func (h *{{$.ServiceName}}Handler) Create{{.Name}}(c *gin.Context) {
// @Description {{.Description}}
// @Tags {{join .Tags ","}}
// @Accept json
// @Produce json
{{if .RequireAuth}}
// @Security ApiKeyAuth
{{end}}
// @Param X-Request-ID header string false "Request ID for tracking"
{{range .PathParams}}
// @Param {{.}} path string true "{{.}}" example("example_value")
{{end}}
// @Produce json {{if .RequireAuth}}
// @Security ApiKeyAuth {{end}}
// @Param X-Request-ID header string false "Request ID for tracking" {{range .PathParams}}
// @Param {{.}} path string true "{{.}}" example("example_value") {{end}}
// @Param request body {{.ModelPackage}}.{{.Model}} true "{{.Name}} data"
// @Success 200 {object} {{.ModelPackage}}.{{.ResponseModel}} "Successfully updated {{.Name}}"
// @Failure 400 {object} models.ErrorResponseBpjs "Bad request - invalid parameters or request body"
@@ -490,14 +480,10 @@ func (h *{{$.ServiceName}}Handler) Update{{.Name}}(c *gin.Context) {
// @Description {{.Description}}
// @Tags {{join .Tags ","}}
// @Accept json
// @Produce json
{{if .RequireAuth}}
// @Security ApiKeyAuth
{{end}}
// @Param X-Request-ID header string false "Request ID for tracking"
{{range .PathParams}}
// @Param {{.}} path string true "{{.}}" example("example_value")
{{end}}
// @Produce json {{if .RequireAuth}}
// @Security ApiKeyAuth {{end}}
// @Param X-Request-ID header string false "Request ID for tracking" {{range .PathParams}}
// @Param {{.}} path string true "{{.}}" example("example_value") {{end}}
// @Success 200 {object} {{.ModelPackage}}.{{.ResponseModel}} "Successfully deleted {{.Name}}"
// @Failure 400 {object} models.ErrorResponseBpjs "Bad request - invalid parameters"
// @Failure 401 {object} models.ErrorResponseBpjs "Unauthorized - invalid API credentials"