|
|
|
|
@ -8,6 +8,7 @@ import 'package:doctor_app_flutter/core/provider/robot_provider.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/core/service/AnalyticsService.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/core/viewModel/medicine_view_model.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/core/viewModel/prescription/prescription_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/locator.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/screens/prescription/prescription_text_filed.dart';
|
|
|
|
|
@ -17,10 +18,12 @@ import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/utils/utils.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/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/TextFields.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:flutter/services.dart';
|
|
|
|
|
import 'package:hexcolor/hexcolor.dart';
|
|
|
|
|
import 'package:speech_to_text/speech_recognition_error.dart';
|
|
|
|
|
import 'package:speech_to_text/speech_to_text.dart' as stt;
|
|
|
|
|
@ -249,6 +252,51 @@ getIcdCodeData() async{
|
|
|
|
|
},
|
|
|
|
|
hintText: TranslationBase.of(context).route,
|
|
|
|
|
),
|
|
|
|
|
Visibility(
|
|
|
|
|
visible: ProjectViewModel.getVidaPlusStatus() == true,
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
SizedBox(height: spaceBetweenTextFields),
|
|
|
|
|
AppTextFieldCustom(
|
|
|
|
|
hintText: TranslationBase.of(context).duration,
|
|
|
|
|
validationError: durationError,
|
|
|
|
|
inputFormatters: [
|
|
|
|
|
FilteringTextInputFormatter.digitsOnly
|
|
|
|
|
],
|
|
|
|
|
enabled: true,
|
|
|
|
|
inputType: TextInputType.numberWithOptions(decimal: false),
|
|
|
|
|
onChanged: (value) {
|
|
|
|
|
if (value == null || value == "") return;
|
|
|
|
|
|
|
|
|
|
if (int.parse(value) < 0) {
|
|
|
|
|
DrAppToastMsg.showErrorToast(TranslationBase.of(context).durationCannotBeNegative);
|
|
|
|
|
setState(() {
|
|
|
|
|
durationError = TranslationBase.of(context).durationCannotBeNegative;
|
|
|
|
|
});
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (int.parse(value) > 365) {
|
|
|
|
|
DrAppToastMsg.showErrorToast(TranslationBase.of(context).durationCannotBeGreaterThan365);
|
|
|
|
|
setState(() {
|
|
|
|
|
durationError = TranslationBase.of(context).durationCannotBeGreaterThan365;
|
|
|
|
|
});
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
setState(() {
|
|
|
|
|
duration = value;
|
|
|
|
|
durationError = null;
|
|
|
|
|
frequency = null;
|
|
|
|
|
if (widget.selectedMedication != null && duration != null && frequency != null && strengthController.text != null) {
|
|
|
|
|
box = widget.medicineViewModel.boxQuintity;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
onFieldSubmitted: () {},
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: spaceBetweenTextFields),
|
|
|
|
|
PrescriptionTextFiled(
|
|
|
|
|
hintText: TranslationBase.of(context).frequency,
|
|
|
|
|
@ -258,17 +306,24 @@ getIcdCodeData() async{
|
|
|
|
|
elementList: widget.medicineViewModel.itemMedicineList,
|
|
|
|
|
keyId: 'parameterCode',
|
|
|
|
|
keyName: 'description',
|
|
|
|
|
okFunction: (selectedValue) {
|
|
|
|
|
okFunction: (selectedValue) async {
|
|
|
|
|
setState(() {
|
|
|
|
|
frequency = selectedValue;
|
|
|
|
|
frequency['isDefault'] = true;
|
|
|
|
|
if (widget.selectedMedication != null && duration != null && frequency != null && strengthController.text != null) {
|
|
|
|
|
widget.medicineViewModel
|
|
|
|
|
.getBoxQuantity(freq: frequency['parameterCode'], duration: duration['id'], itemCode: widget.selectedMedication.itemId, strength: double.parse(strengthController.text));
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
if (widget.selectedMedication != null && duration != null && frequency != null && strengthController.text != null) {
|
|
|
|
|
if(ProjectViewModel.getVidaPlusStatus() && units == null){
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
var duration = ProjectViewModel.getVidaPlusStatus() ? int.parse(this.duration) : this.duration['id'];
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
await widget.medicineViewModel.getBoxQuantity(
|
|
|
|
|
showLoader: false, freq: frequency['parameterCode'], duration: duration, itemCode: widget.selectedMedication.itemId, strength: double.parse(strengthController.text), unitCode:
|
|
|
|
|
units['parameterCode']);
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
box = widget.medicineViewModel.boxQuintity;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}),
|
|
|
|
|
SizedBox(height: spaceBetweenTextFields),
|
|
|
|
|
PrescriptionTextFiled(
|
|
|
|
|
@ -364,33 +419,36 @@ getIcdCodeData() async{
|
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
: widget.medicineViewModel.patientAssessmentList.isNotEmpty ?
|
|
|
|
|
Container(
|
|
|
|
|
height: screenSize.height * 0.068,
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
Material(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
width: MediaQuery.of(context).size.width * 0.29,
|
|
|
|
|
child: AppTextFieldCustom(
|
|
|
|
|
hintText: widget.medicineViewModel.patientAssessmentList[0].icdCode10ID.toString(),
|
|
|
|
|
enabled: true,
|
|
|
|
|
onChanged: (value) {},
|
|
|
|
|
onFieldSubmitted: () {},
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: const EdgeInsets.all(8.0),
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
Flexible(
|
|
|
|
|
flex:1,
|
|
|
|
|
child: AppTextFieldCustom(
|
|
|
|
|
hintText: "",
|
|
|
|
|
hideHint: true,
|
|
|
|
|
controller: TextEditingController( text:widget.medicineViewModel.patientAssessmentList.firstOrNull?.icdCode10ID?.toString()??""),
|
|
|
|
|
enabled: false,
|
|
|
|
|
onChanged: (value) {},
|
|
|
|
|
onFieldSubmitted: () {},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
width: MediaQuery.of(context).size.width * 0.57,
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
child: AppTextFieldCustom(
|
|
|
|
|
maxLines: 5,
|
|
|
|
|
hintText: widget.medicineViewModel.patientAssessmentList[0].asciiDesc.toString(),
|
|
|
|
|
enabled: true,
|
|
|
|
|
onChanged: (value) {},
|
|
|
|
|
onFieldSubmitted: () {},
|
|
|
|
|
Flexible(flex: 2,
|
|
|
|
|
child: AppTextFieldCustom(
|
|
|
|
|
maxLines: 5,
|
|
|
|
|
hintText:"",
|
|
|
|
|
hideHint: true,
|
|
|
|
|
controller: TextEditingController( text:widget.medicineViewModel.patientAssessmentList.firstOrNull?.asciiDesc?.toString()??""),
|
|
|
|
|
enabled: false,
|
|
|
|
|
onChanged: (value) {},
|
|
|
|
|
onFieldSubmitted: () {},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
) :SizedBox(),
|
|
|
|
|
SizedBox(height: spaceBetweenTextFields),
|
|
|
|
|
@ -420,24 +478,31 @@ getIcdCodeData() async{
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: spaceBetweenTextFields),
|
|
|
|
|
PrescriptionTextFiled(
|
|
|
|
|
element: duration,
|
|
|
|
|
elementError: durationError,
|
|
|
|
|
hintText: TranslationBase.of(context).duration,
|
|
|
|
|
elementList: widget.medicineViewModel.medicationDurationList,
|
|
|
|
|
keyName: 'nameEn',
|
|
|
|
|
keyId: 'id',
|
|
|
|
|
okFunction: (selectedValue) {
|
|
|
|
|
setState(() {
|
|
|
|
|
duration = selectedValue;
|
|
|
|
|
if (widget.selectedMedication != null && duration != null && frequency != null && strengthController.text != null) {
|
|
|
|
|
box = widget.medicineViewModel.boxQuintity;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
Visibility(
|
|
|
|
|
visible: ProjectViewModel.getVidaPlusStatus() == false,
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
PrescriptionTextFiled(
|
|
|
|
|
element: duration,
|
|
|
|
|
elementError: durationError,
|
|
|
|
|
hintText: TranslationBase.of(context).duration,
|
|
|
|
|
elementList: widget.medicineViewModel.medicationDurationList,
|
|
|
|
|
keyName: 'nameEn',
|
|
|
|
|
keyId: 'id',
|
|
|
|
|
okFunction: (selectedValue) {
|
|
|
|
|
setState(() {
|
|
|
|
|
duration = selectedValue;
|
|
|
|
|
if (widget.selectedMedication != null && duration != null && frequency != null && strengthController.text != null) {
|
|
|
|
|
box = widget.medicineViewModel.boxQuintity;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: spaceBetweenTextFields),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: spaceBetweenTextFields),
|
|
|
|
|
Container(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
child: AppTextFieldCustom(
|
|
|
|
|
@ -550,6 +615,25 @@ getIcdCodeData() async{
|
|
|
|
|
DrAppToastMsg.showErrorToast(TranslationBase.of(context).strengthCanNotBeZero);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
//adding the vida plus validation for duration
|
|
|
|
|
if (ProjectViewModel.getVidaPlusStatus()) {
|
|
|
|
|
if (duration == null) {
|
|
|
|
|
durationError = TranslationBase.of(context).fieldRequired;
|
|
|
|
|
return;
|
|
|
|
|
} else if (int.parse(duration) < 0) {
|
|
|
|
|
setState(() {
|
|
|
|
|
durationError = TranslationBase.of(context).durationCannotBeNegative;
|
|
|
|
|
});
|
|
|
|
|
return;
|
|
|
|
|
} else if (int.parse(duration) > 365) {
|
|
|
|
|
setState(() {
|
|
|
|
|
durationError = TranslationBase.of(context).durationCannotBeGreaterThan365;
|
|
|
|
|
});
|
|
|
|
|
return;
|
|
|
|
|
} else {
|
|
|
|
|
durationError = null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (formKey.currentState!.validate()) {
|
|
|
|
|
Navigator.push(
|
|
|
|
|
|