fix live care issues

merge-requests/693/head
Mohammad Aljammal 5 years ago
parent ccdd6696be
commit ac701c9806

@ -328,4 +328,4 @@ SPEC CHECKSUMS:
PODFILE CHECKSUM: 649616dc336b3659ac6b2b25159d8e488e042b69
COCOAPODS: 1.10.0.rc.1
COCOAPODS: 1.10.1

@ -982,7 +982,7 @@ const Map<String, Map<String, String>> localizedValues = {
"medicalReportAdd": {"en": "Add Medical Report", "ar": "إضافة تقرير طبي"},
"medicalReportVerify": {"en": "Verify Medical Report", "ar": "تحقق من التقرير الطبي"},
"comments": {"en": "Comments", "ar": "تعليقات"},
"initiateCall ": {"en": "Initiate Call ", "ar": "بدء الاتصال"},
"initiateCall": {"en": "Initiate Call ", "ar": "بدء الاتصال"},
"transferTo": {"en": "Transfer To ", "ar": "حول إلى"},
"admin": {"en": "Admin", "ar": "مشرف"},
"instructions": {"en": "Instructions", "ar": "تعليمات"},
@ -996,6 +996,6 @@ const Map<String, Map<String, String>> localizedValues = {
"laboratoryPhysicalData": {"en": "Laboratory and Physical Data", "ar": "المعامل والبيانات الفيزيائية"},
"impressionRecommendation": {"en": "Impression and Recommendation", "ar": "الانطباع والتوصية"},
"onHold": {"en": "'On Hold'", "ar": "قيد الانتظار"},
"verified": {"en": "'Verified'", "ar": "Verified"},
"endCall": {"en": "'End'", "ar": "انهاء"},
"verified": {"en": "Verified", "ar": "Verified"},
"endCall": {"en": "End Call", "ar": "انهاء"},
};

@ -15,6 +15,10 @@ class LiveCarePatientServices extends BaseService {
bool get isFinished => _isFinished;
setFinished(bool isFinished){
_isFinished = isFinished;
}
var endCallResponse = {};
var transferToAdminResponse = {};
@ -43,10 +47,10 @@ class LiveCarePatientServices extends BaseService {
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());
@ -74,7 +78,7 @@ class LiveCarePatientServices extends BaseService {
super.error = error;
},
body: {
"VC_ID": vcID,
"VC_ID": vcID,"generalid":"Cs2020@2016\$2958",
},
);
}

