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.
100 lines
3.1 KiB
Dart
100 lines
3.1 KiB
Dart
import 'package:doctor_app_flutter/config/config.dart';
|
|
import 'package:doctor_app_flutter/core/model/live_care/PendingPatientERForDoctorAppRequestModel.dart';
|
|
import 'package:doctor_app_flutter/core/service/base/base_service.dart';
|
|
import 'package:doctor_app_flutter/models/livecare/end_call_req.dart';
|
|
import 'package:doctor_app_flutter/models/livecare/start_call_req.dart';
|
|
import 'package:doctor_app_flutter/models/livecare/start_call_res.dart';
|
|
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
|
|
|
|
class LiveCarePatientServices extends BaseService {
|
|
List<PatiantInformtion> _patientList = [];
|
|
|
|
List<PatiantInformtion> get patientList => _patientList;
|
|
|
|
bool _isFinished = false;
|
|
|
|
bool get isFinished => _isFinished;
|
|
|
|
|
|
var endCallResponse = {};
|
|
var transferToAdminResponse = {};
|
|
|
|
StartCallRes _startCallRes;
|
|
StartCallRes get startCallRes => _startCallRes;
|
|
|
|
Future getPendingPatientERForDoctorApp(PendingPatientERForDoctorAppRequestModel pendingPatientERForDoctorAppRequestModel) async{
|
|
hasError = false;
|
|
await baseAppClient.post(
|
|
GET_PENDING_PATIENT_ER_FOR_DOCTOR_APP,
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
_patientList.clear();
|
|
response['List_PendingPatientList'].forEach((v) {
|
|
_patientList.add(PatiantInformtion.fromJson(v));
|
|
});
|
|
},
|
|
onFailure: (String error, int statusCode) {
|
|
hasError = true;
|
|
super.error = error;
|
|
},
|
|
body: pendingPatientERForDoctorAppRequestModel.toJson(),
|
|
);
|
|
}
|
|
|
|
Future endCall(EndCallReq endCallReq) async {
|
|
hasError = false;
|
|
await baseAppClient.post(END_CALL, onSuccess: (response, statusCode) async {
|
|
_isFinished = true;
|
|
endCallResponse = response;
|
|
}, onFailure: (String error, int statusCode) {
|
|
_isFinished = true;
|
|
hasError = true;
|
|
super.error = error;
|
|
}, body: endCallReq.toJson());
|
|
}
|
|
|
|
Future startCall(StartCallReq startCallReq) async {
|
|
hasError = false;
|
|
await baseAppClient.post(START_LIVECARE_CALL,
|
|
onSuccess: (response, statusCode) async {
|
|
_startCallRes = StartCallRes.fromJson(response);
|
|
}, onFailure: (String error, int statusCode) {
|
|
hasError = true;
|
|
super.error = error;
|
|
}, body: startCallReq.toJson());
|
|
}
|
|
Future endCallWithCharge(int vcID) async{
|
|
hasError = false;
|
|
await baseAppClient.post(
|
|
END_CALL_WITH_CHARGE,
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
endCallResponse = response;
|
|
},
|
|
onFailure: (String error, int statusCode) {
|
|
hasError = true;
|
|
super.error = error;
|
|
},
|
|
body: {
|
|
"VC_ID": vcID,
|
|
},
|
|
);
|
|
}
|
|
|
|
Future transferToAdmin(int vcID, String notes) async{
|
|
hasError = false;
|
|
await baseAppClient.post(
|
|
TRANSFERT_TO_ADMIN,
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
transferToAdminResponse = response;
|
|
},
|
|
onFailure: (String error, int statusCode) {
|
|
hasError = true;
|
|
super.error = error;
|
|
},
|
|
body: {
|
|
"VC_ID": vcID,
|
|
"IsOutKsa": false,
|
|
"Notes": notes,
|
|
},
|
|
);
|
|
}
|
|
} |