public async Task <IActionResult> ResetView() { PatientsList queriedPatients = await FhirService.GetObservationValues(AppContext.MonitorPatients); AppContext.MonitorPatients = queriedPatients; return(Json("Success")); }
public async Task <ActionResult> UpdateMonitor(List <string> ListId) { AppContext.MonitorPatients.IsLoading = true; PatientsList newMonitorList = new PatientsList(); PatientsList queryPatients = new PatientsList(); // Only add Patients haven't queried observations to avoid repeated query // One patient only needs to query once at the first time it is selected foreach (Patient patient in AppContext.Patients) { if (ListId.Contains(patient.Id)) { patient.Selected = true; if (!patient.HasObservations) { queryPatients.AddPatient(patient); } else { newMonitorList.AddPatient(patient); } } else { patient.Selected = false; } } // query list of patients haven't queried Cholesterol PatientsList queriedPatients = await FhirService.GetObservationValues(queryPatients); foreach (Patient patient in queriedPatients) { newMonitorList.AddPatient(patient); } AppContext.MonitorPatients = newMonitorList; return(View("Monitor")); }