oro-sdk 7.0.0 → 7.1.0

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/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "7.0.0",
2
+ "version": "7.1.0",
3
3
  "main": "dist/index.js",
4
4
  "typings": "dist/index.d.ts",
5
5
  "files": [
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
- 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)
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,
@@ -322,10 +323,11 @@ async function storePatientData(
322
323
  isoLanguage: string,
323
324
  lockboxUuid: Uuid,
324
325
  workflow: WorkflowData,
325
- oroClient: OroClient
326
+ oroClient: OroClient,
327
+ consultType?: ConsultType
326
328
  ): Promise<(Uuid | void)[]> {
327
329
  // Create and store registration data
328
- return Promise.all([
330
+ let patientDataPromises = [
329
331
  // Storing Raw data first
330
332
  oroClient.getOrInsertJsonData<RawConsultationMeta>(
331
333
  lockboxUuid,
@@ -393,7 +395,33 @@ async function storePatientData(
393
395
  },
394
396
  {}
395
397
  ),
396
- ]).then((dataUuids) => dataUuids.flat())
398
+ ]
399
+
400
+ switch (consultType) {
401
+ case ConsultType.FollowUp:
402
+ patientDataPromises.push(
403
+ getWorkflowDataByCategory(workflow, MetadataCategory.Followup).then((data) =>
404
+ oroClient.getOrInsertJsonData(
405
+ lockboxUuid,
406
+ data,
407
+ {
408
+ category: MetadataCategory.Followup,
409
+ documentType: DocumentType.PopulatedWorkflowData,
410
+ consultationId,
411
+ },
412
+ { consultationId },
413
+ { withNotification: false, forceReplace: false, updateMedicalStatus: false }
414
+ // the only data that needs to include an email notification
415
+ ))
416
+ )
417
+ break
418
+ case ConsultType.Onboard:
419
+ case ConsultType.Refill:
420
+ break;
421
+ }
422
+ return Promise
423
+ .all(patientDataPromises)
424
+ .then((dataUuids) => dataUuids.flat())
397
425
  }
398
426
 
399
427
  async function storeImageAliases(