oro-sdk 7.0.0 → 7.1.1-dev
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/LICENSE +21 -0
- package/dist/client.d.ts +11 -0
- package/dist/oro-sdk.cjs.development.js +415 -356
- package/dist/oro-sdk.cjs.development.js.map +1 -1
- package/dist/oro-sdk.cjs.production.min.js +1 -1
- package/dist/oro-sdk.cjs.production.min.js.map +1 -1
- package/dist/oro-sdk.esm.js +416 -357
- package/dist/oro-sdk.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/client.ts +28 -13
- package/src/helpers/patient-registration.ts +34 -4
package/package.json
CHANGED
package/src/client.ts
CHANGED
@@ -95,7 +95,7 @@ export class OroClient {
|
|
95
95
|
public workflowClient: WorkflowService,
|
96
96
|
public diagnosisClient: DiagnosisService,
|
97
97
|
private authenticationCallback?: (err: Error) => void
|
98
|
-
) {}
|
98
|
+
) { }
|
99
99
|
|
100
100
|
/**
|
101
101
|
* clears the vaultIndex and cached metadata grants
|
@@ -415,18 +415,18 @@ export class OroClient {
|
|
415
415
|
}))
|
416
416
|
.map(
|
417
417
|
(e: IndexConsultLockbox) =>
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
418
|
+
({
|
419
|
+
uuid: e.uuid,
|
420
|
+
timestamp: e.timestamp,
|
421
|
+
uniqueHash: e.uniqueHash,
|
422
|
+
encryptedIndexEntry: CryptoRSA.jsonWithPubEncryptToBase64(
|
423
|
+
{
|
424
|
+
consultationId: e.consultationId,
|
425
|
+
grant: e.grant,
|
426
|
+
},
|
427
|
+
rsaPub
|
428
|
+
),
|
429
|
+
} as EncryptedIndexEntry)
|
430
430
|
)
|
431
431
|
break
|
432
432
|
}
|
@@ -875,6 +875,21 @@ export class OroClient {
|
|
875
875
|
return this.getMetaCategoryFromConsultId(consultationId, MetadataCategory.Medical, options)
|
876
876
|
}
|
877
877
|
|
878
|
+
/**
|
879
|
+
* Retrieves the patient follow up data associated to the `consultationId`
|
880
|
+
* The `consultationId` only helps to retrieve the patient lockboxes
|
881
|
+
* Note: it is possible to have several follow up data
|
882
|
+
* @param consultationId The consultation Id
|
883
|
+
* @param forceRefresh force data refresh (default to false)
|
884
|
+
* @returns the medical data
|
885
|
+
*/
|
886
|
+
public async getFollowupDataFromConsultId(
|
887
|
+
consultationId: Uuid,
|
888
|
+
options: { forceRefresh: boolean } = { forceRefresh: false }
|
889
|
+
): Promise<LocalizedData<PopulatedWorkflowData>[]> {
|
890
|
+
return this.getMetaCategoryFromConsultId(consultationId, MetadataCategory.Followup, options)
|
891
|
+
}
|
892
|
+
|
878
893
|
private async getMetaCategoryFromConsultId(
|
879
894
|
consultationId: Uuid,
|
880
895
|
category: MetadataCategory,
|
@@ -3,6 +3,7 @@ import {
|
|
3
3
|
ConsultationImageMeta,
|
4
4
|
ConsultationMeta,
|
5
5
|
ConsultRequest,
|
6
|
+
ConsultType,
|
6
7
|
DocumentType,
|
7
8
|
IdentityResponse,
|
8
9
|
IndexKey,
|
@@ -192,7 +193,8 @@ export async function registerPatient(
|
|
192
193
|
consultRequest.isoLanguageRequired,
|
193
194
|
lockboxUuid,
|
194
195
|
workflow,
|
195
|
-
oroClient
|
196
|
+
oroClient,
|
197
|
+
consult.consultType
|
196
198
|
).catch((err) => {
|
197
199
|
console.error('[SDK: registration] Some errors happened during patient data upload', err)
|
198
200
|
errorsThrown.push(err)
|
@@ -322,10 +324,11 @@ async function storePatientData(
|
|
322
324
|
isoLanguage: string,
|
323
325
|
lockboxUuid: Uuid,
|
324
326
|
workflow: WorkflowData,
|
325
|
-
oroClient: OroClient
|
327
|
+
oroClient: OroClient,
|
328
|
+
consultType: ConsultType
|
326
329
|
): Promise<(Uuid | void)[]> {
|
327
330
|
// Create and store registration data
|
328
|
-
|
331
|
+
let patientDataPromises = [
|
329
332
|
// Storing Raw data first
|
330
333
|
oroClient.getOrInsertJsonData<RawConsultationMeta>(
|
331
334
|
lockboxUuid,
|
@@ -393,7 +396,34 @@ async function storePatientData(
|
|
393
396
|
},
|
394
397
|
{}
|
395
398
|
),
|
396
|
-
]
|
399
|
+
]
|
400
|
+
|
401
|
+
switch (consultType) {
|
402
|
+
case ConsultType.FollowUp:
|
403
|
+
patientDataPromises.push(
|
404
|
+
getWorkflowDataByCategory(workflow, MetadataCategory.Followup).then((data) =>
|
405
|
+
oroClient.getOrInsertJsonData(
|
406
|
+
lockboxUuid,
|
407
|
+
data,
|
408
|
+
{
|
409
|
+
category: MetadataCategory.Followup,
|
410
|
+
documentType: DocumentType.PopulatedWorkflowData,
|
411
|
+
consultationId,
|
412
|
+
},
|
413
|
+
{ consultationId },
|
414
|
+
{ withNotification: false, forceReplace: false, updateMedicalStatus: false }
|
415
|
+
// the only data that needs to include an email notification
|
416
|
+
))
|
417
|
+
)
|
418
|
+
break
|
419
|
+
case ConsultType.Onboard:
|
420
|
+
case ConsultType.Refill:
|
421
|
+
default:
|
422
|
+
break;
|
423
|
+
}
|
424
|
+
return Promise
|
425
|
+
.all(patientDataPromises)
|
426
|
+
.then((dataUuids) => dataUuids.flat())
|
397
427
|
}
|
398
428
|
|
399
429
|
async function storeImageAliases(
|