finalize create episode on Live care.

merge-requests/758/head
Elham Rababah 5 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'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
class LiveCarePatientServices extends BaseService { class LiveCarePatientServices extends BaseService {
// List<PatiantInformtion> _patientList = []; List<PatiantInformtion> _patientList = [];
List<PatiantInformtion> patientList = []; List<PatiantInformtion> get patientList => _patientList;
List<AlternativeService> alternativeServicesList = []; List<AlternativeService> alternativeServicesList = [];
@ -36,145 +36,41 @@ class LiveCarePatientServices extends BaseService {
Future getPendingPatientERForDoctorApp( Future getPendingPatientERForDoctorApp(
PendingPatientERForDoctorAppRequestModel PendingPatientERForDoctorAppRequestModel
pendingPatientERForDoctorAppRequestModel, {bool isSecondTime = false }) async { pendingPatientERForDoctorAppRequestModel) async {
hasError = false; hasError = false;
await baseAppClient.post( await baseAppClient.post(
GET_PENDING_PATIENT_ER_FOR_DOCTOR_APP, GET_PENDING_PATIENT_ER_FOR_DOCTOR_APP,
onSuccess: (dynamic response, int statusCode) { onSuccess: (dynamic response, int statusCode) {
List<PatiantInformtion> localPatientList= []; List<PatiantInformtion> localPatientList= [];
localPatientList.clear(); localPatientList.clear();
response['List_PendingPatientList'].forEach((v) { response['List_PendingPatientList'].forEach((v) {
localPatientList.add(PatiantInformtion.fromJson(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. /// add new items.
localPatientList.forEach((element) { localPatientList.forEach((element) {
// if (!_patientList.contains(element)) { if ((_patientList.singleWhere((it) => it.patientId == element.patientId,
// _patientList.add(element);
// }
if ((patientList.singleWhere((it) => it.patientId == element.patientId,
orElse: () => null)) == null) { orElse: () => null)) == null) {
patientList.add(element); _patientList.add(element);
} }
}); });
print(patientList);
/// remove items. /// remove items.
patientList.forEach((element) { List<PatiantInformtion> removedPatientList= [];
// if (!localPatientList.contains(element)) { removedPatientList.clear();
// _patientList.remove(element); _patientList.forEach((element) {
// }
if ((localPatientList.singleWhere((it) => it.patientId == element.patientId, if ((localPatientList.singleWhere((it) => it.patientId == element.patientId,
orElse: () => null)) == null) { orElse: () => null)) == null) {
patientList.remove(element); removedPatientList.add(element);
} }
}); });
print(patientList);
removedPatientList.forEach((element) {
_patientList.remove(element);
});
}, },
onFailure: (String error, int statusCode) { onFailure: (String error, int statusCode) {
hasError = true; hasError = true;

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

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

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

Loading…
Cancel
Save