openchs-models 1.30.96 → 1.30.99
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/Makefile +1 -1
- package/dist/Checklist.js +2 -2
- package/dist/EntityApprovalStatus.js +21 -2
- package/dist/Individual.js +7 -3
- package/dist/ProgramEnrolment.js +3 -4
- package/package.json +1 -1
package/Makefile
CHANGED
package/dist/Checklist.js
CHANGED
|
@@ -128,8 +128,8 @@ class Checklist extends _BaseEntity.default {
|
|
|
128
128
|
}`;
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
-
|
|
132
|
-
|
|
131
|
+
addApprovalDescendantsWithLatestStatus(approvalStatus_status, list) {
|
|
132
|
+
_EntityApprovalStatus.default.addMatchingApprovalStatusEntity(this.items, approvalStatus_status, "baseDate", list);
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
}
|
|
@@ -22,8 +22,15 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
22
22
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
23
23
|
|
|
24
24
|
class EntityApprovalStatus extends _BaseEntity.default {
|
|
25
|
-
static getMatchingApprovalStatusEntity(entities, approvalStatus_status) {
|
|
26
|
-
return entities.filter(x => !_lodash.default.isNil(x.latestEntityApprovalStatus) && x.latestEntityApprovalStatus.hasStatus(approvalStatus_status));
|
|
25
|
+
static getMatchingApprovalStatusEntity(entities, approvalStatus_status, latestFieldPath) {
|
|
26
|
+
return _lodash.default.max(entities.filter(x => !_lodash.default.isNil(x.latestEntityApprovalStatus) && x.latestEntityApprovalStatus.hasStatus(approvalStatus_status)), y => _lodash.default.get(y, latestFieldPath));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
static addMatchingApprovalStatusEntity(entities, approvalStatus_status, latestFieldPath, list, groupingByPath) {
|
|
30
|
+
Object.values(_lodash.default.groupBy(entities, x => _lodash.default.get(x, groupingByPath))).forEach(y => {
|
|
31
|
+
const latestEntity = EntityApprovalStatus.getMatchingApprovalStatusEntity(y, approvalStatus_status, latestFieldPath);
|
|
32
|
+
if (!_lodash.default.isNil(latestEntity)) list.push(latestEntity);
|
|
33
|
+
});
|
|
27
34
|
}
|
|
28
35
|
|
|
29
36
|
static getApprovalEntitiesSchema() {
|
|
@@ -149,6 +156,18 @@ class EntityApprovalStatus extends _BaseEntity.default {
|
|
|
149
156
|
return this.approvalStatus.status === status;
|
|
150
157
|
}
|
|
151
158
|
|
|
159
|
+
get isRejected() {
|
|
160
|
+
return this.approvalStatus.isRejected;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
get isApproved() {
|
|
164
|
+
return this.approvalStatus.isApproved;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
get isPending() {
|
|
168
|
+
return this.approvalStatus.isPending;
|
|
169
|
+
}
|
|
170
|
+
|
|
152
171
|
}
|
|
153
172
|
|
|
154
173
|
_defineProperty(EntityApprovalStatus, "schema", {
|
package/dist/Individual.js
CHANGED
|
@@ -974,10 +974,14 @@ class Individual extends _BaseEntity.default {
|
|
|
974
974
|
getMemberEntitiesWithLatestStatus(approvalStatus_status) {
|
|
975
975
|
let descendants = [];
|
|
976
976
|
if (!_lodash.default.isNil(this.latestEntityApprovalStatus) && this.latestEntityApprovalStatus.hasStatus(approvalStatus_status)) descendants.push(this);
|
|
977
|
-
|
|
978
|
-
|
|
977
|
+
|
|
978
|
+
_EntityApprovalStatus.default.addMatchingApprovalStatusEntity(this.nonVoidedEncounters(), approvalStatus_status, "encounterDateTime", descendants, "encounterType.uuid");
|
|
979
|
+
|
|
980
|
+
_EntityApprovalStatus.default.addMatchingApprovalStatusEntity(this.nonVoidedEnrolments(), approvalStatus_status, "enrolmentDateTime", descendants, "program.uuid");
|
|
981
|
+
|
|
979
982
|
this.nonVoidedEnrolments().forEach(enrolment => {
|
|
980
|
-
|
|
983
|
+
const latestEntity = enrolment.addApprovalDescendantsWithLatestStatus(approvalStatus_status, descendants);
|
|
984
|
+
if (!_lodash.default.isNil(latestEntity)) descendants.push(latestEntity);
|
|
981
985
|
});
|
|
982
986
|
return descendants;
|
|
983
987
|
}
|
package/dist/ProgramEnrolment.js
CHANGED
|
@@ -591,13 +591,12 @@ class ProgramEnrolment extends _BaseEntity.default {
|
|
|
591
591
|
this.that.latestEntityApprovalStatus = this.fromObject(entityApprovalStatus);
|
|
592
592
|
}
|
|
593
593
|
|
|
594
|
-
|
|
595
|
-
|
|
594
|
+
addApprovalDescendantsWithLatestStatus(approvalStatus_status, list) {
|
|
595
|
+
_EntityApprovalStatus.default.addMatchingApprovalStatusEntity(this.nonVoidedEncounters(), approvalStatus_status, "encounterDateTime", list, "encounterType.uuid");
|
|
596
596
|
|
|
597
597
|
this.checklists.filter(x => !x.voided).forEach(x => {
|
|
598
|
-
|
|
598
|
+
x.addApprovalDescendantsWithLatestStatus(approvalStatus_status, list);
|
|
599
599
|
});
|
|
600
|
-
return descendants;
|
|
601
600
|
}
|
|
602
601
|
|
|
603
602
|
toJSON() {
|