@ltht-react/diagnosis-summary 2.0.190 → 2.0.191
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/README.md +22 -22
- package/package.json +10 -10
- package/src/atoms/diagnosis-category.tsx +31 -31
- package/src/atoms/diagnosis-data-source.tsx +45 -45
- package/src/atoms/diagnosis-onset-estimated.tsx +40 -40
- package/src/atoms/diagnosis-title.tsx +72 -72
- package/src/constants.ts +5 -5
- package/src/index.tsx +3 -3
- package/src/molecules/diagnosis-redacted.tsx +31 -31
- package/src/organisms/diagnosis-summary.tsx +252 -252
package/README.md
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
# DiagnosisSummary
|
|
2
|
-
|
|
3
|
-
<!-- STORY -->
|
|
4
|
-
|
|
5
|
-
### Import
|
|
6
|
-
|
|
7
|
-
```js
|
|
8
|
-
import DiagnosisSummary from '@ltht-react/diagnosis-summary'
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
### Usage
|
|
12
|
-
|
|
13
|
-
```jsx
|
|
14
|
-
<DiagnosisSummary title="Conditions" conditions={conditions} clickHandler={handleCLick} />
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
### Properties
|
|
18
|
-
|
|
19
|
-
| Prop | Required | Default | Type | Description |
|
|
20
|
-
| :------------- | :------- | :-------- | :---------- | :------------------------------------------------------------ |
|
|
21
|
-
| `conditions` | Yes | | Condition[] | Array of conditions to display |
|
|
22
|
-
| `clickHandler` | No | undefined | Function | Callback click handler containing the selected condition item |
|
|
1
|
+
# DiagnosisSummary
|
|
2
|
+
|
|
3
|
+
<!-- STORY -->
|
|
4
|
+
|
|
5
|
+
### Import
|
|
6
|
+
|
|
7
|
+
```js
|
|
8
|
+
import DiagnosisSummary from '@ltht-react/diagnosis-summary'
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
### Usage
|
|
12
|
+
|
|
13
|
+
```jsx
|
|
14
|
+
<DiagnosisSummary title="Conditions" conditions={conditions} clickHandler={handleCLick} />
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### Properties
|
|
18
|
+
|
|
19
|
+
| Prop | Required | Default | Type | Description |
|
|
20
|
+
| :------------- | :------- | :-------- | :---------- | :------------------------------------------------------------ |
|
|
21
|
+
| `conditions` | Yes | | Condition[] | Array of conditions to display |
|
|
22
|
+
| `clickHandler` | No | undefined | Function | Callback click handler containing the selected condition item |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ltht-react/diagnosis-summary",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.191",
|
|
4
4
|
"description": "ltht-react clinical DiagnosisSummary component.",
|
|
5
5
|
"author": "LTHT",
|
|
6
6
|
"homepage": "",
|
|
@@ -28,16 +28,16 @@
|
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@emotion/react": "^11.0.0",
|
|
30
30
|
"@emotion/styled": "^11.0.0",
|
|
31
|
-
"@ltht-react/button": "^2.0.
|
|
32
|
-
"@ltht-react/hooks": "^2.0.
|
|
33
|
-
"@ltht-react/icon": "^2.0.
|
|
34
|
-
"@ltht-react/list": "^2.0.
|
|
35
|
-
"@ltht-react/styles": "^2.0.
|
|
36
|
-
"@ltht-react/type-summary": "^2.0.
|
|
37
|
-
"@ltht-react/types": "^2.0.
|
|
38
|
-
"@ltht-react/utils": "^2.0.
|
|
31
|
+
"@ltht-react/button": "^2.0.191",
|
|
32
|
+
"@ltht-react/hooks": "^2.0.191",
|
|
33
|
+
"@ltht-react/icon": "^2.0.191",
|
|
34
|
+
"@ltht-react/list": "^2.0.191",
|
|
35
|
+
"@ltht-react/styles": "^2.0.191",
|
|
36
|
+
"@ltht-react/type-summary": "^2.0.191",
|
|
37
|
+
"@ltht-react/types": "^2.0.191",
|
|
38
|
+
"@ltht-react/utils": "^2.0.191",
|
|
39
39
|
"html-react-parser": "^5.0.6",
|
|
40
40
|
"react": "^18.2.0"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "c5113953a19f4ed9ae82b545f073b5feb7d5a20b"
|
|
43
43
|
}
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import { FC, HTMLAttributes } from 'react'
|
|
2
|
-
import styled from '@emotion/styled'
|
|
3
|
-
|
|
4
|
-
import { TEXT_COLOURS } from '@ltht-react/styles'
|
|
5
|
-
import { Condition } from '@ltht-react/types'
|
|
6
|
-
import { codeableConceptDisplaySummary } from '@ltht-react/utils'
|
|
7
|
-
|
|
8
|
-
const StyledConditionCategory = styled.div<IStyledDescription>`
|
|
9
|
-
color: ${TEXT_COLOURS.SECONDARY.VALUE};
|
|
10
|
-
text-align: left;
|
|
11
|
-
font-size: smaller;
|
|
12
|
-
padding-top: 0.25rem;
|
|
13
|
-
text-decoration: ${({ enteredInError }) => (enteredInError ? 'line-through' : 'none')};
|
|
14
|
-
`
|
|
15
|
-
|
|
16
|
-
const DiagnosisCategory: FC<Props> = ({ condition, enteredInError, ...rest }) => (
|
|
17
|
-
<StyledConditionCategory enteredInError={enteredInError} {...rest}>
|
|
18
|
-
{codeableConceptDisplaySummary(condition.severity)}
|
|
19
|
-
</StyledConditionCategory>
|
|
20
|
-
)
|
|
21
|
-
|
|
22
|
-
interface Props extends HTMLAttributes<HTMLDivElement> {
|
|
23
|
-
condition: Condition
|
|
24
|
-
enteredInError: boolean
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
interface IStyledDescription {
|
|
28
|
-
enteredInError: boolean
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export default DiagnosisCategory
|
|
1
|
+
import { FC, HTMLAttributes } from 'react'
|
|
2
|
+
import styled from '@emotion/styled'
|
|
3
|
+
|
|
4
|
+
import { TEXT_COLOURS } from '@ltht-react/styles'
|
|
5
|
+
import { Condition } from '@ltht-react/types'
|
|
6
|
+
import { codeableConceptDisplaySummary } from '@ltht-react/utils'
|
|
7
|
+
|
|
8
|
+
const StyledConditionCategory = styled.div<IStyledDescription>`
|
|
9
|
+
color: ${TEXT_COLOURS.SECONDARY.VALUE};
|
|
10
|
+
text-align: left;
|
|
11
|
+
font-size: smaller;
|
|
12
|
+
padding-top: 0.25rem;
|
|
13
|
+
text-decoration: ${({ enteredInError }) => (enteredInError ? 'line-through' : 'none')};
|
|
14
|
+
`
|
|
15
|
+
|
|
16
|
+
const DiagnosisCategory: FC<Props> = ({ condition, enteredInError, ...rest }) => (
|
|
17
|
+
<StyledConditionCategory enteredInError={enteredInError} {...rest}>
|
|
18
|
+
{codeableConceptDisplaySummary(condition.severity)}
|
|
19
|
+
</StyledConditionCategory>
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
interface Props extends HTMLAttributes<HTMLDivElement> {
|
|
23
|
+
condition: Condition
|
|
24
|
+
enteredInError: boolean
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
interface IStyledDescription {
|
|
28
|
+
enteredInError: boolean
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export default DiagnosisCategory
|
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
import { FC, HTMLAttributes } from 'react'
|
|
2
|
-
import styled from '@emotion/styled'
|
|
3
|
-
|
|
4
|
-
import { TEXT_COLOURS } from '@ltht-react/styles'
|
|
5
|
-
import { Condition } from '@ltht-react/types'
|
|
6
|
-
|
|
7
|
-
const StyledConditionStatus = styled.div<IStyledDescription>`
|
|
8
|
-
color: ${TEXT_COLOURS.SECONDARY.VALUE};
|
|
9
|
-
text-align: left;
|
|
10
|
-
font-size: smaller;
|
|
11
|
-
text-decoration: ${({ enteredInError }) => (enteredInError ? 'line-through' : 'none')};
|
|
12
|
-
`
|
|
13
|
-
|
|
14
|
-
const extractDataSourceDisplayNames = (condition: Condition) => {
|
|
15
|
-
const dataSourceDisplayNames: string[] = []
|
|
16
|
-
|
|
17
|
-
condition?.metadata?.dataSources?.forEach((dataSource, _) => {
|
|
18
|
-
if (dataSource?.display) {
|
|
19
|
-
dataSourceDisplayNames.push(dataSource.display)
|
|
20
|
-
}
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
return dataSourceDisplayNames.join(', ')
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const DiagnosisDataSource: FC<Props> = ({ condition, enteredInError, ...rest }) => {
|
|
27
|
-
const dataSourceDisplayNames = extractDataSourceDisplayNames(condition)
|
|
28
|
-
|
|
29
|
-
return (
|
|
30
|
-
<StyledConditionStatus enteredInError={enteredInError} {...rest}>
|
|
31
|
-
{dataSourceDisplayNames ? `Source: ${dataSourceDisplayNames}` : `Source: Unknown`}
|
|
32
|
-
</StyledConditionStatus>
|
|
33
|
-
)
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
interface Props extends HTMLAttributes<HTMLDivElement> {
|
|
37
|
-
condition: Condition
|
|
38
|
-
enteredInError: boolean
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
interface IStyledDescription {
|
|
42
|
-
enteredInError: boolean
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export default DiagnosisDataSource
|
|
1
|
+
import { FC, HTMLAttributes } from 'react'
|
|
2
|
+
import styled from '@emotion/styled'
|
|
3
|
+
|
|
4
|
+
import { TEXT_COLOURS } from '@ltht-react/styles'
|
|
5
|
+
import { Condition } from '@ltht-react/types'
|
|
6
|
+
|
|
7
|
+
const StyledConditionStatus = styled.div<IStyledDescription>`
|
|
8
|
+
color: ${TEXT_COLOURS.SECONDARY.VALUE};
|
|
9
|
+
text-align: left;
|
|
10
|
+
font-size: smaller;
|
|
11
|
+
text-decoration: ${({ enteredInError }) => (enteredInError ? 'line-through' : 'none')};
|
|
12
|
+
`
|
|
13
|
+
|
|
14
|
+
const extractDataSourceDisplayNames = (condition: Condition) => {
|
|
15
|
+
const dataSourceDisplayNames: string[] = []
|
|
16
|
+
|
|
17
|
+
condition?.metadata?.dataSources?.forEach((dataSource, _) => {
|
|
18
|
+
if (dataSource?.display) {
|
|
19
|
+
dataSourceDisplayNames.push(dataSource.display)
|
|
20
|
+
}
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
return dataSourceDisplayNames.join(', ')
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const DiagnosisDataSource: FC<Props> = ({ condition, enteredInError, ...rest }) => {
|
|
27
|
+
const dataSourceDisplayNames = extractDataSourceDisplayNames(condition)
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<StyledConditionStatus enteredInError={enteredInError} {...rest}>
|
|
31
|
+
{dataSourceDisplayNames ? `Source: ${dataSourceDisplayNames}` : `Source: Unknown`}
|
|
32
|
+
</StyledConditionStatus>
|
|
33
|
+
)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
interface Props extends HTMLAttributes<HTMLDivElement> {
|
|
37
|
+
condition: Condition
|
|
38
|
+
enteredInError: boolean
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
interface IStyledDescription {
|
|
42
|
+
enteredInError: boolean
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export default DiagnosisDataSource
|
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
import { FC, HTMLAttributes } from 'react'
|
|
2
|
-
import styled from '@emotion/styled'
|
|
3
|
-
|
|
4
|
-
import { TEXT_COLOURS } from '@ltht-react/styles'
|
|
5
|
-
import { Condition } from '@ltht-react/types'
|
|
6
|
-
|
|
7
|
-
import { getBooleanExtension } from '@ltht-react/utils'
|
|
8
|
-
|
|
9
|
-
const StyledOnsetEstimated = styled.div<IStyledDescription>`
|
|
10
|
-
color: ${TEXT_COLOURS.INFO};
|
|
11
|
-
font-size: x-small;
|
|
12
|
-
white-space: pre-wrap;
|
|
13
|
-
display: inline-block;
|
|
14
|
-
text-align: right;
|
|
15
|
-
text-decoration: ${({ enteredInError }) => (enteredInError ? 'line-through' : 'none')};
|
|
16
|
-
`
|
|
17
|
-
|
|
18
|
-
const DiagnosisOnsetEstimated: FC<Props> = ({ condition, enteredInError, ...rest }) => {
|
|
19
|
-
const onsetDateEstimated = getBooleanExtension(
|
|
20
|
-
condition.extension,
|
|
21
|
-
'https://fhir.leedsth.nhs.uk/ValueSet/diagnosis-onset-date-estimated-1'
|
|
22
|
-
)
|
|
23
|
-
|
|
24
|
-
return (
|
|
25
|
-
<StyledOnsetEstimated enteredInError={enteredInError} {...rest}>
|
|
26
|
-
{onsetDateEstimated ? '(estimated)' : ''}
|
|
27
|
-
</StyledOnsetEstimated>
|
|
28
|
-
)
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
interface Props extends HTMLAttributes<HTMLDivElement> {
|
|
32
|
-
condition: Condition
|
|
33
|
-
enteredInError: boolean
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
interface IStyledDescription {
|
|
37
|
-
enteredInError: boolean
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export default DiagnosisOnsetEstimated
|
|
1
|
+
import { FC, HTMLAttributes } from 'react'
|
|
2
|
+
import styled from '@emotion/styled'
|
|
3
|
+
|
|
4
|
+
import { TEXT_COLOURS } from '@ltht-react/styles'
|
|
5
|
+
import { Condition } from '@ltht-react/types'
|
|
6
|
+
|
|
7
|
+
import { getBooleanExtension } from '@ltht-react/utils'
|
|
8
|
+
|
|
9
|
+
const StyledOnsetEstimated = styled.div<IStyledDescription>`
|
|
10
|
+
color: ${TEXT_COLOURS.INFO};
|
|
11
|
+
font-size: x-small;
|
|
12
|
+
white-space: pre-wrap;
|
|
13
|
+
display: inline-block;
|
|
14
|
+
text-align: right;
|
|
15
|
+
text-decoration: ${({ enteredInError }) => (enteredInError ? 'line-through' : 'none')};
|
|
16
|
+
`
|
|
17
|
+
|
|
18
|
+
const DiagnosisOnsetEstimated: FC<Props> = ({ condition, enteredInError, ...rest }) => {
|
|
19
|
+
const onsetDateEstimated = getBooleanExtension(
|
|
20
|
+
condition.extension,
|
|
21
|
+
'https://fhir.leedsth.nhs.uk/ValueSet/diagnosis-onset-date-estimated-1'
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<StyledOnsetEstimated enteredInError={enteredInError} {...rest}>
|
|
26
|
+
{onsetDateEstimated ? '(estimated)' : ''}
|
|
27
|
+
</StyledOnsetEstimated>
|
|
28
|
+
)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
interface Props extends HTMLAttributes<HTMLDivElement> {
|
|
32
|
+
condition: Condition
|
|
33
|
+
enteredInError: boolean
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
interface IStyledDescription {
|
|
37
|
+
enteredInError: boolean
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export default DiagnosisOnsetEstimated
|
|
@@ -1,72 +1,72 @@
|
|
|
1
|
-
import { FC, HTMLAttributes } from 'react'
|
|
2
|
-
import styled from '@emotion/styled'
|
|
3
|
-
import { titleCase, codeableConceptDisplaySummary } from '@ltht-react/utils'
|
|
4
|
-
import parseHtml from 'html-react-parser'
|
|
5
|
-
|
|
6
|
-
import { TEXT_COLOURS } from '@ltht-react/styles'
|
|
7
|
-
import { Condition } from '@ltht-react/types'
|
|
8
|
-
import { SNIPPET_HOVER_TEXT } from '../constants'
|
|
9
|
-
|
|
10
|
-
const StyledConditionTitle = styled.div<IStyledDescription>`
|
|
11
|
-
color: ${TEXT_COLOURS.PRIMARY};
|
|
12
|
-
text-align: left;
|
|
13
|
-
text-decoration: ${({ enteredInError }) => (enteredInError ? 'line-through' : 'none')};
|
|
14
|
-
`
|
|
15
|
-
|
|
16
|
-
const DiagnosisTitle: FC<Props> = ({ condition, enteredInError, systemExclusionsFilter, isRichText = false }) => {
|
|
17
|
-
const snippetTagText = extractSnippetTagDisplayValue(condition)
|
|
18
|
-
|
|
19
|
-
if (snippetTagText) {
|
|
20
|
-
return renderTitle(snippetTagText, enteredInError, isRichText)
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const conditionText = extractConditionOrFallbackText(condition, systemExclusionsFilter)
|
|
24
|
-
const conditionStatusText = extractConditionStatusText(condition)
|
|
25
|
-
const title = conditionStatusText ? `${conditionText}, ${conditionStatusText}` : conditionText
|
|
26
|
-
|
|
27
|
-
return renderTitle(title, enteredInError, isRichText)
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const extractConditionOrFallbackText = (condition: Condition, systemExclusionsFilter?: string[]): string => {
|
|
31
|
-
if (!condition?.code) {
|
|
32
|
-
return titleCase('Unknown Condition')
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const diagnosisTitle = codeableConceptDisplaySummary(condition.code, systemExclusionsFilter)
|
|
36
|
-
|
|
37
|
-
return titleCase(diagnosisTitle || 'Unknown Condition')
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const extractConditionStatusText = (condition: Condition): string => {
|
|
41
|
-
const statusParts: string[] = []
|
|
42
|
-
|
|
43
|
-
if (condition?.clinicalStatus) {
|
|
44
|
-
statusParts.push(condition?.clinicalStatus)
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
if (condition?.verificationStatus) {
|
|
48
|
-
statusParts.push(condition.verificationStatus)
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
return titleCase(statusParts.join(', '))
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
const extractSnippetTagDisplayValue = (condition: Condition) =>
|
|
55
|
-
condition?.metadata.tag?.find((coding) => coding?.system === SNIPPET_HOVER_TEXT)?.display
|
|
56
|
-
|
|
57
|
-
const renderTitle = (title: string, enteredInError: boolean, isRichText?: boolean) => (
|
|
58
|
-
<StyledConditionTitle enteredInError={enteredInError}>{isRichText ? parseHtml(title) : title}</StyledConditionTitle>
|
|
59
|
-
)
|
|
60
|
-
|
|
61
|
-
interface Props extends HTMLAttributes<HTMLDivElement> {
|
|
62
|
-
condition: Condition
|
|
63
|
-
enteredInError: boolean
|
|
64
|
-
systemExclusionsFilter?: string[]
|
|
65
|
-
isRichText?: boolean
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
interface IStyledDescription {
|
|
69
|
-
enteredInError: boolean
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export default DiagnosisTitle
|
|
1
|
+
import { FC, HTMLAttributes } from 'react'
|
|
2
|
+
import styled from '@emotion/styled'
|
|
3
|
+
import { titleCase, codeableConceptDisplaySummary } from '@ltht-react/utils'
|
|
4
|
+
import parseHtml from 'html-react-parser'
|
|
5
|
+
|
|
6
|
+
import { TEXT_COLOURS } from '@ltht-react/styles'
|
|
7
|
+
import { Condition } from '@ltht-react/types'
|
|
8
|
+
import { SNIPPET_HOVER_TEXT } from '../constants'
|
|
9
|
+
|
|
10
|
+
const StyledConditionTitle = styled.div<IStyledDescription>`
|
|
11
|
+
color: ${TEXT_COLOURS.PRIMARY};
|
|
12
|
+
text-align: left;
|
|
13
|
+
text-decoration: ${({ enteredInError }) => (enteredInError ? 'line-through' : 'none')};
|
|
14
|
+
`
|
|
15
|
+
|
|
16
|
+
const DiagnosisTitle: FC<Props> = ({ condition, enteredInError, systemExclusionsFilter, isRichText = false }) => {
|
|
17
|
+
const snippetTagText = extractSnippetTagDisplayValue(condition)
|
|
18
|
+
|
|
19
|
+
if (snippetTagText) {
|
|
20
|
+
return renderTitle(snippetTagText, enteredInError, isRichText)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const conditionText = extractConditionOrFallbackText(condition, systemExclusionsFilter)
|
|
24
|
+
const conditionStatusText = extractConditionStatusText(condition)
|
|
25
|
+
const title = conditionStatusText ? `${conditionText}, ${conditionStatusText}` : conditionText
|
|
26
|
+
|
|
27
|
+
return renderTitle(title, enteredInError, isRichText)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const extractConditionOrFallbackText = (condition: Condition, systemExclusionsFilter?: string[]): string => {
|
|
31
|
+
if (!condition?.code) {
|
|
32
|
+
return titleCase('Unknown Condition')
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const diagnosisTitle = codeableConceptDisplaySummary(condition.code, systemExclusionsFilter)
|
|
36
|
+
|
|
37
|
+
return titleCase(diagnosisTitle || 'Unknown Condition')
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const extractConditionStatusText = (condition: Condition): string => {
|
|
41
|
+
const statusParts: string[] = []
|
|
42
|
+
|
|
43
|
+
if (condition?.clinicalStatus) {
|
|
44
|
+
statusParts.push(condition?.clinicalStatus)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (condition?.verificationStatus) {
|
|
48
|
+
statusParts.push(condition.verificationStatus)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return titleCase(statusParts.join(', '))
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const extractSnippetTagDisplayValue = (condition: Condition) =>
|
|
55
|
+
condition?.metadata.tag?.find((coding) => coding?.system === SNIPPET_HOVER_TEXT)?.display
|
|
56
|
+
|
|
57
|
+
const renderTitle = (title: string, enteredInError: boolean, isRichText?: boolean) => (
|
|
58
|
+
<StyledConditionTitle enteredInError={enteredInError}>{isRichText ? parseHtml(title) : title}</StyledConditionTitle>
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
interface Props extends HTMLAttributes<HTMLDivElement> {
|
|
62
|
+
condition: Condition
|
|
63
|
+
enteredInError: boolean
|
|
64
|
+
systemExclusionsFilter?: string[]
|
|
65
|
+
isRichText?: boolean
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
interface IStyledDescription {
|
|
69
|
+
enteredInError: boolean
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export default DiagnosisTitle
|
package/src/constants.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const SNIPPET_HOVER_TEXT = 'https://leedsth.nhs.uk/cds/snippet-hover-text'
|
|
2
|
-
const EXTENSION_TEMPLATE_DISPLAY_NAME = 'https://leedsth.nhs.uk/cds/extension-template-display-name'
|
|
3
|
-
const EXTENSION_TEMPLATE_VERSION = 'https://leedsth.nhs.uk/cds/extension-template-version'
|
|
4
|
-
|
|
5
|
-
export { EXTENSION_TEMPLATE_DISPLAY_NAME, EXTENSION_TEMPLATE_VERSION, SNIPPET_HOVER_TEXT }
|
|
1
|
+
const SNIPPET_HOVER_TEXT = 'https://leedsth.nhs.uk/cds/snippet-hover-text'
|
|
2
|
+
const EXTENSION_TEMPLATE_DISPLAY_NAME = 'https://leedsth.nhs.uk/cds/extension-template-display-name'
|
|
3
|
+
const EXTENSION_TEMPLATE_VERSION = 'https://leedsth.nhs.uk/cds/extension-template-version'
|
|
4
|
+
|
|
5
|
+
export { EXTENSION_TEMPLATE_DISPLAY_NAME, EXTENSION_TEMPLATE_VERSION, SNIPPET_HOVER_TEXT }
|
package/src/index.tsx
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import DiagnosisSummary from './organisms/diagnosis-summary'
|
|
2
|
-
|
|
3
|
-
export default DiagnosisSummary
|
|
1
|
+
import DiagnosisSummary from './organisms/diagnosis-summary'
|
|
2
|
+
|
|
3
|
+
export default DiagnosisSummary
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import { FC } from 'react'
|
|
2
|
-
import styled from '@emotion/styled'
|
|
3
|
-
|
|
4
|
-
import { Condition } from '@ltht-react/types'
|
|
5
|
-
import { DateSummary, RedactedDescription } from '@ltht-react/type-summary'
|
|
6
|
-
|
|
7
|
-
const StyledRedactedDescription = styled.div`
|
|
8
|
-
flex-grow: 1;
|
|
9
|
-
text-align: left;
|
|
10
|
-
`
|
|
11
|
-
|
|
12
|
-
const StyledDateSummary = styled.div`
|
|
13
|
-
text-align: right;
|
|
14
|
-
`
|
|
15
|
-
|
|
16
|
-
const DiagnosisRedacted: FC<Props> = ({ condition }) => (
|
|
17
|
-
<>
|
|
18
|
-
<StyledRedactedDescription>
|
|
19
|
-
<RedactedDescription />
|
|
20
|
-
</StyledRedactedDescription>
|
|
21
|
-
<StyledDateSummary>
|
|
22
|
-
<DateSummary datetime={condition?.onset?.dateTime} />
|
|
23
|
-
</StyledDateSummary>
|
|
24
|
-
</>
|
|
25
|
-
)
|
|
26
|
-
|
|
27
|
-
interface Props {
|
|
28
|
-
condition?: Condition | null
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export default DiagnosisRedacted
|
|
1
|
+
import { FC } from 'react'
|
|
2
|
+
import styled from '@emotion/styled'
|
|
3
|
+
|
|
4
|
+
import { Condition } from '@ltht-react/types'
|
|
5
|
+
import { DateSummary, RedactedDescription } from '@ltht-react/type-summary'
|
|
6
|
+
|
|
7
|
+
const StyledRedactedDescription = styled.div`
|
|
8
|
+
flex-grow: 1;
|
|
9
|
+
text-align: left;
|
|
10
|
+
`
|
|
11
|
+
|
|
12
|
+
const StyledDateSummary = styled.div`
|
|
13
|
+
text-align: right;
|
|
14
|
+
`
|
|
15
|
+
|
|
16
|
+
const DiagnosisRedacted: FC<Props> = ({ condition }) => (
|
|
17
|
+
<>
|
|
18
|
+
<StyledRedactedDescription>
|
|
19
|
+
<RedactedDescription />
|
|
20
|
+
</StyledRedactedDescription>
|
|
21
|
+
<StyledDateSummary>
|
|
22
|
+
<DateSummary datetime={condition?.onset?.dateTime} />
|
|
23
|
+
</StyledDateSummary>
|
|
24
|
+
</>
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
interface Props {
|
|
28
|
+
condition?: Condition | null
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export default DiagnosisRedacted
|
|
@@ -1,252 +1,252 @@
|
|
|
1
|
-
import { cloneElement, FC, HTMLAttributes, ReactElement } from 'react'
|
|
2
|
-
import styled from '@emotion/styled'
|
|
3
|
-
|
|
4
|
-
import { Condition, ConditionVerificationStatus } from '@ltht-react/types'
|
|
5
|
-
import { DateSummary } from '@ltht-react/type-summary'
|
|
6
|
-
import Icon from '@ltht-react/icon'
|
|
7
|
-
import { Button, ButtonProps } from '@ltht-react/button'
|
|
8
|
-
|
|
9
|
-
import { BTN_COLOURS, SMALL_SCREEN_MAXIMUM_MEDIA_QUERY, TABLET_MINIMUM_MEDIA_QUERY } from '@ltht-react/styles'
|
|
10
|
-
import Title from '../atoms/diagnosis-title'
|
|
11
|
-
import OnsetDateEstimated from '../atoms/diagnosis-onset-estimated'
|
|
12
|
-
import Redacted from '../molecules/diagnosis-redacted'
|
|
13
|
-
import DiagnosisDataSource from '../atoms/diagnosis-data-source'
|
|
14
|
-
|
|
15
|
-
const StyledTitle = styled.div`
|
|
16
|
-
display: flex;
|
|
17
|
-
`
|
|
18
|
-
|
|
19
|
-
const StyledSummary = styled.div`
|
|
20
|
-
display: flex;
|
|
21
|
-
justify-content: center;
|
|
22
|
-
flex-direction: column;
|
|
23
|
-
`
|
|
24
|
-
|
|
25
|
-
const StyledDescription = styled.div`
|
|
26
|
-
flex-grow: 1;
|
|
27
|
-
`
|
|
28
|
-
|
|
29
|
-
const StyledTitleAndDateContainer = styled.div`
|
|
30
|
-
display: flex;
|
|
31
|
-
flex-grow: 1;
|
|
32
|
-
flex-direction: row;
|
|
33
|
-
gap: 5px;
|
|
34
|
-
|
|
35
|
-
${SMALL_SCREEN_MAXIMUM_MEDIA_QUERY} {
|
|
36
|
-
flex-flow: column nowrap;
|
|
37
|
-
align-items: flex-start;
|
|
38
|
-
div {
|
|
39
|
-
text-align: left;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
`
|
|
43
|
-
|
|
44
|
-
const StyledButtonAndTagContainer = styled.div`
|
|
45
|
-
display: flex;
|
|
46
|
-
flex-grow: 1;
|
|
47
|
-
flex-direction: row;
|
|
48
|
-
gap: 5px;
|
|
49
|
-
margin-top: 5px;
|
|
50
|
-
|
|
51
|
-
${SMALL_SCREEN_MAXIMUM_MEDIA_QUERY} {
|
|
52
|
-
flex-direction: row;
|
|
53
|
-
justify-content: space-between;
|
|
54
|
-
}
|
|
55
|
-
`
|
|
56
|
-
|
|
57
|
-
const StyledResponsiveButtonContainer = styled.div`
|
|
58
|
-
display: flex;
|
|
59
|
-
margin-right: auto;
|
|
60
|
-
flex-flow: row wrap;
|
|
61
|
-
gap: 5px;
|
|
62
|
-
height: fit-content;
|
|
63
|
-
flex-grow: 1;
|
|
64
|
-
|
|
65
|
-
& > * {
|
|
66
|
-
height: 1.2rem;
|
|
67
|
-
padding: 0 5px;
|
|
68
|
-
|
|
69
|
-
${TABLET_MINIMUM_MEDIA_QUERY} {
|
|
70
|
-
font-size: 0.8rem !important;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
${SMALL_SCREEN_MAXIMUM_MEDIA_QUERY} {
|
|
75
|
-
margin: 0;
|
|
76
|
-
flex-direction: column;
|
|
77
|
-
|
|
78
|
-
span {
|
|
79
|
-
width: 100%;
|
|
80
|
-
max-width: 10rem;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
`
|
|
84
|
-
|
|
85
|
-
const StyledResponsiveTagContainer = styled.div`
|
|
86
|
-
display: flex;
|
|
87
|
-
margin-left: auto;
|
|
88
|
-
flex-flow: row wrap;
|
|
89
|
-
gap: 5px;
|
|
90
|
-
height: fit-content;
|
|
91
|
-
justify-content: flex-end;
|
|
92
|
-
flex-grow: 1;
|
|
93
|
-
|
|
94
|
-
& > * {
|
|
95
|
-
display: flex;
|
|
96
|
-
align-items: center;
|
|
97
|
-
height: 1.2rem;
|
|
98
|
-
margin: 0 !important;
|
|
99
|
-
font-size: 0.8rem !important;
|
|
100
|
-
padding: 0 10px;
|
|
101
|
-
justify-content: center;
|
|
102
|
-
|
|
103
|
-
${TABLET_MINIMUM_MEDIA_QUERY} {
|
|
104
|
-
font-size: 0.8rem !important;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
${SMALL_SCREEN_MAXIMUM_MEDIA_QUERY} {
|
|
109
|
-
flex-direction: column;
|
|
110
|
-
margin: 0;
|
|
111
|
-
|
|
112
|
-
& > * {
|
|
113
|
-
margin: 0;
|
|
114
|
-
width: 100%;
|
|
115
|
-
max-width: 10rem;
|
|
116
|
-
padding: 0 10px;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
`
|
|
120
|
-
|
|
121
|
-
const StyledButton = styled(Button)`
|
|
122
|
-
padding: 0 5px;
|
|
123
|
-
width: fit-content;
|
|
124
|
-
|
|
125
|
-
${SMALL_SCREEN_MAXIMUM_MEDIA_QUERY} {
|
|
126
|
-
width: 100%;
|
|
127
|
-
max-width: 10rem;
|
|
128
|
-
}
|
|
129
|
-
`
|
|
130
|
-
const StyledDate = styled.div`
|
|
131
|
-
display: flex;
|
|
132
|
-
flex-flow: column nowrap;
|
|
133
|
-
text-align: right;
|
|
134
|
-
min-width: 6rem;
|
|
135
|
-
justify-content: start;
|
|
136
|
-
`
|
|
137
|
-
const IconButtonWrapper = styled(Button)`
|
|
138
|
-
-webkit-box-align: center;
|
|
139
|
-
align-items: center;
|
|
140
|
-
-webkit-box-pack: center;
|
|
141
|
-
justify-content: center;
|
|
142
|
-
margin-right: 0.5rem;
|
|
143
|
-
display: inline-block !important;
|
|
144
|
-
margin-left: 0.5rem;
|
|
145
|
-
width: auto;
|
|
146
|
-
padding: 0 5px;
|
|
147
|
-
`
|
|
148
|
-
const IconWrapper = styled.div`
|
|
149
|
-
margin-left: 0.5rem;
|
|
150
|
-
display: inline-block;
|
|
151
|
-
`
|
|
152
|
-
|
|
153
|
-
const DiagnosisSummary: FC<Props> = ({
|
|
154
|
-
condition,
|
|
155
|
-
extendedTemplateDisplayName,
|
|
156
|
-
extensionTemplateDisplayName,
|
|
157
|
-
extensionClickHandler,
|
|
158
|
-
isReadOnly = false,
|
|
159
|
-
dateOnlyView = false,
|
|
160
|
-
canExtendDiagnosis = false,
|
|
161
|
-
displaySource = false,
|
|
162
|
-
controls = [],
|
|
163
|
-
tags = [],
|
|
164
|
-
systemExclusionsFilter = [],
|
|
165
|
-
isRichText = false,
|
|
166
|
-
...rest
|
|
167
|
-
}) => {
|
|
168
|
-
if (condition.metadata.isRedacted) {
|
|
169
|
-
return (
|
|
170
|
-
<StyledSummary {...rest}>
|
|
171
|
-
<Redacted condition={condition} />
|
|
172
|
-
</StyledSummary>
|
|
173
|
-
)
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
const enteredInError = condition.verificationStatus === ConditionVerificationStatus.EnteredInError
|
|
177
|
-
|
|
178
|
-
return (
|
|
179
|
-
<StyledSummary {...rest}>
|
|
180
|
-
<StyledTitleAndDateContainer>
|
|
181
|
-
<StyledDescription>
|
|
182
|
-
<StyledTitle>
|
|
183
|
-
<Title
|
|
184
|
-
enteredInError={enteredInError}
|
|
185
|
-
condition={condition}
|
|
186
|
-
systemExclusionsFilter={systemExclusionsFilter}
|
|
187
|
-
isRichText={isRichText}
|
|
188
|
-
/>
|
|
189
|
-
{extensionTemplateDisplayName && !isReadOnly && canExtendDiagnosis && !enteredInError && (
|
|
190
|
-
<IconButtonWrapper
|
|
191
|
-
onClick={extensionClickHandler}
|
|
192
|
-
type="button"
|
|
193
|
-
styling={{ buttonStyle: 'clear' }}
|
|
194
|
-
value=""
|
|
195
|
-
icon={<Icon type="folder-plus" size="medium" />}
|
|
196
|
-
iconPlacement="center"
|
|
197
|
-
iconColour={BTN_COLOURS.PRIMARY.VALUE}
|
|
198
|
-
title={`This diagnosis can be extended further using form '${extensionTemplateDisplayName}' by clicking here`}
|
|
199
|
-
/>
|
|
200
|
-
)}
|
|
201
|
-
{extendedTemplateDisplayName && (
|
|
202
|
-
<IconWrapper>
|
|
203
|
-
<Icon
|
|
204
|
-
type="comment"
|
|
205
|
-
size="medium"
|
|
206
|
-
title={`This diagnosis has been extended beyond standard diagnosis with form '${extendedTemplateDisplayName}'.
|
|
207
|
-
To view these extra details, click into the full diagnosis detail or edit the existing form.`}
|
|
208
|
-
/>
|
|
209
|
-
</IconWrapper>
|
|
210
|
-
)}
|
|
211
|
-
</StyledTitle>
|
|
212
|
-
{displaySource && <DiagnosisDataSource condition={condition} enteredInError={enteredInError} />}
|
|
213
|
-
</StyledDescription>
|
|
214
|
-
<StyledDate>
|
|
215
|
-
<DateSummary enteredInError={enteredInError} datetime={condition?.assertedDate} dateOnlyView={dateOnlyView} />
|
|
216
|
-
<OnsetDateEstimated enteredInError={enteredInError} condition={condition} />
|
|
217
|
-
</StyledDate>
|
|
218
|
-
</StyledTitleAndDateContainer>
|
|
219
|
-
|
|
220
|
-
{!isReadOnly && (controls.length > 0 || tags.length > 0) && (
|
|
221
|
-
<StyledButtonAndTagContainer>
|
|
222
|
-
<StyledResponsiveButtonContainer>
|
|
223
|
-
{controls.map((props, index) => (
|
|
224
|
-
<StyledButton key={index} {...props} />
|
|
225
|
-
))}
|
|
226
|
-
</StyledResponsiveButtonContainer>
|
|
227
|
-
|
|
228
|
-
<StyledResponsiveTagContainer>
|
|
229
|
-
{tags?.map((tag, index) => (tag.key ? tag : cloneElement(tag, { key: index })))}
|
|
230
|
-
</StyledResponsiveTagContainer>
|
|
231
|
-
</StyledButtonAndTagContainer>
|
|
232
|
-
)}
|
|
233
|
-
</StyledSummary>
|
|
234
|
-
)
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
interface Props extends HTMLAttributes<HTMLDivElement> {
|
|
238
|
-
condition: Condition
|
|
239
|
-
extendedTemplateDisplayName?: string
|
|
240
|
-
extensionTemplateDisplayName?: string
|
|
241
|
-
isReadOnly?: boolean
|
|
242
|
-
dateOnlyView?: boolean
|
|
243
|
-
displaySource?: boolean
|
|
244
|
-
controls?: ButtonProps[]
|
|
245
|
-
tags?: ReactElement[]
|
|
246
|
-
canExtendDiagnosis?: boolean
|
|
247
|
-
extensionClickHandler?(): void
|
|
248
|
-
systemExclusionsFilter?: string[]
|
|
249
|
-
isRichText?: boolean
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
export default DiagnosisSummary
|
|
1
|
+
import { cloneElement, FC, HTMLAttributes, ReactElement } from 'react'
|
|
2
|
+
import styled from '@emotion/styled'
|
|
3
|
+
|
|
4
|
+
import { Condition, ConditionVerificationStatus } from '@ltht-react/types'
|
|
5
|
+
import { DateSummary } from '@ltht-react/type-summary'
|
|
6
|
+
import Icon from '@ltht-react/icon'
|
|
7
|
+
import { Button, ButtonProps } from '@ltht-react/button'
|
|
8
|
+
|
|
9
|
+
import { BTN_COLOURS, SMALL_SCREEN_MAXIMUM_MEDIA_QUERY, TABLET_MINIMUM_MEDIA_QUERY } from '@ltht-react/styles'
|
|
10
|
+
import Title from '../atoms/diagnosis-title'
|
|
11
|
+
import OnsetDateEstimated from '../atoms/diagnosis-onset-estimated'
|
|
12
|
+
import Redacted from '../molecules/diagnosis-redacted'
|
|
13
|
+
import DiagnosisDataSource from '../atoms/diagnosis-data-source'
|
|
14
|
+
|
|
15
|
+
const StyledTitle = styled.div`
|
|
16
|
+
display: flex;
|
|
17
|
+
`
|
|
18
|
+
|
|
19
|
+
const StyledSummary = styled.div`
|
|
20
|
+
display: flex;
|
|
21
|
+
justify-content: center;
|
|
22
|
+
flex-direction: column;
|
|
23
|
+
`
|
|
24
|
+
|
|
25
|
+
const StyledDescription = styled.div`
|
|
26
|
+
flex-grow: 1;
|
|
27
|
+
`
|
|
28
|
+
|
|
29
|
+
const StyledTitleAndDateContainer = styled.div`
|
|
30
|
+
display: flex;
|
|
31
|
+
flex-grow: 1;
|
|
32
|
+
flex-direction: row;
|
|
33
|
+
gap: 5px;
|
|
34
|
+
|
|
35
|
+
${SMALL_SCREEN_MAXIMUM_MEDIA_QUERY} {
|
|
36
|
+
flex-flow: column nowrap;
|
|
37
|
+
align-items: flex-start;
|
|
38
|
+
div {
|
|
39
|
+
text-align: left;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
`
|
|
43
|
+
|
|
44
|
+
const StyledButtonAndTagContainer = styled.div`
|
|
45
|
+
display: flex;
|
|
46
|
+
flex-grow: 1;
|
|
47
|
+
flex-direction: row;
|
|
48
|
+
gap: 5px;
|
|
49
|
+
margin-top: 5px;
|
|
50
|
+
|
|
51
|
+
${SMALL_SCREEN_MAXIMUM_MEDIA_QUERY} {
|
|
52
|
+
flex-direction: row;
|
|
53
|
+
justify-content: space-between;
|
|
54
|
+
}
|
|
55
|
+
`
|
|
56
|
+
|
|
57
|
+
const StyledResponsiveButtonContainer = styled.div`
|
|
58
|
+
display: flex;
|
|
59
|
+
margin-right: auto;
|
|
60
|
+
flex-flow: row wrap;
|
|
61
|
+
gap: 5px;
|
|
62
|
+
height: fit-content;
|
|
63
|
+
flex-grow: 1;
|
|
64
|
+
|
|
65
|
+
& > * {
|
|
66
|
+
height: 1.2rem;
|
|
67
|
+
padding: 0 5px;
|
|
68
|
+
|
|
69
|
+
${TABLET_MINIMUM_MEDIA_QUERY} {
|
|
70
|
+
font-size: 0.8rem !important;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
${SMALL_SCREEN_MAXIMUM_MEDIA_QUERY} {
|
|
75
|
+
margin: 0;
|
|
76
|
+
flex-direction: column;
|
|
77
|
+
|
|
78
|
+
span {
|
|
79
|
+
width: 100%;
|
|
80
|
+
max-width: 10rem;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
`
|
|
84
|
+
|
|
85
|
+
const StyledResponsiveTagContainer = styled.div`
|
|
86
|
+
display: flex;
|
|
87
|
+
margin-left: auto;
|
|
88
|
+
flex-flow: row wrap;
|
|
89
|
+
gap: 5px;
|
|
90
|
+
height: fit-content;
|
|
91
|
+
justify-content: flex-end;
|
|
92
|
+
flex-grow: 1;
|
|
93
|
+
|
|
94
|
+
& > * {
|
|
95
|
+
display: flex;
|
|
96
|
+
align-items: center;
|
|
97
|
+
height: 1.2rem;
|
|
98
|
+
margin: 0 !important;
|
|
99
|
+
font-size: 0.8rem !important;
|
|
100
|
+
padding: 0 10px;
|
|
101
|
+
justify-content: center;
|
|
102
|
+
|
|
103
|
+
${TABLET_MINIMUM_MEDIA_QUERY} {
|
|
104
|
+
font-size: 0.8rem !important;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
${SMALL_SCREEN_MAXIMUM_MEDIA_QUERY} {
|
|
109
|
+
flex-direction: column;
|
|
110
|
+
margin: 0;
|
|
111
|
+
|
|
112
|
+
& > * {
|
|
113
|
+
margin: 0;
|
|
114
|
+
width: 100%;
|
|
115
|
+
max-width: 10rem;
|
|
116
|
+
padding: 0 10px;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
`
|
|
120
|
+
|
|
121
|
+
const StyledButton = styled(Button)`
|
|
122
|
+
padding: 0 5px;
|
|
123
|
+
width: fit-content;
|
|
124
|
+
|
|
125
|
+
${SMALL_SCREEN_MAXIMUM_MEDIA_QUERY} {
|
|
126
|
+
width: 100%;
|
|
127
|
+
max-width: 10rem;
|
|
128
|
+
}
|
|
129
|
+
`
|
|
130
|
+
const StyledDate = styled.div`
|
|
131
|
+
display: flex;
|
|
132
|
+
flex-flow: column nowrap;
|
|
133
|
+
text-align: right;
|
|
134
|
+
min-width: 6rem;
|
|
135
|
+
justify-content: start;
|
|
136
|
+
`
|
|
137
|
+
const IconButtonWrapper = styled(Button)`
|
|
138
|
+
-webkit-box-align: center;
|
|
139
|
+
align-items: center;
|
|
140
|
+
-webkit-box-pack: center;
|
|
141
|
+
justify-content: center;
|
|
142
|
+
margin-right: 0.5rem;
|
|
143
|
+
display: inline-block !important;
|
|
144
|
+
margin-left: 0.5rem;
|
|
145
|
+
width: auto;
|
|
146
|
+
padding: 0 5px;
|
|
147
|
+
`
|
|
148
|
+
const IconWrapper = styled.div`
|
|
149
|
+
margin-left: 0.5rem;
|
|
150
|
+
display: inline-block;
|
|
151
|
+
`
|
|
152
|
+
|
|
153
|
+
const DiagnosisSummary: FC<Props> = ({
|
|
154
|
+
condition,
|
|
155
|
+
extendedTemplateDisplayName,
|
|
156
|
+
extensionTemplateDisplayName,
|
|
157
|
+
extensionClickHandler,
|
|
158
|
+
isReadOnly = false,
|
|
159
|
+
dateOnlyView = false,
|
|
160
|
+
canExtendDiagnosis = false,
|
|
161
|
+
displaySource = false,
|
|
162
|
+
controls = [],
|
|
163
|
+
tags = [],
|
|
164
|
+
systemExclusionsFilter = [],
|
|
165
|
+
isRichText = false,
|
|
166
|
+
...rest
|
|
167
|
+
}) => {
|
|
168
|
+
if (condition.metadata.isRedacted) {
|
|
169
|
+
return (
|
|
170
|
+
<StyledSummary {...rest}>
|
|
171
|
+
<Redacted condition={condition} />
|
|
172
|
+
</StyledSummary>
|
|
173
|
+
)
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
const enteredInError = condition.verificationStatus === ConditionVerificationStatus.EnteredInError
|
|
177
|
+
|
|
178
|
+
return (
|
|
179
|
+
<StyledSummary {...rest}>
|
|
180
|
+
<StyledTitleAndDateContainer>
|
|
181
|
+
<StyledDescription>
|
|
182
|
+
<StyledTitle>
|
|
183
|
+
<Title
|
|
184
|
+
enteredInError={enteredInError}
|
|
185
|
+
condition={condition}
|
|
186
|
+
systemExclusionsFilter={systemExclusionsFilter}
|
|
187
|
+
isRichText={isRichText}
|
|
188
|
+
/>
|
|
189
|
+
{extensionTemplateDisplayName && !isReadOnly && canExtendDiagnosis && !enteredInError && (
|
|
190
|
+
<IconButtonWrapper
|
|
191
|
+
onClick={extensionClickHandler}
|
|
192
|
+
type="button"
|
|
193
|
+
styling={{ buttonStyle: 'clear' }}
|
|
194
|
+
value=""
|
|
195
|
+
icon={<Icon type="folder-plus" size="medium" />}
|
|
196
|
+
iconPlacement="center"
|
|
197
|
+
iconColour={BTN_COLOURS.PRIMARY.VALUE}
|
|
198
|
+
title={`This diagnosis can be extended further using form '${extensionTemplateDisplayName}' by clicking here`}
|
|
199
|
+
/>
|
|
200
|
+
)}
|
|
201
|
+
{extendedTemplateDisplayName && (
|
|
202
|
+
<IconWrapper>
|
|
203
|
+
<Icon
|
|
204
|
+
type="comment"
|
|
205
|
+
size="medium"
|
|
206
|
+
title={`This diagnosis has been extended beyond standard diagnosis with form '${extendedTemplateDisplayName}'.
|
|
207
|
+
To view these extra details, click into the full diagnosis detail or edit the existing form.`}
|
|
208
|
+
/>
|
|
209
|
+
</IconWrapper>
|
|
210
|
+
)}
|
|
211
|
+
</StyledTitle>
|
|
212
|
+
{displaySource && <DiagnosisDataSource condition={condition} enteredInError={enteredInError} />}
|
|
213
|
+
</StyledDescription>
|
|
214
|
+
<StyledDate>
|
|
215
|
+
<DateSummary enteredInError={enteredInError} datetime={condition?.assertedDate} dateOnlyView={dateOnlyView} />
|
|
216
|
+
<OnsetDateEstimated enteredInError={enteredInError} condition={condition} />
|
|
217
|
+
</StyledDate>
|
|
218
|
+
</StyledTitleAndDateContainer>
|
|
219
|
+
|
|
220
|
+
{!isReadOnly && (controls.length > 0 || tags.length > 0) && (
|
|
221
|
+
<StyledButtonAndTagContainer>
|
|
222
|
+
<StyledResponsiveButtonContainer>
|
|
223
|
+
{controls.map((props, index) => (
|
|
224
|
+
<StyledButton key={index} {...props} />
|
|
225
|
+
))}
|
|
226
|
+
</StyledResponsiveButtonContainer>
|
|
227
|
+
|
|
228
|
+
<StyledResponsiveTagContainer>
|
|
229
|
+
{tags?.map((tag, index) => (tag.key ? tag : cloneElement(tag, { key: index })))}
|
|
230
|
+
</StyledResponsiveTagContainer>
|
|
231
|
+
</StyledButtonAndTagContainer>
|
|
232
|
+
)}
|
|
233
|
+
</StyledSummary>
|
|
234
|
+
)
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
interface Props extends HTMLAttributes<HTMLDivElement> {
|
|
238
|
+
condition: Condition
|
|
239
|
+
extendedTemplateDisplayName?: string
|
|
240
|
+
extensionTemplateDisplayName?: string
|
|
241
|
+
isReadOnly?: boolean
|
|
242
|
+
dateOnlyView?: boolean
|
|
243
|
+
displaySource?: boolean
|
|
244
|
+
controls?: ButtonProps[]
|
|
245
|
+
tags?: ReactElement[]
|
|
246
|
+
canExtendDiagnosis?: boolean
|
|
247
|
+
extensionClickHandler?(): void
|
|
248
|
+
systemExclusionsFilter?: string[]
|
|
249
|
+
isRichText?: boolean
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
export default DiagnosisSummary
|