|
|
|
@ -2,6 +2,7 @@ import 'package:autocomplete_textfield/autocomplete_textfield.dart';
|
|
|
|
import 'package:doctor_app_flutter/config/config.dart';
|
|
|
|
import 'package:doctor_app_flutter/config/config.dart';
|
|
|
|
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/Prescriptions/prescription_model.dart';
|
|
|
|
import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_model.dart';
|
|
|
|
|
|
|
|
import 'package:doctor_app_flutter/core/model/patient/patiant_info_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/provider/robot_provider.dart';
|
|
|
|
import 'package:doctor_app_flutter/core/service/AnalyticsService.dart';
|
|
|
|
import 'package:doctor_app_flutter/core/service/AnalyticsService.dart';
|
|
|
|
@ -9,7 +10,6 @@ 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/icons_app/doctor_app_icons.dart';
|
|
|
|
import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart';
|
|
|
|
import 'package:doctor_app_flutter/locator.dart';
|
|
|
|
import 'package:doctor_app_flutter/locator.dart';
|
|
|
|
import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';
|
|
|
|
|
|
|
|
import 'package:doctor_app_flutter/screens/prescription/prescription_text_filed.dart';
|
|
|
|
import 'package:doctor_app_flutter/screens/prescription/prescription_text_filed.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/dr_app_toast_msg.dart';
|
|
|
|
import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart';
|
|
|
|
@ -25,19 +25,23 @@ import 'package:flutter/services.dart';
|
|
|
|
import 'package:hexcolor/hexcolor.dart';
|
|
|
|
import 'package:hexcolor/hexcolor.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;
|
|
|
|
import 'add_drug_widget.dart';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import 'add_drug_widget.dart';
|
|
|
|
|
|
|
|
|
|
|
|
class PrescriptionFormWidget extends StatefulWidget {
|
|
|
|
class PrescriptionFormWidget extends StatefulWidget {
|
|
|
|
final PatiantInformtion patient;
|
|
|
|
final PatiantInformtion patient;
|
|
|
|
final List<PrescriptionModel> prescriptionList;
|
|
|
|
final List<PrescriptionModel> prescriptionList;
|
|
|
|
final PrescriptionViewModel prescriptionViewModel;
|
|
|
|
final PrescriptionViewModel prescriptionViewModel;
|
|
|
|
final MedicineViewModel medicineViewModel;
|
|
|
|
final MedicineViewModel medicineViewModel;
|
|
|
|
|
|
|
|
final GetMedicationResponseModel selectedMedication;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const PrescriptionFormWidget(
|
|
|
|
const PrescriptionFormWidget({Key key, this.patient, this.prescriptionList,
|
|
|
|
{Key key,
|
|
|
|
this.prescriptionViewModel, this.medicineViewModel,});
|
|
|
|
this.patient,
|
|
|
|
|
|
|
|
this.prescriptionList,
|
|
|
|
|
|
|
|
this.prescriptionViewModel,
|
|
|
|
|
|
|
|
this.medicineViewModel,
|
|
|
|
|
|
|
|
this.selectedMedication});
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
_PrescriptionFormWidgetState createState() => _PrescriptionFormWidgetState();
|
|
|
|
_PrescriptionFormWidgetState createState() => _PrescriptionFormWidgetState();
|
|
|
|
@ -64,7 +68,6 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
final myController = TextEditingController();
|
|
|
|
final myController = TextEditingController();
|
|
|
|
DateTime selectedDate;
|
|
|
|
DateTime selectedDate;
|
|
|
|
int strengthChar;
|
|
|
|
int strengthChar;
|
|
|
|
GetMedicationResponseModel _selectedMedication;
|
|
|
|
|
|
|
|
PrescriptionViewModel prescriptionViewModel;
|
|
|
|
PrescriptionViewModel prescriptionViewModel;
|
|
|
|
|
|
|
|
|
|
|
|
GlobalKey key =
|
|
|
|
GlobalKey key =
|
|
|
|
@ -89,7 +92,6 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
dynamic box;
|
|
|
|
dynamic box;
|
|
|
|
dynamic x;
|
|
|
|
dynamic x;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setSelectedType(int val) {
|
|
|
|
setSelectedType(int val) {
|
|
|
|
setState(() {
|
|
|
|
setState(() {
|
|
|
|
selectedType = val;
|
|
|
|
selectedType = val;
|
|
|
|
@ -153,13 +155,10 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
final screenSize = MediaQuery.of(context).size;
|
|
|
|
final screenSize = MediaQuery.of(context).size;
|
|
|
|
return Visibility(
|
|
|
|
return Column(
|
|
|
|
visible: visibilitySearch,
|
|
|
|
|
|
|
|
child: Column(
|
|
|
|
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
AppText(
|
|
|
|
AppText(
|
|
|
|
_selectedMedication?.description ??
|
|
|
|
widget.selectedMedication?.description ?? "",
|
|
|
|
"",
|
|
|
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
SizedBox(
|
|
|
|
@ -169,24 +168,25 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
child: Row(
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
SizedBox(width: 6,),
|
|
|
|
SizedBox(
|
|
|
|
|
|
|
|
width: 6,
|
|
|
|
|
|
|
|
),
|
|
|
|
AppText(
|
|
|
|
AppText(
|
|
|
|
TranslationBase.of(context)
|
|
|
|
TranslationBase.of(context).orderType,
|
|
|
|
.orderType,
|
|
|
|
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(width: 18,),
|
|
|
|
SizedBox(
|
|
|
|
|
|
|
|
width: 18,
|
|
|
|
|
|
|
|
),
|
|
|
|
Radio(
|
|
|
|
Radio(
|
|
|
|
activeColor:
|
|
|
|
activeColor: AppGlobal.appRedColor,
|
|
|
|
AppGlobal.appRedColor,
|
|
|
|
|
|
|
|
value: 1,
|
|
|
|
value: 1,
|
|
|
|
groupValue: selectedType,
|
|
|
|
groupValue: selectedType,
|
|
|
|
onChanged: (value) {
|
|
|
|
onChanged: (value) {
|
|
|
|
setSelectedType(value);
|
|
|
|
setSelectedType(value);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Text(TranslationBase.of(context)
|
|
|
|
Text(TranslationBase.of(context).regular),
|
|
|
|
.regular),
|
|
|
|
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
@ -195,35 +195,26 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
child: Row(
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
Container(
|
|
|
|
width: MediaQuery.of(context)
|
|
|
|
width: MediaQuery.of(context).size.width * 0.35,
|
|
|
|
.size
|
|
|
|
|
|
|
|
.width *
|
|
|
|
|
|
|
|
0.35,
|
|
|
|
|
|
|
|
child: AppTextFieldCustom(
|
|
|
|
child: AppTextFieldCustom(
|
|
|
|
height: 38,
|
|
|
|
height: 38,
|
|
|
|
validationError:
|
|
|
|
validationError: strengthError,
|
|
|
|
strengthError,
|
|
|
|
|
|
|
|
hintText: 'Strength',
|
|
|
|
hintText: 'Strength',
|
|
|
|
isTextFieldHasSuffix: false,
|
|
|
|
isTextFieldHasSuffix: false,
|
|
|
|
enabled: true,
|
|
|
|
enabled: true,
|
|
|
|
controller:
|
|
|
|
controller: strengthController,
|
|
|
|
strengthController,
|
|
|
|
|
|
|
|
onChanged: (String value) {
|
|
|
|
onChanged: (String value) {
|
|
|
|
setState(() {
|
|
|
|
setState(() {
|
|
|
|
strengthChar =
|
|
|
|
strengthChar = value.length;
|
|
|
|
value.length;
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
if (strengthChar >= 5) {
|
|
|
|
if (strengthChar >= 5) {
|
|
|
|
DrAppToastMsg
|
|
|
|
DrAppToastMsg.showErrorToast(
|
|
|
|
.showErrorToast(
|
|
|
|
TranslationBase.of(context)
|
|
|
|
TranslationBase.of(
|
|
|
|
|
|
|
|
context)
|
|
|
|
|
|
|
|
.only5DigitsAllowedForStrength,
|
|
|
|
.only5DigitsAllowedForStrength,
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
inputType: TextInputType
|
|
|
|
inputType: TextInputType.numberWithOptions(
|
|
|
|
.numberWithOptions(
|
|
|
|
|
|
|
|
decimal: true,
|
|
|
|
decimal: true,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
@ -266,23 +257,16 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
PrescriptionTextFiled(
|
|
|
|
PrescriptionTextFiled(
|
|
|
|
width: MediaQuery.of(context)
|
|
|
|
width: MediaQuery.of(context).size.width * 0.510,
|
|
|
|
.size
|
|
|
|
element:
|
|
|
|
.width *
|
|
|
|
widget.medicineViewModel.itemMedicineListUnit.length == 1
|
|
|
|
0.510,
|
|
|
|
? widget.medicineViewModel.itemMedicineListUnit[0]
|
|
|
|
element: widget.medicineViewModel
|
|
|
|
|
|
|
|
.itemMedicineListUnit
|
|
|
|
|
|
|
|
.length ==
|
|
|
|
|
|
|
|
1
|
|
|
|
|
|
|
|
? widget.medicineViewModel
|
|
|
|
|
|
|
|
.itemMedicineListUnit[0]
|
|
|
|
|
|
|
|
: units,
|
|
|
|
: units,
|
|
|
|
elementError: unitError,
|
|
|
|
elementError: unitError,
|
|
|
|
keyName: 'description',
|
|
|
|
keyName: 'description',
|
|
|
|
keyId: 'parameterCode',
|
|
|
|
keyId: 'parameterCode',
|
|
|
|
hintText: 'Unit',
|
|
|
|
hintText: 'Unit',
|
|
|
|
elementList: widget.medicineViewModel
|
|
|
|
elementList: widget.medicineViewModel.itemMedicineListUnit,
|
|
|
|
.itemMedicineListUnit,
|
|
|
|
|
|
|
|
okFunction: (selectedValue) {
|
|
|
|
okFunction: (selectedValue) {
|
|
|
|
setState(() {
|
|
|
|
setState(() {
|
|
|
|
units = selectedValue;
|
|
|
|
units = selectedValue;
|
|
|
|
@ -293,14 +277,10 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
SizedBox(height: spaceBetweenTextFields),
|
|
|
|
height: spaceBetweenTextFields),
|
|
|
|
|
|
|
|
PrescriptionTextFiled(
|
|
|
|
PrescriptionTextFiled(
|
|
|
|
elementList:
|
|
|
|
elementList: widget.medicineViewModel.itemMedicineListRoute,
|
|
|
|
widget.medicineViewModel.itemMedicineListRoute,
|
|
|
|
element: widget.medicineViewModel.itemMedicineListRoute.length == 1
|
|
|
|
element: widget.medicineViewModel.itemMedicineListRoute
|
|
|
|
|
|
|
|
.length ==
|
|
|
|
|
|
|
|
1
|
|
|
|
|
|
|
|
? route = widget.medicineViewModel.itemMedicineListRoute[0]
|
|
|
|
? route = widget.medicineViewModel.itemMedicineListRoute[0]
|
|
|
|
: route,
|
|
|
|
: route,
|
|
|
|
elementError: routeError,
|
|
|
|
elementError: routeError,
|
|
|
|
@ -312,19 +292,14 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
route['isDefault'] = true;
|
|
|
|
route['isDefault'] = true;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
hintText:
|
|
|
|
hintText: TranslationBase.of(context).route,
|
|
|
|
TranslationBase.of(context)
|
|
|
|
|
|
|
|
.route,
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
SizedBox(height: spaceBetweenTextFields),
|
|
|
|
height: spaceBetweenTextFields),
|
|
|
|
|
|
|
|
PrescriptionTextFiled(
|
|
|
|
PrescriptionTextFiled(
|
|
|
|
hintText: TranslationBase.of(context).frequency,
|
|
|
|
hintText: TranslationBase.of(context).frequency,
|
|
|
|
elementError: frequencyError,
|
|
|
|
elementError: frequencyError,
|
|
|
|
// element: frequency,
|
|
|
|
// element: frequency,
|
|
|
|
element: widget.medicineViewModel.itemMedicineListRoute
|
|
|
|
element: widget.medicineViewModel.itemMedicineListRoute.length == 1
|
|
|
|
.length ==
|
|
|
|
|
|
|
|
1
|
|
|
|
|
|
|
|
? frequency = widget.medicineViewModel.itemMedicineListRoute[0]
|
|
|
|
? frequency = widget.medicineViewModel.itemMedicineListRoute[0]
|
|
|
|
: frequency,
|
|
|
|
: frequency,
|
|
|
|
elementList: widget.medicineViewModel.itemMedicineList,
|
|
|
|
elementList: widget.medicineViewModel.itemMedicineList,
|
|
|
|
@ -334,28 +309,26 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
setState(() {
|
|
|
|
setState(() {
|
|
|
|
frequency = selectedValue;
|
|
|
|
frequency = selectedValue;
|
|
|
|
frequency['isDefault'] = true;
|
|
|
|
frequency['isDefault'] = true;
|
|
|
|
if (_selectedMedication != null && duration != null && frequency != null && strengthController.text != null) {
|
|
|
|
if (widget.selectedMedication != null &&
|
|
|
|
|
|
|
|
duration != null &&
|
|
|
|
|
|
|
|
frequency != null &&
|
|
|
|
|
|
|
|
strengthController.text != null) {
|
|
|
|
widget.medicineViewModel.getBoxQuantity(
|
|
|
|
widget.medicineViewModel.getBoxQuantity(
|
|
|
|
freq: frequency['parameterCode'],
|
|
|
|
freq: frequency['parameterCode'],
|
|
|
|
duration: duration['id'],
|
|
|
|
duration: duration['id'],
|
|
|
|
itemCode: _selectedMedication.itemId,
|
|
|
|
itemCode: widget.selectedMedication.itemId,
|
|
|
|
strength: double.parse(strengthController.text)
|
|
|
|
strength: double.parse(strengthController.text));
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}),
|
|
|
|
}),
|
|
|
|
SizedBox(
|
|
|
|
SizedBox(height: spaceBetweenTextFields),
|
|
|
|
height: spaceBetweenTextFields),
|
|
|
|
|
|
|
|
PrescriptionTextFiled(
|
|
|
|
PrescriptionTextFiled(
|
|
|
|
hintText:
|
|
|
|
hintText: TranslationBase.of(context).doseTime,
|
|
|
|
TranslationBase.of(context)
|
|
|
|
|
|
|
|
.doseTime,
|
|
|
|
|
|
|
|
elementError: doseTimeError,
|
|
|
|
elementError: doseTimeError,
|
|
|
|
element: doseTime,
|
|
|
|
element: doseTime,
|
|
|
|
elementList:
|
|
|
|
elementList: widget.medicineViewModel.medicationDoseTimeList,
|
|
|
|
widget.medicineViewModel.medicationDoseTimeList,
|
|
|
|
|
|
|
|
keyId: 'id',
|
|
|
|
keyId: 'id',
|
|
|
|
keyName: 'nameEn',
|
|
|
|
keyName: 'nameEn',
|
|
|
|
okFunction: (selectedValue) {
|
|
|
|
okFunction: (selectedValue) {
|
|
|
|
@ -363,10 +336,8 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
doseTime = selectedValue;
|
|
|
|
doseTime = selectedValue;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}),
|
|
|
|
}),
|
|
|
|
SizedBox(
|
|
|
|
SizedBox(height: spaceBetweenTextFields),
|
|
|
|
height: spaceBetweenTextFields),
|
|
|
|
if (widget.medicineViewModel.patientAssessmentList.isNotEmpty)
|
|
|
|
if (widget.medicineViewModel
|
|
|
|
|
|
|
|
.patientAssessmentList.isNotEmpty)
|
|
|
|
|
|
|
|
Container(
|
|
|
|
Container(
|
|
|
|
height: screenSize.height * 0.070,
|
|
|
|
height: screenSize.height * 0.070,
|
|
|
|
width: double.infinity,
|
|
|
|
width: double.infinity,
|
|
|
|
@ -374,17 +345,10 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
child: Row(
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
Container(
|
|
|
|
width:
|
|
|
|
width: MediaQuery.of(context).size.width * 0.29,
|
|
|
|
MediaQuery.of(context)
|
|
|
|
|
|
|
|
.size
|
|
|
|
|
|
|
|
.width *
|
|
|
|
|
|
|
|
0.29,
|
|
|
|
|
|
|
|
child: AppTextFieldCustom(
|
|
|
|
child: AppTextFieldCustom(
|
|
|
|
hintText:
|
|
|
|
hintText: widget
|
|
|
|
widget.medicineViewModel
|
|
|
|
.medicineViewModel.patientAssessmentList[0].icdCode10ID
|
|
|
|
.patientAssessmentList[
|
|
|
|
|
|
|
|
0]
|
|
|
|
|
|
|
|
.icdCode10ID
|
|
|
|
|
|
|
|
.toString(),
|
|
|
|
.toString(),
|
|
|
|
// indication != null
|
|
|
|
// indication != null
|
|
|
|
// ? indication[
|
|
|
|
// ? indication[
|
|
|
|
@ -395,19 +359,12 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
Container(
|
|
|
|
width:
|
|
|
|
width: MediaQuery.of(context).size.width * 0.57,
|
|
|
|
MediaQuery.of(context)
|
|
|
|
|
|
|
|
.size
|
|
|
|
|
|
|
|
.width *
|
|
|
|
|
|
|
|
0.57,
|
|
|
|
|
|
|
|
color: Colors.white,
|
|
|
|
color: Colors.white,
|
|
|
|
child: AppTextFieldCustom(
|
|
|
|
child: AppTextFieldCustom(
|
|
|
|
maxLines: 5,
|
|
|
|
maxLines: 5,
|
|
|
|
hintText:
|
|
|
|
hintText: widget
|
|
|
|
widget.medicineViewModel
|
|
|
|
.medicineViewModel.patientAssessmentList[0].asciiDesc
|
|
|
|
.patientAssessmentList[
|
|
|
|
|
|
|
|
0]
|
|
|
|
|
|
|
|
.asciiDesc
|
|
|
|
|
|
|
|
.toString(),
|
|
|
|
.toString(),
|
|
|
|
// indication != null
|
|
|
|
// indication != null
|
|
|
|
// ? indication[
|
|
|
|
// ? indication[
|
|
|
|
@ -419,22 +376,20 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
SizedBox(height: spaceBetweenTextFields),
|
|
|
|
height: spaceBetweenTextFields),
|
|
|
|
|
|
|
|
Container(
|
|
|
|
Container(
|
|
|
|
color: Colors.transparent,
|
|
|
|
color: Colors.transparent,
|
|
|
|
child: InkWell(
|
|
|
|
child: InkWell(
|
|
|
|
onTap: () => selectDate(
|
|
|
|
onTap: () => selectDate(context, widget.prescriptionViewModel),
|
|
|
|
context, widget.prescriptionViewModel),
|
|
|
|
|
|
|
|
child: AppTextFieldCustom(
|
|
|
|
child: AppTextFieldCustom(
|
|
|
|
validationError:
|
|
|
|
validationError: strengthError,
|
|
|
|
strengthError,
|
|
|
|
|
|
|
|
hintText: 'Date',
|
|
|
|
hintText: 'Date',
|
|
|
|
isTextFieldHasSuffix: true,
|
|
|
|
isTextFieldHasSuffix: true,
|
|
|
|
suffixIcon: IconButton(
|
|
|
|
suffixIcon: IconButton(
|
|
|
|
icon: Icon(
|
|
|
|
icon: Icon(
|
|
|
|
Icons.calendar_today,
|
|
|
|
Icons.calendar_today,
|
|
|
|
color: Colors.black,),
|
|
|
|
color: Colors.black,
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
dropDownText: selectedDate != null
|
|
|
|
dropDownText: selectedDate != null
|
|
|
|
? "${AppDateUtils.convertStringToDateFormat(selectedDate.toString(), "yyyy-MM-dd")}"
|
|
|
|
? "${AppDateUtils.convertStringToDateFormat(selectedDate.toString(), "yyyy-MM-dd")}"
|
|
|
|
@ -461,37 +416,26 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
SizedBox(height: spaceBetweenTextFields),
|
|
|
|
height: spaceBetweenTextFields),
|
|
|
|
|
|
|
|
PrescriptionTextFiled(
|
|
|
|
PrescriptionTextFiled(
|
|
|
|
element: duration,
|
|
|
|
element: duration,
|
|
|
|
elementError: durationError,
|
|
|
|
elementError: durationError,
|
|
|
|
hintText:
|
|
|
|
hintText: TranslationBase.of(context).duration,
|
|
|
|
TranslationBase.of(context)
|
|
|
|
elementList: widget.medicineViewModel.medicationDurationList,
|
|
|
|
.duration,
|
|
|
|
|
|
|
|
elementList:
|
|
|
|
|
|
|
|
widget.medicineViewModel.medicationDurationList,
|
|
|
|
|
|
|
|
keyName: 'nameEn',
|
|
|
|
keyName: 'nameEn',
|
|
|
|
keyId: 'id',
|
|
|
|
keyId: 'id',
|
|
|
|
okFunction: (selectedValue) {
|
|
|
|
okFunction: (selectedValue) {
|
|
|
|
setState(() {
|
|
|
|
setState(() {
|
|
|
|
duration = selectedValue;
|
|
|
|
duration = selectedValue;
|
|
|
|
if (_selectedMedication !=
|
|
|
|
if (widget.selectedMedication != null &&
|
|
|
|
null &&
|
|
|
|
|
|
|
|
duration != null &&
|
|
|
|
duration != null &&
|
|
|
|
frequency != null &&
|
|
|
|
frequency != null &&
|
|
|
|
strengthController.text !=
|
|
|
|
strengthController.text != null) {
|
|
|
|
null) {
|
|
|
|
|
|
|
|
widget.medicineViewModel.getBoxQuantity(
|
|
|
|
widget.medicineViewModel.getBoxQuantity(
|
|
|
|
freq: frequency[
|
|
|
|
freq: frequency['parameterCode'],
|
|
|
|
'parameterCode'],
|
|
|
|
|
|
|
|
duration: duration['id'],
|
|
|
|
duration: duration['id'],
|
|
|
|
itemCode:
|
|
|
|
itemCode: widget.selectedMedication.itemId,
|
|
|
|
_selectedMedication
|
|
|
|
strength: double.parse(strengthController.text),
|
|
|
|
.itemId,
|
|
|
|
|
|
|
|
strength: double.parse(
|
|
|
|
|
|
|
|
strengthController
|
|
|
|
|
|
|
|
.text),
|
|
|
|
|
|
|
|
);
|
|
|
|
);
|
|
|
|
box = widget.medicineViewModel.boxQuintity;
|
|
|
|
box = widget.medicineViewModel.boxQuintity;
|
|
|
|
|
|
|
|
|
|
|
|
@ -500,26 +444,21 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
SizedBox(height: spaceBetweenTextFields),
|
|
|
|
height: spaceBetweenTextFields),
|
|
|
|
|
|
|
|
Container(
|
|
|
|
Container(
|
|
|
|
color: Colors.white,
|
|
|
|
color: Colors.white,
|
|
|
|
child: AppTextFieldCustom(
|
|
|
|
child: AppTextFieldCustom(
|
|
|
|
hintText: "UOM",
|
|
|
|
hintText: "UOM",
|
|
|
|
isTextFieldHasSuffix: false,
|
|
|
|
isTextFieldHasSuffix: false,
|
|
|
|
dropDownText:
|
|
|
|
dropDownText: uom != null ? uom : null,
|
|
|
|
uom != null ? uom : null,
|
|
|
|
|
|
|
|
enabled: false,
|
|
|
|
enabled: false,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
SizedBox(height: spaceBetweenTextFields),
|
|
|
|
height: spaceBetweenTextFields),
|
|
|
|
|
|
|
|
Container(
|
|
|
|
Container(
|
|
|
|
color: Colors.white,
|
|
|
|
color: Colors.white,
|
|
|
|
child: AppTextFieldCustom(
|
|
|
|
child: AppTextFieldCustom(
|
|
|
|
hintText:
|
|
|
|
hintText: TranslationBase.of(context).boxQuantity,
|
|
|
|
TranslationBase.of(context)
|
|
|
|
|
|
|
|
.boxQuantity,
|
|
|
|
|
|
|
|
isTextFieldHasSuffix: false,
|
|
|
|
isTextFieldHasSuffix: false,
|
|
|
|
dropDownText: box != null
|
|
|
|
dropDownText: box != null
|
|
|
|
? widget.medicineViewModel.boxQuintity.toString()
|
|
|
|
? widget.medicineViewModel.boxQuintity.toString()
|
|
|
|
@ -527,27 +466,18 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
enabled: false,
|
|
|
|
enabled: false,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
SizedBox(height: spaceBetweenTextFields),
|
|
|
|
height: spaceBetweenTextFields
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
Container(
|
|
|
|
Container(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
borderRadius: BorderRadius.all(
|
|
|
|
borderRadius: BorderRadius.all(Radius.circular(6.0)),
|
|
|
|
Radius.circular(6.0)),
|
|
|
|
border: Border.all(width: 1.0, color: HexColor("#CCCCCC"))),
|
|
|
|
border: Border.all(
|
|
|
|
|
|
|
|
width: 1.0,
|
|
|
|
|
|
|
|
color:
|
|
|
|
|
|
|
|
HexColor("#CCCCCC"))),
|
|
|
|
|
|
|
|
child: Stack(
|
|
|
|
child: Stack(
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
TextFields(
|
|
|
|
TextFields(
|
|
|
|
maxLines: 6,
|
|
|
|
maxLines: 6,
|
|
|
|
minLines: 4,
|
|
|
|
minLines: 4,
|
|
|
|
hintText: TranslationBase.of(
|
|
|
|
hintText: TranslationBase.of(context).instruction,
|
|
|
|
context)
|
|
|
|
controller: instructionController,
|
|
|
|
.instruction,
|
|
|
|
|
|
|
|
controller:
|
|
|
|
|
|
|
|
instructionController,
|
|
|
|
|
|
|
|
//keyboardType: TextInputType.number,
|
|
|
|
//keyboardType: TextInputType.number,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Positioned(
|
|
|
|
Positioned(
|
|
|
|
@ -560,38 +490,31 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
size: 35,
|
|
|
|
size: 35,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
onPressed: () {
|
|
|
|
onPressed: () {
|
|
|
|
initSpeechState().then(
|
|
|
|
initSpeechState().then((value) => {onVoiceText()});
|
|
|
|
(value) =>
|
|
|
|
|
|
|
|
{onVoiceText()});
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
SizedBox(height: spaceBetweenTextFields),
|
|
|
|
height: spaceBetweenTextFields),
|
|
|
|
|
|
|
|
Container(
|
|
|
|
Container(
|
|
|
|
margin: EdgeInsets.all(
|
|
|
|
margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5),
|
|
|
|
SizeConfig.widthMultiplier * 5),
|
|
|
|
|
|
|
|
child: Wrap(
|
|
|
|
child: Wrap(
|
|
|
|
alignment: WrapAlignment.center,
|
|
|
|
alignment: WrapAlignment.center,
|
|
|
|
children: <Widget>[
|
|
|
|
children: <Widget>[
|
|
|
|
AppButton(
|
|
|
|
AppButton(
|
|
|
|
color: Color(0xff359846),
|
|
|
|
color: Color(0xff359846),
|
|
|
|
title: TranslationBase.of(
|
|
|
|
title: TranslationBase.of(context).addMedication,
|
|
|
|
context)
|
|
|
|
|
|
|
|
.addMedication,
|
|
|
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
onPressed: () async {
|
|
|
|
onPressed: () async {
|
|
|
|
addMedicationButton( widget.medicineViewModel);
|
|
|
|
addMedicationButton(widget.medicineViewModel);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -613,7 +536,8 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
openDrugToDrug(MedicineViewModel model, PrescriptionViewModel modelPrescription) {
|
|
|
|
openDrugToDrug(
|
|
|
|
|
|
|
|
MedicineViewModel model, PrescriptionViewModel modelPrescription) {
|
|
|
|
showModalBottomSheet(
|
|
|
|
showModalBottomSheet(
|
|
|
|
context: context,
|
|
|
|
context: context,
|
|
|
|
builder: (context) {
|
|
|
|
builder: (context) {
|
|
|
|
@ -626,107 +550,65 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addMedicationButton(MedicineViewModel model) async {
|
|
|
|
addMedicationButton(MedicineViewModel model) async {
|
|
|
|
await locator<
|
|
|
|
await locator<AnalyticsService>().logEvent(
|
|
|
|
AnalyticsService>()
|
|
|
|
eventCategory: "Add Prescription Form",
|
|
|
|
.logEvent(
|
|
|
|
eventAction: "Add Prescription",
|
|
|
|
eventCategory:
|
|
|
|
|
|
|
|
"Add Prescription Form",
|
|
|
|
|
|
|
|
eventAction:
|
|
|
|
|
|
|
|
"Add Prescription",
|
|
|
|
|
|
|
|
);
|
|
|
|
);
|
|
|
|
if (duration != null &&
|
|
|
|
if (duration != null &&
|
|
|
|
doseTime != null &&
|
|
|
|
doseTime != null &&
|
|
|
|
frequency != null &&
|
|
|
|
frequency != null &&
|
|
|
|
selectedDate != null &&
|
|
|
|
selectedDate != null &&
|
|
|
|
strengthController
|
|
|
|
strengthController.text != "") {
|
|
|
|
.text !=
|
|
|
|
if (widget.selectedMedication.isNarcotic == true) {
|
|
|
|
"") {
|
|
|
|
DrAppToastMsg.showErrorToast(TranslationBase.of(context)
|
|
|
|
if (_selectedMedication
|
|
|
|
|
|
|
|
.isNarcotic ==
|
|
|
|
|
|
|
|
true) {
|
|
|
|
|
|
|
|
DrAppToastMsg.showErrorToast(
|
|
|
|
|
|
|
|
TranslationBase.of(
|
|
|
|
|
|
|
|
context)
|
|
|
|
|
|
|
|
.narcoticMedicineCanOnlyBePrescribedFromVida);
|
|
|
|
.narcoticMedicineCanOnlyBePrescribedFromVida);
|
|
|
|
Navigator.pop(context);
|
|
|
|
Navigator.pop(context);
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (double.parse(
|
|
|
|
if (double.parse(strengthController.text) > 1000.0) {
|
|
|
|
strengthController
|
|
|
|
DrAppToastMsg.showErrorToast("1000 is the MAX for the strength");
|
|
|
|
.text) >
|
|
|
|
|
|
|
|
1000.0) {
|
|
|
|
|
|
|
|
DrAppToastMsg
|
|
|
|
|
|
|
|
.showErrorToast(
|
|
|
|
|
|
|
|
"1000 is the MAX for the strength");
|
|
|
|
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (double.parse(
|
|
|
|
if (double.parse(strengthController.text) < 0.0) {
|
|
|
|
strengthController
|
|
|
|
DrAppToastMsg.showErrorToast("strength can't be zero");
|
|
|
|
.text) <
|
|
|
|
|
|
|
|
0.0) {
|
|
|
|
|
|
|
|
DrAppToastMsg
|
|
|
|
|
|
|
|
.showErrorToast(
|
|
|
|
|
|
|
|
"strength can't be zero");
|
|
|
|
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (formKey.currentState
|
|
|
|
if (formKey.currentState.validate()) {
|
|
|
|
.validate()) {
|
|
|
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
Navigator.pop(context);
|
|
|
|
openDrugToDrug(model, widget.prescriptionViewModel);
|
|
|
|
openDrugToDrug(model, widget.prescriptionViewModel);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
setState(() {
|
|
|
|
setState(() {
|
|
|
|
if (duration == null) {
|
|
|
|
if (duration == null) {
|
|
|
|
durationError =
|
|
|
|
durationError = TranslationBase.of(context).fieldRequired;
|
|
|
|
TranslationBase.of(
|
|
|
|
|
|
|
|
context)
|
|
|
|
|
|
|
|
.fieldRequired;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
durationError = null;
|
|
|
|
durationError = null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (doseTime == null) {
|
|
|
|
if (doseTime == null) {
|
|
|
|
doseTimeError =
|
|
|
|
doseTimeError = TranslationBase.of(context).fieldRequired;
|
|
|
|
TranslationBase.of(
|
|
|
|
|
|
|
|
context)
|
|
|
|
|
|
|
|
.fieldRequired;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
doseTimeError = null;
|
|
|
|
doseTimeError = null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (route == null) {
|
|
|
|
if (route == null) {
|
|
|
|
routeError =
|
|
|
|
routeError = TranslationBase.of(context).fieldRequired;
|
|
|
|
TranslationBase.of(
|
|
|
|
|
|
|
|
context)
|
|
|
|
|
|
|
|
.fieldRequired;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
routeError = null;
|
|
|
|
routeError = null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (frequency == null) {
|
|
|
|
if (frequency == null) {
|
|
|
|
frequencyError =
|
|
|
|
frequencyError = TranslationBase.of(context).fieldRequired;
|
|
|
|
TranslationBase.of(
|
|
|
|
|
|
|
|
context)
|
|
|
|
|
|
|
|
.fieldRequired;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
frequencyError = null;
|
|
|
|
frequencyError = null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (units == null) {
|
|
|
|
if (units == null) {
|
|
|
|
unitError =
|
|
|
|
unitError = TranslationBase.of(context).fieldRequired;
|
|
|
|
TranslationBase.of(
|
|
|
|
|
|
|
|
context)
|
|
|
|
|
|
|
|
.fieldRequired;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
unitError = null;
|
|
|
|
unitError = null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (strengthController
|
|
|
|
if (strengthController.text == "") {
|
|
|
|
.text ==
|
|
|
|
strengthError = TranslationBase.of(context).fieldRequired;
|
|
|
|
"") {
|
|
|
|
|
|
|
|
strengthError =
|
|
|
|
|
|
|
|
TranslationBase.of(
|
|
|
|
|
|
|
|
context)
|
|
|
|
|
|
|
|
.fieldRequired;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
strengthError = null;
|
|
|
|
strengthError = null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -735,5 +617,3 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
formKey.currentState.save();
|
|
|
|
formKey.currentState.save();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|