finalize create episode on Live care.

merge-requests/758/head
Elham Rababah 4 years ago
parent 80ef1a241d
commit 29eeb21e76

@ -10,9 +10,9 @@ 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> _patientList = [];
List<PatiantInformtion> patientList = [];
List<PatiantInformtion> get patientList => _patientList;
List<AlternativeService> alternativeServicesList = [];
@ -36,145 +36,41 @@ class LiveCarePatientServices extends BaseService {
Future getPendingPatientERForDoctorApp(
PendingPatientERForDoctorAppRequestModel
pendingPatientERForDoctorAppRequestModel, {bool isSecondTime = false }) async {
pendingPatientERForDoctorAppRequestModel) async {
hasError = false;
await baseAppClient.post(
GET_PENDING_PATIENT_ER_FOR_DOCTOR_APP,
onSuccess: (dynamic response, int statusCode) {
List<PatiantInformtion> localPatientList= [];
localPatientList.clear();
response['List_PendingPatientList'].forEach((v) {
localPatientList.add(PatiantInformtion.fromJson(v));
});
localPatientList.add(PatiantInformtion.fromJson({
"AcceptedBy": null,
"AcceptedOn": null,
"Age": 34,
"AppointmentDate": null,
"AppointmentNo": null,
"ArrivalTime": "2021-06-09 16:24",
"ArrivalTimeD": "/Date(1623245082567+0300)/",
"CallStatus": 1,
"CallStatusDisc": null,
"CallTypeID": 1,
"ClientRequestID": "2344670985-1231755-1621862656",
"ClinicName": "ENT",
"ConsoltationEnd": null,
"ConsultationNotes": null,
"CreatedOn": null,
"DateOfBirth": "1987-01-04",
"DeviceToken": "fYjscrPmRQk:APA91bHP3zv4YhxMc4v5cTgbY1TZQFj5hIzrS0VUsTqhsaeNOpWwGgrOTpl2S7xD1-98nOaTmEwNqZwgbZeJVBNPATHOBBXQmMht3yh91jobpYCht4vfmIcvFMl87MhrnWbaVz9nJy_5",
"DeviceType": "Android",
"DoctorName": null,
"EditOn": "/Date(1623230039447+0300)/",
"Gender": "1",
"IsFlutter": null,
"IsFollowUP": false,
"IsFromVida": false,
"IsLoginB": 0,
"IsOutKSA": false,
"IsRejected": 0,
"Language": "AR ",
"Latitude": 24.708887,
"Longitude": 46.665832,
"MobileNumber": "0537503378",
"OpenSession": null,
"OpenTokenID": "T1==cGFydG5lcl9pZD00NjIwOTk2MiZzaWc9NjYzMzhlOGNjMTdmNTU3ZjcxOTU1ZTg5ZGUxNzQyZDRiMDkwMjU2YjpzZXNzaW9uX2lkPTFfTVg0ME5qSXdPVGsyTW41LU1UWXlNVGcyTWpjNU9ESXhPWDUxV0hsSGVUTjZObFJoTldaV1ZFWlRkekpJV0hWM0sydC1mZyZjcmVhdGVfdGltZT0xNjIxODYyNzk5Jm5vbmNlPTE4MzE1Mi",
"PatientID": "1231755",
"PatientName": "TAMER FANASHEH",
"PatientStatus": 1,
"PreferredLanguage": "En",
"ProjectID": 0,
"Scoring": 0.00,
"ServiceID": 7,
"TokenID": null,
"VC_ID": 4475,
"VoipToken": null
}));
if(isSecondTime) {
localPatientList.add(PatiantInformtion.fromJson({
"AcceptedBy": null,
"AcceptedOn": null,
"Age": 34,
"AppointmentDate": null,
"AppointmentNo": null,
"ArrivalTime": "2021-06-09 16:24",
"ArrivalTimeD": "/Date(1623245082567+0300)/",
"CallStatus": 1,
"CallStatusDisc": null,
"CallTypeID": 1,
"ClientRequestID": "2344670985-1231755-1621862656",
"ClinicName": "ENT",
"ConsoltationEnd": null,
"ConsultationNotes": null,
"CreatedOn": null,
"DateOfBirth": "1987-01-04",
"DeviceToken": "fYjscrPmRQk:APA91bHP3zv4YhxMc4v5cTgbY1TZQFj5hIzrS0VUsTqhsaeNOpWwGgrOTpl2S7xD1-98nOaTmEwNqZwgbZeJVBNPATHOBBXQmMht3yh91jobpYCht4vfmIcvFMl87MhrnWbaVz9nJy_5",
"DeviceType": "Android",
"DoctorName": null,
"EditOn": "/Date(1623230039447+0300)/",
"Gender": "1",
"IsFlutter": null,
"IsFollowUP": false,
"IsFromVida": false,
"IsLoginB": 0,
"IsOutKSA": false,
"IsRejected": 0,
"Language": "AR ",
"Latitude": 24.708887,
"Longitude": 46.665832,
"MobileNumber": "0537503378",
"OpenSession": null,
"OpenTokenID": "T1==cGFydG5lcl9pZD00NjIwOTk2MiZzaWc9NjYzMzhlOGNjMTdmNTU3ZjcxOTU1ZTg5ZGUxNzQyZDRiMDkwMjU2YjpzZXNzaW9uX2lkPTFfTVg0ME5qSXdPVGsyTW41LU1UWXlNVGcyTWpjNU9ESXhPWDUxV0hsSGVUTjZObFJoTldaV1ZFWlRkekpJV0hWM0sydC1mZyZjcmVhdGVfdGltZT0xNjIxODYyNzk5Jm5vbmNlPTE4MzE1Mi",
"PatientID": "12317552222",
"PatientName": "TAMER FANASHEH",
"PatientStatus": 1,
"PreferredLanguage": "En",
"ProjectID": 0,
"Scoring": 0.00,
"ServiceID": 7,
"TokenID": null,
"VC_ID": 4475,
"VoipToken": null
}));
}
/// add new items.
localPatientList.forEach((element) {
// if (!_patientList.contains(element)) {
// _patientList.add(element);
// }
if ((patientList.singleWhere((it) => it.patientId == element.patientId,
if ((_patientList.singleWhere((it) => it.patientId == element.patientId,
orElse: () => null)) == null) {
patientList.add(element);
_patientList.add(element);
}
});
print(patientList);
/// remove items.
patientList.forEach((element) {
// if (!localPatientList.contains(element)) {
// _patientList.remove(element);
// }
List<PatiantInformtion> removedPatientList= [];
removedPatientList.clear();
_patientList.forEach((element) {
if ((localPatientList.singleWhere((it) => it.patientId == element.patientId,
orElse: () => null)) == null) {
patientList.remove(element);
removedPatientList.add(element);
}
});
print(patientList);
removedPatientList.forEach((element) {
_patientList.remove(element);
});
},
onFailure: (String error, int statusCode) {
hasError = true;

@ -25,7 +25,7 @@ class LiveCarePatientViewModel extends BaseViewModel {
DashboardService _dashboardService = locator<DashboardService>();
getPendingPatientERForDoctorApp({bool isFromTimer = false, bool isSecondTime = false}) async {
getPendingPatientERForDoctorApp({bool isFromTimer = false}) async {
if (isFromTimer) {
setState(ViewState.Idle);
} else {
@ -34,7 +34,7 @@ class LiveCarePatientViewModel extends BaseViewModel {
PendingPatientERForDoctorAppRequestModel pendingPatientERForDoctorAppRequestModel =
PendingPatientERForDoctorAppRequestModel(sErServiceID: _dashboardService.sServiceID, outSA: false);
await _liveCarePatientServices.getPendingPatientERForDoctorApp(pendingPatientERForDoctorAppRequestModel, isSecondTime: isSecondTime);
await _liveCarePatientServices.getPendingPatientERForDoctorApp(pendingPatientERForDoctorAppRequestModel);
if (_liveCarePatientServices.hasError) {
error = _liveCarePatientServices.error;

@ -32,7 +32,7 @@ class _LiveCarePatientScreenState extends State<LiveCarePatientScreen> {
super.initState();
timer = Timer.periodic(Duration(seconds: 10), (Timer t) {
if (_liveCareViewModel != null) {
_liveCareViewModel.getPendingPatientERForDoctorApp(isFromTimer: true, isSecondTime: true);
_liveCareViewModel.getPendingPatientERForDoctorApp(isFromTimer: true);
}
});
}

@ -1,14 +1,17 @@
import 'dart:async';
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/service/VideoCallService.dart';
import 'package:doctor_app_flutter/core/viewModel/LiveCarePatientViewModel.dart';
import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart';
import 'package:doctor_app_flutter/models/SOAP/PostEpisodeReqModel.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/screens/live_care/end_call_screen.dart';
import 'package:doctor_app_flutter/screens/patients/profile/profile_screen/profile_gird_for_InPatient.dart';
import 'package:doctor_app_flutter/screens/patients/profile/profile_screen/profile_gird_for_other.dart';
import 'package:doctor_app_flutter/screens/patients/profile/profile_screen/profile_gird_for_search.dart';
import 'package:doctor_app_flutter/util/NotificationPermissionUtils.dart';
import 'package:doctor_app_flutter/util/helpers.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart';
@ -19,6 +22,7 @@ import 'package:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart';
import 'package:quiver/async.dart';
import '../../../../locator.dart';
import '../../../../routes.dart';
class PatientProfileScreen extends StatefulWidget {
@ -293,46 +297,48 @@ class _PatientProfileScreenState extends State<PatientProfileScreen> with Single
: TranslationBase.of(context).initiateCall,
disabled: isCallStarted || model.state == ViewState.BusyLocal,
onPressed: () async {
if (isCallFinished) {
Navigator.push(
context,
MaterialPageRoute(
builder: (BuildContext context) =>
EndCallScreen(patient: patient)));
} else {
GifLoaderDialogUtils.showMyDialog(context);
await model.startCall(
isReCall: false, vCID: patient.vcId);
model.updateInCallPatient(
patient: patient,
appointmentNo: 0 );
setState(() {
patient.episodeNo = 0 ;
patient.appointmentNo = 0;
});
// Navigator.push(context, MaterialPageRoute(
// builder: (BuildContext context) =>
// EndCallScreen(patient:patient)));
// if (isCallFinished) {
// Navigator.push(
// context,
// MaterialPageRoute(
// builder: (BuildContext context) => EndCallScreen(patient: patient)));
// } else {
// GifLoaderDialogUtils.showMyDialog(context);
// await model.startCall(isReCall: false, vCID: patient.vcId);
//
// if (model.state == ViewState.ErrorLocal) {
// GifLoaderDialogUtils.hideDialog(context);
// Helpers.showErrorToast(model.error);
// } else {
// await model.getDoctorProfile();
// patient.appointmentNo = int.parse(model.startCallRes.appointmentNo.toString());
// patient.episodeNo = 0;
// setState(() {
// isCallStarted = true;
// });
// GifLoaderDialogUtils.hideDialog(context);
// AppPermissionsUtils.requestVideoCallPermission(
// context: context,
// onTapGrant: () {
// locator<VideoCallService>()
// .openVideo(model.startCallRes, patient, callConnected, callDisconnected);
// });
// }
// }
if (model.state == ViewState.ErrorLocal) {
GifLoaderDialogUtils.hideDialog(context);
Helpers.showErrorToast(model.error);
} else {
await model.getDoctorProfile();
patient.appointmentNo = int.parse(model
.startCallRes.appointmentNo
.toString());
patient.episodeNo = 0;
model.updateInCallPatient(
patient: patient,
appointmentNo: int.parse(model
.startCallRes.appointmentNo
.toString()));
setState(() {
isCallStarted = true;
});
GifLoaderDialogUtils.hideDialog(context);
AppPermissionsUtils
.requestVideoCallPermission(
context: context,
onTapGrant: () {
locator<VideoCallService>()
.openVideo(
model.startCallRes,
patient,
callConnected,
callDisconnected);
});
}
}
},
),
),

Loading…
Cancel
Save