Skip to content

Commit 0f05292

Browse files
committed
Use openEHR for TNM in screens
1 parent fd98aeb commit 0f05292

File tree

4 files changed

+248
-106
lines changed

4 files changed

+248
-106
lines changed
Lines changed: 180 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,22 @@
11
import React, { Component } from 'react';
22
import Panel from './Panel';
3+
import Loading from './Loading';
34
import { DateTimeInput, Select, TextInput, InlineWidgetGroup } from './widgets';
5+
import { bindActionCreators } from 'redux';
6+
import { connect } from 'react-redux';
7+
import { actions as patientActions } from 'redux/modules/patient';
48
import styles from './FollowUpDiagnosis.scss';
59

10+
const mapStateToProps = (state) => ({
11+
activePatient: state.patients.activePatient
12+
});
13+
14+
const mapDispatchToProps = (dispatch) => {
15+
return {
16+
patientActions: bindActionCreators(patientActions, dispatch),
17+
};
18+
};
19+
620
export default class FollowUpDiagnosis extends Component {
721
constructor () {
822
super();
@@ -44,122 +58,183 @@ export default class FollowUpDiagnosis extends Component {
4458
return gleasonScore;
4559
};
4660

47-
render () {
48-
return (
49-
<Panel title='Diagnosis' className={styles['fud-panel']}>
50-
<div className={styles['fud-widget-group-one']}>
51-
<DateTimeInput label='Date of Dx' noTime mandatory />
52-
<InlineWidgetGroup>
53-
<Select
54-
label='TNM'
55-
options={[
56-
{key: 'pT2', value: 'pT2'},
57-
{key: 'pT3a', value: 'pT3a'},
58-
{key: 'pT3b', value: 'pT3b'},
59-
{key: 'pT4', value: 'pT4'},
60-
{key: 'pTx', value: 'pTx'},
61-
]}
62-
/>
63-
<Select
64-
options={[
65-
{key: 'pN0', value: 'pN0'},
66-
{key: 'pN1', value: 'pN1'},
67-
{key: 'pN2', value: 'pN2'},
68-
{key: 'pNX', value: 'pNX'},
69-
]}
70-
/>
71-
<Select
72-
options={[
73-
{key: 'MX', value: 'MX'},
74-
{key: 'M0', value: 'M0'},
75-
{key: 'M1', value: 'M1'},
76-
{key: 'M1a', value: 'M1a'},
77-
{key: 'M1b', value: 'M1b'},
78-
{key: 'M1c', value: 'M1c'},
79-
]}
80-
/>
81-
</InlineWidgetGroup>
61+
componentWillMount () {
62+
this.props.patientActions.fetchDiagnosis(this.props.activePatient.ehrId);
63+
};
64+
65+
componentWillUnmount () {
66+
this.props.patientActions.saveDiagnosis(
67+
this.props.activePatient.ehrId,
68+
this.props.activePatient.diagnosis.primary_tumour_pt,
69+
this.props.activePatient.diagnosis.regional_lymph_node_pn,
70+
this.props.activePatient.diagnosis.distant_metastasis_pm);
71+
};
72+
73+
handleChangePrimaryTumorPt = (e) => {
74+
const newVal = e.target.value;
75+
const diagnosis = {
76+
primary_tumour_pt: newVal,
77+
regional_lymph_node_pn: this.props.activePatient.diagnosis.regional_lymph_node_pn,
78+
distant_metastasis_pm: this.props.activePatient.diagnosis.distant_metastasis_pm
79+
};
80+
this.props.patientActions.updateDiagnosis(diagnosis);
81+
};
82+
83+
handleChangeRegionalLymphNode = (e) => {
84+
const newVal = e.target.value;
85+
const diagnosis = {
86+
primary_tumour_pt: this.props.activePatient.diagnosis.primary_tumour_pt,
87+
regional_lymph_node_pn: newVal,
88+
distant_metastasis_pm: this.props.activePatient.diagnosis.distant_metastasis_pm
89+
};
90+
this.props.patientActions.updateDiagnosis(diagnosis);
91+
};
8292

83-
<InlineWidgetGroup>
93+
handleChangeDistantMetastasis = (e) => {
94+
const newVal = e.target.value;
95+
const diagnosis = {
96+
primary_tumour_pt: this.props.activePatient.diagnosis.primary_tumour_pt,
97+
regional_lymph_node_pn: this.props.activePatient.diagnosis.regional_lymph_node_pn,
98+
distant_metastasis_pm: newVal
99+
};
100+
this.props.patientActions.updateDiagnosis(diagnosis);
101+
};
102+
103+
render () {
104+
console.log('rendering FolloupDiagnosis');
105+
if (this.props.activePatient.diagnosis === undefined) {
106+
return (
107+
<Panel title='Diagnosis' className={styles['fud-panel']}>
108+
<Loading/>
109+
</Panel>
110+
);
111+
} else {
112+
return (
113+
<Panel title='Diagnosis' className={styles['fud-panel']}>
114+
<div className={styles['fud-widget-group-one']}>
115+
<DateTimeInput label='Date of Dx' noTime mandatory />
116+
<InlineWidgetGroup>
117+
<Select
118+
label='TNM'
119+
options={[
120+
{key: 'pT2', value: 'pT2'},
121+
{key: 'pT3a', value: 'pT3a'},
122+
{key: 'pT3b', value: 'pT3b'},
123+
{key: 'pT4', value: 'pT4'},
124+
{key: 'pTx', value: 'pTx'},
125+
]}
126+
defaultValue={this.props.activePatient.diagnosis.primary_tumour_pt}
127+
onChange={this.handleChangePrimaryTumorPt}
128+
/>
129+
<Select
130+
options={[
131+
{key: 'pN0', value: 'pN0'},
132+
{key: 'pN1', value: 'pN1'},
133+
{key: 'pN2', value: 'pN2'},
134+
{key: 'pNX', value: 'pNX'},
135+
]}
136+
defaultValue={this.props.activePatient.diagnosis.regional_lymph_node_pn}
137+
onChange={this.handleChangeRegionalLymphNode}
138+
/>
139+
<Select
140+
options={[
141+
{key: 'MX', value: 'MX'},
142+
{key: 'M0', value: 'M0'},
143+
{key: 'M1', value: 'M1'},
144+
{key: 'M1a', value: 'M1a'},
145+
{key: 'M1b', value: 'M1b'},
146+
{key: 'M1c', value: 'M1c'},
147+
]}
148+
defaultValue={this.props.activePatient.diagnosis.distant_metastasis_pm}
149+
onChange={this.handleChangeDistantMetastasis}
150+
/>
151+
</InlineWidgetGroup>
152+
<InlineWidgetGroup>
153+
<Select
154+
ref='gsPatternOne'
155+
label='GS'
156+
options={[
157+
{key: '0', value: '0'},
158+
{key: '1', value: '1'},
159+
{key: '2', value: '2'},
160+
{key: '3', value: '3'},
161+
{key: '4', value: '4'},
162+
{key: '5', value: '5'},
163+
]}
164+
onChange={this.setGSPatternOne}
165+
/>
166+
+
167+
<Select
168+
ref='gsPatternTwo'
169+
options={[
170+
{key: '0', value: '0'},
171+
{key: '1', value: '1'},
172+
{key: '2', value: '2'},
173+
{key: '3', value: '3'},
174+
{key: '4', value: '4'},
175+
{key: '5', value: '5'},
176+
]}
177+
onChange={this.setGSPatternTwo}
178+
/>
179+
=
180+
<TextInput
181+
ref='gsCalculated'
182+
type='text'
183+
value={this.state.gleasonScore}
184+
className={styles['fud-gs-result']}
185+
/>
186+
</InlineWidgetGroup>
187+
<InlineWidgetGroup className={styles['fud-cores-container']}>
188+
<TextInput
189+
type='text'
190+
label='Cores Biopsied'
191+
className={styles['fud-cores']}
192+
/>
193+
<TextInput
194+
type='text'
195+
label='Cores Involved'
196+
className={styles['fud-cores']}
197+
/>
198+
</InlineWidgetGroup>
199+
</div>
200+
<div className={styles['fud-widget-group-two']}>
84201
<Select
85-
ref='gsPatternOne'
86-
label='GS'
202+
label='RadOnc'
87203
options={[
88-
{key: '0', value: '0'},
89-
{key: '1', value: '1'},
90-
{key: '2', value: '2'},
91-
{key: '3', value: '3'},
92-
{key: '4', value: '4'},
93-
{key: '5', value: '5'},
204+
{key: 'M. Back', value: 'M. Back'},
205+
{key: 'J. Donovan', value: 'J. Donovan'},
206+
{key: 'T. Eade', value: 'T. Eade'},
207+
{key: 'M. Holecek', value: 'M. Holecek'},
208+
{key: 'A. Kneebone', value: 'A. Kneebone'},
209+
{key: 'G. Lamoury', value: 'G. Lamoury'},
210+
{key: 'G. Morgan', value: 'G. Morgan'},
211+
{key: 'T. Shakespeare', value: 'T. Shakespeare'},
94212
]}
95-
onChange={this.setGSPatternOne}
96213
/>
97-
+
98214
<Select
99-
ref='gsPatternTwo'
215+
label='Referring Urologist'
100216
options={[
101-
{key: '0', value: '0'},
102-
{key: '1', value: '1'},
103-
{key: '2', value: '2'},
104-
{key: '3', value: '3'},
105-
{key: '4', value: '4'},
106-
{key: '5', value: '5'},
217+
{key: 'V. Chalasani', value: 'V. Chalasani'},
218+
{key: 'E. Lazzaro', value: 'E. Lazzaro'},
219+
{key: 'K. Rasiah', value: 'K. Rasiah'},
220+
{key: 'J. Vass', value: 'J. Vass'},
221+
{key: 'K. Vaux', value: 'K. Vaux'},
222+
{key: 'M. Wines', value: 'M. Wines'},
107223
]}
108-
onChange={this.setGSPatternTwo}
109224
/>
110-
=
111225
<TextInput
112-
ref='gsCalculated'
113226
type='text'
114-
value={this.state.gleasonScore}
115-
className={styles['fud-gs-result']}
116-
/>
117-
</InlineWidgetGroup>
227+
label='Referring LMO' />
228+
</div>
229+
</Panel>
230+
);
231+
}
232+
};
233+
};
118234

119-
<InlineWidgetGroup className={styles['fud-cores-container']}>
120-
<TextInput
121-
type='text'
122-
label='Cores Biopsied'
123-
className={styles['fud-cores']}
124-
/>
125-
<TextInput
126-
type='text'
127-
label='Cores Involved'
128-
className={styles['fud-cores']}
129-
/>
130-
</InlineWidgetGroup>
131-
</div>
235+
export default connect(mapStateToProps, mapDispatchToProps)(FollowUpDiagnosis);
132236

133-
<div className={styles['fud-widget-group-two']}>
134-
<Select
135-
label='RadOnc'
136-
options={[
137-
{key: 'M. Back', value: 'M. Back'},
138-
{key: 'J. Donovan', value: 'J. Donovan'},
139-
{key: 'T. Eade', value: 'T. Eade'},
140-
{key: 'M. Holecek', value: 'M. Holecek'},
141-
{key: 'A. Kneebone', value: 'A. Kneebone'},
142-
{key: 'G. Lamoury', value: 'G. Lamoury'},
143-
{key: 'G. Morgan', value: 'G. Morgan'},
144-
{key: 'T. Shakespeare', value: 'T. Shakespeare'},
145-
]}
146-
/>
147-
<Select
148-
label='Referring Urologist'
149-
options={[
150-
{key: 'V. Chalasani', value: 'V. Chalasani'},
151-
{key: 'E. Lazzaro', value: 'E. Lazzaro'},
152-
{key: 'K. Rasiah', value: 'K. Rasiah'},
153-
{key: 'J. Vass', value: 'J. Vass'},
154-
{key: 'K. Vaux', value: 'K. Vaux'},
155-
{key: 'M. Wines', value: 'M. Wines'},
156-
]}
157-
/>
158-
<TextInput
159-
type='text'
160-
label='Referring LMO' />
161-
</div>
162-
</Panel>
163-
);
164-
};
237+
FollowUpDiagnosis.propTypes = {
238+
patientActions: React.PropTypes.object,
239+
activePatient: React.PropTypes.object,
165240
};

src/components/widgets/Select.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ export default class Select extends Component {
6262
onChange={this.handleOnChange}
6363
disabled={this.props.disabled}
6464
value={this.props.value}
65+
defaultValue={this.props.defaultValue}
6566
>
6667
{this.getOptions()}
6768
</select>
@@ -75,6 +76,7 @@ export default class Select extends Component {
7576
onChange={this.handleOnChange}
7677
disabled={this.props.disabled}
7778
value={this.props.value}
79+
defaultValue={this.props.defaultValue}
7880
>
7981
{this.getOptions()}
8082
</select>
@@ -90,6 +92,7 @@ Select.propTypes = {
9092
labelClassName: React.PropTypes.string,
9193
options: React.PropTypes.array.isRequired,
9294
value: React.PropTypes.oneOfType([React.PropTypes.string, React.PropTypes.bool]),
95+
defaultValue: React.PropTypes.oneOfType([React.PropTypes.string, React.PropTypes.bool]),
9396
placeholder: React.PropTypes.string,
9497
mandatory: React.PropTypes.bool,
9598
disabled: React.PropTypes.bool,

0 commit comments

Comments
 (0)