Skip to content

Commit d602f5f

Browse files
committed
feat: add episode type
1 parent e74e18d commit d602f5f

File tree

4 files changed

+54
-6
lines changed

4 files changed

+54
-6
lines changed

src/hooks/api/patientHooks.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -167,11 +167,7 @@ export const useRegisterPatient = () => {
167167
);
168168
};
169169

170-
export const useRegisterEpisode = (
171-
hospitalID?: string,
172-
patientID?: string,
173-
episodeType = 'Inguinal Mesh Hernia Repair'
174-
) => {
170+
export const useRegisterEpisode = (hospitalID?: string, patientID?: string) => {
175171
const history = useHistory();
176172

177173
return useMutation<RegisterEpisodePayload, AxiosError, RegisterEpisodeFormType>(
@@ -184,7 +180,7 @@ export const useRegisterEpisode = (
184180
surgeon_ids: params?.surgeons?.map((surgeon) => surgeon?.value) ?? ['1'],
185181
comments: params?.comments,
186182
mesh_type: params?.meshType?.label,
187-
episode_type: episodeType,
183+
episode_type: params?.episodeType.label,
188184
type: params.type?.label,
189185
cepod: params.cepod?.label,
190186
complexity: params?.complexity?.label,

src/pages/RegisterEpisode/components/RegisterEpisodeForm/RegisterEpisodeForm.tsx

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import {
1818
OCCURRENCE_OPTIONS,
1919
SIDE_OPTIONS,
2020
TYPE_OPTIONS,
21+
EPISODE_TYPE_OPTIONS,
2122
} from '../../constants';
2223
import { RegisterEpisodeFormType } from '../../types';
2324
import { getHospitalOptions, getSurgeonOptions } from '../../utils';
@@ -127,6 +128,33 @@ const RegisterEpisodeForm: React.FC<Props> = ({
127128
</FormHeadingContainer>
128129
<FormHeadingContainer>
129130
<SectionTitle>Episode Details</SectionTitle>
131+
<FieldWrapper>
132+
<Field name="episodeType">
133+
{(props) => {
134+
const hasError = props.meta.touched && props.meta.invalid && !props.meta.active;
135+
136+
return (
137+
<SelectWrapper>
138+
<Select
139+
id="episode_type"
140+
label="Episode Type"
141+
styleType="outlined"
142+
size="md"
143+
required
144+
status={hasError ? 'error' : 'hint'}
145+
hintMsg={hasError ? props.meta.error : undefined}
146+
options={EPISODE_TYPE_OPTIONS}
147+
{...omit(props.input, ['onFocus'])}
148+
selectedOption={EPISODE_TYPE_OPTIONS.find(
149+
(option) => option.value === props.input.value.value
150+
)}
151+
handleSelectedOption={props.input.onChange}
152+
/>
153+
</SelectWrapper>
154+
);
155+
}}
156+
</Field>
157+
</FieldWrapper>
130158
<FieldWrapper>
131159
<Field name="cepod">
132160
{(props) => {

src/pages/RegisterEpisode/constants.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,3 +127,26 @@ export const FOLLOW_UP_PAIN_OPTIONS: SelectOption[] = [
127127
label: 'Severe',
128128
},
129129
];
130+
131+
export const EPISODE_TYPE_OPTIONS: SelectOption[] = [
132+
{
133+
value: 0,
134+
label: 'Inguinal Mesh Hernia Repair',
135+
},
136+
{
137+
value: 1,
138+
label: 'Incisional Mesh Hernia Repair',
139+
},
140+
{
141+
value: 2,
142+
label: 'Femoral Mesh Hernia Repair',
143+
},
144+
{
145+
value: 3,
146+
label: 'Hiatus Mesh Hernia Repair',
147+
},
148+
{
149+
value: 4,
150+
label: 'Umbilical/Periumbilicial Mesh Hernia Repair',
151+
},
152+
];

src/pages/RegisterEpisode/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { SelectOption } from '../../models/apiTypes';
33
export type RegisterEpisodeFormType = {
44
hospital: SelectOption;
55
patientHospitalId: number;
6+
episodeType: SelectOption;
67
surgeryDate: string;
78
cepod: SelectOption;
89
side: SelectOption;

0 commit comments

Comments
 (0)