Pembaruan

This commit is contained in:
2025-08-26 09:47:42 +07:00
parent fc0575af02
commit f2dbbd165e

View File

@@ -1312,23 +1312,23 @@ const (
)`
}
func generateOptimizedHl7FhirUpdateMethod(data Hl7FhirHandlerData) string {
var routePath, tagName string
if data.Category != "" {
routePath = "hl7fhir/" + data.Category + "/" + data.NameLower
tagParts := append([]string{"HL7FHIR"}, data.CategoryParts...)
tagParts = append(tagParts, strings.Title(data.NameLower))
tagName = strings.Join(tagParts, "-")
} else {
routePath = "hl7fhir/" + data.NameLower
tagName = "HL7FHIR-" + strings.Title(data.NameLower)
}
var routePath, tagName string
if data.Category != "" {
routePath = "hl7fhir/" + data.Category + "/" + data.NameLower
tagParts := append([]string{"HL7FHIR"}, data.CategoryParts...)
tagParts = append(tagParts, strings.Title(data.NameLower))
tagName = strings.Join(tagParts, "-")
} else {
routePath = "hl7fhir/" + data.NameLower
tagName = "HL7FHIR-" + strings.Title(data.NameLower)
}
profileTag := ""
if data.Profile != "" {
profileTag = fmt.Sprintf(" (%s Profile)", data.Profile)
}
profileTag := ""
if data.Profile != "" {
profileTag = fmt.Sprintf(" (%s Profile)", data.Profile)
}
return `
return `
// Update` + data.Name + ` updates (replaces) an existing HL7 FHIR ` + data.FhirResource + ` resource
// @Summary Update (replace) an existing HL7 FHIR ` + data.FhirResource + ` resource
@@ -1524,23 +1524,23 @@ func (h *` + data.Name + `Handler) Update` + data.Name + `(c *gin.Context) {
}
func generateOptimizedHl7FhirPatchMethod(data Hl7FhirHandlerData) string {
var routePath, tagName string
if data.Category != "" {
routePath = "hl7fhir/" + data.Category + "/" + data.NameLower
tagParts := append([]string{"HL7FHIR"}, data.CategoryParts...)
tagParts = append(tagParts, strings.Title(data.NameLower))
tagName = strings.Join(tagParts, "-")
} else {
routePath = "hl7fhir/" + data.NameLower
tagName = "HL7FHIR-" + strings.Title(data.NameLower)
}
var routePath, tagName string
if data.Category != "" {
routePath = "hl7fhir/" + data.Category + "/" + data.NameLower
tagParts := append([]string{"HL7FHIR"}, data.CategoryParts...)
tagParts = append(tagParts, strings.Title(data.NameLower))
tagName = strings.Join(tagParts, "-")
} else {
routePath = "hl7fhir/" + data.NameLower
tagName = "HL7FHIR-" + strings.Title(data.NameLower)
}
profileTag := ""
if data.Profile != "" {
profileTag = fmt.Sprintf(" (%s Profile)", data.Profile)
}
profileTag := ""
if data.Profile != "" {
profileTag = fmt.Sprintf(" (%s Profile)", data.Profile)
}
return `
return `
// Patch` + data.Name + ` partially updates an existing HL7 FHIR ` + data.FhirResource + ` resource
// @Summary Patch (partial update) an existing HL7 FHIR ` + data.FhirResource + ` resource
@@ -1716,23 +1716,23 @@ func (h *` + data.Name + `Handler) Patch` + data.Name + `(c *gin.Context) {
}
func generateOptimizedHl7FhirDeleteMethod(data Hl7FhirHandlerData) string {
var routePath, tagName string
if data.Category != "" {
routePath = "hl7fhir/" + data.Category + "/" + data.NameLower
tagParts := append([]string{"HL7FHIR"}, data.CategoryParts...)
tagParts = append(tagParts, strings.Title(data.NameLower))
tagName = strings.Join(tagParts, "-")
} else {
routePath = "hl7fhir/" + data.NameLower
tagName = "HL7FHIR-" + strings.Title(data.NameLower)
}
var routePath, tagName string
if data.Category != "" {
routePath = "hl7fhir/" + data.Category + "/" + data.NameLower
tagParts := append([]string{"HL7FHIR"}, data.CategoryParts...)
tagParts = append(tagParts, strings.Title(data.NameLower))
tagName = strings.Join(tagParts, "-")
} else {
routePath = "hl7fhir/" + data.NameLower
tagName = "HL7FHIR-" + strings.Title(data.NameLower)
}
profileTag := ""
if data.Profile != "" {
profileTag = fmt.Sprintf(" (%s Profile)", data.Profile)
}
profileTag := ""
if data.Profile != "" {
profileTag = fmt.Sprintf(" (%s Profile)", data.Profile)
}
return `
return `
// Delete` + data.Name + ` deletes an existing HL7 FHIR ` + data.FhirResource + ` resource
// @Summary Delete an existing HL7 FHIR ` + data.FhirResource + ` resource
@@ -1836,23 +1836,23 @@ func (h *` + data.Name + `Handler) Delete` + data.Name + `(c *gin.Context) {
}
func generateOptimizedHl7FhirGetMethod(data Hl7FhirHandlerData) string {
var routePath, tagName string
if data.Category != "" {
routePath = "hl7fhir/" + data.Category + "/" + data.NameLower
tagParts := append([]string{"HL7FHIR"}, data.CategoryParts...)
tagParts = append(tagParts, strings.Title(data.NameLower))
tagName = strings.Join(tagParts, "-")
} else {
routePath = "hl7fhir/" + data.NameLower
tagName = "HL7FHIR-" + strings.Title(data.NameLower)
}
var routePath, tagName string
if data.Category != "" {
routePath = "hl7fhir/" + data.Category + "/" + data.NameLower
tagParts := append([]string{"HL7FHIR"}, data.CategoryParts...)
tagParts = append(tagParts, strings.Title(data.NameLower))
tagName = strings.Join(tagParts, "-")
} else {
routePath = "hl7fhir/" + data.NameLower
tagName = "HL7FHIR-" + strings.Title(data.NameLower)
}
profileTag := ""
if data.Profile != "" {
profileTag = fmt.Sprintf(" (%s Profile)", data.Profile)
}
profileTag := ""
if data.Profile != "" {
profileTag = fmt.Sprintf(" (%s Profile)", data.Profile)
}
return `
return `
// Get` + data.Name + ` retrieves a specific HL7 FHIR ` + data.FhirResource + ` resource by ID
// @Summary Get a specific HL7 FHIR ` + data.FhirResource + ` resource by ID
@@ -1991,7 +1991,7 @@ func (h *` + data.Name + `Handler) Get` + data.Name + `(c *gin.Context) {
// Set response headers
if fhirResponse.Meta.VersionId != "" {
c.Header("ETag", fmt.Sprintf(`W/"%s"`, fhirResponse.Meta.VersionId))
c.Header("ETag", fmt.Sprintf("W/\"%s\"", fhirResponse.Meta.VersionId))
}
if fhirResponse.Meta.LastUpdated != "" {
@@ -2003,25 +2003,24 @@ func (h *` + data.Name + `Handler) Get` + data.Name + `(c *gin.Context) {
}`
}
func generateOptimizedHl7FhirHistoryMethod(data Hl7FhirHandlerData) string {
var routePath, tagName string
if data.Category != "" {
routePath = "hl7fhir/" + data.Category + "/" + data.NameLower
tagParts := append([]string{"HL7FHIR"}, data.CategoryParts...)
tagParts = append(tagParts, strings.Title(data.NameLower))
tagName = strings.Join(tagParts, "-")
} else {
routePath = "hl7fhir/" + data.NameLower
tagName = "HL7FHIR-" + strings.Title(data.NameLower)
}
var routePath, tagName string
if data.Category != "" {
routePath = "hl7fhir/" + data.Category + "/" + data.NameLower
tagParts := append([]string{"HL7FHIR"}, data.CategoryParts...)
tagParts = append(tagParts, strings.Title(data.NameLower))
tagName = strings.Join(tagParts, "-")
} else {
routePath = "hl7fhir/" + data.NameLower
tagName = "HL7FHIR-" + strings.Title(data.NameLower)
}
profileTag := ""
if data.Profile != "" {
profileTag = fmt.Sprintf(" (%s Profile)", data.Profile)
}
profileTag := ""
if data.Profile != "" {
profileTag = fmt.Sprintf(" (%s Profile)", data.Profile)
}
return `
return `
// History` + data.Name + ` retrieves the version history for a specific HL7 FHIR ` + data.FhirResource + ` resource
// @Summary Get version history for a specific HL7 FHIR ` + data.FhirResource + ` resource
@@ -2181,9 +2180,8 @@ func (h *` + data.Name + `Handler) History` + data.Name + `(c *gin.Context) {
}`
}
func generateHl7FhirUpdateRequestModel(data Hl7FhirHandlerData) string {
return `
return `
// ` + data.Name + ` UPDATE Request Structure with HL7 FHIR ` + data.FhirVersion + ` Validation
type ` + data.Name + `UpdateRequest struct {
@@ -2248,7 +2246,7 @@ func (r *` + data.Name + `UpdateRequest) ToJSON() (string, error) {
}
func generateHl7FhirPatchRequestModel(data Hl7FhirHandlerData) string {
return `
return `
// ` + data.Name + ` PATCH Request Structure with HL7 FHIR ` + data.FhirVersion + ` JSON Patch
type ` + data.Name + `PatchRequest struct {
@@ -2314,6 +2312,411 @@ func (r *` + data.Name + `PatchRequest) ToJSON() (string, error) {
}`
}
func generateHl7FhirCommonDataTypes(data Hl7FhirHandlerData) string {
return `
// ============================================================================
// Common HL7 FHIR Data Types for ` + data.FhirVersion + `
// These are reusable data types used across multiple FHIR resources
// Generated for: ` + data.FhirResource + ` | Path: ` + data.Category + `
// ============================================================================
// Narrative - Human-readable summary of the resource
type Hl7FhirNarrative struct {
Status string ` + "`json:\"status\" validate:\"required,oneof=generated extensions additional empty\"`" + `
Div string ` + "`json:\"div\" validate:\"required\"`" + ` // Limited XHTML content
}
// Extension - Additional content defined by implementations
type Hl7FhirExtension struct {
URL string ` + "`json:\"url\" validate:\"required,url\"`" + `
ValueBase64Binary *string ` + "`json:\"valueBase64Binary,omitempty\"`" + `
ValueBoolean *bool ` + "`json:\"valueBoolean,omitempty\"`" + `
ValueCanonical *string ` + "`json:\"valueCanonical,omitempty\" validate:\"omitempty,url\"`" + `
ValueCode *string ` + "`json:\"valueCode,omitempty\"`" + `
ValueDate *string ` + "`json:\"valueDate,omitempty\" validate:\"omitempty,datetime=2006-01-02\"`" + `
ValueDateTime *string ` + "`json:\"valueDateTime,omitempty\" validate:\"omitempty,datetime=2006-01-02T15:04:05Z07:00\"`" + `
ValueDecimal *float64 ` + "`json:\"valueDecimal,omitempty\"`" + `
ValueId *string ` + "`json:\"valueId,omitempty\"`" + `
ValueInstant *string ` + "`json:\"valueInstant,omitempty\" validate:\"omitempty,datetime=2006-01-02T15:04:05Z07:00\"`" + `
ValueInteger *int ` + "`json:\"valueInteger,omitempty\"`" + `
ValueMarkdown *string ` + "`json:\"valueMarkdown,omitempty\"`" + `
ValueOid *string ` + "`json:\"valueOid,omitempty\"`" + `
ValuePositiveInt *int ` + "`json:\"valuePositiveInt,omitempty\" validate:\"omitempty,min=1\"`" + `
ValueString *string ` + "`json:\"valueString,omitempty\"`" + `
ValueTime *string ` + "`json:\"valueTime,omitempty\" validate:\"omitempty,datetime=15:04:05\"`" + `
ValueUnsignedInt *int ` + "`json:\"valueUnsignedInt,omitempty\" validate:\"omitempty,min=0\"`" + `
ValueUri *string ` + "`json:\"valueUri,omitempty\" validate:\"omitempty,url\"`" + `
ValueUrl *string ` + "`json:\"valueUrl,omitempty\" validate:\"omitempty,url\"`" + `
ValueUuid *string ` + "`json:\"valueUuid,omitempty\" validate:\"omitempty,uuid\"`" + `
// Complex data types
ValueAddress *Hl7FhirAddress ` + "`json:\"valueAddress,omitempty\"`" + `
ValueAge *Hl7FhirAge ` + "`json:\"valueAge,omitempty\"`" + `
ValueAnnotation *Hl7FhirAnnotation ` + "`json:\"valueAnnotation,omitempty\"`" + `
ValueAttachment *Hl7FhirAttachment ` + "`json:\"valueAttachment,omitempty\"`" + `
ValueCodeableConcept *Hl7FhirCodeableConcept ` + "`json:\"valueCodeableConcept,omitempty\"`" + `
ValueCoding *Hl7FhirCoding ` + "`json:\"valueCoding,omitempty\"`" + `
ValueContactPoint *Hl7FhirContactPoint ` + "`json:\"valueContactPoint,omitempty\"`" + `
ValueCount *Hl7FhirCount ` + "`json:\"valueCount,omitempty\"`" + `
ValueDistance *Hl7FhirDistance ` + "`json:\"valueDistance,omitempty\"`" + `
ValueDuration *Hl7FhirDuration ` + "`json:\"valueDuration,omitempty\"`" + `
ValueHumanName *Hl7FhirHumanName ` + "`json:\"valueHumanName,omitempty\"`" + `
ValueIdentifier *Hl7FhirIdentifier ` + "`json:\"valueIdentifier,omitempty\"`" + `
ValueMoney *Hl7FhirMoney ` + "`json:\"valueMoney,omitempty\"`" + `
ValuePeriod *Hl7FhirPeriod ` + "`json:\"valuePeriod,omitempty\"`" + `
ValueQuantity *Hl7FhirQuantity ` + "`json:\"valueQuantity,omitempty\"`" + `
ValueRange *Hl7FhirRange ` + "`json:\"valueRange,omitempty\"`" + `
ValueRatio *Hl7FhirRatio ` + "`json:\"valueRatio,omitempty\"`" + `
ValueReference *Hl7FhirReference ` + "`json:\"valueReference,omitempty\"`" + `
ValueSampledData *Hl7FhirSampledData ` + "`json:\"valueSampledData,omitempty\"`" + `
ValueSignature *Hl7FhirSignature ` + "`json:\"valueSignature,omitempty\"`" + `
ValueTiming *Hl7FhirTiming ` + "`json:\"valueTiming,omitempty\"`" + `
ValueContactDetail *Hl7FhirContactDetail ` + "`json:\"valueContactDetail,omitempty\"`" + `
ValueContributor *Hl7FhirContributor ` + "`json:\"valueContributor,omitempty\"`" + `
ValueDataRequirement *Hl7FhirDataRequirement ` + "`json:\"valueDataRequirement,omitempty\"`" + `
ValueExpression *Hl7FhirExpression ` + "`json:\"valueExpression,omitempty\"`" + `
ValueParameterDefinition *Hl7FhirParameterDefinition ` + "`json:\"valueParameterDefinition,omitempty\"`" + `
ValueRelatedArtifact *Hl7FhirRelatedArtifact ` + "`json:\"valueRelatedArtifact,omitempty\"`" + `
ValueTriggerDefinition *Hl7FhirTriggerDefinition ` + "`json:\"valueTriggerDefinition,omitempty\"`" + `
ValueUsageContext *Hl7FhirUsageContext ` + "`json:\"valueUsageContext,omitempty\"`" + `
ValueDosage *Hl7FhirDosage ` + "`json:\"valueDosage,omitempty\"`" + `
}
// Coding - Reference to a code defined by a terminology system
type Hl7FhirCoding struct {
System string ` + "`json:\"system,omitempty\" validate:\"omitempty,url\"`" + `
Version string ` + "`json:\"version,omitempty\"`" + `
Code string ` + "`json:\"code,omitempty\"`" + `
Display string ` + "`json:\"display,omitempty\"`" + `
UserSelected *bool ` + "`json:\"userSelected,omitempty\"`" + `
}
// CodeableConcept - Concept defined by Coding(s) and/or text
type Hl7FhirCodeableConcept struct {
Coding []Hl7FhirCoding ` + "`json:\"coding,omitempty\" validate:\"dive\"`" + `
Text string ` + "`json:\"text,omitempty\"`" + `
}
// Reference - Reference to another resource
type Hl7FhirReference struct {
Reference string ` + "`json:\"reference,omitempty\"`" + `
Type string ` + "`json:\"type,omitempty\"`" + `
Identifier Hl7FhirIdentifier ` + "`json:\"identifier,omitempty\"`" + `
Display string ` + "`json:\"display,omitempty\"`" + `
}
// Identifier - Identifier for a resource
type Hl7FhirIdentifier struct {
Use string ` + "`json:\"use,omitempty\" validate:\"omitempty,oneof=usual official temp secondary old\"`" + `
Type Hl7FhirCodeableConcept ` + "`json:\"type,omitempty\"`" + `
System string ` + "`json:\"system,omitempty\" validate:\"omitempty,url\"`" + `
Value string ` + "`json:\"value,omitempty\"`" + `
Period Hl7FhirPeriod ` + "`json:\"period,omitempty\"`" + `
Assigner Hl7FhirReference ` + "`json:\"assigner,omitempty\"`" + `
}
// Period - Time range defined by start and end date/time
type Hl7FhirPeriod struct {
Start string ` + "`json:\"start,omitempty\" validate:\"omitempty,datetime=2006-01-02T15:04:05Z07:00\"`" + `
End string ` + "`json:\"end,omitempty\" validate:\"omitempty,datetime=2006-01-02T15:04:05Z07:00\"`" + `
}
// Quantity - Measured amount (or range of measured amounts)
type Hl7FhirQuantity struct {
Value float64 ` + "`json:\"value,omitempty\"`" + `
Comparator string ` + "`json:\"comparator,omitempty\" validate:\"omitempty,oneof=< <= >= > ad\"`" + `
Unit string ` + "`json:\"unit,omitempty\"`" + `
System string ` + "`json:\"system,omitempty\" validate:\"omitempty,url\"`" + `
Code string ` + "`json:\"code,omitempty\"`" + `
}
// Range - Set of values bounded by low and high
type Hl7FhirRange struct {
Low Hl7FhirQuantity ` + "`json:\"low,omitempty\"`" + `
High Hl7FhirQuantity ` + "`json:\"high,omitempty\"`" + `
}
// Ratio - Relationship between two quantities
type Hl7FhirRatio struct {
Numerator Hl7FhirQuantity ` + "`json:\"numerator,omitempty\"`" + `
Denominator Hl7FhirQuantity ` + "`json:\"denominator,omitempty\"`" + `
}
// SampledData - Data that comes from observations
type Hl7FhirSampledData struct {
Origin Hl7FhirQuantity ` + "`json:\"origin\" validate:\"required\"`" + `
Period float64 ` + "`json:\"period\" validate:\"required,min=0\"`" + `
Factor float64 ` + "`json:\"factor,omitempty\"`" + `
LowerLimit float64 ` + "`json:\"lowerLimit,omitempty\"`" + `
UpperLimit float64 ` + "`json:\"upperLimit,omitempty\"`" + `
Dimensions int ` + "`json:\"dimensions\" validate:\"required,min=1\"`" + `
Data string ` + "`json:\"data,omitempty\"`" + `
}
// Attachment - Content in a format defined elsewhere
type Hl7FhirAttachment struct {
ContentType string ` + "`json:\"contentType,omitempty\"`" + `
Language string ` + "`json:\"language,omitempty\" validate:\"omitempty,len=2\"`" + `
Data string ` + "`json:\"data,omitempty\"`" + `
Url string ` + "`json:\"url,omitempty\" validate:\"omitempty,url\"`" + `
Size int ` + "`json:\"size,omitempty\" validate:\"omitempty,min=0\"`" + `
Hash string ` + "`json:\"hash,omitempty\"`" + `
Title string ` + "`json:\"title,omitempty\"`" + `
Creation string ` + "`json:\"creation,omitempty\" validate:\"omitempty,datetime=2006-01-02T15:04:05Z07:00\"`" + `
Height int ` + "`json:\"height,omitempty\" validate:\"omitempty,min=1\"`" + `
Width int ` + "`json:\"width,omitempty\" validate:\"omitempty,min=1\"`" + `
Frames int ` + "`json:\"frames,omitempty\" validate:\"omitempty,min=1\"`" + `
Duration float64` + "`json:\"duration,omitempty\" validate:\"omitempty,min=0\"`" + `
Pages int ` + "`json:\"pages,omitempty\" validate:\"omitempty,min=1\"`" + `
}
// ContactPoint - Details for contacting
type Hl7FhirContactPoint struct {
System string ` + "`json:\"system,omitempty\" validate:\"omitempty,oneof=phone fax email pager url sms other\"`" + `
Value string ` + "`json:\"value,omitempty\"`" + `
Use string ` + "`json:\"use,omitempty\" validate:\"omitempty,oneof=home work temp old mobile\"`" + `
Rank int ` + "`json:\"rank,omitempty\" validate:\"omitempty,min=1\"`" + `
Period Hl7FhirPeriod ` + "`json:\"period,omitempty\"`" + `
}
// HumanName - Name of a human or other living entity
type Hl7FhirHumanName struct {
Use string ` + "`json:\"use,omitempty\" validate:\"omitempty,oneof=usual official temp nickname anonymous old maiden\"`" + `
Text string ` + "`json:\"text,omitempty\"`" + `
Family string ` + "`json:\"family,omitempty\"`" + `
Given []string ` + "`json:\"given,omitempty\"`" + `
Prefix []string ` + "`json:\"prefix,omitempty\"`" + `
Suffix []string ` + "`json:\"suffix,omitempty\"`" + `
Period Hl7FhirPeriod ` + "`json:\"period,omitempty\"`" + `
}
// Address - Postal address
type Hl7FhirAddress struct {
Use string ` + "`json:\"use,omitempty\" validate:\"omitempty,oneof=home work temp old billing\"`" + `
Type string ` + "`json:\"type,omitempty\" validate:\"omitempty,oneof=postal physical both\"`" + `
Text string ` + "`json:\"text,omitempty\"`" + `
Line []string ` + "`json:\"line,omitempty\"`" + `
City string ` + "`json:\"city,omitempty\"`" + `
District string ` + "`json:\"district,omitempty\"`" + `
State string ` + "`json:\"state,omitempty\"`" + `
PostalCode string ` + "`json:\"postalCode,omitempty\"`" + `
Country string ` + "`json:\"country,omitempty\" validate:\"omitempty,len=2\"`" + `
Period Hl7FhirPeriod ` + "`json:\"period,omitempty\"`" + `
}
// Age - Duration with context
type Hl7FhirAge struct {
Value float64 ` + "`json:\"value,omitempty\" validate:\"omitempty,min=0\"`" + `
Comparator string ` + "`json:\"comparator,omitempty\" validate:\"omitempty,oneof=< <= >= >\"`" + `
Unit string ` + "`json:\"unit,omitempty\"`" + `
System string ` + "`json:\"system,omitempty\" validate:\"omitempty,url\"`" + `
Code string ` + "`json:\"code,omitempty\"`" + `
}
// Count - Integer with units
type Hl7FhirCount struct {
Value int ` + "`json:\"value,omitempty\" validate:\"omitempty,min=0\"`" + `
Comparator string ` + "`json:\"comparator,omitempty\" validate:\"omitempty,oneof=< <= >= >\"`" + `
Unit string ` + "`json:\"unit,omitempty\"`" + `
System string ` + "`json:\"system,omitempty\" validate:\"omitempty,url\"`" + `
Code string ` + "`json:\"code,omitempty\"`" + `
}
// Distance - Length with units
type Hl7FhirDistance struct {
Value float64 ` + "`json:\"value,omitempty\" validate:\"omitempty,min=0\"`" + `
Comparator string ` + "`json:\"comparator,omitempty\" validate:\"omitempty,oneof=< <= >= >\"`" + `
Unit string ` + "`json:\"unit,omitempty\"`" + `
System string ` + "`json:\"system,omitempty\" validate:\"omitempty,url\"`" + `
Code string ` + "`json:\"code,omitempty\"`" + `
}
// Duration - Length of time
type Hl7FhirDuration struct {
Value float64 ` + "`json:\"value,omitempty\" validate:\"omitempty,min=0\"`" + `
Comparator string ` + "`json:\"comparator,omitempty\" validate:\"omitempty,oneof=< <= >= >\"`" + `
Unit string ` + "`json:\"unit,omitempty\"`" + `
System string ` + "`json:\"system,omitempty\" validate:\"omitempty,url\"`" + `
Code string ` + "`json:\"code,omitempty\"`" + `
}
// Money - Amount of economic utility
type Hl7FhirMoney struct {
Value float64 ` + "`json:\"value,omitempty\" validate:\"omitempty,min=0\"`" + `
Currency string ` + "`json:\"currency,omitempty\" validate:\"omitempty,len=3\"`" + `
}
// Annotation - Text node with attribution
type Hl7FhirAnnotation struct {
AuthorReference Hl7FhirReference ` + "`json:\"authorReference,omitempty\"`" + `
AuthorString string ` + "`json:\"authorString,omitempty\"`" + `
Time string ` + "`json:\"time,omitempty\" validate:\"omitempty,datetime=2006-01-02T15:04:05Z07:00\"`" + `
Text string ` + "`json:\"text\" validate:\"required\"`" + `
}
// Timing - When something happens
type Hl7FhirTiming struct {
Event []string ` + "`json:\"event,omitempty\"`" + `
Repeat Hl7FhirTimingRepeat ` + "`json:\"repeat,omitempty\"`" + `
Code Hl7FhirCodeableConcept` + "`json:\"code,omitempty\"`" + `
}
// TimingRepeat - When events repeat
type Hl7FhirTimingRepeat struct {
BoundsDuration Hl7FhirDuration ` + "`json:\"boundsDuration,omitempty\"`" + `
BoundsRange Hl7FhirRange ` + "`json:\"boundsRange,omitempty\"`" + `
BoundsPeriod Hl7FhirPeriod ` + "`json:\"boundsPeriod,omitempty\"`" + `
Count int ` + "`json:\"count,omitempty\" validate:\"omitempty,min=0\"`" + `
CountMax int ` + "`json:\"countMax,omitempty\" validate:\"omitempty,min=0\"`" + `
Duration float64 ` + "`json:\"duration,omitempty\" validate:\"omitempty,min=0\"`" + `
DurationMax float64 ` + "`json:\"durationMax,omitempty\" validate:\"omitempty,min=0\"`" + `
DurationUnit string ` + "`json:\"durationUnit,omitempty\" validate:\"omitempty,oneof=s min h d wk mo a\"`" + `
Frequency int ` + "`json:\"frequency,omitempty\" validate:\"omitempty,min=1\"`" + `
FrequencyMax int ` + "`json:\"frequencyMax,omitempty\" validate:\"omitempty,min=1\"`" + `
Period float64 ` + "`json:\"period,omitempty\" validate:\"omitempty,min=0\"`" + `
PeriodMax float64 ` + "`json:\"periodMax,omitempty\" validate:\"omitempty,min=0\"`" + `
PeriodUnit string ` + "`json:\"periodUnit,omitempty\" validate:\"omitempty,oneof=s min h d wk mo a\"`" + `
DayOfWeek []string ` + "`json:\"dayOfWeek,omitempty\"`" + `
TimeOfDay []string ` + "`json:\"timeOfDay,omitempty\"`" + `
When []string ` + "`json:\"when,omitempty\"`" + `
Offset int ` + "`json:\"offset,omitempty\" validate:\"omitempty,min=0\"`" + `
}
// ContactDetail - Contact details (See also ContactPoint)
type Hl7FhirContactDetail struct {
Name string ` + "`json:\"name,omitempty\"`" + `
Telecom []Hl7FhirContactPoint ` + "`json:\"telecom,omitempty\" validate:\"dive\"`" + `
}
// Contributor - Contributor information
type Hl7FhirContributor struct {
Type string ` + "`json:\"type\" validate:\"required,oneof=author editor reviewer endorser\"`" + `
Name string ` + "`json:\"name\" validate:\"required\"`" + `
Contact []Hl7FhirContactDetail ` + "`json:\"contact,omitempty\" validate:\"dive\"`" + `
}
// DataRequirement - Describes a required data item
type Hl7FhirDataRequirement struct {
Type string ` + "`json:\"type\" validate:\"required\"`" + `
Profile []string ` + "`json:\"profile,omitempty\"`" + `
SubjectCodeableConcept Hl7FhirCodeableConcept ` + "`json:\"subjectCodeableConcept,omitempty\"`" + `
SubjectReference Hl7FhirReference ` + "`json:\"subjectReference,omitempty\"`" + `
MustSupport []string ` + "`json:\"mustSupport,omitempty\"`" + `
CodeFilter []Hl7FhirDataRequirementCodeFilter ` + "`json:\"codeFilter,omitempty\"`" + `
DateFilter []Hl7FhirDataRequirementDateFilter ` + "`json:\"dateFilter,omitempty\"`" + `
Limit int ` + "`json:\"limit,omitempty\" validate:\"omitempty,min=1\"`" + `
Sort []Hl7FhirDataRequirementSort ` + "`json:\"sort,omitempty\"`" + `
}
// DataRequirementCodeFilter - Code filters specify additional constraints
type Hl7FhirDataRequirementCodeFilter struct {
Path string ` + "`json:\"path,omitempty\"`" + `
SearchParam string ` + "`json:\"searchParam,omitempty\"`" + `
ValueSet string ` + "`json:\"valueSet,omitempty\" validate:\"omitempty,url\"`" + `
Code []Hl7FhirCoding ` + "`json:\"code,omitempty\" validate:\"dive\"`" + `
}
// DataRequirementDateFilter - Date filters specify additional constraints
type Hl7FhirDataRequirementDateFilter struct {
Path string ` + "`json:\"path,omitempty\"`" + `
SearchParam string ` + "`json:\"searchParam,omitempty\"`" + `
ValueDateTime string ` + "`json:\"valueDateTime,omitempty\" validate:\"omitempty,datetime=2006-01-02T15:04:05Z07:00\"`" + `
ValuePeriod Hl7FhirPeriod ` + "`json:\"valuePeriod,omitempty\"`" + `
ValueDuration Hl7FhirDuration ` + "`json:\"valueDuration,omitempty\"`" + `
}
// DataRequirementSort - Specifies the order of the results
type Hl7FhirDataRequirementSort struct {
Path string ` + "`json:\"path\" validate:\"required\"`" + `
Direction string ` + "`json:\"direction\" validate:\"required,oneof=ascending descending\"`" + `
}
// Expression - Expression language
type Hl7FhirExpression struct {
Description string ` + "`json:\"description,omitempty\"`" + `
Name string ` + "`json:\"name,omitempty\"`" + `
Language string ` + "`json:\"language\" validate:\"required\"`" + `
Expression string ` + "`json:\"expression,omitempty\"`" + `
Reference string ` + "`json:\"reference,omitempty\" validate:\"omitempty,url\"`" + `
}
// ParameterDefinition - Definition of a parameter to a module
type Hl7FhirParameterDefinition struct {
Name string ` + "`json:\"name,omitempty\"`" + `
Use string ` + "`json:\"use\" validate:\"required,oneof=in out\"`" + `
Min int ` + "`json:\"min,omitempty\" validate:\"omitempty,min=0\"`" + `
Max string ` + "`json:\"max,omitempty\"`" + `
Documentation string ` + "`json:\"documentation,omitempty\"`" + `
Type string ` + "`json:\"type\" validate:\"required\"`" + `
Profile string ` + "`json:\"profile,omitempty\" validate:\"omitempty,url\"`" + `
}
// RelatedArtifact - Related artifacts such as additional documentation
type Hl7FhirRelatedArtifact struct {
Type string ` + "`json:\"type\" validate:\"required,oneof=documentation justification citation predecessor successor derived-from depends-on composed-of\"`" + `
Label string ` + "`json:\"label,omitempty\"`" + `
Display string ` + "`json:\"display,omitempty\"`" + `
Citation string ` + "`json:\"citation,omitempty\"`" + `
Url string ` + "`json:\"url,omitempty\" validate:\"omitempty,url\"`" + `
Document Hl7FhirAttachment ` + "`json:\"document,omitempty\"`" + `
Resource string ` + "`json:\"resource,omitempty\" validate:\"omitempty,url\"`" + `
}
// TriggerDefinition - Defines an expected trigger for a module
type Hl7FhirTriggerDefinition struct {
Type string ` + "`json:\"type\" validate:\"required,oneof=named-event periodic data-changed data-added data-modified data-removed data-accessed data-access-ended\"`" + `
Name string ` + "`json:\"name,omitempty\"`" + `
TimingTiming Hl7FhirTiming ` + "`json:\"timingTiming,omitempty\"`" + `
TimingReference Hl7FhirReference ` + "`json:\"timingReference,omitempty\"`" + `
TimingDate string ` + "`json:\"timingDate,omitempty\" validate:\"omitempty,datetime=2006-01-02\"`" + `
TimingDateTime string ` + "`json:\"timingDateTime,omitempty\" validate:\"omitempty,datetime=2006-01-02T15:04:05Z07:00\"`" + `
Data []Hl7FhirDataRequirement ` + "`json:\"data,omitempty\" validate:\"dive\"`" + `
Condition Hl7FhirExpression ` + "`json:\"condition,omitempty\"`" + `
}
// UsageContext - Describes the context of use for a conformance or knowledge resource
type Hl7FhirUsageContext struct {
Code Hl7FhirCoding ` + "`json:\"code\" validate:\"required\"`" + `
ValueCodeableConcept Hl7FhirCodeableConcept ` + "`json:\"valueCodeableConcept,omitempty\"`" + `
ValueQuantity Hl7FhirQuantity ` + "`json:\"valueQuantity,omitempty\"`" + `
ValueRange Hl7FhirRange ` + "`json:\"valueRange,omitempty\"`" + `
ValueReference Hl7FhirReference ` + "`json:\"valueReference,omitempty\"`" + `
}
// Dosage - How medication is/was taken or should be taken
type Hl7FhirDosage struct {
Sequence int ` + "`json:\"sequence,omitempty\" validate:\"omitempty,min=1\"`" + `
Text string ` + "`json:\"text,omitempty\"`" + `
AdditionalInstruction []Hl7FhirCodeableConcept ` + "`json:\"additionalInstruction,omitempty\" validate:\"dive\"`" + `
PatientInstruction string ` + "`json:\"patientInstruction,omitempty\"`" + `
Timing Hl7FhirTiming ` + "`json:\"timing,omitempty\"`" + `
AsNeededBoolean *bool ` + "`json:\"asNeededBoolean,omitempty\"`" + `
AsNeededCodeableConcept Hl7FhirCodeableConcept ` + "`json:\"asNeededCodeableConcept,omitempty\"`" + `
Site Hl7FhirCodeableConcept ` + "`json:\"site,omitempty\"`" + `
Route Hl7FhirCodeableConcept ` + "`json:\"route,omitempty\"`" + `
Method Hl7FhirCodeableConcept ` + "`json:\"method,omitempty\"`" + `
DoseAndRate []Hl7FhirDosageDoseAndRate ` + "`json:\"doseAndRate,omitempty\" validate:\"dive\"`" + `
MaxDosePerPeriod []Hl7FhirRatio ` + "`json:\"maxDosePerPeriod,omitempty\" validate:\"dive\"`" + `
MaxDosePerAdministration Hl7FhirQuantity ` + "`json:\"maxDosePerAdministration,omitempty\"`" + `
MaxDosePerLifetime Hl7FhirQuantity ` + "`json:\"maxDosePerLifetime,omitempty\"`" + `
}
// DosageDoseAndRate - Amount of medication administered
type Hl7FhirDosageDoseAndRate struct {
Type Hl7FhirCodeableConcept ` + "`json:\"type,omitempty\"`" + `
DoseRange Hl7FhirRange ` + "`json:\"doseRange,omitempty\"`" + `
DoseQuantity Hl7FhirQuantity ` + "`json:\"doseQuantity,omitempty\"`" + `
RateRatio Hl7FhirRatio ` + "`json:\"rateRatio,omitempty\"`" + `
RateRange Hl7FhirRange ` + "`json:\"rateRange,omitempty\"`" + `
RateQuantity Hl7FhirQuantity ` + "`json:\"rateQuantity,omitempty\"`" + `
}
// ============================================================================
// End of Common HL7 FHIR Data Types
// ============================================================================
`
}
// Continue with additional methods and model generation...
func writeFile(filename, content string) {