voice commad updated

merge-requests/636/head
Sultan Khan 5 years ago
parent d6e621e4ce
commit 5a42184716

@ -946,8 +946,14 @@ const Map<String, Map<String, String>> localizedValues = {
"approvals22": {"en": "Approvals", "ar": "التامين"}, "approvals22": {"en": "Approvals", "ar": "التامين"},
"severe": {"en": "Severe", "ar": "الشدة"}, "severe": {"en": "Severe", "ar": "الشدة"},
"graphDetails": {"en": "Graph Details", "ar": "تفاصيل الرسم البياني"}, "graphDetails": {"en": "Graph Details", "ar": "تفاصيل الرسم البياني"},
"addNewOrderSheet": {"en": "Add a New Order Sheet", "ar": "أضف ورقة طلب جديدة"}, "addNewOrderSheet": {
"addNewProgressNote": {"en": "Add a New Progress Note", "ar": "أضف ملاحظة تقدم جديدة"}, "en": "Add a New Order Sheet",
"ar": "أضف ورقة طلب جديدة"
},
"addNewProgressNote": {
"en": "Add a New Progress Note",
"ar": "أضف ملاحظة تقدم جديدة"
},
"notePending": {"en": "Pending", "ar": "قيد الانتظار"}, "notePending": {"en": "Pending", "ar": "قيد الانتظار"},
"noteCanceled": {"en": "Canceled", "ar": "ألغيت"}, "noteCanceled": {"en": "Canceled", "ar": "ألغيت"},
"noteVerified": {"en": "Verified", "ar": "تم التحقق"}, "noteVerified": {"en": "Verified", "ar": "تم التحقق"},
@ -964,4 +970,5 @@ const Map<String, Map<String, String>> localizedValues = {
"discharged": {"en": "Discharged", "ar": "المفرغين"}, "discharged": {"en": "Discharged", "ar": "المفرغين"},
"none": {"en": "None", "ar": "لا شيء"}, "none": {"en": "None", "ar": "لا شيء"},
"notRepliedYet": {"en": "Not Replied yet", "ar": "لم يرد بعد"}, "notRepliedYet": {"en": "Not Replied yet", "ar": "لم يرد بعد"},
"clearText": {"en": "Clear Text", "ar": "نص واضح"},
}; };

