File tree Expand file tree Collapse file tree 2 files changed +56
-9
lines changed Expand file tree Collapse file tree 2 files changed +56
-9
lines changed Original file line number Diff line number Diff line change @@ -95,6 +95,7 @@ def vaccination_records
95
95
:patient ,
96
96
:performed_by_user ,
97
97
:session ,
98
+ :supplied_by ,
98
99
:vaccine
99
100
)
100
101
@@ -209,14 +210,19 @@ def site(vaccination_record)
209
210
end
210
211
211
212
def notes ( vaccination_record )
212
- notes = vaccination_record . notes . to_s
213
- if vaccination_record . performed_by
214
- notes += ( notes . empty? ? "" : "\n " )
215
- notes +=
216
- "Administered by: #{ vaccination_record . performed_by . given_name } " \
217
- " #{ vaccination_record . performed_by . family_name } "
218
- end
219
- notes
213
+ [
214
+ vaccination_record . notes ,
215
+ if ( user = vaccination_record . performed_by )
216
+ "Administered by: #{ user . full_name } "
217
+ end ,
218
+ if ( user = vaccination_record . supplied_by )
219
+ if vaccination_record . pgd?
220
+ "Authorised by: #{ user . full_name } "
221
+ else
222
+ "Prescribed by: #{ user . full_name } "
223
+ end
224
+ end
225
+ ] . compact_blank . join ( "\n " )
220
226
end
221
227
222
228
def method ( vaccination_record )
Original file line number Diff line number Diff line change 58
58
"Reason" => "Routine" ,
59
59
"Site" => "Left deltoid" ,
60
60
"Method" => "Intramuscular" ,
61
- "Notes" => "Administered by: Test User "
61
+ "Notes" => "Administered by: USER, Test "
62
62
}
63
63
)
64
64
end
264
264
end
265
265
end
266
266
267
+ describe "Notes field" do
268
+ subject { csv_row [ "Notes" ] }
269
+
270
+ let ( :nurse ) { create ( :nurse , given_name : "Nurse" ) }
271
+ let ( :healthcare_assistant ) do
272
+ create ( :healthcare_assistant , given_name : "HCA" )
273
+ end
274
+
275
+ context "nasal flu administered by healthcare assistant under PGD" do
276
+ let ( :vaccination_record ) do
277
+ create (
278
+ :vaccination_record ,
279
+ programme :,
280
+ patient :,
281
+ session :,
282
+ protocol : "pgd" ,
283
+ performed_by : healthcare_assistant ,
284
+ supplied_by : nurse
285
+ )
286
+ end
287
+
288
+ it { should eq ( "Administered by: USER, HCA\n Authorised by: USER, Nurse" ) }
289
+ end
290
+
291
+ context "nasal flu administered by healthcare assistant under PSD" do
292
+ let ( :vaccination_record ) do
293
+ create (
294
+ :vaccination_record ,
295
+ programme :,
296
+ patient :,
297
+ session :,
298
+ protocol : "psd" ,
299
+ performed_by : healthcare_assistant ,
300
+ supplied_by : nurse
301
+ )
302
+ end
303
+
304
+ it { should eq ( "Administered by: USER, HCA\n Prescribed by: USER, Nurse" ) }
305
+ end
306
+ end
307
+
267
308
describe "Flu vaccine records" do
268
309
let ( :vaccination_record ) do
269
310
create (
You can’t perform that action at this time.
0 commit comments