|
|
|
|
@ -22,6 +22,7 @@ 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/dialogs/dailog-list-select.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/text_fields/app_text_form_field.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:flutter/services.dart';
|
|
|
|
|
@ -406,6 +407,11 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
|
child: Container(
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
AppText(
|
|
|
|
|
_selectedMedication?.description ??
|
|
|
|
|
"",
|
|
|
|
|
bold: true,
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
@ -430,16 +436,25 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: spaceBetweenTextFileds),
|
|
|
|
|
Container(
|
|
|
|
|
height: screenSize.height * 0.070,
|
|
|
|
|
//height: screenSize.height * 0.062,
|
|
|
|
|
height: MediaQuery.of(context)
|
|
|
|
|
.size
|
|
|
|
|
.height *
|
|
|
|
|
0.0749,
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
// height: MediaQuery.of(context)
|
|
|
|
|
// .size
|
|
|
|
|
// .height *
|
|
|
|
|
// 0.02,
|
|
|
|
|
width: MediaQuery.of(context)
|
|
|
|
|
.size
|
|
|
|
|
.width *
|
|
|
|
|
0.550,
|
|
|
|
|
child: TextFields(
|
|
|
|
|
0.35,
|
|
|
|
|
child: AppTextFieldCustom(
|
|
|
|
|
isPrscription: true,
|
|
|
|
|
inputFormatters: [
|
|
|
|
|
LengthLimitingTextInputFormatter(
|
|
|
|
|
5),
|
|
|
|
|
@ -450,12 +465,17 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
|
TranslationBase.of(
|
|
|
|
|
context)
|
|
|
|
|
.strength,
|
|
|
|
|
|
|
|
|
|
// fontWeight: FontWeight.w500,
|
|
|
|
|
// fontSize: 14.0,
|
|
|
|
|
// borderWidth: 0.2,
|
|
|
|
|
|
|
|
|
|
controller:
|
|
|
|
|
strengthController,
|
|
|
|
|
keyboardType: TextInputType
|
|
|
|
|
.numberWithOptions(
|
|
|
|
|
decimal: true,
|
|
|
|
|
),
|
|
|
|
|
// keyboardType: TextInputType
|
|
|
|
|
// .numberWithOptions(
|
|
|
|
|
// decimal: true,
|
|
|
|
|
// ),
|
|
|
|
|
onChanged: (String value) {
|
|
|
|
|
setState(() {
|
|
|
|
|
strengthChar =
|
|
|
|
|
@ -470,30 +490,30 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
onSubmit: (_) {
|
|
|
|
|
if (_selectedMedication !=
|
|
|
|
|
null &&
|
|
|
|
|
duration != null &&
|
|
|
|
|
frequency != null &&
|
|
|
|
|
strengthController
|
|
|
|
|
.text !=
|
|
|
|
|
null) {
|
|
|
|
|
model.getBoxQuantity(
|
|
|
|
|
freq: frequency[
|
|
|
|
|
'parameterCode'],
|
|
|
|
|
duration:
|
|
|
|
|
duration['id'],
|
|
|
|
|
itemCode:
|
|
|
|
|
_selectedMedication
|
|
|
|
|
.itemId,
|
|
|
|
|
strength: double.parse(
|
|
|
|
|
strengthController
|
|
|
|
|
.text));
|
|
|
|
|
box = model.boxQuintity;
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
// onClick: (_) {
|
|
|
|
|
// if (_selectedMedication !=
|
|
|
|
|
// null &&
|
|
|
|
|
// duration != null &&
|
|
|
|
|
// frequency != null &&
|
|
|
|
|
// strengthController
|
|
|
|
|
// .text !=
|
|
|
|
|
// null) {
|
|
|
|
|
// model.getBoxQuantity(
|
|
|
|
|
// freq: frequency[
|
|
|
|
|
// 'parameterCode'],
|
|
|
|
|
// duration:
|
|
|
|
|
// duration['id'],
|
|
|
|
|
// itemCode:
|
|
|
|
|
// _selectedMedication
|
|
|
|
|
// .itemId,
|
|
|
|
|
// strength: double.parse(
|
|
|
|
|
// strengthController
|
|
|
|
|
// .text));
|
|
|
|
|
// box = model.boxQuintity;
|
|
|
|
|
//
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
// },
|
|
|
|
|
// validator: (value) {
|
|
|
|
|
// if (value.isEmpty &&
|
|
|
|
|
// strengthController.text.length >
|
|
|
|
|
@ -506,14 +526,18 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
width: 10.0,
|
|
|
|
|
width: 5.0,
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
// height: MediaQuery.of(context)
|
|
|
|
|
// .size
|
|
|
|
|
// .height *
|
|
|
|
|
// 0.06,
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
width: MediaQuery.of(context)
|
|
|
|
|
.size
|
|
|
|
|
.width *
|
|
|
|
|
0.350,
|
|
|
|
|
0.560,
|
|
|
|
|
child: InkWell(
|
|
|
|
|
onTap:
|
|
|
|
|
model.itemMedicineListUnit !=
|
|
|
|
|
@ -561,19 +585,18 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
|
child: TextField(
|
|
|
|
|
decoration:
|
|
|
|
|
textFieldSelectorDecoration(
|
|
|
|
|
TranslationBase.of(
|
|
|
|
|
context)
|
|
|
|
|
.unit,
|
|
|
|
|
'Select',
|
|
|
|
|
model.itemMedicineListUnit
|
|
|
|
|
.length ==
|
|
|
|
|
1
|
|
|
|
|
? model.itemMedicineListUnit[
|
|
|
|
|
0][
|
|
|
|
|
? units = model
|
|
|
|
|
.itemMedicineListUnit[0]
|
|
|
|
|
[
|
|
|
|
|
'description']
|
|
|
|
|
: units !=
|
|
|
|
|
null
|
|
|
|
|
? units[
|
|
|
|
|
'description']
|
|
|
|
|
? units['description']
|
|
|
|
|
.toString()
|
|
|
|
|
: null,
|
|
|
|
|
true),
|
|
|
|
|
enabled: false),
|
|
|
|
|
@ -640,10 +663,16 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
|
TranslationBase.of(
|
|
|
|
|
context)
|
|
|
|
|
.route,
|
|
|
|
|
route != null
|
|
|
|
|
? route[
|
|
|
|
|
'description']
|
|
|
|
|
: null,
|
|
|
|
|
model.itemMedicineListRoute
|
|
|
|
|
.length ==
|
|
|
|
|
1
|
|
|
|
|
? model.itemMedicineListRoute[
|
|
|
|
|
0]
|
|
|
|
|
['description']
|
|
|
|
|
: route != null
|
|
|
|
|
? route[
|
|
|
|
|
'description']
|
|
|
|
|
: null,
|
|
|
|
|
true),
|
|
|
|
|
enabled: false,
|
|
|
|
|
),
|
|
|
|
|
@ -725,10 +754,16 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
|
TranslationBase.of(
|
|
|
|
|
context)
|
|
|
|
|
.frequency,
|
|
|
|
|
frequency != null
|
|
|
|
|
? frequency[
|
|
|
|
|
'description']
|
|
|
|
|
: null,
|
|
|
|
|
model.itemMedicineList
|
|
|
|
|
.length ==
|
|
|
|
|
1
|
|
|
|
|
? model.itemMedicineList[
|
|
|
|
|
0]
|
|
|
|
|
['description']
|
|
|
|
|
: frequency != null
|
|
|
|
|
? frequency[
|
|
|
|
|
'description']
|
|
|
|
|
: null,
|
|
|
|
|
true),
|
|
|
|
|
enabled: false,
|
|
|
|
|
),
|
|
|
|
|
@ -1138,12 +1173,13 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
|
formKey.currentState.save();
|
|
|
|
|
// Navigator.pop(context);
|
|
|
|
|
// openDrugToDrug();
|
|
|
|
|
if (route == null ||
|
|
|
|
|
frequency == null ||
|
|
|
|
|
if (frequency == null ||
|
|
|
|
|
strengthController
|
|
|
|
|
.text ==
|
|
|
|
|
"" ||
|
|
|
|
|
doseTime == null ||
|
|
|
|
|
duration == null ||
|
|
|
|
|
selectedDate == null ||
|
|
|
|
|
units == null) {
|
|
|
|
|
selectedDate == null) {
|
|
|
|
|
DrAppToastMsg.showErrorToast(
|
|
|
|
|
TranslationBase.of(
|
|
|
|
|
context)
|
|
|
|
|
@ -1206,27 +1242,48 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
|
// // .trim())
|
|
|
|
|
// // .toList()
|
|
|
|
|
// // .join(' '),
|
|
|
|
|
// dose:
|
|
|
|
|
// strengthController
|
|
|
|
|
// .text,
|
|
|
|
|
// doseUnit: units[
|
|
|
|
|
// 'parameterCode']
|
|
|
|
|
// .toString(),
|
|
|
|
|
// patient:
|
|
|
|
|
// widget.patient,
|
|
|
|
|
// dose: strengthController
|
|
|
|
|
// .text,
|
|
|
|
|
// doseUnit: model
|
|
|
|
|
// .itemMedicineListUnit
|
|
|
|
|
// .length ==
|
|
|
|
|
// 1
|
|
|
|
|
// ? model
|
|
|
|
|
// .itemMedicineListUnit[
|
|
|
|
|
// 0][
|
|
|
|
|
// 'parameterCode']
|
|
|
|
|
// .toString()
|
|
|
|
|
// : units['parameterCode']
|
|
|
|
|
// .toString(),
|
|
|
|
|
// patient: widget.patient,
|
|
|
|
|
// doseTimeIn:
|
|
|
|
|
// doseTime['id']
|
|
|
|
|
// .toString(),
|
|
|
|
|
// model: widget.model,
|
|
|
|
|
// duration:
|
|
|
|
|
// duration['id']
|
|
|
|
|
// .toString(),
|
|
|
|
|
// frequency: frequency[
|
|
|
|
|
// 'parameterCode']
|
|
|
|
|
// .toString(),
|
|
|
|
|
// route: route[
|
|
|
|
|
// 'parameterCode']
|
|
|
|
|
// duration: duration['id']
|
|
|
|
|
// .toString(),
|
|
|
|
|
// frequency: model
|
|
|
|
|
// .itemMedicineList
|
|
|
|
|
// .length ==
|
|
|
|
|
// 1
|
|
|
|
|
// ? model
|
|
|
|
|
// .itemMedicineList[
|
|
|
|
|
// 0][
|
|
|
|
|
// 'parameterCode']
|
|
|
|
|
// .toString()
|
|
|
|
|
// : frequency[
|
|
|
|
|
// 'parameterCode']
|
|
|
|
|
// .toString(),
|
|
|
|
|
// route: model.itemMedicineListRoute
|
|
|
|
|
// .length ==
|
|
|
|
|
// 1
|
|
|
|
|
// ? model
|
|
|
|
|
// .itemMedicineListRoute[
|
|
|
|
|
// 0][
|
|
|
|
|
// 'parameterCode']
|
|
|
|
|
// .toString()
|
|
|
|
|
// : route['parameterCode']
|
|
|
|
|
// .toString(),
|
|
|
|
|
// drugId:
|
|
|
|
|
// _selectedMedication
|
|
|
|
|
// .itemId
|
|
|
|
|
@ -1240,8 +1297,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
|
// instruction:
|
|
|
|
|
// instructionController
|
|
|
|
|
// .text,
|
|
|
|
|
// doseTime:
|
|
|
|
|
// selectedDate,
|
|
|
|
|
// doseTime: selectedDate,
|
|
|
|
|
// );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -1350,7 +1406,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
|
children: [
|
|
|
|
|
DrugToDrug(
|
|
|
|
|
widget.patient,
|
|
|
|
|
getPriscriptionforDrug(widget.prescriptionList),
|
|
|
|
|
getPriscriptionforDrug(widget.prescriptionList, model),
|
|
|
|
|
model.patientAssessmentList),
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.all(SizeConfig.widthMultiplier * 3),
|
|
|
|
|
@ -1382,8 +1438,12 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
|
doseTimeIn: doseTime['id'].toString(),
|
|
|
|
|
model: widget.model,
|
|
|
|
|
duration: duration['id'].toString(),
|
|
|
|
|
frequency: frequency['parameterCode'].toString(),
|
|
|
|
|
route: route['parameterCode'].toString(),
|
|
|
|
|
frequency: model.itemMedicineList.length == 1
|
|
|
|
|
? model.itemMedicineList[0]['parameterCode']
|
|
|
|
|
: frequency['parameterCode'].toString(),
|
|
|
|
|
route: model.itemMedicineListRoute.length == 1
|
|
|
|
|
? model.itemMedicineListRoute[0]['parameterCode']
|
|
|
|
|
: route['parameterCode'].toString(),
|
|
|
|
|
drugId: _selectedMedication.itemId.toString(),
|
|
|
|
|
strength: strengthController.text,
|
|
|
|
|
indication: indicationController.text,
|
|
|
|
|
@ -1431,7 +1491,17 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getPriscriptionforDrug(List<PrescriptionModel> prescriptionList) {
|
|
|
|
|
// selectedValue(itemMdeicationList,key){
|
|
|
|
|
// // String selected = "";
|
|
|
|
|
// // units[key]=itemMdeicationList.length==1? itemMdeicationList[0][key]:units[key].toString();
|
|
|
|
|
// //
|
|
|
|
|
// // selected = units[key];
|
|
|
|
|
// //
|
|
|
|
|
// // return selected;
|
|
|
|
|
// // }
|
|
|
|
|
|
|
|
|
|
getPriscriptionforDrug(
|
|
|
|
|
List<PrescriptionModel> prescriptionList, MedicineViewModel model) {
|
|
|
|
|
var prescriptionDetails = [];
|
|
|
|
|
if (prescriptionList.length > 0) {
|
|
|
|
|
prescriptionList[0].entityList.forEach((element) {
|
|
|
|
|
@ -1455,11 +1525,19 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
|
'DrugId': _selectedMedication.mediSpanGPICode,
|
|
|
|
|
'DrugName': _selectedMedication.description,
|
|
|
|
|
'Dose': strengthController.text,
|
|
|
|
|
'DoseType': units['parameterCode'].toString(),
|
|
|
|
|
'Unit': units['description'],
|
|
|
|
|
'FrequencyType': frequency['parameterCode'].toString(),
|
|
|
|
|
'DoseType': model.itemMedicineListUnit.length == 1
|
|
|
|
|
? model.itemMedicineListUnit[0]['parameterCode'].toString()
|
|
|
|
|
: units['parameterCode'].toString(),
|
|
|
|
|
'Unit': model.itemMedicineListUnit.length == 1
|
|
|
|
|
? model.itemMedicineListUnit[0]['description']
|
|
|
|
|
: units['description'],
|
|
|
|
|
'FrequencyType': model.itemMedicineList.length == 1
|
|
|
|
|
? model.itemMedicineList[0]['parameterCode']
|
|
|
|
|
: frequency['parameterCode'].toString(),
|
|
|
|
|
'Duration': duration['id'].toString(),
|
|
|
|
|
'RouteID': route['parameterCode'].toString(),
|
|
|
|
|
'RouteID': model.itemMedicineListRoute.length == 1
|
|
|
|
|
? model.itemMedicineListRoute[0]['parameterCode'].toString()
|
|
|
|
|
: route['parameterCode'].toString(),
|
|
|
|
|
'IsScreen': true
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|