diff --git a/frontend/src/app/pages/medical-history/medical-history.component.html b/frontend/src/app/pages/medical-history/medical-history.component.html index 3e70171c..8e18d794 100644 --- a/frontend/src/app/pages/medical-history/medical-history.component.html +++ b/frontend/src/app/pages/medical-history/medical-history.component.html @@ -8,6 +8,7 @@ +
@@ -43,7 +44,7 @@
{ - let selectedResourceIds = response.map((resource: ResourceFhir): Partial => { + this.allEncountersIds = response.map((resource: ResourceFhir): Partial => { return { source_id: resource.source_id, source_resource_type: resource.source_resource_type, @@ -56,23 +51,29 @@ export class MedicalHistoryComponent implements OnInit { } }) - this.fastenApi.getResourceGraph(null, selectedResourceIds).subscribe((graphResponse: ResourceGraphResponse) => { - this.loading = false + this.pageChange() - console.log("FLATTENED RESOURCES RESPONSE", graphResponse) - this.encounters = graphResponse.results["Encounter"] || [] - }, - error => { - this.loading = false - }) + }) + + } + + pageChange(){ + this.loading = true + + let encounterIds = this.allEncountersIds.slice((this.currentPage-1) * this.pageSize, this.currentPage * this.pageSize) + + this.fastenApi.getResourceGraph(null, encounterIds).subscribe((graphResponse: ResourceGraphResponse) => { + this.loading = false + + console.log("FLATTENED RESOURCES RESPONSE", graphResponse) + this.encounters = graphResponse.results["Encounter"] || [] }, error => { this.loading = false - } - ) + }) // this.fastenApi.getResourceGraph(null, page).subscribe((response: ResourceGraphResponse) => { // this.loading = false