Created
November 28, 2019 17:11
-
-
Save MamboBryan/190ec2cd6e6425238706a95b27fed1a9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class PatientsSeenViewModel extends ViewModel { | |
private static final String TAG = "PatientsSeenViewModel"; | |
private FiltersRepository filtersRepository; | |
private PatientSeenRepository patientSeenRepository; | |
private String mApiUrl; | |
private String mAuthToken; | |
private MutableLiveData<PatientsSeenData> mPatientsSeen; | |
private MutableLiveData<PatientSeenSummaryData> mSummaryData; | |
public PatientsSeenViewModel(String apiUrl, String authToken) { | |
mApiUrl = apiUrl; | |
mAuthToken = authToken; | |
init(); | |
} | |
private void init() { | |
if (mPatientsSeen != null) { | |
return; | |
} | |
filtersRepository = new FiltersRepository(mApiUrl, mAuthToken); | |
patientSeenRepository = new PatientSeenRepository(mApiUrl, mAuthToken); | |
} | |
public LiveData<PatientsSeenData> getPatientsSeen(Filters filters){ | |
mPatientsSeen = patientSeenRepository.getPatientsSeenData(filters); | |
return mPatientsSeen; | |
} | |
public LiveData<PatientSeenSummaryData> getPatientsSeenSummaryData(Filters filters){ | |
Log.i(TAG, "SummaryData getPatientsSeenSummaryData: update request sent"); | |
mSummaryData = patientSeenRepository.getPatientSeenSummaryData(filters); | |
Log.i(TAG, "SummaryData getPatientsSeenSummaryData: update request updated"); | |
return mSummaryData; | |
} | |
public void setPatientsSeenSummary(PatientSeenSummaryData patientsSeenSummary){ | |
mSummaryData.postValue(patientsSeenSummary); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment