Skip to content

Commit

Permalink
Fix barcode and extrnal link display
Browse files Browse the repository at this point in the history
leverage fhirpath
  • Loading branch information
ir4y committed Dec 13, 2024
1 parent 8747954 commit 020cdca
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
Consent,
Observation,
ServiceRequest,
Identifier,
} from 'fhir/r4b';
import _ from 'lodash';
import moment from 'moment';
Expand All @@ -23,6 +24,7 @@ import { PatientActivitySummary } from 'src/containers/PatientDetails/PatientAct
import { LinkToEdit } from 'src/containers/PatientDetails/PatientOverviewDynamic/components/LinkToEdit';
import { OverviewCard } from 'src/containers/PatientDetails/PatientOverviewDynamic/components/StandardCard/types';
import medicationIcon from 'src/containers/PatientDetails/PatientOverviewDynamic/images/medication.svg';
import { compileAsFirst } from 'src/utils';
import { formatHumanDate } from 'src/utils/date';

export function prepareAllergies(
Expand Down Expand Up @@ -323,6 +325,13 @@ export function prepareServiceRequest(
};
}

const getBarcode = compileAsFirst<ServiceRequest, string>(
"ServiceRequest.identifier.where(system='http://diagnostic-orders-are-us.com.au/ids/pgn').value",
);
const getSonicId = compileAsFirst<ServiceRequest, Identifier>(
"ServiceRequest.identifier.where(system='https://pyroserver.azurewebsites.net/pyro/ServiceRequest')",
);

export function prepareAuERequest(
serviceRequests: ServiceRequest[],
_provenanceList: Provenance[],
Expand All @@ -339,7 +348,7 @@ export function prepareAuERequest(
{
title: t`Barcode`,
key: 'id',
render: (resource: ServiceRequest) => resource.identifier?.[0]?.value ?? resource.id!,
render: (resource: ServiceRequest) => getBarcode(resource) ?? resource.id!,
width: 300,
},
{
Expand All @@ -358,7 +367,7 @@ export function prepareAuERequest(
title: t`External ids`,
key: 'externalid',
render: (r: ServiceRequest) => {
const identifier = r.identifier?.[0];
const identifier = getSonicId(r);
if (identifier) {
const { value, system } = identifier;
const srLink = `${system}/${value}`;
Expand Down

0 comments on commit 020cdca

Please sign in to comment.