diff --git a/frontend/src/lib/models/resources/explanation-of-benefit-model.ts b/frontend/src/lib/models/resources/explanation-of-benefit-model.ts index f8c0304b..e9aeb15a 100644 --- a/frontend/src/lib/models/resources/explanation-of-benefit-model.ts +++ b/frontend/src/lib/models/resources/explanation-of-benefit-model.ts @@ -5,8 +5,14 @@ import {fhirVersions, ResourceType} from '../constants'; import {FastenOptions} from '../fasten/fasten-options'; import * as _ from "lodash"; import {CodingModel} from '../datatypes/coding-model'; +import * as fhirpath from 'fhirpath'; export class ExplanationOfBenefitModel extends FastenDisplayModel { + code: CodableConceptModel | undefined + code_text: string | undefined + code_id: string | undefined + code_system: string | undefined + disposition: string | undefined created: string | undefined @@ -96,6 +102,15 @@ export class ExplanationOfBenefitModel extends FastenDisplayModel { }; r4DTO(fhirResource){ + let principalDiagnosis = fhirpath.evaluate(fhirResource, "ExplanationOfBenefit.diagnosis.where(type.coding.code='principal').first().diagnosisCodeableConcept.first()") + + if(principalDiagnosis.length > 0) { + this.code = principalDiagnosis[0] as CodableConceptModel + this.code_text = principalDiagnosis[0]?.coding?.display + this.code_id = principalDiagnosis[0]?.coding?.code + this.code_system = principalDiagnosis[0]?.coding?.system + } + this.type = _.get(fhirResource, 'type.coding', []); this.hasType = Array.isArray(this.type) && this.type.length > 0; this.resourceStatus = _.get(fhirResource, 'status'); diff --git a/go.mod b/go.mod index 35678783..c8a59c5a 100644 --- a/go.mod +++ b/go.mod @@ -7,8 +7,8 @@ require ( github.com/dave/jennifer v1.6.1 github.com/dominikbraun/graph v0.15.0 github.com/dop251/goja v0.0.0-20230605162241-28ee0ee714f3 - github.com/fastenhealth/fasten-sources v0.3.2 - github.com/fastenhealth/gofhir-models v0.0.5 + github.com/fastenhealth/fasten-sources v0.3.3 + github.com/fastenhealth/gofhir-models v0.0.6 github.com/gin-gonic/gin v1.9.0 github.com/glebarez/sqlite v1.5.0 github.com/golang-jwt/jwt/v4 v4.4.2 @@ -111,3 +111,5 @@ require ( ) //replace github.com/fastenhealth/fasten-sources => ../fasten-sources +// +//replace github.com/fastenhealth/gofhir-models => ../gofhir-models diff --git a/go.sum b/go.sum index 17273b2f..506e273b 100644 --- a/go.sum +++ b/go.sum @@ -197,10 +197,10 @@ github.com/evanphx/json-patch v4.2.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLi github.com/evanphx/json-patch v4.5.0+incompatible h1:ouOWdg56aJriqS0huScTkVXPC5IcNrDCXZ6OoTAWu7M= github.com/evanphx/json-patch v4.5.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/evanphx/json-patch/v5 v5.6.0 h1:b91NhWfaz02IuVxO9faSllyAtNXHMPkC5J8sJCLunww= -github.com/fastenhealth/fasten-sources v0.3.2 h1:AdFayvwu88zO5JmMNhxlZDARZW1q6iBNHl9Ew8BSLHs= -github.com/fastenhealth/fasten-sources v0.3.2/go.mod h1:KUtpp65GaKlpRvl5i8zWTVZlI1yJaUPkvGVqQVEC21w= -github.com/fastenhealth/gofhir-models v0.0.5 h1:wU2Dz+/h9MzZCTRgkQzeq5l0EFuMI6C5xgCbKislFpg= -github.com/fastenhealth/gofhir-models v0.0.5/go.mod h1:xB8ikGxu3bUq2b1JYV+CZpHqBaLXpOizFR0eFBCunis= +github.com/fastenhealth/fasten-sources v0.3.3 h1:JI8fuXd6Cuq21T4aATLDS26Ubdy3foALFrQ/wa1Ylc8= +github.com/fastenhealth/fasten-sources v0.3.3/go.mod h1:YxgwR6jSEU+edYqEDkm238n7HlvZdW3i04nIh7gSDaM= +github.com/fastenhealth/gofhir-models v0.0.6 h1:yJYYaV1eJtHiGEfA1rXLsyOm/9hIi6s2cGoZzGfW1tM= +github.com/fastenhealth/gofhir-models v0.0.6/go.mod h1:xB8ikGxu3bUq2b1JYV+CZpHqBaLXpOizFR0eFBCunis= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w=