@ -97,9 +97,13 @@ class _UpdateNoteOrderState extends State<UpdateNoteOrder> {
children: [ children: [
BottomSheetTitle( BottomSheetTitle(
title: widget.visitType == 3 title: widget.visitType == 3
? (widget.isUpdate ? TranslationBase.of(context).noteUpdate : TranslationBase.of(context).noteAdd) + ? (widget.isUpdate
? TranslationBase.of(context).noteUpdate
: TranslationBase.of(context).noteAdd) +
TranslationBase.of(context).orderSheet TranslationBase.of(context).orderSheet
: (widget.isUpdate ? TranslationBase.of(context).noteUpdate : TranslationBase.of(context).noteAdd) + : (widget.isUpdate
? TranslationBase.of(context).noteUpdate
: TranslationBase.of(context).noteAdd) +
TranslationBase.of(context).progressNote, TranslationBase.of(context).progressNote,
), ),
SizedBox( SizedBox(
@ -114,9 +118,17 @@ class _UpdateNoteOrderState extends State<UpdateNoteOrder> {
children: [ children: [
AppTextFieldCustom( AppTextFieldCustom(
hintText: widget.visitType == 3 hintText: widget.visitType == 3
? (widget.isUpdate ? TranslationBase.of(context).noteUpdate : TranslationBase.of(context).noteAdd) + ? (widget.isUpdate
? TranslationBase.of(context)
.noteUpdate
: TranslationBase.of(context)
.noteAdd) +
TranslationBase.of(context).orderSheet TranslationBase.of(context).orderSheet
: (widget.isUpdate ? TranslationBase.of(context).noteUpdate : TranslationBase.of(context).noteAdd) + : (widget.isUpdate
? TranslationBase.of(context)
.noteUpdate
: TranslationBase.of(context)
.noteAdd) +
TranslationBase.of(context).progressNote, TranslationBase.of(context).progressNote,
//TranslationBase.of(context).addProgressNote, //TranslationBase.of(context).addProgressNote,
controller: progressNoteController, controller: progressNoteController,
@ -132,19 +144,23 @@ class _UpdateNoteOrderState extends State<UpdateNoteOrder> {
: null, : null,
), ),
Positioned( Positioned(
top: -2, //MediaQuery.of(context).size.height * 0, top:
right: projectViewModel.isArabic? MediaQuery.of(context).size.width * 0.75 : 15, -2, //MediaQuery.of(context).size.height * 0,
child: IconButton( right: projectViewModel.isArabic
icon: Icon( ? MediaQuery.of(context).size.width * 0.75
DoctorApp.speechtotext, : 15,
color: Colors.black, child: Column(
), children: [
IconButton(
icon: Icon(DoctorApp.speechtotext,
color: Colors.black, size: 35),
onPressed: () { onPressed: () {
initSpeechState() initSpeechState()
.then((value) => {onVoiceText()}); .then((value) => {onVoiceText()});
}, },
), ),
) ],
))
], ],
), ),
], ],
@ -161,11 +177,31 @@ class _UpdateNoteOrderState extends State<UpdateNoteOrder> {
child: Wrap( child: Wrap(
alignment: WrapAlignment.center, alignment: WrapAlignment.center,
children: <Widget>[ children: <Widget>[
AppButton( progressNoteController.text.isEmpty
? SizedBox()
: Container(
margin: EdgeInsets.all(5),
child: Expanded(
child: AppButton(
title: TranslationBase.of(context).clearText,
onPressed: () {
setState(() {
progressNoteController.text = '';
});
},
)),
),
Container(
margin: EdgeInsets.all(5),
child: AppButton(
title: widget.visitType == 3 title: widget.visitType == 3
? (widget.isUpdate ? TranslationBase.of(context).noteUpdate : TranslationBase.of(context).noteAdd) + ? (widget.isUpdate
? TranslationBase.of(context).noteUpdate
: TranslationBase.of(context).noteAdd) +
TranslationBase.of(context).orderSheet TranslationBase.of(context).orderSheet
: (widget.isUpdate ? TranslationBase.of(context).noteUpdate : TranslationBase.of(context).noteAdd) + : (widget.isUpdate
? TranslationBase.of(context).noteUpdate
: TranslationBase.of(context).noteAdd) +
TranslationBase.of(context).progressNote, TranslationBase.of(context).progressNote,
color: Color(0xff359846), color: Color(0xff359846),
// disabled: progressNoteController.text.isEmpty, // disabled: progressNoteController.text.isEmpty,
@ -196,7 +232,8 @@ class _UpdateNoteOrderState extends State<UpdateNoteOrder> {
.updatePatientProgressNote(reqModel); .updatePatientProgressNote(reqModel);
} else { } else {
CreateNoteModel reqModel = CreateNoteModel( CreateNoteModel reqModel = CreateNoteModel(
admissionNo: int.parse(widget.patient.admissionNo), admissionNo:
int.parse(widget.patient.admissionNo),
createdBy: doctorProfile.doctorID, createdBy: doctorProfile.doctorID,
visitType: widget.visitType, visitType: widget.visitType,
patientID: widget.patient.patientId, patientID: widget.patient.patientId,
@ -221,8 +258,8 @@ class _UpdateNoteOrderState extends State<UpdateNoteOrder> {
projectID: widget.patient.projectId, projectID: widget.patient.projectId,
patientTypeID: widget.patient.patientType, patientTypeID: widget.patient.patientType,
languageID: 2); languageID: 2);
await widget.patientModel await widget.patientModel.getPatientProgressNote(
.getPatientProgressNote(progressNoteRequest.toJson()); progressNoteRequest.toJson());
} }
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
DrAppToastMsg.showSuccesToast( DrAppToastMsg.showSuccesToast(
@ -231,7 +268,7 @@ class _UpdateNoteOrderState extends State<UpdateNoteOrder> {
} else { } else {
Helpers.showErrorToast("You cant add only spaces"); Helpers.showErrorToast("You cant add only spaces");
} }
}), })),
], ],
), ),
), ),
@ -278,7 +315,7 @@ class _UpdateNoteOrderState extends State<UpdateNoteOrder> {
setState(() { setState(() {
SpeechToText.closeAlertDialog(context); SpeechToText.closeAlertDialog(context);
speech.stop(); speech.stop();
progressNoteController.text = reconizedWord; progressNoteController.text += reconizedWord + '\n';
}); });
} else { } else {
print(result.finalResult); print(result.finalResult);

@ -19,7 +19,6 @@ import 'package:permission_handler/permission_handler.dart';
import 'package:speech_to_text/speech_recognition_error.dart'; 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 AddReplayOnReferralPatient extends StatefulWidget { class AddReplayOnReferralPatient extends StatefulWidget {
final PatientReferralViewModel patientReferralViewModel; final PatientReferralViewModel patientReferralViewModel;
final MyReferralPatientModel myReferralInPatientModel; final MyReferralPatientModel myReferralInPatientModel;
@ -33,8 +32,8 @@ class AddReplayOnReferralPatient extends StatefulWidget {
_AddReplayOnReferralPatientState(); _AddReplayOnReferralPatientState();
} }
class _AddReplayOnReferralPatientState extends State<AddReplayOnReferralPatient> { class _AddReplayOnReferralPatientState
extends State<AddReplayOnReferralPatient> {
bool isSubmitted = false; bool isSubmitted = false;
stt.SpeechToText speech = stt.SpeechToText(); stt.SpeechToText speech = stt.SpeechToText();
var reconizedWord; var reconizedWord;
@ -46,7 +45,6 @@ class _AddReplayOnReferralPatientState extends State<AddReplayOnReferralPatient>
super.initState(); super.initState();
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return AppScaffold( return AppScaffold(
@ -84,12 +82,13 @@ class _AddReplayOnReferralPatientState extends State<AddReplayOnReferralPatient>
: null, : null,
), ),
Positioned( Positioned(
top: 0,//MediaQuery.of(context).size.height * 0, top: 0, //MediaQuery.of(context).size.height * 0,
right: 15, right: 15,
child: IconButton( child: IconButton(
icon: Icon( icon: Icon(
DoctorApp.speechtotext, DoctorApp.speechtotext,
color: Colors.black, color: Colors.black,
size: 35,
), ),
onPressed: () { onPressed: () {
onVoiceText(); onVoiceText();
@ -112,7 +111,23 @@ class _AddReplayOnReferralPatientState extends State<AddReplayOnReferralPatient>
child: Wrap( child: Wrap(
alignment: WrapAlignment.center, alignment: WrapAlignment.center,
children: <Widget>[ children: <Widget>[
AppButton( progressNoteController.text.isEmpty
? SizedBox()
: Container(
margin: EdgeInsets.all(5),
child: Expanded(
child: AppButton(
title: TranslationBase.of(context).clearText,
onPressed: () {
setState(() {
progressNoteController.text = '';
});
},
)),
),
Container(
margin: EdgeInsets.all(5),
child: AppButton(
title: 'Submit Replay', title: 'Submit Replay',
color: Color(0xff359846), color: Color(0xff359846),
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
@ -122,22 +137,27 @@ class _AddReplayOnReferralPatientState extends State<AddReplayOnReferralPatient>
}); });
if (progressNoteController.text.isNotEmpty) { if (progressNoteController.text.isNotEmpty) {
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
await widget.patientReferralViewModel.replay(progressNoteController.text.trim(), widget.myReferralInPatientModel); await widget.patientReferralViewModel.replay(
if (widget.patientReferralViewModel.state == ViewState.ErrorLocal) { progressNoteController.text.trim(),
Helpers.showErrorToast(widget.patientReferralViewModel.error); widget.myReferralInPatientModel);
if (widget.patientReferralViewModel.state ==
ViewState.ErrorLocal) {
Helpers.showErrorToast(
widget.patientReferralViewModel.error);
} else { } else {
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
DrAppToastMsg.showSuccesToast("Your Replay Added Successfully"); DrAppToastMsg.showSuccesToast(
"Your Replay Added Successfully");
Navigator.of(context).pop(); Navigator.of(context).pop();
Navigator.of(context).pop(); Navigator.of(context).pop();
} }
}else { } else {
Helpers.showErrorToast("You can't add empty replay"); Helpers.showErrorToast("You can't add empty replay");
setState(() { setState(() {
isSubmitted = false; isSubmitted = false;
}); });
} }
}), })),
], ],
), ),
), ),
@ -179,7 +199,7 @@ class _AddReplayOnReferralPatientState extends State<AddReplayOnReferralPatient>
if (result.finalResult == true) { if (result.finalResult == true) {
setState(() { setState(() {
SpeechToText.closeAlertDialog(context); SpeechToText.closeAlertDialog(context);
progressNoteController.text = reconizedWord; progressNoteController.text += reconizedWord + '\n';
}); });
} }
} }

@ -22,6 +22,7 @@ import 'package:intl/intl.dart';
import 'package:permission_handler/permission_handler.dart'; import 'package:permission_handler/permission_handler.dart';
import 'package:speech_to_text/speech_recognition_error.dart'; 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 PatientMakeInPatientReferralScreen extends StatefulWidget { class PatientMakeInPatientReferralScreen extends StatefulWidget {
@override @override
_PatientMakeInPatientReferralScreenState createState() => _PatientMakeInPatientReferralScreenState createState() =>
@ -104,7 +105,7 @@ class _PatientMakeInPatientReferralScreenState
setState(() { setState(() {
SpeechToText.closeAlertDialog(context); SpeechToText.closeAlertDialog(context);
speech.stop(); speech.stop();
_remarksController.text = reconizedWord; _remarksController.text += reconizedWord + '\n';
}); });
} else { } else {
print(result.finalResult); print(result.finalResult);
@ -146,7 +147,11 @@ class _PatientMakeInPatientReferralScreenState
appBarTitle: TranslationBase.of(context).referPatient, appBarTitle: TranslationBase.of(context).referPatient,
isShowAppBar: true, isShowAppBar: true,
appBar: PatientProfileHeaderNewDesignAppBar( appBar: PatientProfileHeaderNewDesignAppBar(
patient, patientType, arrivalType,isInpatient: isInpatient,), patient,
patientType,
arrivalType,
isInpatient: isInpatient,
),
body: SingleChildScrollView( body: SingleChildScrollView(
child: Container( child: Container(
child: Column( child: Column(
@ -466,19 +471,21 @@ class _PatientMakeInPatientReferralScreenState
Stack( Stack(
children: [ children: [
AppTextFieldCustom( AppTextFieldCustom(
hintText:"Remarks", hintText: "Remarks",
controller: _remarksController, controller: _remarksController,
inputType: TextInputType.multiline, inputType: TextInputType.multiline,
minLines: 4, minLines: 4,
maxLines: 6, maxLines: 6,
), ),
Positioned( Positioned(
top: 0, //MediaQuery.of(context).size.height * 0, top:
0, //MediaQuery.of(context).size.height * 0,
right: 15, right: 15,
child: IconButton( child: IconButton(
icon: Icon( icon: Icon(
DoctorApp.speechtotext, DoctorApp.speechtotext,
color: Colors.black, color: Colors.black,
size: 35,
), ),
onPressed: () { onPressed: () {
initSpeechState() initSpeechState()
@ -493,13 +500,28 @@ class _PatientMakeInPatientReferralScreenState
) )
], ],
), ),
Column(
children: [
_remarksController.text.isEmpty
? SizedBox()
: Container(
margin: EdgeInsets.all(5),
child: Expanded(
child: AppButton(
title: TranslationBase.of(context).clearText,
onPressed: () {
setState(() {
_remarksController.text = '';
});
},
))),
Container( Container(
margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8), margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8),
child: AppButton( child: AppButton(
title: TranslationBase.of(context).refer, title: TranslationBase.of(context).refer,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
color: Color(0XFF359846), color: Color(0XFF359846),
onPressed: () async{ onPressed: () async {
setState(() { setState(() {
if (_referTo == null) { if (_referTo == null) {
branchError = branchError =
@ -537,31 +559,34 @@ class _PatientMakeInPatientReferralScreenState
_selectedClinic == null || _selectedClinic == null ||
_selectedDoctor == null || _selectedDoctor == null ||
_remarksController.text == null || _remarksController.text == null ||
_extController.text == null) return;{ _extController.text == null) return;
{
await model.makeInPatientReferral( await model.makeInPatientReferral(
patient: patient, patient: patient,
projectID: _selectedBranch['facilityId'], projectID: _selectedBranch['facilityId'],
clinicID: _selectedClinic['ClinicID'], clinicID: _selectedClinic['ClinicID'],
doctorID: _selectedDoctor['DoctorID'], doctorID: _selectedDoctor['DoctorID'],
frequencyCode: _selectedFrequency['ParameterCode'], frequencyCode:
_selectedFrequency['ParameterCode'],
ext: _extController.text, ext: _extController.text,
remarks: _remarksController.text, remarks: _remarksController.text,
priority: _activePriority, priority: _activePriority,
referralDate: appointmentDate referralDate: appointmentDate);
); if (model.state == ViewState.ErrorLocal)
if(model.state == ViewState.ErrorLocal)
DrAppToastMsg.showErrorToast(model.error); DrAppToastMsg.showErrorToast(model.error);
else{ else {
DrAppToastMsg.showSuccesToast(TranslationBase.of(context).referralSuccessMsg); DrAppToastMsg.showSuccesToast(
TranslationBase.of(context)
.referralSuccessMsg);
Navigator.pop(context); Navigator.pop(context);
} }
} }
}, },
), ),
) )
], ],
)
],
), ),
), ),
), ),

@ -1301,41 +1301,34 @@ class TranslationBase {
String get insurance22 => localizedValues["insurance22"][locale.languageCode]; String get insurance22 => localizedValues["insurance22"][locale.languageCode];
String get approvals22 => localizedValues["approvals22"][locale.languageCode]; String get approvals22 => localizedValues["approvals22"][locale.languageCode];
String get severe => localizedValues["severe"][locale.languageCode]; String get severe => localizedValues["severe"][locale.languageCode];
String get graphDetails => localizedValues["graphDetails"][locale.languageCode]; String get graphDetails =>
localizedValues["graphDetails"][locale.languageCode];
String get discharged => localizedValues["discharged"][locale.languageCode]; String get discharged => localizedValues["discharged"][locale.languageCode];
String get addNewOrderSheet => String get addNewOrderSheet =>
localizedValues["addNewOrderSheet"][locale.languageCode]; localizedValues["addNewOrderSheet"][locale.languageCode];
String get addNewProgressNote => String get addNewProgressNote =>
localizedValues["addNewProgressNote"][locale.languageCode]; localizedValues["addNewProgressNote"][locale.languageCode];
String get notePending => String get notePending => localizedValues["notePending"][locale.languageCode];
localizedValues["notePending"][locale.languageCode];
String get noteCanceled => String get noteCanceled =>
localizedValues["noteCanceled"][locale.languageCode]; localizedValues["noteCanceled"][locale.languageCode];
String get noteVerified => String get noteVerified =>
localizedValues["noteVerified"][locale.languageCode]; localizedValues["noteVerified"][locale.languageCode];
String get noteVerify => String get noteVerify => localizedValues["noteVerify"][locale.languageCode];
localizedValues["noteVerify"][locale.languageCode]; String get noteConfirm => localizedValues["noteConfirm"][locale.languageCode];
String get noteConfirm => String get noteAdd => localizedValues["noteAdd"][locale.languageCode];
localizedValues["noteConfirm"][locale.languageCode];
String get noteAdd => String get noteUpdate => localizedValues["noteUpdate"][locale.languageCode];
localizedValues["noteAdd"][locale.languageCode];
String get orderSheet => localizedValues["orderSheet"][locale.languageCode];
String get noteUpdate => String get order => localizedValues["order"][locale.languageCode];
localizedValues["noteUpdate"][locale.languageCode]; String get sheet => localizedValues["sheet"][locale.languageCode];
String get medical => localizedValues["medical"][locale.languageCode];
String get orderSheet => String get report => localizedValues["report"][locale.languageCode];
localizedValues["orderSheet"][locale.languageCode];
String get order =>
localizedValues["order"][locale.languageCode];
String get sheet =>
localizedValues["sheet"][locale.languageCode];
String get medical =>
localizedValues["medical"][locale.languageCode];
String get report =>
localizedValues["report"][locale.languageCode];
String get discharge => localizedValues["discharge"][locale.languageCode]; String get discharge => localizedValues["discharge"][locale.languageCode];
String get none => localizedValues["none"][locale.languageCode]; String get none => localizedValues["none"][locale.languageCode];
String get notRepliedYet => localizedValues["notRepliedYet"][locale.languageCode]; String get notRepliedYet =>
localizedValues["notRepliedYet"][locale.languageCode];
String get clearText => localizedValues["clearText"][locale.languageCode];
} }
class TranslationBaseDelegate extends LocalizationsDelegate<TranslationBase> { class TranslationBaseDelegate extends LocalizationsDelegate<TranslationBase> {

Loading…
Cancel
Save