Skip to content

Commit

Permalink
feat: harmonisation textuelle - Ref gestion-de-projet#2371
Browse files Browse the repository at this point in the history
  • Loading branch information
pl-buiquang authored and aetchego committed Nov 13, 2024
1 parent 68551c5 commit 4a6a85c
Show file tree
Hide file tree
Showing 154 changed files with 4,869 additions and 8,105 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,5 @@ yarn-error.log*
.env*
!.env.example
.mp4
public/config.dev.json
public/config.dev.json
public/config.local.json
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"antlr4": "^4.13.1-patch-1",
"axios": "^1.6.0",
"buffer": "^6.0.3",
"canvas": "^2.11.2",
"client-oauth2": "^4.2.4",
"d3": "^7.8.2",
"d3-cloud": "^1.2.5",
Expand All @@ -41,6 +42,7 @@
"react-router": "^6.9.0",
"react-router-dom": "^6.9.0",
"react-use-websocket": "4.8.1",
"react-window": "^1.8.10",
"redux": "^4.2.1",
"redux-devtools-extension": "^2.13.9",
"redux-logger": "^3.0.6",
Expand All @@ -60,7 +62,7 @@
"build": "vite build",
"serve": "vite preview",
"lint": "eslint --ext .jsx,.js,.ts,.tsx src/",
"test": "vitest",
"test": "vitest",
"coverage": "vitest run --coverage",
"ui": "vitest --ui"
},
Expand Down Expand Up @@ -98,6 +100,7 @@
"@types/react-redux": "^7.1.25",
"@types/react-router": "^5.1.20",
"@types/react-router-dom": "^5.3.3",
"@types/react-window": "^1.8.8",
"@types/redux-logger": "^3.0.9",
"@types/uuid": "^8.3.4",
"@typescript-eslint/eslint-plugin": "^5.57.0",
Expand Down
4 changes: 3 additions & 1 deletion src/__tests__/data/cohortCreation/claimCriteria.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,14 @@ export const completeClaimCriteria: GhmDataType = {
full_path: 'APHP-ASSISTANCE PUBLIQUE AP-HP/H01-GH RCP',
id: '8312016825',
inferior_levels_ids: '8312016826',
label: 'GH RCP',
name: 'GH RCP',
parent_id: '8312002244',
source_value: 'H01',
status: undefined,
subItems: undefined,
type: 'Groupe hospitalier (GH)'
type: 'Groupe hospitalier (GH)',
system: 'nan'
}
]
}
1 change: 0 additions & 1 deletion src/__tests__/data/cohortCreation/cohortCreation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ const defaultProcedureCriteria: SelectedCriteriaType = {
encounterEndDate: [null, null],
includeEncounterEndDateNull: true,
encounterStatus: [],
hierarchy: undefined,
code: [],
source: null,
label: undefined
Expand Down
1 change: 0 additions & 1 deletion src/__tests__/data/cohortCreation/procedureCriteria.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export const defaultProcedureCriteria: CcamDataType = {
encounterEndDate: [null, null],
includeEncounterEndDateNull: false,
encounterStatus: [],
hierarchy: undefined,
code: [],
source: null,
label: undefined,
Expand Down
221 changes: 148 additions & 73 deletions src/components/CreationCohort/DataList_Criteria.tsx

Large diffs are not rendered by default.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
import React, { useState } from 'react'

import { Collapse, FormLabel, Grid, IconButton, Typography } from '@mui/material'

import KeyboardArrowUpIcon from '@mui/icons-material/KeyboardArrowUp'
import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown'

import { SourceType } from 'types/scope'
import { Hierarchy } from 'types/hierarchy'
import { ScopeElement } from 'types'
import CalendarRange from 'components/ui/Inputs/CalendarRange'

import { CriteriaType, SelectedCriteriaTypesWithAdvancedInputs } from 'types/requestCriterias'
import { DurationRangeType } from 'types/searchCriterias'
import { CriteriaLabel } from 'components/ui/CriteriaLabel'
import { getOccurenceDateLabel } from 'utils/requestCriterias'
import ExecutiveUnitsInput from 'components/ui/Inputs/ExecutiveUnits'
import { InputWrapper } from 'components/ui/Inputs'

type AdvancedInputsProps = {
sourceType: SourceType
selectedCriteria: SelectedCriteriaTypesWithAdvancedInputs
onChangeValue: (key: string, value: ScopeElement[] | DurationRangeType | boolean | string | null | undefined) => void
onError: (error: boolean) => void
}

const AdvancedInputs = ({ sourceType, selectedCriteria, onChangeValue, onError }: AdvancedInputsProps) => {
const optionsIsUsed =
(selectedCriteria.encounterService && selectedCriteria.encounterService.length > 0) ||
selectedCriteria.startOccurrence?.[0] !== null ||
selectedCriteria.startOccurrence?.[1] !== null ||
selectedCriteria.endOccurrence?.[0] !== null ||
selectedCriteria.endOccurrence?.[1] !== null ||
selectedCriteria.encounterStartDate[0] !== null ||
selectedCriteria.encounterStartDate[1] !== null ||
selectedCriteria.encounterEndDate[0] !== null ||
selectedCriteria.encounterEndDate[1] !== null

const [checked, setChecked] = useState(optionsIsUsed)

const _onSubmitExecutiveUnits = (_selectedExecutiveUnits: Hierarchy<ScopeElement, string>[]) => {
onChangeValue('encounterService', _selectedExecutiveUnits)
}

return (
<>
<Grid
item
container
direction="row"
alignItems="center"
style={{ padding: '1em' }}
onClick={() => setChecked(!checked)}
>
<Typography style={{ cursor: 'pointer' }} variant="h6">
Options avancées
</Typography>

<IconButton size="small">
{checked ? <KeyboardArrowUpIcon fontSize="small" /> : <KeyboardArrowDownIcon fontSize="small" />}
</IconButton>
</Grid>

<Collapse in={checked} unmountOnExit>
<Grid container direction="column" padding="0 1em" gap="10px">
<InputWrapper>
<ExecutiveUnitsInput
sourceType={sourceType}
value={selectedCriteria?.encounterService || []}
onChange={_onSubmitExecutiveUnits}
/>
</InputWrapper>

<InputWrapper>
<CriteriaLabel label="Prise en charge" infoIcon="Ne concerne pas les consultations" />
<FormLabel style={{ fontWeight: 600, fontSize: 12 }} component="legend">
Début de prise en charge
</FormLabel>
<CalendarRange
inline
value={selectedCriteria?.encounterStartDate}
onChange={(newDate) => {
onChangeValue('encounterStartDate', newDate)
}}
onError={(isError) => onError(isError)}
includeNullValues={selectedCriteria.includeEncounterStartDateNull}
onChangeIncludeNullValues={(includeNullValues) =>
onChangeValue('includeEncounterStartDateNull', includeNullValues)
}
/>
<FormLabel style={{ fontWeight: 600, fontSize: 12 }} component="legend">
Fin de prise en charge
</FormLabel>
<CalendarRange
inline
value={selectedCriteria?.encounterEndDate}
onChange={(newDate) => {
onChangeValue('encounterEndDate', newDate)
}}
onError={(isError) => onError(isError)}
includeNullValues={selectedCriteria.includeEncounterEndDateNull}
onChangeIncludeNullValues={(includeNullValues) =>
onChangeValue('includeEncounterEndDateNull', includeNullValues)
}
/>
</InputWrapper>

{selectedCriteria.type !== CriteriaType.IMAGING && (
<>
<InputWrapper>
<CriteriaLabel label={getOccurenceDateLabel(selectedCriteria.type)} sx={{ paddingBottom: 0 }} />
<CalendarRange
inline
value={selectedCriteria?.startOccurrence}
onChange={(newDate) => {
onChangeValue('startOccurrence', newDate)
}}
onError={(isError) => onError(isError)}
/>
</InputWrapper>
{selectedCriteria.type === CriteriaType.MEDICATION_REQUEST && (
<InputWrapper>
<CriteriaLabel label={getOccurenceDateLabel(selectedCriteria.type, true)} sx={{ paddingBottom: 0 }} />
<CalendarRange
inline
value={selectedCriteria?.endOccurrence ?? [null, null]}
onChange={(newDate) => {
onChangeValue('endOccurrence', newDate)
}}
onError={(isError) => onError(isError)}
/>
</InputWrapper>
)}
</>
)}
</Grid>
</Collapse>
</>
)
}

export default AdvancedInputs
Loading

0 comments on commit 4a6a85c

Please sign in to comment.