fhir-react 0.3.5 → 0.3.8

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 (173) hide show
  1. package/.circleci/config.yml +1 -1
  2. package/.eslintrc +10 -1
  3. package/.stylelintrc +6 -2
  4. package/README.md +19 -1
  5. package/build/index.js +15 -11
  6. package/build/style.css +9 -8
  7. package/package.json +55 -54
  8. package/src/assets/containers/AdverseEvent/adverse-event.svg +6 -0
  9. package/src/assets/containers/Coverage/coverage.svg +4 -0
  10. package/src/assets/containers/{ResourceCategory/resource-placeholder.svg → Generic/generic.svg} +0 -0
  11. package/src/assets/containers/MedicationDispense/medication-dispense.svg +5 -0
  12. package/src/assets/containers/MedicationOrder/medication-order.svg +5 -0
  13. package/src/assets/containers/MedicationRequest/medication-request.svg +5 -0
  14. package/src/assets/containers/Organization/organization.svg +5 -0
  15. package/src/assets/containers/PractitionerRole/practitioner-role.svg +5 -0
  16. package/src/assets/containers/ReferralRequest/referral-request.svg +8 -0
  17. package/src/assets/containers/RelatedPerson/related-person.svg +6 -0
  18. package/src/assets/containers/ResourceCategory/resource-category.svg +3 -0
  19. package/src/components/containers/Accordion/Accordion.js +21 -13
  20. package/src/components/datatypes/Attachment/Attachment.css +5 -0
  21. package/src/components/datatypes/Attachment/Attachment.js +7 -2
  22. package/src/components/datatypes/CodeableConcept/CodeableConcept.js +6 -3
  23. package/src/components/datatypes/Coding/Coding.js +7 -3
  24. package/src/components/datatypes/Identifier/Identifier.js +7 -3
  25. package/src/components/datatypes/Reference/Reference.js +7 -1
  26. package/src/components/datatypes/Telecom/Telecom.js +2 -3
  27. package/src/components/resources/AdverseEvent/AdverseEvent.js +81 -42
  28. package/src/components/resources/AdverseEvent/AdverseEvent.stories.js +12 -2
  29. package/src/components/resources/AdverseEvent/AdverseEvent.test.js +109 -2
  30. package/src/components/resources/AllergyIntolerance/AllergyIntolerance.js +9 -5
  31. package/src/components/resources/AllergyIntolerance/AllergyIntolerance.stories.js +5 -4
  32. package/src/components/resources/AllergyIntolerance/AllergyIntolerance.test.js +107 -1
  33. package/src/components/resources/Appointment/Appointment.js +2 -1
  34. package/src/components/resources/Appointment/Appointment.test.js +36 -1
  35. package/src/components/resources/Binary/Binary.js +1 -2
  36. package/src/components/resources/Binary/Binary.stories.js +10 -4
  37. package/src/components/resources/Binary/Binary.test.js +67 -0
  38. package/src/components/resources/Bundle/Bundle.css +7 -0
  39. package/src/components/resources/Bundle/Bundle.js +15 -11
  40. package/src/components/resources/Bundle/Bundle.stories.js +12 -78
  41. package/src/components/resources/Bundle/Bundle.test.js +0 -3
  42. package/src/components/resources/CarePlan/CarePlan.js +2 -1
  43. package/src/components/resources/CarePlan/CarePlan.stories.js +31 -5
  44. package/src/components/resources/CarePlan/CarePlan.test.js +114 -6
  45. package/src/components/resources/CareTeam/CareTeam.js +72 -50
  46. package/src/components/resources/CareTeam/CareTeam.stories.js +20 -3
  47. package/src/components/resources/CareTeam/CareTeam.test.js +109 -1
  48. package/src/components/resources/CareTeam/CareTeamParticipants.js +1 -1
  49. package/src/components/resources/Claim/CareTeam.js +55 -0
  50. package/src/components/resources/Claim/Claim.css +2 -11
  51. package/src/components/resources/Claim/Claim.js +158 -309
  52. package/src/components/resources/Claim/Claim.stories.js +37 -5
  53. package/src/components/resources/Claim/Claim.test.js +104 -1
  54. package/src/components/resources/Claim/Diagnosis.js +61 -0
  55. package/src/components/resources/Claim/Insurance.js +58 -0
  56. package/src/components/resources/Claim/Item.js +79 -0
  57. package/src/components/resources/Claim/Items.js +29 -0
  58. package/src/components/resources/ClaimResponse/AddedItem.js +61 -11
  59. package/src/components/resources/ClaimResponse/AddedItems.js +5 -9
  60. package/src/components/resources/ClaimResponse/ClaimResponse.js +137 -83
  61. package/src/components/resources/ClaimResponse/ClaimResponse.stories.js +15 -2
  62. package/src/components/resources/ClaimResponse/ClaimResponse.test.js +112 -1
  63. package/src/components/resources/ClaimResponse/Item.js +44 -9
  64. package/src/components/resources/ClaimResponse/Items.js +5 -4
  65. package/src/components/resources/Condition/Condition.js +3 -3
  66. package/src/components/resources/Condition/Condition.test.js +37 -4
  67. package/src/components/resources/Coverage/Coverage.js +97 -69
  68. package/src/components/resources/Coverage/Coverage.stories.js +31 -5
  69. package/src/components/resources/Coverage/Coverage.test.js +111 -4
  70. package/src/components/resources/Device/Device.js +2 -1
  71. package/src/components/resources/Device/Device.stories.js +33 -5
  72. package/src/components/resources/Device/Device.test.js +108 -1
  73. package/src/components/resources/DiagnosticReport/DiagnosticReport.js +7 -2
  74. package/src/components/resources/DiagnosticReport/DiagnosticReport.stories.js +5 -4
  75. package/src/components/resources/DiagnosticReport/DiagnosticReport.test.js +107 -1
  76. package/src/components/resources/DocumentReference/DocumentReference.js +7 -2
  77. package/src/components/resources/DocumentReference/DocumentReference.stories.js +3 -2
  78. package/src/components/resources/DocumentReference/DocumentReference.test.js +113 -1
  79. package/src/components/resources/Encounter/Encounter.js +2 -1
  80. package/src/components/resources/Encounter/Encounter.test.js +36 -1
  81. package/src/components/resources/ExplanationOfBenefit/ExplanationOfBenefit.js +2 -0
  82. package/src/components/resources/ExplanationOfBenefit/ExplanationOfBenefit.test.js +38 -1
  83. package/src/components/resources/FamilyMemberHistory/FamilyMemberHistory.js +7 -2
  84. package/src/components/resources/FamilyMemberHistory/FamilyMemberHistory.stories.js +3 -2
  85. package/src/components/resources/FamilyMemberHistory/FamilyMemberHistory.test.js +108 -1
  86. package/src/components/resources/Generic/Generic.js +20 -7
  87. package/src/components/resources/Generic/Generic.stories.js +2 -1
  88. package/src/components/resources/Generic/Generic.test.js +26 -7
  89. package/src/components/resources/Goal/Goal.js +3 -5
  90. package/src/components/resources/Goal/Goal.stories.js +5 -4
  91. package/src/components/resources/Goal/Goal.test.js +101 -1
  92. package/src/components/resources/Immunization/Immunization.js +2 -2
  93. package/src/components/resources/Immunization/Immunization.test.js +36 -1
  94. package/src/components/resources/List/DrugTierDefinitionExtension.js +79 -35
  95. package/src/components/resources/List/Entries.js +3 -3
  96. package/src/components/resources/List/List.js +135 -88
  97. package/src/components/resources/List/List.stories.js +38 -5
  98. package/src/components/resources/List/List.test.js +105 -1
  99. package/src/components/resources/Location/Location.js +65 -47
  100. package/src/components/resources/Location/Location.stories.js +11 -4
  101. package/src/components/resources/Location/Location.test.js +106 -4
  102. package/src/components/resources/Medication/Medication.js +91 -51
  103. package/src/components/resources/Medication/Medication.stories.js +37 -7
  104. package/src/components/resources/Medication/Medication.test.js +113 -4
  105. package/src/components/resources/MedicationAdministration/MedicationAdministration.js +86 -62
  106. package/src/components/resources/MedicationAdministration/MedicationAdministration.stories.js +7 -0
  107. package/src/components/resources/MedicationAdministration/MedicationAdministration.test.js +117 -1
  108. package/src/components/resources/MedicationDispense/DosageInstruction.js +25 -0
  109. package/src/components/resources/MedicationDispense/MedicationDispense.js +68 -68
  110. package/src/components/resources/MedicationDispense/MedicationDispense.stories.js +7 -0
  111. package/src/components/resources/MedicationDispense/MedicationDispense.test.js +108 -1
  112. package/src/components/resources/MedicationKnowledge/MedicationKnowledge.js +115 -66
  113. package/src/components/resources/MedicationKnowledge/MedicationKnowledge.stories.js +6 -0
  114. package/src/components/resources/MedicationKnowledge/MedicationKnowledge.test.js +110 -1
  115. package/src/components/resources/MedicationOrder/MedicationOrder.js +3 -4
  116. package/src/components/resources/MedicationOrder/MedicationOrder.stories.js +1 -2
  117. package/src/components/resources/MedicationOrder/MedicationOrder.test.js +102 -4
  118. package/src/components/resources/MedicationRequest/MedicationRequest.js +3 -4
  119. package/src/components/resources/MedicationRequest/MedicationRequest.stories.js +11 -6
  120. package/src/components/resources/MedicationRequest/MedicationRequest.test.js +100 -4
  121. package/src/components/resources/MedicationStatement/MedicationDosage.js +2 -2
  122. package/src/components/resources/MedicationStatement/MedicationStatement.js +8 -2
  123. package/src/components/resources/MedicationStatement/MedicationStatement.stories.js +5 -4
  124. package/src/components/resources/MedicationStatement/MedicationStatement.test.js +108 -1
  125. package/src/components/resources/Observation/Observation.js +2 -1
  126. package/src/components/resources/Observation/Observation.test.js +30 -1
  127. package/src/components/resources/Organization/Organization.js +56 -37
  128. package/src/components/resources/Organization/Organization.stories.js +15 -2
  129. package/src/components/resources/Organization/Organization.test.js +109 -1
  130. package/src/components/resources/Patient/Patient.js +2 -0
  131. package/src/components/resources/Patient/Patient.test.js +31 -2
  132. package/src/components/resources/Practitioner/Practitioner.js +2 -1
  133. package/src/components/resources/Practitioner/Practitioner.test.js +36 -1
  134. package/src/components/resources/PractitionerRole/PractitionerRole.js +50 -29
  135. package/src/components/resources/PractitionerRole/PractitionerRole.stories.js +7 -0
  136. package/src/components/resources/PractitionerRole/PractitionerRole.test.js +108 -1
  137. package/src/components/resources/Procedure/Procedure.js +2 -2
  138. package/src/components/resources/Procedure/Procedure.test.js +30 -1
  139. package/src/components/resources/Questionnaire/Group.js +53 -0
  140. package/src/components/resources/Questionnaire/Items.js +45 -0
  141. package/src/components/resources/Questionnaire/Questionnaire.css +24 -5
  142. package/src/components/resources/Questionnaire/Questionnaire.js +31 -170
  143. package/src/components/resources/Questionnaire/Questionnaire.stories.js +8 -0
  144. package/src/components/resources/Questionnaire/Questionnaire.test.js +194 -15
  145. package/src/components/resources/Questionnaire/Questions.js +40 -0
  146. package/src/components/resources/Questionnaire/getQuestionText.js +20 -0
  147. package/src/components/resources/QuestionnaireResponse/Answers.js +59 -0
  148. package/src/components/resources/QuestionnaireResponse/Group.js +70 -0
  149. package/src/components/resources/QuestionnaireResponse/Items.js +45 -0
  150. package/src/components/resources/QuestionnaireResponse/QuestionnaireResponse.css +33 -8
  151. package/src/components/resources/QuestionnaireResponse/QuestionnaireResponse.js +52 -236
  152. package/src/components/resources/QuestionnaireResponse/QuestionnaireResponse.stories.js +8 -0
  153. package/src/components/resources/QuestionnaireResponse/QuestionnaireResponse.test.js +38 -3
  154. package/src/components/resources/QuestionnaireResponse/Questions.js +43 -0
  155. package/src/components/resources/QuestionnaireResponse/getQuestionText.js +22 -0
  156. package/src/components/resources/ReferralRequest/ReferralRequest.js +65 -40
  157. package/src/components/resources/ReferralRequest/ReferralRequest.test.js +111 -11
  158. package/src/components/resources/RelatedPerson/RelatedPerson.js +151 -0
  159. package/src/components/resources/RelatedPerson/RelatedPerson.stories.js +46 -0
  160. package/src/components/resources/RelatedPerson/RelatedPerson.test.js +156 -0
  161. package/src/components/resources/RelatedPerson/index.js +3 -0
  162. package/src/components/resources/ResearchStudy/ResearchStudy.js +160 -130
  163. package/src/components/resources/ResearchStudy/ResearchStudy.stories.js +2 -0
  164. package/src/components/resources/ResearchStudy/ResearchStudy.test.js +108 -1
  165. package/src/components/resources/ResourceCategory/ResourceCategory.js +7 -12
  166. package/src/components/resources/ResourceCategory/ResourceCategory.stories.js +13 -2
  167. package/src/components/resources/ResourceCategory/ResourceCategory.test.js +77 -18
  168. package/src/components/ui/index.js +32 -12
  169. package/src/fixtures/dstu2/resources/relatedPerson/example1.json +79 -0
  170. package/src/fixtures/example-icons.jsx +81 -11
  171. package/src/fixtures/r4/resources/relatedPerson/example1.json +64 -0
  172. package/src/fixtures/stu3/resources/relatedPerson/example1.json +43 -0
  173. package/src/style.scss +3 -1
