@rinse-dental/open-dental 2.4.2 → 2.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"visit.d.ts","sourceRoot":"","sources":["../../src/transformers/visit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,gCAAgC,CAAC;AAIvD,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,WAAW,GAAG,KAAK,
|
|
1
|
+
{"version":3,"file":"visit.d.ts","sourceRoot":"","sources":["../../src/transformers/visit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,gCAAgC,CAAC;AAIvD,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,WAAW,GAAG,KAAK,CA4C1D"}
|
|
@@ -17,6 +17,7 @@ function appointmentToVisit(apt) {
|
|
|
17
17
|
}
|
|
18
18
|
const duration = (apt.Pattern?.length || 0) * 5;
|
|
19
19
|
const location = 'NF6YVFAXyRVXGi5nItqV';
|
|
20
|
+
const display_ProvNum = apt.IsHygiene == 'true' ? apt.ProvHyg : apt.ProvNum;
|
|
20
21
|
return {
|
|
21
22
|
docRef: `/patients/${apt.PatNum}/patientVisits/${apt.AptNum}`,
|
|
22
23
|
...apt,
|
|
@@ -25,10 +26,10 @@ function appointmentToVisit(apt) {
|
|
|
25
26
|
IsNewPatient: apt.IsNewPatient == 'true',
|
|
26
27
|
appendix: {
|
|
27
28
|
duration: duration,
|
|
28
|
-
ProvNum:
|
|
29
|
-
ProviderDocRef: `/providers/${
|
|
30
|
-
VisitTypeDocRef: `/lookups/lookup_definitions/lookup_visitType/${apt.AppointmentTypeNum}
|
|
31
|
-
OpDocRef: `/locations/${location}/locationOperatories/${apt.Op}
|
|
29
|
+
ProvNum: display_ProvNum,
|
|
30
|
+
ProviderDocRef: display_ProvNum != 0 ? `/providers/${display_ProvNum}` : undefined,
|
|
31
|
+
VisitTypeDocRef: apt.AppointmentTypeNum != 0 ? `/lookups/lookup_definitions/lookup_visitType/${apt.AppointmentTypeNum}` : undefined,
|
|
32
|
+
OpDocRef: apt.Op != 0 ? `/locations/${location}/locationOperatories/${apt.Op}` : undefined,
|
|
32
33
|
date: moment_aptDateTime.format('YYYY-MM-DD'),
|
|
33
34
|
dateTime: moment_aptDateTime.format(),
|
|
34
35
|
firestoreTimestamp: firestoreTimestamp,
|
|
@@ -42,8 +43,22 @@ function appointmentToVisit(apt) {
|
|
|
42
43
|
year_YYYY: moment_aptDateTime.format('YYYY'),
|
|
43
44
|
time: moment_aptDateTime.format('h:mm A'),
|
|
44
45
|
timezone: moment_aptDateTime.tz(),
|
|
45
|
-
|
|
46
|
+
timezone_z: moment_aptDateTime.format('z'),
|
|
47
|
+
duration_desc: formatMinutes(duration),
|
|
46
48
|
},
|
|
47
49
|
},
|
|
48
50
|
};
|
|
49
51
|
}
|
|
52
|
+
function formatMinutes(minutes) {
|
|
53
|
+
const days = Math.floor(minutes / (24 * 60)); // Calculate whole days
|
|
54
|
+
const hours = Math.floor((minutes % (24 * 60)) / 60); // Remaining hours
|
|
55
|
+
const mins = minutes % 60; // Remaining minutes
|
|
56
|
+
const parts = [];
|
|
57
|
+
if (days > 0)
|
|
58
|
+
parts.push(`${days} day${days > 1 ? 's' : ''}`);
|
|
59
|
+
if (hours > 0)
|
|
60
|
+
parts.push(`${hours} hour${hours > 1 ? 's' : ''}`);
|
|
61
|
+
if (mins > 0)
|
|
62
|
+
parts.push(`${mins} minute${mins > 1 ? 's' : ''}`);
|
|
63
|
+
return parts.join(' and ');
|
|
64
|
+
}
|
package/package.json
CHANGED
|
@@ -15,6 +15,7 @@ export function appointmentToVisit(apt: Appointment): Visit {
|
|
|
15
15
|
|
|
16
16
|
const duration = (apt.Pattern?.length || 0) * 5;
|
|
17
17
|
const location = 'NF6YVFAXyRVXGi5nItqV';
|
|
18
|
+
const display_ProvNum = apt.IsHygiene == 'true' ? apt.ProvHyg : apt.ProvNum;
|
|
18
19
|
|
|
19
20
|
return {
|
|
20
21
|
docRef: `/patients/${apt.PatNum}/patientVisits/${apt.AptNum}`,
|
|
@@ -24,10 +25,10 @@ export function appointmentToVisit(apt: Appointment): Visit {
|
|
|
24
25
|
IsNewPatient: apt.IsNewPatient == 'true',
|
|
25
26
|
appendix: {
|
|
26
27
|
duration: duration,
|
|
27
|
-
ProvNum:
|
|
28
|
-
ProviderDocRef: `/providers/${
|
|
29
|
-
VisitTypeDocRef: `/lookups/lookup_definitions/lookup_visitType/${apt.AppointmentTypeNum}
|
|
30
|
-
OpDocRef: `/locations/${location}/locationOperatories/${apt.Op}
|
|
28
|
+
ProvNum: display_ProvNum,
|
|
29
|
+
ProviderDocRef: display_ProvNum != 0 ? `/providers/${display_ProvNum}` : undefined,
|
|
30
|
+
VisitTypeDocRef: apt.AppointmentTypeNum != 0 ? `/lookups/lookup_definitions/lookup_visitType/${apt.AppointmentTypeNum}` : undefined,
|
|
31
|
+
OpDocRef: apt.Op != 0 ? `/locations/${location}/locationOperatories/${apt.Op}` : undefined,
|
|
31
32
|
date: moment_aptDateTime.format('YYYY-MM-DD'),
|
|
32
33
|
dateTime: moment_aptDateTime.format(),
|
|
33
34
|
firestoreTimestamp: firestoreTimestamp,
|
|
@@ -41,8 +42,22 @@ export function appointmentToVisit(apt: Appointment): Visit {
|
|
|
41
42
|
year_YYYY: moment_aptDateTime.format('YYYY'),
|
|
42
43
|
time: moment_aptDateTime.format('h:mm A'),
|
|
43
44
|
timezone: moment_aptDateTime.tz(),
|
|
44
|
-
|
|
45
|
+
timezone_z: moment_aptDateTime.format('z'),
|
|
46
|
+
duration_desc: formatMinutes(duration),
|
|
45
47
|
},
|
|
46
48
|
},
|
|
47
49
|
};
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function formatMinutes(minutes: number): string {
|
|
53
|
+
const days = Math.floor(minutes / (24 * 60)); // Calculate whole days
|
|
54
|
+
const hours = Math.floor((minutes % (24 * 60)) / 60); // Remaining hours
|
|
55
|
+
const mins = minutes % 60; // Remaining minutes
|
|
56
|
+
|
|
57
|
+
const parts = [];
|
|
58
|
+
if (days > 0) parts.push(`${days} day${days > 1 ? 's' : ''}`);
|
|
59
|
+
if (hours > 0) parts.push(`${hours} hour${hours > 1 ? 's' : ''}`);
|
|
60
|
+
if (mins > 0) parts.push(`${mins} minute${mins > 1 ? 's' : ''}`);
|
|
61
|
+
|
|
62
|
+
return parts.join(' and ');
|
|
48
63
|
}
|