|
|
|
|
@ -35,6 +35,9 @@ class PatientSearchViewModel extends BaseViewModel {
|
|
|
|
|
|
|
|
|
|
List<String> InpatientClinicList = [];
|
|
|
|
|
|
|
|
|
|
String myInPatientQuery = "";
|
|
|
|
|
String allInPatientQuery = "";
|
|
|
|
|
|
|
|
|
|
searchData(String str) {
|
|
|
|
|
var strExist = str.length > 0 ? true : false;
|
|
|
|
|
if (strExist) {
|
|
|
|
|
@ -136,6 +139,7 @@ class PatientSearchViewModel extends BaseViewModel {
|
|
|
|
|
List<PatiantInformtion> mainList = [];
|
|
|
|
|
List<PatiantInformtion> filteredInPatientItems = [];
|
|
|
|
|
List<PatiantInformtion> filteredMyInPatientItems = [];
|
|
|
|
|
List<PatiantInformtion> mainMyInPatientItems = [];
|
|
|
|
|
PatientSearchRequestModel? requestModel;
|
|
|
|
|
bool isVidaPlusProject = false;
|
|
|
|
|
bool paginationLoading = false;
|
|
|
|
|
@ -144,6 +148,7 @@ class PatientSearchViewModel extends BaseViewModel {
|
|
|
|
|
void resetViewModel() {
|
|
|
|
|
// 1. Clear all lists that hold patient data.
|
|
|
|
|
mainList.clear();
|
|
|
|
|
mainMyInPatientItems.clear();
|
|
|
|
|
filteredInPatientItems.clear();
|
|
|
|
|
filteredMyInPatientItems.clear();
|
|
|
|
|
_inPatientService.inPatientList.clear();
|
|
|
|
|
@ -242,8 +247,9 @@ class PatientSearchViewModel extends BaseViewModel {
|
|
|
|
|
filteredMyInPatientItems.clear();
|
|
|
|
|
filteredMyInPatientItems.addAll(localInPatient);
|
|
|
|
|
} else if (isAllClinic) {
|
|
|
|
|
filteredInPatientItems.clear();
|
|
|
|
|
resetInPatientPagination();
|
|
|
|
|
filteredInPatientItems.addAll(localInPatient.sublist(firstSubsetIndex, lastSubsetIndex));
|
|
|
|
|
filteredInPatientItems.addAll(localInPatient);
|
|
|
|
|
} else {
|
|
|
|
|
filteredInPatientItems.clear();
|
|
|
|
|
filteredInPatientItems.addAll(localInPatient);
|
|
|
|
|
@ -272,6 +278,7 @@ class PatientSearchViewModel extends BaseViewModel {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (myIinPatientList.length > 0) {
|
|
|
|
|
mainMyInPatientItems.addAll(myIinPatientList);
|
|
|
|
|
filteredMyInPatientItems.addAll(myIinPatientList);
|
|
|
|
|
}
|
|
|
|
|
setState(ViewState.Idle);
|
|
|
|
|
@ -336,9 +343,12 @@ class PatientSearchViewModel extends BaseViewModel {
|
|
|
|
|
|
|
|
|
|
void filterSearchResults(String query, {bool isAllClinic = false, bool isMyInPatient = false}) {
|
|
|
|
|
var strExist = query.length > 0 ? true : false;
|
|
|
|
|
|
|
|
|
|
if(isMyInPatient)
|
|
|
|
|
myInPatientQuery = query;
|
|
|
|
|
else
|
|
|
|
|
allInPatientQuery = query;
|
|
|
|
|
if (isMyInPatient) {
|
|
|
|
|
List<PatiantInformtion> localFilteredMyInPatientItems = [...filteredMyInPatientItems];
|
|
|
|
|
List<PatiantInformtion> localFilteredMyInPatientItems = [...myIinPatientList];
|
|
|
|
|
|
|
|
|
|
if (strExist) {
|
|
|
|
|
filteredMyInPatientItems.clear();
|
|
|
|
|
@ -355,7 +365,7 @@ class PatientSearchViewModel extends BaseViewModel {
|
|
|
|
|
notifyListeners();
|
|
|
|
|
} else {
|
|
|
|
|
if (filteredMyInPatientItems.length > 0) filteredMyInPatientItems.clear();
|
|
|
|
|
filteredMyInPatientItems.addAll(localFilteredMyInPatientItems);
|
|
|
|
|
filteredMyInPatientItems.addAll(mainMyInPatientItems);
|
|
|
|
|
notifyListeners();
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
|