fhir-react 0.3.6 → 0.3.9
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/.circleci/config.yml +1 -1
- package/.eslintrc +10 -1
- package/.stylelintrc +6 -2
- package/README.md +19 -1
- package/build/index.js +15 -11
- package/build/style.css +11 -10
- package/package.json +55 -54
- package/src/assets/containers/AdverseEvent/adverse-event.svg +6 -0
- package/src/assets/containers/Coverage/coverage.svg +4 -0
- package/src/assets/containers/Generic/generic.svg +3 -0
- package/src/assets/containers/Medication/medication.svg +5 -0
- package/src/assets/containers/MedicationDispense/medication-dispense.svg +5 -0
- package/src/assets/containers/Organization/organization.svg +5 -0
- package/src/assets/containers/PractitionerRole/practitioner-role.svg +5 -0
- package/src/assets/containers/ReferralRequest/referral-request.svg +8 -0
- package/src/assets/containers/RelatedPerson/related-person.svg +6 -0
- package/src/components/containers/Accordion/Accordion.js +44 -13
- package/src/components/containers/ResourceContainer/ResourceContainer.css +4 -0
- package/src/components/containers/ResourceContainer/ResourceContainer.js +28 -37
- package/src/components/containers/ResourceContainer/ResourceContainer.stories.js +23 -1
- package/src/components/datatypes/Attachment/Attachment.css +5 -0
- package/src/components/datatypes/Attachment/Attachment.js +7 -2
- package/src/components/datatypes/CodeableConcept/CodeableConcept.js +6 -3
- package/src/components/datatypes/Coding/Coding.js +7 -3
- package/src/components/datatypes/Identifier/Identifier.js +7 -3
- package/src/components/datatypes/Reference/Reference.js +7 -1
- package/src/components/datatypes/Telecom/Telecom.js +2 -3
- package/src/components/resources/AdverseEvent/AdverseEvent.js +88 -42
- package/src/components/resources/AdverseEvent/AdverseEvent.stories.js +12 -2
- package/src/components/resources/AdverseEvent/AdverseEvent.test.js +109 -2
- package/src/components/resources/AllergyIntolerance/AllergyIntolerance.js +9 -1
- package/src/components/resources/AllergyIntolerance/AllergyIntolerance.test.js +36 -1
- package/src/components/resources/Appointment/Appointment.js +9 -1
- package/src/components/resources/Appointment/Appointment.test.js +36 -1
- package/src/components/resources/Binary/Binary.js +2 -1
- package/src/components/resources/Bundle/Bundle.css +7 -0
- package/src/components/resources/Bundle/Bundle.js +15 -11
- package/src/components/resources/Bundle/Bundle.stories.js +12 -78
- package/src/components/resources/Bundle/Bundle.test.js +0 -3
- package/src/components/resources/CarePlan/CarePlan.js +9 -1
- package/src/components/resources/CarePlan/CarePlan.test.js +42 -6
- package/src/components/resources/CareTeam/CareTeam.js +79 -50
- package/src/components/resources/CareTeam/CareTeam.stories.js +20 -3
- package/src/components/resources/CareTeam/CareTeam.test.js +109 -1
- package/src/components/resources/CareTeam/CareTeamParticipants.js +1 -1
- package/src/components/resources/Claim/CareTeam.js +55 -0
- package/src/components/resources/Claim/Claim.css +2 -11
- package/src/components/resources/Claim/Claim.js +165 -309
- package/src/components/resources/Claim/Claim.stories.js +37 -5
- package/src/components/resources/Claim/Claim.test.js +104 -1
- package/src/components/resources/Claim/Diagnosis.js +61 -0
- package/src/components/resources/Claim/Insurance.js +58 -0
- package/src/components/resources/Claim/Item.js +79 -0
- package/src/components/resources/Claim/Items.js +29 -0
- package/src/components/resources/ClaimResponse/AddedItem.js +61 -11
- package/src/components/resources/ClaimResponse/AddedItems.js +5 -9
- package/src/components/resources/ClaimResponse/ClaimResponse.js +144 -83
- package/src/components/resources/ClaimResponse/ClaimResponse.stories.js +15 -2
- package/src/components/resources/ClaimResponse/ClaimResponse.test.js +112 -1
- package/src/components/resources/ClaimResponse/Item.js +44 -9
- package/src/components/resources/ClaimResponse/Items.js +5 -4
- package/src/components/resources/Condition/Condition.js +10 -3
- package/src/components/resources/Condition/Condition.test.js +37 -4
- package/src/components/resources/Coverage/Coverage.js +104 -69
- package/src/components/resources/Coverage/Coverage.stories.js +31 -5
- package/src/components/resources/Coverage/Coverage.test.js +111 -4
- package/src/components/resources/Device/Device.js +9 -1
- package/src/components/resources/Device/Device.test.js +36 -1
- package/src/components/resources/DiagnosticReport/DiagnosticReport.js +9 -2
- package/src/components/resources/DiagnosticReport/DiagnosticReport.test.js +36 -1
- package/src/components/resources/DocumentReference/DocumentReference.js +9 -2
- package/src/components/resources/DocumentReference/DocumentReference.test.js +42 -1
- package/src/components/resources/Encounter/Encounter.js +9 -1
- package/src/components/resources/Encounter/Encounter.test.js +36 -1
- package/src/components/resources/ExplanationOfBenefit/ExplanationOfBenefit.js +4 -0
- package/src/components/resources/ExplanationOfBenefit/ExplanationOfBenefit.test.js +38 -1
- package/src/components/resources/FamilyMemberHistory/FamilyMemberHistory.js +9 -2
- package/src/components/resources/FamilyMemberHistory/FamilyMemberHistory.test.js +36 -1
- package/src/components/resources/Generic/Generic.js +21 -7
- package/src/components/resources/Generic/Generic.stories.js +2 -1
- package/src/components/resources/Generic/Generic.test.js +26 -7
- package/src/components/resources/Goal/Goal.js +9 -3
- package/src/components/resources/Goal/Goal.test.js +32 -1
- package/src/components/resources/Immunization/Immunization.js +9 -2
- package/src/components/resources/Immunization/Immunization.test.js +36 -1
- package/src/components/resources/List/DrugTierDefinitionExtension.js +79 -35
- package/src/components/resources/List/Entries.js +3 -3
- package/src/components/resources/List/List.js +137 -88
- package/src/components/resources/List/List.stories.js +38 -5
- package/src/components/resources/List/List.test.js +105 -1
- package/src/components/resources/Location/Location.js +66 -47
- package/src/components/resources/Location/Location.stories.js +11 -4
- package/src/components/resources/Location/Location.test.js +106 -4
- package/src/components/resources/Medication/Medication.js +98 -51
- package/src/components/resources/Medication/Medication.stories.js +37 -7
- package/src/components/resources/Medication/Medication.test.js +114 -5
- package/src/components/resources/MedicationAdministration/MedicationAdministration.js +88 -62
- package/src/components/resources/MedicationAdministration/MedicationAdministration.stories.js +7 -0
- package/src/components/resources/MedicationAdministration/MedicationAdministration.test.js +117 -1
- package/src/components/resources/MedicationDispense/DosageInstruction.js +25 -0
- package/src/components/resources/MedicationDispense/MedicationDispense.js +70 -68
- package/src/components/resources/MedicationDispense/MedicationDispense.stories.js +7 -0
- package/src/components/resources/MedicationDispense/MedicationDispense.test.js +108 -1
- package/src/components/resources/MedicationKnowledge/MedicationKnowledge.js +117 -66
- package/src/components/resources/MedicationKnowledge/MedicationKnowledge.stories.js +6 -0
- package/src/components/resources/MedicationKnowledge/MedicationKnowledge.test.js +110 -1
- package/src/components/resources/MedicationOrder/MedicationOrder.js +3 -3
- package/src/components/resources/MedicationOrder/MedicationOrder.test.js +35 -4
- package/src/components/resources/MedicationRequest/MedicationRequest.js +8 -1
- package/src/components/resources/MedicationRequest/MedicationRequest.test.js +33 -4
- package/src/components/resources/MedicationStatement/MedicationStatement.js +9 -2
- package/src/components/resources/MedicationStatement/MedicationStatement.test.js +36 -1
- package/src/components/resources/Observation/Observation.js +3 -1
- package/src/components/resources/Observation/Observation.test.js +30 -1
- package/src/components/resources/Observation/ObservationGraph.js +1 -1
- package/src/components/resources/Organization/Organization.js +63 -37
- package/src/components/resources/Organization/Organization.stories.js +15 -2
- package/src/components/resources/Organization/Organization.test.js +109 -1
- package/src/components/resources/Patient/Patient.js +4 -0
- package/src/components/resources/Patient/Patient.test.js +31 -2
- package/src/components/resources/Practitioner/Practitioner.js +9 -1
- package/src/components/resources/Practitioner/Practitioner.test.js +36 -1
- package/src/components/resources/PractitionerRole/PractitionerRole.js +52 -29
- package/src/components/resources/PractitionerRole/PractitionerRole.stories.js +7 -0
- package/src/components/resources/PractitionerRole/PractitionerRole.test.js +108 -1
- package/src/components/resources/Procedure/Procedure.js +3 -2
- package/src/components/resources/Procedure/Procedure.test.js +30 -1
- package/src/components/resources/Questionnaire/Group.js +53 -0
- package/src/components/resources/Questionnaire/Items.js +45 -0
- package/src/components/resources/Questionnaire/Questionnaire.css +24 -5
- package/src/components/resources/Questionnaire/Questionnaire.js +38 -170
- package/src/components/resources/Questionnaire/Questionnaire.stories.js +8 -0
- package/src/components/resources/Questionnaire/Questionnaire.test.js +194 -15
- package/src/components/resources/Questionnaire/Questions.js +40 -0
- package/src/components/resources/Questionnaire/getQuestionText.js +20 -0
- package/src/components/resources/QuestionnaireResponse/Answers.js +59 -0
- package/src/components/resources/QuestionnaireResponse/Group.js +70 -0
- package/src/components/resources/QuestionnaireResponse/Items.js +45 -0
- package/src/components/resources/QuestionnaireResponse/QuestionnaireResponse.css +33 -8
- package/src/components/resources/QuestionnaireResponse/QuestionnaireResponse.js +54 -236
- package/src/components/resources/QuestionnaireResponse/QuestionnaireResponse.stories.js +8 -0
- package/src/components/resources/QuestionnaireResponse/QuestionnaireResponse.test.js +38 -3
- package/src/components/resources/QuestionnaireResponse/Questions.js +43 -0
- package/src/components/resources/QuestionnaireResponse/getQuestionText.js +22 -0
- package/src/components/resources/ReferralRequest/ReferralRequest.js +72 -40
- package/src/components/resources/ReferralRequest/ReferralRequest.test.js +111 -11
- package/src/components/resources/RelatedPerson/RelatedPerson.js +158 -0
- package/src/components/resources/RelatedPerson/RelatedPerson.stories.js +46 -0
- package/src/components/resources/RelatedPerson/RelatedPerson.test.js +156 -0
- package/src/components/resources/RelatedPerson/index.js +3 -0
- package/src/components/resources/ResearchStudy/ResearchStudy.js +167 -130
- package/src/components/resources/ResearchStudy/ResearchStudy.stories.js +2 -0
- package/src/components/resources/ResearchStudy/ResearchStudy.test.js +108 -1
- package/src/components/resources/ResourceCategory/ResourceCategory.js +1 -1
- package/src/components/ui/index.js +56 -32
- package/src/fixtures/dstu2/resources/relatedPerson/example1.json +79 -0
- package/src/fixtures/example-icons.jsx +63 -0
- package/src/fixtures/r4/resources/relatedPerson/example1.json +64 -0
- package/src/fixtures/stu3/resources/relatedPerson/example1.json +43 -0
- package/src/style.scss +14 -1
|
@@ -14,18 +14,18 @@ import './Claim.css';
|
|
|
14
14
|
import {
|
|
15
15
|
Root,
|
|
16
16
|
Header,
|
|
17
|
-
Title,
|
|
18
17
|
Badge,
|
|
19
|
-
BadgeSecondary,
|
|
20
18
|
Body,
|
|
21
19
|
MissingValue,
|
|
22
20
|
Value,
|
|
23
21
|
ValueSection,
|
|
24
|
-
|
|
25
|
-
TableCell,
|
|
26
|
-
TableHeader,
|
|
27
|
-
TableRow,
|
|
22
|
+
ValueSectionItem,
|
|
28
23
|
} from '../../ui';
|
|
24
|
+
import Accordion from '../../containers/Accordion';
|
|
25
|
+
import CareTeam from './CareTeam';
|
|
26
|
+
import Diagnosis from './Diagnosis';
|
|
27
|
+
import Insurance from './Insurance';
|
|
28
|
+
import Items from './Items';
|
|
29
29
|
|
|
30
30
|
const commonDTO = fhirResource => {
|
|
31
31
|
const id = _get(fhirResource, 'id');
|
|
@@ -298,215 +298,13 @@ const resourceDTO = (fhirVersion, fhirResource) => {
|
|
|
298
298
|
}
|
|
299
299
|
};
|
|
300
300
|
|
|
301
|
-
const
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
<TableRow>
|
|
309
|
-
<TableHeader>Provider</TableHeader>
|
|
310
|
-
<TableHeader>Role</TableHeader>
|
|
311
|
-
<TableHeader>Qualification</TableHeader>
|
|
312
|
-
</TableRow>
|
|
313
|
-
</thead>
|
|
314
|
-
<tbody>
|
|
315
|
-
{careTeam.map((member, idx) => (
|
|
316
|
-
<TableRow key={idx}>
|
|
317
|
-
<TableCell data-testid="careTeam.provider">
|
|
318
|
-
<Reference fhirData={member.provider} />
|
|
319
|
-
</TableCell>
|
|
320
|
-
<TableCell data-testid="careTeam.role">
|
|
321
|
-
{member.role ? (
|
|
322
|
-
<Coding fhirData={member.role} />
|
|
323
|
-
) : (
|
|
324
|
-
<MissingValue />
|
|
325
|
-
)}
|
|
326
|
-
</TableCell>
|
|
327
|
-
<TableCell data-testid="careTeam.qualification">
|
|
328
|
-
{careTeam.qualification ? (
|
|
329
|
-
<Coding fhirData={member.qualification} />
|
|
330
|
-
) : (
|
|
331
|
-
<MissingValue />
|
|
332
|
-
)}
|
|
333
|
-
</TableCell>
|
|
334
|
-
</TableRow>
|
|
335
|
-
))}
|
|
336
|
-
</tbody>
|
|
337
|
-
</Table>
|
|
338
|
-
</ValueSection>
|
|
339
|
-
);
|
|
340
|
-
};
|
|
341
|
-
|
|
342
|
-
const Diagnosis = props => {
|
|
343
|
-
const { diagnosis } = props;
|
|
344
|
-
|
|
345
|
-
return (
|
|
346
|
-
<ValueSection label="Diagnosis" data-testid="diagnosis">
|
|
347
|
-
<Table>
|
|
348
|
-
<thead>
|
|
349
|
-
<TableRow>
|
|
350
|
-
<TableHeader>Diagnosis</TableHeader>
|
|
351
|
-
<TableHeader>Type</TableHeader>
|
|
352
|
-
<TableHeader>Package code</TableHeader>
|
|
353
|
-
</TableRow>
|
|
354
|
-
</thead>
|
|
355
|
-
<tbody>
|
|
356
|
-
{diagnosis.map((diagnosis, idx) => (
|
|
357
|
-
<TableRow key={idx}>
|
|
358
|
-
<TableCell data-testid="diagnosis.diagnosis">
|
|
359
|
-
{diagnosis.coding ? (
|
|
360
|
-
<Coding fhirData={diagnosis.coding} />
|
|
361
|
-
) : diagnosis.refrence ? (
|
|
362
|
-
<Reference fhirData={diagnosis.reference} />
|
|
363
|
-
) : (
|
|
364
|
-
<MissingValue />
|
|
365
|
-
)}
|
|
366
|
-
</TableCell>
|
|
367
|
-
<TableCell data-testid="diagnosis.type">
|
|
368
|
-
{diagnosis.typeCoding ? (
|
|
369
|
-
<Coding fhirData={diagnosis.typeCoding} />
|
|
370
|
-
) : (
|
|
371
|
-
<MissingValue />
|
|
372
|
-
)}
|
|
373
|
-
</TableCell>
|
|
374
|
-
<TableCell data-testid="diagnosis.packageCode">
|
|
375
|
-
{diagnosis.packageCodeCoding ? (
|
|
376
|
-
<Coding fhirData={diagnosis.packageCodeCoding} />
|
|
377
|
-
) : (
|
|
378
|
-
<MissingValue />
|
|
379
|
-
)}
|
|
380
|
-
</TableCell>
|
|
381
|
-
</TableRow>
|
|
382
|
-
))}
|
|
383
|
-
</tbody>
|
|
384
|
-
</Table>
|
|
385
|
-
</ValueSection>
|
|
386
|
-
);
|
|
387
|
-
};
|
|
388
|
-
|
|
389
|
-
const Insurance = props => {
|
|
390
|
-
const { insurance } = props;
|
|
391
|
-
|
|
392
|
-
return (
|
|
393
|
-
<ValueSection label="Insurance" data-testid="insurance">
|
|
394
|
-
<Table>
|
|
395
|
-
<thead>
|
|
396
|
-
<TableRow>
|
|
397
|
-
<TableHeader>Coverage</TableHeader>
|
|
398
|
-
<TableHeader>Business Arrangement</TableHeader>
|
|
399
|
-
<TableHeader>Claim Response</TableHeader>
|
|
400
|
-
</TableRow>
|
|
401
|
-
</thead>
|
|
402
|
-
<tbody>
|
|
403
|
-
{insurance.map((insurance, idx) => (
|
|
404
|
-
<TableRow key={idx}>
|
|
405
|
-
<TableCell data-testid="insurance.coverage">
|
|
406
|
-
<Reference fhirData={insurance.coverage} />
|
|
407
|
-
{insurance.focal && ' (focal)'}
|
|
408
|
-
</TableCell>
|
|
409
|
-
<TableCell data-testid="insurance.businessArrangement">
|
|
410
|
-
{insurance.businessArrangement ? (
|
|
411
|
-
insurance.businessArrangement
|
|
412
|
-
) : (
|
|
413
|
-
<MissingValue />
|
|
414
|
-
)}
|
|
415
|
-
</TableCell>
|
|
416
|
-
<TableCell data-testid="insurance.claimResponse">
|
|
417
|
-
{insurance.claimResponse ? (
|
|
418
|
-
<Reference fhirData={insurance.claimResponse} />
|
|
419
|
-
) : (
|
|
420
|
-
<MissingValue />
|
|
421
|
-
)}
|
|
422
|
-
</TableCell>
|
|
423
|
-
</TableRow>
|
|
424
|
-
))}
|
|
425
|
-
</tbody>
|
|
426
|
-
</Table>
|
|
427
|
-
</ValueSection>
|
|
428
|
-
);
|
|
429
|
-
};
|
|
430
|
-
|
|
431
|
-
const Item = props => {
|
|
432
|
-
const { item, parentSequences, level } = props;
|
|
433
|
-
|
|
434
|
-
const fill = Array(level)
|
|
435
|
-
.fill(null)
|
|
436
|
-
.map((_, idx) => (
|
|
437
|
-
<div key={idx} className="fhir-resource__Claim__item-level-fill"></div>
|
|
438
|
-
));
|
|
439
|
-
|
|
440
|
-
const itemSequences = [...parentSequences, item.sequence];
|
|
441
|
-
const id = itemSequences.join('.');
|
|
442
|
-
|
|
443
|
-
return (
|
|
444
|
-
<>
|
|
445
|
-
<TableRow>
|
|
446
|
-
<TableCell data-testid="items.level">
|
|
447
|
-
<div className="fhir-resource__Claim__item-level">{fill}</div>
|
|
448
|
-
</TableCell>
|
|
449
|
-
<TableCell data-testid="items.sequence">{id}</TableCell>
|
|
450
|
-
<TableCell data-testid="items.service">
|
|
451
|
-
<Coding fhirData={item.service} />
|
|
452
|
-
</TableCell>
|
|
453
|
-
<TableCell data-testid="items.unitPrice">
|
|
454
|
-
{item.unitPrice ? (
|
|
455
|
-
<Money fhirData={item.unitPrice} />
|
|
456
|
-
) : (
|
|
457
|
-
<MissingValue />
|
|
458
|
-
)}
|
|
459
|
-
{item.factor != null ? (
|
|
460
|
-
<span> × {item.factor}</span>
|
|
461
|
-
) : null}
|
|
462
|
-
</TableCell>
|
|
463
|
-
<TableCell data-testid="items.quantity">
|
|
464
|
-
{item.quantity != null ? item.quantity : <MissingValue />}
|
|
465
|
-
</TableCell>
|
|
466
|
-
<TableCell data-testid="items.net">
|
|
467
|
-
{item.net ? <Money fhirData={item.net} /> : <MissingValue />}
|
|
468
|
-
</TableCell>
|
|
469
|
-
</TableRow>
|
|
470
|
-
{item.subItems.map((subItem, idx) => (
|
|
471
|
-
<Item
|
|
472
|
-
key={idx}
|
|
473
|
-
item={subItem}
|
|
474
|
-
level={level + 1}
|
|
475
|
-
parentSequences={itemSequences}
|
|
476
|
-
/>
|
|
477
|
-
))}
|
|
478
|
-
</>
|
|
479
|
-
);
|
|
480
|
-
};
|
|
481
|
-
|
|
482
|
-
const Items = props => {
|
|
483
|
-
const { items } = props;
|
|
484
|
-
|
|
485
|
-
return (
|
|
486
|
-
<ValueSection label="Items" data-testid="items">
|
|
487
|
-
<Table>
|
|
488
|
-
<thead>
|
|
489
|
-
<TableRow>
|
|
490
|
-
<TableHeader />
|
|
491
|
-
<TableHeader>ID</TableHeader>
|
|
492
|
-
<TableHeader expand>Service</TableHeader>
|
|
493
|
-
<TableHeader>Unit price</TableHeader>
|
|
494
|
-
<TableHeader>Quantity</TableHeader>
|
|
495
|
-
<TableHeader>Total</TableHeader>
|
|
496
|
-
</TableRow>
|
|
497
|
-
</thead>
|
|
498
|
-
<tbody>
|
|
499
|
-
{items.map((item, idx) => (
|
|
500
|
-
<Item key={idx} item={item} level={0} parentSequences={[]} />
|
|
501
|
-
))}
|
|
502
|
-
</tbody>
|
|
503
|
-
</Table>
|
|
504
|
-
</ValueSection>
|
|
505
|
-
);
|
|
506
|
-
};
|
|
507
|
-
|
|
508
|
-
const Claim = props => {
|
|
509
|
-
const { fhirResource, fhirVersion } = props;
|
|
301
|
+
const Claim = ({
|
|
302
|
+
fhirResource,
|
|
303
|
+
fhirVersion,
|
|
304
|
+
fhirIcons,
|
|
305
|
+
onClick,
|
|
306
|
+
rawOnClick,
|
|
307
|
+
}) => {
|
|
510
308
|
let fhirResourceData = {};
|
|
511
309
|
try {
|
|
512
310
|
fhirResourceData = resourceDTO(fhirVersion, fhirResource);
|
|
@@ -537,103 +335,161 @@ const Claim = props => {
|
|
|
537
335
|
const hasDiagnosis = diagnosis.length > 0;
|
|
538
336
|
const hasInsurance = insurance.length > 0;
|
|
539
337
|
|
|
338
|
+
const tableData1 = [
|
|
339
|
+
{
|
|
340
|
+
label: 'Type',
|
|
341
|
+
testId: 'type',
|
|
342
|
+
data: <Coding fhirData={typeCoding} />,
|
|
343
|
+
status: true,
|
|
344
|
+
},
|
|
345
|
+
{
|
|
346
|
+
label: 'Created at',
|
|
347
|
+
testId: 'created',
|
|
348
|
+
data: created && <DateType fhirData={created} />,
|
|
349
|
+
status: created,
|
|
350
|
+
},
|
|
351
|
+
{
|
|
352
|
+
label: 'Accident',
|
|
353
|
+
testId: 'accident',
|
|
354
|
+
data: accident && (
|
|
355
|
+
<>
|
|
356
|
+
{accident.date && (
|
|
357
|
+
<Value label="Date" data-testid="accident.date">
|
|
358
|
+
<DateType fhirData={accident.date} />
|
|
359
|
+
</Value>
|
|
360
|
+
)}
|
|
361
|
+
{accident.coding && (
|
|
362
|
+
<Value label="Type" data-testid="accident.type">
|
|
363
|
+
<Coding fhirData={accident.coding} />
|
|
364
|
+
</Value>
|
|
365
|
+
)}
|
|
366
|
+
</>
|
|
367
|
+
),
|
|
368
|
+
status: accident,
|
|
369
|
+
},
|
|
370
|
+
{
|
|
371
|
+
label: 'Employment impacted',
|
|
372
|
+
testId: 'employmentImpacted',
|
|
373
|
+
data: employmentImpacted && (
|
|
374
|
+
<>
|
|
375
|
+
{employmentImpacted.start ? (
|
|
376
|
+
<DateType fhirData={employmentImpacted.start} />
|
|
377
|
+
) : (
|
|
378
|
+
<MissingValue />
|
|
379
|
+
)}
|
|
380
|
+
{' - '}
|
|
381
|
+
{employmentImpacted.end ? (
|
|
382
|
+
<DateType fhirData={employmentImpacted.end} />
|
|
383
|
+
) : (
|
|
384
|
+
<MissingValue />
|
|
385
|
+
)}
|
|
386
|
+
</>
|
|
387
|
+
),
|
|
388
|
+
status: employmentImpacted,
|
|
389
|
+
},
|
|
390
|
+
{
|
|
391
|
+
label: 'Hospitalization',
|
|
392
|
+
testId: 'hospitalization',
|
|
393
|
+
data: hospitalization && (
|
|
394
|
+
<>
|
|
395
|
+
{hospitalization.start ? (
|
|
396
|
+
<DateType fhirData={hospitalization.start} />
|
|
397
|
+
) : (
|
|
398
|
+
<MissingValue />
|
|
399
|
+
)}
|
|
400
|
+
{' - '}
|
|
401
|
+
{hospitalization.end ? (
|
|
402
|
+
<DateType fhirData={hospitalization.end} />
|
|
403
|
+
) : (
|
|
404
|
+
<MissingValue />
|
|
405
|
+
)}
|
|
406
|
+
</>
|
|
407
|
+
),
|
|
408
|
+
status: hospitalization,
|
|
409
|
+
},
|
|
410
|
+
];
|
|
411
|
+
|
|
412
|
+
const tableData2 = [
|
|
413
|
+
{
|
|
414
|
+
label: 'Insurer',
|
|
415
|
+
testId: 'insurer',
|
|
416
|
+
data: insurer && <Reference fhirData={insurer} />,
|
|
417
|
+
status: insurer,
|
|
418
|
+
},
|
|
419
|
+
{
|
|
420
|
+
label: 'Organization',
|
|
421
|
+
testId: 'organization',
|
|
422
|
+
data: organization && <Reference fhirData={organization} />,
|
|
423
|
+
status: organization,
|
|
424
|
+
},
|
|
425
|
+
{
|
|
426
|
+
label: 'Payee',
|
|
427
|
+
testId: 'payee.type',
|
|
428
|
+
data: payee.coding && <Coding fhirData={payee.coding} />,
|
|
429
|
+
status: payee.coding,
|
|
430
|
+
},
|
|
431
|
+
{
|
|
432
|
+
label: 'Payee party',
|
|
433
|
+
testId: 'payee.party',
|
|
434
|
+
data: payee.party && <Reference fhirData={payee.party} />,
|
|
435
|
+
status: payee.party,
|
|
436
|
+
},
|
|
437
|
+
{
|
|
438
|
+
label: 'Priority',
|
|
439
|
+
testId: 'priority',
|
|
440
|
+
data: priorityCoding && <Coding fhirData={priorityCoding} />,
|
|
441
|
+
status: priorityCoding,
|
|
442
|
+
},
|
|
443
|
+
];
|
|
444
|
+
|
|
540
445
|
return (
|
|
541
446
|
<Root name="Claim">
|
|
542
|
-
<
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
{
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
<DateType fhirData={employmentImpacted.end} />
|
|
582
|
-
) : (
|
|
583
|
-
<MissingValue />
|
|
584
|
-
)}
|
|
585
|
-
</Value>
|
|
586
|
-
)}
|
|
587
|
-
{hospitalization && (
|
|
588
|
-
<Value label="Hospitalization" data-testid="hospitalization">
|
|
589
|
-
{hospitalization.start ? (
|
|
590
|
-
<DateType fhirData={hospitalization.start} />
|
|
591
|
-
) : (
|
|
592
|
-
<MissingValue />
|
|
593
|
-
)}
|
|
594
|
-
{' - '}
|
|
595
|
-
{hospitalization.end ? (
|
|
596
|
-
<DateType fhirData={hospitalization.end} />
|
|
597
|
-
) : (
|
|
598
|
-
<MissingValue />
|
|
447
|
+
<Accordion
|
|
448
|
+
headerContent={
|
|
449
|
+
<Header
|
|
450
|
+
resourceName="Claim"
|
|
451
|
+
title={`Claim #${id}`}
|
|
452
|
+
badges={
|
|
453
|
+
<>
|
|
454
|
+
{use && <Badge data-testid="use">{use}</Badge>}
|
|
455
|
+
{status && <Badge data-testid="status">{status}</Badge>}
|
|
456
|
+
</>
|
|
457
|
+
}
|
|
458
|
+
icon={fhirIcons}
|
|
459
|
+
/>
|
|
460
|
+
}
|
|
461
|
+
bodyContent={
|
|
462
|
+
<Body tableData={tableData1}>
|
|
463
|
+
{hasCareTeam && <CareTeam careTeam={careTeam} />}
|
|
464
|
+
{hasDiagnosis && <Diagnosis diagnosis={diagnosis} />}
|
|
465
|
+
<ValueSection>
|
|
466
|
+
{tableData2.map(
|
|
467
|
+
(item, index) =>
|
|
468
|
+
item.status && (
|
|
469
|
+
<ValueSectionItem
|
|
470
|
+
key={`claim-item-${index}`}
|
|
471
|
+
label={item.label}
|
|
472
|
+
data-testid={item.testId}
|
|
473
|
+
>
|
|
474
|
+
{item.data}
|
|
475
|
+
</ValueSectionItem>
|
|
476
|
+
),
|
|
477
|
+
)}
|
|
478
|
+
</ValueSection>
|
|
479
|
+
{hasInsurance && <Insurance insurance={insurance} />}
|
|
480
|
+
{total && (
|
|
481
|
+
<ValueSection>
|
|
482
|
+
<ValueSectionItem label="Total amount" data-testid="total">
|
|
483
|
+
<Money fhirData={total} />
|
|
484
|
+
</ValueSectionItem>
|
|
485
|
+
</ValueSection>
|
|
599
486
|
)}
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
{
|
|
605
|
-
|
|
606
|
-
<Reference fhirData={insurer} />
|
|
607
|
-
</Value>
|
|
608
|
-
)}
|
|
609
|
-
{organization && (
|
|
610
|
-
<Value label="Organization" data-testid="organization">
|
|
611
|
-
<Reference fhirData={organization} />
|
|
612
|
-
</Value>
|
|
613
|
-
)}
|
|
614
|
-
{payee.coding && (
|
|
615
|
-
<Value label="Payee" data-testid="payee.type">
|
|
616
|
-
<Coding fhirData={payee.coding} />
|
|
617
|
-
</Value>
|
|
618
|
-
)}
|
|
619
|
-
{payee.party && (
|
|
620
|
-
<Value label="Payee party" data-testid="payee.party">
|
|
621
|
-
<Reference fhirData={payee.party} />
|
|
622
|
-
</Value>
|
|
623
|
-
)}
|
|
624
|
-
{priorityCoding && (
|
|
625
|
-
<Value label="Priority" data-testid="priority">
|
|
626
|
-
<Coding fhirData={priorityCoding} />
|
|
627
|
-
</Value>
|
|
628
|
-
)}
|
|
629
|
-
{hasInsurance && <Insurance insurance={insurance} />}
|
|
630
|
-
{total && (
|
|
631
|
-
<Value label="Total amount" data-testid="total">
|
|
632
|
-
<Money fhirData={total} />
|
|
633
|
-
</Value>
|
|
634
|
-
)}
|
|
635
|
-
{items && <Items items={items} />}
|
|
636
|
-
</Body>
|
|
487
|
+
{items && <Items items={items} />}
|
|
488
|
+
</Body>
|
|
489
|
+
}
|
|
490
|
+
onClick={onClick}
|
|
491
|
+
rawOnClick={rawOnClick}
|
|
492
|
+
/>
|
|
637
493
|
</Root>
|
|
638
494
|
);
|
|
639
495
|
};
|
|
@@ -11,6 +11,8 @@ import stu3Example3 from '../../../fixtures/stu3/resources/claim/example-3.json'
|
|
|
11
11
|
|
|
12
12
|
import r4Example1 from '../../../fixtures/r4/resources/claim/example1.json';
|
|
13
13
|
import r4Example2 from '../../../fixtures/r4/resources/claim/example2.json';
|
|
14
|
+
import ClaimIcon from '../../../assets/containers/Claim/claim.svg';
|
|
15
|
+
import fhirIcons from '../../../fixtures/example-icons';
|
|
14
16
|
|
|
15
17
|
export default {
|
|
16
18
|
title: 'Claim',
|
|
@@ -18,27 +20,57 @@ export default {
|
|
|
18
20
|
|
|
19
21
|
export const ExampleOfDSTU2 = () => {
|
|
20
22
|
const fhirResource = object('Resource', dstu2Example1);
|
|
21
|
-
return
|
|
23
|
+
return (
|
|
24
|
+
<Claim
|
|
25
|
+
fhirVersion={fhirVersions.DSTU2}
|
|
26
|
+
fhirResource={fhirResource}
|
|
27
|
+
fhirIcons={require('../../../assets/containers/Claim/claim.svg')}
|
|
28
|
+
/>
|
|
29
|
+
);
|
|
22
30
|
};
|
|
23
31
|
|
|
24
32
|
export const ExampleOfSTU3 = () => {
|
|
25
33
|
const fhirResource = object('Resource', stu3Example1);
|
|
26
|
-
return
|
|
34
|
+
return (
|
|
35
|
+
<Claim
|
|
36
|
+
fhirVersion={fhirVersions.STU3}
|
|
37
|
+
fhirResource={fhirResource}
|
|
38
|
+
fhirIcons={ClaimIcon}
|
|
39
|
+
/>
|
|
40
|
+
);
|
|
27
41
|
};
|
|
28
42
|
|
|
29
43
|
export const Example2OfSTU3 = () => {
|
|
30
44
|
const fhirResource = object('Resource', stu3Example2);
|
|
31
|
-
return
|
|
45
|
+
return (
|
|
46
|
+
<Claim
|
|
47
|
+
fhirVersion={fhirVersions.STU3}
|
|
48
|
+
fhirResource={fhirResource}
|
|
49
|
+
fhirIcons={fhirIcons}
|
|
50
|
+
/>
|
|
51
|
+
);
|
|
32
52
|
};
|
|
33
53
|
|
|
34
54
|
export const Example3OfSTU3 = () => {
|
|
35
55
|
const fhirResource = object('Resource', stu3Example3);
|
|
36
|
-
return
|
|
56
|
+
return (
|
|
57
|
+
<Claim
|
|
58
|
+
fhirVersion={fhirVersions.STU3}
|
|
59
|
+
fhirResource={fhirResource}
|
|
60
|
+
fhirIcons={false}
|
|
61
|
+
/>
|
|
62
|
+
);
|
|
37
63
|
};
|
|
38
64
|
|
|
39
65
|
export const Example1OfR4 = () => {
|
|
40
66
|
const fhirResource = object('Resource', r4Example1);
|
|
41
|
-
return
|
|
67
|
+
return (
|
|
68
|
+
<Claim
|
|
69
|
+
fhirVersion={fhirVersions.R4}
|
|
70
|
+
fhirResource={fhirResource}
|
|
71
|
+
fhirIcons={'random text'}
|
|
72
|
+
/>
|
|
73
|
+
);
|
|
42
74
|
};
|
|
43
75
|
|
|
44
76
|
export const Example2OfR4 = () => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { render } from '@testing-library/react';
|
|
2
|
+
import { fireEvent, render } from '@testing-library/react';
|
|
3
3
|
|
|
4
4
|
import Claim from './Claim';
|
|
5
5
|
import fhirVersions from '../fhirResourceVersions';
|
|
@@ -9,8 +9,80 @@ import stu3Example1 from '../../../fixtures/stu3/resources/claim/example-1.json'
|
|
|
9
9
|
import stu3Example2 from '../../../fixtures/stu3/resources/claim/example-2.json';
|
|
10
10
|
import stu3Example3 from '../../../fixtures/stu3/resources/claim/example-3.json';
|
|
11
11
|
import r4Example1 from '../../../fixtures/r4/resources/claim/example1.json';
|
|
12
|
+
import fhirIcons from '../../../fixtures/example-icons';
|
|
12
13
|
|
|
13
14
|
describe('should render the Claim component properly', () => {
|
|
15
|
+
it('component without a fhirIcons props should render a default icon', () => {
|
|
16
|
+
const defaultProps = {
|
|
17
|
+
fhirVersion: fhirVersions.DSTU2,
|
|
18
|
+
fhirResource: dstu2Example1,
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const { getByAltText } = render(<Claim {...defaultProps} />);
|
|
22
|
+
const headerIcon = getByAltText('claim');
|
|
23
|
+
|
|
24
|
+
expect(headerIcon.getAttribute('src')).toContain('IMAGE_MOCK');
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it('component with a false as a fhirIcons props should render a placeholder', () => {
|
|
28
|
+
const defaultProps = {
|
|
29
|
+
fhirVersion: fhirVersions.DSTU2,
|
|
30
|
+
fhirResource: dstu2Example1,
|
|
31
|
+
fhirIcons: false,
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const { getByTestId } = render(<Claim {...defaultProps} />);
|
|
35
|
+
const headerIcon = getByTestId('placeholder');
|
|
36
|
+
|
|
37
|
+
expect(headerIcon).toBeTruthy();
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it('component with the img as a fhirIcons props should render an img', () => {
|
|
41
|
+
const defaultProps = {
|
|
42
|
+
fhirVersion: fhirVersions.DSTU2,
|
|
43
|
+
fhirResource: dstu2Example1,
|
|
44
|
+
fhirIcons: (
|
|
45
|
+
<img
|
|
46
|
+
src={require('../assets/containers/Claim/claim.svg')}
|
|
47
|
+
alt="claim"
|
|
48
|
+
/>
|
|
49
|
+
),
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const { getByAltText } = render(<Claim {...defaultProps} />);
|
|
53
|
+
const headerIcon = getByAltText('claim');
|
|
54
|
+
|
|
55
|
+
expect(headerIcon.getAttribute('src')).toContain('IMAGE_MOCK');
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it('component with the resources object as a fhirIcons props should render an img', () => {
|
|
59
|
+
const defaultProps = {
|
|
60
|
+
fhirVersion: fhirVersions.DSTU2,
|
|
61
|
+
fhirResource: dstu2Example1,
|
|
62
|
+
fhirIcons: fhirIcons,
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const { getByAltText } = render(<Claim {...defaultProps} />);
|
|
66
|
+
const headerIcon = getByAltText('clipboard with a symmetrical cross');
|
|
67
|
+
|
|
68
|
+
expect(headerIcon.getAttribute('src')).toContain('IMAGE_MOCK');
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it('component with the url as a fhirIcons props should render an img', () => {
|
|
72
|
+
const avatarSrc =
|
|
73
|
+
'https://www.gravatar.com/avatar/?s=50&r=any&default=identicon&forcedefault=1';
|
|
74
|
+
const defaultProps = {
|
|
75
|
+
fhirVersion: fhirVersions.DSTU2,
|
|
76
|
+
fhirResource: dstu2Example1,
|
|
77
|
+
fhirIcons: avatarSrc,
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
const { getByAltText } = render(<Claim {...defaultProps} />);
|
|
81
|
+
const headerIcon = getByAltText('header icon');
|
|
82
|
+
|
|
83
|
+
expect(headerIcon.getAttribute('src')).toContain(avatarSrc);
|
|
84
|
+
});
|
|
85
|
+
|
|
14
86
|
it('with DSTU2 source data', () => {
|
|
15
87
|
const defaultProps = {
|
|
16
88
|
fhirResource: dstu2Example1,
|
|
@@ -288,4 +360,35 @@ describe('should render the Claim component properly', () => {
|
|
|
288
360
|
expect(quantities).toEqual(['-']);
|
|
289
361
|
expect(netPrices).toEqual(['135.57 USD']);
|
|
290
362
|
});
|
|
363
|
+
|
|
364
|
+
it('should fire custom onClick function', () => {
|
|
365
|
+
const defaultProps = {
|
|
366
|
+
fhirResource: r4Example1,
|
|
367
|
+
fhirVersion: fhirVersions.R4,
|
|
368
|
+
};
|
|
369
|
+
|
|
370
|
+
const onClick = jest.fn();
|
|
371
|
+
const { getByRole } = render(<Claim {...defaultProps} onClick={onClick} />);
|
|
372
|
+
const accordion = getByRole('button');
|
|
373
|
+
fireEvent.click(accordion);
|
|
374
|
+
|
|
375
|
+
const attribute = accordion.getAttribute('data-bs-toggle');
|
|
376
|
+
expect(attribute).not.toEqual('collapse');
|
|
377
|
+
expect(onClick).toHaveBeenCalled();
|
|
378
|
+
});
|
|
379
|
+
|
|
380
|
+
it('should not fire custom onClick function', () => {
|
|
381
|
+
const defaultProps = {
|
|
382
|
+
fhirResource: r4Example1,
|
|
383
|
+
fhirVersion: fhirVersions.R4,
|
|
384
|
+
};
|
|
385
|
+
|
|
386
|
+
const onClick = 'test';
|
|
387
|
+
const { getByRole } = render(<Claim {...defaultProps} onClick={onClick} />);
|
|
388
|
+
const accordion = getByRole('button');
|
|
389
|
+
fireEvent.click(accordion);
|
|
390
|
+
|
|
391
|
+
const attribute = accordion.getAttribute('data-bs-toggle');
|
|
392
|
+
expect(attribute).toEqual('collapse');
|
|
393
|
+
});
|
|
291
394
|
});
|