Merge branches 'development' and 'live_care_patient' of https://gitlab.com/Cloud_Solution/doctor_app_flutter into live_care_patient

 Conflicts:
	lib/core/service/patient/LiveCarePatientServices.dart
	lib/core/viewModel/LiveCarePatientViewModel.dart
	lib/screens/patients/profile/profile_screen/patient_profile_screen.dart
merge-requests/690/head
Elham Rababah 5 years ago
commit fdc23ce932

@ -48,8 +48,8 @@ class BaseAppClient {
if (body['EditedBy'] == '') { if (body['EditedBy'] == '') {
body.remove("EditedBy"); body.remove("EditedBy");
} }
body['TokenID'] = "@dm!n";// token ?? ''; body['TokenID'] = token ?? '';
// body['TokenID'] = "@dm!n" ?? ''; // body['TokenID'] = "@dm!n" ?? '';
String lang = await sharedPref.getString(APP_Language); String lang = await sharedPref.getString(APP_Language);
if (lang != null && lang == 'ar') if (lang != null && lang == 'ar')
body['LanguageID'] = 1; body['LanguageID'] = 1;

@ -297,9 +297,11 @@ const GET_PROCEDURE_TEMPLETE =
const GET_PROCEDURE_TEMPLETE_DETAILS = const GET_PROCEDURE_TEMPLETE_DETAILS =
"Services/Doctors.svc/REST/DAPP_ProcedureTemplateDetailsGet"; "Services/Doctors.svc/REST/DAPP_ProcedureTemplateDetailsGet";
const GET_PENDING_PATIENT_ER_FOR_DOCTOR_APP ='Services/DoctorApplication.svc/REST/GetPendingPatientERForDoctorApp'; const GET_PENDING_PATIENT_ER_FOR_DOCTOR_APP =
'Services/DoctorApplication.svc/REST/GetPendingPatientERForDoctorApp';
const DOCTOR_CHECK_HAS_LIVE_CARE = "Services/DoctorApplication.svc/REST/CheckDoctorHasLiveCare"; const DOCTOR_CHECK_HAS_LIVE_CARE =
"Services/DoctorApplication.svc/REST/CheckDoctorHasLiveCare";
var selectedPatientType = 1; var selectedPatientType = 1;

@ -1,6 +1,7 @@
const Map<String, Map<String, String>> localizedValues = { const Map<String, Map<String, String>> localizedValues = {
'dashboardScreenToolbarTitle': {'ar': 'الرئيسة', 'en': 'Home'}, 'dashboardScreenToolbarTitle': {'ar': 'الرئيسة', 'en': 'Home'},
'settings': {'en': 'Settings', 'ar': 'الاعدادات'}, 'settings': {'en': 'Settings', 'ar': 'الاعدادات'},
'areYouSureYouWantTo': {'en': 'Are you sure you want to', 'ar': 'هل انت متاكد من انك تريد أن'},
'language': {'en': 'App Language', 'ar': 'لغة التطبيق'}, 'language': {'en': 'App Language', 'ar': 'لغة التطبيق'},
'lanEnglish': {'en': 'English', 'ar': 'English'}, 'lanEnglish': {'en': 'English', 'ar': 'English'},
'lanArabic': {'en': 'العربية', 'ar': 'العربية'}, 'lanArabic': {'en': 'العربية', 'ar': 'العربية'},

@ -53,6 +53,7 @@ class EntityList {
String remarks; String remarks;
String status; String status;
String template; String template;
int doctorID;
EntityList( EntityList(
{this.achiCode, {this.achiCode,
@ -78,10 +79,12 @@ class EntityList {
this.procedureName, this.procedureName,
this.remarks, this.remarks,
this.status, this.status,
this.template}); this.template,
this.doctorID});
EntityList.fromJson(Map<String, dynamic> json) { EntityList.fromJson(Map<String, dynamic> json) {
achiCode = json['achiCode']; achiCode = json['achiCode'];
doctorID = json['doctorID'];
appointmentDate = json['appointmentDate']; appointmentDate = json['appointmentDate'];
appointmentNo = json['appointmentNo']; appointmentNo = json['appointmentNo'];
categoryID = json['categoryID']; categoryID = json['categoryID'];
@ -110,6 +113,7 @@ class EntityList {
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>(); final Map<String, dynamic> data = new Map<String, dynamic>();
data['achiCode'] = this.achiCode; data['achiCode'] = this.achiCode;
data['doctorID'] = this.doctorID;
data['appointmentDate'] = this.appointmentDate; data['appointmentDate'] = this.appointmentDate;
data['appointmentNo'] = this.appointmentNo; data['appointmentNo'] = this.appointmentNo;
data['categoryID'] = this.categoryID; data['categoryID'] = this.categoryID;

@ -17,6 +17,7 @@ class LiveCarePatientServices extends BaseService {
var endCallResponse = {}; var endCallResponse = {};
var transferToAdminResponse = {};
StartCallRes _startCallRes; StartCallRes _startCallRes;
StartCallRes get startCallRes => _startCallRes; StartCallRes get startCallRes => _startCallRes;
@ -61,4 +62,39 @@ class LiveCarePatientServices extends BaseService {
super.error = error; super.error = error;
}, body: startCallReq.toJson()); }, body: startCallReq.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,
},
);
}
Future transferToAdmin(int vcID, String notes) async{
hasError = false;
await baseAppClient.post(
TRANSFERT_TO_ADMIN,
onSuccess: (dynamic response, int statusCode) {
transferToAdminResponse = response;
},
onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
},
body: {
"VC_ID": vcID,
"IsOutKsa": false,
"Notes": notes,
},
);
}
} }

@ -11,8 +11,6 @@ class PatientMedicalReportService extends BaseService {
Future getMedicalReportList(PatiantInformtion patient) async { Future getMedicalReportList(PatiantInformtion patient) async {
hasError = false; hasError = false;
Map<String, dynamic> body = Map(); Map<String, dynamic> body = Map();
// body['TokenID'] = "@dm!n";
body['SetupID'] = "91877";
body['AdmissionNo'] = patient.admissionNo; body['AdmissionNo'] = patient.admissionNo;
await baseAppClient.postPatient(PATIENT_MEDICAL_REPORT_GET_LIST, await baseAppClient.postPatient(PATIENT_MEDICAL_REPORT_GET_LIST,

@ -84,6 +84,32 @@ 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);
}
}
Future transferToAdmin(int vcID, String notes) async {
setState(ViewState.BusyLocal);
await _liveCarePatientServices
.transferToAdmin(vcID, notes);
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) {

@ -421,8 +421,9 @@ class AuthenticationViewModel extends BaseViewModel {
doctorProfile = null; doctorProfile = null;
sharedPref.setString(APP_Language, lang); sharedPref.setString(APP_Language, lang);
deleteUser(); deleteUser();
await getDeviceInfoFromFirebase(); await getDeviceInfoFromFirebase();
this.isFromLogin = isFromLogin; this.isFromLogin = isFromLogin;
setState(ViewState.Idle);
Navigator.pushAndRemoveUntil( Navigator.pushAndRemoveUntil(
AppGlobal.CONTEX, AppGlobal.CONTEX,
FadePage( FadePage(

@ -7,7 +7,7 @@ class DoctorProfileModel {
Null clinicDescriptionN; Null clinicDescriptionN;
Null licenseExpiry; Null licenseExpiry;
int employmentType; int employmentType;
Null setupID; dynamic setupID;
int projectID; int projectID;
String projectName; String projectName;
String nationalityID; String nationalityID;

@ -1,12 +1,19 @@
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/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';
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';
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';
@ -30,23 +37,38 @@ 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 = [
PatientProfileCardModel(TranslationBase.of(context).resume, PatientProfileCardModel(TranslationBase.of(context).resume,
TranslationBase.of(context).theCall, '', 'patient/vital_signs.png', TranslationBase.of(context).theCall, '', 'patient/vital_signs.png',
isInPatient: isInpatient, onTap: () {}, isDartIcon: true, isInPatient: isInpatient,
onTap: () {},
isDartIcon: true,
dartIcon: DoctorApp.call), dartIcon: DoctorApp.call),
PatientProfileCardModel( PatientProfileCardModel(
TranslationBase.of(context).endLC, TranslationBase.of(context).endLC,
TranslationBase.of(context).consultation, TranslationBase.of(context).consultation,
'', '',
'patient/vital_signs.png', 'patient/vital_signs.png',
isInPatient: isInpatient, isInPatient: isInpatient, onTap: () {
onTap: () {}, Helpers.showConfirmationDialog(context,
isDartIcon: true, "${TranslationBase.of(context).areYouSureYouWantTo} ${TranslationBase.of(context).endLC} ${TranslationBase.of(context).consultation} ?",
dartIcon: DoctorApp.end_consultaion () async {
), Navigator.of(context).pop();
GifLoaderDialogUtils.showMyDialog(context);
liveCareModel.endCallWithCharge(widget.patient.vcId);
GifLoaderDialogUtils.hideDialog(context);
if (liveCareModel.state == ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(liveCareModel.error);
} else {
Navigator.of(context).pop();
Navigator.of(context).pop();
}
});
}, isDartIcon: true, dartIcon: DoctorApp.end_consultaion),
PatientProfileCardModel( PatientProfileCardModel(
TranslationBase.of(context).sendLC, TranslationBase.of(context).sendLC,
TranslationBase.of(context).instruction, TranslationBase.of(context).instruction,
@ -55,128 +77,136 @@ class _EndCallScreenState extends State<EndCallScreen> {
onTap: () {}, onTap: () {},
isInPatient: isInpatient, isInPatient: isInpatient,
isDartIcon: true, isDartIcon: true,
dartIcon: DoctorApp.send_instruction dartIcon: DoctorApp.send_instruction),
), PatientProfileCardModel(TranslationBase.of(context).transferTo,
PatientProfileCardModel( TranslationBase.of(context).admin, '', 'patient/health_summary.png',
TranslationBase.of(context).transferTo, onTap: () {
TranslationBase.of(context).admin, Navigator.push(context, MaterialPageRoute(
'', builder: (BuildContext context) =>
'patient/health_summary.png', LivaCareTransferToAdmin(patient:widget.patient)));
onTap: () {}, },
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: const EdgeInsets.symmetric( : MediaQuery.of(context).size.height * 0.65
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(TranslationBase.of(context).endcall, AppText(
fontSize: 26, TranslationBase.of(context).patient,
fontWeight: FontWeight.bold, fontSize: 14,
), 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, ),
), ],
], ),
), ),
), ),
); );

@ -0,0 +1,197 @@
import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/core/enum/viewstate.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/icons_app/doctor_app_icons.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/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/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/buttons/button_bottom_sheet.dart';
import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart';
import 'package:doctor_app_flutter/widgets/shared/speech-text-popup.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart';
import 'package:flutter/material.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:provider/provider.dart';
import 'package:speech_to_text/speech_recognition_error.dart';
import 'package:speech_to_text/speech_to_text.dart' as stt;
class LivaCareTransferToAdmin extends StatefulWidget {
final PatiantInformtion patient;
const LivaCareTransferToAdmin({Key key, this.patient}) : super(key: key);
@override
_LivaCareTransferToAdminState createState() =>
_LivaCareTransferToAdminState();
}
class _LivaCareTransferToAdminState extends State<LivaCareTransferToAdmin> {
stt.SpeechToText speech = stt.SpeechToText();
var reconizedWord;
var event = RobotProvider();
ProjectViewModel projectViewModel;
TextEditingController noteController = TextEditingController();
String noteError;
void initState() {
requestPermissions();
event.controller.stream.listen((p) {
if (p['startPopUp'] == 'true') {
if (this.mounted) {
initSpeechState().then((value) => {onVoiceText()});
}
}
});
super.initState();
}
@override
Widget build(BuildContext context) {
projectViewModel = Provider.of(context);
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(
child: Column(
children: [
Expanded(
child: SingleChildScrollView(
child: Container(
color: Colors.white,
margin: EdgeInsets.all(16),
child: Stack(
children: [
AppTextFieldCustom(
hintText: TranslationBase.of(context).notes,
//TranslationBase.of(context).addProgressNote,
controller: noteController,
maxLines: 35,
minLines: 25,
hasBorder: true,
validationError: noteError,
),
Positioned(
top: -2, //MediaQuery.of(context).size.height * 0,
right: projectViewModel.isArabic
? MediaQuery.of(context).size.width * 0.75
: 15,
child: Column(
children: [
IconButton(
icon: Icon(DoctorApp.speechtotext,
color: Colors.black, size: 35),
onPressed: () {
initSpeechState()
.then((value) => {onVoiceText()});
},
),
],
))
],
),
),
),
),
ButtonBottomSheet(
title:
"${TranslationBase.of(context).transferTo}${TranslationBase.of(context).admin}",
onPressed: () {
setState(() {
if (noteController.text.isEmpty) {
noteError = TranslationBase.of(context).emptyMessage;
} else {
noteError = null;
}
if (noteController.text.isNotEmpty) {
Helpers.showConfirmationDialog(context,
"${TranslationBase.of(context).areYouSureYouWantTo} ${TranslationBase.of(context).transferTo}${TranslationBase.of(context).admin} ?",
() async {
Navigator.of(context).pop();
GifLoaderDialogUtils.showMyDialog(context);
model.endCallWithCharge(widget.patient.vcId);
GifLoaderDialogUtils.hideDialog(context);
if (model.state == ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(model.error);
} else {
Navigator.of(context).pop();
Navigator.of(context).pop();
Navigator.of(context).pop();
}
});
}
});
},
)
],
),
),
),
);
}
onVoiceText() async {
new SpeechToText(context: context).showAlertDialog(context);
var lang = TranslationBase.of(AppGlobal.CONTEX).locale.languageCode;
bool available = await speech.initialize(
onStatus: statusListener, onError: errorListener);
if (available) {
speech.listen(
onResult: resultListener,
listenMode: stt.ListenMode.confirmation,
localeId: lang == 'en' ? 'en-US' : 'ar-SA',
);
} else {
print("The user has denied the use of speech recognition.");
}
}
void errorListener(SpeechRecognitionError error) {
event.setValue({"searchText": 'null'});
//SpeechToText.closeAlertDialog(context);
print(error);
}
void statusListener(String status) {
reconizedWord = status == 'listening' ? 'Lisening...' : 'Sorry....';
}
void requestPermissions() async {
Map<Permission, PermissionStatus> statuses = await [
Permission.microphone,
].request();
}
void resultListener(result) {
reconizedWord = result.recognizedWords;
event.setValue({"searchText": reconizedWord});
if (result.finalResult == true) {
setState(() {
SpeechToText.closeAlertDialog(context);
speech.stop();
noteController.text += reconizedWord + '\n';
});
} else {
print(result.finalResult);
}
}
Future<void> initSpeechState() async {
bool hasSpeech = await speech.initialize(
onError: errorListener, onStatus: statusListener);
print(hasSpeech);
if (!mounted) return;
}
}

@ -80,7 +80,7 @@ class _VideoCallPageState extends State<VideoCallPage> {
}); });
}, },
onCallNotRespond: (SessionStatusModel sessionStatusModel) { onCallNotRespond: (SessionStatusModel sessionStatusModel) {
//TODO handling onCalcallNotRespondlEnd //TODO handling onCalNotRespondEnd
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
changeRoute(context); changeRoute(context);
}); });

