@icure/api 8.6.5 → 8.6.7
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/icc-api/api/IccFormApi.d.ts +89 -0
- package/icc-api/api/IccFormApi.js +234 -0
- package/icc-api/api/IccFormApi.js.map +1 -1
- package/icc-x-api/icc-accesslog-x-api.d.ts +93 -0
- package/icc-x-api/icc-accesslog-x-api.js +93 -0
- package/icc-x-api/icc-accesslog-x-api.js.map +1 -1
- package/icc-x-api/icc-calendar-item-x-api.d.ts +122 -0
- package/icc-x-api/icc-calendar-item-x-api.js +122 -0
- package/icc-x-api/icc-calendar-item-x-api.js.map +1 -1
- package/icc-x-api/icc-classification-x-api.d.ts +20 -0
- package/icc-x-api/icc-classification-x-api.js +20 -0
- package/icc-x-api/icc-classification-x-api.js.map +1 -1
- package/icc-x-api/icc-code-x-api.d.ts +23 -0
- package/icc-x-api/icc-code-x-api.js +23 -0
- package/icc-x-api/icc-code-x-api.js.map +1 -1
- package/icc-x-api/icc-contact-x-api.d.ts +219 -1
- package/icc-x-api/icc-contact-x-api.js +219 -2
- package/icc-x-api/icc-contact-x-api.js.map +1 -1
- package/icc-x-api/icc-data-owner-x-api.d.ts +14 -3
- package/icc-x-api/icc-data-owner-x-api.js +14 -3
- package/icc-x-api/icc-data-owner-x-api.js.map +1 -1
- package/icc-x-api/icc-device-x-api.d.ts +8 -0
- package/icc-x-api/icc-device-x-api.js +8 -0
- package/icc-x-api/icc-device-x-api.js.map +1 -1
- package/icc-x-api/icc-doctemplate-x-api.d.ts +26 -0
- package/icc-x-api/icc-doctemplate-x-api.js +26 -0
- package/icc-x-api/icc-doctemplate-x-api.js.map +1 -1
- package/icc-x-api/icc-document-x-api.d.ts +114 -1
- package/icc-x-api/icc-document-x-api.js +127 -1
- package/icc-x-api/icc-document-x-api.js.map +1 -1
- package/icc-x-api/icc-form-x-api.d.ts +34 -4
- package/icc-x-api/icc-form-x-api.js +34 -4
- package/icc-x-api/icc-form-x-api.js.map +1 -1
- package/icc-x-api/icc-hcparty-x-api.d.ts +67 -0
- package/icc-x-api/icc-hcparty-x-api.js +67 -0
- package/icc-x-api/icc-hcparty-x-api.js.map +1 -1
- package/icc-x-api/icc-helement-x-api.d.ts +141 -0
- package/icc-x-api/icc-helement-x-api.js +141 -0
- package/icc-x-api/icc-helement-x-api.js.map +1 -1
- package/icc-x-api/icc-invoice-x-api.d.ts +54 -0
- package/icc-x-api/icc-invoice-x-api.js +54 -0
- package/icc-x-api/icc-invoice-x-api.js.map +1 -1
- package/icc-x-api/icc-message-x-api.d.ts +162 -0
- package/icc-x-api/icc-message-x-api.js +162 -0
- package/icc-x-api/icc-message-x-api.js.map +1 -1
- package/icc-x-api/icc-patient-x-api.d.ts +245 -0
- package/icc-x-api/icc-patient-x-api.js +245 -1
- package/icc-x-api/icc-patient-x-api.js.map +1 -1
- package/icc-x-api/icc-receipt-x-api.d.ts +25 -0
- package/icc-x-api/icc-receipt-x-api.js +25 -0
- package/icc-x-api/icc-receipt-x-api.js.map +1 -1
- package/icc-x-api/icc-user-x-api.d.ts +25 -0
- package/icc-x-api/icc-user-x-api.js +25 -0
- package/icc-x-api/icc-user-x-api.js.map +1 -1
- package/package.json +1 -1
- package/test/icc-x-api/icc-form-x-api.js +316 -1
- package/test/icc-x-api/icc-form-x-api.js.map +1 -1
- package/test/utils/roles.js +5 -0
- package/test/utils/roles.js.map +1 -1
- package/test/utils/test_utils.js +1 -21
- package/test/utils/test_utils.js.map +1 -1
|
@@ -79,6 +79,11 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
|
|
|
79
79
|
return new models.Patient(initialisationInfo.updatedEntity);
|
|
80
80
|
});
|
|
81
81
|
}
|
|
82
|
+
/**
|
|
83
|
+
* Ensures patient names are consistent by synchronizing names property with firstName/lastName/maidenName/alias fields.
|
|
84
|
+
* @param patient the patient to process
|
|
85
|
+
* @return the patient with completed names
|
|
86
|
+
*/
|
|
82
87
|
completeNames(patient) {
|
|
83
88
|
var _a;
|
|
84
89
|
let finalPatient = patient;
|
|
@@ -141,6 +146,12 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
|
|
|
141
146
|
createPatient(body) {
|
|
142
147
|
throw new Error('Cannot call a method that returns patients without providing a user for de/encryption');
|
|
143
148
|
}
|
|
149
|
+
/**
|
|
150
|
+
* Creates a patient in the database with encryption.
|
|
151
|
+
* @param user the current user
|
|
152
|
+
* @param body the patient data to create
|
|
153
|
+
* @return the created patient
|
|
154
|
+
*/
|
|
144
155
|
createPatientWithUser(user, body) {
|
|
145
156
|
return body
|
|
146
157
|
? this.encrypt(user, [_.cloneDeep(this.completeNames(body))])
|
|
@@ -165,6 +176,18 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
|
|
|
165
176
|
filterBy(startKey, startDocumentId, limit, skip, sort, desc, body) {
|
|
166
177
|
throw new Error('Cannot call a method that returns contacts without providing a user for de/encryption');
|
|
167
178
|
}
|
|
179
|
+
/**
|
|
180
|
+
* Filters patients using a filter chain and returns decrypted results.
|
|
181
|
+
* @param user the current user
|
|
182
|
+
* @param filterChain the filter chain to apply
|
|
183
|
+
* @param startKey optional start key for pagination
|
|
184
|
+
* @param startDocumentId optional start document id for pagination
|
|
185
|
+
* @param limit optional maximum number of results
|
|
186
|
+
* @param skip optional number of results to skip
|
|
187
|
+
* @param sort optional sort field
|
|
188
|
+
* @param desc optional sort direction
|
|
189
|
+
* @return paginated list of decrypted patients
|
|
190
|
+
*/
|
|
168
191
|
filterByWithUser(user, filterChain, startKey, startDocumentId, limit, skip, sort, desc) {
|
|
169
192
|
return super
|
|
170
193
|
.filterPatientsBy(startKey, startDocumentId, limit, skip, sort, desc, filterChain)
|
|
@@ -173,6 +196,17 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
|
|
|
173
196
|
findByAccessLogUserAfterDate(userId, accessType, startDate, startKey, startDocumentId, limit) {
|
|
174
197
|
throw new Error('Cannot call a method that returns contacts without providing a user for de/encryption');
|
|
175
198
|
}
|
|
199
|
+
/**
|
|
200
|
+
* Finds patients by access log user after a specific date and returns decrypted results.
|
|
201
|
+
* @param user the current user
|
|
202
|
+
* @param userId the user id to search for in access logs
|
|
203
|
+
* @param accessType optional type of access
|
|
204
|
+
* @param startDate optional start date timestamp
|
|
205
|
+
* @param startKey optional start key for pagination
|
|
206
|
+
* @param startDocumentId optional start document id for pagination
|
|
207
|
+
* @param limit optional maximum number of results
|
|
208
|
+
* @return paginated list of decrypted patients
|
|
209
|
+
*/
|
|
176
210
|
findByAccessLogUserAfterDateWithUser(user, userId, accessType, startDate, startKey, startDocumentId, limit) {
|
|
177
211
|
return super
|
|
178
212
|
.findByAccessLogUserAfterDate(userId, accessType, startDate, startKey, startDocumentId, limit)
|
|
@@ -181,6 +215,12 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
|
|
|
181
215
|
findByAccessLogUserAfterDate_1(externalId) {
|
|
182
216
|
throw new Error('Cannot call a method that returns contacts without providing a user for de/encryption');
|
|
183
217
|
}
|
|
218
|
+
/**
|
|
219
|
+
* Finds a patient by external id and returns the decrypted result.
|
|
220
|
+
* @param user the current user
|
|
221
|
+
* @param externalId the external id to search for
|
|
222
|
+
* @return the decrypted patient
|
|
223
|
+
*/
|
|
184
224
|
findByExternalIdWithUser(user, externalId) {
|
|
185
225
|
return super
|
|
186
226
|
.findByExternalId(externalId)
|
|
@@ -190,6 +230,17 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
|
|
|
190
230
|
findByNameBirthSsinAuto(healthcarePartyId, filterValue, startKey, startDocumentId, limit, sortDirection) {
|
|
191
231
|
throw new Error('Cannot call a method that returns contacts without providing a user for de/encryption');
|
|
192
232
|
}
|
|
233
|
+
/**
|
|
234
|
+
* Finds patients by name, birth date, or SSIN with automatic search and returns decrypted results.
|
|
235
|
+
* @param user the current user
|
|
236
|
+
* @param healthcarePartyId optional healthcare party id
|
|
237
|
+
* @param filterValue optional search value
|
|
238
|
+
* @param startKey optional start key for pagination
|
|
239
|
+
* @param startDocumentId optional start document id for pagination
|
|
240
|
+
* @param limit optional maximum number of results
|
|
241
|
+
* @param sortDirection optional sort direction
|
|
242
|
+
* @return paginated list of decrypted patients
|
|
243
|
+
*/
|
|
193
244
|
findByNameBirthSsinAutoWithUser(user, healthcarePartyId, filterValue, startKey, startDocumentId, limit, sortDirection) {
|
|
194
245
|
return super
|
|
195
246
|
.findByNameBirthSsinAuto(healthcarePartyId, filterValue, startKey, startDocumentId, limit, sortDirection)
|
|
@@ -198,21 +249,46 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
|
|
|
198
249
|
fuzzySearch(firstName, lastName, dateOfBirth) {
|
|
199
250
|
throw new Error('Cannot call a method that returns contacts without providing a user for de/encryption');
|
|
200
251
|
}
|
|
252
|
+
/**
|
|
253
|
+
* Performs a fuzzy search for patients and returns decrypted results.
|
|
254
|
+
* @param user the current user
|
|
255
|
+
* @param firstName optional first name to search for
|
|
256
|
+
* @param lastName optional last name to search for
|
|
257
|
+
* @param dateOfBirth optional date of birth timestamp
|
|
258
|
+
* @return array of decrypted patients
|
|
259
|
+
*/
|
|
201
260
|
fuzzySearchWithUser(user, firstName, lastName, dateOfBirth) {
|
|
202
261
|
return super.fuzzySearch(firstName, lastName, dateOfBirth).then((pats) => this.decrypt(user, pats));
|
|
203
262
|
}
|
|
204
263
|
getPatient(patientId) {
|
|
205
264
|
throw new Error('Cannot call a method that returns contacts without providing a user for de/encryption');
|
|
206
265
|
}
|
|
266
|
+
/**
|
|
267
|
+
* Gets a patient by id without decryption.
|
|
268
|
+
* @param patientId the patient id
|
|
269
|
+
* @return the encrypted patient
|
|
270
|
+
*/
|
|
207
271
|
getPatientRaw(patientId) {
|
|
208
272
|
return super.getPatient(patientId);
|
|
209
273
|
}
|
|
274
|
+
/**
|
|
275
|
+
* Gets a patient by id with decryption.
|
|
276
|
+
* @param user the current user
|
|
277
|
+
* @param patientId the patient id
|
|
278
|
+
* @return the decrypted patient
|
|
279
|
+
*/
|
|
210
280
|
getPatientWithUser(user, patientId) {
|
|
211
281
|
return super
|
|
212
282
|
.getPatient(patientId)
|
|
213
283
|
.then((p) => this.tryDecryptOrReturnOriginal([p]))
|
|
214
284
|
.then((pats) => pats[0].entity);
|
|
215
285
|
}
|
|
286
|
+
/**
|
|
287
|
+
* Gets a patient by id and indicates whether it was successfully decrypted.
|
|
288
|
+
* @param user the current user
|
|
289
|
+
* @param patientId the patient id
|
|
290
|
+
* @return object containing the patient and a flag indicating if it was decrypted
|
|
291
|
+
*/
|
|
216
292
|
getPotentiallyEncryptedPatientWithUser(user, patientId) {
|
|
217
293
|
return super
|
|
218
294
|
.getPatient(patientId)
|
|
@@ -222,12 +298,29 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
|
|
|
222
298
|
getPatients(body) {
|
|
223
299
|
throw new Error('Cannot call a method that returns contacts without providing a user for de/encryption');
|
|
224
300
|
}
|
|
301
|
+
/**
|
|
302
|
+
* Gets multiple patients by their ids with decryption.
|
|
303
|
+
* @param user the current user
|
|
304
|
+
* @param body list of patient ids
|
|
305
|
+
* @return array of decrypted patients
|
|
306
|
+
*/
|
|
225
307
|
getPatientsWithUser(user, body) {
|
|
226
308
|
return super.getPatients(body).then((pats) => this.decrypt(user, pats));
|
|
227
309
|
}
|
|
228
310
|
listDeletedPatients(startDate, endDate, desc, startKey, startDocumentId, limit) {
|
|
229
311
|
throw new Error('Cannot call a method that returns contacts without providing a user for de/encryption');
|
|
230
312
|
}
|
|
313
|
+
/**
|
|
314
|
+
* Lists deleted patients with decryption.
|
|
315
|
+
* @param user the current user
|
|
316
|
+
* @param startDate optional start date timestamp
|
|
317
|
+
* @param endDate optional end date timestamp
|
|
318
|
+
* @param desc optional sort direction
|
|
319
|
+
* @param startKey optional start key for pagination
|
|
320
|
+
* @param startDocumentId optional start document id for pagination
|
|
321
|
+
* @param limit optional maximum number of results
|
|
322
|
+
* @return paginated list of decrypted deleted patients
|
|
323
|
+
*/
|
|
231
324
|
listDeletedPatientsWithUser(user, startDate, endDate, desc, startKey, startDocumentId, limit) {
|
|
232
325
|
return super
|
|
233
326
|
.listDeletedPatients(startDate, endDate, desc, startDocumentId, startKey, limit)
|
|
@@ -236,18 +329,40 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
|
|
|
236
329
|
listDeletedPatients_2(firstName, lastName) {
|
|
237
330
|
throw new Error('Cannot call a method that returns contacts without providing a user for de/encryption');
|
|
238
331
|
}
|
|
332
|
+
/**
|
|
333
|
+
* Lists deleted patients by name with decryption.
|
|
334
|
+
* @param user the current user
|
|
335
|
+
* @param firstName optional first name to filter by
|
|
336
|
+
* @param lastName optional last name to filter by
|
|
337
|
+
* @return array of decrypted deleted patients
|
|
338
|
+
*/
|
|
239
339
|
listDeletedPatientsByNameWithUser(user, firstName, lastName) {
|
|
240
340
|
return super.listDeletedPatientsByName(firstName, lastName).then((rows) => this.decrypt(user, rows, false));
|
|
241
341
|
}
|
|
242
342
|
listOfMergesAfter(date) {
|
|
243
343
|
throw new Error('Cannot call a method that returns contacts without providing a user for de/encryption');
|
|
244
344
|
}
|
|
345
|
+
/**
|
|
346
|
+
* Lists merged patients after a specific date with decryption.
|
|
347
|
+
* @param user the current user
|
|
348
|
+
* @param date timestamp to start from
|
|
349
|
+
* @return array of decrypted merged patients
|
|
350
|
+
*/
|
|
245
351
|
listOfMergesAfterWithUser(user, date) {
|
|
246
352
|
return super.listOfMergesAfter(date).then((pats) => this.decrypt(user, pats, false));
|
|
247
353
|
}
|
|
248
354
|
listOfPatientsModifiedAfter(date, startKey, startDocumentId, limit) {
|
|
249
355
|
throw new Error('Cannot call a method that returns contacts without providing a user for de/encryption');
|
|
250
356
|
}
|
|
357
|
+
/**
|
|
358
|
+
* Lists patients modified after a specific date with decryption.
|
|
359
|
+
* @param user the current user
|
|
360
|
+
* @param date timestamp to start from
|
|
361
|
+
* @param startKey optional start key for pagination
|
|
362
|
+
* @param startDocumentId optional start document id for pagination
|
|
363
|
+
* @param limit optional maximum number of results
|
|
364
|
+
* @return paginated list of decrypted modified patients
|
|
365
|
+
*/
|
|
251
366
|
listOfPatientsModifiedAfterWithUser(user, date, startKey, startDocumentId, limit) {
|
|
252
367
|
return super
|
|
253
368
|
.listOfPatientsModifiedAfter(date, startKey, startDocumentId, limit)
|
|
@@ -256,6 +371,17 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
|
|
|
256
371
|
listPatients(hcPartyId, sortField, startKey, startDocumentId, limit, sortDirection) {
|
|
257
372
|
throw new Error('Cannot call a method that returns contacts without providing a user for de/encryption');
|
|
258
373
|
}
|
|
374
|
+
/**
|
|
375
|
+
* Lists patients with decryption.
|
|
376
|
+
* @param user the current user
|
|
377
|
+
* @param hcPartyId optional healthcare party id
|
|
378
|
+
* @param sortField optional sort field
|
|
379
|
+
* @param startKey optional start key for pagination
|
|
380
|
+
* @param startDocumentId optional start document id for pagination
|
|
381
|
+
* @param limit optional maximum number of results
|
|
382
|
+
* @param sortDirection optional sort direction
|
|
383
|
+
* @return paginated list of decrypted patients
|
|
384
|
+
*/
|
|
259
385
|
listPatientsWithUser(user, hcPartyId, sortField, startKey, startDocumentId, limit, sortDirection) {
|
|
260
386
|
return super
|
|
261
387
|
.listPatients(hcPartyId, sortField, startKey, startDocumentId, limit, sortDirection)
|
|
@@ -264,6 +390,17 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
|
|
|
264
390
|
listPatientsByHcParty(hcPartyId, sortField, startKey, startDocumentId, limit, sortDirection) {
|
|
265
391
|
throw new Error('Cannot call a method that returns contacts without providing a user for de/encryption');
|
|
266
392
|
}
|
|
393
|
+
/**
|
|
394
|
+
* Lists patients by healthcare party with decryption.
|
|
395
|
+
* @param user the current user
|
|
396
|
+
* @param hcPartyId the healthcare party id
|
|
397
|
+
* @param sortField optional sort field
|
|
398
|
+
* @param startKey optional start key for pagination
|
|
399
|
+
* @param startDocumentId optional start document id for pagination
|
|
400
|
+
* @param limit optional maximum number of results
|
|
401
|
+
* @param sortDirection optional sort direction
|
|
402
|
+
* @return paginated list of decrypted patients
|
|
403
|
+
*/
|
|
267
404
|
listPatientsByHcPartyWithUser(user, hcPartyId, sortField, startKey, startDocumentId, limit, sortDirection) {
|
|
268
405
|
return super
|
|
269
406
|
.listPatientsByHcParty(hcPartyId, sortField, startKey, startDocumentId, limit, sortDirection)
|
|
@@ -272,6 +409,17 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
|
|
|
272
409
|
listPatientsOfHcParty(hcPartyId, sortField, startKey, startDocumentId, limit, sortDirection) {
|
|
273
410
|
throw new Error('Cannot call a method that returns contacts without providing a user for de/encryption');
|
|
274
411
|
}
|
|
412
|
+
/**
|
|
413
|
+
* Lists patients of a healthcare party with decryption.
|
|
414
|
+
* @param user the current user
|
|
415
|
+
* @param hcPartyId the healthcare party id
|
|
416
|
+
* @param sortField optional sort field
|
|
417
|
+
* @param startKey optional start key for pagination
|
|
418
|
+
* @param startDocumentId optional start document id for pagination
|
|
419
|
+
* @param limit optional maximum number of results
|
|
420
|
+
* @param sortDirection optional sort direction
|
|
421
|
+
* @return paginated list of decrypted patients
|
|
422
|
+
*/
|
|
275
423
|
listPatientsOfHcPartyWithUser(user, hcPartyId, sortField, startKey, startDocumentId, limit, sortDirection) {
|
|
276
424
|
return super
|
|
277
425
|
.listPatientsOfHcParty(hcPartyId, sortField, startKey, startDocumentId, limit, sortDirection)
|
|
@@ -280,6 +428,13 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
|
|
|
280
428
|
mergeInto(toId, fromIds) {
|
|
281
429
|
throw new Error('Cannot call a method that returns contacts without providing a user for de/encryption');
|
|
282
430
|
}
|
|
431
|
+
/**
|
|
432
|
+
* Merges patients and returns the decrypted result.
|
|
433
|
+
* @param user the current user
|
|
434
|
+
* @param toId the target patient id
|
|
435
|
+
* @param fromIds the source patient ids to merge from
|
|
436
|
+
* @return the decrypted merged patient
|
|
437
|
+
*/
|
|
283
438
|
mergeIntoWithUser(user, toId, fromIds) {
|
|
284
439
|
return super
|
|
285
440
|
.mergeInto(toId, fromIds)
|
|
@@ -295,6 +450,12 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
|
|
|
295
450
|
modifyPatientRaw(body) {
|
|
296
451
|
return super.modifyPatient(body);
|
|
297
452
|
}
|
|
453
|
+
/**
|
|
454
|
+
* Updates a patient with encryption.
|
|
455
|
+
* @param user the current user
|
|
456
|
+
* @param body the patient data to update
|
|
457
|
+
* @return the updated decrypted patient
|
|
458
|
+
*/
|
|
298
459
|
modifyPatientWithUser(user, body) {
|
|
299
460
|
return body ? this.modifyPatientAs(this.dataOwnerApi.getDataOwnerIdOf(user), body) : Promise.resolve(null);
|
|
300
461
|
}
|
|
@@ -307,12 +468,27 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
|
|
|
307
468
|
modifyPatientReferral(patientId, referralId, start, end) {
|
|
308
469
|
throw new Error('Cannot call a method that returns contacts without providing a user for de/encryption');
|
|
309
470
|
}
|
|
471
|
+
/**
|
|
472
|
+
* Updates a patient referral and returns the decrypted result.
|
|
473
|
+
* @param user the current user
|
|
474
|
+
* @param patientId the patient id
|
|
475
|
+
* @param referralId the referral id
|
|
476
|
+
* @param start optional start timestamp
|
|
477
|
+
* @param end optional end timestamp
|
|
478
|
+
* @return the updated decrypted patient
|
|
479
|
+
*/
|
|
310
480
|
modifyPatientReferralWithUser(user, patientId, referralId, start, end) {
|
|
311
481
|
return super
|
|
312
482
|
.modifyPatientReferral(patientId, referralId, start, end)
|
|
313
483
|
.then((p) => this.decrypt(user, [p]))
|
|
314
484
|
.then((pats) => pats[0]);
|
|
315
485
|
}
|
|
486
|
+
/**
|
|
487
|
+
* Encrypts patients using the current user's encryption keys.
|
|
488
|
+
* @param user the current user
|
|
489
|
+
* @param pats the patients to encrypt
|
|
490
|
+
* @return the encrypted patients
|
|
491
|
+
*/
|
|
316
492
|
encrypt(user, pats) {
|
|
317
493
|
const dataOwnerId = this.dataOwnerApi.getDataOwnerIdOf(user);
|
|
318
494
|
return this.encryptAs(dataOwnerId, pats);
|
|
@@ -320,13 +496,24 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
|
|
|
320
496
|
encryptAs(dataOwner, pats) {
|
|
321
497
|
return this.crypto.xapi.tryEncryptEntities(pats, EntityWithDelegationTypeName_1.EntityWithDelegationTypeName.Patient, this.encryptedFields, true, false, (x) => new models.Patient(x));
|
|
322
498
|
}
|
|
323
|
-
|
|
499
|
+
/**
|
|
500
|
+
* Decrypts patients using the current user's encryption keys. If a patient can't be decrypted, returns it with encrypted data.
|
|
501
|
+
* @param user the current user
|
|
502
|
+
* @param patients the patients to decrypt
|
|
503
|
+
* @param fillDelegations optional flag to fill delegations (defaults to true)
|
|
504
|
+
* @return the decrypted patients
|
|
505
|
+
*/
|
|
324
506
|
decrypt(user, patients, fillDelegations = true) {
|
|
325
507
|
return this.decryptAs(this.dataOwnerApi.getDataOwnerIdOf(user), patients, fillDelegations);
|
|
326
508
|
}
|
|
327
509
|
decryptAs(dataOwner, patients, fillDelegations = true) {
|
|
328
510
|
return this.tryDecryptOrReturnOriginal(patients).then((ps) => ps.map((p) => p.entity));
|
|
329
511
|
}
|
|
512
|
+
/**
|
|
513
|
+
* Attempts to decrypt patients. If decryption fails, returns the original encrypted patients.
|
|
514
|
+
* @param patients the patients to decrypt
|
|
515
|
+
* @return array of objects containing the patient entity and a flag indicating if it was decrypted
|
|
516
|
+
*/
|
|
330
517
|
tryDecryptOrReturnOriginal(patients) {
|
|
331
518
|
return __awaiter(this, void 0, void 0, function* () {
|
|
332
519
|
return (yield this.crypto.xapi.tryDecryptEntities(patients, EntityWithDelegationTypeName_1.EntityWithDelegationTypeName.Patient, (x) => new models.Patient(x))).map((p) => {
|
|
@@ -349,6 +536,16 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
|
|
|
349
536
|
return this.shareAllDataOfPatient(user, patId, ownerId, delegateIds, delegationTags, usingPost);
|
|
350
537
|
});
|
|
351
538
|
}
|
|
539
|
+
/**
|
|
540
|
+
* Shares a patient and all related data with specified delegates.
|
|
541
|
+
* @param user the current user
|
|
542
|
+
* @param patId the patient id
|
|
543
|
+
* @param ownerId the owner healthcare party id
|
|
544
|
+
* @param delegateIds the delegate ids to share with
|
|
545
|
+
* @param delegationTags tags specifying what data to share (e.g., medicalInformation, financialInformation, all)
|
|
546
|
+
* @param usingPost optional flag to use POST method instead of GET (defaults to false)
|
|
547
|
+
* @return object containing the updated patient and sharing statuses for each entity type
|
|
548
|
+
*/
|
|
352
549
|
shareAllDataOfPatient(user_1, patId_1, ownerId_1, delegateIds_1, delegationTags_1) {
|
|
353
550
|
return __awaiter(this, arguments, void 0, function* (user, patId, ownerId, delegateIds, delegationTags, usingPost = false) {
|
|
354
551
|
const allTags = _.uniq(_.flatMap(Object.values(delegationTags)));
|
|
@@ -530,6 +727,13 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
|
|
|
530
727
|
});
|
|
531
728
|
});
|
|
532
729
|
}
|
|
730
|
+
/**
|
|
731
|
+
* Exports a patient and all related medical data.
|
|
732
|
+
* @param user the current user
|
|
733
|
+
* @param patId the patient id
|
|
734
|
+
* @param ownerId the owner healthcare party id
|
|
735
|
+
* @return object containing the patient and all related entities (contacts, forms, health elements, invoices, classifications, calendar items, documents)
|
|
736
|
+
*/
|
|
533
737
|
export(user, patId, ownerId) {
|
|
534
738
|
return __awaiter(this, void 0, void 0, function* () {
|
|
535
739
|
const parentId = yield this.dataOwnerApi.getCurrentDataOwnerHierarchyIds().then((h) => (h.length - 2 >= 0 ? h[h.length - 2] : h[0]));
|
|
@@ -628,6 +832,11 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
|
|
|
628
832
|
};
|
|
629
833
|
});
|
|
630
834
|
}
|
|
835
|
+
/**
|
|
836
|
+
* Validates a Belgian INAMI number using modulo 97 check.
|
|
837
|
+
* @param inami the INAMI number to validate
|
|
838
|
+
* @return true if the INAMI number is valid, false otherwise
|
|
839
|
+
*/
|
|
631
840
|
checkInami(inami) {
|
|
632
841
|
const num_inami = inami.replace(new RegExp('[^(0-9)]', 'g'), '');
|
|
633
842
|
const checkDigit = num_inami.substring(6, 8);
|
|
@@ -642,6 +851,11 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
|
|
|
642
851
|
}
|
|
643
852
|
return retour;
|
|
644
853
|
}
|
|
854
|
+
/**
|
|
855
|
+
* Validates a Belgian social security identification number (SSIN/NISS) including support for bis and ter numbers.
|
|
856
|
+
* @param ssin the SSIN to validate
|
|
857
|
+
* @return true if the SSIN is valid, false otherwise
|
|
858
|
+
*/
|
|
645
859
|
isValidSsin(ssin) {
|
|
646
860
|
ssin = ssin.replace(new RegExp('[^(0-9)]', 'g'), '');
|
|
647
861
|
let isValidNiss = false;
|
|
@@ -656,6 +870,13 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
|
|
|
656
870
|
}
|
|
657
871
|
return isValidNiss;
|
|
658
872
|
}
|
|
873
|
+
/**
|
|
874
|
+
* Extracts the patient id from a child document, following merge chains if necessary.
|
|
875
|
+
* @param childDocument the child document (invoice, calendar item, contact, or access log)
|
|
876
|
+
* @param hcpId the healthcare party id
|
|
877
|
+
* @param childDocumentType the type of the child document
|
|
878
|
+
* @return the patient id after following any merge chains
|
|
879
|
+
*/
|
|
659
880
|
getPatientIdOfChildDocumentForHcpAndHcpParents(childDocument, hcpId, childDocumentType) {
|
|
660
881
|
const _super = Object.create(null, {
|
|
661
882
|
getPatient: { get: () => super.getPatient }
|
|
@@ -791,9 +1012,19 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
|
|
|
791
1012
|
decryptNonConfidentialSecretIdsOf(patient) {
|
|
792
1013
|
return this.crypto.xapi.getSecretIdsSharedWithParents({ entity: patient, type: EntityWithDelegationTypeName_1.EntityWithDelegationTypeName.Patient });
|
|
793
1014
|
}
|
|
1015
|
+
/**
|
|
1016
|
+
* Gets all data owners with access to the patient and their permission levels.
|
|
1017
|
+
* @param entity the patient
|
|
1018
|
+
* @return object containing permissions by data owner id and a flag indicating if there are unknown anonymous data owners
|
|
1019
|
+
*/
|
|
794
1020
|
getDataOwnersWithAccessTo(entity) {
|
|
795
1021
|
return this.crypto.delegationsDeAnonymization.getDataOwnersWithAccessTo({ entity, type: EntityWithDelegationTypeName_1.EntityWithDelegationTypeName.Patient });
|
|
796
1022
|
}
|
|
1023
|
+
/**
|
|
1024
|
+
* Gets all encryption keys of the patient that the current user can decrypt.
|
|
1025
|
+
* @param entity the patient
|
|
1026
|
+
* @return array of encryption keys
|
|
1027
|
+
*/
|
|
797
1028
|
getEncryptionKeysOf(entity) {
|
|
798
1029
|
return this.crypto.xapi.encryptionKeysOf({ entity, type: EntityWithDelegationTypeName_1.EntityWithDelegationTypeName.Patient }, undefined);
|
|
799
1030
|
}
|
|
@@ -844,12 +1075,25 @@ class IccPatientXApi extends icc_api_1.IccPatientApi {
|
|
|
844
1075
|
return (yield this.tryDecryptOrReturnOriginal([merged]))[0].entity;
|
|
845
1076
|
});
|
|
846
1077
|
}
|
|
1078
|
+
/**
|
|
1079
|
+
* Subscribes to patient events (create, update, delete) and automatically decrypts them.
|
|
1080
|
+
* @param eventTypes the types of events to subscribe to
|
|
1081
|
+
* @param filter optional filter to apply to events
|
|
1082
|
+
* @param eventFired callback function to handle each event
|
|
1083
|
+
* @param options optional subscription options
|
|
1084
|
+
* @return connection object to manage the subscription
|
|
1085
|
+
*/
|
|
847
1086
|
subscribeToPatientEvents(eventTypes_1, filter_1, eventFired_1) {
|
|
848
1087
|
return __awaiter(this, arguments, void 0, function* (eventTypes, filter, eventFired, options = {}) {
|
|
849
1088
|
const currentUser = yield this.userApi.getCurrentUser();
|
|
850
1089
|
return (0, utils_1.subscribeToEntityEvents)(this.host, this.authApi, EntityWithDelegationTypeName_1.EntityWithDelegationTypeName.Patient, eventTypes, filter, eventFired, options, (encrypted) => __awaiter(this, void 0, void 0, function* () { return (yield this.decrypt(currentUser, [encrypted]))[0]; })).then((rs) => new Connection_1.ConnectionImpl(rs));
|
|
851
1090
|
});
|
|
852
1091
|
}
|
|
1092
|
+
/**
|
|
1093
|
+
* Creates or updates de-anonymization metadata for patient delegations.
|
|
1094
|
+
* @param entity the patient
|
|
1095
|
+
* @param delegates array of delegate ids to create metadata for
|
|
1096
|
+
*/
|
|
853
1097
|
createDelegationDeAnonymizationMetadata(entity, delegates) {
|
|
854
1098
|
return this.crypto.delegationsDeAnonymization.createOrUpdateDeAnonymizationInfo({ entity, type: EntityWithDelegationTypeName_1.EntityWithDelegationTypeName.Patient }, delegates);
|
|
855
1099
|
}
|