fhir-react 0.3.4 → 0.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/bootstrap-reboot.min.css +8 -2
- package/build/index.js +7 -7
- package/build/style.css +4 -5
- package/package.json +1 -1
- package/src/assets/containers/Binary/binary.svg +9 -0
- package/src/components/containers/Accordion/Accordion.js +10 -9
- package/src/components/datatypes/Annotation/Annotation.js +4 -4
- package/src/components/datatypes/CodeableConcept/CodeableConcept.css +4 -1
- package/src/components/datatypes/Coding/Coding.css +0 -1
- package/src/components/datatypes/Reference/Reference.css +3 -0
- package/src/components/datatypes/Reference/Reference.js +2 -0
- package/src/components/resources/AllergyIntolerance/AllergyIntolerance.js +87 -76
- package/src/components/resources/AllergyIntolerance/AllergyIntolerance.stories.js +11 -1
- package/src/components/resources/Binary/Binary.js +31 -20
- package/src/components/resources/Binary/Binary.stories.js +6 -5
- package/src/components/resources/CarePlan/CarePlan.js +111 -96
- package/src/components/resources/CarePlan/CarePlan.test.js +2 -2
- package/src/components/resources/CarePlan/CarePlanActivity.js +6 -2
- package/src/components/resources/Device/Device.js +54 -34
- package/src/components/resources/DiagnosticReport/DiagnosticReport.js +53 -43
- package/src/components/resources/DiagnosticReport/DiagnosticReport.stories.js +7 -1
- package/src/components/resources/DocumentReference/DocumentReference.js +101 -65
- package/src/components/resources/DocumentReference/DocumentReference.stories.js +4 -0
- package/src/components/resources/FamilyMemberHistory/FamilyMemberHistory.js +47 -38
- package/src/components/resources/FamilyMemberHistory/FamilyMemberHistory.stories.js +4 -0
- package/src/components/resources/Goal/Goal.js +104 -85
- package/src/components/resources/Goal/Goal.stories.js +37 -7
- package/src/components/resources/Goal/Goal.test.js +1 -3
- package/src/components/resources/MedicationOrder/MedicationOrder.js +45 -28
- package/src/components/resources/MedicationOrder/MedicationOrder.stories.js +2 -1
- package/src/components/resources/MedicationRequest/MedicationRequest.js +65 -43
- package/src/components/resources/MedicationRequest/MedicationRequest.stories.js +16 -5
- package/src/components/resources/MedicationStatement/MedicationDetails.js +52 -0
- package/src/components/resources/MedicationStatement/MedicationDosage.js +46 -0
- package/src/components/resources/MedicationStatement/MedicationStatement.js +65 -118
- package/src/components/resources/MedicationStatement/MedicationStatement.stories.js +6 -0
- package/src/components/resources/MedicationStatement/MedicationStatement.test.js +31 -6
- package/src/components/ui/bootstrap-reboot.min.css +8 -2
- package/src/components/ui/index.js +11 -0
- package/src/fixtures/example-icons.jsx +7 -0
- package/src/style.scss +1 -0
- package/src/utils/formatDate.js +6 -4
- package/src/components/resources/AllergyIntolerance/AllergyIntolerance.css +0 -4
- package/src/components/resources/CarePlan/CarePlan.css +0 -7
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import _get from 'lodash/get';
|
|
4
|
+
import Accordion from '../../containers/Accordion/Accordion';
|
|
4
5
|
import Reference from '../../datatypes/Reference';
|
|
5
6
|
import CodeableConcept from '../../datatypes/CodeableConcept';
|
|
6
7
|
import Coding from '../../datatypes/Coding';
|
|
7
8
|
|
|
8
|
-
import { Root, Header,
|
|
9
|
+
import { Root, Header, Body } from '../../ui';
|
|
9
10
|
|
|
10
11
|
const MedicationOrder = props => {
|
|
11
|
-
const { fhirResource } = props;
|
|
12
|
+
const { fhirResource, fhirIcons } = props;
|
|
13
|
+
const headerIcon = fhirIcons && fhirIcons['Medication'];
|
|
12
14
|
const medicationReference = _get(fhirResource, 'medicationReference');
|
|
13
15
|
const medicationCodeableConcept = _get(
|
|
14
16
|
fhirResource,
|
|
@@ -22,34 +24,49 @@ const MedicationOrder = props => {
|
|
|
22
24
|
const dosageInstruction = _get(fhirResource, 'dosageInstruction');
|
|
23
25
|
const hasDosageInstruction =
|
|
24
26
|
Array.isArray(dosageInstruction) && dosageInstruction.length > 0;
|
|
27
|
+
|
|
28
|
+
const tableData = [
|
|
29
|
+
{
|
|
30
|
+
label: 'Medication',
|
|
31
|
+
testId: 'medication',
|
|
32
|
+
data: showMedicationCodeableConcept && (
|
|
33
|
+
<Coding fhirData={medicationCodeableConcept} />
|
|
34
|
+
),
|
|
35
|
+
status: showMedicationCodeableConcept,
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
label: 'Reason',
|
|
39
|
+
testId: 'reasonCode',
|
|
40
|
+
data: reasonCode && <CodeableConcept fhirData={reasonCode} />,
|
|
41
|
+
status: reasonCode,
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
label: 'Dosage',
|
|
45
|
+
testId: 'hasDosageInstruction',
|
|
46
|
+
data:
|
|
47
|
+
hasDosageInstruction &&
|
|
48
|
+
dosageInstruction.map((item, i) => (
|
|
49
|
+
<p key={`dosage-instruction-item-${i}`}>{item.text}</p>
|
|
50
|
+
)),
|
|
51
|
+
status: hasDosageInstruction,
|
|
52
|
+
},
|
|
53
|
+
];
|
|
25
54
|
return (
|
|
26
55
|
<Root name="MedicationOrder">
|
|
27
|
-
<
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
</Value>
|
|
42
|
-
)}
|
|
43
|
-
{hasDosageInstruction && (
|
|
44
|
-
<Value label="Dosage" data-testid="hasDosageInstruction">
|
|
45
|
-
<ul>
|
|
46
|
-
{dosageInstruction.map((item, i) => (
|
|
47
|
-
<li key={`item-${i}`}>{item.text}</li>
|
|
48
|
-
))}
|
|
49
|
-
</ul>
|
|
50
|
-
</Value>
|
|
51
|
-
)}
|
|
52
|
-
</Body>
|
|
56
|
+
<Accordion
|
|
57
|
+
headerContent={
|
|
58
|
+
<Header
|
|
59
|
+
icon={headerIcon}
|
|
60
|
+
resourceName="MedicationOrder"
|
|
61
|
+
title={
|
|
62
|
+
medicationReference && (
|
|
63
|
+
<Reference fhirData={medicationReference} />
|
|
64
|
+
)
|
|
65
|
+
}
|
|
66
|
+
/>
|
|
67
|
+
}
|
|
68
|
+
bodyContent={<Body tableData={tableData} />}
|
|
69
|
+
/>
|
|
53
70
|
</Root>
|
|
54
71
|
);
|
|
55
72
|
};
|
|
@@ -4,6 +4,7 @@ import { object } from '@storybook/addon-knobs';
|
|
|
4
4
|
import MedicationOrder from './MedicationOrder';
|
|
5
5
|
|
|
6
6
|
import dstu2Example from '../../../fixtures/dstu2/resources/medicationOrder/example.json';
|
|
7
|
+
import fhirIcons from '../../../fixtures/example-icons';
|
|
7
8
|
|
|
8
9
|
export default {
|
|
9
10
|
title: 'MedicationOrder',
|
|
@@ -11,5 +12,5 @@ export default {
|
|
|
11
12
|
|
|
12
13
|
export const DefaultVisualizationDSTU2 = () => {
|
|
13
14
|
const fhirResource = object('Resource', dstu2Example);
|
|
14
|
-
return <MedicationOrder fhirResource={fhirResource} />;
|
|
15
|
+
return <MedicationOrder fhirResource={fhirResource} fhirIcons={fhirIcons} />;
|
|
15
16
|
};
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import _get from 'lodash/get';
|
|
4
|
+
import Accordion from '../../containers/Accordion/Accordion';
|
|
4
5
|
import Reference from '../../datatypes/Reference';
|
|
5
6
|
import CodeableConcept from '../../datatypes/CodeableConcept';
|
|
6
7
|
import Coding from '../../datatypes/Coding';
|
|
7
8
|
import Date from '../../datatypes/Date';
|
|
8
9
|
|
|
9
|
-
import { Root, Header,
|
|
10
|
+
import { Root, Header, Body } from '../../ui';
|
|
10
11
|
|
|
11
12
|
const MedicationRequest = props => {
|
|
12
|
-
const { fhirResource } = props;
|
|
13
|
+
const { fhirResource, fhirIcons } = props;
|
|
14
|
+
const headerIcon = fhirIcons && fhirIcons['Medication'];
|
|
13
15
|
const medicationReference = _get(fhirResource, 'medicationReference');
|
|
14
16
|
const medicationCodeableConcept = _get(
|
|
15
17
|
fhirResource,
|
|
@@ -25,49 +27,69 @@ const MedicationRequest = props => {
|
|
|
25
27
|
_get(fhirResource, 'requester.agent') || _get(fhirResource, 'requester');
|
|
26
28
|
const created = _get(fhirResource, 'authoredOn');
|
|
27
29
|
const intent = _get(fhirResource, 'intent');
|
|
30
|
+
const tableData = [
|
|
31
|
+
{
|
|
32
|
+
label: 'Medication',
|
|
33
|
+
testId: 'medication',
|
|
34
|
+
data: showMedicationCodeableConcept && (
|
|
35
|
+
<Coding fhirData={medicationCodeableConcept} />
|
|
36
|
+
),
|
|
37
|
+
status: showMedicationCodeableConcept,
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
label: 'Requester',
|
|
41
|
+
testId: 'requester',
|
|
42
|
+
data: requester && <Reference fhirData={requester} />,
|
|
43
|
+
status: requester,
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
label: 'Created',
|
|
47
|
+
testId: 'created',
|
|
48
|
+
data: created && <Date fhirData={created} />,
|
|
49
|
+
status: created,
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
label: 'Type of request',
|
|
53
|
+
testId: 'intent',
|
|
54
|
+
data: intent,
|
|
55
|
+
status: intent,
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
label: 'Reason',
|
|
59
|
+
testId: 'reasonCode',
|
|
60
|
+
data: reasonCode && <CodeableConcept fhirData={reasonCode} />,
|
|
61
|
+
status: reasonCode,
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
label: 'Dosage',
|
|
65
|
+
testId: 'hasDosageInstruction',
|
|
66
|
+
data:
|
|
67
|
+
hasDosageInstruction &&
|
|
68
|
+
dosageInstruction.map((item, i) => (
|
|
69
|
+
<p key={`dosage-instruction-item-${i}`}>{item.text}</p>
|
|
70
|
+
)),
|
|
71
|
+
status: hasDosageInstruction,
|
|
72
|
+
},
|
|
73
|
+
];
|
|
74
|
+
|
|
28
75
|
return (
|
|
29
76
|
<Root name="MedicationRequest">
|
|
30
|
-
<
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
{created && (
|
|
47
|
-
<Value label="Created" data-testid="created">
|
|
48
|
-
<Date fhirData={created} />
|
|
49
|
-
</Value>
|
|
50
|
-
)}
|
|
51
|
-
{intent && (
|
|
52
|
-
<Value label="Type of request" data-testid="intent">
|
|
53
|
-
{intent}
|
|
54
|
-
</Value>
|
|
55
|
-
)}
|
|
56
|
-
{reasonCode && (
|
|
57
|
-
<Value label="Reason" data-testid="reasonCode">
|
|
58
|
-
<CodeableConcept fhirData={reasonCode} />
|
|
59
|
-
</Value>
|
|
60
|
-
)}
|
|
61
|
-
{hasDosageInstruction && (
|
|
62
|
-
<Value label="Dosage" data-testid="hasDosageInstruction">
|
|
63
|
-
<ul>
|
|
64
|
-
{dosageInstruction.map((item, i) => (
|
|
65
|
-
<li key={`item-${i}`}>{item.text}</li>
|
|
66
|
-
))}
|
|
67
|
-
</ul>
|
|
68
|
-
</Value>
|
|
69
|
-
)}
|
|
70
|
-
</Body>
|
|
77
|
+
<Accordion
|
|
78
|
+
headerContent={
|
|
79
|
+
<Header
|
|
80
|
+
icon={headerIcon}
|
|
81
|
+
resourceName="MedicationRequest"
|
|
82
|
+
title={
|
|
83
|
+
medicationReference ? (
|
|
84
|
+
<Reference fhirData={medicationReference} />
|
|
85
|
+
) : (
|
|
86
|
+
'Medication request'
|
|
87
|
+
)
|
|
88
|
+
}
|
|
89
|
+
/>
|
|
90
|
+
}
|
|
91
|
+
bodyContent={<Body tableData={tableData} />}
|
|
92
|
+
/>
|
|
71
93
|
</Root>
|
|
72
94
|
);
|
|
73
95
|
};
|
|
@@ -8,6 +8,7 @@ import stu3Example2 from '../../../fixtures/stu3/resources/medicationRequest/exa
|
|
|
8
8
|
import R4Example1 from '../../../fixtures/r4/resources/medicationRequest/example1.json';
|
|
9
9
|
import R4Example2 from '../../../fixtures/r4/resources/medicationRequest/example2.json';
|
|
10
10
|
import R4Example3 from '../../../fixtures/r4/resources/medicationRequest/example3.json';
|
|
11
|
+
import fhirIcons from '../../../fixtures/example-icons';
|
|
11
12
|
|
|
12
13
|
export default {
|
|
13
14
|
title: 'MedicationRequest',
|
|
@@ -15,25 +16,35 @@ export default {
|
|
|
15
16
|
|
|
16
17
|
export const DefaultVisualizationSTU3 = () => {
|
|
17
18
|
const fhirResource = object('Resource', stu3Example1);
|
|
18
|
-
return
|
|
19
|
+
return (
|
|
20
|
+
<MedicationRequest fhirResource={fhirResource} fhirIcons={fhirIcons} />
|
|
21
|
+
);
|
|
19
22
|
};
|
|
20
23
|
|
|
21
24
|
export const Example2OfSTU3 = () => {
|
|
22
25
|
const fhirResource = object('Resource', stu3Example2);
|
|
23
|
-
return
|
|
26
|
+
return (
|
|
27
|
+
<MedicationRequest fhirResource={fhirResource} fhirIcons={fhirIcons} />
|
|
28
|
+
);
|
|
24
29
|
};
|
|
25
30
|
|
|
26
31
|
export const Example1OfR4 = () => {
|
|
27
32
|
const fhirResource = object('Resource', R4Example1);
|
|
28
|
-
return
|
|
33
|
+
return (
|
|
34
|
+
<MedicationRequest fhirResource={fhirResource} fhirIcons={fhirIcons} />
|
|
35
|
+
);
|
|
29
36
|
};
|
|
30
37
|
|
|
31
38
|
export const Example2OfR4 = () => {
|
|
32
39
|
const fhirResource = object('Resource', R4Example2);
|
|
33
|
-
return
|
|
40
|
+
return (
|
|
41
|
+
<MedicationRequest fhirResource={fhirResource} fhirIcons={fhirIcons} />
|
|
42
|
+
);
|
|
34
43
|
};
|
|
35
44
|
|
|
36
45
|
export const Example3OfR4 = () => {
|
|
37
46
|
const fhirResource = object('Resource', R4Example3);
|
|
38
|
-
return
|
|
47
|
+
return (
|
|
48
|
+
<MedicationRequest fhirResource={fhirResource} fhirIcons={fhirIcons} />
|
|
49
|
+
);
|
|
39
50
|
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { ValueSection, ValueSectionItem } from '../../ui';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import Reference from '../../datatypes/Reference';
|
|
4
|
+
import _get from 'lodash/get';
|
|
5
|
+
|
|
6
|
+
const MedicationDetails = props => {
|
|
7
|
+
const {
|
|
8
|
+
medication,
|
|
9
|
+
expiration,
|
|
10
|
+
ingredient,
|
|
11
|
+
medicationReference,
|
|
12
|
+
hasReasonCode,
|
|
13
|
+
reasonCode,
|
|
14
|
+
} = props;
|
|
15
|
+
return (
|
|
16
|
+
<ValueSection label={medication} marginBottom>
|
|
17
|
+
<ValueSectionItem label="Expiration date" data-testid="expirationDate">
|
|
18
|
+
{expiration}
|
|
19
|
+
</ValueSectionItem>
|
|
20
|
+
{ingredient && (
|
|
21
|
+
<ValueSectionItem label="Ingredient" data-testid="ingredient">
|
|
22
|
+
{ingredient.map((item, i) => (
|
|
23
|
+
<div key={`item-${i}`} data-testid="ingredient-item">
|
|
24
|
+
{_get(item, 'itemCodeableConcept.coding.0.display', '')}
|
|
25
|
+
</div>
|
|
26
|
+
))}
|
|
27
|
+
</ValueSectionItem>
|
|
28
|
+
)}
|
|
29
|
+
{medicationReference && (
|
|
30
|
+
<ValueSectionItem
|
|
31
|
+
label="Medication reference"
|
|
32
|
+
data-testid="medicationReference"
|
|
33
|
+
>
|
|
34
|
+
{<Reference fhirData={medicationReference} />}
|
|
35
|
+
</ValueSectionItem>
|
|
36
|
+
)}
|
|
37
|
+
{hasReasonCode && (
|
|
38
|
+
<ValueSectionItem label="Reasons" data-testid="hasReasonCode">
|
|
39
|
+
{reasonCode.map((item, i) => {
|
|
40
|
+
const display = _get(item, 'coding.0.display');
|
|
41
|
+
if (display) {
|
|
42
|
+
return <div key={`item-${i}`}>{display}</div>;
|
|
43
|
+
}
|
|
44
|
+
return null;
|
|
45
|
+
})}
|
|
46
|
+
</ValueSectionItem>
|
|
47
|
+
)}
|
|
48
|
+
</ValueSection>
|
|
49
|
+
);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export default MedicationDetails;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { ValueSection, ValueSectionItem } from '../../ui';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import _get from 'lodash/get';
|
|
4
|
+
|
|
5
|
+
const MedicationDosage = props => {
|
|
6
|
+
const { dosage, hasNote, note, key } = props;
|
|
7
|
+
|
|
8
|
+
const instructions = _get(dosage, 'text');
|
|
9
|
+
const additionalInstructionText = _get(
|
|
10
|
+
dosage,
|
|
11
|
+
'additionalInstruction[0].text',
|
|
12
|
+
);
|
|
13
|
+
const route =
|
|
14
|
+
_get(dosage, 'route.coding[0].display') ||
|
|
15
|
+
`${_get(dosage, 'route.text', '')} ${_get(dosage, 'text', '')}`;
|
|
16
|
+
const hasRoute = route.trim() !== '';
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<ValueSection label="Dosage" key={key}>
|
|
20
|
+
<ValueSectionItem label="Instructions" data-testid="dosageInstruction">
|
|
21
|
+
{instructions}
|
|
22
|
+
</ValueSectionItem>
|
|
23
|
+
{additionalInstructionText && (
|
|
24
|
+
<ValueSectionItem
|
|
25
|
+
label="Additional instruction"
|
|
26
|
+
data-testid="additionalInstruction"
|
|
27
|
+
>
|
|
28
|
+
{additionalInstructionText}
|
|
29
|
+
</ValueSectionItem>
|
|
30
|
+
)}
|
|
31
|
+
{hasRoute && (
|
|
32
|
+
<ValueSectionItem label="Route" data-testid="route">
|
|
33
|
+
{route}
|
|
34
|
+
</ValueSectionItem>
|
|
35
|
+
)}
|
|
36
|
+
{hasNote && (
|
|
37
|
+
<ValueSectionItem label="Notes" data-testid="hasNote">
|
|
38
|
+
{note.map((item, i) => (
|
|
39
|
+
<div key={`note-${i}`}>{item.text}</div>
|
|
40
|
+
))}
|
|
41
|
+
</ValueSectionItem>
|
|
42
|
+
)}
|
|
43
|
+
</ValueSection>
|
|
44
|
+
);
|
|
45
|
+
};
|
|
46
|
+
export default MedicationDosage;
|
|
@@ -3,42 +3,13 @@ import PropTypes from 'prop-types';
|
|
|
3
3
|
|
|
4
4
|
import _get from 'lodash/get';
|
|
5
5
|
import _has from 'lodash/has';
|
|
6
|
-
import Date from '../../datatypes/Date';
|
|
7
6
|
import UnhandledResourceDataStructure from '../UnhandledResourceDataStructure';
|
|
8
7
|
import fhirVersions from '../fhirResourceVersions';
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
Title,
|
|
15
|
-
Badge,
|
|
16
|
-
BadgeSecondary,
|
|
17
|
-
Body,
|
|
18
|
-
Value,
|
|
19
|
-
ValueSection,
|
|
20
|
-
} from '../../ui';
|
|
21
|
-
|
|
22
|
-
const MedicationDetails = props => {
|
|
23
|
-
const { medication, expiration, ingredient } = props;
|
|
24
|
-
return (
|
|
25
|
-
<div>
|
|
26
|
-
<h5>{medication} </h5>
|
|
27
|
-
<Value label="Expiration date">{expiration}</Value>
|
|
28
|
-
{ingredient && (
|
|
29
|
-
<Value label="Ingredient">
|
|
30
|
-
<ul>
|
|
31
|
-
{ingredient.map((item, i) => (
|
|
32
|
-
<li key={`item-${i}`}>
|
|
33
|
-
{_get(item, 'itemCodeableConcept.coding.0.display', '')}
|
|
34
|
-
</li>
|
|
35
|
-
))}
|
|
36
|
-
</ul>
|
|
37
|
-
</Value>
|
|
38
|
-
)}
|
|
39
|
-
</div>
|
|
40
|
-
);
|
|
41
|
-
};
|
|
8
|
+
import Accordion from '../../containers/Accordion';
|
|
9
|
+
import DatePeriod from '../../datatypes/DatePeriod/DatePeriod';
|
|
10
|
+
import MedicationDetails from './MedicationDetails';
|
|
11
|
+
import { Root, Header, Badge, Body } from '../../ui';
|
|
12
|
+
import MedicationDosage from './MedicationDosage';
|
|
42
13
|
|
|
43
14
|
const DEFAULT_TITLE = 'Medication Statement';
|
|
44
15
|
|
|
@@ -137,7 +108,7 @@ const resourceDTO = (fhirVersion, fhirResource) => {
|
|
|
137
108
|
};
|
|
138
109
|
|
|
139
110
|
const MedicationStatement = props => {
|
|
140
|
-
const { fhirResource, fhirVersion } = props;
|
|
111
|
+
const { fhirResource, fhirVersion, fhirIcons } = props;
|
|
141
112
|
let fhirResourceData = {};
|
|
142
113
|
try {
|
|
143
114
|
fhirResourceData = resourceDTO(fhirVersion, fhirResource);
|
|
@@ -165,94 +136,70 @@ const MedicationStatement = props => {
|
|
|
165
136
|
|
|
166
137
|
return (
|
|
167
138
|
<Root name="MedicationStatement">
|
|
168
|
-
<
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
'code.coding[0].display',
|
|
186
|
-
);
|
|
187
|
-
if (hasMedicationDetails) {
|
|
188
|
-
return (
|
|
189
|
-
<MedicationDetails
|
|
190
|
-
key={`item-${i}`}
|
|
191
|
-
medication={_get(medication, 'code.coding[0].display')}
|
|
192
|
-
expiration={_get(
|
|
193
|
-
medication,
|
|
194
|
-
'package.batch[0].expirationDate',
|
|
195
|
-
)}
|
|
196
|
-
ingredient={_get(medication, 'ingredient', [])}
|
|
139
|
+
<Accordion
|
|
140
|
+
headerContent={
|
|
141
|
+
<Header
|
|
142
|
+
icon={fhirIcons}
|
|
143
|
+
resourceName="MedicationStatement"
|
|
144
|
+
badges={status && <Badge data-testid="hasStatus">{status}</Badge>}
|
|
145
|
+
title={title}
|
|
146
|
+
additionalContent={
|
|
147
|
+
hasEffectivePeriod && (
|
|
148
|
+
<>
|
|
149
|
+
<DatePeriod
|
|
150
|
+
periodBeginLabel="Start date"
|
|
151
|
+
periodBeginDate={statusDesc.from}
|
|
152
|
+
periodBeginTestId="startDate"
|
|
153
|
+
periodEndLabel="End date"
|
|
154
|
+
periodEndDate={statusDesc.to}
|
|
155
|
+
periodEndTestId="endDate"
|
|
197
156
|
/>
|
|
157
|
+
<span>{reported}</span>
|
|
158
|
+
</>
|
|
159
|
+
)
|
|
160
|
+
}
|
|
161
|
+
/>
|
|
162
|
+
}
|
|
163
|
+
bodyContent={
|
|
164
|
+
<Body>
|
|
165
|
+
{hasMedications &&
|
|
166
|
+
contained.map((medication, i) => {
|
|
167
|
+
const hasMedicationDetails = _has(
|
|
168
|
+
medication,
|
|
169
|
+
'code.coding[0].display',
|
|
198
170
|
);
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
if (display) {
|
|
215
|
-
return <li key={`item-${i}`}>{display}</li>;
|
|
171
|
+
if (hasMedicationDetails) {
|
|
172
|
+
return (
|
|
173
|
+
<MedicationDetails
|
|
174
|
+
key={`item-${i}`}
|
|
175
|
+
medication={_get(medication, 'code.coding[0].display')}
|
|
176
|
+
expiration={_get(
|
|
177
|
+
medication,
|
|
178
|
+
'package.batch[0].expirationDate',
|
|
179
|
+
)}
|
|
180
|
+
ingredient={_get(medication, 'ingredient', [])}
|
|
181
|
+
medicationReference={medicationReference}
|
|
182
|
+
hasReasonCode={hasReasonCode}
|
|
183
|
+
reasonCode={reasonCode}
|
|
184
|
+
/>
|
|
185
|
+
);
|
|
216
186
|
}
|
|
217
187
|
return null;
|
|
218
188
|
})}
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
)
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
const hasRoute = route.trim() !== '';
|
|
234
|
-
return (
|
|
235
|
-
<div key={`dosage-${i}`}>
|
|
236
|
-
<Value label="Instructions" data-testid="dosageInstruction">
|
|
237
|
-
{text}
|
|
238
|
-
</Value>
|
|
239
|
-
{additionalInstructionText && (
|
|
240
|
-
<Value label="Additional Instruction">
|
|
241
|
-
{additionalInstructionText}
|
|
242
|
-
</Value>
|
|
243
|
-
)}
|
|
244
|
-
{hasRoute && <Value label="Route">{route}</Value>}
|
|
245
|
-
</div>
|
|
246
|
-
);
|
|
247
|
-
})}
|
|
248
|
-
</ValueSection>
|
|
249
|
-
)}
|
|
250
|
-
{hasNote && (
|
|
251
|
-
<Value label="Notes" data-testid="hasNote">
|
|
252
|
-
<Annotation fhirData={note} />
|
|
253
|
-
</Value>
|
|
254
|
-
)}
|
|
255
|
-
</Body>
|
|
189
|
+
{hasDosage &&
|
|
190
|
+
fhirResource.dosage.map((dosage, i) => {
|
|
191
|
+
return (
|
|
192
|
+
<MedicationDosage
|
|
193
|
+
key={`dosage-${i}`}
|
|
194
|
+
dosage={dosage}
|
|
195
|
+
hasNote={hasNote}
|
|
196
|
+
note={note}
|
|
197
|
+
/>
|
|
198
|
+
);
|
|
199
|
+
})}
|
|
200
|
+
</Body>
|
|
201
|
+
}
|
|
202
|
+
/>
|
|
256
203
|
</Root>
|
|
257
204
|
);
|
|
258
205
|
};
|
|
@@ -9,6 +9,7 @@ import stu3Example1 from '../../../fixtures/stu3/resources/medicationStatement/e
|
|
|
9
9
|
import stu3Example2 from '../../../fixtures/stu3/resources/medicationStatement/example2.json';
|
|
10
10
|
import r4Example1 from '../../../fixtures/r4/resources/medicationStatement/example1.json';
|
|
11
11
|
import r4Example2 from '../../../fixtures/r4/resources/medicationStatement/example2.json';
|
|
12
|
+
import fhirIcons from '../../../fixtures/example-icons';
|
|
12
13
|
|
|
13
14
|
export default {
|
|
14
15
|
title: 'MedicationStatement',
|
|
@@ -20,6 +21,7 @@ export const DefaultVisualizationDSTU2 = () => {
|
|
|
20
21
|
<MedicationStatement
|
|
21
22
|
fhirVersion={fhirVersions.DSTU2}
|
|
22
23
|
fhirResource={fhirResource}
|
|
24
|
+
fhirIcons={fhirIcons}
|
|
23
25
|
/>
|
|
24
26
|
);
|
|
25
27
|
};
|
|
@@ -30,6 +32,7 @@ export const ExampleOfSTU3 = () => {
|
|
|
30
32
|
<MedicationStatement
|
|
31
33
|
fhirVersion={fhirVersions.STU3}
|
|
32
34
|
fhirResource={fhirResource}
|
|
35
|
+
fhirIcons={fhirIcons}
|
|
33
36
|
/>
|
|
34
37
|
);
|
|
35
38
|
};
|
|
@@ -40,6 +43,7 @@ export const Example2OfSTU3 = () => {
|
|
|
40
43
|
<MedicationStatement
|
|
41
44
|
fhirVersion={fhirVersions.STU3}
|
|
42
45
|
fhirResource={fhirResource}
|
|
46
|
+
fhirIcons={fhirIcons}
|
|
43
47
|
/>
|
|
44
48
|
);
|
|
45
49
|
};
|
|
@@ -50,6 +54,7 @@ export const Example1OfR4 = () => {
|
|
|
50
54
|
<MedicationStatement
|
|
51
55
|
fhirVersion={fhirVersions.R4}
|
|
52
56
|
fhirResource={fhirResource}
|
|
57
|
+
fhirIcons={fhirIcons}
|
|
53
58
|
/>
|
|
54
59
|
);
|
|
55
60
|
};
|
|
@@ -60,6 +65,7 @@ export const Example2OfR4 = () => {
|
|
|
60
65
|
<MedicationStatement
|
|
61
66
|
fhirVersion={fhirVersions.R4}
|
|
62
67
|
fhirResource={fhirResource}
|
|
68
|
+
fhirIcons={fhirIcons}
|
|
63
69
|
/>
|
|
64
70
|
);
|
|
65
71
|
};
|