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.
38 lines
1.3 KiB
Dart
38 lines
1.3 KiB
Dart
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
|
|
import 'package:doctor_app_flutter/core/model/PatientSearchRequestModel.dart';
|
|
import 'package:doctor_app_flutter/core/service/patient/out_patient_service.dart';
|
|
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
|
|
|
|
import '../../locator.dart';
|
|
import 'base_view_model.dart';
|
|
|
|
class PatientSearchViewModel extends BaseViewModel{
|
|
OutPatientService _outPatientService = locator<OutPatientService>();
|
|
|
|
List<PatiantInformtion> get patientList => _outPatientService.patientList;
|
|
|
|
getOutPatient(PatientSearchRequestModel patientSearchRequestModel) async {
|
|
setState(ViewState.Busy);
|
|
await _outPatientService.getOutPatient(
|
|
patientSearchRequestModel);
|
|
if (_outPatientService.hasError) {
|
|
error = _outPatientService.error;
|
|
setState(ViewState.Error);
|
|
} else {
|
|
setState(ViewState.Idle);
|
|
}
|
|
}
|
|
|
|
getPatientFileInformation(PatientSearchRequestModel patientSearchRequestModel) async {
|
|
setState(ViewState.Busy);
|
|
await _outPatientService.getPatientFileInformation(
|
|
patientSearchRequestModel);
|
|
if (_outPatientService.hasError) {
|
|
error = _outPatientService.error;
|
|
setState(ViewState.Error);
|
|
} else {
|
|
setState(ViewState.Idle);
|
|
}
|
|
}
|
|
|
|
} |