@ -283,7 +283,7 @@ class _PatientProfileScreenState extends State<PatientProfileScreen>
.initiateCall, .initiateCall,
disabled: model.state == ViewState.BusyLocal, disabled: model.state == ViewState.BusyLocal,
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)));

@ -5,10 +5,12 @@ import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/model/Prescriptions/post_prescrition_req_model.dart'; import 'package:doctor_app_flutter/core/model/Prescriptions/post_prescrition_req_model.dart';
import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_model.dart'; import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_model.dart';
import 'package:doctor_app_flutter/core/model/search_drug/get_medication_response_model.dart'; import 'package:doctor_app_flutter/core/model/search_drug/get_medication_response_model.dart';
import 'package:doctor_app_flutter/core/provider/robot_provider.dart';
import 'package:doctor_app_flutter/core/viewModel/medicine_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/medicine_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/prescription_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/prescription_view_model.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/icons_app/doctor_app_icons.dart';
import 'package:doctor_app_flutter/models/SOAP/GetAssessmentReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/GetAssessmentReqModel.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';
@ -23,12 +25,16 @@ 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/dialogs/dailog-list-select.dart'; import 'package:doctor_app_flutter/widgets/shared/dialogs/dailog-list-select.dart';
import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart';
import 'package:doctor_app_flutter/widgets/shared/speech-text-popup.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/app_text_form_field.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/app_text_form_field.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:hexcolor/hexcolor.dart'; import 'package:hexcolor/hexcolor.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:speech_to_text/speech_recognition_error.dart';
import 'package:speech_to_text/speech_to_text.dart' as stt;
addPrescriptionForm(context, PrescriptionViewModel model, addPrescriptionForm(context, PrescriptionViewModel model,
PatiantInformtion patient, prescription) { PatiantInformtion patient, prescription) {
@ -102,6 +108,13 @@ class PrescriptionFormWidget extends StatefulWidget {
} }
class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> { class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
String routeError;
String frequencyError;
String doseTimeError;
String durationError;
String unitError;
String strengthError;
int selectedType; int selectedType;
TextEditingController durationController = TextEditingController(); TextEditingController durationController = TextEditingController();
TextEditingController strengthController = TextEditingController(); TextEditingController strengthController = TextEditingController();
@ -124,6 +137,9 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
TextEditingController drugIdController = TextEditingController(); TextEditingController drugIdController = TextEditingController();
TextEditingController doseController = TextEditingController(); TextEditingController doseController = TextEditingController();
final searchController = TextEditingController(); final searchController = TextEditingController();
stt.SpeechToText speech = stt.SpeechToText();
var event = RobotProvider();
var reconizedWord;
var notesList; var notesList;
var filteredNotesList; var filteredNotesList;
@ -188,6 +204,60 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
}); });
} }
onVoiceText() async {
new SpeechToText(context: context).showAlertDialog(context);
var lang = TranslationBase.of(AppGlobal.CONTEX).locale.languageCode;
bool available = await speech.initialize(
onStatus: statusListener, onError: errorListener);
if (available) {
speech.listen(
onResult: resultListener,
listenMode: stt.ListenMode.confirmation,
localeId: lang == 'en' ? 'en-US' : 'ar-SA',
);
} else {
print("The user has denied the use of speech recognition.");
}
}
void errorListener(SpeechRecognitionError error) {
event.setValue({"searchText": 'null'});
//SpeechToText.closeAlertDialog(context);
print(error);
}
void statusListener(String status) {
reconizedWord = status == 'listening' ? 'Lisening...' : 'Sorry....';
}
void requestPermissions() async {
Map<Permission, PermissionStatus> statuses = await [
Permission.microphone,
].request();
}
void resultListener(result) {
reconizedWord = result.recognizedWords;
event.setValue({"searchText": reconizedWord});
if (result.finalResult == true) {
setState(() {
SpeechToText.closeAlertDialog(context);
speech.stop();
indicationController.text += reconizedWord + '\n';
});
} else {
print(result.finalResult);
}
}
Future<void> initSpeechState() async {
bool hasSpeech = await speech.initialize(
onError: errorListener, onStatus: statusListener);
print(hasSpeech);
if (!mounted) return;
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
ListSelectDialog drugDialog; ListSelectDialog drugDialog;
@ -244,7 +314,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
(BuildContext context, ScrollController scrollController) { (BuildContext context, ScrollController scrollController) {
return SingleChildScrollView( return SingleChildScrollView(
child: Container( child: Container(
height: MediaQuery.of(context).size.height * 1.45, height: MediaQuery.of(context).size.height * 1.65,
color: Color(0xffF8F8F8), color: Color(0xffF8F8F8),
child: Padding( child: Padding(
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
@ -437,11 +507,6 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
SizedBox( SizedBox(
height: spaceBetweenTextFileds), height: spaceBetweenTextFileds),
Container( Container(
//height: screenSize.height * 0.062,
height: MediaQuery.of(context)
.size
.height *
0.0749,
width: double.infinity, width: double.infinity,
child: Row( child: Row(
children: [ children: [
@ -451,44 +516,43 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
.size .size
.width * .width *
0.35, 0.35,
child: TextField( child: AppTextFieldCustom(
decoration: height: 40,
textFieldSelectorDecorationStreangrh( validationError:
strengthController strengthError,
.text, hintText: 'Strength',
'Strength', //strengthController.text, isTextFieldHasSuffix: false,
false), enabled: true,
enabled: true, controller:
controller: strengthController,
strengthController, onChanged: (String value) {
onChanged: setState(() {
(String value) { strengthChar =
setState(() { value.length;
strengthChar = });
value.length; if (strengthChar >= 5) {
}); DrAppToastMsg
if (strengthChar >= 5) { .showErrorToast(
DrAppToastMsg TranslationBase.of(
.showErrorToast( context)
TranslationBase.of( .only5DigitsAllowedForStrength,
context) );
.only5DigitsAllowedForStrength, }
); },
} inputType: TextInputType
}, .numberWithOptions(
keyboardType: TextInputType decimal: true,
.numberWithOptions( ),
decimal: true, // keyboardType: TextInputType
)), // .numberWithOptions(
// decimal: true,
// ),
),
), ),
SizedBox( SizedBox(
width: 5.0, width: 5.0,
), ),
Container( Container(
// height: MediaQuery.of(context)
// .size
// .height *
// 0.06,
color: Colors.white, color: Colors.white,
width: MediaQuery.of(context) width: MediaQuery.of(context)
.size .size
@ -538,23 +602,27 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
); );
} }
: null, : null,
child: TextField( child: AppTextFieldCustom(
decoration: hintText: 'Select',
textFieldSelectorDecoration( isTextFieldHasSuffix:
'Select', true,
model.itemMedicineListUnit dropDownText: model
.length == .itemMedicineListUnit
1 .length ==
? units = model 1
.itemMedicineListUnit[0] ? units = model
[ .itemMedicineListUnit[0]
'description'] ['description']
: units != : units != null
null ? units['description']
? units['description'] .toString()
.toString() : null,
: null, validationError:
true), model.itemMedicineListUnit
.length !=
1
? unitError
: null,
enabled: false), enabled: false),
), ),
), ),
@ -564,7 +632,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
SizedBox( SizedBox(
height: spaceBetweenTextFileds), height: spaceBetweenTextFileds),
Container( Container(
height: screenSize.height * 0.070, //height: screenSize.height * 0.070,
color: Colors.white, color: Colors.white,
child: InkWell( child: InkWell(
onTap: onTap:
@ -613,23 +681,44 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
); );
} }
: null, : null,
child: TextField( child: AppTextFieldCustom(
decoration: // decoration:
textFieldSelectorDecoration( // textFieldSelectorDecoration(
TranslationBase.of( // TranslationBase.of(
context) // context)
.route, // .route,
model.itemMedicineListRoute // model.itemMedicineListRoute
.length == // .length ==
1 // 1
? model.itemMedicineListRoute[ // ? model.itemMedicineListRoute[
0] // 0]
['description'] // ['description']
: route != null // : route != null
? route[ // ? route[
'description'] // 'description']
: null, // : null,
true), // true),
hintText:
TranslationBase.of(context)
.route,
dropDownText: model
.itemMedicineListRoute
.length ==
1
? model.itemMedicineListRoute[
0]['description']
: route != null
? route['description']
: null,
isTextFieldHasSuffix: true,
//height: 45,
validationError:
model.itemMedicineListRoute
.length !=
1
? routeError
: null,
enabled: false, enabled: false,
), ),
), ),
@ -637,7 +726,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
SizedBox( SizedBox(
height: spaceBetweenTextFileds), height: spaceBetweenTextFileds),
Container( Container(
height: screenSize.height * 0.070, //height: screenSize.height * 0.070,
color: Colors.white, color: Colors.white,
child: InkWell( child: InkWell(
onTap: onTap:
@ -704,23 +793,27 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
); );
} }
: null, : null,
child: TextField( child: AppTextFieldCustom(
decoration: isTextFieldHasSuffix: true,
textFieldSelectorDecoration( hintText:
TranslationBase.of( TranslationBase.of(context)
context) .frequency,
.frequency, dropDownText: model
model.itemMedicineList .itemMedicineList
.length == .length ==
1 1
? model.itemMedicineList[ ? model.itemMedicineList[0]
0] ['description']
['description'] : frequency != null
: frequency != null ? frequency[
? frequency[ 'description']
'description'] : null,
: null, validationError: model
true), .itemMedicineList
.length !=
1
? frequencyError
: null,
enabled: false, enabled: false,
), ),
), ),
@ -728,7 +821,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
SizedBox( SizedBox(
height: spaceBetweenTextFileds), height: spaceBetweenTextFileds),
Container( Container(
height: screenSize.height * 0.070, //height: screenSize.height * 0.070,
color: Colors.white, color: Colors.white,
child: InkWell( child: InkWell(
onTap: onTap:
@ -770,17 +863,18 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
); );
} }
: null, : null,
child: TextField( child: AppTextFieldCustom(
decoration: hintText:
textFieldSelectorDecoration( TranslationBase.of(context)
TranslationBase.of( .doseTime,
context) isTextFieldHasSuffix: true,
.doseTime, dropDownText: doseTime != null
doseTime != null ? doseTime['nameEn']
? doseTime['nameEn'] : null,
: null, //height: 45,
true),
enabled: false, enabled: false,
validationError: doseTimeError,
), ),
), ),
), ),
@ -894,7 +988,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
SizedBox( SizedBox(
height: spaceBetweenTextFileds), height: spaceBetweenTextFileds),
Container( Container(
height: screenSize.height * 0.070, //height: screenSize.height * 0.070,
color: Colors.white, color: Colors.white,
child: InkWell( child: InkWell(
onTap: onTap:
@ -963,16 +1057,15 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
); );
} }
: null, : null,
child: TextField( child: AppTextFieldCustom(
decoration: validationError: durationError,
textFieldSelectorDecoration( isTextFieldHasSuffix: true,
TranslationBase.of( dropDownText: duration != null
context) ? duration['nameEn']
.duration, : null,
duration != null hintText:
? duration['nameEn'] TranslationBase.of(context)
: null, .duration,
true),
enabled: false, enabled: false,
), ),
), ),
@ -1101,14 +1194,36 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
width: 1.0, width: 1.0,
color: color:
HexColor("#CCCCCC"))), HexColor("#CCCCCC"))),
child: TextFields( child: Stack(
maxLines: 6, children: [
minLines: 4, TextFields(
hintText: maxLines: 6,
TranslationBase.of(context) minLines: 4,
hintText: TranslationBase.of(
context)
.instruction, .instruction,
controller: instructionController, controller:
//keyboardType: TextInputType.number, instructionController,
//keyboardType: TextInputType.number,
),
Positioned(
top:
0, //MediaQuery.of(context).size.height * 0,
right: 15,
child: IconButton(
icon: Icon(
DoctorApp.speechtotext,
color: Colors.black,
size: 35,
),
onPressed: () {
initSpeechState().then(
(value) =>
{onVoiceText()});
},
),
),
],
), ),
), ),
SizedBox( SizedBox(
@ -1125,139 +1240,205 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
context) context)
.addMedication, .addMedication,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
onPressed: () { onPressed: () async {
formKey.currentState.save(); if (route != null &&
// Navigator.pop(context); duration != null &&
// openDrugToDrug(); doseTime != null &&
if (frequency == null || frequency != null &&
units != null &&
selectedDate != null &&
strengthController strengthController
.text == .text !=
"" || "") {
doseTime == null || if (_selectedMedication
duration == null || .isNarcotic ==
selectedDate == null) { true) {
DrAppToastMsg.showErrorToast( DrAppToastMsg.showErrorToast(
TranslationBase.of( TranslationBase.of(
context) context)
.pleaseFillAllFields); .narcoticMedicineCanOnlyBePrescribedFromVida);
return; Navigator.pop(context);
} return;
if (_selectedMedication }
.isNarcotic ==
true) {
DrAppToastMsg.showErrorToast(
TranslationBase.of(
context)
.narcoticMedicineCanOnlyBePrescribedFromVida);
Navigator.pop(context);
return;
}
if (double.parse( if (double.parse(
strengthController strengthController
.text) > .text) >
1000.0) { 1000.0) {
DrAppToastMsg.showErrorToast( DrAppToastMsg
"1000 is the MAX for the strength"); .showErrorToast(
return; "1000 is the MAX for the strength");
} return;
if (double.parse( }
strengthController if (double.parse(
.text) < strengthController
0.0) { .text) <
DrAppToastMsg.showErrorToast( 0.0) {
"strength can't be zero"); DrAppToastMsg
return; .showErrorToast(
} "strength can't be zero");
return;
}
if (formKey.currentState if (formKey.currentState
.validate()) { .validate()) {
Navigator.pop(context); Navigator.pop(context);
openDrugToDrug(model); openDrugToDrug(model);
{ {
// postProcedure( // postProcedure(
// icdCode: model // icdCode: model
// .patientAssessmentList // .patientAssessmentList
// .isNotEmpty // .isNotEmpty
// ? model // ? model
// .patientAssessmentList[ // .patientAssessmentList[
// 0] // 0]
// .icdCode10ID // .icdCode10ID
// .isEmpty // .isEmpty
// ? "test" // ? "test"
// : model // : model
// .patientAssessmentList[ // .patientAssessmentList[
// 0] // 0]
// .icdCode10ID // .icdCode10ID
// .toString() // .toString()
// : "test", // : "test",
// // icdCode: model // // icdCode: model
// // .patientAssessmentList // // .patientAssessmentList
// // .map((value) => value // // .map((value) => value
// // .icdCode10ID // // .icdCode10ID
// // .trim()) // // .trim())
// // .toList() // // .toList()
// // .join(' '), // // .join(' '),
// dose: strengthController // dose: strengthController
// .text, // .text,
// doseUnit: model // doseUnit: model
// .itemMedicineListUnit // .itemMedicineListUnit
// .length == // .length ==
// 1 // 1
// ? model // ? model
// .itemMedicineListUnit[ // .itemMedicineListUnit[
// 0][ // 0][
// 'parameterCode'] // 'parameterCode']
// .toString() // .toString()
// : units['parameterCode'] // : units['parameterCode']
// .toString(), // .toString(),
// patient: widget.patient, // patient: widget.patient,
// doseTimeIn: // doseTimeIn:
// doseTime['id'] // doseTime['id']
// .toString(), // .toString(),
// model: widget.model, // model: widget.model,
// duration: duration['id'] // duration: duration['id']
// .toString(), // .toString(),
// frequency: model // frequency: model
// .itemMedicineList // .itemMedicineList
// .length == // .length ==
// 1 // 1
// ? model // ? model
// .itemMedicineList[ // .itemMedicineList[
// 0][ // 0][
// 'parameterCode'] // 'parameterCode']
// .toString() // .toString()
// : frequency[ // : frequency[
// 'parameterCode'] // 'parameterCode']
// .toString(), // .toString(),
// route: model.itemMedicineListRoute // route: model.itemMedicineListRoute
// .length == // .length ==
// 1 // 1
// ? model // ? model
// .itemMedicineListRoute[ // .itemMedicineListRoute[
// 0][ // 0][
// 'parameterCode'] // 'parameterCode']
// .toString() // .toString()
// : route['parameterCode'] // : route['parameterCode']
// .toString(), // .toString(),
// drugId: // drugId:
// _selectedMedication // _selectedMedication
// .itemId // .itemId
// .toString(), // .toString(),
// strength: // strength:
// strengthController // strengthController
// .text, // .text,
// indication: // indication:
// indicationController // indicationController
// .text, // .text,
// instruction: // instruction:
// instructionController // instructionController
// .text, // .text,
// doseTime: selectedDate, // doseTime: selectedDate,
// ); // );
}
} }
} else {
setState(() {
if (duration == null) {
durationError =
TranslationBase.of(
context)
.fieldRequired;
} else {
durationError = null;
}
if (doseTime == null) {
doseTimeError =
TranslationBase.of(
context)
.fieldRequired;
} else {
doseTimeError = null;
}
if (route == null) {
routeError =
TranslationBase.of(
context)
.fieldRequired;
} else {
routeError = null;
}
if (frequency == null) {
frequencyError =
TranslationBase.of(
context)
.fieldRequired;
} else {
frequencyError = null;
}
if (units == null) {
unitError =
TranslationBase.of(
context)
.fieldRequired;
} else {
unitError = null;
}
if (strengthController
.text ==
"") {
strengthError =
TranslationBase.of(
context)
.fieldRequired;
} else {
strengthError = null;
}
});
} }
formKey.currentState.save();
// Navigator.pop(context);
// openDrugToDrug();
// if (frequency == null ||
// strengthController
// .text ==
// "" ||
// doseTime == null ||
// duration == null ||
// selectedDate == null) {
// DrAppToastMsg.showErrorToast(
// TranslationBase.of(
// context)
// .pleaseFillAllFields);
// return;
// }
{ {
// Navigator.push( // Navigator.push(
// context, // context,
@ -1430,17 +1611,20 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
// .join(' '), // .join(' '),
dose: strengthController.text, dose: strengthController.text,
doseUnit: model.itemMedicineListUnit.length == 1 doseUnit: model.itemMedicineListUnit.length == 1
? model.itemMedicineListUnit[0]['parameterCode'].toString() ? model.itemMedicineListUnit[0]['parameterCode']
.toString()
: units['parameterCode'].toString(), : units['parameterCode'].toString(),
patient: widget.patient, patient: widget.patient,
doseTimeIn: doseTime['id'].toString(), doseTimeIn: doseTime['id'].toString(),
model: widget.model, model: widget.model,
duration: duration['id'].toString(), duration: duration['id'].toString(),
frequency: model.itemMedicineList.length == 1 frequency: model.itemMedicineList.length == 1
? model.itemMedicineList[0]['parameterCode'].toString() ? model.itemMedicineList[0]['parameterCode']
.toString()
: frequency['parameterCode'].toString(), : frequency['parameterCode'].toString(),
route: model.itemMedicineListRoute.length == 1 route: model.itemMedicineListRoute.length == 1
? model.itemMedicineListRoute[0]['parameterCode'].toString() ? model.itemMedicineListRoute[0]['parameterCode']
.toString()
: route['parameterCode'].toString(), : route['parameterCode'].toString(),
drugId: _selectedMedication.itemId.toString(), drugId: _selectedMedication.itemId.toString(),
strength: strengthController.text, strength: strengthController.text,

@ -2,6 +2,7 @@
import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/core/model/procedure/get_ordered_procedure_model.dart'; import 'package:doctor_app_flutter/core/model/procedure/get_ordered_procedure_model.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/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/util/date-utils.dart'; import 'package:doctor_app_flutter/util/date-utils.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
@ -16,7 +17,7 @@ class ProcedureCard extends StatelessWidget {
final String categoryName; final String categoryName;
final int categoryID; final int categoryID;
final PatiantInformtion patient; final PatiantInformtion patient;
final String doctorName; final int doctorID;
const ProcedureCard({ const ProcedureCard({
Key key, Key key,
@ -25,7 +26,7 @@ class ProcedureCard extends StatelessWidget {
this.categoryID, this.categoryID,
this.categoryName, this.categoryName,
this.patient, this.patient,
this.doctorName, this.doctorID,
}) : super(key: key); }) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -241,22 +242,27 @@ class ProcedureCard extends StatelessWidget {
), ),
), ),
),*/ ),*/
// Row( Padding(
// mainAxisAlignment: MainAxisAlignment.spaceBetween, padding: const EdgeInsets.all(8.0),
// children: [ child: Row(
// AppText( mainAxisAlignment: MainAxisAlignment.spaceBetween,
// entityList.remarks.toString() ?? '', children: [
// fontSize: 12, Expanded(
// ), child: AppText(
// if (entityList.categoryID == 2 || entityList.remarks.toString() ?? '',
// entityList.categoryID == 4 && fontSize: 12,
// doctorName == entityList.doctorName) ),
// InkWell( ),
// child: Icon(DoctorApp.edit), if (entityList.categoryID == 2 ||
// onTap: onTap, entityList.categoryID == 4 &&
// ) doctorID == entityList.doctorID)
// ], InkWell(
// ) child: Icon(DoctorApp.edit),
onTap: onTap,
)
],
),
)
], ],
), ),
//onTap: onTap, //onTap: onTap,

