Skip to content

Commit be30c1d

Browse files
committed
Add new fields to patient metadata
Add PatientFields and Ringdown changes from 169-ems-update-form branch. Fix default value for status indicator.
1 parent 78897c3 commit be30c1d

File tree

6 files changed

+86
-81
lines changed

6 files changed

+86
-81
lines changed

src/Components/FormRadio.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function FormRadio({ currentValue, disabled, label, onChange, property, value })
2424
FormRadio.propTypes = {
2525
currentValue: PropTypes.oneOfType([PropTypes.bool, PropTypes.number, PropTypes.string]),
2626
disabled: PropTypes.bool,
27-
label: PropTypes.string.isRequired,
27+
label: PropTypes.node.isRequired,
2828
onChange: PropTypes.func.isRequired,
2929
property: PropTypes.string.isRequired,
3030
value: PropTypes.oneOfType([PropTypes.bool, PropTypes.number, PropTypes.string]),

src/Components/FormRadioFieldSet.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,12 @@ FormRadioFieldSet.propTypes = {
2929
children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,
3030
labelText: PropTypes.string.isRequired,
3131
property: PropTypes.string.isRequired,
32-
isRequired: PropTypes.bool.isRequired,
32+
isRequired: PropTypes.bool,
3333
validationState: PropTypes.string,
3434
};
3535

3636
FormRadioFieldSet.defaultProps = {
37+
isRequired: false,
3738
validationState: ValidityState.NO_INPUT,
3839
};
3940

src/EMS/PatientFields.js

Lines changed: 65 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,38 @@ import ApiService from '../ApiService';
1414
import Context from '../Context';
1515

1616
const INPUT_RANGES = {
17+
age: { min: 0, max: 130 },
1718
systolicBloodPressure: { min: 90, max: 180 },
1819
diastolicBloodPressure: { min: 60, max: 120 },
1920
heartRateBpm: { min: 40, max: 200 },
2021
respiratoryRate: { min: 12, max: 25 },
2122
oxygenSaturation: { min: 0, max: 100 },
2223
temperature: { min: 80, max: 150 },
24+
glasgowComaScale: { min: 3, max: 15 },
2325
};
2426

2527
function getRange(property, extreme) {
2628
return INPUT_RANGES[property] ? INPUT_RANGES[property][extreme] : null;
2729
}
2830

31+
// use prop-spreading here because all we're doing is defaulting some props and letting the rest
32+
// pass through to FormInput
33+
function NumericField({ property, size = 'small', min = getRange(property, 'min'), max = getRange(property, 'max'), ...props }) {
34+
return (
35+
<FormInput
36+
property={property}
37+
size={size}
38+
min={min}
39+
max={max}
40+
type="number"
41+
/* eslint-disable-next-line react/jsx-props-no-spreading */
42+
{...props}
43+
/>
44+
);
45+
}
46+
47+
NumericField.propTypes = FormInput.propTypes;
48+
2949
function PatientFields({ ringdown, onChange }) {
3050
const [ambulanceIds, setAmbulanceIds] = useState([]);
3151
const [dispatchCallNumbers, setDispatchCallNumbers] = useState([]);
@@ -91,27 +111,24 @@ function PatientFields({ ringdown, onChange }) {
91111
<Heading title="Patient Info" />
92112
<div className="usa-accordion__content">
93113
<fieldset className="usa-fieldset">
94-
<FormInput
95-
label="Age (estim.)"
96-
onChange={handleUserInput}
114+
<NumericField
115+
label="Age (estimated)"
97116
property="age"
98-
required
99-
size="small"
100-
type="number"
101117
unit="years"
102118
value={ringdown.age}
119+
required
103120
validationState={ringdown.getValidationState('age')}
121+
onChange={handleUserInput}
104122
/>
105123
</fieldset>
106124
<FormRadioFieldSet labelText="Gender Identity" property="sex" isRequired validationState={ringdown.getValidationState('sex')}>
107-
<FormRadio currentValue={ringdown.sex} label="Male" onChange={handleUserInput} property="sex" value="MALE" />
108-
<FormRadio currentValue={ringdown.sex} label="Female" onChange={handleUserInput} property="sex" value="FEMALE" />
109-
<FormRadio currentValue={ringdown.sex} label="Non-binary" onChange={handleUserInput} property="sex" value="NON-BINARY" />
125+
<FormRadio currentValue={ringdown.sex} label="Male" property="sex" value="MALE" onChange={handleUserInput} />
126+
<FormRadio currentValue={ringdown.sex} label="Female" property="sex" value="FEMALE" onChange={handleUserInput} />
127+
<FormRadio currentValue={ringdown.sex} label="Non-binary" property="sex" value="NON-BINARY" onChange={handleUserInput} />
110128
</FormRadioFieldSet>
111129
<FormRadioFieldSet
112130
labelText="Urgency"
113131
property="emergencyServiceResponseType"
114-
isRequired
115132
validationState={ringdown.getValidationState('emergencyServiceResponseType')}
116133
>
117134
<FormRadio
@@ -127,7 +144,7 @@ function PatientFields({ ringdown, onChange }) {
127144
onChange={handleUserInput}
128145
property="emergencyServiceResponseType"
129146
value="CODE 3"
130-
disabled={window.env.REACT_APP_DISABLE_CODE_3 === 'true'}
147+
disabled
131148
/>
132149
</FormRadioFieldSet>
133150
<fieldset className="usa-fieldset">
@@ -166,67 +183,34 @@ function PatientFields({ ringdown, onChange }) {
166183
/>
167184
</FormRadioFieldSet>
168185
</div>
169-
<Heading title="Vitals" subtitle="(optional)" />
186+
<Heading title="Vitals" subtitle="optional" />
170187
<div className="usa-accordion__content">
171188
<fieldset className="usa-fieldset">
172-
<FormInput
189+
<NumericField
173190
label="Blood Pressure"
174-
onChange={handleUserInput}
175191
property="systolicBloodPressure"
176-
size="small"
177-
type="number"
178192
unit="/"
179-
min={getRange('systolicBloodPressure', 'min')}
180-
max={getRange('systolicBloodPressure', 'max')}
181193
value={ringdown.systolicBloodPressure}
194+
onChange={handleUserInput}
182195
>
183196
<span className="usa-hint usa-hint--unit">&nbsp;&nbsp;</span>
184-
<FormInput
185-
onChange={handleUserInput}
197+
<NumericField
186198
isWrapped={false}
187199
property="diastolicBloodPressure"
188-
size="small"
189-
type="number"
190200
unit="mmHg"
191-
min={getRange('diastolicBloodPressure', 'min')}
192-
max={getRange('diastolicBloodPressure', 'max')}
193201
value={ringdown.diastolicBloodPressure}
202+
onChange={handleUserInput}
194203
/>
195-
</FormInput>
196-
<FormInput
197-
label="Pulse"
198-
onChange={handleUserInput}
199-
property="heartRateBpm"
200-
size="small"
201-
type="number"
202-
unit="bpm"
203-
min={getRange('heartRateBpm', 'min')}
204-
max={getRange('heartRateBpm', 'max')}
205-
value={ringdown.heartRateBpm}
206-
/>
207-
<FormInput
204+
</NumericField>
205+
<NumericField label="Pulse" property="heartRateBpm" unit="beats/min" value={ringdown.heartRateBpm} onChange={handleUserInput} />
206+
<NumericField
208207
label="Respiratory Rate"
209-
onChange={handleUserInput}
210208
property="respiratoryRate"
211-
size="small"
212-
type="number"
213-
min={getRange('respiratoryRate', 'min')}
214-
max={getRange('respiratoryRate', 'max')}
215-
unit="breath/m"
209+
unit="breaths/min"
216210
value={ringdown.respiratoryRate}
217-
/>
218-
<FormInput
219-
label="SpO2"
220211
onChange={handleUserInput}
221-
property="oxygenSaturation"
222-
size="small"
223-
type="number"
224-
unit="%"
225-
pattern="[0-9]*"
226-
min={getRange('oxygenSaturation', 'min')}
227-
max={getRange('oxygenSaturation', 'max')}
228-
value={ringdown.oxygenSaturation}
229212
/>
213+
<NumericField label="SpO2" property="oxygenSaturation" unit="%" value={ringdown.oxygenSaturation} onChange={handleUserInput} />
230214
<div className="padding-left-4">
231215
<FormRadio
232216
currentValue={ringdown.lowOxygenResponseType}
@@ -240,40 +224,38 @@ function PatientFields({ ringdown, onChange }) {
240224
<FormRadio
241225
currentValue={ringdown.lowOxygenResponseType}
242226
disabled={ringdown.oxygenSaturation === null || ringdown.oxygenSaturation === ''}
243-
label="O2"
227+
label={
228+
<span>
229+
O<sub>2</sub>
230+
</span>
231+
}
244232
onChange={handleUserInput}
245233
property="lowOxygenResponseType"
246234
value="SUPPLEMENTAL OXYGEN"
247235
/>
248236
<div className="margin-left-4">
249-
<FormInput
250-
disabled={ringdown.lowOxygenResponseType !== 'SUPPLEMENTAL OXYGEN'}
251-
onChange={handleUserInput}
237+
<NumericField
252238
property="supplementalOxygenAmount"
253-
size="small"
254-
type="number"
255239
unit="L"
240+
disabled={ringdown.lowOxygenResponseType !== 'SUPPLEMENTAL OXYGEN'}
256241
value={ringdown.supplementalOxygenAmount}
242+
onChange={handleUserInput}
257243
/>
258244
</div>
259245
</div>
260246
</div>
261-
<FormInput
262-
label="Temp."
263-
onChange={handleUserInput}
264-
property="temperature"
265-
size="small"
266-
type="number"
267-
min={getRange('temperature', 'min')}
268-
max={getRange('temperature', 'max')}
269-
unit="&deg;F"
270-
value={ringdown.temperature}
271-
/>
247+
<NumericField label="Temp." property="temperature" unit="&deg;F" value={ringdown.temperature} onChange={handleUserInput} />
272248
</fieldset>
273249
</div>
274-
<Heading title="Additional notes" subtitle="(optional)" />
250+
<Heading title="Additional Notes" subtitle="optional" />
275251
<div className="usa-accordion__content">
276252
<fieldset className="usa-fieldset">
253+
<FormTextArea
254+
label="Treatments administered"
255+
property="treatmentNotes"
256+
value={ringdown.treatmentNotes}
257+
onChange={handleUserInput}
258+
/>
277259
<FormCheckbox
278260
currentValue={ringdown.etohSuspectedIndicator}
279261
label="ETOH suspected"
@@ -319,14 +301,19 @@ function PatientFields({ ringdown, onChange }) {
319301
property="covid19SuspectedIndicator"
320302
value={true}
321303
/>
322-
<FormCheckbox
323-
currentValue={ringdown.ivIndicator}
324-
label="IV started"
304+
<NumericField
305+
label="GCS"
306+
property="glasgowComaScale"
307+
unit="/ 15"
308+
value={ringdown.glasgowComaScale}
309+
onChange={handleUserInput}
310+
/>
311+
<FormTextArea
312+
label="Other"
313+
property="otherObservationNotes"
314+
value={ringdown.otherObservationNotes}
325315
onChange={handleUserInput}
326-
property="ivIndicator"
327-
value={true}
328316
/>
329-
<FormTextArea label="Other" onChange={onChange} property="otherObservationNotes" value={ringdown.otherObservationNotes} />
330317
</fieldset>
331318
</div>
332319
</div>

src/Models/Ringdown.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ class Ringdown {
4646
this.payload.ambulance = this.payload.ambulance || {};
4747
this.payload.emsCall = this.payload.emsCall || {};
4848
this.payload.hospital = this.payload.hospital || {};
49-
this.payload.patient = this.payload.patient || {};
49+
// default the urgency to Code 2 for a new ringdown
50+
this.payload.patient = this.payload.patient || { emergencyServiceResponseType: 'CODE 2' };
5051
this.payload.patientDelivery = this.payload.patientDelivery || {};
5152

5253
// add getters/setters for patient fields

src/metadata/patient.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ const fields = [
4040
{
4141
name: 'stableIndicator',
4242
type: 'boolean',
43+
// though this is stored as a boolean, it's rendered in the UI as two radio buttons, not a
44+
// checkbox, so use null as the default so neither radio is selected
45+
defaultValue: null,
4346
required: true,
4447
},
4548
{
@@ -75,6 +78,10 @@ const fields = [
7578
name: 'temperature',
7679
type: 'decimal',
7780
},
81+
{
82+
name: 'treatmentNotes',
83+
type: 'text',
84+
},
7885
{
7986
name: 'etohSuspectedIndicator',
8087
type: 'boolean',
@@ -104,6 +111,10 @@ const fields = [
104111
name: 'ivIndicator',
105112
type: 'boolean',
106113
},
114+
{
115+
name: 'glasgowComaScale',
116+
type: 'integer',
117+
},
107118
{
108119
name: 'otherObservationNotes',
109120
type: 'text',

theme/_uswds-theme-custom-styles.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,11 @@ $spinner-border-width-sm: 0.2em;
300300
@include u-margin-top(2);
301301
}
302302

303+
textarea + .usa-checkbox > .usa-checkbox__label,
304+
textarea + .usa-radio > .usa-radio__label {
305+
@include u-margin-top(4);
306+
}
307+
303308
.usa-combo-box__clear-input {
304309
display: none !important;
305310
}

0 commit comments

Comments
 (0)