|
|
|
|
@ -1,18 +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/core/viewModel/SOAP_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/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';
|
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
|
|
|
|
|
@ -156,51 +151,57 @@ class _PatientProfileScreenState extends State<PatientProfileScreen>
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: MediaQuery.of(context).size.height * 0.05,
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
if (patient.patientStatusType != null &&
|
|
|
|
|
patient.patientStatusType == 43)
|
|
|
|
|
BaseView<SOAPViewModel>(
|
|
|
|
|
onModelReady: (model) async {},
|
|
|
|
|
builder: (_, model, w) => Positioned(
|
|
|
|
|
top: 180,
|
|
|
|
|
left: 20,
|
|
|
|
|
right: 20,
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(child: Container()),
|
|
|
|
|
if (patient.episodeNo == 0)
|
|
|
|
|
AppButton(
|
|
|
|
|
title:
|
|
|
|
|
"${TranslationBase.of(context).createNew}\n${TranslationBase.of(context).episode}",
|
|
|
|
|
color: patient.patientStatusType == 43
|
|
|
|
|
? Colors.red.shade700
|
|
|
|
|
: Colors.grey.shade700,
|
|
|
|
|
fontColor: Colors.white,
|
|
|
|
|
vPadding: 8,
|
|
|
|
|
radius: 30,
|
|
|
|
|
hPadding: 20,
|
|
|
|
|
fontWeight: FontWeight.normal,
|
|
|
|
|
fontSize: 1.6,
|
|
|
|
|
icon: Image.asset(
|
|
|
|
|
"assets/images/create-episod.png",
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
if (isFromLiveCare
|
|
|
|
|
? patient.episodeNo != null
|
|
|
|
|
: patient.patientStatusType != null &&
|
|
|
|
|
patient.patientStatusType == 43)
|
|
|
|
|
BaseView<SOAPViewModel>(
|
|
|
|
|
onModelReady: (model) async {},
|
|
|
|
|
builder: (_, model, w) => Positioned(
|
|
|
|
|
top: 180,
|
|
|
|
|
left: 20,
|
|
|
|
|
right: 20,
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(child: Container()),
|
|
|
|
|
if (patient.episodeNo == 0)
|
|
|
|
|
AppButton(
|
|
|
|
|
title:
|
|
|
|
|
"${TranslationBase.of(context).createNew}\n${TranslationBase.of(context).episode}",
|
|
|
|
|
color: isFromLiveCare
|
|
|
|
|
? Colors.red.shade700
|
|
|
|
|
: patient.patientStatusType == 43
|
|
|
|
|
? Colors.red.shade700
|
|
|
|
|
: Colors.grey.shade700,
|
|
|
|
|
fontColor: Colors.white,
|
|
|
|
|
vPadding: 8,
|
|
|
|
|
radius: 30,
|
|
|
|
|
hPadding: 20,
|
|
|
|
|
fontWeight: FontWeight.normal,
|
|
|
|
|
fontSize: 1.6,
|
|
|
|
|
icon: Image.asset(
|
|
|
|
|
"assets/images/create-episod.png",
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
height: 30,
|
|
|
|
|
),
|
|
|
|
|
onPressed: () async {
|
|
|
|
|
if (patient.patientStatusType ==
|
|
|
|
|
43) {
|
|
|
|
|
if ((isFromLiveCare &&
|
|
|
|
|
patient.appointmentNo != null &&
|
|
|
|
|
patient.appointmentNo != 0) ||
|
|
|
|
|
patient.patientStatusType ==
|
|
|
|
|
43) {
|
|
|
|
|
PostEpisodeReqModel
|
|
|
|
|
postEpisodeReqModel =
|
|
|
|
|
PostEpisodeReqModel(
|
|
|
|
|
appointmentNo:
|
|
|
|
|
patient.appointmentNo,
|
|
|
|
|
patientMRN:
|
|
|
|
|
patient.patientMRN);
|
|
|
|
|
postEpisodeReqModel =
|
|
|
|
|
PostEpisodeReqModel(
|
|
|
|
|
appointmentNo:
|
|
|
|
|
patient.appointmentNo,
|
|
|
|
|
patientMRN:
|
|
|
|
|
patient.patientMRN);
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(
|
|
|
|
|
context);
|
|
|
|
|
await model.postEpisode(
|
|
|
|
|
@ -220,11 +221,18 @@ class _PatientProfileScreenState extends State<PatientProfileScreen>
|
|
|
|
|
if (patient.episodeNo != 0)
|
|
|
|
|
AppButton(
|
|
|
|
|
title:
|
|
|
|
|
"${TranslationBase.of(context).update}\n${TranslationBase.of(context).episode}",
|
|
|
|
|
"${TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.update}\n${TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.episode}",
|
|
|
|
|
color:
|
|
|
|
|
patient.patientStatusType == 43
|
|
|
|
|
? Colors.red.shade700
|
|
|
|
|
: Colors.grey.shade700,
|
|
|
|
|
isFromLiveCare
|
|
|
|
|
? Colors.red.shade700
|
|
|
|
|
: patient.patientStatusType ==
|
|
|
|
|
43
|
|
|
|
|
? Colors.red.shade700
|
|
|
|
|
: Colors.grey.shade700,
|
|
|
|
|
fontColor: Colors.white,
|
|
|
|
|
vPadding: 8,
|
|
|
|
|
radius: 30,
|
|
|
|
|
@ -237,8 +245,12 @@ class _PatientProfileScreenState extends State<PatientProfileScreen>
|
|
|
|
|
height: 30,
|
|
|
|
|
),
|
|
|
|
|
onPressed: () {
|
|
|
|
|
if (patient.patientStatusType ==
|
|
|
|
|
43) {
|
|
|
|
|
if ((isFromLiveCare &&
|
|
|
|
|
patient.appointmentNo !=
|
|
|
|
|
null &&
|
|
|
|
|
patient.appointmentNo != 0) ||
|
|
|
|
|
patient.patientStatusType ==
|
|
|
|
|
43) {
|
|
|
|
|
Navigator.of(context).pushNamed(
|
|
|
|
|
UPDATE_EPISODE,
|
|
|
|
|
arguments: {
|
|
|
|
|
@ -283,65 +295,70 @@ class _PatientProfileScreenState extends State<PatientProfileScreen>
|
|
|
|
|
TranslationBase.of(context).initiateCall,
|
|
|
|
|
disabled: 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);
|
|
|
|
|
|
|
|
|
|
if(model.state == ViewState.ErrorLocal) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
Helpers.showErrorToast(model.error);
|
|
|
|
|
} else {
|
|
|
|
|
await model.getDoctorProfile();
|
|
|
|
|
patient.appointmentNo = model.startCallRes.appointmentNo;
|
|
|
|
|
patient.episodeNo = 0;
|
|
|
|
|
Navigator.push(context, MaterialPageRoute(
|
|
|
|
|
builder: (BuildContext context) =>
|
|
|
|
|
EndCallScreen(patient:patient)));
|
|
|
|
|
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
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;
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// 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 = model.startCallRes.appointmentNo;
|
|
|
|
|
// patient.episodeNo = 0;
|
|
|
|
|
//
|
|
|
|
|
// GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
// 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;
|
|
|
|
|
// });
|
|
|
|
|
// });
|
|
|
|
|
//
|
|
|
|
|
// });
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
|