@@ -0,0 +1,61 @@
1
+ import {
2
+ MissingValue,
3
+ Table,
4
+ TableCell,
5
+ TableHeader,
6
+ TableRow,
7
+ ValueSection,
8
+ } from '../../ui';
9
+ import Coding from '../../datatypes/Coding';
10
+ import Reference from '../../datatypes/Reference';
11
+ import React from 'react';
12
+
13
+ const Diagnosis = ({ diagnosis }) => {
14
+ return (
15
+ <ValueSection label="Diagnosis" data-testid="diagnosis" marginTop>
16
+ <Table>
17
+ <thead>
18
+ <TableRow>
19
+ <TableHeader>Diagnosis</TableHeader>
20
+ <TableHeader>Type</TableHeader>
21
+ <TableHeader>Package code</TableHeader>
22
+ </TableRow>
23
+ </thead>
24
+ <tbody className="border-top-0">
25
+ {diagnosis.map((diagnosis, idx) => (
26
+ <TableRow key={idx}>
27
+ <TableCell data-testid="diagnosis.diagnosis" className="col-md-4">
28
+ {diagnosis.coding ? (
29
+ <Coding fhirData={diagnosis.coding} />
30
+ ) : diagnosis.refrence ? (
31
+ <Reference fhirData={diagnosis.reference} />
32
+ ) : (
33
+ <MissingValue />
34
+ )}
35
+ </TableCell>
36
+ <TableCell data-testid="diagnosis.type" className="col-md-4">
37
+ {diagnosis.typeCoding ? (
38
+ <Coding fhirData={diagnosis.typeCoding} />
39
+ ) : (
40
+ <MissingValue />
41
+ )}
42
+ </TableCell>
43
+ <TableCell
44
+ data-testid="diagnosis.packageCode"
45
+ className="col-md-4"
46
+ >
47
+ {diagnosis.packageCodeCoding ? (
48
+ <Coding fhirData={diagnosis.packageCodeCoding} />
49
+ ) : (
50
+ <MissingValue />
51
+ )}
52
+ </TableCell>
53
+ </TableRow>
54
+ ))}
55
+ </tbody>
56
+ </Table>
57
+ </ValueSection>
58
+ );
59
+ };
60
+
61
+ export default Diagnosis;
@@ -0,0 +1,58 @@
1
+ import {
2
+ MissingValue,
3
+ Table,
4
+ TableCell,
5
+ TableHeader,
6
+ TableRow,
7
+ ValueSection,
8
+ } from '../../ui';
9
+ import Reference from '../../datatypes/Reference';
10
+ import React from 'react';
11
+
12
+ const Insurance = ({ insurance }) => {
13
+ return (
14
+ <ValueSection label="Insurance" data-testid="insurance" marginTop>
15
+ <Table>
16
+ <thead>
17
+ <TableRow>
18
+ <TableHeader>Coverage</TableHeader>
19
+ <TableHeader>Business Arrangement</TableHeader>
20
+ <TableHeader>Claim Response</TableHeader>
21
+ </TableRow>
22
+ </thead>
23
+ <tbody className="border-top-0">
24
+ {insurance.map((insurance, idx) => (
25
+ <TableRow key={idx}>
26
+ <TableCell data-testid="insurance.coverage" className="col-md-4">
27
+ <Reference fhirData={insurance.coverage} />
28
+ {insurance.focal && ' (focal)'}
29
+ </TableCell>
30
+ <TableCell
31
+ data-testid="insurance.businessArrangement"
32
+ className="col-md-4"
33
+ >
34
+ {insurance.businessArrangement ? (
35
+ insurance.businessArrangement
36
+ ) : (
37
+ <MissingValue />
38
+ )}
39
+ </TableCell>
40
+ <TableCell
41
+ data-testid="insurance.claimResponse"
42
+ className="col-md-4"
43
+ >
44
+ {insurance.claimResponse ? (
45
+ <Reference fhirData={insurance.claimResponse} />
46
+ ) : (
47
+ <MissingValue />
48
+ )}
49
+ </TableCell>
50
+ </TableRow>
51
+ ))}
52
+ </tbody>
53
+ </Table>
54
+ </ValueSection>
55
+ );
56
+ };
57
+
58
+ export default Insurance;
@@ -0,0 +1,79 @@
1
+ import React, { useState } from 'react';
2
+ import { Chevron, MissingValue, TableCell, TableRow } from '../../ui';
3
+ import Coding from '../../datatypes/Coding';
4
+ import Money from '../../datatypes/Money';
5
+
6
+ const Item = ({ item, parentSequences, parentId, isCollapse = false }) => {
7
+ const itemSequences = [...parentSequences, item.sequence];
8
+ const id = itemSequences.join('.');
9
+ const collapseId = parentSequences.length ? parentId : item.sequence;
10
+
11
+ const [rotate, setRotate] = useState(false);
12
+ const handleTableExpand = () => setRotate(!rotate);
13
+
14
+ const isExpandable =
15
+ parentSequences.length === 0 && item.subItems.length !== 0;
16
+
17
+ return (
18
+ <>
19
+ <TableRow
20
+ className={`${isCollapse ? `collapse item-${parentId}` : ''} ${
21
+ isExpandable ? 'fw-bold table-expandable-row border-top' : ''
22
+ }`}
23
+ data-bs-target={`.item-${collapseId}`}
24
+ data-bs-toggle={'collapse'}
25
+ aria-controls={id}
26
+ aria-expanded="false"
27
+ onClick={handleTableExpand}
28
+ >
29
+ <TableCell data-testid="items.sequence" className="col-md-2">
30
+ {id}
31
+ </TableCell>
32
+ <TableCell data-testid="items.service" className="col-md-2">
33
+ <Coding fhirData={item.service} />
34
+ </TableCell>
35
+ <TableCell data-testid="items.unitPrice" className="col-md-2">
36
+ {item.unitPrice ? (
37
+ <Money fhirData={item.unitPrice} />
38
+ ) : (
39
+ <MissingValue />
40
+ )}
41
+ {item.factor != null ? (
42
+ <span>&nbsp;&times;&nbsp;{item.factor}</span>
43
+ ) : null}
44
+ </TableCell>
45
+ <TableCell data-testid="items.quantity" className="col-md-2">
46
+ {item.quantity != null ? item.quantity : <MissingValue />}
47
+ </TableCell>
48
+ <TableCell data-testid="items.net" className="col-md-2">
49
+ {item.net ? <Money fhirData={item.net} /> : <MissingValue />}
50
+ </TableCell>
51
+ {isExpandable ? (
52
+ <TableCell className="col-md-2">
53
+ <button
54
+ className="fhir-container__Accordion__header-button w-100 p-0 border-0 rounded-1 collapsed text-dark bg-transparent shadow-none "
55
+ type="button"
56
+ >
57
+ <div className={` ${rotate ? ' header-rotate' : ''}`}>
58
+ <Chevron strokeColor={rotate ? '#2a6fd7' : '#6f83a9'} />
59
+ </div>
60
+ </button>
61
+ </TableCell>
62
+ ) : (
63
+ <TableCell style={{ width: '64px' }} className="col-md-2" />
64
+ )}
65
+ </TableRow>
66
+ {item.subItems.map((subItem, idx) => (
67
+ <Item
68
+ key={idx}
69
+ item={subItem}
70
+ parentSequences={itemSequences}
71
+ parentId={collapseId}
72
+ isCollapse
73
+ />
74
+ ))}
75
+ </>
76
+ );
77
+ };
78
+
79
+ export default Item;
@@ -0,0 +1,29 @@
1
+ import { Table, TableHeader, TableRow, ValueSection } from '../../ui';
2
+ import React from 'react';
3
+ import Item from './Item';
4
+
5
+ const Items = ({ items }) => {
6
+ return (
7
+ <ValueSection label="Items" data-testid="items" marginTop>
8
+ <Table>
9
+ <thead>
10
+ <TableRow>
11
+ <TableHeader>ID</TableHeader>
12
+ <TableHeader>Service</TableHeader>
13
+ <TableHeader>Unit price</TableHeader>
14
+ <TableHeader>Quantity</TableHeader>
15
+ <TableHeader>Total</TableHeader>
16
+ <TableHeader></TableHeader>
17
+ </TableRow>
18
+ </thead>
19
+ <tbody className="border-top-0">
20
+ {items.map((item, idx) => (
21
+ <Item key={idx} item={item} parentSequences={[]} />
22
+ ))}
23
+ </tbody>
24
+ </Table>
25
+ </ValueSection>
26
+ );
27
+ };
28
+
29
+ export default Items;
@@ -1,27 +1,62 @@
1
- import React from 'react';
1
+ import React, { useState } from 'react';
2
2
 