@ -13,13 +13,11 @@ 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/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/dialogs/dailog-list-select.dart';
import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart'; import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'entity_list_checkbox_search_widget.dart'; import 'entity_list_checkbox_search_widget.dart';
import 'entity_list_procedure_widget.dart';
valdateProcedure(ProcedureViewModel model, PatiantInformtion patient, valdateProcedure(ProcedureViewModel model, PatiantInformtion patient,
List<EntityList> entityList) async { List<EntityList> entityList) async {
@ -139,9 +137,7 @@ class _AddSelectedProcedureState extends State<AddSelectedProcedure> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final screenSize = MediaQuery.of(context).size;
return BaseView<ProcedureViewModel>( return BaseView<ProcedureViewModel>(
//onModelReady: (model) => model.getCategory(),
builder: (BuildContext context, ProcedureViewModel model, Widget child) => builder: (BuildContext context, ProcedureViewModel model, Widget child) =>
AppScaffold( AppScaffold(
isShowAppBar: false, isShowAppBar: false,
@ -186,7 +182,7 @@ class _AddSelectedProcedureState extends State<AddSelectedProcedure> {
children: [ children: [
Container( Container(
width: MediaQuery.of(context).size.width * width: MediaQuery.of(context).size.width *
0.81, 0.79,
child: AppTextFieldCustom( child: AppTextFieldCustom(
hintText: TranslationBase.of(context) hintText: TranslationBase.of(context)
.searchProcedureHere, .searchProcedureHere,
@ -218,21 +214,23 @@ class _AddSelectedProcedureState extends State<AddSelectedProcedure> {
width: MediaQuery.of(context).size.width * width: MediaQuery.of(context).size.width *
0.02, 0.02,
), ),
InkWell( Expanded(
onTap: () { child: InkWell(
if (procedureName.text.isNotEmpty && onTap: () {
procedureName.text.length >= 3) if (procedureName.text.isNotEmpty &&
model.getProcedureCategory( procedureName.text.length >= 3)
categoryName: procedureName.text); model.getProcedureCategory(
else categoryName: procedureName.text);
DrAppToastMsg.showErrorToast( else
TranslationBase.of(context) DrAppToastMsg.showErrorToast(
.atLeastThreeCharacters, TranslationBase.of(context)
); .atLeastThreeCharacters,
}, );
child: Icon( },
Icons.search, child: Icon(
size: 25.0, Icons.search,
size: 25.0,
),
), ),
), ),
], ],
@ -429,8 +427,6 @@ class _AddSelectedProcedureState extends State<AddSelectedProcedure> {
color: Color(0xff359846), color: Color(0xff359846),
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
onPressed: () { onPressed: () {
//print(entityList.toString());
onPressed:
if (entityList.isEmpty == true) { if (entityList.isEmpty == true) {
DrAppToastMsg.showErrorToast( DrAppToastMsg.showErrorToast(
TranslationBase.of(context) TranslationBase.of(context)

@ -125,12 +125,12 @@ class _AddProcedureHomeState extends State<AddProcedureHome>
tabWidget( tabWidget(
screenSize, screenSize,
_activeTab == 0, _activeTab == 0,
'All Procedures', "Favorite Templates",
), ),
tabWidget( tabWidget(
screenSize, screenSize,
_activeTab == 1, _activeTab == 1,
"Favorite Templates", 'All Procedures',
), ),
], ],
), ),
@ -144,14 +144,14 @@ class _AddProcedureHomeState extends State<AddProcedureHome>
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
controller: _tabController, controller: _tabController,
children: [ children: [
AddSelectedProcedure(
model: model,
patient: patient,
),
AddFavouriteProcedure( AddFavouriteProcedure(
patient: patient, patient: patient,
model: model, model: model,
), ),
AddSelectedProcedure(
model: model,
patient: patient,
),
], ],
), ),
), ),

@ -10,7 +10,6 @@ import 'package:doctor_app_flutter/widgets/shared/TextFields.dart';
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/divider_with_spaces_around.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -37,164 +36,159 @@ class _ProcedureCheckOutScreenState extends State<ProcedureCheckOutScreen> {
AppScaffold( AppScaffold(
backgroundColor: Color(0xffF8F8F8).withOpacity(0.9), backgroundColor: Color(0xffF8F8F8).withOpacity(0.9),
isShowAppBar: false, isShowAppBar: false,
body: Column( body: SingleChildScrollView(
children: [ child: Column(
Container( children: [
height: MediaQuery.of(context).size.height * 0.070, Container(
color: Colors.white, height: MediaQuery.of(context).size.height * 0.070,
), color: Colors.white,
Container( ),
color: Colors.white, Container(
child: Padding( color: Colors.white,
padding: EdgeInsets.all(12.0), child: Padding(
child: Row( padding: EdgeInsets.all(12.0),
//mainAxisAlignment: MainAxisAlignment.spaceBetween, child: Row(
children: [ //mainAxisAlignment: MainAxisAlignment.spaceBetween,
InkWell( children: [
child: Icon( InkWell(
Icons.arrow_back_ios_sharp, child: Icon(
size: 24.0, Icons.arrow_back_ios_sharp,
size: 24.0,
),
onTap: () {
Navigator.pop(context);
},
), ),
onTap: () { SizedBox(
Navigator.pop(context); width: 5.0,
}, ),
), AppText(
SizedBox( 'Add Procedure',
width: 5.0, fontWeight: FontWeight.w700,
), fontSize: 20,
AppText( ),
'Add Procedure', ],
fontWeight: FontWeight.w700, ),
fontSize: 20,
),
],
), ),
), ),
), SizedBox(height: 30,),
Padding( ...List.generate(widget.items.length, (index) => Container(
padding: const EdgeInsets.only( margin: EdgeInsets.only(bottom: 15.0),
left: 12.0, right: 12.0, bottom: 26.0, top: 10), decoration: BoxDecoration(
child: ListView.builder( color: Colors.white,
scrollDirection: Axis.vertical, borderRadius:
physics: AlwaysScrollableScrollPhysics(), BorderRadius.all(Radius.circular(10.0))),
shrinkWrap: true, child: ExpansionTile(
itemCount: widget.items.length, initiallyExpanded: true,
itemBuilder: (BuildContext context, int index) { title: Row(
return Container( children: [
margin: EdgeInsets.only(bottom: 15.0), Icon(
decoration: BoxDecoration( Icons.check_box,
color: Colors.white, color: Color(0xffD02127),
borderRadius: size: 30.5,
BorderRadius.all(Radius.circular(10.0))), ),
child: ExpansionTile( SizedBox(
initiallyExpanded: true, width: 6.0,
title: Row( ),
Expanded(
child:
AppText(widget.items[index].procedureName)),
],
),
children: [
Container(
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 12),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Icon( Row(
Icons.check_box, children: [
color: Color(0xffD02127), Padding(
size: 30.5, padding: const EdgeInsets.symmetric(
horizontal: 11),
child: AppText(
TranslationBase.of(context).orderType,
fontWeight: FontWeight.w700,
color: Color(0xff2B353E),
),
),
],
), ),
SizedBox( Row(
width: 6.0, children: [
Radio(
activeColor: Color(0xFFD02127),
value: 0,
groupValue:
widget.items[index].selectedType,
onChanged: (value) {
widget.items[index].selectedType = 0;
setState(() {
widget.items[index].type =
value.toString();
});
},
),
AppText(
'routine',
color: Color(0xff575757),
fontWeight: FontWeight.w600,
),
Radio(
activeColor: Color(0xFFD02127),
groupValue:
widget.items[index].selectedType,
value: 1,
onChanged: (value) {
widget.items[index].selectedType = 1;
setState(() {
widget.items[index].type =
value.toString();
});
},
),
AppText(
TranslationBase.of(context).urgent,
color: Color(0xff575757),
fontWeight: FontWeight.w600,
),
],
), ),
Expanded(
child:
AppText(widget.items[index].procedureName)),
], ],
), ),
children: [
Container(
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 12),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 11),
child: AppText(
TranslationBase.of(context).orderType,
fontWeight: FontWeight.w700,
color: Color(0xff2B353E),
),
),
],
),
Row(
children: [
Radio(
activeColor: Color(0xFFD02127),
value: 0,
groupValue:
widget.items[index].selectedType,
onChanged: (value) {
widget.items[index].selectedType = 0;
setState(() {
widget.items[index].type =
value.toString();
});
},
),
AppText(
'routine',
color: Color(0xff575757),
fontWeight: FontWeight.w600,
),
Radio(
activeColor: Color(0xFFD02127),
groupValue:
widget.items[index].selectedType,
value: 1,
onChanged: (value) {
widget.items[index].selectedType = 1;
setState(() {
widget.items[index].type =
value.toString();
});
},
),
AppText(
TranslationBase.of(context).urgent,
color: Color(0xff575757),
fontWeight: FontWeight.w600,
),
],
),
],
),
),
),
SizedBox(
height: 2.0,
),
Padding(
padding: EdgeInsets.symmetric(
horizontal: 12, vertical: 15.0),
child: TextFields(
hintText: TranslationBase.of(context).remarks,
controller: remarksController,
onChanged: (value) {
widget.items[index].remarks = value;
},
minLines: 3,
maxLines: 5,
borderWidth: 0.5,
borderColor: Colors.grey[500],
),
),
SizedBox(
height: 19.0,
),
//DividerWithSpacesAround(),
],
), ),
); ),
}), SizedBox(
), height: 2.0,
], ),
Padding(
padding: EdgeInsets.symmetric(
horizontal: 12, vertical: 15.0),
child: TextFields(
hintText: TranslationBase.of(context).remarks,
controller: remarksController,
onChanged: (value) {
widget.items[index].remarks = value;
},
minLines: 3,
maxLines: 5,
borderWidth: 0.5,
borderColor: Colors.grey[500],
),
),
SizedBox(
height: 19.0,
),
//DividerWithSpacesAround(),
],
),
)),
SizedBox(height: 90,),
],
),
), ),
bottomSheet: Container( bottomSheet: Container(
margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5), margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5),
@ -206,15 +200,6 @@ class _ProcedureCheckOutScreenState extends State<ProcedureCheckOutScreen> {
color: Color(0xff359846), color: Color(0xff359846),
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
onPressed: () async { onPressed: () async {
//print(entityList.toString());
onPressed:
// if (entityList.isEmpty == true) {
// DrAppToastMsg.showErrorToast(
// TranslationBase.of(context)
// .fillTheMandatoryProcedureDetails,
// );
// return;
// }
List<EntityList> entityList = List(); List<EntityList> entityList = List();
widget.items.forEach((element) { widget.items.forEach((element) {
entityList.add( entityList.add(

@ -17,12 +17,12 @@ import 'package:flutter/material.dart';
import 'ProcedureCard.dart'; import 'ProcedureCard.dart';
class ProcedureScreen extends StatelessWidget { class ProcedureScreen extends StatelessWidget {
String doctorNameP; int doctorNameP;
void initState() async { void initState() async {
Map profile = await sharedPref.getObj(DOCTOR_PROFILE); Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile);
doctorNameP = doctorProfile.doctorName; doctorNameP = doctorProfile.doctorID;
} }
@override @override
@ -192,7 +192,7 @@ class ProcedureScreen extends StatelessWidget {
// 'You Cant Update This Procedure'); // 'You Cant Update This Procedure');
}, },
patient: patient, patient: patient,
doctorName: doctorNameP, doctorID: doctorNameP,
), ),
), ),
if (model.state == ViewState.ErrorLocal || if (model.state == ViewState.ErrorLocal ||

@ -100,7 +100,7 @@ class _UpdateProcedureWidgetState extends State<UpdateProcedureWidget> {
baseViewModel: model, baseViewModel: model,
child: SingleChildScrollView( child: SingleChildScrollView(
child: Container( child: Container(
height: MediaQuery.of(context).size.height * 0.65, height: MediaQuery.of(context).size.height * 0.9,
child: Form( child: Form(
child: Padding( child: Padding(
padding: padding:

@ -8,6 +8,8 @@ import 'package:doctor_app_flutter/models/doctor/list_doctor_working_hours_table
import 'package:doctor_app_flutter/screens/auth/login_screen.dart'; import 'package:doctor_app_flutter/screens/auth/login_screen.dart';
import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; import 'package:doctor_app_flutter/util/dr_app_shared_pref.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_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart';
import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart'; import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -24,7 +26,47 @@ class Helpers {
static int cupertinoPickerIndex = 0; static int cupertinoPickerIndex = 0;
get currentLanguage => null; get currentLanguage => null;
static showCupertinoPicker(context, List<GetHospitalsResponseModel> items, decKey, onSelectFun, AuthenticationViewModel model) {
static showConfirmationDialog(
BuildContext context, String message, Function okFunction) {
return showDialog(
context: context,
barrierDismissible: false, // user must tap button!
builder: (_) {
return Container(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
AlertDialog(
title: null,
content: Container(
child: AppText(message),
),
actions: [
AppButton(
onPressed: okFunction,
title: TranslationBase.of(context).noteConfirm,
fontColor: Colors.white,
color: Colors.green[600],
),
AppButton(
onPressed: (){
Navigator.of(context).pop();
},
title: TranslationBase.of(context).cancel,
fontColor: Colors.white,
color: Colors.red[600],
),
],
),
],
),
);
});
}
static showCupertinoPicker(context, List<GetHospitalsResponseModel> items,
decKey, onSelectFun, AuthenticationViewModel model) {
showModalBottomSheet( showModalBottomSheet(
isDismissible: false, isDismissible: false,
context: context, context: context,
@ -64,8 +106,8 @@ class Helpers {
Container( Container(
height: SizeConfig.realScreenHeight * 0.3, height: SizeConfig.realScreenHeight * 0.3,
color: Color(0xfff7f7f7), color: Color(0xfff7f7f7),
child: child: buildPickerItems(
buildPickerItems(context, items, decKey, onSelectFun, model)) context, items, decKey, onSelectFun, model))
], ],
), ),
); );
@ -75,7 +117,8 @@ class Helpers {
static TextStyle textStyle(context) => static TextStyle textStyle(context) =>
TextStyle(color: Theme.of(context).primaryColor); TextStyle(color: Theme.of(context).primaryColor);
static buildPickerItems(context, List<GetHospitalsResponseModel> items, decKey, onSelectFun, model) { static buildPickerItems(context, List<GetHospitalsResponseModel> items,
decKey, onSelectFun, model) {
return CupertinoPicker( return CupertinoPicker(
magnification: 1.5, magnification: 1.5,
scrollController: scrollController:

@ -18,6 +18,8 @@ class TranslationBase {
String get settings => localizedValues['settings'][locale.languageCode]; String get settings => localizedValues['settings'][locale.languageCode];
String get areYouSureYouWantTo => localizedValues['areYouSureYouWantTo'][locale.languageCode];
String get language => localizedValues['language'][locale.languageCode]; String get language => localizedValues['language'][locale.languageCode];
String get lanEnglish => localizedValues['lanEnglish'][locale.languageCode]; String get lanEnglish => localizedValues['lanEnglish'][locale.languageCode];

@ -42,23 +42,27 @@ class ButtonBottomSheet extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
margin: EdgeInsets.symmetric(horizontal: 16, vertical: 16), margin: EdgeInsets.symmetric(horizontal: 16, vertical: 16),
child: AppButton( child: Column(
title: title, children: [
onPressed: onPressed, AppButton(
fontWeight: fontWeight, title: title,
color: color, onPressed: onPressed,
fontSize: fontSize, fontWeight: fontWeight,
padding: padding, color: color,
disabled: disabled, fontSize: fontSize,
radius: radius, padding: padding,
hasBorder: hasBorder, disabled: disabled,
fontColor: fontColor, radius: radius,
icon: icon, hasBorder: hasBorder,
iconData: iconData, fontColor: fontColor,
hPadding: hPadding, icon: icon,
vPadding: vPadding, iconData: iconData,
borderColor: borderColor, hPadding: hPadding,
loading: loading, vPadding: vPadding,
borderColor: borderColor,
loading: loading,
),
],
), ),
); );
} }

Loading…
Cancel
Save