merge-requests/689/head
mosazaid 5 years ago
parent ac460f1d19
commit 8b2c7f1a05

@ -42,4 +42,20 @@ class LiveCarePatientServices extends BaseService{
}, body: endCallReq.toJson()); }, body: endCallReq.toJson());
} }
Future endCallWithCharge(int vcID) async{
hasError = false;
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,
},
);
}
} }

@ -57,6 +57,19 @@ class LiveCarePatientViewModel extends BaseViewModel {
} }
} }
Future endCallWithCharge(int vcID) async {
setState(ViewState.BusyLocal);
await _liveCarePatientServices
.endCallWithCharge(vcID);
if (_liveCarePatientServices.hasError) {
error = _liveCarePatientServices.error;
setState(ViewState.ErrorLocal);
} else {
await getPendingPatientERForDoctorApp();
setState(ViewState.Idle);
}
}
searchData(String str) { searchData(String str) {
var strExist= str.length > 0 ? true : false; var strExist= str.length > 0 ? true : false;
if (strExist) { if (strExist) {

@ -1,6 +1,11 @@
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/icons_app/doctor_app_icons.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/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/screens/patients/profile/profile_screen/PatientProfileCardModel.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/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/PatientProfileButton.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/PatientProfileButton.dart';
@ -8,6 +13,7 @@ import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-head
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart'; import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';
import 'package:hexcolor/hexcolor.dart'; import 'package:hexcolor/hexcolor.dart';
@ -31,6 +37,8 @@ class _EndCallScreenState extends State<EndCallScreen> {
String from; String from;
String to; String to;
LiveCarePatientViewModel liveCareModel;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final List<PatientProfileCardModel> cardsList = [ final List<PatientProfileCardModel> cardsList = [
@ -46,13 +54,17 @@ class _EndCallScreenState extends State<EndCallScreen> {
'', '',
'patient/vital_signs.png', 'patient/vital_signs.png',
isInPatient: isInpatient, onTap: () { isInPatient: isInpatient, onTap: () {
Helpers.showConfirmationDialog( Helpers.showConfirmationDialog(context,
context,
"${TranslationBase.of(context).areYouSureYouWantTo} ${TranslationBase.of(context).endLC} ${TranslationBase.of(context).consultation} ?", "${TranslationBase.of(context).areYouSureYouWantTo} ${TranslationBase.of(context).endLC} ${TranslationBase.of(context).consultation} ?",
() { () async {
Navigator.of(context).pop(); Navigator.of(context).pop();
GifLoaderDialogUtils.showMyDialog(context);
}); liveCareModel.endCallWithCharge(0);
GifLoaderDialogUtils.hideDialog(context);
if (liveCareModel.state == ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(liveCareModel.error);
}
});
}, isDartIcon: true, dartIcon: DoctorApp.end_consultaion), }, isDartIcon: true, dartIcon: DoctorApp.end_consultaion),
PatientProfileCardModel( PatientProfileCardModel(
TranslationBase.of(context).sendLC, TranslationBase.of(context).sendLC,
@ -65,122 +77,133 @@ class _EndCallScreenState extends State<EndCallScreen> {
dartIcon: DoctorApp.send_instruction), dartIcon: DoctorApp.send_instruction),
PatientProfileCardModel(TranslationBase.of(context).transferTo, PatientProfileCardModel(TranslationBase.of(context).transferTo,
TranslationBase.of(context).admin, '', 'patient/health_summary.png', TranslationBase.of(context).admin, '', 'patient/health_summary.png',
onTap: () {}, onTap: () {
Navigator.push(context, MaterialPageRoute(
builder: (BuildContext context) =>
LivaCareTransferToAdmin(patient:widget.patient)));
},
isInPatient: isInpatient, isInPatient: isInpatient,
isDartIcon: true, isDartIcon: true,
dartIcon: DoctorApp.transfer_to_admin), dartIcon: DoctorApp.transfer_to_admin),
]; ];
return AppScaffold( return BaseView<LiveCarePatientViewModel>(
appBarTitle: TranslationBase.of(context).patientProfile, onModelReady: (model) {
backgroundColor: Theme.of(context).scaffoldBackgroundColor, liveCareModel = model;
isShowAppBar: true, },
appBar: PatientProfileHeaderNewDesignAppBar( builder: (_, model, w) => AppScaffold(
widget.patient, arrivalType ?? '7', '1', baseViewModel: model,
isInpatient: isInpatient, appBarTitle: TranslationBase.of(context).patientProfile,
height: (widget.patient.patientStatusType != null && backgroundColor: Theme.of(context).scaffoldBackgroundColor,
widget.patient.patientStatusType == 43) isShowAppBar: true,
? 210 appBar: PatientProfileHeaderNewDesignAppBar(
: isDischargedPatient widget.patient, arrivalType ?? '7', '1',
? 240 isInpatient: isInpatient,
: 0, height: (widget.patient.patientStatusType != null &&
isDischargedPatient: isDischargedPatient), widget.patient.patientStatusType == 43)
body: Container( ? 210
height: !isSearchAndOut : isDischargedPatient
? isDischargedPatient ? 240
? MediaQuery.of(context).size.height * 0.64 : 0,
: MediaQuery.of(context).size.height * 0.65 isDischargedPatient: isDischargedPatient),
: MediaQuery.of(context).size.height * 0.69, body: Container(
child: ListView( height: !isSearchAndOut
children: [ ? isDischargedPatient
Padding( ? MediaQuery.of(context).size.height * 0.64
padding: : MediaQuery.of(context).size.height * 0.65
const EdgeInsets.symmetric(vertical: 15.0, horizontal: 15), : MediaQuery.of(context).size.height * 0.69,
child: Column( child: ListView(
crossAxisAlignment: CrossAxisAlignment.start, children: [
children: [ Padding(
AppText( padding:
TranslationBase.of(context).patient, const EdgeInsets.symmetric(vertical: 15.0, horizontal: 15),
fontSize: 14, child: Column(
fontWeight: FontWeight.w500, crossAxisAlignment: CrossAxisAlignment.start,
), children: [
AppText( AppText(
TranslationBase.of(context).endcall, TranslationBase.of(context).patient,
fontSize: 26, fontSize: 14,
fontWeight: FontWeight.bold, fontWeight: FontWeight.w500,
),
SizedBox(
height: 10,
),
StaggeredGridView.countBuilder(
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
crossAxisSpacing: 10,
mainAxisSpacing: 10,
crossAxisCount: 3,
itemCount: cardsList.length,
staggeredTileBuilder: (int index) => StaggeredTile.fit(1),
itemBuilder: (BuildContext context, int index) =>
PatientProfileButton(
patient: widget.patient,
patientType: patientType,
arrivalType: arrivalType,
from: from,
to: to,
nameLine1: cardsList[index].nameLine1,
nameLine2: cardsList[index].nameLine2,
route: cardsList[index].route,
icon: cardsList[index].icon,
isInPatient: cardsList[index].isInPatient,
isDischargedPatient: cardsList[index].isDischargedPatient,
isDisable: cardsList[index].isDisable,
onTap: cardsList[index].onTap,
isLoading: cardsList[index].isLoading,
isDartIcon: cardsList[index].isDartIcon,
dartIcon: cardsList[index].dartIcon,
), ),
), AppText(
], TranslationBase.of(context).endcall,
fontSize: 26,
fontWeight: FontWeight.bold,
),
SizedBox(
height: 10,
),
StaggeredGridView.countBuilder(
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
crossAxisSpacing: 10,
mainAxisSpacing: 10,
crossAxisCount: 3,
itemCount: cardsList.length,
staggeredTileBuilder: (int index) => StaggeredTile.fit(1),
itemBuilder: (BuildContext context, int index) =>
PatientProfileButton(
patient: widget.patient,
patientType: patientType,
arrivalType: arrivalType,
from: from,
to: to,
nameLine1: cardsList[index].nameLine1,
nameLine2: cardsList[index].nameLine2,
route: cardsList[index].route,
icon: cardsList[index].icon,
isInPatient: cardsList[index].isInPatient,
isDischargedPatient:
cardsList[index].isDischargedPatient,
isDisable: cardsList[index].isDisable,
onTap: cardsList[index].onTap,
isLoading: cardsList[index].isLoading,
isDartIcon: cardsList[index].isDartIcon,
dartIcon: cardsList[index].dartIcon,
),
),
],
),
), ),
), SizedBox(
SizedBox( height: MediaQuery.of(context).size.height * 0.05,
height: MediaQuery.of(context).size.height * 0.05, )
) ],
],
),
),
bottomSheet: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(0.0),
), ),
border: Border.all(color: HexColor('#707070'), width: 0),
), ),
height: MediaQuery.of(context).size.height * 0.1, bottomSheet: Container(
width: double.infinity, decoration: BoxDecoration(
child: Column( color: Colors.white,
children: [ borderRadius: BorderRadius.all(
SizedBox( Radius.circular(0.0),
height: 10,
), ),
Container( border: Border.all(color: HexColor('#707070'), width: 0),
child: FractionallySizedBox( ),
widthFactor: .80, height: MediaQuery.of(context).size.height * 0.1,
child: Center( width: double.infinity,
child: AppButton( child: Column(
fontWeight: FontWeight.w700, children: [
color: Colors.red[600], SizedBox(
title: "Close", //TranslationBase.of(context).close, height: 10,
onPressed: () async {}, ),
Container(
child: FractionallySizedBox(
widthFactor: .80,
child: Center(
child: AppButton(
fontWeight: FontWeight.w700,
color: Colors.red[600],
title: "Close", //TranslationBase.of(context).close,
onPressed: () async {},
),
), ),
), ),
), ),
), SizedBox(
SizedBox( height: 5,
height: 5, ),
), ],
], ),
), ),
), ),
); );

@ -1,10 +1,11 @@
import 'dart:html';
import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/core/provider/robot_provider.dart'; import 'package:doctor_app_flutter/core/provider/robot_provider.dart';
import 'package:doctor_app_flutter/core/viewModel/LiveCarePatientViewModel.dart';
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.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/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/speech-text-popup.dart'; import 'package:doctor_app_flutter/widgets/shared/speech-text-popup.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:permission_handler/permission_handler.dart'; import 'package:permission_handler/permission_handler.dart';
@ -13,17 +14,16 @@ import 'package:speech_to_text/speech_recognition_error.dart';
import 'package:speech_to_text/speech_to_text.dart' as stt; import 'package:speech_to_text/speech_to_text.dart' as stt;
class LivaCareTransferToAdmin extends StatefulWidget { class LivaCareTransferToAdmin extends StatefulWidget {
final PatiantInformtion patient; final PatiantInformtion patient;
const LivaCareTransferToAdmin({Key key, this.patient}) : super(key: key); const LivaCareTransferToAdmin({Key key, this.patient}) : super(key: key);
@override @override
_LivaCareTransferToAdminState createState() => _LivaCareTransferToAdminState(); _LivaCareTransferToAdminState createState() =>
_LivaCareTransferToAdminState();
} }
class _LivaCareTransferToAdminState extends State<LivaCareTransferToAdmin> { class _LivaCareTransferToAdminState extends State<LivaCareTransferToAdmin> {
stt.SpeechToText speech = stt.SpeechToText(); stt.SpeechToText speech = stt.SpeechToText();
var reconizedWord; var reconizedWord;
var event = RobotProvider(); var event = RobotProvider();
@ -47,8 +47,15 @@ class _LivaCareTransferToAdminState extends State<LivaCareTransferToAdmin> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
projectViewModel = Provider.of(context); projectViewModel = Provider.of(context);
return Container( return BaseView<LiveCarePatientViewModel>(
onModelReady: (model) {},
builder: (_, model, w) => AppScaffold(
baseViewModel: model,
appBarTitle: "${TranslationBase.of(context).transferTo}${TranslationBase.of(context).admin}",
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
isShowAppBar: true,
body: Container(),
),
); );
} }

@ -277,13 +277,13 @@ class _PatientProfileScreenState extends State<PatientProfileScreen>
.of(context) .of(context)
.initiateCall, .initiateCall,
onPressed: () async { onPressed: () async {
if(model.isFinished) { // if(model.isFinished) {
Navigator.push(context, MaterialPageRoute( Navigator.push(context, MaterialPageRoute(
builder: (BuildContext context) => builder: (BuildContext context) =>
EndCallScreen(patient:patient))); EndCallScreen(patient:patient)));
} else { // } else {
// TODO Call initiateCall service // // TODO Call initiateCall service
} // }
}, },
), ),

Loading…
Cancel
Save