@@ -32,9 +32,11 @@ import ca.bc.gov.common.model.services.BcCancerScreeningDataDto
32
32
import ca.bc.gov.common.model.services.DiagnosticImagingDataDto
33
33
import ca.bc.gov.common.model.specialauthority.SpecialAuthorityDto
34
34
import ca.bc.gov.common.model.test.CovidOrderWithCovidTestDto
35
+ import ca.bc.gov.common.utils.dateString
35
36
import ca.bc.gov.common.utils.toDate
36
37
import ca.bc.gov.common.utils.toDateTimeString
37
38
import ca.bc.gov.common.utils.toLocalDateTimeInstant
39
+ import ca.bc.gov.common.utils.toPST
38
40
import java.time.Instant
39
41
import java.time.LocalDate
40
42
@@ -101,7 +103,7 @@ fun ClinicalDocumentDto.toUiModel() =
101
103
fun LabOrderWithLabTestDto.toUiModel (): HealthRecordItem {
102
104
var description = " "
103
105
description = mapOrderStatus(labOrder.orderStatus ? : " " ).plus(" • " )
104
- .plus(labOrder.timelineDateTime.toDate ())
106
+ .plus(labOrder.timelineDateTime.dateString ())
105
107
return HealthRecordItem (
106
108
patientId = labOrder.patientId,
107
109
title = labOrder.commonName ? : " " ,
@@ -168,9 +170,9 @@ fun CovidOrderWithCovidTestDto.toUiModel(): HealthRecordItem {
168
170
patientId = covidOrder.patientId,
169
171
recordId = covidOrder.id,
170
172
title = " COVID-19 test result" ,
171
- description = " $testOutcome • ${date.toDate ()} " ,
173
+ description = " $testOutcome • ${date.dateString ()} " ,
172
174
icon = R .drawable.ic_health_record_covid_test,
173
- date = date,
175
+ date = date.toPST() ,
174
176
healthRecordType = HealthRecordType .COVID_TEST_RECORD ,
175
177
dataSource = covidOrder.dataSource.name
176
178
)
@@ -182,7 +184,7 @@ fun ImmunizationRecordWithForecastDto.toUiModel(): HealthRecordItem {
182
184
patientId = immunizationRecord.patientId,
183
185
recordId = immunizationRecord.id,
184
186
title = immunizationRecord.immunizationName ? : " " ,
185
- description = immunizationRecord.dateOfImmunization.toDate (),
187
+ description = immunizationRecord.dateOfImmunization.dateString (),
186
188
icon = R .drawable.ic_health_record_vaccine,
187
189
date = immunizationRecord.dateOfImmunization,
188
190
healthRecordType = HealthRecordType .IMMUNIZATION_RECORD ,
@@ -207,12 +209,12 @@ fun ImmunizationRecordWithForecastAndPatientDto.toUiModel(): ImmunizationRecordD
207
209
return ImmunizationRecordDetailItem (
208
210
id = immunizationRecordWithForecast.immunizationRecord.id,
209
211
status = immunizationRecordWithForecast.immunizationRecord.status,
210
- dueDate = immunizationRecordWithForecast.immunizationForecast?.dueDate?.toDate (),
212
+ dueDate = immunizationRecordWithForecast.immunizationForecast?.dueDate?.dateString (),
211
213
name = immunizationRecordWithForecast.immunizationRecord.immunizationName,
212
214
doseDetails = listOf (
213
215
ImmunizationDoseDetailItem (
214
216
id = immunizationRecordWithForecast.immunizationRecord.id,
215
- date = immunizationRecordWithForecast.immunizationRecord.dateOfImmunization.toDate (),
217
+ date = immunizationRecordWithForecast.immunizationRecord.dateOfImmunization.dateString (),
216
218
productName = immunizationRecordWithForecast.immunizationRecord.productName,
217
219
immunizingAgent = immunizationRecordWithForecast.immunizationRecord.agentName,
218
220
providerOrClinicName = immunizationRecordWithForecast.immunizationRecord.provideOrClinic,
@@ -228,7 +230,7 @@ fun HealthVisitsDto.toUiModel() =
228
230
patientId = patientId,
229
231
recordId = healthVisitId,
230
232
title = specialtyDescription.orEmpty(),
231
- description = practitionerName.orEmpty() + " • " + encounterDate.toDate (),
233
+ description = practitionerName.orEmpty() + " • " + encounterDate.dateString (),
232
234
icon = R .drawable.ic_health_record_health_visit,
233
235
date = encounterDate,
234
236
healthRecordType = HealthRecordType .HEALTH_VISIT_RECORD ,
@@ -239,7 +241,7 @@ fun SpecialAuthorityDto.toUiModel() = HealthRecordItem(
239
241
patientId = patientId,
240
242
recordId = specialAuthorityId,
241
243
title = drugName.orEmpty(),
242
- description = requestStatus.orEmpty() + " • " + requestedDate?.toDate (),
244
+ description = requestStatus.orEmpty() + " • " + requestedDate?.dateString (),
243
245
icon = R .drawable.ic_health_record_special_authority,
244
246
date = requestedDate!! ,
245
247
healthRecordType = HealthRecordType .SPECIAL_AUTHORITY_RECORD ,
@@ -261,7 +263,7 @@ fun HospitalVisitDto.toUiModel() =
261
263
fun ImmunizationRecommendationsDto.toUiModel () = RecommendationDetailItem (
262
264
title = this .recommendedVaccinations.orPlaceholder(),
263
265
status = this .status,
264
- date = this .agentDueDate?.toDate ().orPlaceholder(),
266
+ date = this .agentDueDate?.dateString ().orPlaceholder(),
265
267
)
266
268
267
269
fun DependentDto.toUiModel (currentDate : LocalDate ) = DependentDetailItem (
@@ -288,7 +290,7 @@ fun CommentDto.toUiModel() = Comment(
288
290
private fun ImmunizationForecastDto.toUiModel () = ForecastDetailItem (
289
291
name = this .displayName.orPlaceholder(),
290
292
status = this .status,
291
- date = this .dueDate.toDate (),
293
+ date = this .dueDate.dateString (),
292
294
)
293
295
294
296
enum class CovidTestResultStatus {
@@ -305,7 +307,7 @@ private fun DiagnosticImagingDataDto.toUiModel() = HealthRecordItem(
305
307
patientId = patientId,
306
308
icon = R .drawable.ic_health_record_diagnostic_imaging,
307
309
title = modality.orEmpty(),
308
- description = if (isUpdated) { " Updated" } else { examStatus } + " • " + examDate?.toDate (),
310
+ description = if (isUpdated) { " Updated" } else { examStatus } + " • " + examDate?.dateString (),
309
311
date = examDate!! ,
310
312
healthRecordType = HealthRecordType .DIAGNOSTIC_IMAGING ,
311
313
dataSource = null
@@ -320,7 +322,7 @@ fun BcCancerScreeningDataDto.toUiModel() = HealthRecordItem(
320
322
patientId = patientId,
321
323
icon = R .drawable.ic_health_record_bc_cancer_screening,
322
324
title = if (eventType == " Recall" ) { " BC Cancer Screening Reminder Letter" } else { " BC Cancer Screening Result Letter" },
323
- description = programName + " • " + if (eventType == " Recall" ) { eventDateTime } else { resultDateTime }?.toDate (),
325
+ description = programName + " • " + if (eventType == " Recall" ) { eventDateTime } else { resultDateTime }?.dateString (),
324
326
date = if (eventType == " Recall" ) { eventDateTime !! } else { resultDateTime!! },
325
327
healthRecordType = HealthRecordType .BC_CANCER_SCREENING ,
326
328
dataSource = null
0 commit comments