fhir-react 0.2.1 → 0.3.0

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.
Files changed (163) hide show
  1. package/.github/workflows/publish_npmjs.yml +18 -0
  2. package/.storybook/config.js +9 -3
  3. package/.storybook/presets.js +1 -0
  4. package/.storybook/preview-head.html +4 -0
  5. package/README.md +86 -55
  6. package/package.json +13 -4
  7. package/src/assets/common/chevron-right.svg +3 -0
  8. package/src/assets/containers/AllergyIntolerance/allergy-intolerance.svg +9 -0
  9. package/src/assets/containers/Appointment/appointment.svg +14 -0
  10. package/src/assets/containers/CarePlan/care-plan.svg +10 -0
  11. package/src/assets/containers/CareTeam/care-team.svg +10 -0
  12. package/src/assets/containers/Claim/claim.svg +6 -0
  13. package/src/assets/containers/ClaimResponse/claim-response.svg +7 -0
  14. package/src/assets/containers/Condition/condition.svg +11 -0
  15. package/src/assets/containers/Device/device.svg +8 -0
  16. package/src/assets/containers/DiagnosticReport/diagnostic-report.svg +14 -0
  17. package/src/assets/containers/DocumentReference/document-reference.svg +10 -0
  18. package/src/assets/containers/Encounter/encounter.svg +10 -0
  19. package/src/assets/containers/ExplanationOfBenefit/explanation-of-benefit.svg +3 -0
  20. package/src/assets/containers/FamilyMemberHistory/family-member-history.svg +7 -0
  21. package/src/assets/containers/Goal/goal.svg +11 -0
  22. package/src/assets/containers/Immunization/immunization.svg +7 -0
  23. package/src/assets/containers/List/list.svg +3 -0
  24. package/src/assets/containers/Location/location.svg +4 -0
  25. package/src/assets/containers/Medication/medication.svg +5 -0
  26. package/src/assets/containers/MedicationAdministration/medication-administration.svg +6 -0
  27. package/src/assets/containers/MedicationKnowledge/medication-knowledge.svg +11 -0
  28. package/src/assets/containers/MedicationStatement/medication-statement.svg +5 -0
  29. package/src/assets/containers/Observation/observation.svg +12 -0
  30. package/src/assets/containers/Practitioner/practitioner.svg +5 -0
  31. package/src/assets/containers/Procedure/procedure.svg +9 -0
  32. package/src/assets/containers/Questionnaire/questionnaire.svg +6 -0
  33. package/src/assets/containers/QuestionnaireResponse/questionnaire-response.svg +6 -0
  34. package/src/assets/containers/QustionnaireResponse/questionnaire-response.svg +6 -0
  35. package/src/assets/containers/ResearchStudy/research-study.svg +9 -0
  36. package/src/assets/containers/ResourceCategory/resource-placeholder.svg +3 -0
  37. package/src/components/containers/Accordion/Accordion.js +80 -0
  38. package/src/components/containers/Accordion/Accordion.stories.js +76 -0
  39. package/src/components/containers/Accordion/index.js +3 -0
  40. package/src/components/containers/ResourceContainer/ResourceContainer.css +0 -1
  41. package/src/components/containers/ResourceContainer/ResourceContainer.js +1 -1
  42. package/src/components/datatypes/AccountBalance/AccountBalance.js +33 -0
  43. package/src/components/datatypes/AccountBalance/index.js +3 -0
  44. package/src/components/datatypes/Annotation/Annotation.js +1 -1
  45. package/src/components/datatypes/Coding/Coding.js +1 -1
  46. package/src/components/datatypes/Date/Date.js +14 -4
  47. package/src/components/datatypes/DatePeriod/DatePeriod.js +38 -0
  48. package/src/components/datatypes/DatePeriod/index.js +3 -0
  49. package/src/components/datatypes/HeaderIcon/HeaderIcon.js +31 -0
  50. package/src/components/datatypes/HeaderIcon/index.js +3 -0
  51. package/src/components/datatypes/HumanName/HumanName.js +6 -21
  52. package/src/components/datatypes/Reference/Reference.js +3 -6
  53. package/src/components/resources/AdverseEvent/AdverseEvent.test.js +2 -2
  54. package/src/components/resources/AllergyIntolerance/AllergyIntolerance.test.js +4 -4
  55. package/src/components/resources/Appointment/Appointment.js +91 -65
  56. package/src/components/resources/Appointment/Appointment.test.js +3 -3
  57. package/src/components/resources/Bundle/Bundle.js +2 -2
  58. package/src/components/resources/Bundle/Bundle.stories.js +78 -12
  59. package/src/components/resources/Bundle/Bundle.test.js +3 -0
  60. package/src/components/resources/CarePlan/CarePlan.test.js +4 -4
  61. package/src/components/resources/CareTeam/CareTeam.js +13 -14
  62. package/src/components/resources/CareTeam/CareTeam.test.js +4 -4
  63. package/src/components/resources/Claim/Claim.test.js +6 -6
  64. package/src/components/resources/ClaimResponse/ClaimResponse.test.js +6 -6
  65. package/src/components/resources/Condition/Condition.js +63 -47
  66. package/src/components/resources/Condition/Condition.stories.js +41 -8
  67. package/src/components/resources/Condition/Condition.test.js +20 -14
  68. package/src/components/resources/DiagnosticReport/DiagnosticReport.test.js +5 -7
  69. package/src/components/resources/DocumentReference/DocumentReference.js +1 -1
  70. package/src/components/resources/DocumentReference/DocumentReference.test.js +3 -3
  71. package/src/components/resources/Encounter/Encounter.js +66 -36
  72. package/src/components/resources/Encounter/EncounterParticipants.js +2 -2
  73. package/src/components/resources/ExplanationOfBenefit/CareTeam.js +2 -2
  74. package/src/components/resources/ExplanationOfBenefit/Diagnosis.js +31 -5
  75. package/src/components/resources/ExplanationOfBenefit/ExplanationOfBenefit.js +272 -201
  76. package/src/components/resources/ExplanationOfBenefit/ExplanationOfBenefit.stories.js +12 -0
  77. package/src/components/resources/ExplanationOfBenefit/ExplanationOfBenefit.test.js +96 -62
  78. package/src/components/resources/ExplanationOfBenefit/Items.js +2 -2
  79. package/src/components/resources/ExplanationOfBenefit/PriceLabel.js +20 -0
  80. package/src/components/resources/ExplanationOfBenefit/Related.js +3 -3
  81. package/src/components/resources/ExplanationOfBenefit/SupportingInfo.js +14 -3
  82. package/src/components/resources/ExplanationOfBenefit/TotalGraph.js +68 -0
  83. package/src/components/resources/ExplanationOfBenefitGraph/ExplanationOfBenefitGraph.js +89 -0
  84. package/src/components/resources/ExplanationOfBenefitGraph/ExplanationOfBenefitGraph.stories.js +78 -0
  85. package/src/components/resources/ExplanationOfBenefitGraph/ExplanationOfBenefitGraph.test.js +51 -0
  86. package/src/components/resources/ExplanationOfBenefitGraph/index.js +3 -0
  87. package/src/components/resources/Goal/Goal.test.js +1 -1
  88. package/src/components/resources/Immunization/Immunization.js +125 -94
  89. package/src/components/resources/Immunization/Immunization.stories.js +23 -4
  90. package/src/components/resources/Immunization/Immunization.test.js +17 -12
  91. package/src/components/resources/List/DrugTierDefinitionExtension.js +139 -0
  92. package/src/components/resources/List/Entries.js +66 -0
  93. package/src/components/resources/List/List.js +262 -0
  94. package/src/components/resources/List/List.stories.js +75 -0
  95. package/src/components/resources/List/List.test.js +95 -0
  96. package/src/components/resources/List/index.js +3 -0
  97. package/src/components/resources/List/utils.js +6 -0
  98. package/src/components/resources/MedicationAdministration/MedicationAdministration.test.js +7 -7
  99. package/src/components/resources/MedicationDispense/MedicationDispense.test.js +2 -2
  100. package/src/components/resources/MedicationKnowledge/MedicationKnowledge.js +217 -0
  101. package/src/components/resources/MedicationKnowledge/MedicationKnowledge.stories.js +78 -0
  102. package/src/components/resources/MedicationKnowledge/MedicationKnowledge.test.js +69 -0
  103. package/src/components/resources/MedicationKnowledge/index.js +3 -0
  104. package/src/components/resources/MedicationKnowledge/utils.js +8 -0
  105. package/src/components/resources/MedicationRequest/MedicationRequest.test.js +4 -4
  106. package/src/components/resources/Observation/Observation.js +72 -54
  107. package/src/components/resources/Observation/Observation.test.js +6 -18
  108. package/src/components/resources/Observation/ObservationGraph.js +159 -55
  109. package/src/components/resources/Observation/ObservationGraph.test.js +47 -26
  110. package/src/components/resources/Patient/Patient.js +79 -97
  111. package/src/components/resources/Patient/Patient.test.js +10 -10
  112. package/src/components/resources/Practitioner/Practitioner.js +80 -60
  113. package/src/components/resources/Practitioner/Practitioner.test.js +4 -4
  114. package/src/components/resources/Procedure/Procedure.js +99 -87
  115. package/src/components/resources/Procedure/Procedure.stories.js +8 -6
  116. package/src/components/resources/Procedure/Procedure.test.js +11 -8
  117. package/src/components/resources/Questionnaire/Questionnaire.test.js +3 -3
  118. package/src/components/resources/QuestionnaireResponse/QuestionnaireResponse.test.js +5 -5
  119. package/src/components/resources/ReferralRequest/ReferralRequest.test.js +2 -2
  120. package/src/components/resources/ResearchStudy/ResearchStudy.test.js +1 -1
  121. package/src/components/resources/ResourceCategory/ResourceCategory.js +56 -0
  122. package/src/components/resources/ResourceCategory/ResourceCategory.stories.js +29 -0
  123. package/src/components/resources/ResourceCategory/ResourceCategory.test.js +101 -0
  124. package/src/components/resources/ResourceCategory/index.js +3 -0
  125. package/src/components/supportedFhirResourceList.js +4 -0
  126. package/src/components/ui/_header.scss +3 -0
  127. package/src/components/ui/bootstrap-reboot.min.css +2 -22
  128. package/src/components/ui/index.js +191 -29
  129. package/src/constants/badge-status.jsx +98 -0
  130. package/src/fixtures/dstu2/resources/condition/condition.svg +35 -0
  131. package/src/fixtures/dstu2/resources/immunization/immunization.svg +10 -0
  132. package/src/fixtures/dstu2/resources/list/example1.json +49 -0
  133. package/src/fixtures/dstu2/resources/list/example2.json +116 -0
  134. package/src/fixtures/dstu2/resources/list/example3.json +380 -0
  135. package/src/fixtures/example-icons.jsx +169 -0
  136. package/src/fixtures/r4/resources/explanationOfBenefit/c4bbExtendedDiagnosis.json +446 -0
  137. package/src/fixtures/r4/resources/list/example1.json +45 -0
  138. package/src/fixtures/r4/resources/list/example2.json +282 -0
  139. package/src/fixtures/r4/resources/list/example3.json +298 -0
  140. package/src/fixtures/r4/resources/medicationKnowledge/example1.json +42 -0
  141. package/src/fixtures/r4/resources/medicationKnowledge/example2.json +59 -0
  142. package/src/fixtures/r4/resources/medicationKnowledge/example3.json +59 -0
  143. package/src/fixtures/r4/resources/medicationKnowledge/example4.json +59 -0
  144. package/src/fixtures/stu3/resources/list/example1.json +46 -0
  145. package/src/fixtures/stu3/resources/list/example2.json +298 -0
  146. package/src/fixtures/stu3/resources/list/example3.json +115 -0
  147. package/src/index.js +6 -1
  148. package/src/style.scss +176 -0
  149. package/src/utils/formatDate.js +21 -0
  150. package/src/utils/formatDate.test.js +22 -0
  151. package/src/utils/getBadgeColor.js +6 -0
  152. package/src/utils/getBadgeColor.test.js +14 -0
  153. package/src/utils/isUrl.js +9 -0
  154. package/src/utils/isUrl.test.js +12 -0
  155. package/src/utils.js +7 -0
  156. package/build/bootstrap-reboot.min.css +0 -414
  157. package/build/index.js +0 -15
  158. package/build/style.css +0 -459
  159. package/src/components/datatypes/HumanName/HumanName.css +0 -15
  160. package/src/components/datatypes/Reference/Reference.css +0 -8
  161. package/src/components/resources/Observation/ObservationGraph.css +0 -51
  162. package/src/components/resources/Patient/Patient.css +0 -19
  163. package/src/components/ui/index.css +0 -123
