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.
RSGDoctorApp/lib/core/viewModel/patient-vital-sign-viewMode...

31 lines
1.1 KiB
Dart

import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/service/patient-vital-signs-service.dart';
import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart';
import 'package:doctor_app_flutter/models/patient/vital_sign/patient-vital-sign-data.dart';
import 'package:doctor_app_flutter/models/patient/vital_sign/vital_sign_res_model.dart';
import '../../locator.dart';
class VitalSignsViewModel extends BaseViewModel{
VitalSignsService _vitalSignService = locator<VitalSignsService>();
VitalSignData get patientVitalSigns =>
_vitalSignService.patientVitalSigns;
Future getPatientVitalSign() async {
setState(ViewState.Busy);
await _vitalSignService.getPatientVitalSign();
if (_vitalSignService.hasError) {
error = _vitalSignService.error;
setState(ViewState.Error);
} else {
if(patientVitalSigns == null) {
_vitalSignService.patientVitalSigns = VitalSignData(
appointmentNo: 2016053265, bloodPressureCuffLocation: 0, bloodPressureCuffSize: 0, bloodPressureHigher: 38,
);
}
setState(ViewState.Idle);
}
}
}