/
preart_visit.xml
323 lines (303 loc) · 14.6 KB
/
preart_visit.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
<htmlform formUuid="468a01c2-c39d-4dc2-b142-04052a09e869"
formName="Pre-ART Visit"
formEncounterType="664b8812-977f-11e1-8993-905e29aff6c1"
formVersion="4.0">
<macros>
height=5090
weight=5089
tbStatus=7459
tbNotSuspected=7454
tbSuspected=7455
tbConfirmedNoTx=7456
tbConfirmedTx=7458
nextAppt=5096
wasting=8033
mod=1900
severe=1903
whoStageQuestion=7562
whoStage1=7041
whoStage2=7042
whoStage3=7043
whoStage4=7044
cd4SampleTaken=8555
pregnant=6131
ipt=8032
numCptGiven=6319
depoGiven=8029
numCondoms=8080
sideEffect=7755
no=1066
yes=1065
pn=821
hp=29
sk=512
lip=2148
other=6408
cd4Value=3434
<macro key="nenoLocations" expression="fn.globalProperty('pihmalawi.systemLocationsTag')"/>
</macros>
<ifMode mode="VIEW" include="false">
<script type="text/javascript">
jq(function() {
var searchNextApptDate = function() {
var nextAppointDateValue = jq("span#appointmentDate input[type='hidden']").val();
if (!nextAppointDateValue) {
// if value was not entered yet then search within other followup encounters on the same day
var visitDateInput = jq("span#visitDate input[type='hidden']").val();
// the Visit Date is in the format YYYY-MM-DD
var dateParts = visitDateInput.split("-");
// month is 0-based, that's why we need dataParts[1] - 1
var visitDate = new Date(+dateParts[0], dateParts[1] - 1, +dateParts[2]);
var nextAppointDate = '<lookup expression="fn.latestObs(5096).getValueDatetime()"/>';
if (nextAppointDate) {
var latestNextAppointDate = new Date(nextAppointDate);
var obsDatetime = '<lookup expression="fn.latestObs(5096).getObsDatetime()"/>';
if (obsDatetime) {
var jsObsDatetime = new Date(obsDatetime);
if ( visitDate.getFullYear() === jsObsDatetime.getFullYear() &&
visitDate.getMonth() === jsObsDatetime.getMonth() &&
visitDate.getDate() === jsObsDatetime.getDate() ) {
//we found a Next Appointment Date set on the same day on a different encounter
var appointDateWidget = getField('appointmentDate.value').datepicker('setDate', latestNextAppointDate);
setValue('appointmentDate.value', latestNextAppointDate);
jq("#appointmentDate").children("input[type=hidden]").first().trigger('change');
}
}
}
}
}
var findNextApptDate = setInterval(function() {
searchNextApptDate();
clearInterval(findNextApptDate);
}, 500);
});
</script>
</ifMode>
<!-- Flowsheet table view -->
<ifMode mode="VIEW" include="true">
<table class="visit-table data-entry-table">
<thead class="visit-table-header">
<tr>
<td>Visit Date</td>
<td>HT</td>
<td>WT</td>
<td>Wasting/malnutr.</td>
<td rowspan="2">TB status</td>
<td>WHO stage</td>
<td colspan="2">CD4</td>
<td>Pregnant?</td>
<td>IPT</td>
<td>CPT</td>
<td colspan="2">Family Plan</td>
<td>MLW ART side effects</td>
<td>Appointment date</td>
</tr>
<tr>
<td><i style="font-size:.7em;">day / month / year</i></td>
<td><i>cm</i></td>
<td><i>kg</i></td>
<td>Based on either Wt4Hgt BMI MUAC</td>
<td>Specify new conditions in Notes</td>
<td>Sample taken</td>
<td>Result</td>
<td>→ start ART!</td>
<td colspan="2">No. of tablets</td>
<td>Depo given</td>
<td>No. of con<br/>doms</td>
<td>Specify "Other" in Notes</td>
<td></td>
</tr>
</thead>
<tbody class="visit-table-body">
<tr class="visit-table-row">
<td class="nowrap visit-date">
<!-- Encounter Date -->
<encounterDate />
</td>
<td>
<!-- Height -->
<obs conceptId="$height" id="heightEntered" />
</td>
<td>
<!-- Weight -->
<obs conceptId="$weight" />
</td>
<td>
<!-- Wasting/malnutrition -->
<obs conceptId="$wasting" style="radio" answerConceptIds="$no,$mod,$severe" answerLabels="No,Mod,Sev" />
</td>
<td>
<!-- TB status -->
<obs conceptId="$tbStatus" style="radio" answerConceptIds="$tbNotSuspected,$tbSuspected,$tbConfirmedNoTx,$tbConfirmedTx" answerLabels="N,Y,C,Rx" />
</td>
<td>
<!-- WHO stage -->
<obs conceptId="$whoStageQuestion" style="radio" answerConceptIds="$whoStage1,$whoStage2,$whoStage3,$whoStage4" answerLabels="1,2,3,4" />
</td>
<td>
<!-- CD4 sample taken -->
<!-- taken from DNA/PCR bleeding; not 100% correct for CD4, but at least consistent to ART -->
<obs conceptId="$cd4SampleTaken" style="checkbox" answerConceptId="$yes" answerLabel="Bled" />
</td>
<td>
<!-- CD4 result -->
<lookup complexExpression="
#set ($obs = false)
#set ($obs = $fn.latestObs($cd4Value))
#if (!$obs)
#set ($obsResult = 'N/A')
#set ($obsDate = 'N/A')
#else
#set ($obsdate = $obs.obsDatetime.toString())
#set ($year = $obsdate.substring(0,4))
#set ($month = $obsdate.substring(5,7))
#set ($date = $obsdate.substring(8,10))
#set ($obsResult = $obs.valueNumeric)
#set ($obsDate = "${date}/${month}/${year}")
#end" />
<obs conceptId="$cd4Value" />
</td>
<td>
<!-- pregnant -->
<obs conceptId="$pregnant" style="radio" answerConceptIds="$no,$yes" answerLabels="N,Y" />
</td>
<td>
<!-- IPT -->
<obs conceptId="$ipt" />
</td>
<td>
<!-- CPT -->
<obs conceptId="$numCptGiven" />
</td>
<td>
<!-- depo given -->
<obs conceptId="$depoGiven" style="checkbox" answerConceptId="$yes" answerLabel="" />
</td>
<td>
<!-- # condoms -->
<obs conceptId="$numCondoms" />
</td>
<td>
<!-- side effects -->
<obs conceptId="$sideEffect" style="checkbox" answerConceptId="$no" answerLabel="No" />
<obs conceptId="$sideEffect" style="checkbox" answerConceptId="$pn" answerLabel="PN" />
<obs conceptId="$sideEffect" style="checkbox" answerConceptId="$hp" answerLabel="HP" />
<obs conceptId="$sideEffect" style="checkbox" answerConceptId="$sk" answerLabel="SK" />
<obs conceptId="$sideEffect" style="checkbox" answerConceptId="$other" answerLabel="Oth" />
</td>
<td>
<!-- Next appointment date -->
<obs conceptId="$nextAppt" allowFutureDates="true" id="nextAppointmentDate"/>
</td>
</tr>
</tbody>
</table>
</ifMode>
<!-- Data entry view -->
<ifMode mode="VIEW" include="false">
<h4 style="font-style: italic;">
<b>Pre-ART Patient Card</b>
<span style="padding-left:50px;">Version 4</span>
<span style="padding-left:50px;">
<b style="padding-right:10px;">HCC Reg no: </b>
<b>
<lookup complexExpression="#foreach( $id in $patientIdentifiers.get("HCC Number") ) $!id #end" />
</b>
</span>
</h4>
<span style="display:none"><encounterProvider default="16576" /></span> <!-- Set provider to a default as not used -->
<table class="visit-edit-table">
<tr>
<th>Visit Location</th>
<td class="nowrap visit-date">
<!-- Encounter Date -->
<encounterLocation id="visitLocation" tags="$nenoLocations"/>
</td>
</tr>
<tr>
<th>Visit Date</th>
<td class="nowrap visit-date">
<!-- Encounter Date -->
<encounterDate />
</td>
</tr>
<tr>
<th>Height</th>
<td><obs conceptId="$height" /></td>
</tr>
<tr>
<th>Weight</th>
<td><obs conceptId="$weight" /></td>
</tr>
<tr>
<th>Wasting/malnutrition</th>
<td><obs conceptId="$wasting" style="radio" answerConceptIds="$no,$mod,$severe" answerLabels="No,Mod,Sev" /></td>
</tr>
<tr><th>TB Status</th>
<td><obs conceptId="$tbStatus" style="radio" answerConceptIds="$tbNotSuspected,$tbSuspected,$tbConfirmedNoTx,$tbConfirmedTx" answerLabels="N,Y,C,Rx" /></td>
</tr>
<tr>
<th>WHO Stage</th>
<td><obs conceptId="$whoStageQuestion" style="radio" answerConceptIds="$whoStage1,$whoStage2,$whoStage3,$whoStage4" answerLabels="1,2,3,4" />
</td>
</tr>
<tr>
<th>CD4 sample taken</th>
<td><obs conceptId="$cd4SampleTaken" style="checkbox" answerConceptId="$yes" answerLabel="Bled" /></td>
</tr>
<tr>
<th>CD4 Value</th>
<td><lookup complexExpression="
#set ($obs = false)
#set ($obs = $fn.latestObs(3434))
#if (!$obs)
#set ($obsResult = 'N/A')
#set ($obsDate = 'N/A')
#else
#set ($obsdate = $obs.obsDatetime.toString())
#set ($year = $obsdate.substring(0,4))
#set ($month = $obsdate.substring(5,7))
#set ($date = $obsdate.substring(8,10))
#set ($obsResult = $obs.valueNumeric)
#set ($obsDate = "${date}/${month}/${year}")
#end
<input type='text' value='$obsResult' size='5' disabled='true' id='$prevCd4Value' /> on <input type='text' value='$obsDate' size='10' disabled='true' id='$prevCd4Date' />" />
<obs conceptId="$cd4Value" /></td>
</tr>
<tr>
<th>Pregnant?</th>
<td><obs conceptId="$pregnant" style="radio" answerConceptIds="$no,$yes" answerLabels="N,Y" /></td>
</tr>
<tr>
<th>Number IPT</th>
<td><obs conceptId="$ipt" /></td>
</tr>
<tr>
<th>Number CPT</th>
<td><obs conceptId="$numCptGiven" /></td>
</tr>
<tr>
<th>Depo-Provera Given</th>
<td><obs conceptId="$depoGiven" style="checkbox" answerConceptId="$yes" answerLabel="" /></td>
</tr>
<tr>
<th>Number of Condoms</th>
<td><obs conceptId="$numCondoms" /></td>
</tr>
<tr>
<th>Side Effects</th>
<td><obs conceptId="$sideEffect" style="checkbox" answerConceptId="$no" answerLabel="No" />
<obs conceptId="$sideEffect" style="checkbox" answerConceptId="$pn" answerLabel="PN" />
<obs conceptId="$sideEffect" style="checkbox" answerConceptId="$hp" answerLabel="HP" />
<obs conceptId="$sideEffect" style="checkbox" answerConceptId="$sk" answerLabel="SK" />
<obs conceptId="$sideEffect" style="checkbox" answerConceptId="$other" answerLabel="Oth" />
</td>
</tr>
<tr>
<th>Next Appointment</th>
<td><obs conceptId="$nextAppt" id="appointmentDate" allowFutureDates="true" /></td>
</tr>
</table>
<submit/>
</ifMode>
</htmlform>