|
|
|
|
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/core/model/live_care/PendingPatientERForDoctorAppRequestModel.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/core/service/home/dasboard_service.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/core/service/patient/LiveCarePatientServices.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/models/livecare/end_call_req.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
|
|
|
|
|
|
|
|
|
|
import '../../locator.dart';
|
|
|
|
|
|
|
|
|
|
class LiveCarePatientViewModel extends BaseViewModel {
|
|
|
|
|
List<PatiantInformtion> filterData = [];
|
|
|
|
|
|
|
|
|
|
LiveCarePatientServices _liveCarePatientServices =
|
|
|
|
|
locator<LiveCarePatientServices>();
|
|
|
|
|
|
|
|
|
|
bool get isFinished => _liveCarePatientServices.isFinished;
|
|
|
|
|
|
|
|
|
|
DashboardService _dashboardService =
|
|
|
|
|
locator<DashboardService>();
|
|
|
|
|
|
|
|
|
|
getPendingPatientERForDoctorApp() async {
|
|
|
|
|
setState(ViewState.BusyLocal);
|
|
|
|
|
PendingPatientERForDoctorAppRequestModel
|
|
|
|
|
pendingPatientERForDoctorAppRequestModel =
|
|
|
|
|
PendingPatientERForDoctorAppRequestModel(sErServiceID:_dashboardService.sServiceID, outSA: false);
|
|
|
|
|
await _liveCarePatientServices
|
|
|
|
|
.getPendingPatientERForDoctorApp(pendingPatientERForDoctorAppRequestModel);
|
|
|
|
|
if (_liveCarePatientServices.hasError) {
|
|
|
|
|
error = _liveCarePatientServices.error;
|
|
|
|
|
|
|
|
|
|
setState(ViewState.ErrorLocal);
|
|
|
|
|
} else {
|
|
|
|
|
filterData = _liveCarePatientServices.patientList;
|
|
|
|
|
setState(ViewState.Idle);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future endCall(request, isPatient, doctorID) async {
|
|
|
|
|
|
|
|
|
|
EndCallReq endCallReq = new EndCallReq();
|
|
|
|
|
endCallReq.doctorId = doctorID; //profile["DoctorID"];
|
|
|
|
|
endCallReq.generalid = 'Cs2020@2016\$2958';
|
|
|
|
|
endCallReq.vCID = request.vCID; //["VC_ID"];
|
|
|
|
|
endCallReq.isDestroy = isPatient;
|
|
|
|
|
|
|
|
|
|
setState(ViewState.BusyLocal);
|
|
|
|
|
await _liveCarePatientServices
|
|
|
|
|
.endCall(endCallReq);
|
|
|
|
|
if (_liveCarePatientServices.hasError) {
|
|
|
|
|
error = _liveCarePatientServices.error;
|
|
|
|
|
|
|
|
|
|
setState(ViewState.ErrorLocal);
|
|
|
|
|
} else {
|
|
|
|
|
filterData = _liveCarePatientServices.patientList;
|
|
|
|
|
setState(ViewState.Idle);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
searchData(String str) {
|
|
|
|
|
var strExist= str.length > 0 ? true : false;
|
|
|
|
|
if (strExist) {
|
|
|
|
|
filterData = [];
|
|
|
|
|
for (var i = 0; i < _liveCarePatientServices.patientList.length; i++) {
|
|
|
|
|
String fullName =
|
|
|
|
|
_liveCarePatientServices.patientList[i].fullName.toUpperCase();
|
|
|
|
|
String patientID =
|
|
|
|
|
_liveCarePatientServices.patientList[i].patientId.toString();
|
|
|
|
|
String mobile =
|
|
|
|
|
_liveCarePatientServices.patientList[i].mobileNumber.toUpperCase();
|
|
|
|
|
|
|
|
|
|
if (fullName.contains(str.toUpperCase()) ||
|
|
|
|
|
patientID.contains(str)|| mobile.contains(str)) {
|
|
|
|
|
filterData.add(_liveCarePatientServices.patientList[i]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
notifyListeners();
|
|
|
|
|
} else {
|
|
|
|
|
filterData = _liveCarePatientServices.patientList;
|
|
|
|
|
notifyListeners();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|