@ -1,3 +1,4 @@
import 'package:doctor_app_flutter/config/shared_pref_kay.dart';
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';
@ -16,7 +17,7 @@ class LiveCarePatientViewModel extends BaseViewModel {
LiveCarePatientServices _liveCarePatientServices =
locator<LiveCarePatientServices>();
bool get isFinished => _liveCarePatientServices.isFinished;
StartCallRes get startCallRes => _liveCarePatientServices.startCallRes;
DashboardService _dashboardService =
@ -39,12 +40,12 @@ class LiveCarePatientViewModel extends BaseViewModel {
}
}
Future endCall(request, isPatient, doctorID) async {
Future endCall(int vCID, bool isPatient) async {
await getDoctorProfile(isGetProfile: true);
EndCallReq endCallReq = new EndCallReq();
endCallReq.doctorId = doctorID; //profile["DoctorID"];
endCallReq.doctorId = doctorProfile.doctorID;
endCallReq.generalid = 'Cs2020@2016\$2958';
endCallReq.vCID = request.vCID; //["VC_ID"];
endCallReq.vCID = vCID;
endCallReq.isDestroy = isPatient;
setState(ViewState.BusyLocal);
@ -58,6 +59,10 @@ class LiveCarePatientViewModel extends BaseViewModel {
}
}
getToken()async{
String token = await sharedPref.getString(TOKEN);
return token;
}
Future startCall({int vCID, bool isReCall}) async {
StartCallReq startCallReq = new StartCallReq();
@ -74,8 +79,7 @@ class LiveCarePatientViewModel extends BaseViewModel {
startCallReq.generalid = 'Cs2020@2016\$2958';
setState(ViewState.BusyLocal);
await _liveCarePatientServices
.startCall(startCallReq);
await _liveCarePatientServices.startCall(startCallReq);
if (_liveCarePatientServices.hasError) {
error = _liveCarePatientServices.error;
setState(ViewState.ErrorLocal);

@ -1,10 +1,13 @@
import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/viewModel/LiveCarePatientViewModel.dart';
import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart';
import 'package:doctor_app_flutter/models/livecare/session_status_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/live_care/live-care_transfer_to_admin.dart';
import 'package:doctor_app_flutter/screens/patients/profile/profile_screen/PatientProfileCardModel.dart';
import 'package:doctor_app_flutter/util/VideoChannel.dart';
import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart';
import 'package:doctor_app_flutter/util/helpers.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
@ -44,10 +47,51 @@ class _EndCallScreenState extends State<EndCallScreen> {
final List<PatientProfileCardModel> cardsList = [
PatientProfileCardModel(TranslationBase.of(context).resume,
TranslationBase.of(context).theCall, '', 'patient/vital_signs.png',
isInPatient: isInpatient,
onTap: () {},
isDartIcon: true,
dartIcon: DoctorApp.call),
isInPatient: isInpatient, onTap: () async {
GifLoaderDialogUtils.showMyDialog(context);
await liveCareModel
.startCall(isReCall: false, vCID: widget.patient.vcId)
.then((value) async{
await liveCareModel.getDoctorProfile();
GifLoaderDialogUtils.hideDialog(context);
if (liveCareModel.state == ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(liveCareModel.error);
}else
await VideoChannel.openVideoCallScreen(
kToken: liveCareModel.startCallRes.openTokenID,
kSessionId: liveCareModel.startCallRes.openSessionID,
kApiKey: '46209962',
vcId: widget.patient.vcId,
tokenID: await liveCareModel.getToken(),
generalId: GENERAL_ID,
doctorId: liveCareModel.doctorProfile.doctorID,
onFailure: (String error) {
DrAppToastMsg.showErrorToast(error);
},
onCallEnd: () async{
GifLoaderDialogUtils.showMyDialog(context);
GifLoaderDialogUtils.showMyDialog(context);
await liveCareModel.endCall(widget.patient.vcId, false,);
GifLoaderDialogUtils.hideDialog(context);
if (liveCareModel.state == ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(liveCareModel.error);
}
},
onCallNotRespond: (SessionStatusModel sessionStatusModel) async{
GifLoaderDialogUtils.showMyDialog(context);
GifLoaderDialogUtils.showMyDialog(context);
await liveCareModel.endCall(widget.patient.vcId, sessionStatusModel.sessionStatus == 3,);
GifLoaderDialogUtils.hideDialog(context);
if (liveCareModel.state == ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(liveCareModel.error);
}
});
});
GifLoaderDialogUtils.hideDialog(context);
if (liveCareModel.state == ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(liveCareModel.error);
}
}, isDartIcon: true, dartIcon: DoctorApp.call),
PatientProfileCardModel(
TranslationBase.of(context).endLC,
TranslationBase.of(context).consultation,
@ -59,7 +103,7 @@ class _EndCallScreenState extends State<EndCallScreen> {
() async {
Navigator.of(context).pop();
GifLoaderDialogUtils.showMyDialog(context);
liveCareModel.endCallWithCharge(widget.patient.vcId);
await liveCareModel.endCallWithCharge(widget.patient.vcId);
GifLoaderDialogUtils.hideDialog(context);
if (liveCareModel.state == ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(liveCareModel.error);
@ -77,14 +121,19 @@ class _EndCallScreenState extends State<EndCallScreen> {
onTap: () {},
isInPatient: isInpatient,
isDartIcon: true,
isDisable: true,
dartIcon: DoctorApp.send_instruction),
PatientProfileCardModel(TranslationBase.of(context).transferTo,
TranslationBase.of(context).admin, '', 'patient/health_summary.png',
onTap: () {
Navigator.push(context, MaterialPageRoute(
PatientProfileCardModel(
TranslationBase.of(context).transferTo,
TranslationBase.of(context).admin,
'',
'patient/health_summary.png', onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (BuildContext context) =>
LivaCareTransferToAdmin(patient:widget.patient)));
},
LivaCareTransferToAdmin(patient: widget.patient)));
},
isInPatient: isInpatient,
isDartIcon: true,
dartIcon: DoctorApp.transfer_to_admin),
@ -197,7 +246,9 @@ class _EndCallScreenState extends State<EndCallScreen> {
fontWeight: FontWeight.w700,
color: Colors.red[600],
title: "Close", //TranslationBase.of(context).close,
onPressed: () async {},
onPressed: () {
Navigator.of(context).pop();
},
),
),
),

@ -1,15 +1,17 @@
import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/core/enum/viewstate.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/patient_view_model.dart';
import 'package:doctor_app_flutter/models/SOAP/PostEpisodeReqModel.dart';
import 'package:doctor_app_flutter/models/livecare/session_status_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/live_care/end_call_screen.dart';
import 'package:doctor_app_flutter/screens/live_care/video_call.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/VideoChannel.dart';
import 'package:doctor_app_flutter/util/dr_app_toast_msg.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';
@ -34,7 +36,7 @@ class _PatientProfileScreenState extends State<PatientProfileScreen>
bool isFromLiveCare = false;
bool isInpatient = false;
bool isCallFinished = false;
bool isDischargedPatient = false;
bool isSearchAndOut = false;
String patientType;
@ -275,15 +277,13 @@ class _PatientProfileScreenState extends State<PatientProfileScreen>
child: Center(
child: AppButton(
fontWeight: FontWeight.w700,
color: model.isFinished?Colors.red[600]:Colors.green[600],
title: model.isFinished?TranslationBase
.of(context)
.endCall:TranslationBase
.of(context)
.initiateCall,
color: isCallFinished?Colors.red[600]:Colors.green[600],
title: isCallFinished?
TranslationBase.of(context).endCall:
TranslationBase.of(context).initiateCall,
disabled: model.state == ViewState.BusyLocal,
onPressed: () async {
if(model.isFinished) {
if(isCallFinished) {
Navigator.push(context, MaterialPageRoute(
builder: (BuildContext context) =>
EndCallScreen(patient:patient)));
@ -291,14 +291,51 @@ class _PatientProfileScreenState extends State<PatientProfileScreen>
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();
GifLoaderDialogUtils.hideDialog(context);
Navigator.push(context, MaterialPageRoute(
builder: (BuildContext context) =>
VideoCallPage(patientData: patient,listContext: "dfd",model: model,)));
await VideoChannel.openVideoCallScreen(
kToken: model.startCallRes.openTokenID,
kSessionId: model.startCallRes.openSessionID,
kApiKey: '46209962',
vcId: patient.vcId,
tokenID: await model.getToken(),
generalId: GENERAL_ID,
doctorId: model.doctorProfile.doctorID,
onFailure: (String error) {
DrAppToastMsg.showErrorToast(error);
},
onCallEnd: () {
WidgetsBinding.instance.addPostFrameCallback((_) {
GifLoaderDialogUtils.showMyDialog(context);
model.endCall(patient.vcId, false,).then((value) {
GifLoaderDialogUtils.hideDialog(context);
if (model.state == ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(model.error);
}
setState(() {
isCallFinished = true;
});
});
});
},
onCallNotRespond: (SessionStatusModel sessionStatusModel) {
WidgetsBinding.instance.addPostFrameCallback((_) {
GifLoaderDialogUtils.showMyDialog(context);
model.endCall(patient.vcId, sessionStatusModel.sessionStatus == 3,).then((value) {
GifLoaderDialogUtils.hideDialog(context);
if (model.state == ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(model.error);
}
setState(() {
isCallFinished = true;
});
});
});
});
}
}

@ -1338,8 +1338,8 @@ class TranslationBase {
String get medicalReportAdd => localizedValues['medicalReportAdd'][locale.languageCode];
String get medicalReportVerify => localizedValues['medicalReportVerify'][locale.languageCode];
String get comments => localizedValues['comments'][locale.languageCode];
String get initiateCall => localizedValues['initiateCall '][locale.languageCode];
String get endCall => localizedValues['endCall '][locale.languageCode];
String get initiateCall => localizedValues['initiateCall'][locale.languageCode];
String get endCall => localizedValues['endCall'][locale.languageCode];
String get transferTo => localizedValues['transferTo'][locale.languageCode];
String get admin => localizedValues['admin'][locale.languageCode];

Loading…
Cancel
Save