|
|
|
|
@ -1,31 +1,27 @@
|
|
|
|
|
import 'package:autocomplete_textfield/autocomplete_textfield.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/client/base_app_client.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/config/config.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/config/size_config.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/core/model/get_medication_response_model.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/core/model/post_prescrition_req_model.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/core/model/Prescription_model.dart';
|
|
|
|
|
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/livecare/transfer_to_admin.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/screens/prescription/drugtodrug.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/screens/prescription/prescription_screen.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/screens/prescription/prescription_warnings.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';
|
|
|
|
|
import 'package:doctor_app_flutter/widgets/patients/dynamic_elements.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/Text.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/TextFields.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/app_text_form_field.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/dialogs/dailog-list-select.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:hexcolor/hexcolor.dart';
|
|
|
|
|
import 'package:intl/intl.dart';
|
|
|
|
|
|
|
|
|
|
addPrescriptionForm(context, PrescriptionViewModel model,
|
|
|
|
|
PatiantInformtion patient, prescription) {
|
|
|
|
|
@ -105,6 +101,9 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
|
TextEditingController instructionController = TextEditingController();
|
|
|
|
|
DateTime selectedDate;
|
|
|
|
|
dynamic selectedDrug;
|
|
|
|
|
GetMedicationResponseModel _selectedMedication;
|
|
|
|
|
GlobalKey key =
|
|
|
|
|
new GlobalKey<AutoCompleteTextFieldState<GetMedicationResponseModel>>();
|
|
|
|
|
|
|
|
|
|
TextEditingController drugIdController = TextEditingController();
|
|
|
|
|
TextEditingController doseController = TextEditingController();
|
|
|
|
|
@ -190,14 +189,25 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
|
dynamic route25 = {"id": 37, "name": "Inserted into Vagina"};
|
|
|
|
|
dynamic route26 = {"id": 36, "name": "Inserted into Rectum"};
|
|
|
|
|
dynamic route27 = {"id": 31, "name": "In Each Nostril"};
|
|
|
|
|
dynamic frequency1 = {"id": 1, "name": "2 Times a day"};
|
|
|
|
|
dynamic frequency2 = {"id": 2, "name": "3 Times a day"};
|
|
|
|
|
dynamic frequency3 = {"id": 3, "name": "4 Times a day"};
|
|
|
|
|
dynamic frequency1 = {"id": 2, "name": "2 Times a day"};
|
|
|
|
|
dynamic frequency2 = {"id": 3, "name": "3 Times a day"};
|
|
|
|
|
dynamic frequency3 = {"id": 4, "name": "4 Times a day"};
|
|
|
|
|
dynamic frequency4 = {"id": 8, "name": "As Needed"};
|
|
|
|
|
dynamic frequency5 = {"id": 9, "name": "Bed Time"};
|
|
|
|
|
dynamic frequency6 = {"id": 11, "name": "Every Other Day"};
|
|
|
|
|
dynamic frequency7 = {"id": 29, "name": "Every Eight Hours"};
|
|
|
|
|
dynamic frequency8 = {"id": 34, "name": "As Directed"};
|
|
|
|
|
dynamic frequency9 = {"id": 22, "name": "Once Per Month"};
|
|
|
|
|
dynamic frequency10 = {"id": 2, "name": "3 Times a day"};
|
|
|
|
|
dynamic frequency11 = {"id": 21, "name": "Every 3 hours"};
|
|
|
|
|
dynamic frequency12 = {"id": 20, "name": "Once a Week"};
|
|
|
|
|
dynamic frequency13 = {"id": 12, "name": "Every Half Hour"};
|
|
|
|
|
dynamic frequency14 = {"id": 10, "name": "4 Times a Day"};
|
|
|
|
|
dynamic frequency15 = {"id": 24, "name": "Once Every 2 Months"};
|
|
|
|
|
dynamic frequency16 = {"id": 25, "name": "Every One Hour"};
|
|
|
|
|
dynamic frequency17 = {"id": 26, "name": "Every Two Hours"};
|
|
|
|
|
dynamic frequency18 = {"id": 28, "name": "Every Six Hours"};
|
|
|
|
|
|
|
|
|
|
dynamic duration1 = {"id": 1, "name": "For 1 Day"};
|
|
|
|
|
dynamic duration2 = {"id": 2, "name": "For 2 Days"};
|
|
|
|
|
dynamic duration3 = {"id": 3, "name": "For 3 Days"};
|
|
|
|
|
@ -226,6 +236,15 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
|
dynamic doseTime10 = {"id": 10, "name": "While wake"};
|
|
|
|
|
dynamic doseTime11 = {"id": 12, "name": "Any Time"};
|
|
|
|
|
dynamic doseTime12 = {"id": 21, "name": "Bed Time"};
|
|
|
|
|
dynamic doseTime13 = {"id": 13, "name": "30 Minutes Before Meals"};
|
|
|
|
|
dynamic doseTime14 = {"id": 14, "name": "1 Hour Before Meals"};
|
|
|
|
|
dynamic doseTime15 = {"id": 15, "name": "2 Hours After Meal"};
|
|
|
|
|
dynamic doseTime16 = {"id": 16, "name": "After Breakfast"};
|
|
|
|
|
dynamic doseTime17 = {"id": 17, "name": "Before Lunch"};
|
|
|
|
|
dynamic doseTime18 = {"id": 18, "name": "After Lunch"};
|
|
|
|
|
dynamic doseTime19 = {"id": 20, "name": "After Dinner"};
|
|
|
|
|
dynamic doseTime20 = {"id": 21, "name": "Bed Time"};
|
|
|
|
|
dynamic doseTime21 = {"id": 11, "name": "Now"};
|
|
|
|
|
dynamic indication1 = {"id": 545, "name": "Gingival Hyperplasia"};
|
|
|
|
|
dynamic indication2 = {"id": 546, "name": "Mild Drowsiness"};
|
|
|
|
|
dynamic indication3 = {"id": 547, "name": "Hypertrichosis"};
|
|
|
|
|
@ -265,6 +284,17 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
|
doseTimeList.add(doseTime9);
|
|
|
|
|
doseTimeList.add(doseTime10);
|
|
|
|
|
doseTimeList.add(doseTime11);
|
|
|
|
|
doseTimeList.add(doseTime12);
|
|
|
|
|
doseTimeList.add(doseTime13);
|
|
|
|
|
doseTimeList.add(doseTime14);
|
|
|
|
|
doseTimeList.add(doseTime15);
|
|
|
|
|
doseTimeList.add(doseTime16);
|
|
|
|
|
doseTimeList.add(doseTime17);
|
|
|
|
|
doseTimeList.add(doseTime18);
|
|
|
|
|
doseTimeList.add(doseTime19);
|
|
|
|
|
doseTimeList.add(doseTime20);
|
|
|
|
|
doseTimeList.add(doseTime21);
|
|
|
|
|
|
|
|
|
|
doseTimeList.add(doseTime12);
|
|
|
|
|
frequencyList.add(frequency1);
|
|
|
|
|
frequencyList.add(frequency2);
|
|
|
|
|
@ -274,6 +304,16 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
|
frequencyList.add(frequency6);
|
|
|
|
|
frequencyList.add(frequency7);
|
|
|
|
|
frequencyList.add(frequency8);
|
|
|
|
|
frequencyList.add(frequency9);
|
|
|
|
|
frequencyList.add(frequency10);
|
|
|
|
|
frequencyList.add(frequency11);
|
|
|
|
|
frequencyList.add(frequency12);
|
|
|
|
|
frequencyList.add(frequency13);
|
|
|
|
|
frequencyList.add(frequency14);
|
|
|
|
|
frequencyList.add(frequency15);
|
|
|
|
|
frequencyList.add(frequency16);
|
|
|
|
|
frequencyList.add(frequency17);
|
|
|
|
|
frequencyList.add(frequency18);
|
|
|
|
|
routeList.add(route1);
|
|
|
|
|
routeList.add(route2);
|
|
|
|
|
routeList.add(route3);
|
|
|
|
|
@ -343,11 +383,12 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
|
// final routeArgs = ModalRoute.of(context).settings.arguments as Map;
|
|
|
|
|
// patient = routeArgs['patient'];
|
|
|
|
|
|
|
|
|
|
return BaseView<PrescriptionViewModel>(
|
|
|
|
|
onModelReady: (model) => model.getDrugs(drugName: textSeartch),
|
|
|
|
|
builder:
|
|
|
|
|
(BuildContext context, PrescriptionViewModel model, Widget child) =>
|
|
|
|
|
NetworkBaseView(
|
|
|
|
|
return BaseView<MedicineViewModel>(
|
|
|
|
|
onModelReady: (model) async {
|
|
|
|
|
await model.getMedicationList();
|
|
|
|
|
},
|
|
|
|
|
builder: (BuildContext context, MedicineViewModel model, Widget child) =>
|
|
|
|
|
NetworkBaseView(
|
|
|
|
|
baseViewModel: model,
|
|
|
|
|
child: DraggableScrollableSheet(
|
|
|
|
|
initialChildSize: 0.90,
|
|
|
|
|
@ -378,152 +419,73 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
|
//mainAxisAlignment: MainAxisAlignment.end,
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
height: screenSize.height * 0.070,
|
|
|
|
|
height: MediaQuery.of(context).size.height *
|
|
|
|
|
0.070,
|
|
|
|
|
child: InkWell(
|
|
|
|
|
onTap: model.drugsList != null &&
|
|
|
|
|
model.drugsList.length > 0
|
|
|
|
|
onTap: model.allMedicationList != null
|
|
|
|
|
? () {
|
|
|
|
|
return drugDialog =
|
|
|
|
|
ListSelectDialog(
|
|
|
|
|
list: model.drugsList,
|
|
|
|
|
attributeName: 'GenericName',
|
|
|
|
|
attributeValueId: 'ItemId',
|
|
|
|
|
okText:
|
|
|
|
|
TranslationBase.of(context)
|
|
|
|
|
.ok,
|
|
|
|
|
okFunction: (selectedValue) {
|
|
|
|
|
setState(() {
|
|
|
|
|
selectedDrug = selectedValue;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
/* searchWidget: Row(
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: TextField(
|
|
|
|
|
decoration: Helpers
|
|
|
|
|
.textFieldSelectorDecoration(
|
|
|
|
|
TranslationBase.of(
|
|
|
|
|
context)
|
|
|
|
|
.search,
|
|
|
|
|
searchController.text !=
|
|
|
|
|
null &&
|
|
|
|
|
searchController
|
|
|
|
|
.text !=
|
|
|
|
|
""
|
|
|
|
|
? searchController
|
|
|
|
|
.text
|
|
|
|
|
: null,
|
|
|
|
|
false,
|
|
|
|
|
),
|
|
|
|
|
onChanged: (String str) {
|
|
|
|
|
textSeartch = str;
|
|
|
|
|
},
|
|
|
|
|
controller:
|
|
|
|
|
searchController,
|
|
|
|
|
enabled: true,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
child: InkWell(
|
|
|
|
|
child: Icon(
|
|
|
|
|
Icons.search,
|
|
|
|
|
color: Colors.black,
|
|
|
|
|
),
|
|
|
|
|
onTap: () async {
|
|
|
|
|
Navigator.of(context)
|
|
|
|
|
.pop();
|
|
|
|
|
await searchMedicine(
|
|
|
|
|
context,
|
|
|
|
|
model,
|
|
|
|
|
textSeartch);
|
|
|
|
|
showDialog(
|
|
|
|
|
barrierDismissible:
|
|
|
|
|
false,
|
|
|
|
|
context: context,
|
|
|
|
|
builder: (BuildContext
|
|
|
|
|
context) {
|
|
|
|
|
return drugDialog;
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
margin:
|
|
|
|
|
EdgeInsets.symmetric(
|
|
|
|
|
horizontal: 8),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),*/
|
|
|
|
|
);
|
|
|
|
|
showDialog(
|
|
|
|
|
barrierDismissible: false,
|
|
|
|
|
context: context,
|
|
|
|
|
builder: (BuildContext context) {
|
|
|
|
|
return drugDialog;
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
setState(() {
|
|
|
|
|
_selectedMedication = null;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
: null,
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: TextField(
|
|
|
|
|
decoration: Helpers
|
|
|
|
|
.textFieldSelectorDecoration(
|
|
|
|
|
child: _selectedMedication == null
|
|
|
|
|
? AutoCompleteTextField<
|
|
|
|
|
GetMedicationResponseModel>(
|
|
|
|
|
decoration:
|
|
|
|
|
textFieldSelectorDecoration(
|
|
|
|
|
TranslationBase.of(context)
|
|
|
|
|
.search,
|
|
|
|
|
searchController.text != null &&
|
|
|
|
|
searchController.text !=
|
|
|
|
|
""
|
|
|
|
|
? searchController.text
|
|
|
|
|
.searchMedicineNameHere,
|
|
|
|
|
_selectedMedication != null
|
|
|
|
|
? _selectedMedication
|
|
|
|
|
.genericName
|
|
|
|
|
: null,
|
|
|
|
|
false,
|
|
|
|
|
true,
|
|
|
|
|
),
|
|
|
|
|
onChanged: (String str) {
|
|
|
|
|
textSeartch = str;
|
|
|
|
|
},
|
|
|
|
|
controller: searchController,
|
|
|
|
|
enabled: true,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
child: InkWell(
|
|
|
|
|
child: Icon(
|
|
|
|
|
Icons.search,
|
|
|
|
|
color: Colors.black,
|
|
|
|
|
itemSubmitted: (item) => setState(
|
|
|
|
|
() =>
|
|
|
|
|
_selectedMedication = item),
|
|
|
|
|
key: key,
|
|
|
|
|
suggestions:
|
|
|
|
|
model.allMedicationList,
|
|
|
|
|
itemBuilder: (context,
|
|
|
|
|
suggestion) =>
|
|
|
|
|
new Padding(
|
|
|
|
|
child: Texts(suggestion
|
|
|
|
|
.description +
|
|
|
|
|
'/' +
|
|
|
|
|
suggestion.genericName),
|
|
|
|
|
padding:
|
|
|
|
|
EdgeInsets.all(8.0)),
|
|
|
|
|
itemSorter: (a, b) => 1,
|
|
|
|
|
itemFilter: (suggestion, input) =>
|
|
|
|
|
suggestion.genericName
|
|
|
|
|
.toLowerCase()
|
|
|
|
|
.startsWith(
|
|
|
|
|
input.toLowerCase()) ||
|
|
|
|
|
suggestion.description
|
|
|
|
|
.toLowerCase()
|
|
|
|
|
.startsWith(
|
|
|
|
|
input.toLowerCase()) ||
|
|
|
|
|
suggestion.keywords
|
|
|
|
|
.toLowerCase()
|
|
|
|
|
.startsWith(
|
|
|
|
|
input.toLowerCase()),
|
|
|
|
|
)
|
|
|
|
|
: TextField(
|
|
|
|
|
decoration:
|
|
|
|
|
textFieldSelectorDecoration(
|
|
|
|
|
TranslationBase.of(context)
|
|
|
|
|
.searchMedicineNameHere,
|
|
|
|
|
_selectedMedication != null
|
|
|
|
|
? _selectedMedication
|
|
|
|
|
.description +
|
|
|
|
|
('${_selectedMedication.genericName}')
|
|
|
|
|
: null,
|
|
|
|
|
true,
|
|
|
|
|
),
|
|
|
|
|
onTap: () async {
|
|
|
|
|
// Navigator.of(context)
|
|
|
|
|
// .pop();
|
|
|
|
|
await searchMedicine(
|
|
|
|
|
context, model, textSeartch);
|
|
|
|
|
showDialog(
|
|
|
|
|
barrierDismissible: false,
|
|
|
|
|
context: context,
|
|
|
|
|
builder:
|
|
|
|
|
(BuildContext context) {
|
|
|
|
|
return drugDialog;
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
enabled: false,
|
|
|
|
|
),
|
|
|
|
|
margin: EdgeInsets.symmetric(
|
|
|
|
|
horizontal: 8),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
), /*TextField(
|
|
|
|
|
decoration: textFieldSelectorDecoration(
|
|
|
|
|
TranslationBase.of(context)
|
|
|
|
|
.searchMedicine,
|
|
|
|
|
selectedDrug != null
|
|
|
|
|
? selectedDrug['GenericName']
|
|
|
|
|
: null,
|
|
|
|
|
true,
|
|
|
|
|
suffixIcon: Icon(
|
|
|
|
|
Icons.search,
|
|
|
|
|
color: Colors.black,
|
|
|
|
|
)),
|
|
|
|
|
enabled: true,
|
|
|
|
|
),*/
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
@ -554,46 +516,6 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
// 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,
|
|
|
|
|
@ -603,47 +525,21 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
|
Container(
|
|
|
|
|
width:
|
|
|
|
|
MediaQuery.of(context).size.width *
|
|
|
|
|
0.5,
|
|
|
|
|
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,
|
|
|
|
|
),
|
|
|
|
|
0.650,
|
|
|
|
|
child: TextFields(
|
|
|
|
|
hintText: TranslationBase.of(context)
|
|
|
|
|
.strength,
|
|
|
|
|
controller: strengthController,
|
|
|
|
|
keyboardType: TextInputType.number,
|
|
|
|
|
validator: (value) {
|
|
|
|
|
if (value.isEmpty &&
|
|
|
|
|
strengthController.text.length >
|
|
|
|
|
4)
|
|
|
|
|
return TranslationBase.of(context)
|
|
|
|
|
.emptyMessage;
|
|
|
|
|
else
|
|
|
|
|
return null;
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
@ -652,7 +548,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
|
Container(
|
|
|
|
|
width:
|
|
|
|
|
MediaQuery.of(context).size.width *
|
|
|
|
|
0.40,
|
|
|
|
|
0.250,
|
|
|
|
|
child: InkWell(
|
|
|
|
|
onTap: unitsList != null
|
|
|
|
|
? () {
|
|
|
|
|
@ -959,14 +855,13 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
|
// formKey.currentState.save();
|
|
|
|
|
// Navigator.pop(context);
|
|
|
|
|
// openDrugToDrug();
|
|
|
|
|
if (strength == null ||
|
|
|
|
|
route == null ||
|
|
|
|
|
if (route == null ||
|
|
|
|
|
frequency == null ||
|
|
|
|
|
indication == null ||
|
|
|
|
|
doseTime == null ||
|
|
|
|
|
duration == null ||
|
|
|
|
|
selectedDrug == null ||
|
|
|
|
|
selectedDate == null) {
|
|
|
|
|
selectedDate == null ||
|
|
|
|
|
units == null) {
|
|
|
|
|
DrAppToastMsg.showErrorToast(
|
|
|
|
|
"Please Fill All Fields");
|
|
|
|
|
return;
|
|
|
|
|
@ -974,7 +869,32 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
|
|
|
|
|
|
if (formKey.currentState.validate()) {
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
openDrugToDrug();
|
|
|
|
|
{
|
|
|
|
|
postProcedure(
|
|
|
|
|
dose: strengthController.text,
|
|
|
|
|
doseUnit:
|
|
|
|
|
units['id'].toString(),
|
|
|
|
|
patient: widget.patient,
|
|
|
|
|
doseTimeIn:
|
|
|
|
|
doseTime['id'].toString(),
|
|
|
|
|
model: widget.model,
|
|
|
|
|
duration:
|
|
|
|
|
duration['id'].toString(),
|
|
|
|
|
frequency: frequency['id']
|
|
|
|
|
.toString(),
|
|
|
|
|
route: route['id'].toString(),
|
|
|
|
|
drugId: _selectedMedication
|
|
|
|
|
.itemId
|
|
|
|
|
.toString(),
|
|
|
|
|
strength:
|
|
|
|
|
strengthController.text,
|
|
|
|
|
indication:
|
|
|
|
|
indicationController.text,
|
|
|
|
|
instruction:
|
|
|
|
|
instructionController
|
|
|
|
|
.text,
|
|
|
|
|
doseTime: selectedDate);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
// Navigator.push(
|
|
|
|
|
@ -1070,7 +990,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
|
title: TranslationBase.of(context).addMedication,
|
|
|
|
|
onPressed: () {
|
|
|
|
|
postProcedure(
|
|
|
|
|
dose: strength['id'].toString(),
|
|
|
|
|
dose: strengthController.text,
|
|
|
|
|
doseUnit: units['id'].toString(),
|
|
|
|
|
patient: widget.patient,
|
|
|
|
|
doseTimeIn: doseTime['id'].toString(),
|
|
|
|
|
@ -1079,7 +999,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
|
frequency: frequency['id'].toString(),
|
|
|
|
|
route: route['id'].toString(),
|
|
|
|
|
drugId: selectedDrug['ItemId'].toString(),
|
|
|
|
|
strength: strength['id'].toString(),
|
|
|
|
|
strength: strengthController.text,
|
|
|
|
|
indication: indicationController.text,
|
|
|
|
|
instruction: instructionController.text,
|
|
|
|
|
doseTime: selectedDate);
|
|
|
|
|
@ -1093,41 +1013,4 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// searchData(String str, PrescriptionViewModel model) {
|
|
|
|
|
// var strExist = str.length > 0 ? true : false;
|
|
|
|
|
//
|
|
|
|
|
// if (strExist) {
|
|
|
|
|
// filteredNotesList = null;
|
|
|
|
|
// filteredNotesList = model.drugsList
|
|
|
|
|
// .where((note) =>
|
|
|
|
|
// note["GenericName"].toString().contains(str.toUpperCase()))
|
|
|
|
|
// .toList();
|
|
|
|
|
// setState(() {
|
|
|
|
|
// notesList = filteredNotesList;
|
|
|
|
|
// });
|
|
|
|
|
// } else {
|
|
|
|
|
// setState(() {
|
|
|
|
|
// notesList = model.drugsList;
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
searchMedicine(context, PrescriptionViewModel model, String str) async {
|
|
|
|
|
FocusScope.of(context).unfocus();
|
|
|
|
|
// if (searchController.text.isEmpty()) {
|
|
|
|
|
// helpers.showErrorToast(TranslationBase.of(context).typeMedicineName);
|
|
|
|
|
// //"Type Medicine Name")
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
if (searchController.text.length < 0) {
|
|
|
|
|
helpers.showErrorToast(TranslationBase.of(context).moreThan3Letter);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
|
|
|
|
|
await model.getDrugs(drugName: searchController.text);
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|