You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
70 lines
2.4 KiB
Dart
70 lines
2.4 KiB
Dart
|
5 years ago
|
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
|
||
|
|
import 'package:doctor_app_flutter/core/model/DischargeReferralPatient.dart';
|
||
|
|
import 'package:doctor_app_flutter/core/service/DischargedPatientService.dart';
|
||
|
|
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
|
||
|
|
|
||
|
|
import '../../locator.dart';
|
||
|
|
import 'base_view_model.dart';
|
||
|
|
|
||
|
|
class DischargedPatientViewModel extends BaseViewModel {
|
||
|
|
DischargedPatientService _dischargedPatientService =
|
||
|
|
locator<DischargedPatientService>();
|
||
|
|
|
||
|
|
List<PatiantInformtion> get myDischargedPatient =>
|
||
|
|
_dischargedPatientService.myDischargedPatients;
|
||
|
|
|
||
|
|
List<DischargeReferralPatient> get myDischargeReferralPatient =>
|
||
|
|
_dischargedPatientService.myDischargeReferralPatients;
|
||
|
|
List<PatiantInformtion> filterData = [];
|
||
|
|
|
||
|
|
searchData(String str) {
|
||
|
|
// this.responseModelList = this.responseModelList2;
|
||
|
|
// var strExist = str.length > 0 ? true : false;
|
||
|
|
// if (strExist) {
|
||
|
|
// List<PatiantInformtion> filterData = [];
|
||
|
|
//
|
||
|
|
// for (var i = 0; i < responseModelList2.length; i++) {
|
||
|
|
// String firstName = responseModelList[i].firstName.toUpperCase();
|
||
|
|
// String lastName = responseModelList[i].lastName.toUpperCase();
|
||
|
|
// String mobile = responseModelList[i].mobileNumber.toUpperCase();
|
||
|
|
// String patientID = responseModelList[i].patientId.toString();
|
||
|
|
//
|
||
|
|
// if (firstName.contains(str.toUpperCase()) ||
|
||
|
|
// lastName.contains(str.toUpperCase()) ||
|
||
|
|
// mobile.contains(str) ||
|
||
|
|
// patientID.contains(str)) {
|
||
|
|
// filterData.add(responseModelList[i]);
|
||
|
|
// }
|
||
|
|
// }
|
||
|
|
//
|
||
|
|
// // setState(() {
|
||
|
|
// // this.responseModelList = filterData;
|
||
|
|
// // });
|
||
|
|
// } else {
|
||
|
|
// filterData = myDischargedPatient;
|
||
|
|
// notifyListeners();
|
||
|
|
// }
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
Future getDischargedPatient() async {
|
||
|
|
setState(ViewState.Busy);
|
||
|
|
await _dischargedPatientService.getDischargedPatient();
|
||
|
|
if (_dischargedPatientService.hasError) {
|
||
|
|
error = _dischargedPatientService.error;
|
||
|
|
setState(ViewState.Error);
|
||
|
|
} else
|
||
|
|
setState(ViewState.Idle);
|
||
|
|
}
|
||
|
|
|
||
|
|
Future gtMyDischargeReferralPatient() async {
|
||
|
|
setState(ViewState.Busy);
|
||
|
|
await _dischargedPatientService.gtMyDischargeReferralPatient();
|
||
|
|
if (_dischargedPatientService.hasError) {
|
||
|
|
error = _dischargedPatientService.error;
|
||
|
|
setState(ViewState.Error);
|
||
|
|
} else
|
||
|
|
setState(ViewState.Idle);
|
||
|
|
}
|
||
|
|
}
|