|
|
|
|
@ -3,11 +3,11 @@ import 'package:doctor_app_flutter/core/model/live_care/AlternativeServicesList.
|
|
|
|
|
import 'package:doctor_app_flutter/core/model/live_care/PendingPatientERForDoctorAppRequestModel.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/core/model/live_care/add_patient_to_doctor_list_request_model.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/core/model/live_care/live_care_login_reguest_model.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/core/service/base/base_service.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/core/model/livecare/end_call_req.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/core/model/livecare/start_call_req.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/core/model/livecare/start_call_res.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/core/service/base/base_service.dart';
|
|
|
|
|
|
|
|
|
|
class LiveCarePatientServices extends BaseService {
|
|
|
|
|
List<PatiantInformtion> _patientList = [];
|
|
|
|
|
@ -34,9 +34,7 @@ class LiveCarePatientServices extends BaseService {
|
|
|
|
|
|
|
|
|
|
StartCallRes get startCallRes => _startCallRes;
|
|
|
|
|
|
|
|
|
|
Future getPendingPatientERForDoctorApp(
|
|
|
|
|
PendingPatientERForDoctorAppRequestModel
|
|
|
|
|
pendingPatientERForDoctorAppRequestModel) async {
|
|
|
|
|
Future getPendingPatientERForDoctorApp(PendingPatientERForDoctorAppRequestModel pendingPatientERForDoctorAppRequestModel) async {
|
|
|
|
|
hasError = false;
|
|
|
|
|
await baseAppClient.post(
|
|
|
|
|
GET_PENDING_PATIENT_ER_FOR_DOCTOR_APP,
|
|
|
|
|
@ -49,10 +47,7 @@ class LiveCarePatientServices extends BaseService {
|
|
|
|
|
|
|
|
|
|
/// add new items.
|
|
|
|
|
localPatientList.forEach((element) {
|
|
|
|
|
if ((_patientList.singleWhere(
|
|
|
|
|
(it) => it.patientId == element.patientId,
|
|
|
|
|
orElse: () => PatiantInformtion())) ==
|
|
|
|
|
null) {
|
|
|
|
|
if (!_patientList.any((it) => it.patientId == element.patientId)) {
|
|
|
|
|
_patientList.add(element);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
@ -60,10 +55,7 @@ class LiveCarePatientServices extends BaseService {
|
|
|
|
|
/// remove items.
|
|
|
|
|
List<PatiantInformtion> removedPatientList = [];
|
|
|
|
|
_patientList.forEach((element) {
|
|
|
|
|
if ((localPatientList.singleWhere(
|
|
|
|
|
(it) => it.patientId == element.patientId,
|
|
|
|
|
orElse: () => PatiantInformtion())) ==
|
|
|
|
|
null) {
|
|
|
|
|
if (localPatientList.any((it) => it.patientId == element.patientId)) {
|
|
|
|
|
removedPatientList.add(element);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
@ -92,8 +84,7 @@ class LiveCarePatientServices extends BaseService {
|
|
|
|
|
|
|
|
|
|
Future startCall(StartCallReq startCallReq) async {
|
|
|
|
|
hasError = false;
|
|
|
|
|
await baseAppClient.post(START_LIVE_CARE_CALL,
|
|
|
|
|
onSuccess: (response, statusCode) async {
|
|
|
|
|
await baseAppClient.post(START_LIVE_CARE_CALL, onSuccess: (response, statusCode) async {
|
|
|
|
|
_startCallRes = StartCallRes.fromJson(response);
|
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
|
hasError = true;
|
|
|
|
|
@ -103,23 +94,17 @@ class LiveCarePatientServices extends BaseService {
|
|
|
|
|
|
|
|
|
|
Future endCallWithCharge(int vcID, List<int> altServiceList) async {
|
|
|
|
|
hasError = false;
|
|
|
|
|
await baseAppClient.post(END_CALL_WITH_CHARGE,
|
|
|
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
|
|
|
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,
|
|
|
|
|
"AltServiceList": altServiceList,
|
|
|
|
|
"generalid": GENERAL_ID
|
|
|
|
|
}, isLiveCare: _isLive);
|
|
|
|
|
}, body: {"VC_ID": vcID, "AltServiceList": altServiceList, "generalid": GENERAL_ID}, isLiveCare: _isLive);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future transferToAdmin(int vcID, String notes) async {
|
|
|
|
|
hasError = false;
|
|
|
|
|
await baseAppClient.post(TRANSFERT_TO_ADMIN,
|
|
|
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
|
|
|
await baseAppClient.post(TRANSFERT_TO_ADMIN, onSuccess: (dynamic response, int statusCode) {
|
|
|
|
|
transferToAdminResponse = response;
|
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
|
hasError = true;
|
|
|
|
|
@ -133,8 +118,7 @@ class LiveCarePatientServices extends BaseService {
|
|
|
|
|
|
|
|
|
|
Future sendSMSInstruction(int vcID) async {
|
|
|
|
|
hasError = false;
|
|
|
|
|
await baseAppClient.post(SEND_SMS_INSTRUCTIONS,
|
|
|
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
|
|
|
await baseAppClient.post(SEND_SMS_INSTRUCTIONS, onSuccess: (dynamic response, int statusCode) {
|
|
|
|
|
transferToAdminResponse = response;
|
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
|
hasError = true;
|
|
|
|
|
@ -142,14 +126,11 @@ class LiveCarePatientServices extends BaseService {
|
|
|
|
|
}, body: {"VC_ID": vcID, "generalid": GENERAL_ID}, isLiveCare: _isLive);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future isLogin(
|
|
|
|
|
{LiveCareUserLoginRequestModel? isLoginRequestModel,
|
|
|
|
|
int? loginStatus}) async {
|
|
|
|
|
Future isLogin({LiveCareUserLoginRequestModel? isLoginRequestModel, int? loginStatus}) async {
|
|
|
|
|
hasError = false;
|
|
|
|
|
await getDoctorProfile();
|
|
|
|
|
isLoginRequestModel!.doctorId = super.doctorProfile!.doctorID;
|
|
|
|
|
await baseAppClient.post(LIVE_CARE_IS_LOGIN,
|
|
|
|
|
onSuccess: (response, statusCode) async {
|
|
|
|
|
await baseAppClient.post(LIVE_CARE_IS_LOGIN, onSuccess: (response, statusCode) async {
|
|
|
|
|
isLoginResponse = response;
|
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
|
hasError = true;
|
|
|
|
|
@ -161,8 +142,7 @@ class LiveCarePatientServices extends BaseService {
|
|
|
|
|
hasError = false;
|
|
|
|
|
alternativeServicesList.clear();
|
|
|
|
|
|
|
|
|
|
await baseAppClient.post(GET_ALTERNATIVE_SERVICE,
|
|
|
|
|
onSuccess: (dynamic response, int statusCode) {
|
|
|
|
|
await baseAppClient.post(GET_ALTERNATIVE_SERVICE, onSuccess: (dynamic response, int statusCode) {
|
|
|
|
|
response['AlternativeServicesList'].forEach((v) {
|
|
|
|
|
alternativeServicesList.add(AlternativeService.fromJson(v));
|
|
|
|
|
});
|
|
|
|
|
@ -175,16 +155,14 @@ class LiveCarePatientServices extends BaseService {
|
|
|
|
|
Future addPatientToDoctorList({int? vcID}) async {
|
|
|
|
|
hasError = false;
|
|
|
|
|
await getDoctorProfile();
|
|
|
|
|
AddPatientToDoctorListRequestModel addPatientToDoctorListRequestModel =
|
|
|
|
|
AddPatientToDoctorListRequestModel();
|
|
|
|
|
AddPatientToDoctorListRequestModel addPatientToDoctorListRequestModel = AddPatientToDoctorListRequestModel();
|
|
|
|
|
|
|
|
|
|
addPatientToDoctorListRequestModel.doctorId = super.doctorProfile!.doctorID;
|
|
|
|
|
addPatientToDoctorListRequestModel.vCID = vcID;
|
|
|
|
|
addPatientToDoctorListRequestModel.isOutKsa = false;
|
|
|
|
|
addPatientToDoctorListRequestModel.generalid = GENERAL_ID;
|
|
|
|
|
|
|
|
|
|
await baseAppClient.post(ADD_PATIENT_TO_DOCTOR,
|
|
|
|
|
onSuccess: (response, statusCode) async {
|
|
|
|
|
await baseAppClient.post(ADD_PATIENT_TO_DOCTOR, onSuccess: (response, statusCode) async {
|
|
|
|
|
isLoginResponse = response;
|
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
|
hasError = true;
|
|
|
|
|
@ -194,16 +172,14 @@ class LiveCarePatientServices extends BaseService {
|
|
|
|
|
|
|
|
|
|
Future removePatientFromDoctorList({int? vcID}) async {
|
|
|
|
|
hasError = false;
|
|
|
|
|
AddPatientToDoctorListRequestModel addPatientToDoctorListRequestModel =
|
|
|
|
|
AddPatientToDoctorListRequestModel();
|
|
|
|
|
AddPatientToDoctorListRequestModel addPatientToDoctorListRequestModel = AddPatientToDoctorListRequestModel();
|
|
|
|
|
await getDoctorProfile();
|
|
|
|
|
addPatientToDoctorListRequestModel.doctorId = super.doctorProfile!.doctorID;
|
|
|
|
|
addPatientToDoctorListRequestModel.vCID = vcID;
|
|
|
|
|
addPatientToDoctorListRequestModel.isOutKsa = false;
|
|
|
|
|
addPatientToDoctorListRequestModel.generalid = GENERAL_ID;
|
|
|
|
|
|
|
|
|
|
await baseAppClient.post(REMOVE_PATIENT_FROM_DOCTOR,
|
|
|
|
|
onSuccess: (response, statusCode) async {
|
|
|
|
|
await baseAppClient.post(REMOVE_PATIENT_FROM_DOCTOR, onSuccess: (response, statusCode) async {
|
|
|
|
|
isLoginResponse = response;
|
|
|
|
|
}, onFailure: (String error, int statusCode) {
|
|
|
|
|
hasError = true;
|
|
|
|
|
|