|
|
|
|
@ -186,30 +186,48 @@ class PatientSearchViewModel extends BaseViewModel {
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
setDefaultInPatientList();
|
|
|
|
|
|
|
|
|
|
generateMyInpatientClinicList();
|
|
|
|
|
setState(ViewState.Idle);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sortInPatient({bool isDes = false}) {
|
|
|
|
|
if (isDes)
|
|
|
|
|
filteredInPatientItems.sort((PatiantInformtion a, PatiantInformtion b) =>
|
|
|
|
|
b.admissionDateWithDateTimeForm
|
|
|
|
|
.compareTo(a.admissionDateWithDateTimeForm));
|
|
|
|
|
else
|
|
|
|
|
filteredInPatientItems.sort((PatiantInformtion a, PatiantInformtion b) =>
|
|
|
|
|
a.admissionDateWithDateTimeForm
|
|
|
|
|
.compareTo(b.admissionDateWithDateTimeForm));
|
|
|
|
|
sortInPatient({bool isDes = false, bool isAllClinic}) {
|
|
|
|
|
if (isAllClinic
|
|
|
|
|
? inPatientList.length > 0
|
|
|
|
|
: filteredInPatientItems.length > 0) {
|
|
|
|
|
List<PatiantInformtion> localInPatient =
|
|
|
|
|
isAllClinic ? [...inPatientList] : [...filteredInPatientItems];
|
|
|
|
|
if (isDes)
|
|
|
|
|
localInPatient.sort((PatiantInformtion a, PatiantInformtion b) => b
|
|
|
|
|
.admissionDateWithDateTimeForm
|
|
|
|
|
.compareTo(a.admissionDateWithDateTimeForm));
|
|
|
|
|
else
|
|
|
|
|
localInPatient.sort((PatiantInformtion a, PatiantInformtion b) => a
|
|
|
|
|
.admissionDateWithDateTimeForm
|
|
|
|
|
.compareTo(b.admissionDateWithDateTimeForm));
|
|
|
|
|
|
|
|
|
|
if (isAllClinic) {
|
|
|
|
|
resetInPatientPagination();
|
|
|
|
|
filteredInPatientItems
|
|
|
|
|
.addAll(localInPatient.sublist(firstSubsetIndex, lastSubsetIndex));
|
|
|
|
|
} else {
|
|
|
|
|
filteredInPatientItems.clear();
|
|
|
|
|
filteredInPatientItems.addAll(localInPatient);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
setState(ViewState.Idle);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future setDefaultInPatientList() async {
|
|
|
|
|
setState(ViewState.BusyLocal);
|
|
|
|
|
await getDoctorProfile();
|
|
|
|
|
resetInPatientPagination() {
|
|
|
|
|
filteredInPatientItems.clear();
|
|
|
|
|
firstSubsetIndex = 0;
|
|
|
|
|
lastSubsetIndex = inPatientPageSize - 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future setDefaultInPatientList() async {
|
|
|
|
|
setState(ViewState.BusyLocal);
|
|
|
|
|
await getDoctorProfile();
|
|
|
|
|
resetInPatientPagination();
|
|
|
|
|
if (inPatientList.length > 0)
|
|
|
|
|
filteredInPatientItems
|
|
|
|
|
.addAll(inPatientList.sublist(firstSubsetIndex, lastSubsetIndex));
|
|
|
|
|
@ -218,7 +236,7 @@ class PatientSearchViewModel extends BaseViewModel {
|
|
|
|
|
|
|
|
|
|
generateMyInpatientClinicList() {
|
|
|
|
|
inPatientList.forEach((element) {
|
|
|
|
|
if(!myInpatientClinicList.contains(element.clinicDescription)) {
|
|
|
|
|
if (!myInpatientClinicList.contains(element.clinicDescription)) {
|
|
|
|
|
myInpatientClinicList.add(element.clinicDescription);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
@ -240,8 +258,7 @@ class PatientSearchViewModel extends BaseViewModel {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
filterByHospital({ int hospitalId}) {
|
|
|
|
|
filterByHospital({int hospitalId}) {
|
|
|
|
|
filteredInPatientItems = [];
|
|
|
|
|
for (var i = 0; i < inPatientList.length; i++) {
|
|
|
|
|
if (inPatientList[i].projectId == hospitalId) {
|
|
|
|
|
@ -251,7 +268,7 @@ class PatientSearchViewModel extends BaseViewModel {
|
|
|
|
|
notifyListeners();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
filterByClinic({ String clinicName}) {
|
|
|
|
|
filterByClinic({String clinicName}) {
|
|
|
|
|
filteredInPatientItems = [];
|
|
|
|
|
for (var i = 0; i < inPatientList.length; i++) {
|
|
|
|
|
if (inPatientList[i].clinicDescription == clinicName) {
|
|
|
|
|
@ -266,28 +283,61 @@ class PatientSearchViewModel extends BaseViewModel {
|
|
|
|
|
_inPatientService.myInPatientList = [];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void filterSearchResults(String query) {
|
|
|
|
|
void filterSearchResults(String query, {bool isAllClinic}) {
|
|
|
|
|
var strExist = query.length > 0 ? true : false;
|
|
|
|
|
if (strExist) {
|
|
|
|
|
filteredInPatientItems = [];
|
|
|
|
|
for (var i = 0; i < inPatientList.length; i++) {
|
|
|
|
|
String firstName = inPatientList[i].firstName.toUpperCase();
|
|
|
|
|
String lastName = inPatientList[i].lastName.toUpperCase();
|
|
|
|
|
String mobile = inPatientList[i].mobileNumber.toUpperCase();
|
|
|
|
|
String patientID = inPatientList[i].patientId.toString();
|
|
|
|
|
|
|
|
|
|
if (firstName.contains(query.toUpperCase()) ||
|
|
|
|
|
lastName.contains(query.toUpperCase()) ||
|
|
|
|
|
mobile.contains(query) ||
|
|
|
|
|
patientID.contains(query)) {
|
|
|
|
|
filteredInPatientItems.add(inPatientList[i]);
|
|
|
|
|
if (isAllClinic) {
|
|
|
|
|
if (strExist) {
|
|
|
|
|
filteredInPatientItems = [];
|
|
|
|
|
for (var i = 0; i < inPatientList.length; i++) {
|
|
|
|
|
String firstName = inPatientList[i].firstName.toUpperCase();
|
|
|
|
|
String lastName = inPatientList[i].lastName.toUpperCase();
|
|
|
|
|
String mobile = inPatientList[i].mobileNumber.toUpperCase();
|
|
|
|
|
String patientID = inPatientList[i].patientId.toString();
|
|
|
|
|
|
|
|
|
|
if (firstName.contains(query.toUpperCase()) ||
|
|
|
|
|
lastName.contains(query.toUpperCase()) ||
|
|
|
|
|
mobile.contains(query) ||
|
|
|
|
|
patientID.contains(query)) {
|
|
|
|
|
filteredInPatientItems.add(inPatientList[i]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
notifyListeners();
|
|
|
|
|
} else {
|
|
|
|
|
if (inPatientList.length > 0) filteredInPatientItems.clear();
|
|
|
|
|
filteredInPatientItems.addAll(inPatientList);
|
|
|
|
|
notifyListeners();
|
|
|
|
|
}
|
|
|
|
|
notifyListeners();
|
|
|
|
|
} else {
|
|
|
|
|
if (inPatientList.length > 0) filteredInPatientItems.clear();
|
|
|
|
|
filteredInPatientItems.addAll(inPatientList);
|
|
|
|
|
notifyListeners();
|
|
|
|
|
List<PatiantInformtion> localFilteredInPatientItems = [
|
|
|
|
|
...filteredInPatientItems
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
if (strExist) {
|
|
|
|
|
filteredInPatientItems.clear();
|
|
|
|
|
for (var i = 0; i < localFilteredInPatientItems.length; i++) {
|
|
|
|
|
String firstName =
|
|
|
|
|
localFilteredInPatientItems[i].firstName.toUpperCase();
|
|
|
|
|
String lastName =
|
|
|
|
|
localFilteredInPatientItems[i].lastName.toUpperCase();
|
|
|
|
|
String mobile =
|
|
|
|
|
localFilteredInPatientItems[i].mobileNumber.toUpperCase();
|
|
|
|
|
String patientID =
|
|
|
|
|
localFilteredInPatientItems[i].patientId.toString();
|
|
|
|
|
|
|
|
|
|
if (firstName.contains(query.toUpperCase()) ||
|
|
|
|
|
lastName.contains(query.toUpperCase()) ||
|
|
|
|
|
mobile.contains(query) ||
|
|
|
|
|
patientID.contains(query)) {
|
|
|
|
|
filteredInPatientItems.add(localFilteredInPatientItems[i]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
notifyListeners();
|
|
|
|
|
} else {
|
|
|
|
|
if (localFilteredInPatientItems.length > 0)
|
|
|
|
|
filteredInPatientItems.clear();
|
|
|
|
|
filteredInPatientItems.addAll(localFilteredInPatientItems);
|
|
|
|
|
notifyListeners();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|