add prescription & add lab test changes

merge-requests/461/head
hussam al-habibeh 5 years ago
parent 76b80600c6
commit c72d612646

@ -345,8 +345,9 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
suggestion
.genericName),
padding:
EdgeInsets.all(8.0)),
EdgeInsets.all(15.0)),
itemSorter: (a, b) => 1,
suggestionsAmount: 7,
itemFilter: (suggestion, input) =>
suggestion.genericName.toLowerCase().startsWith(
input.toLowerCase()) ||
@ -383,6 +384,13 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
SizedBox(
height: spaceBetweenTextFileds,
),
Visibility(
visible: _selectedMedication == null
? false
: true,
child: Container(
child: Column(
children: [
Container(
child: Row(
children: [
@ -391,7 +399,8 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
fontWeight: FontWeight.w600,
),
Radio(
activeColor: Color(0xFFB9382C),
activeColor:
Color(0xFFB9382C),
value: 1,
groupValue: selectedType,
onChanged: (value) {
@ -402,7 +411,8 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
],
),
),
SizedBox(height: spaceBetweenTextFileds),
SizedBox(
height: spaceBetweenTextFileds),
Container(
height: screenSize.height * 0.070,
width: double.infinity,
@ -421,32 +431,39 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
// .digitsOnly
],
hintText:
TranslationBase.of(context)
TranslationBase.of(
context)
.strength,
controller: strengthController,
keyboardType:
TextInputType.numberWithOptions(
controller:
strengthController,
keyboardType: TextInputType
.numberWithOptions(
decimal: true,
),
onChanged: (String value) {
setState(() {
strengthChar = value.length;
strengthChar =
value.length;
});
if (strengthChar >= 5) {
DrAppToastMsg.showErrorToast(
DrAppToastMsg
.showErrorToast(
"Only 5 Digits allowed for strength");
}
},
onSubmit: (_) {
if (_selectedMedication != null &&
if (_selectedMedication !=
null &&
duration != null &&
frequency != null &&
strengthController.text !=
strengthController
.text !=
null) {
model.getBoxQuantity(
freq: frequency[
'parameterCode'],
duration: duration['id'],
duration:
duration['id'],
itemCode:
_selectedMedication
.itemId,
@ -479,12 +496,15 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
.width *
0.350,
child: InkWell(
onTap: model.itemMedicineListUnit !=
onTap:
model.itemMedicineListUnit !=
null
? () {
Helpers.hideKeyboard(
Helpers
.hideKeyboard(
context);
ListSelectDialog dialog =
ListSelectDialog
dialog =
ListSelectDialog(
list: model
.itemMedicineListUnit,
@ -492,23 +512,27 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
'description',
attributeValueId:
'parameterCode',
okText:
TranslationBase.of(
okText: TranslationBase.of(
context)
.ok,
okFunction:
(selectedValue) {
setState(() {
units = selectedValue;
setState(
() {
units =
selectedValue;
units['isDefault'] =
true;
});
},
);
showDialog(
barrierDismissible: false,
context: context,
builder: (BuildContext
barrierDismissible:
false,
context:
context,
builder:
(BuildContext
context) {
return dialog;
},
@ -530,82 +554,110 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
],
),
),
SizedBox(height: spaceBetweenTextFileds),
SizedBox(
height: spaceBetweenTextFileds),
Container(
height: screenSize.height * 0.070,
color: Colors.white,
child: InkWell(
onTap: model.itemMedicineListRoute != null
onTap:
model.itemMedicineListRoute !=
null
? () {
Helpers.hideKeyboard(context);
ListSelectDialog dialog =
Helpers.hideKeyboard(
context);
ListSelectDialog
dialog =
ListSelectDialog(
list:
model.itemMedicineListRoute,
attributeName: 'description',
list: model
.itemMedicineListRoute,
attributeName:
'description',
attributeValueId:
'parameterCode',
okText:
TranslationBase.of(context)
TranslationBase.of(
context)
.ok,
okFunction: (selectedValue) {
okFunction:
(selectedValue) {
setState(() {
route = selectedValue;
route['isDefault'] = true;
route =
selectedValue;
route['isDefault'] =
true;
});
if (route == null) {
if (route ==
null) {
helpers.showErrorToast(
'plase fill');
}
},
);
showDialog(
barrierDismissible: false,
barrierDismissible:
false,
context: context,
builder:
(BuildContext context) {
(BuildContext
context) {
return dialog;
},
);
}
: null,
child: TextField(
decoration: textFieldSelectorDecoration(
TranslationBase.of(context).route,
decoration:
textFieldSelectorDecoration(
TranslationBase.of(
context)
.route,
route != null
? route['description']
? route[
'description']
: null,
true),
enabled: false,
),
),
),
SizedBox(height: spaceBetweenTextFileds),
SizedBox(
height: spaceBetweenTextFileds),
Container(
height: screenSize.height * 0.070,
color: Colors.white,
child: InkWell(
onTap: model.itemMedicineList != null
onTap:
model.itemMedicineList != null
? () {
Helpers.hideKeyboard(context);
ListSelectDialog dialog =
Helpers.hideKeyboard(
context);
ListSelectDialog
dialog =
ListSelectDialog(
list: model.itemMedicineList,
attributeName: 'description',
list: model
.itemMedicineList,
attributeName:
'description',
attributeValueId:
'parameterCode',
okText:
TranslationBase.of(context)
TranslationBase.of(
context)
.ok,
okFunction: (selectedValue) {
okFunction:
(selectedValue) {
setState(() {
frequency = selectedValue;
frequency['isDefault'] =
frequency =
selectedValue;
frequency[
'isDefault'] =
true;
if (_selectedMedication !=
if (_selectedMedication != null &&
duration !=
null &&
frequency !=
null &&
duration != null &&
frequency != null &&
strengthController
.text !=
null) {
@ -613,13 +665,14 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
freq: frequency[
'parameterCode'],
duration:
duration['id'],
duration[
'id'],
itemCode:
_selectedMedication
.itemId,
strength: double.parse(
strengthController
.text));
strength:
double.parse(
strengthController.text));
return;
}
@ -627,64 +680,82 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
},
);
showDialog(
barrierDismissible: false,
barrierDismissible:
false,
context: context,
builder:
(BuildContext context) {
(BuildContext
context) {
return dialog;
},
);
}
: null,
child: TextField(
decoration: textFieldSelectorDecoration(
TranslationBase.of(context)
decoration:
textFieldSelectorDecoration(
TranslationBase.of(
context)
.frequency,
frequency != null
? frequency['description']
? frequency[
'description']
: null,
true),
enabled: false,
),
),
),
SizedBox(height: spaceBetweenTextFileds),
SizedBox(
height: spaceBetweenTextFileds),
Container(
height: screenSize.height * 0.070,
color: Colors.white,
child: InkWell(
onTap: model.medicationDoseTimeList !=
onTap:
model.medicationDoseTimeList !=
null
? () {
Helpers.hideKeyboard(context);
ListSelectDialog dialog =
Helpers.hideKeyboard(
context);
ListSelectDialog
dialog =
ListSelectDialog(
list: model
.medicationDoseTimeList,
attributeName: 'nameEn',
attributeValueId: 'id',
attributeName:
'nameEn',
attributeValueId:
'id',
okText:
TranslationBase.of(context)
TranslationBase.of(
context)
.ok,
okFunction: (selectedValue) {
okFunction:
(selectedValue) {
setState(() {
doseTime = selectedValue;
doseTime =
selectedValue;
});
},
);
showDialog(
barrierDismissible: false,
barrierDismissible:
false,
context: context,
builder:
(BuildContext context) {
(BuildContext
context) {
return dialog;
},
);
}
: null,
child: TextField(
decoration: textFieldSelectorDecoration(
TranslationBase.of(context)
decoration:
textFieldSelectorDecoration(
TranslationBase.of(
context)
.doseTime,
doseTime != null
? doseTime['nameEn']
@ -694,8 +765,10 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
),
),
),
SizedBox(height: spaceBetweenTextFileds),
if (model.patientAssessmentList.isNotEmpty)
SizedBox(
height: spaceBetweenTextFileds),
if (model
.patientAssessmentList.isNotEmpty)
Container(
height: screenSize.height * 0.070,
width: double.infinity,
@ -703,12 +776,14 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
child: Row(
children: [
Container(
width: MediaQuery.of(context)
width:
MediaQuery.of(context)
.size
.width *
0.29,
child: InkWell(
onTap: indicationList != null
onTap:
indicationList != null
? () {
Helpers.hideKeyboard(
context);
@ -722,8 +797,10 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
0]
.icdCode10ID
.toString(),
indication != null
? indication['name']
indication !=
null
? indication[
'name']
: null,
false),
enabled: true,
@ -732,13 +809,15 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
),
),
Container(
width: MediaQuery.of(context)
width:
MediaQuery.of(context)
.size
.width *
0.65,
color: Colors.white,
child: InkWell(
onTap: indicationList != null
onTap:
indicationList != null
? () {
Helpers.hideKeyboard(
context);
@ -753,8 +832,10 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
0]
.asciiDesc
.toString(),
indication != null
? indication['name']
indication !=
null
? indication[
'name']
: null,
false),
enabled: true,
@ -765,16 +846,20 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
],
),
),
SizedBox(height: spaceBetweenTextFileds),
SizedBox(
height: spaceBetweenTextFileds),
Container(
height: screenSize.height * 0.070,
color: Colors.white,
child: InkWell(
onTap: () =>
selectDate(context, widget.model),
onTap: () => selectDate(
context, widget.model),
child: TextField(
decoration: textFieldSelectorDecoration(
TranslationBase.of(context).date,
decoration:
textFieldSelectorDecoration(
TranslationBase.of(
context)
.date,
selectedDate != null
? "${DateUtils.convertStringToDateFormat(selectedDate.toString(), "yyyy-MM-dd")}"
: null,
@ -787,39 +872,51 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
),
),
),
SizedBox(height: spaceBetweenTextFileds),
SizedBox(
height: spaceBetweenTextFileds),
Container(
height: screenSize.height * 0.070,
color: Colors.white,
child: InkWell(
onTap: model.medicationDurationList !=
onTap:
model.medicationDurationList !=
null
? () {
Helpers.hideKeyboard(context);
ListSelectDialog dialog =
Helpers.hideKeyboard(
context);
ListSelectDialog
dialog =
ListSelectDialog(
list: model
.medicationDurationList,
attributeName: 'nameEn',
attributeValueId: 'id',
attributeName:
'nameEn',
attributeValueId:
'id',
okText:
TranslationBase.of(context)
TranslationBase.of(
context)
.ok,
okFunction: (selectedValue) {
okFunction:
(selectedValue) {
setState(() {
duration = selectedValue;
if (_selectedMedication !=
duration =
selectedValue;
if (_selectedMedication != null &&
duration !=
null &&
frequency !=
null &&
duration != null &&
frequency != null &&
strengthController
.text !=
null) {
model.getBoxQuantity(
model
.getBoxQuantity(
freq: frequency[
'parameterCode'],
duration:
duration['id'],
duration[
'id'],
itemCode:
_selectedMedication
.itemId,
@ -827,7 +924,8 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
strengthController
.text),
);
box = model.boxQuintity;
box = model
.boxQuintity;
return;
}
@ -835,18 +933,22 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
},
);
showDialog(
barrierDismissible: false,
barrierDismissible:
false,
context: context,
builder:
(BuildContext context) {
(BuildContext
context) {
return dialog;
},
);
}
: null,
child: TextField(
decoration: textFieldSelectorDecoration(
TranslationBase.of(context)
decoration:
textFieldSelectorDecoration(
TranslationBase.of(
context)
.duration,
duration != null
? duration['nameEn']
@ -856,86 +958,108 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
),
),
),
SizedBox(height: spaceBetweenTextFileds),
SizedBox(
height: spaceBetweenTextFileds),
Container(
height: screenSize.height * 0.070,
color: Colors.white,
child: InkWell(
onTap: model.allMedicationList != null
onTap: model.allMedicationList !=
null
? () {
Helpers.hideKeyboard(context);
Helpers.hideKeyboard(
context);
ListSelectDialog dialog =
ListSelectDialog(
list: model.allMedicationList,
list: model
.allMedicationList,
attributeName: 'nameEn',
attributeValueId: 'id',
okText:
TranslationBase.of(context)
TranslationBase.of(
context)
.ok,
okFunction: (selectedValue) {
okFunction:
(selectedValue) {
setState(() {
duration = selectedValue;
duration =
selectedValue;
});
},
);
showDialog(
barrierDismissible: false,
barrierDismissible:
false,
context: context,
builder:
(BuildContext context) {
builder: (BuildContext
context) {
return dialog;
},
);
}
: null,
child: TextField(
decoration: textFieldSelectorDecoration(
decoration:
textFieldSelectorDecoration(
"UOM",
uom != null ? uom : null,
uom != null
? uom
: null,
false),
//enabled: false,
readOnly: true,
),
),
),
SizedBox(height: spaceBetweenTextFileds),
SizedBox(
height: spaceBetweenTextFileds),
Container(
height: screenSize.height * 0.070,
color: Colors.white,
child: InkWell(
onTap: model.allMedicationList != null
onTap: model.allMedicationList !=
null
? () {
Helpers.hideKeyboard(context);
Helpers.hideKeyboard(
context);
ListSelectDialog dialog =
ListSelectDialog(
list: model.allMedicationList,
list: model
.allMedicationList,
attributeName: 'nameEn',
attributeValueId: 'id',
okText:
TranslationBase.of(context)
TranslationBase.of(
context)
.ok,
okFunction: (selectedValue) {
okFunction:
(selectedValue) {
setState(() {
duration = selectedValue;
duration =
selectedValue;
});
},
);
showDialog(
barrierDismissible: false,
barrierDismissible:
false,
context: context,
builder:
(BuildContext context) {
builder: (BuildContext
context) {
return dialog;
},
);
}
: null,
child: TextField(
decoration: textFieldSelectorDecoration(
decoration:
textFieldSelectorDecoration(
"Box Quantity",
box != null
? "Box Quantity: " +
model.boxQuintity.toString()
model
.boxQuintity
.toString()
: null,
false),
//enabled: false,
@ -943,24 +1067,28 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
),
),
),
SizedBox(height: spaceBetweenTextFileds),
SizedBox(
height: spaceBetweenTextFileds),
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(6.0)),
border: Border.all(
width: 1.0,
color: HexColor("#CCCCCC"))),
color:
HexColor("#CCCCCC"))),
child: TextFields(
maxLines: 6,
minLines: 4,
hintText: TranslationBase.of(context)
hintText:
TranslationBase.of(context)
.instruction,
controller: instructionController,
//keyboardType: TextInputType.number,
),
),
SizedBox(height: spaceBetweenTextFileds),
SizedBox(
height: spaceBetweenTextFileds),
Container(
margin: EdgeInsets.all(
SizeConfig.widthMultiplier * 5),
@ -969,7 +1097,8 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
children: <Widget>[
AppButton(
color: Color(0xff359846),
title: TranslationBase.of(context)
title: TranslationBase.of(
context)
.addMedication,
fontWeight: FontWeight.w600,
onPressed: () {
@ -996,14 +1125,16 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
}
if (double.parse(
strengthController.text) >
strengthController
.text) >
1000.0) {
DrAppToastMsg.showErrorToast(
"1000 is the MAX for the strength");
return;
}
if (double.parse(
strengthController.text) <
strengthController
.text) <
0.0) {
DrAppToastMsg.showErrorToast(
"strength can't be zero");
@ -1097,6 +1228,10 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
),
),
),
],
),
),
),
);
}),
),

@ -134,9 +134,14 @@ class _EntityListCheckboxSearchWidgetState
children: [
AppText(
TranslationBase.of(context)
.orderType),
.orderType,
fontWeight: FontWeight.w700,
),
Row(
children: [
Radio(
activeColor: Color(0xFFB9382C),
activeColor:
Color(0xFFB9382C),
value: 0,
groupValue: selectedType,
onChanged: (value) {
@ -150,7 +155,8 @@ class _EntityListCheckboxSearchWidgetState
),
Text('routine'),
Radio(
activeColor: Color(0xFFB9382C),
activeColor:
Color(0xFFB9382C),
groupValue: selectedType,
value: 1,
onChanged: (value) {
@ -162,18 +168,21 @@ class _EntityListCheckboxSearchWidgetState
value.toString();
},
),
Text(TranslationBase.of(context)
Text(TranslationBase.of(
context)
.urgent),
],
),
],
),
),
),
SizedBox(
height: 15.0,
height: 2.0,
),
Padding(
padding: EdgeInsets.symmetric(
horizontal: 12),
horizontal: 12, vertical: 12.0),
child: TextFields(
hintText: TranslationBase.of(context)
.remarks,

Loading…
Cancel
Save