|
|
|
@ -8,6 +8,7 @@ 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/models/patient/patiant_info_model.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/screens/base/base_view.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/helpers.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
|
|
|
|
@ -36,6 +37,7 @@ class UpdatePrescriptionForm extends StatefulWidget {
|
|
|
|
|
final String startDate;
|
|
|
|
|
final String frequency;
|
|
|
|
|
final String drugNameGeneric;
|
|
|
|
|
|
|
|
|
|
final PrescriptionViewModel model;
|
|
|
|
|
|
|
|
|
|
UpdatePrescriptionForm(
|
|
|
|
@ -71,14 +73,44 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
|
|
|
|
|
GetMedicationResponseModel newSelectedMedication;
|
|
|
|
|
GlobalKey key =
|
|
|
|
|
new GlobalKey<AutoCompleteTextFieldState<GetMedicationResponseModel>>();
|
|
|
|
|
|
|
|
|
|
List<dynamic> indicationList;
|
|
|
|
|
dynamic indication;
|
|
|
|
|
DateTime selectedDate;
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
super.initState();
|
|
|
|
|
|
|
|
|
|
indicationList = List();
|
|
|
|
|
|
|
|
|
|
dynamic indication1 = {"id": 545, "name": "Gingival Hyperplasia"};
|
|
|
|
|
dynamic indication2 = {"id": 546, "name": "Mild Drowsiness"};
|
|
|
|
|
dynamic indication3 = {"id": 547, "name": "Hypertrichosis"};
|
|
|
|
|
dynamic indication4 = {"id": 548, "name": "Mild Dizziness"};
|
|
|
|
|
dynamic indication5 = {"id": 549, "name": "Enlargement of Facial Features"};
|
|
|
|
|
dynamic indication6 = {
|
|
|
|
|
"id": 550,
|
|
|
|
|
"name": "Phenytoin Hypersensitivity Syndrome"
|
|
|
|
|
};
|
|
|
|
|
dynamic indication7 = {"id": 551, "name": "Asterixis"};
|
|
|
|
|
dynamic indication8 = {"id": 552, "name": "Bullous Dermatitis"};
|
|
|
|
|
dynamic indication9 = {"id": 554, "name": "Purpuric Dermatitis"};
|
|
|
|
|
dynamic indication10 = {"id": 555, "name": "Systemic Lupus Erythematosus"};
|
|
|
|
|
|
|
|
|
|
indicationList.add(indication1);
|
|
|
|
|
indicationList.add(indication2);
|
|
|
|
|
indicationList.add(indication3);
|
|
|
|
|
indicationList.add(indication4);
|
|
|
|
|
indicationList.add(indication5);
|
|
|
|
|
indicationList.add(indication6);
|
|
|
|
|
indicationList.add(indication7);
|
|
|
|
|
indicationList.add(indication8);
|
|
|
|
|
indicationList.add(indication9);
|
|
|
|
|
indicationList.add(indication10);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
final screenSize = MediaQuery.of(context).size;
|
|
|
|
|
return StatefulBuilder(builder:
|
|
|
|
|
(BuildContext context, StateSetter setState /*You can rename this!*/) {
|
|
|
|
|
return BaseView<MedicineViewModel>(
|
|
|
|
@ -105,17 +137,17 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
|
|
|
|
|
NetworkBaseView(
|
|
|
|
|
baseViewModel: model,
|
|
|
|
|
child: GestureDetector(
|
|
|
|
|
onTap: (){
|
|
|
|
|
onTap: () {
|
|
|
|
|
FocusScope.of(context).requestFocus(new FocusNode());
|
|
|
|
|
},
|
|
|
|
|
child: DraggableScrollableSheet(
|
|
|
|
|
initialChildSize: 0.95,
|
|
|
|
|
initialChildSize: 0.98,
|
|
|
|
|
maxChildSize: 0.99,
|
|
|
|
|
minChildSize: 0.6,
|
|
|
|
|
builder:
|
|
|
|
|
(BuildContext context, ScrollController scrollController) {
|
|
|
|
|
return Container(
|
|
|
|
|
height: MediaQuery.of(context).size.height * 1.3,
|
|
|
|
|
height: MediaQuery.of(context).size.height * 2.5,
|
|
|
|
|
child: Form(
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
@ -211,15 +243,18 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
width:
|
|
|
|
|
MediaQuery.of(context).size.width *
|
|
|
|
|
width: MediaQuery.of(context)
|
|
|
|
|
.size
|
|
|
|
|
.width *
|
|
|
|
|
0.4900,
|
|
|
|
|
height:
|
|
|
|
|
MediaQuery.of(context).size.height *
|
|
|
|
|
height: MediaQuery.of(context)
|
|
|
|
|
.size
|
|
|
|
|
.height *
|
|
|
|
|
0.55,
|
|
|
|
|
child: TextFields(
|
|
|
|
|
inputFormatters: [
|
|
|
|
|
LengthLimitingTextInputFormatter(4),
|
|
|
|
|
LengthLimitingTextInputFormatter(
|
|
|
|
|
4),
|
|
|
|
|
WhitelistingTextInputFormatter
|
|
|
|
|
.digitsOnly
|
|
|
|
|
],
|
|
|
|
@ -251,35 +286,44 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
|
|
|
|
|
width: 10.0,
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
width:
|
|
|
|
|
MediaQuery.of(context).size.width *
|
|
|
|
|
width: MediaQuery.of(context)
|
|
|
|
|
.size
|
|
|
|
|
.width *
|
|
|
|
|
0.3700,
|
|
|
|
|
child: InkWell(
|
|
|
|
|
onTap: model.medicationStrengthList !=
|
|
|
|
|
onTap:
|
|
|
|
|
model.medicationStrengthList !=
|
|
|
|
|
null
|
|
|
|
|
? () {
|
|
|
|
|
Helpers.hideKeyboard(context);
|
|
|
|
|
ListSelectDialog dialog =
|
|
|
|
|
Helpers.hideKeyboard(
|
|
|
|
|
context);
|
|
|
|
|
ListSelectDialog
|
|
|
|
|
dialog =
|
|
|
|
|
ListSelectDialog(
|
|
|
|
|
list: model
|
|
|
|
|
.medicationStrengthList,
|
|
|
|
|
attributeName: 'nameEn',
|
|
|
|
|
attributeValueId: 'id',
|
|
|
|
|
okText: TranslationBase.of(
|
|
|
|
|
attributeName:
|
|
|
|
|
'nameEn',
|
|
|
|
|
attributeValueId:
|
|
|
|
|
'id',
|
|
|
|
|
okText:
|
|
|
|
|
TranslationBase.of(
|
|
|
|
|
context)
|
|
|
|
|
.ok,
|
|
|
|
|
okFunction:
|
|
|
|
|
(selectedValue) {
|
|
|
|
|
setState(() {
|
|
|
|
|
units = selectedValue;
|
|
|
|
|
units =
|
|
|
|
|
selectedValue;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
showDialog(
|
|
|
|
|
barrierDismissible: false,
|
|
|
|
|
barrierDismissible:
|
|
|
|
|
false,
|
|
|
|
|
context: context,
|
|
|
|
|
builder:
|
|
|
|
|
(BuildContext context) {
|
|
|
|
|
builder: (BuildContext
|
|
|
|
|
context) {
|
|
|
|
|
return dialog;
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
@ -330,7 +374,8 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
|
|
|
|
|
showDialog(
|
|
|
|
|
barrierDismissible: false,
|
|
|
|
|
context: context,
|
|
|
|
|
builder: (BuildContext context) {
|
|
|
|
|
builder:
|
|
|
|
|
(BuildContext context) {
|
|
|
|
|
return dialog;
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
@ -354,13 +399,14 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
|
|
|
|
|
height: MediaQuery.of(context).size.height *
|
|
|
|
|
0.070,
|
|
|
|
|
child: InkWell(
|
|
|
|
|
onTap: model.medicationDoseTimeList != null
|
|
|
|
|
onTap: model.medicationDoseTimeList !=
|
|
|
|
|
null
|
|
|
|
|
? () {
|
|
|
|
|
Helpers.hideKeyboard(context);
|
|
|
|
|
ListSelectDialog dialog =
|
|
|
|
|
ListSelectDialog(
|
|
|
|
|
list:
|
|
|
|
|
model.medicationDoseTimeList,
|
|
|
|
|
list: model
|
|
|
|
|
.medicationDoseTimeList,
|
|
|
|
|
attributeName: 'nameEn',
|
|
|
|
|
attributeValueId: 'id',
|
|
|
|
|
okText:
|
|
|
|
@ -375,7 +421,8 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
|
|
|
|
|
showDialog(
|
|
|
|
|
barrierDismissible: false,
|
|
|
|
|
context: context,
|
|
|
|
|
builder: (BuildContext context) {
|
|
|
|
|
builder:
|
|
|
|
|
(BuildContext context) {
|
|
|
|
|
return dialog;
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
@ -383,7 +430,8 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
|
|
|
|
|
: null,
|
|
|
|
|
child: TextField(
|
|
|
|
|
decoration: textFieldSelectorDecoration(
|
|
|
|
|
TranslationBase.of(context).doseTime,
|
|
|
|
|
TranslationBase.of(context)
|
|
|
|
|
.doseTime,
|
|
|
|
|
doseTime != null
|
|
|
|
|
? doseTime['nameEn']
|
|
|
|
|
: null,
|
|
|
|
@ -399,13 +447,14 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
|
|
|
|
|
height: MediaQuery.of(context).size.height *
|
|
|
|
|
0.070,
|
|
|
|
|
child: InkWell(
|
|
|
|
|
onTap: model.medicationFrequencyList != null
|
|
|
|
|
onTap: model.medicationFrequencyList !=
|
|
|
|
|
null
|
|
|
|
|
? () {
|
|
|
|
|
Helpers.hideKeyboard(context);
|
|
|
|
|
ListSelectDialog dialog =
|
|
|
|
|
ListSelectDialog(
|
|
|
|
|
list:
|
|
|
|
|
model.medicationFrequencyList,
|
|
|
|
|
list: model
|
|
|
|
|
.medicationFrequencyList,
|
|
|
|
|
attributeName: 'nameEn',
|
|
|
|
|
attributeValueId: 'id',
|
|
|
|
|
okText:
|
|
|
|
@ -421,7 +470,8 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
|
|
|
|
|
showDialog(
|
|
|
|
|
barrierDismissible: false,
|
|
|
|
|
context: context,
|
|
|
|
|
builder: (BuildContext context) {
|
|
|
|
|
builder:
|
|
|
|
|
(BuildContext context) {
|
|
|
|
|
return dialog;
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
@ -429,7 +479,8 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
|
|
|
|
|
: null,
|
|
|
|
|
child: TextField(
|
|
|
|
|
decoration: textFieldSelectorDecoration(
|
|
|
|
|
TranslationBase.of(context).frequency,
|
|
|
|
|
TranslationBase.of(context)
|
|
|
|
|
.frequency,
|
|
|
|
|
frequencyUpdate != null
|
|
|
|
|
? frequencyUpdate['nameEn']
|
|
|
|
|
: null,
|
|
|
|
@ -445,13 +496,14 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
|
|
|
|
|
height: MediaQuery.of(context).size.height *
|
|
|
|
|
0.070,
|
|
|
|
|
child: InkWell(
|
|
|
|
|
onTap: model.medicationDurationList != null
|
|
|
|
|
onTap: model.medicationDurationList !=
|
|
|
|
|
null
|
|
|
|
|
? () {
|
|
|
|
|
Helpers.hideKeyboard(context);
|
|
|
|
|
ListSelectDialog dialog =
|
|
|
|
|
ListSelectDialog(
|
|
|
|
|
list:
|
|
|
|
|
model.medicationDurationList,
|
|
|
|
|
list: model
|
|
|
|
|
.medicationDurationList,
|
|
|
|
|
attributeName: 'nameEn',
|
|
|
|
|
attributeValueId: 'id',
|
|
|
|
|
okText:
|
|
|
|
@ -467,7 +519,8 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
|
|
|
|
|
showDialog(
|
|
|
|
|
barrierDismissible: false,
|
|
|
|
|
context: context,
|
|
|
|
|
builder: (BuildContext context) {
|
|
|
|
|
builder:
|
|
|
|
|
(BuildContext context) {
|
|
|
|
|
return dialog;
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
@ -475,7 +528,8 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
|
|
|
|
|
: null,
|
|
|
|
|
child: TextField(
|
|
|
|
|
decoration: textFieldSelectorDecoration(
|
|
|
|
|
TranslationBase.of(context).duration,
|
|
|
|
|
TranslationBase.of(context)
|
|
|
|
|
.duration,
|
|
|
|
|
updatedDuration != null
|
|
|
|
|
? updatedDuration['nameEn']
|
|
|
|
|
.toString()
|
|
|
|
@ -488,6 +542,100 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 12.0,
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
height: screenSize.height * 0.070,
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
width: MediaQuery.of(context)
|
|
|
|
|
.size
|
|
|
|
|
.width *
|
|
|
|
|
0.29,
|
|
|
|
|
child: InkWell(
|
|
|
|
|
onTap: indicationList != null
|
|
|
|
|
? () {
|
|
|
|
|
Helpers.hideKeyboard(
|
|
|
|
|
context);
|
|
|
|
|
}
|
|
|
|
|
: null,
|
|
|
|
|
child: TextField(
|
|
|
|
|
decoration:
|
|
|
|
|
textFieldSelectorDecoration(
|
|
|
|
|
model
|
|
|
|
|
.patientAssessmentList[
|
|
|
|
|
0]
|
|
|
|
|
.icdCode10ID
|
|
|
|
|
.toString(),
|
|
|
|
|
indication != null
|
|
|
|
|
? indication['name']
|
|
|
|
|
: null,
|
|
|
|
|
true),
|
|
|
|
|
enabled: true,
|
|
|
|
|
readOnly: true,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
width: MediaQuery.of(context)
|
|
|
|
|
.size
|
|
|
|
|
.width *
|
|
|
|
|
0.61,
|
|
|
|
|
child: InkWell(
|
|
|
|
|
onTap: indicationList != null
|
|
|
|
|
? () {
|
|
|
|
|
Helpers.hideKeyboard(
|
|
|
|
|
context);
|
|
|
|
|
}
|
|
|
|
|
: null,
|
|
|
|
|
child: TextField(
|
|
|
|
|
maxLines: 3,
|
|
|
|
|
decoration:
|
|
|
|
|
textFieldSelectorDecoration(
|
|
|
|
|
model
|
|
|
|
|
.patientAssessmentList[
|
|
|
|
|
0]
|
|
|
|
|
.asciiDesc
|
|
|
|
|
.toString(),
|
|
|
|
|
indication != null
|
|
|
|
|
? indication['name']
|
|
|
|
|
: null,
|
|
|
|
|
true),
|
|
|
|
|
enabled: true,
|
|
|
|
|
readOnly: true,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 12.0,
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
height: screenSize.height * 0.070,
|
|
|
|
|
child: InkWell(
|
|
|
|
|
onTap: () =>
|
|
|
|
|
selectDate(context, widget.model),
|
|
|
|
|
child: TextField(
|
|
|
|
|
decoration:
|
|
|
|
|
Helpers.textFieldSelectorDecoration(
|
|
|
|
|
widget.startDate,
|
|
|
|
|
selectedDate != null
|
|
|
|
|
? "${DateUtils.convertStringToDateFormat(selectedDate.toString(), "yyyy-MM-dd")}"
|
|
|
|
|
: null,
|
|
|
|
|
true,
|
|
|
|
|
suffixIcon: Icon(
|
|
|
|
|
Icons.calendar_today,
|
|
|
|
|
color: Colors.black,
|
|
|
|
|
)),
|
|
|
|
|
enabled: false,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 12.0,
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
borderRadius: BorderRadius.all(
|
|
|
|
@ -503,11 +651,11 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 12.0,
|
|
|
|
|
height: 10.0,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height:
|
|
|
|
|
MediaQuery.of(context).size.height * 0.12,
|
|
|
|
|
height: MediaQuery.of(context).size.height *
|
|
|
|
|
0.08,
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.all(
|
|
|
|
@ -516,16 +664,19 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
|
|
|
|
|
alignment: WrapAlignment.center,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
AppButton(
|
|
|
|
|
title:
|
|
|
|
|
'update prescription'.toUpperCase(),
|
|
|
|
|
title: 'update prescription'
|
|
|
|
|
.toUpperCase(),
|
|
|
|
|
onPressed: () {
|
|
|
|
|
updatePrescription(
|
|
|
|
|
newStartDate: selectedDate,
|
|
|
|
|
newDoseStreangth:
|
|
|
|
|
strengthController
|
|
|
|
|
.text.isNotEmpty
|
|
|
|
|
? strengthController.text
|
|
|
|
|
? strengthController
|
|
|
|
|
.text
|
|
|
|
|
: widget.doseStreangth,
|
|
|
|
|
newUnit: units !=
|
|
|
|
|
newUnit:
|
|
|
|
|
units !=
|
|
|
|
|
null
|
|
|
|
|
? units['id'].toString()
|
|
|
|
|
: widget.doseUnit,
|
|
|
|
@ -582,6 +733,24 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
selectDate(BuildContext context, PrescriptionViewModel model) async {
|
|
|
|
|
Helpers.hideKeyboard(context);
|
|
|
|
|
DateTime selectedDate;
|
|
|
|
|
selectedDate = DateTime.now();
|
|
|
|
|
final DateTime picked = await showDatePicker(
|
|
|
|
|
context: context,
|
|
|
|
|
initialDate: selectedDate,
|
|
|
|
|
firstDate: DateTime.now(),
|
|
|
|
|
lastDate: DateTime(2040),
|
|
|
|
|
initialEntryMode: DatePickerEntryMode.calendar,
|
|
|
|
|
);
|
|
|
|
|
if (picked != null && picked != selectedDate) {
|
|
|
|
|
setState(() {
|
|
|
|
|
this.selectedDate = picked;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
InputDecoration textFieldSelectorDecoration(
|
|
|
|
|
String hintText, String selectedText, bool isDropDown,
|
|
|
|
|
{Icon suffixIcon}) {
|
|
|
|
@ -626,6 +795,7 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
|
|
|
|
|
String route,
|
|
|
|
|
String routeId,
|
|
|
|
|
String startDate,
|
|
|
|
|
DateTime newStartDate,
|
|
|
|
|
String doseUnit,
|
|
|
|
|
String doseStreangth,
|
|
|
|
|
String newDoseStreangth,
|
|
|
|
@ -664,7 +834,8 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
|
|
|
|
|
duration: newDuration.isNotEmpty
|
|
|
|
|
? int.parse(newDuration)
|
|
|
|
|
: int.parse(duration),
|
|
|
|
|
doseStartDate: startDate));
|
|
|
|
|
doseStartDate:
|
|
|
|
|
newStartDate != null ? newStartDate.toIso8601String() : startDate));
|
|
|
|
|
updatePrescriptionReqModel.prescriptionRequestModel = sss;
|
|
|
|
|
//postProcedureReqModel.procedures = controlsProcedure;
|
|
|
|
|
|
|
|
|
|