@uxland/primary-shell 5.6.5 → 5.6.6
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.
package/dist/index.js
CHANGED
|
@@ -11638,11 +11638,14 @@ const areSameDiagnostics = (te, J) => {
|
|
|
11638
11638
|
return !1;
|
|
11639
11639
|
const X = te.map((ne) => ne.codi).sort(), re = J.map((ne) => ne.codi).sort();
|
|
11640
11640
|
return X.every((ne, oe) => ne === re[oe]);
|
|
11641
|
-
}, hasValidDiagnostic = (te) => te != null && typeof te.codi == "string" && typeof te.cataleg == "string" && typeof te.descripcio == "string", hasValidDiagnostics = (te) => te == null ? !0 : Array.isArray(te) && te.every(hasValidDiagnostic),
|
|
11642
|
-
var oe, de, ce, he, ue, pe, fe, ge
|
|
11643
|
-
const
|
|
11644
|
-
return X
|
|
11645
|
-
}, withinEightHours = (te, J) =>
|
|
11641
|
+
}, hasValidDiagnostic = (te) => te != null && typeof te.codi == "string" && typeof te.cataleg == "string" && typeof te.descripcio == "string", hasValidDiagnostics = (te) => te == null ? !0 : Array.isArray(te) && te.every(hasValidDiagnostic), dateStringCache = /* @__PURE__ */ new Map(), dateObjectCache = /* @__PURE__ */ new Map(), getDateString = (te) => (dateStringCache.has(te) || dateStringCache.set(te, new Date(te).toDateString()), dateStringCache.get(te)), getDateObject = (te) => (dateObjectCache.has(te) || dateObjectCache.set(te, new Date(te)), dateObjectCache.get(te)), createVisitKey = (te) => {
|
|
11642
|
+
var ne, oe, de, ce, he, ue, pe, fe, ge;
|
|
11643
|
+
const J = `${((ne = te.professional) == null ? void 0 : ne.id) || "null"}-${((de = (oe = te.professional) == null ? void 0 : oe.role) == null ? void 0 : de.id) || "null"}-${((he = (ce = te.professional) == null ? void 0 : ce.speciality) == null ? void 0 : he.id) || "null"}`, X = `${((ue = te.ep) == null ? void 0 : ue.id) || "null"}-${((pe = te.up) == null ? void 0 : pe.id) || "null"}-${((fe = te.center) == null ? void 0 : fe.id) || "null"}-${((ge = te.service) == null ? void 0 : ge.id) || "null"}`, re = getDateString(te.date);
|
|
11644
|
+
return `${J}|${X}|${re}`;
|
|
11645
|
+
}, withinEightHours = (te, J) => {
|
|
11646
|
+
const X = getDateObject(te).getTime(), re = getDateObject(J).getTime();
|
|
11647
|
+
return Math.abs(X - re) <= 8 * 60 * 60 * 1e3;
|
|
11648
|
+
};
|
|
11646
11649
|
function groupByValidDiagnostics(te) {
|
|
11647
11650
|
te.forEach((J) => {
|
|
11648
11651
|
const X = [], re = [];
|
|
@@ -11667,21 +11670,33 @@ function groupByValidDiagnostics(te) {
|
|
|
11667
11670
|
});
|
|
11668
11671
|
}
|
|
11669
11672
|
const groupActivityHistoryItems = (te) => {
|
|
11670
|
-
|
|
11671
|
-
|
|
11672
|
-
|
|
11673
|
-
|
|
11674
|
-
|
|
11675
|
-
|
|
11676
|
-
|
|
11677
|
-
|
|
11673
|
+
if (!(te != null && te.length)) return [];
|
|
11674
|
+
dateStringCache.clear(), dateObjectCache.clear();
|
|
11675
|
+
const J = /* @__PURE__ */ new Map();
|
|
11676
|
+
te.forEach((re) => {
|
|
11677
|
+
const ne = createVisitKey(re);
|
|
11678
|
+
if (!J.has(ne))
|
|
11679
|
+
J.set(ne, {
|
|
11680
|
+
idGroup: Math.random().toString(36).substr(2, 9),
|
|
11681
|
+
items: [re]
|
|
11682
|
+
});
|
|
11683
|
+
else {
|
|
11684
|
+
const oe = J.get(ne), de = oe.items[0], ce = oe.items[oe.items.length - 1];
|
|
11685
|
+
if (withinEightHours(de.date, re.date) && withinEightHours(ce.date, re.date))
|
|
11686
|
+
oe.items.push(re);
|
|
11687
|
+
else {
|
|
11688
|
+
let he = 1, ue = `${ne}_${he}`;
|
|
11689
|
+
for (; J.has(ue); )
|
|
11690
|
+
he++, ue = `${ne}_${he}`;
|
|
11691
|
+
J.set(ue, {
|
|
11692
|
+
idGroup: Math.random().toString(36).substr(2, 9),
|
|
11693
|
+
items: [re]
|
|
11694
|
+
});
|
|
11678
11695
|
}
|
|
11679
11696
|
}
|
|
11680
|
-
|
|
11681
|
-
|
|
11682
|
-
|
|
11683
|
-
});
|
|
11684
|
-
}), groupByValidDiagnostics(J), J;
|
|
11697
|
+
});
|
|
11698
|
+
const X = Array.from(J.values());
|
|
11699
|
+
return groupByValidDiagnostics(X), X;
|
|
11685
11700
|
}, sortGroupsByMostRecentDate = (te) => {
|
|
11686
11701
|
const J = (oe) => oe.reduce((de, ce) => {
|
|
11687
11702
|
const he = new Date(ce.date);
|