2023-07-08 08:43:30 -06:00
// THIS FILE IS GENERATED BY https://github.com/fastenhealth/fasten-onprem/blob/main/backend/pkg/models/database/generate.go
// PLEASE DO NOT EDIT BY HAND
package database
import (
"encoding/json"
"fmt"
goja "github.com/dop251/goja"
models "github.com/fastenhealth/fastenhealth-onprem/backend/pkg/models"
datatypes "gorm.io/datatypes"
"time"
)
type FhirOrganizationAffiliation struct {
models . ResourceBase
// Whether this organization affiliation record is in active use
// https://hl7.org/fhir/r4/search.html#token
Active datatypes . JSON ` gorm:"column:active;type:text;serializer:json" json:"active,omitempty" `
// The period during which the participatingOrganization is affiliated with the primary organization
// https://hl7.org/fhir/r4/search.html#date
2023-08-01 21:29:35 -06:00
Date * time . Time ` gorm:"column:date;type:datetime" json:"date,omitempty" `
2023-07-08 08:43:30 -06:00
// A value in an email contact
// https://hl7.org/fhir/r4/search.html#token
Email datatypes . JSON ` gorm:"column:email;type:text;serializer:json" json:"email,omitempty" `
// Technical endpoints providing access to services operated for this role
// https://hl7.org/fhir/r4/search.html#reference
Endpoint datatypes . JSON ` gorm:"column:endpoint;type:text;serializer:json" json:"endpoint,omitempty" `
// An organization affiliation's Identifier
// https://hl7.org/fhir/r4/search.html#token
Identifier datatypes . JSON ` gorm:"column:identifier;type:text;serializer:json" json:"identifier,omitempty" `
// Language of the resource content
// https://hl7.org/fhir/r4/search.html#token
Language datatypes . JSON ` gorm:"column:language;type:text;serializer:json" json:"language,omitempty" `
// When the resource version last changed
// https://hl7.org/fhir/r4/search.html#date
2023-08-01 21:29:35 -06:00
LastUpdated * time . Time ` gorm:"column:lastUpdated;type:datetime" json:"lastUpdated,omitempty" `
2023-07-08 08:43:30 -06:00
// The location(s) at which the role occurs
// https://hl7.org/fhir/r4/search.html#reference
Location datatypes . JSON ` gorm:"column:location;type:text;serializer:json" json:"location,omitempty" `
// Health insurance provider network in which the participatingOrganization provides the role's services (if defined) at the indicated locations (if defined)
// https://hl7.org/fhir/r4/search.html#reference
Network datatypes . JSON ` gorm:"column:network;type:text;serializer:json" json:"network,omitempty" `
// The organization that provides services to the primary organization
// https://hl7.org/fhir/r4/search.html#reference
ParticipatingOrganization datatypes . JSON ` gorm:"column:participatingOrganization;type:text;serializer:json" json:"participatingOrganization,omitempty" `
// A value in a phone contact
// https://hl7.org/fhir/r4/search.html#token
Phone datatypes . JSON ` gorm:"column:phone;type:text;serializer:json" json:"phone,omitempty" `
// The organization that receives the services from the participating organization
// https://hl7.org/fhir/r4/search.html#reference
PrimaryOrganization datatypes . JSON ` gorm:"column:primaryOrganization;type:text;serializer:json" json:"primaryOrganization,omitempty" `
// Profiles this resource claims to conform to
// https://hl7.org/fhir/r4/search.html#reference
Profile datatypes . JSON ` gorm:"column:profile;type:text;serializer:json" json:"profile,omitempty" `
// Definition of the role the participatingOrganization plays
// https://hl7.org/fhir/r4/search.html#token
Role datatypes . JSON ` gorm:"column:role;type:text;serializer:json" json:"role,omitempty" `
// Healthcare services provided through the role
// https://hl7.org/fhir/r4/search.html#reference
Service datatypes . JSON ` gorm:"column:service;type:text;serializer:json" json:"service,omitempty" `
// Specific specialty of the participatingOrganization in the context of the role
// https://hl7.org/fhir/r4/search.html#token
Specialty datatypes . JSON ` gorm:"column:specialty;type:text;serializer:json" json:"specialty,omitempty" `
// Tags applied to this resource
// https://hl7.org/fhir/r4/search.html#token
Tag datatypes . JSON ` gorm:"column:tag;type:text;serializer:json" json:"tag,omitempty" `
// The value in any kind of contact
// https://hl7.org/fhir/r4/search.html#token
Telecom datatypes . JSON ` gorm:"column:telecom;type:text;serializer:json" json:"telecom,omitempty" `
// Text search against the narrative
// https://hl7.org/fhir/r4/search.html#string
2023-07-30 22:40:25 -06:00
Text datatypes . JSON ` gorm:"column:text;type:text;serializer:json" json:"text,omitempty" `
2023-07-08 08:43:30 -06:00
// A resource type filter
// https://hl7.org/fhir/r4/search.html#special
Type datatypes . JSON ` gorm:"column:type;type:text;serializer:json" json:"type,omitempty" `
}
func ( s * FhirOrganizationAffiliation ) GetSearchParameters ( ) map [ string ] string {
searchParameters := map [ string ] string {
"active" : "token" ,
"date" : "date" ,
"email" : "token" ,
"endpoint" : "reference" ,
2023-08-23 13:24:08 -06:00
"id" : "keyword" ,
2023-07-08 08:43:30 -06:00
"identifier" : "token" ,
"language" : "token" ,
"lastUpdated" : "date" ,
"location" : "reference" ,
"network" : "reference" ,
"participatingOrganization" : "reference" ,
"phone" : "token" ,
"primaryOrganization" : "reference" ,
"profile" : "reference" ,
"role" : "token" ,
"service" : "reference" ,
2023-08-23 13:24:08 -06:00
"source_id" : "keyword" ,
"source_resource_id" : "keyword" ,
"source_resource_type" : "keyword" ,
"source_uri" : "keyword" ,
2023-07-08 08:43:30 -06:00
"specialty" : "token" ,
"tag" : "token" ,
"telecom" : "token" ,
"text" : "string" ,
"type" : "special" ,
}
return searchParameters
}
func ( s * FhirOrganizationAffiliation ) PopulateAndExtractSearchParameters ( resourceRaw json . RawMessage ) error {
s . ResourceRaw = datatypes . JSON ( resourceRaw )
// unmarshal the raw resource (bytes) into a map
var resourceRawMap map [ string ] interface { }
err := json . Unmarshal ( resourceRaw , & resourceRawMap )
if err != nil {
return err
}
if len ( fhirPathJs ) == 0 {
return fmt . Errorf ( "fhirPathJs script is empty" )
}
vm := goja . New ( )
// setup the global window object
vm . Set ( "window" , vm . NewObject ( ) )
// set the global FHIR Resource object
vm . Set ( "fhirResource" , resourceRawMap )
// compile the fhirpath library
fhirPathJsProgram , err := goja . Compile ( "fhirpath.min.js" , fhirPathJs , true )
if err != nil {
return err
}
// add the fhirpath library in the goja vm
_ , err = vm . RunProgram ( fhirPathJsProgram )
if err != nil {
return err
}
// execute the fhirpath expression for each search parameter
// extracting Active
activeResult , err := vm . RunString ( `
ActiveResult = window . fhirpath . evaluate ( fhirResource , ' OrganizationAffiliation . active ' )
ActiveProcessed = ActiveResult . reduce ( ( accumulator , currentValue ) = > {
if ( currentValue . coding ) {
//CodeableConcept
currentValue . coding . map ( ( coding ) = > {
accumulator . push ( {
"code" : coding . code ,
"system" : coding . system ,
"text" : currentValue . text
} )
} )
} else if ( currentValue . value ) {
//ContactPoint, Identifier
accumulator . push ( {
"code" : currentValue . value ,
"system" : currentValue . system ,
"text" : currentValue . type ? . text
} )
} else if ( currentValue . code ) {
//Coding
accumulator . push ( {
"code" : currentValue . code ,
"system" : currentValue . system ,
"text" : currentValue . display
} )
} else if ( ( typeof currentValue == = ' string ' ) || ( typeof currentValue == = ' boolean ' ) ) {
//string, boolean
accumulator . push ( {
"code" : currentValue ,
} )
}
return accumulator
} , [ ] )
2023-08-01 21:29:35 -06:00
if ( ActiveProcessed . length == 0 ) {
"undefined"
}
else {
JSON . stringify ( ActiveProcessed )
}
2023-07-08 08:43:30 -06:00
` )
if err == nil && activeResult . String ( ) != "undefined" {
s . Active = [ ] byte ( activeResult . String ( ) )
}
// extracting Date
dateResult , err := vm . RunString ( "window.fhirpath.evaluate(fhirResource, 'OrganizationAffiliation.period')[0]" )
if err == nil && dateResult . String ( ) != "undefined" {
t , err := time . Parse ( time . RFC3339 , dateResult . String ( ) )
if err == nil {
2023-08-01 21:29:35 -06:00
s . Date = & t
} else if err != nil {
d , err := time . Parse ( "2006-01-02" , dateResult . String ( ) )
if err == nil {
s . Date = & d
}
2023-07-08 08:43:30 -06:00
}
}
// extracting Email
emailResult , err := vm . RunString ( `
EmailResult = window . fhirpath . evaluate ( fhirResource , ' OrganizationAffiliation . telecom . where ( system = ' email ')' )
EmailProcessed = EmailResult . reduce ( ( accumulator , currentValue ) = > {
if ( currentValue . coding ) {
//CodeableConcept
currentValue . coding . map ( ( coding ) = > {
accumulator . push ( {
"code" : coding . code ,
"system" : coding . system ,
"text" : currentValue . text
} )
} )
} else if ( currentValue . value ) {
//ContactPoint, Identifier
accumulator . push ( {
"code" : currentValue . value ,
"system" : currentValue . system ,
"text" : currentValue . type ? . text
} )
} else if ( currentValue . code ) {
//Coding
accumulator . push ( {
"code" : currentValue . code ,
"system" : currentValue . system ,
"text" : currentValue . display
} )
} else if ( ( typeof currentValue == = ' string ' ) || ( typeof currentValue == = ' boolean ' ) ) {
//string, boolean
accumulator . push ( {
"code" : currentValue ,
} )
}
return accumulator
} , [ ] )
2023-08-01 21:29:35 -06:00
if ( EmailProcessed . length == 0 ) {
"undefined"
}
else {
JSON . stringify ( EmailProcessed )
}
2023-07-08 08:43:30 -06:00
` )
if err == nil && emailResult . String ( ) != "undefined" {
s . Email = [ ] byte ( emailResult . String ( ) )
}
// extracting Endpoint
2023-08-13 15:28:03 -06:00
endpointResult , err := vm . RunString ( `
EndpointResult = window . fhirpath . evaluate ( fhirResource , ' OrganizationAffiliation . endpoint ' )
if ( EndpointResult . length == 0 ) {
"undefined"
}
else {
JSON . stringify ( EndpointResult )
}
` )
2023-07-08 08:43:30 -06:00
if err == nil && endpointResult . String ( ) != "undefined" {
2023-08-13 15:28:03 -06:00
s . Endpoint = [ ] byte ( endpointResult . String ( ) )
2023-07-08 08:43:30 -06:00
}
// extracting Identifier
identifierResult , err := vm . RunString ( `
IdentifierResult = window . fhirpath . evaluate ( fhirResource , ' OrganizationAffiliation . identifier ' )
IdentifierProcessed = IdentifierResult . reduce ( ( accumulator , currentValue ) = > {
if ( currentValue . coding ) {
//CodeableConcept
currentValue . coding . map ( ( coding ) = > {
accumulator . push ( {
"code" : coding . code ,
"system" : coding . system ,
"text" : currentValue . text
} )
} )
} else if ( currentValue . value ) {
//ContactPoint, Identifier
accumulator . push ( {
"code" : currentValue . value ,
"system" : currentValue . system ,
"text" : currentValue . type ? . text
} )
} else if ( currentValue . code ) {
//Coding
accumulator . push ( {
"code" : currentValue . code ,
"system" : currentValue . system ,
"text" : currentValue . display
} )
} else if ( ( typeof currentValue == = ' string ' ) || ( typeof currentValue == = ' boolean ' ) ) {
//string, boolean
accumulator . push ( {
"code" : currentValue ,
} )
}
return accumulator
} , [ ] )
2023-08-01 21:29:35 -06:00
if ( IdentifierProcessed . length == 0 ) {
"undefined"
}
else {
JSON . stringify ( IdentifierProcessed )
}
2023-07-08 08:43:30 -06:00
` )
if err == nil && identifierResult . String ( ) != "undefined" {
s . Identifier = [ ] byte ( identifierResult . String ( ) )
}
// extracting Language
languageResult , err := vm . RunString ( `
2023-08-13 12:30:39 -06:00
LanguageResult = window . fhirpath . evaluate ( fhirResource , ' language ' )
2023-07-08 08:43:30 -06:00
LanguageProcessed = LanguageResult . reduce ( ( accumulator , currentValue ) = > {
if ( currentValue . coding ) {
//CodeableConcept
currentValue . coding . map ( ( coding ) = > {
accumulator . push ( {
"code" : coding . code ,
"system" : coding . system ,
"text" : currentValue . text
} )
} )
} else if ( currentValue . value ) {
//ContactPoint, Identifier
accumulator . push ( {
"code" : currentValue . value ,
"system" : currentValue . system ,
"text" : currentValue . type ? . text
} )
} else if ( currentValue . code ) {
//Coding
accumulator . push ( {
"code" : currentValue . code ,
"system" : currentValue . system ,
"text" : currentValue . display
} )
} else if ( ( typeof currentValue == = ' string ' ) || ( typeof currentValue == = ' boolean ' ) ) {
//string, boolean
accumulator . push ( {
"code" : currentValue ,
} )
}
return accumulator
} , [ ] )
2023-08-01 21:29:35 -06:00
if ( LanguageProcessed . length == 0 ) {
"undefined"
}
else {
JSON . stringify ( LanguageProcessed )
}
2023-07-08 08:43:30 -06:00
` )
if err == nil && languageResult . String ( ) != "undefined" {
s . Language = [ ] byte ( languageResult . String ( ) )
}
// extracting LastUpdated
2023-08-13 12:30:39 -06:00
lastUpdatedResult , err := vm . RunString ( "window.fhirpath.evaluate(fhirResource, 'meta.lastUpdated')[0]" )
2023-07-08 08:43:30 -06:00
if err == nil && lastUpdatedResult . String ( ) != "undefined" {
t , err := time . Parse ( time . RFC3339 , lastUpdatedResult . String ( ) )
if err == nil {
2023-08-01 21:29:35 -06:00
s . LastUpdated = & t
} else if err != nil {
d , err := time . Parse ( "2006-01-02" , lastUpdatedResult . String ( ) )
if err == nil {
s . LastUpdated = & d
}
2023-07-08 08:43:30 -06:00
}
}
// extracting Location
2023-08-13 15:28:03 -06:00
locationResult , err := vm . RunString ( `
LocationResult = window . fhirpath . evaluate ( fhirResource , ' OrganizationAffiliation . location ' )
if ( LocationResult . length == 0 ) {
"undefined"
}
else {
JSON . stringify ( LocationResult )
}
` )
2023-07-08 08:43:30 -06:00
if err == nil && locationResult . String ( ) != "undefined" {
2023-08-13 15:28:03 -06:00
s . Location = [ ] byte ( locationResult . String ( ) )
2023-07-08 08:43:30 -06:00
}
// extracting Network
2023-08-13 15:28:03 -06:00
networkResult , err := vm . RunString ( `
NetworkResult = window . fhirpath . evaluate ( fhirResource , ' OrganizationAffiliation . network ' )
if ( NetworkResult . length == 0 ) {
"undefined"
}
else {
JSON . stringify ( NetworkResult )
}
` )
2023-07-08 08:43:30 -06:00
if err == nil && networkResult . String ( ) != "undefined" {
2023-08-13 15:28:03 -06:00
s . Network = [ ] byte ( networkResult . String ( ) )
2023-07-08 08:43:30 -06:00
}
// extracting ParticipatingOrganization
2023-08-13 15:28:03 -06:00
participatingOrganizationResult , err := vm . RunString ( `
ParticipatingOrganizationResult = window . fhirpath . evaluate ( fhirResource , ' OrganizationAffiliation . participatingOrganization ' )
if ( ParticipatingOrganizationResult . length == 0 ) {
"undefined"
}
else {
JSON . stringify ( ParticipatingOrganizationResult )
}
` )
2023-07-08 08:43:30 -06:00
if err == nil && participatingOrganizationResult . String ( ) != "undefined" {
2023-08-13 15:28:03 -06:00
s . ParticipatingOrganization = [ ] byte ( participatingOrganizationResult . String ( ) )
2023-07-08 08:43:30 -06:00
}
// extracting Phone
phoneResult , err := vm . RunString ( `
PhoneResult = window . fhirpath . evaluate ( fhirResource , ' OrganizationAffiliation . telecom . where ( system = ' phone ')' )
PhoneProcessed = PhoneResult . reduce ( ( accumulator , currentValue ) = > {
if ( currentValue . coding ) {
//CodeableConcept
currentValue . coding . map ( ( coding ) = > {
accumulator . push ( {
"code" : coding . code ,
"system" : coding . system ,
"text" : currentValue . text
} )
} )
} else if ( currentValue . value ) {
//ContactPoint, Identifier
accumulator . push ( {
"code" : currentValue . value ,
"system" : currentValue . system ,
"text" : currentValue . type ? . text
} )
} else if ( currentValue . code ) {
//Coding
accumulator . push ( {
"code" : currentValue . code ,
"system" : currentValue . system ,
"text" : currentValue . display
} )
} else if ( ( typeof currentValue == = ' string ' ) || ( typeof currentValue == = ' boolean ' ) ) {
//string, boolean
accumulator . push ( {
"code" : currentValue ,
} )
}
return accumulator
} , [ ] )
2023-08-01 21:29:35 -06:00
if ( PhoneProcessed . length == 0 ) {
"undefined"
}
else {
JSON . stringify ( PhoneProcessed )
}
2023-07-08 08:43:30 -06:00
` )
if err == nil && phoneResult . String ( ) != "undefined" {
s . Phone = [ ] byte ( phoneResult . String ( ) )
}
// extracting PrimaryOrganization
2023-08-13 15:28:03 -06:00
primaryOrganizationResult , err := vm . RunString ( `
PrimaryOrganizationResult = window . fhirpath . evaluate ( fhirResource , ' OrganizationAffiliation . organization ' )
if ( PrimaryOrganizationResult . length == 0 ) {
"undefined"
}
else {
JSON . stringify ( PrimaryOrganizationResult )
}
` )
2023-07-08 08:43:30 -06:00
if err == nil && primaryOrganizationResult . String ( ) != "undefined" {
2023-08-13 15:28:03 -06:00
s . PrimaryOrganization = [ ] byte ( primaryOrganizationResult . String ( ) )
2023-07-08 08:43:30 -06:00
}
// extracting Profile
2023-08-13 15:28:03 -06:00
profileResult , err := vm . RunString ( `
ProfileResult = window . fhirpath . evaluate ( fhirResource , ' meta . profile ' )
if ( ProfileResult . length == 0 ) {
"undefined"
}
else {
JSON . stringify ( ProfileResult )
}
` )
2023-07-08 08:43:30 -06:00
if err == nil && profileResult . String ( ) != "undefined" {
2023-08-13 15:28:03 -06:00
s . Profile = [ ] byte ( profileResult . String ( ) )
2023-07-08 08:43:30 -06:00
}
// extracting Role
roleResult , err := vm . RunString ( `
RoleResult = window . fhirpath . evaluate ( fhirResource , ' OrganizationAffiliation . code ' )
RoleProcessed = RoleResult . reduce ( ( accumulator , currentValue ) = > {
if ( currentValue . coding ) {
//CodeableConcept
currentValue . coding . map ( ( coding ) = > {
accumulator . push ( {
"code" : coding . code ,
"system" : coding . system ,
"text" : currentValue . text
} )
} )
} else if ( currentValue . value ) {
//ContactPoint, Identifier
accumulator . push ( {
"code" : currentValue . value ,
"system" : currentValue . system ,
"text" : currentValue . type ? . text
} )
} else if ( currentValue . code ) {
//Coding
accumulator . push ( {
"code" : currentValue . code ,
"system" : currentValue . system ,
"text" : currentValue . display
} )
} else if ( ( typeof currentValue == = ' string ' ) || ( typeof currentValue == = ' boolean ' ) ) {
//string, boolean
accumulator . push ( {
"code" : currentValue ,
} )
}
return accumulator
} , [ ] )
2023-08-01 21:29:35 -06:00
if ( RoleProcessed . length == 0 ) {
"undefined"
}
else {
JSON . stringify ( RoleProcessed )
}
2023-07-08 08:43:30 -06:00
` )
if err == nil && roleResult . String ( ) != "undefined" {
s . Role = [ ] byte ( roleResult . String ( ) )
}
// extracting Service
2023-08-13 15:28:03 -06:00
serviceResult , err := vm . RunString ( `
ServiceResult = window . fhirpath . evaluate ( fhirResource , ' OrganizationAffiliation . healthcareService ' )
if ( ServiceResult . length == 0 ) {
"undefined"
}
else {
JSON . stringify ( ServiceResult )
}
` )
2023-07-08 08:43:30 -06:00
if err == nil && serviceResult . String ( ) != "undefined" {
2023-08-13 15:28:03 -06:00
s . Service = [ ] byte ( serviceResult . String ( ) )
2023-07-08 08:43:30 -06:00
}
// extracting Specialty
specialtyResult , err := vm . RunString ( `
SpecialtyResult = window . fhirpath . evaluate ( fhirResource , ' OrganizationAffiliation . specialty ' )
SpecialtyProcessed = SpecialtyResult . reduce ( ( accumulator , currentValue ) = > {
if ( currentValue . coding ) {
//CodeableConcept
currentValue . coding . map ( ( coding ) = > {
accumulator . push ( {
"code" : coding . code ,
"system" : coding . system ,
"text" : currentValue . text
} )
} )
} else if ( currentValue . value ) {
//ContactPoint, Identifier
accumulator . push ( {
"code" : currentValue . value ,
"system" : currentValue . system ,
"text" : currentValue . type ? . text
} )
} else if ( currentValue . code ) {
//Coding
accumulator . push ( {
"code" : currentValue . code ,
"system" : currentValue . system ,
"text" : currentValue . display
} )
} else if ( ( typeof currentValue == = ' string ' ) || ( typeof currentValue == = ' boolean ' ) ) {
//string, boolean
accumulator . push ( {
"code" : currentValue ,
} )
}
return accumulator
} , [ ] )
2023-08-01 21:29:35 -06:00
if ( SpecialtyProcessed . length == 0 ) {
"undefined"
}
else {
JSON . stringify ( SpecialtyProcessed )
}
2023-07-08 08:43:30 -06:00
` )
if err == nil && specialtyResult . String ( ) != "undefined" {
s . Specialty = [ ] byte ( specialtyResult . String ( ) )
}
// extracting Tag
tagResult , err := vm . RunString ( `
2023-08-13 12:30:39 -06:00
TagResult = window . fhirpath . evaluate ( fhirResource , ' meta . tag ' )
2023-07-08 08:43:30 -06:00
TagProcessed = TagResult . reduce ( ( accumulator , currentValue ) = > {
if ( currentValue . coding ) {
//CodeableConcept
currentValue . coding . map ( ( coding ) = > {
accumulator . push ( {
"code" : coding . code ,
"system" : coding . system ,
"text" : currentValue . text
} )
} )
} else if ( currentValue . value ) {
//ContactPoint, Identifier
accumulator . push ( {
"code" : currentValue . value ,
"system" : currentValue . system ,
"text" : currentValue . type ? . text
} )
} else if ( currentValue . code ) {
//Coding
accumulator . push ( {
"code" : currentValue . code ,
"system" : currentValue . system ,
"text" : currentValue . display
} )
} else if ( ( typeof currentValue == = ' string ' ) || ( typeof currentValue == = ' boolean ' ) ) {
//string, boolean
accumulator . push ( {
"code" : currentValue ,
} )
}
return accumulator
} , [ ] )
2023-08-01 21:29:35 -06:00
if ( TagProcessed . length == 0 ) {
"undefined"
}
else {
JSON . stringify ( TagProcessed )
}
2023-07-08 08:43:30 -06:00
` )
if err == nil && tagResult . String ( ) != "undefined" {
s . Tag = [ ] byte ( tagResult . String ( ) )
}
// extracting Telecom
telecomResult , err := vm . RunString ( `
TelecomResult = window . fhirpath . evaluate ( fhirResource , ' OrganizationAffiliation . telecom ' )
TelecomProcessed = TelecomResult . reduce ( ( accumulator , currentValue ) = > {
if ( currentValue . coding ) {
//CodeableConcept
currentValue . coding . map ( ( coding ) = > {
accumulator . push ( {
"code" : coding . code ,
"system" : coding . system ,
"text" : currentValue . text
} )
} )
} else if ( currentValue . value ) {
//ContactPoint, Identifier
accumulator . push ( {
"code" : currentValue . value ,
"system" : currentValue . system ,
"text" : currentValue . type ? . text
} )
} else if ( currentValue . code ) {
//Coding
accumulator . push ( {
"code" : currentValue . code ,
"system" : currentValue . system ,
"text" : currentValue . display
} )
} else if ( ( typeof currentValue == = ' string ' ) || ( typeof currentValue == = ' boolean ' ) ) {
//string, boolean
accumulator . push ( {
"code" : currentValue ,
} )
}
return accumulator
} , [ ] )
2023-08-01 21:29:35 -06:00
if ( TelecomProcessed . length == 0 ) {
"undefined"
}
else {
JSON . stringify ( TelecomProcessed )
}
2023-07-08 08:43:30 -06:00
` )
if err == nil && telecomResult . String ( ) != "undefined" {
s . Telecom = [ ] byte ( telecomResult . String ( ) )
}
return nil
}
// TableName overrides the table name from fhir_observations (pluralized) to `fhir_observation`. https://gorm.io/docs/conventions.html#TableName
func ( s * FhirOrganizationAffiliation ) TableName ( ) string {
return "fhir_organization_affiliation"
}