prescription form fix

merge-requests/243/head
hussam al-habibeh 5 years ago
parent f767467a67
commit 5253c28469

File diff suppressed because it is too large Load Diff

@ -60,15 +60,15 @@ postProcedure(
sss.add(PrescriptionRequestModel(
covered: true,
dose: 1,
itemId: int.parse(drugId),
itemId: drugId.isEmpty ? 1 : int.parse(drugId),
doseUnitId: 1,
route: int.parse(route),
frequency: int.parse(frequency),
route: route.isEmpty ? 1 : int.parse(route),
frequency: frequency.isEmpty ? 1 : int.parse(frequency),
remarks: instruction,
approvalRequired: true,
icdcode10Id: "test2",
doseTime: int.parse(doseTimeIn),
duration: int.parse(duration),
doseTime: doseTimeIn.isEmpty ? 1 : int.parse(doseTimeIn),
duration: duration.isEmpty ? 1 : int.parse(duration),
doseStartDate: doseTime.toIso8601String()));
postProcedureReqModel.prescriptionRequestModel = sss;
//postProcedureReqModel.procedures = controlsProcedure;
@ -120,10 +120,9 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
List<dynamic> durationList;
List<dynamic> doseTimeList;
List<dynamic> indicationList;
String routeInatial = 'By Mouth';
//PatiantInformtion patient;
dynamic _strength;
dynamic _selectedBranch;
@override
void initState() {
super.initState();
@ -260,487 +259,500 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
return BaseView<PrescriptionViewModel>(
onModelReady: (model) => model.getDrugs(),
builder: (BuildContext context, PrescriptionViewModel model,
Widget child) =>
DraggableScrollableSheet(
initialChildSize: 0.90,
maxChildSize: 0.90,
minChildSize: 0.9,
builder:
(BuildContext context, ScrollController scrollController) {
return SingleChildScrollView(
child: Container(
height: 980,
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: 12.0, vertical: 10.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
//mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
AppText(
TranslationBase.of(context).medicines.toUpperCase(),
fontWeight: FontWeight.w900,
),
SizedBox(
height: spaceBetweenTextFileds,
),
Container(
child: Form(
key: formKey,
child: Column(
//mainAxisAlignment: MainAxisAlignment.end,
children: [
Container(
height: screenSize.height * 0.070,
child: InkWell(
onTap: model.drugsList != null &&
model.drugsList.length > 0
? () {
ListSelectDialog dialog =
ListSelectDialog(
list: model.drugsList,
attributeName: 'GenericName',
attributeValueId: 'ItemId',
okText:
TranslationBase.of(context)
.ok,
okFunction: (selectedValue) {
setState(() {
selectedDrug =
selectedValue;
});
},
);
showDialog(
barrierDismissible: false,
context: context,
builder:
(BuildContext context) {
return dialog;
},
);
}
: null,
child: TextField(
decoration: textFieldSelectorDecoration(
TranslationBase.of(context).search,
selectedDrug != null
? selectedDrug['GenericName']
: null,
true),
enabled: false,
),
builder:
(BuildContext context, PrescriptionViewModel model, Widget child) =>
NetworkBaseView(
baseViewModel: model,
child: DraggableScrollableSheet(
initialChildSize: 0.90,
maxChildSize: 0.90,
minChildSize: 0.9,
builder: (BuildContext context, ScrollController scrollController) {
return SingleChildScrollView(
child: Container(
height: 980,
child: Padding(
padding:
EdgeInsets.symmetric(horizontal: 12.0, vertical: 10.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
//mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
AppText(
TranslationBase.of(context).medicines.toUpperCase(),
fontWeight: FontWeight.w900,
),
SizedBox(
height: spaceBetweenTextFileds,
),
Container(
child: Form(
key: formKey,
child: Column(
//mainAxisAlignment: MainAxisAlignment.end,
children: [
Container(
height: screenSize.height * 0.070,
child: InkWell(
onTap: model.drugsList != null &&
model.drugsList.length > 0
? () {
ListSelectDialog dialog =
ListSelectDialog(
list: model.drugsList,
attributeName: 'GenericName',
attributeValueId: 'ItemId',
okText:
TranslationBase.of(context)
.ok,
okFunction: (selectedValue) {
setState(() {
selectedDrug = selectedValue;
});
},
);
showDialog(
barrierDismissible: false,
context: context,
builder: (BuildContext context) {
return dialog;
},
);
}
: null,
child: TextField(
decoration: textFieldSelectorDecoration(
TranslationBase.of(context)
.searchMedicine,
selectedDrug != null
? selectedDrug['GenericName']
: null,
true,
suffixIcon: Icon(
Icons.search,
color: Colors.black,
)),
enabled: false,
),
),
SizedBox(
height: spaceBetweenTextFileds,
),
Container(
height: screenSize.height * 0.070,
child: InkWell(
onTap: referToList != null
? () {
ListSelectDialog dialog =
ListSelectDialog(
list: referToList,
attributeName: 'name',
attributeValueId: 'id',
okText:
TranslationBase.of(context)
.ok,
okFunction: (selectedValue) {
setState(() {
type = selectedValue;
_selectedBranch = null;
});
},
);
showDialog(
barrierDismissible: false,
context: context,
builder:
(BuildContext context) {
return dialog;
},
);
}
: null,
child: TextField(
decoration: textFieldSelectorDecoration(
TranslationBase.of(context)
.orderType,
type != null ? type['name'] : null,
true),
enabled: false,
),
SizedBox(
height: spaceBetweenTextFileds,
),
Container(
child: Row(
children: [
AppText('Order Type'),
Radio(),
Text('Regular'),
Radio(
value: 1,
),
),
Text('Urgent'),
],
),
SizedBox(height: spaceBetweenTextFileds),
Container(
height: screenSize.height * 0.070,
child: InkWell(
onTap: strengthList != null
? () {
ListSelectDialog dialog =
ListSelectDialog(
list: strengthList,
attributeName: 'name',
attributeValueId: 'id',
okText:
TranslationBase.of(context)
.ok,
okFunction: (selectedValue) {
setState(() {
strength = selectedValue;
_selectedBranch = null;
});
},
);
showDialog(
barrierDismissible: false,
context: context,
builder:
(BuildContext context) {
return dialog;
},
);
}
: null,
child: TextField(
decoration: textFieldSelectorDecoration(
TranslationBase.of(context)
.strength,
strength != null
? strength['name']
: null,
true),
enabled: false,
),
),
// Container(
// height: screenSize.height * 0.070,
// child: InkWell(
// onTap: referToList != null
// ? () {
// ListSelectDialog dialog =
// ListSelectDialog(
// list: referToList,
// attributeName: 'name',
// attributeValueId: 'id',
// okText:
// TranslationBase.of(context)
// .ok,
// okFunction: (selectedValue) {
// setState(() {
// type = selectedValue;
// _selectedBranch = null;
// });
// },
// );
// showDialog(
// barrierDismissible: false,
// context: context,
// builder:
// (BuildContext context) {
// return dialog;
// },
// );
// }
// : null,
// child: TextField(
// decoration: textFieldSelectorDecoration(
// TranslationBase.of(context)
// .orderType,
// type != null ? type['name'] : null,
// true),
// enabled: false,
// ),
// ),
// ),
SizedBox(height: spaceBetweenTextFileds),
Container(
height: screenSize.height * 0.070,
child: InkWell(
onTap: strengthList != null
? () {
ListSelectDialog dialog =
ListSelectDialog(
list: strengthList,
attributeName: 'name',
attributeValueId: 'id',
okText:
TranslationBase.of(context)
.ok,
okFunction: (selectedValue) {
setState(() {
strength = selectedValue;
});
},
);
showDialog(
barrierDismissible: false,
context: context,
builder: (BuildContext context) {
return dialog;
},
);
}
: null,
child: TextField(
decoration: textFieldSelectorDecoration(
TranslationBase.of(context).strength,
strength != null
? strength['name']
: null,
true),
enabled: false,
),
),
SizedBox(height: spaceBetweenTextFileds),
Container(
height: screenSize.height * 0.070,
child: InkWell(
onTap: routeList != null
? () {
ListSelectDialog dialog =
ListSelectDialog(
list: routeList,
attributeName: 'name',
attributeValueId: 'id',
okText:
TranslationBase.of(context)
.ok,
okFunction: (selectedValue) {
setState(() {
route = selectedValue;
_selectedBranch = null;
});
},
);
showDialog(
barrierDismissible: false,
context: context,
builder:
(BuildContext context) {
return dialog;
},
);
}
: null,
child: TextField(
decoration: textFieldSelectorDecoration(
TranslationBase.of(context).route,
route != null
? route['name']
: null,
true),
enabled: false,
),
),
SizedBox(height: spaceBetweenTextFileds),
Container(
height: screenSize.height * 0.070,
child: InkWell(
onTap: routeList != null
? () {
ListSelectDialog dialog =
ListSelectDialog(
list: routeList,
attributeName: 'name',
attributeValueId: 'id',
okText:
TranslationBase.of(context)
.ok,
okFunction: (selectedValue) {
setState(() {
route = selectedValue;
});
if (route == null) {
helpers.showErrorToast(
'plase fill');
}
},
);
showDialog(
barrierDismissible: false,
context: context,
builder: (BuildContext context) {
return dialog;
},
);
}
: null,
child: TextField(
decoration: textFieldSelectorDecoration(
TranslationBase.of(context).route,
route != null ? route['name'] : null,
true),
enabled: false,
),
),
SizedBox(height: spaceBetweenTextFileds),
Container(
height: screenSize.height * 0.070,
child: InkWell(
onTap: frequencyList != null
? () {
ListSelectDialog dialog =
ListSelectDialog(
list: frequencyList,
attributeName: 'name',
attributeValueId: 'id',
okText:
TranslationBase.of(context)
.ok,
okFunction: (selectedValue) {
setState(() {
frequency = selectedValue;
_selectedBranch = null;
});
},
);
showDialog(
barrierDismissible: false,
context: context,
builder:
(BuildContext context) {
return dialog;
},
);
}
: null,
child: TextField(
decoration: textFieldSelectorDecoration(
TranslationBase.of(context)
.frequency,
frequency != null
? frequency['name']
: null,
true),
enabled: false,
),
),
SizedBox(height: spaceBetweenTextFileds),
Container(
height: screenSize.height * 0.070,
child: InkWell(
onTap: frequencyList != null
? () {
ListSelectDialog dialog =
ListSelectDialog(
list: frequencyList,
attributeName: 'name',
attributeValueId: 'id',
okText:
TranslationBase.of(context)
.ok,
okFunction: (selectedValue) {
setState(() {
frequency = selectedValue;
});
},
);
showDialog(
barrierDismissible: false,
context: context,
builder: (BuildContext context) {
return dialog;
},
);
}
: null,
child: TextField(
decoration: textFieldSelectorDecoration(
TranslationBase.of(context).frequency,
frequency != null
? frequency['name']
: null,
true),
enabled: false,
),
),
SizedBox(height: spaceBetweenTextFileds),
Container(
height: screenSize.height * 0.070,
child: InkWell(
onTap: doseTimeList != null
? () {
ListSelectDialog dialog =
ListSelectDialog(
list: doseTimeList,
attributeName: 'name',
attributeValueId: 'id',
okText:
TranslationBase.of(context)
.ok,
okFunction: (selectedValue) {
setState(() {
doseTime = selectedValue;
_selectedBranch = null;
});
},
);
showDialog(
barrierDismissible: false,
context: context,
builder:
(BuildContext context) {
return dialog;
},
);
}
: null,
child: TextField(
decoration: textFieldSelectorDecoration(
TranslationBase.of(context)
.doseTime,
doseTime != null
? doseTime['name']
: null,
true),
enabled: false,
),
),
SizedBox(height: spaceBetweenTextFileds),
Container(
height: screenSize.height * 0.070,
child: InkWell(
onTap: doseTimeList != null
? () {
ListSelectDialog dialog =
ListSelectDialog(
list: doseTimeList,
attributeName: 'name',
attributeValueId: 'id',
okText:
TranslationBase.of(context)
.ok,
okFunction: (selectedValue) {
setState(() {
doseTime = selectedValue;
});
},
);
showDialog(
barrierDismissible: false,
context: context,
builder: (BuildContext context) {
return dialog;
},
);
}
: null,
child: TextField(
decoration: textFieldSelectorDecoration(
TranslationBase.of(context).doseTime,
doseTime != null
? doseTime['name']
: null,
true),
enabled: false,
),
),
SizedBox(height: spaceBetweenTextFileds),
Container(
height: screenSize.height * 0.070,
child: InkWell(
onTap: indicationList != null
? () {
ListSelectDialog dialog =
ListSelectDialog(
list: indicationList,
attributeName: 'name',
attributeValueId: 'id',
okText:
TranslationBase.of(context)
.ok,
okFunction: (selectedValue) {
setState(() {
indicationList =
selectedValue;
_selectedBranch = null;
});
},
);
showDialog(
barrierDismissible: false,
context: context,
builder:
(BuildContext context) {
return dialog;
},
);
}
: null,
child: TextField(
decoration: textFieldSelectorDecoration(
TranslationBase.of(context)
.indication,
indication != null
? indication['name']
: null,
true),
enabled: false,
),
),
SizedBox(height: spaceBetweenTextFileds),
Container(
height: screenSize.height * 0.070,
child: InkWell(
onTap: indicationList != null
? () {
ListSelectDialog dialog =
ListSelectDialog(
list: indicationList,
attributeName: 'name',
attributeValueId: 'id',
okText:
TranslationBase.of(context)
.ok,
okFunction: (selectedValue) {
setState(() {
indication = selectedValue;
});
},
);
showDialog(
barrierDismissible: false,
context: context,
builder: (BuildContext context) {
return dialog;
},
);
}
: null,
child: TextField(
decoration: textFieldSelectorDecoration(
TranslationBase.of(context)
.indication,
indication != null
? indication['name']
: null,
true),
enabled: false,
),
),
SizedBox(height: spaceBetweenTextFileds),
Container(
height: screenSize.height * 0.070,
child: InkWell(
onTap: () =>
selectDate(context, widget.model),
child: TextField(
decoration:
Helpers.textFieldSelectorDecoration(
TranslationBase.of(context)
.date,
selectedDate != null
? "${DateUtils.convertStringToDateFormat(selectedDate.toString(), "yyyy-MM-dd")}"
: null,
true,
suffixIcon: Icon(
Icons.calendar_today,
color: Colors.black,
)),
enabled: false,
),
),
SizedBox(height: spaceBetweenTextFileds),
Container(
height: screenSize.height * 0.070,
child: InkWell(
onTap: () =>
selectDate(context, widget.model),
child: TextField(
decoration:
Helpers.textFieldSelectorDecoration(
TranslationBase.of(context).date,
selectedDate != null
? "${DateUtils.convertStringToDateFormat(selectedDate.toString(), "yyyy-MM-dd")}"
: null,
true,
suffixIcon: Icon(
Icons.calendar_today,
color: Colors.black,
)),
enabled: false,
),
),
SizedBox(height: spaceBetweenTextFileds),
Container(
height: screenSize.height * 0.070,
child: InkWell(
onTap: durationList != null
? () {
ListSelectDialog dialog =
ListSelectDialog(
list: durationList,
attributeName: 'name',
attributeValueId: 'id',
okText:
TranslationBase.of(context)
.ok,
okFunction: (selectedValue) {
setState(() {
duration = selectedValue;
_selectedBranch = null;
});
},
);
showDialog(
barrierDismissible: false,
context: context,
builder:
(BuildContext context) {
return dialog;
},
);
}
: null,
child: TextField(
decoration: textFieldSelectorDecoration(
TranslationBase.of(context)
.duration,
duration != null
? duration['name']
: null,
true),
enabled: false,
),
),
SizedBox(height: spaceBetweenTextFileds),
Container(
height: screenSize.height * 0.070,
child: InkWell(
onTap: durationList != null
? () {
ListSelectDialog dialog =
ListSelectDialog(
list: durationList,
attributeName: 'name',
attributeValueId: 'id',
okText:
TranslationBase.of(context)
.ok,
okFunction: (selectedValue) {
setState(() {
duration = selectedValue;
});
},
);
showDialog(
barrierDismissible: false,
context: context,
builder: (BuildContext context) {
return dialog;
},
);
}
: null,
child: TextField(
decoration: textFieldSelectorDecoration(
TranslationBase.of(context).duration,
duration != null
? duration['name']
: null,
true),
enabled: false,
),
),
SizedBox(height: spaceBetweenTextFileds),
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(6.0)),
border: Border.all(
width: 1.0,
color: HexColor("#CCCCCC"))),
child: TextFields(
maxLines: 6,
minLines: 4,
hintText: TranslationBase.of(context)
.instruction,
controller: instructionController,
//keyboardType: TextInputType.number,
validator: (value) {
if (value.isEmpty)
return TranslationBase.of(context)
.emptyMessage;
else
return null;
},
),
),
SizedBox(height: spaceBetweenTextFileds),
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(6.0)),
border: Border.all(
width: 1.0,
color: HexColor("#CCCCCC"))),
child: TextFields(
maxLines: 6,
minLines: 4,
hintText:
TranslationBase.of(context).instruction,
controller: instructionController,
//keyboardType: TextInputType.number,
validator: (value) {
if (value.isEmpty)
return TranslationBase.of(context)
.emptyMessage;
else
return null;
},
),
SizedBox(height: spaceBetweenTextFileds),
Container(
margin: EdgeInsets.all(
SizeConfig.widthMultiplier * 5),
child: Wrap(
alignment: WrapAlignment.center,
children: <Widget>[
AppButton(
title: TranslationBase.of(context)
.addMedication,
onPressed: () {
formKey.currentState.save();
),
SizedBox(height: spaceBetweenTextFileds),
Container(
margin: EdgeInsets.all(
SizeConfig.widthMultiplier * 5),
child: Wrap(
alignment: WrapAlignment.center,
children: <Widget>[
AppButton(
title: TranslationBase.of(context)
.addMedication,
onPressed: () {
formKey.currentState.save();
if (formKey.currentState
.validate()) {
postProcedure(
patient: widget.patient,
doseTimeIn:
doseTime['id'].toString(),
model: widget.model,
duration:
duration['id'].toString(),
frequency: frequency['id']
.toString(),
route: route['id'].toString(),
drugId: selectedDrug['ItemId']
.toString(),
strength:
strength['id'].toString(),
indication:
indicationController.text,
instruction:
instructionController
.text,
doseTime: selectedDate);
Navigator.pop(context);
}
{
// Navigator.push(
// context,
// MaterialPageRoute(
// builder: (context) =>
// NewPrescriptionScreen()),
// );
}
},
),
],
),
if (strength == null ||
route == null ||
frequency == null ||
indication == null ||
doseTime == null ||
duration == null ||
selectedDrug == null ||
selectedDate == null) {
DrAppToastMsg.showErrorToast(
"Please Fill All Fields");
return;
}
if (formKey.currentState.validate()) {
postProcedure(
patient: widget.patient,
doseTimeIn:
doseTime['id'].toString(),
model: widget.model,
duration:
duration['id'].toString(),
frequency:
frequency['id'].toString(),
route: route['id'].toString(),
drugId: selectedDrug['ItemId']
.toString(),
strength:
strength['id'].toString(),
indication:
indicationController.text,
instruction:
instructionController.text,
doseTime: selectedDate);
Navigator.pop(context);
}
{
// Navigator.push(
// context,
// MaterialPageRoute(
// builder: (context) =>
// NewPrescriptionScreen()),
// );
}
},
),
],
),
],
),
),
],
),
),
],
),
),
],
),
),
);
}),
),
);
}),
),
);
}

@ -679,6 +679,7 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
title: 'update prescription'.toUpperCase(),
onPressed: () {
updatePrescription(
patient: patient,
model: model,
drugId: drugId,
remarks: remarksController.text,
@ -700,23 +701,23 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
});
}
updatePrescription({
PrescriptionViewModel model,
int drugId,
String remarks,
String dose,
String frequency,
String route,
}) async {
updatePrescription(
{PrescriptionViewModel model,
int drugId,
String remarks,
String dose,
String frequency,
String route,
PatiantInformtion patient}) async {
//PrescriptionViewModel model = PrescriptionViewModel();
PostPrescriptionReqModel updatePrescriptionReqModel =
new PostPrescriptionReqModel();
List<PrescriptionRequestModel> sss = List();
updatePrescriptionReqModel.appointmentNo = 2016055159;
updatePrescriptionReqModel.clinicID = 17;
updatePrescriptionReqModel.episodeID = 200012330;
updatePrescriptionReqModel.patientMRN = 3120877;
updatePrescriptionReqModel.appointmentNo = patient.appointmentNo;
updatePrescriptionReqModel.clinicID = patient.clinicId;
updatePrescriptionReqModel.episodeID = patient.episodeNo;
updatePrescriptionReqModel.patientMRN = patient.patientMRN;
updatePrescriptionReqModel.vidaAuthTokenID =
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMDAyIiwianRpIjoiOGFjNDRjZGQtOWE0Mi00M2YxLWE2YTQtMWQ4NzBmZmYwNTUyIiwiZW1haWwiOiIiLCJpZCI6IjEwMDIiLCJOYW1lIjoiVEVNUCAtIERPQ1RPUiIsIkVtcGxveWVlSWQiOiI0NzA5IiwiRmFjaWxpdHlHcm91cElkIjoiMDEwMjY2IiwiRmFjaWxpdHlJZCI6IjE1IiwiUGhhcmFtY3lGYWNpbGl0eUlkIjoiNTUiLCJJU19QSEFSTUFDWV9DT05ORUNURUQiOiJUcnVlIiwiRG9jdG9ySWQiOiI0NzA5IiwiU0VTU0lPTklEIjoiMjE1OTU2NDkiLCJDbGluaWNJZCI6IjEiLCJyb2xlIjpbIkRPQ1RPUlMiLCJIRUFEIERPQ1RPUlMiLCJBRE1JTklTVFJBVE9SUyIsIlJFQ0VQVElPTklTVCIsIkVSIE5VUlNFIiwiRVIgUkVDRVBUSU9OSVNUIiwiUEhBUk1BQ1kgQUNDT1VOVCBTVEFGRiIsIlBIQVJNQUNZIE5VUlNFIiwiSU5QQVRJRU5UIFBIQVJNQUNJU1QiLCJBRE1JU1NJT04gU1RBRkYiLCJBUFBST1ZBTCBTVEFGRiIsIkNPTlNFTlQgIiwiTUVESUNBTCBSRVBPUlQgLSBTSUNLIExFQVZFIE1BTkFHRVIiXSwibmJmIjoxNjA4NzM2NjY5LCJleHAiOjE2MDk2MDA2NjksImlhdCI6MTYwODczNjY2OX0.9EDgYrbe5fQA2CvgLdFT4s_PL7hD5R_Qggfpv4lDtUY";
sss.add(PrescriptionRequestModel(

Loading…
Cancel
Save