3
- import { TableCell, TableRow } from '../../ui';
3
+ import { Chevron, TableCell, TableRow } from '../../ui';
4
4
  import Coding from '../../datatypes/Coding';
5
5
  import Money from '../../datatypes/Money';
6
6
  import Item from './Item';
7
7
 
8
- const AddedItem = props => {
9
- const { addedItem, parentSequences, level } = props;
10
-
8
+ const AddedItem = ({
9
+ addedItem,
10
+ parentSequences,
11
+ parentId,
12
+ isCollapse = false,
13
+ }) => {
11
14
  const itemSequences = [...parentSequences, addedItem.sequenceLinkId];
12
15
  const id = itemSequences.join('.');
16
+ const collapseId = parentSequences.length
17
+ ? parentId
18
+ : addedItem.sequenceLinkId;
19
+
20
+ const [rotate, setRotate] = useState(false);
21
+ const handleTableExpand = () => setRotate(!rotate);
22
+
23
+ const isExpandable =
24
+ parentSequences.length === 0 && addedItem.subItems.length !== 0;
13
25
 
14
26
  return (
15
27
  <>
16
- <TableRow>
17
- <TableCell data-testid="addedItems.sequence">{id}</TableCell>
18
- <TableCell data-testid="addedItems.service">
28
+ <TableRow
29
+ className={`${isCollapse ? `collapse item-${parentId}` : ''} ${
30
+ isExpandable ? 'fw-bold table-expandable-row border-top' : ''
31
+ }`}
32
+ data-bs-target={`.item-${collapseId}`}
33
+ data-bs-toggle={'collapse'}
34
+ aria-controls={id}
35
+ aria-expanded="false"
36
+ onClick={handleTableExpand}
37
+ >
38
+ <TableCell
39
+ data-testid="addedItems.sequence"
40
+ className="col-md-2"
41
+ isAlignTop
42
+ >
43
+ {id}
44
+ </TableCell>
45
+ <TableCell
46
+ data-testid="addedItems.service"
47
+ className="col-md-2"
48
+ isAlignTop
49
+ >
19
50
  {addedItem.service && <Coding fhirData={addedItem.service} />}
20
51
  </TableCell>
21
- <TableCell data-testid="addedItems.fee">
52
+ <TableCell data-testid="addedItems.fee" className="col-md-2" isAlignTop>
22
53
  {addedItem.fee && <Money fhirData={addedItem.fee} />}
23
54
  </TableCell>
24
- <TableCell data-testid="addedItems.adjudication">
55
+ <TableCell
56
+ data-testid="addedItems.adjudication"
57
+ className="col-md-2"
58
+ isAlignTop
59
+ >
25
60
  {addedItem.adjudication.map((adjudication, idx) => (
26
61
  <div
27
62
  key={idx}
@@ -36,13 +71,28 @@ const AddedItem = props => {
36
71
  </div>
37
72
  ))}
38
73
  </TableCell>
74
+ {isExpandable ? (
75
+ <TableCell className="col-md-2" isAlignTop>
76
+ <button
77
+ className="fhir-container__Accordion__header-button w-100 p-0 border-0 rounded-1 collapsed text-dark bg-transparent shadow-none "
78
+ type="button"
79
+ >
80
+ <div className={` ${rotate ? ' header-rotate' : ''}`}>
81
+ <Chevron strokeColor={rotate ? '#2a6fd7' : '#6f83a9'} />
82
+ </div>
83
+ </button>
84
+ </TableCell>
85
+ ) : (
86
+ <TableCell style={{ width: '64px' }} className="col-md-2" />
87
+ )}
39
88
  </TableRow>
40
89
  {addedItem.subItems.map((subItem, idx) => (
41
90
  <Item
42
91
  key={idx}
43
92
  addedItem={subItem}
44
- level={level + 1}
45
93
  parentSequences={itemSequences}
94
+ parentId={collapseId}
95
+ isCollapse
46
96
  />
47
97
  ))}
48
98
  </>
@@ -7,24 +7,20 @@ const AddedItems = props => {
7
7
  const { addedItems } = props;
8
8
 
9
9
  return (
10
- <ValueSection label="Added Items" data-testid="addedItems">
10
+ <ValueSection label="Added Items" data-testid="addedItems" marginTop>
11
11
  <Table>
12
12
  <thead>
13
13
  <TableRow>
14
14
  <TableHeader>ID</TableHeader>
15
15
  <TableHeader>Service</TableHeader>
16
16
  <TableHeader>Fee</TableHeader>
17
- <TableHeader expand>Adjudication</TableHeader>
17
+ <TableHeader>Adjudication</TableHeader>
18
+ <TableHeader></TableHeader>
18
19
  </TableRow>
19
20
  </thead>
20
- <tbody>
21
+ <tbody className="border-top-0">
21
22
  {addedItems.map((item, idx) => (
22
- <AddedItem
23
- key={idx}
24
- addedItem={item}
25
- level={0}
26
- parentSequences={[]}
27
- />
23
+ <AddedItem key={idx} addedItem={item} parentSequences={[]} />
28
24
  ))}
29
25
  </tbody>
30
26
  </Table>
@@ -21,11 +21,11 @@ import {
21
21
  Header,
22
22
  MissingValue,
23
23
  Root,
24
- Title,
25
- Value,
26
24
  ValueSection,
27
25
  BadgeSecondary,
26
+ ValueSectionItem,
28
27
  } from '../../ui';
28
+ import Accordion from '../../containers/Accordion';
29
29
 
30
30
  const commonDTO = fhirResource => {
31
31
  const id = _get(fhirResource, 'id');
@@ -285,8 +285,7 @@ const hasPaymentInfo = payment => {
285
285
  return Object.values(payment).filter(item => item).length > 0;
286
286
  };
287
287
 
288
- const ClaimResponse = props => {
289
- const { fhirVersion, fhirResource } = props;
288
+ const ClaimResponse = ({ fhirVersion, fhirResource, fhirIcons, onClick }) => {
290
289
  let fhirResourceData = {};
291
290
  try {
292
291
  fhirResourceData = resourceDTO(fhirVersion, fhirResource);
@@ -314,88 +313,143 @@ const ClaimResponse = props => {
314
313
  const hasAddedItems = addedItems.length > 0;
315
314
  const hasPayment = hasPaymentInfo(payment);
316
315
 
316
+ const tableData = [
317
+ {
318
+ label: 'Created At',
319
+ testId: 'created',
320
+ data: created && <DateType fhirData={created} isBlack />,
321
+ status: created,
322
+ },
323
+ {
324
+ label: 'Request claim',
325
+ testId: 'request',
326
+ data: requestReference && <Reference fhirData={requestReference} />,
327
+ status: requestReference,
328
+ },
329
+ {
330
+ label: 'Disposition',
331
+ testId: 'disposition',
332
+ data: disposition,
333
+ status: disposition,
334
+ },
335
+ {
336
+ label: 'Total cost',
337
+ testId: 'totalCost',
338
+ data: totalCost && <Money fhirData={totalCost} />,
339
+ status: totalCost,
340
+ },
341
+ {
342
+ label: 'Total benefit',
343
+ testId: 'totalBenefit',
344
+ data: totalBenefit && <Money fhirData={totalBenefit} />,
345
+ status: totalBenefit,
346
+ },
347
+ ];
348
+
349
+ const paymentData = [
350
+ {
351
+ label: 'Type',
352
+ testId: 'payment.type',
353
+ data: payment.typeCoding ? (
354
+ <Coding fhirData={payment.typeCoding} />
355
+ ) : (
356
+ <MissingValue />
357
+ ),
358
+ status: true,
359
+ },
360
+ {
361
+ label: 'Amount',
362
+ testId: 'payment.amount',
363
+ data: payment.amount ? (
364
+ <Money fhirData={payment.amount} />
365
+ ) : (
366
+ <MissingValue />
367
+ ),
368
+ status: payment.amount,
369
+ },
370
+ {
371
+ label: 'Date',
372
+ testId: 'payment.date',
373
+ data: payment.date ? (
374
+ <DateType fhirData={payment.date} isBlack />
375
+ ) : (
376
+ <MissingValue />
377
+ ),
378
+ status: payment.date,
379
+ },
380
+ {
381
+ label: 'Reference',
382
+ testId: 'payment.ref',
383
+ data: payment.ref ? (
384
+ <Identifier fhirData={payment.ref} />
385
+ ) : (
386
+ <MissingValue />
387
+ ),
388
+ status: payment.ref,
389
+ },
390
+ ];
391
+
317
392
  return (
318
393
  <Root name="ClaimResponse">
319
- <Header>
320
- <Title>Claim response #{id}</Title>
321
- {outcome && <Badge data-testid="outcome">{outcome}</Badge>}
322
- {status && (
323
- <BadgeSecondary data-testid="status">{status}</BadgeSecondary>
324
- )}
325
- </Header>
326
- <Body>
327
- {created && (
328
- <Value label="Created At" data-testid="created">
329
- <DateType fhirData={created} />
330
- </Value>
331
- )}
332
- {requestReference && (
333
- <Value label="Request claim" data-testid="request">
334
- <Reference fhirData={requestReference} />
335
- </Value>
336
- )}
337
- {disposition && (
338
- <Value label="Disposition" data-testid="disposition">
339
- {disposition}
340
- </Value>
341
- )}
342
- {totalCost && (
343
- <Value label="Total cost" data-testid="totalCost">
344
- <Money fhirData={totalCost} />
345
- </Value>
346
- )}
347
- {totalBenefit && (
348
- <Value label="Total benefit" data-testid="totalBenefit">
349
- <Money fhirData={totalBenefit} />
350
- </Value>
351
- )}
352
- {isNotEmptyArray(totalCostsArr) && (
353
- <ValueSection label="Total" data-testid="totalSection">
354
- {totalCostsArr.map(
355
- ({ category, amount }, i) =>
356
- category && (
357
- <Value label={category} key={`total-value-${i}`}>
358
- <Money fhirData={amount} />
359
- </Value>
360
- ),
394
+ <Accordion
395
+ headerContent={
396
+ <Header
397
+ resourceName="ClaimResponse"
398
+ title={`Claim response #${id}`}
399
+ badges={
400
+ <>
401
+ {outcome && <Badge data-testid="outcome">{outcome}</Badge>}
402
+ {status && (
403
+ <BadgeSecondary data-testid="status">{status}</BadgeSecondary>
404
+ )}
405
+ </>
406
+ }
407
+ icon={fhirIcons}
408
+ />
409
+ }
410
+ bodyContent={
411
+ <Body tableData={tableData}>
412
+ {isNotEmptyArray(totalCostsArr) && (
413
+ <ValueSection label="Total" data-testid="totalSection" marginTop>
414
+ {totalCostsArr.map(
415
+ ({ category, amount }, i) =>
416
+ category && (
417
+ <ValueSectionItem
418
+ label={category}
419
+ key={`total-value-${i}`}
420
+ >
421
+ <Money fhirData={amount} />
422
+ </ValueSectionItem>
423
+ ),
424
+ )}
425
+ </ValueSection>
426
+ )}
427
+ {hasPayment && (
428
+ <ValueSection
429
+ label="Payment"
430
+ data-testid="paymentSection"
431
+ marginTop
432
+ >
433
+ {paymentData.map(
434
+ (item, index) =>
435
+ item.status && (
436
+ <ValueSectionItem
437
+ key={`payment-item-${index}`}
438
+ label={item.label}
439
+ data-testid={item.testId}
440
+ >
441
+ {item.data}
442
+ </ValueSectionItem>
443
+ ),
444
+ )}
445
+ </ValueSection>
361
446
  )}
362
- </ValueSection>
363
- )}
364
- {hasPayment && (
365
- <ValueSection label="Payment" data-testid="paymentSection">
366
- <Value label="Type" data-testid="payment.type">
367
- {payment.typeCoding ? (
368
- <Coding fhirData={payment.typeCoding} />
369
- ) : (
370
- <MissingValue />
371
- )}
372
- </Value>
373
- <Value label="Amount" data-testid="payment.amount">
374
- {payment.amount ? (
375
- <Money fhirData={payment.amount} />
376
- ) : (
377
- <MissingValue />
378
- )}
379
- </Value>
380
- <Value label="Date" data-testid="payment.date">
381
- {payment.date ? (
382
- <DateType fhirData={payment.date} />
383
- ) : (
384
- <MissingValue />
385
- )}
386
- </Value>
387
- <Value label="Reference" data-testid="payment.ref">
388
- {payment.ref ? (
389
- <Identifier fhirData={payment.ref} />
390
- ) : (
391
- <MissingValue />
392
- )}
393
- </Value>
394
- </ValueSection>
395
- )}
396
- {hasAddedItems && <AddedItems addedItems={addedItems} />}
397
- {hasItems && <Items items={items} />}
398
- </Body>
447
+ {hasAddedItems && <AddedItems addedItems={addedItems} />}
448
+ {hasItems && <Items items={items} />}
449
+ </Body>
450
+ }
451
+ onClick={onClick}
452
+ />
399
453
  </Root>
400
454
  );
401
455
  };
@@ -10,6 +10,8 @@ import example2ClaimResponseSTU3 from '../../../fixtures/stu3/resources/claimRes
10
10
  import example1ClaimResponseR4 from '../../../fixtures/r4/resources/claimResponse/example1.json';
11
11
  import example2ClaimResponseR4 from '../../../fixtures/r4/resources/claimResponse/example2.json';
12
12
  import example3ClaimResponseR4 from '../../../fixtures/r4/resources/claimResponse/example3.json';
13
+ import fhirIcons from '../../../fixtures/example-icons';
14
+ import ClaimResponseIcon from '../../../assets/containers/ClaimResponse/claim-response.svg';
13
15
 
14
16
  export default { title: 'Claim Response' };
15
17
 
@@ -19,6 +21,7 @@ export const ExampleDSTU2 = () => {
19
21
  <ClaimResponse
20
22
  fhirResource={fhirResource}
21
23
  fhirVersion={fhirVersions.DSTU2}
24
+ fhirIcons={require('../../../assets/containers/ClaimResponse/claim-response.svg')}
22
25
  />
23
26
  );
24
27
  };
@@ -29,6 +32,7 @@ export const Example1OfSTU3 = () => {
29
32
  <ClaimResponse
30
33
  fhirResource={fhirResource}
31
34
  fhirVersion={fhirVersions.STU3}
35
+ fhirIcons={ClaimResponseIcon}
32
36
  />
33
37
  );
34
38
  };
@@ -38,6 +42,7 @@ export const Example2OfSTU3 = () => {
38
42
  <ClaimResponse
39
43
  fhirResource={fhirResource}
40
44
  fhirVersion={fhirVersions.STU3}
45
+ fhirIcons={fhirIcons}
41
46
  />
42
47
  );
43
48
  };
@@ -45,13 +50,21 @@ export const Example2OfSTU3 = () => {
45
50
  export const Example1OfR4 = () => {
46
51
  const fhirResource = object('Resource', example1ClaimResponseR4);
47
52
  return (
48
- <ClaimResponse fhirResource={fhirResource} fhirVersion={fhirVersions.R4} />
53
+ <ClaimResponse
54
+ fhirResource={fhirResource}
55
+ fhirVersion={fhirVersions.R4}
56
+ fhirIcons={false}
57
+ />
49
58
  );
50
59
  };
51
60
  export const Example2OfR4 = () => {
52
61
  const fhirResource = object('Resource', example2ClaimResponseR4);
53
62
  return (
54
- <ClaimResponse fhirResource={fhirResource} fhirVersion={fhirVersions.R4} />
63
+ <ClaimResponse
64
+ fhirResource={fhirResource}
65
+ fhirVersion={fhirVersions.R4}
66
+ fhirIcons={'random text'}
67
+ />
55
68
  );
56
69
  };
57
70
  export const Example3OfR4 = () => {