@@ -8,28 +8,54 @@ import CodeableConcept from '../../datatypes/CodeableConcept';
8
8
  const Diagnosis = ({ fhirData }) => {
9
9
  return fhirData.map((diagnosis, index) => {
10
10
  const sequence = _get(diagnosis, 'sequence');
11
+ const id = _get(diagnosis, 'id');
11
12
  const reference = _get(diagnosis, 'diagnosisReference');
12
- const codeableConcept = _get(diagnosis, 'codeableConcept');
13
+ const codeableConcept = _get(diagnosis, 'diagnosisCodeableConcept');
13
14
  const type = _get(diagnosis, 'type');
15
+ const onAdmission = _get(diagnosis, 'onAdmission');
16
+ const packageCode = _get(diagnosis, 'packageCode');
14
17
 
15
18
  return (
16
19
  <div key={`total-${index}`}>
17
- <ValueSection label={`Diagnosis ${sequence}.`} data-testid="diagnosis">
20
+ <ValueSection
21
+ dirColumn
22
+ label={`Diagnosis ${sequence}${id ? ` (id: ${id})` : ''}`}
23
+ data-testid="diagnosis"
24
+ marginTop
25
+ >
18
26
  {reference && (
19
- <Value label="Diagnosis" data-testid="reference">
27
+ <Value dirColumn label="Diagnosis" data-testid="reference">
20
28
  <Reference fhirData={reference} />
21
29
  </Value>
22
30
  )}
23
31
  {codeableConcept && (
24
- <Value label="Diagnosis" data-testid="codeableConcept">
32
+ <Value dirColumn label="Diagnosis" data-testid="codeableConcept">
25
33
  <CodeableConcept fhirData={codeableConcept} />
26
34
  </Value>
27
35
  )}
28
36
  {type && (
29
- <Value label="Type" data-testid="diagnosisType">
37
+ <Value dirColumn label="Type" data-testid="diagnosisType">
30
38
  <CodeableConcept fhirData={type} />
31
39
  </Value>
32
40
  )}
41
+ {onAdmission && (
42
+ <Value
43
+ dirColumn
44
+ label="On admission"
45
+ data-testid="diagnosisOnAdmission"
46
+ >
47
+ <CodeableConcept fhirData={onAdmission} />
48
+ </Value>
49
+ )}
50
+ {packageCode && (
51
+ <Value
52
+ dirColumn
53
+ label="Package code"
54
+ data-testid="diagnosisPackageCode"
55
+ >
56
+ <CodeableConcept fhirData={packageCode} />
57
+ </Value>
58
+ )}
33
59
  </ValueSection>
34
60
  </div>
35
61
  );
@@ -1,35 +1,38 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import _get from 'lodash/get';
4
- import UnhandledResourceDataStructure from '../UnhandledResourceDataStructure';
5
- import fhirVersions from '../fhirResourceVersions';
6
-
7
1
  import {
8
- Root,
9
- Header,
10
- Title,
11
- Value,
2
+ Badge,
12
3
  Body,
13
- ValueSection,
4
+ Header,
5
+ MissingValue,
6
+ Root,
14
7
  Table,
15
- TableRow,
16
8
  TableCell,
17
- MissingValue,
18
- Badge,
9
+ TableRow,
10
+ Value,
11
+ ValueSection,
19
12
  } from '../../ui';
13
+
14
+ import CareTeam from './CareTeam';
15
+ import CodeableConcept from '../../datatypes/CodeableConcept';
20
16
  import Coding from '../../datatypes/Coding';
21
17
  import Date from '../../datatypes/Date';
22
- import Money from '../../datatypes/Money';
23
- import Reference from '../../datatypes/Reference';
24
- import Period from '../../datatypes/Period';
25
- import TotalSum from './TotalSum';
26
18
  import Diagnosis from './Diagnosis';
27
- import SupportingInfo from './SupportingInfo';
28
- import Items from './Items';
29
19
  import Identifier from '../../datatypes/Identifier/Identifier';
30
- import CareTeam from './CareTeam';
31
- import CodeableConcept from '../../datatypes/CodeableConcept';
20
+ import Items from './Items';
21
+ import Money from '../../datatypes/Money';
22
+ import Period from '../../datatypes/Period';
23
+ import PropTypes from 'prop-types';
24
+ import React from 'react';
25
+ import Reference from '../../datatypes/Reference';
32
26
  import Related from './Related';
27
+ import SupportingInfo from './SupportingInfo';
28
+ import TotalSum from './TotalSum';
29
+ import UnhandledResourceDataStructure from '../UnhandledResourceDataStructure';
30
+ import _get from 'lodash/get';
31
+ import fhirVersions from '../fhirResourceVersions';
32
+ import Accordion from '../../containers/Accordion';
33
+ import TotalGraph from './TotalGraph';
34
+ import PriceLabel from './PriceLabel';
35
+ import { TableHeader } from '../../ui';
33
36
 
34
37
  /**
35
38
  * @typedef ExplanationOfBenefitServiceItem
@@ -275,191 +278,259 @@ const ExplanationOfBenefit = props => {
275
278
  related,
276
279
  } = fhirResourceData;
277
280
 
281
+ const getRowItem = (item, index) =>
282
+ ('isLoaded' in item ? item.isLoaded : item.data) && (
283
+ <div
284
+ key={`details-item-${index}`}
285
+ className="col-12 col-sm-6 col-md-4 text-wrap"
286
+ >
287
+ <Value label={item.label} data-testid={item.testId} dirColumn>
288
+ {item.data}
289
+ </Value>
290
+ </div>
291
+ );
292
+
293
+ const getHeaderPrice = () => {
294
+ if (totalCost) {
295
+ return <PriceLabel totalCost={totalCost} />;
296
+ }
297
+ };
298
+
299
+ const EOBRowData = [
300
+ {
301
+ label: 'Type',
302
+ testId: 'type',
303
+ data:
304
+ hasType &&
305
+ type.map((typeItem, i) => (
306
+ <Coding key={`item-${i}`} fhirData={typeItem} />
307
+ )),
308
+ isLoaded: hasType,
309
+ },
310
+ {
311
+ label: 'Identifier',
312
+ testId: 'identifier',
313
+ data:
314
+ identifier &&
315
+ identifier.map((id, index) => (
316
+ <div key={`identifier-${index}`}>
317
+ <Identifier fhirData={id} />
318
+ </div>
319
+ )),
320
+ isLoaded: identifier,
321
+ },
322
+ {
323
+ label: 'Outcome',
324
+ testId: 'outcome',
325
+ data: outcome,
326
+ },
327
+ {
328
+ label: 'Insurer',
329
+ testId: 'insurer',
330
+ data: <Reference fhirData={insurer} />,
331
+ isLoaded: hasInsurer,
332
+ },
333
+ {
334
+ label: 'Claim provider',
335
+ testId: 'provider',
336
+ data: <Reference fhirData={provider} />,
337
+ isLoaded: provider,
338
+ },
339
+ {
340
+ label: 'Total',
341
+ testId: 'totalSum',
342
+ data: <TotalSum fhirData={total} />,
343
+ isLoaded: hasTotal,
344
+ },
345
+ {
346
+ label: 'Payment',
347
+ testId: 'payment',
348
+ data: <Money fhirData={payment} />,
349
+ isLoaded: payment,
350
+ },
351
+ {
352
+ label: 'Payee',
353
+ testId: 'payee',
354
+ data: (
355
+ <>
356
+ {payeeType && <CodeableConcept fhirData={payeeType} />}
357
+ {payeeParty && <Reference fhirData={payeeParty} />}
358
+ </>
359
+ ),
360
+ isLoaded: payeeType || payeeParty,
361
+ },
362
+ {
363
+ label: 'Billable period',
364
+ testId: 'billablePeriod',
365
+ data: <Period fhirData={billablePeriod} />,
366
+ isLoaded: billablePeriod,
367
+ },
368
+ {
369
+ label: 'Purpose',
370
+ testId: 'purpose',
371
+ data: useCode,
372
+ },
373
+ {
374
+ label: 'Patient',
375
+ testId: 'patient',
376
+ data: <Reference fhirData={patient} />,
377
+ isLoaded: patient,
378
+ },
379
+ {
380
+ label: 'Insurance',
381
+ testId: 'insurance',
382
+ data: <Reference fhirData={insurance} />,
383
+ isLoaded: insurance,
384
+ },
385
+ {
386
+ label: 'Related',
387
+ testId: 'related',
388
+ data: <Related fhirData={related} />,
389
+ isLoaded: related,
390
+ },
391
+ ];
392
+
278
393
  return (
279
394
  <Root name="ExplanationOfBenefit">
280
- <Header>
281
- <Title>{disposition}</Title>
282
- {resourceStatus && <Badge>{resourceStatus}</Badge>}
283
- </Header>
284
- <Body>
285
- {hasType && (
286
- <Value label="Type" data-testid="type">
287
- {type.map((typeItem, i) => (
288
- <Coding key={`item-${i}`} fhirData={typeItem} />
289
- ))}
290
- </Value>
291
- )}
292
- {created && (
293
- <Value label="Created" data-testid="created">
294
- {created}
295
- </Value>
296
- )}
297
- {identifier && (
298
- <Value label="Identifier" data-testid="identifier">
299
- {identifier.map((id, index) => (
300
- <div key={`identifier-${index}`}>
301
- <Identifier fhirData={id} />
395
+ <Accordion
396
+ headerContent={
397
+ <Header
398
+ resourceName="ExplanationOfBenefit"
399
+ title={
400
+ disposition ? disposition : `Explanation Of Benefit (default)`
401
+ }
402
+ badges={getHeaderPrice()}
403
+ rightAdditionalContent={
404
+ resourceStatus && <Badge>{resourceStatus}</Badge>
405
+ }
406
+ additionalContent={
407
+ created &&
408
+ created !== 'undefined' && (
409
+ <Value label="Start date" data-testid="created">
410
+ <Date fhirData={created} isBlack />
411
+ </Value>
412
+ )
413
+ }
414
+ />
415
+ }
416
+ bodyContent={
417
+ <Body>
418
+ <ValueSection
419
+ label="Details"
420
+ data-testid="details"
421
+ className="mt-3"
422
+ >
423
+ <div className="row gy-sm-3">
424
+ {EOBRowData.map((x, index) => getRowItem(x, index))}
302
425
  </div>
303
- ))}
304
- </Value>
305
- )}
306
- {outcome && (
307
- <Value label="Outcome" data-testid="outcome">
308
- {outcome}
309
- </Value>
310
- )}
311
- {hasInsurer && (
312
- <Value label="Insurer" data-testid="insurer">
313
- <Reference fhirData={insurer} />
314
- </Value>
315
- )}
316
- {provider && (
317
- <Value label="Claim provider" data-testid="provider">
318
- <Reference fhirData={provider} />
319
- </Value>
320
- )}
321
- {totalCost && (
322
- <Value label="Total cost" data-testid="totalCost">
323
- <Money fhirData={totalCost} />
324
- </Value>
325
- )}
326
- {totalBenefit && (
327
- <Value label="Total benefit" data-testid="totalBenefit">
328
- <Money fhirData={totalBenefit} />
329
- </Value>
330
- )}
331
- {hasTotal && (
332
- <Value label="Total" data-testid="totalSum">
333
- <TotalSum fhirData={total} />
334
- </Value>
335
- )}
336
- {payment && (
337
- <Value label="Payment" data-testid="payment">
338
- <Money fhirData={payment} />
339
- </Value>
340
- )}
341
- {(payeeType || payeeParty) && (
342
- <Value label="Payee" data-testid="payee">
343
- {payeeType && <CodeableConcept fhirData={payeeType} />}
344
- {payeeParty && <Reference fhirData={payeeParty} />}
345
- </Value>
346
- )}
347
- {billablePeriod && (
348
- <Value label="Billable period" data-testid="billablePeriod">
349
- <Period fhirData={billablePeriod} />
350
- </Value>
351
- )}
352
- {useCode && (
353
- <Value label="Purpose" data-testid="purpose">
354
- {useCode}
355
- </Value>
356
- )}
357
- {patient && (
358
- <Value label="Patient" data-testid="patient">
359
- <Reference fhirData={patient} />
360
- </Value>
361
- )}
362
- {insurance && (
363
- <Value label="Insurance" data-testid="insurance">
364
- <Reference fhirData={insurance} />
365
- </Value>
366
- )}
367
- {related && (
368
- <Value label="Related" data-testid="related">
369
- <Related fhirData={related} />
370
- </Value>
371
- )}
372
- {hasDiagnosis && <Diagnosis fhirData={diagnosis} />}
373
- {hasSupportingInfo && <SupportingInfo fhirData={supportingInfo} />}
426
+ </ValueSection>
427
+ {hasDiagnosis && <Diagnosis fhirData={diagnosis} />}
428
+ {hasSupportingInfo && <SupportingInfo fhirData={supportingInfo} />}
429
+ {totalCost && totalBenefit && (
430
+ <TotalGraph fhirData={{ totalCost, totalBenefit }} />
431
+ )}
374
432
 
375
- {hasServices && (
376
- <ValueSection label="Services" data-testid="hasServices">
377
- <Table>
378
- <thead>
379
- <TableRow>
380
- <TableCell>Service</TableCell>
381
- <TableCell>Service date</TableCell>
382
- <TableCell>Quantity</TableCell>
383
- <TableCell>Item cost</TableCell>
384
- </TableRow>
385
- </thead>
386
- <tbody>
387
- {services.map((serviceItem, i) => {
388
- return (
389
- <TableRow key={`serviceItem-${i}`}>
390
- <TableCell>
391
- <Coding fhirData={serviceItem.coding} />
392
- </TableCell>
393
- <TableCell>
394
- {serviceItem.servicedDate ? (
395
- <Date fhirData={serviceItem.servicedDate} />
396
- ) : (
397
- <MissingValue />
398
- )}
399
- </TableCell>
400
- <TableCell>
401
- {Number.isFinite(Number(serviceItem.quantity)) ? (
402
- serviceItem.quantity
403
- ) : (
404
- <MissingValue />
405
- )}
406
- </TableCell>
407
- <TableCell>
408
- {Number.isFinite(
409
- Number(_get(serviceItem, 'itemCost.value')),
410
- ) ? (
411
- <Money fhirData={serviceItem.itemCost} />
412
- ) : (
413
- <MissingValue />
414
- )}
415
- </TableCell>
433
+ {hasServices && (
434
+ <ValueSection
435
+ label="Services"
436
+ data-testid="hasServices"
437
+ marginTop
438
+ >
439
+ <Table>
440
+ <thead>
441
+ <TableRow>
442
+ <TableHeader>Service</TableHeader>
443
+ <TableHeader>Service date</TableHeader>
444
+ <TableHeader>Quantity</TableHeader>
445
+ <TableHeader>Item cost</TableHeader>
416
446
  </TableRow>
417
- );
418
- })}
419
- </tbody>
420
- </Table>
421
- </ValueSection>
422
- )}
423
- {hasInformation && (
424
- <ValueSection label="Information" data-testid="hasInformation">
425
- <Table>
426
- <thead>
427
- <TableRow>
428
- <TableCell />
429
- <TableCell>Status</TableCell>
430
- </TableRow>
431
- </thead>
432
- <tbody>
433
- {information.map((informationItem, i) => {
434
- const infoTitle = _get(informationItem, 'category.coding.0');
435
- const infoStatus = _get(informationItem, 'code.coding.0');
436
-
437
- return (
438
- <TableRow key={`serviceItem-${i}`}>
439
- <TableCell>
440
- {infoTitle ? (
441
- <Coding fhirData={infoTitle} />
442
- ) : (
443
- <MissingValue />
444
- )}
445
- </TableCell>
446
- <TableCell>
447
- {infoStatus ? (
448
- <Coding fhirData={infoStatus} />
449
- ) : (
450
- <MissingValue />
451
- )}
452
- </TableCell>
447
+ </thead>
448
+ <tbody className="border-top-0">
449
+ {services.map((serviceItem, i) => {
450
+ return (
451
+ <TableRow key={`serviceItem-${i}`}>
452
+ <TableCell data-testid="explanation.service">
453
+ <Coding fhirData={serviceItem.coding} />
454
+ </TableCell>
455
+ <TableCell data-testid="explanation.servicedDate">
456
+ {serviceItem.servicedDate ? (
457
+ <Date fhirData={serviceItem.servicedDate} />
458
+ ) : (
459
+ <MissingValue />
460
+ )}
461
+ </TableCell>
462
+ <TableCell data-testid="explanation.quantity">
463
+ {Number.isFinite(Number(serviceItem.quantity)) ? (
464
+ serviceItem.quantity
465
+ ) : (
466
+ <MissingValue />
467
+ )}
468
+ </TableCell>
469
+ <TableCell data-testid="explanation.itemCost">
470
+ {Number.isFinite(
471
+ Number(_get(serviceItem, 'itemCost.value')),
472
+ ) ? (
473
+ <Money fhirData={serviceItem.itemCost} />
474
+ ) : (
475
+ <MissingValue />
476
+ )}
477
+ </TableCell>
478
+ </TableRow>
479
+ );
480
+ })}
481
+ </tbody>
482
+ </Table>
483
+ </ValueSection>
484
+ )}
485
+ {hasInformation && (
486
+ <ValueSection
487
+ label="Information"
488
+ data-testid="hasInformation"
489
+ marginTop
490
+ >
491
+ <Table>
492
+ <thead>
493
+ <TableRow>
494
+ <TableHeader />
495
+ <TableHeader>Status</TableHeader>
453
496
  </TableRow>
454
- );
455
- })}
456
- </tbody>
457
- </Table>
458
- </ValueSection>
459
- )}
460
- {hasItems && <Items fhirData={items} />}
461
- {hasCareTeam && <CareTeam fhirData={careTeam} />}
462
- </Body>
497
+ </thead>
498
+ <tbody className="border-top-0">
499
+ {information.map((informationItem, i) => {
500
+ const infoTitle = _get(
501
+ informationItem,
502
+ 'category.coding.0',
503
+ );
504
+ const infoStatus = _get(informationItem, 'code.coding.0');
505
+
506
+ return (
507
+ <TableRow key={`serviceItem-${i}`}>
508
+ <TableCell>
509
+ {infoTitle ? (
510
+ <Coding fhirData={infoTitle} />
511
+ ) : (
512
+ <MissingValue />
513
+ )}
514
+ </TableCell>
515
+ <TableCell>
516
+ {infoStatus ? (
517
+ <Coding fhirData={infoStatus} />
518
+ ) : (
519
+ <MissingValue />
520
+ )}
521
+ </TableCell>
522
+ </TableRow>
523
+ );
524
+ })}
525
+ </tbody>
526
+ </Table>
527
+ </ValueSection>
528
+ )}
529
+ {hasItems && <Items fhirData={items} />}
530
+ {hasCareTeam && <CareTeam fhirData={careTeam} />}
531
+ </Body>
532
+ }
533
+ />
463
534
  </Root>
464
535
  );
465
536
  };
@@ -10,6 +10,7 @@ import example2Stu3 from '../../../fixtures/stu3/resources/explanationOfBenefit/
10
10
  import example1R4 from '../../../fixtures/r4/resources/explanationOfBenefit/personPrimaryCoverage.json';
11
11
  import example2R4 from '../../../fixtures/r4/resources/explanationOfBenefit/eobForClaimWithErrors.json';
12
12
  import exampleC4BB from '../../../fixtures/r4/resources/explanationOfBenefit/c4bbExample.json';
13
+ import exampleC4BBExtendedDiagnosis from '../../../fixtures/r4/resources/explanationOfBenefit/c4bbExtendedDiagnosis.json';
13
14
 
14
15
  export default {
15
16
  title: 'ExplanationOfBenefit',
@@ -77,3 +78,14 @@ export const EOBCarinBlueButtonExample = () => {
77
78
  />
78
79
  );
79
80
  };
81
+
82
+ export const EOBCarinBlueButtonExtendedDiagnosis = () => {
83
+ const fhirResource = object('Resource', exampleC4BBExtendedDiagnosis);
84
+ return (
85
+ <ExplanationOfBenefit
86
+ fhirVersion={fhirVersions.R4}
87
+ fhirResource={fhirResource}
88
+ withCarinBBProfile
89
+ />
90
+ );
91
+ };