You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1031 lines
50 KiB
Dart
1031 lines
50 KiB
Dart
import 'package:autocomplete_textfield/autocomplete_textfield.dart';
|
|
import 'package:doctor_app_flutter/client/base_app_client.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/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/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/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_texts_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:flutter/material.dart';
|
|
import 'package:hexcolor/hexcolor.dart';
|
|
import 'package:flutter/services.dart';
|
|
|
|
addPrescriptionForm(context, PrescriptionViewModel model,
|
|
PatiantInformtion patient, prescription) {
|
|
showModalBottomSheet(
|
|
isScrollControlled: true,
|
|
context: context,
|
|
builder: (BuildContext bc) {
|
|
return PrescriptionFormWidget(model, patient, prescription);
|
|
});
|
|
}
|
|
|
|
postProcedure(
|
|
{String duration,
|
|
String doseTimeIn,
|
|
String dose,
|
|
String drugId,
|
|
String strength,
|
|
String route,
|
|
String frequency,
|
|
String indication,
|
|
String instruction,
|
|
PrescriptionViewModel model,
|
|
DateTime doseTime,
|
|
String doseUnit,
|
|
PatiantInformtion patient}) async {
|
|
PostPrescriptionReqModel postProcedureReqModel =
|
|
new PostPrescriptionReqModel();
|
|
List<PrescriptionRequestModel> sss = List();
|
|
|
|
postProcedureReqModel.appointmentNo = patient.appointmentNo;
|
|
postProcedureReqModel.clinicID = patient.clinicId;
|
|
postProcedureReqModel.episodeID = patient.episodeNo;
|
|
postProcedureReqModel.patientMRN = patient.patientMRN;
|
|
|
|
sss.add(PrescriptionRequestModel(
|
|
covered: true,
|
|
dose: int.parse(dose),
|
|
itemId: drugId.isEmpty ? 1 : int.parse(drugId),
|
|
doseUnitId: int.parse(doseUnit),
|
|
route: route.isEmpty ? 1 : int.parse(route),
|
|
frequency: frequency.isEmpty ? 1 : int.parse(frequency),
|
|
remarks: instruction,
|
|
approvalRequired: true,
|
|
icdcode10Id: "test2",
|
|
doseTime: doseTimeIn.isEmpty ? 1 : int.parse(doseTimeIn),
|
|
duration: duration.isEmpty ? 1 : int.parse(duration),
|
|
doseStartDate: doseTime.toIso8601String()));
|
|
postProcedureReqModel.prescriptionRequestModel = sss;
|
|
//postProcedureReqModel.procedures = controlsProcedure;
|
|
|
|
await model.postPrescription(postProcedureReqModel, patient.patientMRN);
|
|
|
|
if (model.state == ViewState.ErrorLocal) {
|
|
helpers.showErrorToast(model.error);
|
|
} else if (model.state == ViewState.Idle) {
|
|
DrAppToastMsg.showSuccesToast('Medication has been added');
|
|
}
|
|
}
|
|
|
|
class PrescriptionFormWidget extends StatefulWidget {
|
|
final PrescriptionViewModel model;
|
|
PatiantInformtion patient;
|
|
List<PrescriptionModel> prescriptionList;
|
|
PrescriptionFormWidget(this.model, this.patient, this.prescriptionList);
|
|
|
|
@override
|
|
_PrescriptionFormWidgetState createState() => _PrescriptionFormWidgetState();
|
|
}
|
|
|
|
class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
int selectedType;
|
|
TextEditingController durationController = TextEditingController();
|
|
TextEditingController strengthController = TextEditingController();
|
|
TextEditingController routeController = TextEditingController();
|
|
TextEditingController frequencyController = TextEditingController();
|
|
TextEditingController indicationController = TextEditingController();
|
|
TextEditingController instructionController = TextEditingController();
|
|
DateTime selectedDate;
|
|
dynamic selectedDrug;
|
|
int strengthChar;
|
|
GetMedicationResponseModel _selectedMedication;
|
|
GlobalKey key =
|
|
new GlobalKey<AutoCompleteTextFieldState<GetMedicationResponseModel>>();
|
|
|
|
TextEditingController drugIdController = TextEditingController();
|
|
TextEditingController doseController = TextEditingController();
|
|
final searchController = TextEditingController();
|
|
|
|
var notesList;
|
|
var filteredNotesList;
|
|
String textSeartch = "Amoxicillin";
|
|
|
|
final GlobalKey<FormState> formKey = GlobalKey<FormState>();
|
|
final double spaceBetweenTextFileds = 12;
|
|
List<dynamic> referToList;
|
|
dynamic type;
|
|
dynamic strength;
|
|
dynamic route;
|
|
dynamic frequency;
|
|
dynamic duration;
|
|
dynamic doseTime;
|
|
dynamic indication;
|
|
dynamic units;
|
|
|
|
List<dynamic> strengthList;
|
|
List<dynamic> routeList;
|
|
List<dynamic> frequencyList;
|
|
List<dynamic> durationList;
|
|
List<dynamic> doseTimeList;
|
|
List<dynamic> indicationList;
|
|
List<dynamic> unitsList;
|
|
String routeInatial = 'By Mouth';
|
|
|
|
//PatiantInformtion patient;
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
selectedType = 1;
|
|
referToList = List();
|
|
strengthList = List();
|
|
routeList = List();
|
|
frequencyList = List();
|
|
durationList = List();
|
|
doseTimeList = List();
|
|
indicationList = List();
|
|
unitsList = List();
|
|
|
|
dynamic unit1 = {"id": 1, "name": "MG"};
|
|
dynamic unit2 = {"id": 2, "name": "MCG"};
|
|
dynamic unit3 = {"id": 3, "name": "GM"};
|
|
dynamic regularOrder = {"id": 1, "name": "regular Order"};
|
|
dynamic urgentOrder = {"id": 2, "name": "urgent Order"};
|
|
dynamic strength1 = {"id": 1, "name": "1"};
|
|
dynamic strength2 = {"id": 2, "name": "2"};
|
|
dynamic strength3 = {"id": 3, "name": "3"};
|
|
dynamic strength4 = {"id": 4, "name": "4"};
|
|
dynamic strength5 = {"id": 5, "name": "5"};
|
|
dynamic strength6 = {"id": 6, "name": "6"};
|
|
dynamic strength7 = {"id": 7, "name": "7"};
|
|
dynamic strength8 = {"id": 8, "name": "8"};
|
|
dynamic strength9 = {"id": 9, "name": "9"};
|
|
dynamic route1 = {"id": 7, "name": "By Mouth"};
|
|
dynamic route2 = {"id": 10, "name": "Inhale by Mouth"};
|
|
dynamic route3 = {"id": 15, "name": "for INJECTION"};
|
|
dynamic route4 = {"id": 17, "name": "Drops"};
|
|
dynamic route5 = {"id": 18, "name": "Rub On"};
|
|
dynamic route6 = {"id": 20, "name": "Spary"};
|
|
dynamic route7 = {"id": 27, "name": "In Both EYES"};
|
|
dynamic route8 = {"id": 28, "name": "In Both Ears"};
|
|
dynamic route9 = {"id": 32, "name": "Intramuscular"};
|
|
dynamic route10 = {"id": 60, "name": "TRANSDERMAL"};
|
|
dynamic route11 = {"id": 59, "name": "OROPHARYNGEAL"};
|
|
dynamic route12 = {"id": 15, "name": "for INJECTION"};
|
|
dynamic route13 = {"id": 58, "name": "SUBCUTANEOUS"};
|
|
dynamic route14 = {"id": 57, "name": "NASOGASTRIC"};
|
|
dynamic route15 = {"id": 56, "name": "IRRIGATION"};
|
|
dynamic route16 = {"id": 55, "name": "INTRAVITREAL"};
|
|
dynamic route17 = {"id": 54, "name": "INTRAVENOUS BOLUS"};
|
|
dynamic route18 = {"id": 51, "name": "EPIDURAL"};
|
|
dynamic route19 = {"id": 47, "name": "Parenteral"};
|
|
dynamic route20 = {"id": 43, "name": "IM"};
|
|
dynamic route21 = {"id": 42, "name": "IV"};
|
|
dynamic route22 = {"id": 41, "name": "Sublingual"};
|
|
dynamic route23 = {"id": 40, "name": "For Nebulization"};
|
|
dynamic route24 = {"id": 39, "name": "Nasal"};
|
|
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": 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"};
|
|
dynamic duration4 = {"id": 4, "name": "For 4 Days"};
|
|
dynamic duration5 = {"id": 5, "name": "For 5 Days"};
|
|
dynamic duration6 = {"id": 6, "name": "For 6 Days"};
|
|
dynamic duration7 = {"id": 7, "name": "For 7 Days"};
|
|
dynamic duration8 = {"id": 8, "name": "For 8 Days"};
|
|
dynamic duration9 = {"id": 9, "name": "For 9 Days"};
|
|
dynamic duration10 = {"id": 10, "name": "For 10 Days"};
|
|
dynamic duration11 = {"id": 14, "name": "For 14 Days"};
|
|
dynamic duration12 = {"id": 21, "name": "For 21 Days"};
|
|
dynamic duration13 = {"id": 30, "name": "For 30 Days"};
|
|
dynamic duration14 = {"id": 45, "name": "For 45 Days"};
|
|
dynamic duration15 = {"id": 60, "name": "For 60 Days"};
|
|
dynamic duration16 = {"id": 90, "name": "For 90 Days"};
|
|
dynamic doseTime1 = {"id": 1, "name": "Before Meals"};
|
|
dynamic doseTime2 = {"id": 2, "name": "After Meals"};
|
|
dynamic doseTime3 = {"id": 3, "name": "With Meals"};
|
|
dynamic doseTime4 = {"id": 4, "name": "In The Morning"};
|
|
dynamic doseTime5 = {"id": 5, "name": "In the Evening"};
|
|
dynamic doseTime6 = {"id": 6, "name": "After Supper"};
|
|
dynamic doseTime7 = {"id": 7, "name": "With Supper"};
|
|
dynamic doseTime8 = {"id": 8, "name": "Before Breakfast"};
|
|
dynamic doseTime9 = {"id": 9, "name": "In the Afternoon"};
|
|
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"};
|
|
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"};
|
|
|
|
unitsList.add(unit1);
|
|
unitsList.add(unit2);
|
|
unitsList.add(unit3);
|
|
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);
|
|
|
|
doseTimeList.add(doseTime1);
|
|
doseTimeList.add(doseTime2);
|
|
doseTimeList.add(doseTime3);
|
|
doseTimeList.add(doseTime4);
|
|
doseTimeList.add(doseTime5);
|
|
doseTimeList.add(doseTime6);
|
|
doseTimeList.add(doseTime7);
|
|
doseTimeList.add(doseTime8);
|
|
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);
|
|
frequencyList.add(frequency3);
|
|
frequencyList.add(frequency4);
|
|
frequencyList.add(frequency5);
|
|
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);
|
|
routeList.add(route4);
|
|
routeList.add(route5);
|
|
routeList.add(route6);
|
|
routeList.add(route7);
|
|
routeList.add(route8);
|
|
routeList.add(route9);
|
|
routeList.add(route10);
|
|
routeList.add(route11);
|
|
routeList.add(route12);
|
|
routeList.add(route13);
|
|
routeList.add(route14);
|
|
routeList.add(route15);
|
|
routeList.add(route16);
|
|
routeList.add(route17);
|
|
routeList.add(route18);
|
|
routeList.add(route19);
|
|
routeList.add(route20);
|
|
routeList.add(route21);
|
|
routeList.add(route22);
|
|
routeList.add(route23);
|
|
routeList.add(route24);
|
|
routeList.add(route25);
|
|
routeList.add(route26);
|
|
routeList.add(route27);
|
|
strengthList.add(strength1);
|
|
strengthList.add(strength2);
|
|
strengthList.add(strength3);
|
|
strengthList.add(strength4);
|
|
strengthList.add(strength5);
|
|
strengthList.add(strength6);
|
|
strengthList.add(strength7);
|
|
strengthList.add(strength8);
|
|
strengthList.add(strength9);
|
|
durationList.add(duration1);
|
|
durationList.add(duration2);
|
|
durationList.add(duration3);
|
|
durationList.add(duration4);
|
|
durationList.add(duration5);
|
|
durationList.add(duration6);
|
|
durationList.add(duration7);
|
|
durationList.add(duration8);
|
|
durationList.add(duration9);
|
|
durationList.add(duration10);
|
|
durationList.add(duration11);
|
|
durationList.add(duration12);
|
|
durationList.add(duration13);
|
|
durationList.add(duration14);
|
|
durationList.add(duration15);
|
|
durationList.add(duration16);
|
|
referToList.add(regularOrder);
|
|
referToList.add(urgentOrder);
|
|
}
|
|
|
|
setSelectedType(int val) {
|
|
setState(() {
|
|
selectedType = val;
|
|
});
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
ListSelectDialog drugDialog;
|
|
final screenSize = MediaQuery.of(context).size;
|
|
// final routeArgs = ModalRoute.of(context).settings.arguments as Map;
|
|
// patient = routeArgs['patient'];
|
|
|
|
return BaseView<MedicineViewModel>(
|
|
onModelReady: (model) async {
|
|
await model.getMedicationList();
|
|
},
|
|
builder: (BuildContext context, MedicineViewModel 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: MediaQuery.of(context).size.height *
|
|
0.070,
|
|
child: InkWell(
|
|
onTap: model.allMedicationList != null
|
|
? () {
|
|
setState(() {
|
|
_selectedMedication = null;
|
|
});
|
|
}
|
|
: null,
|
|
child: _selectedMedication == null
|
|
? AutoCompleteTextField<
|
|
GetMedicationResponseModel>(
|
|
decoration:
|
|
textFieldSelectorDecoration(
|
|
TranslationBase.of(context)
|
|
.searchMedicineNameHere,
|
|
_selectedMedication != null
|
|
? _selectedMedication
|
|
.genericName
|
|
: null,
|
|
true,
|
|
),
|
|
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,
|
|
),
|
|
enabled: false,
|
|
),
|
|
),
|
|
),
|
|
SizedBox(
|
|
height: spaceBetweenTextFileds,
|
|
),
|
|
Container(
|
|
child: Row(
|
|
children: [
|
|
AppText('Order Type'),
|
|
Radio(
|
|
activeColor: Color(0xFFB9382C),
|
|
value: 0,
|
|
groupValue: selectedType,
|
|
onChanged: (value) {
|
|
setSelectedType(value);
|
|
},
|
|
),
|
|
Text('Regular'),
|
|
Radio(
|
|
activeColor: Color(0xFFB9382C),
|
|
groupValue: selectedType,
|
|
value: 1,
|
|
onChanged: (value) {
|
|
setSelectedType(value);
|
|
},
|
|
),
|
|
Text('Urgent'),
|
|
],
|
|
),
|
|
),
|
|
SizedBox(height: spaceBetweenTextFileds),
|
|
Container(
|
|
height: screenSize.height * 0.070,
|
|
width: double.infinity,
|
|
child: Row(
|
|
children: [
|
|
Container(
|
|
width:
|
|
MediaQuery.of(context).size.width *
|
|
0.550,
|
|
child: TextFields(
|
|
inputFormatters: [
|
|
LengthLimitingTextInputFormatter(4)
|
|
],
|
|
hintText: TranslationBase.of(context)
|
|
.strength,
|
|
controller: strengthController,
|
|
keyboardType: TextInputType.number,
|
|
onChanged: (String value) {
|
|
setState(() {
|
|
strengthChar = value.length;
|
|
});
|
|
if (strengthChar >= 4) {
|
|
DrAppToastMsg.showErrorToast(
|
|
"Only 4 Digits allowed for strength");
|
|
}
|
|
},
|
|
// validator: (value) {
|
|
// if (value.isEmpty &&
|
|
// strengthController.text.length >
|
|
// 4)
|
|
// return TranslationBase.of(context)
|
|
// .emptyMessage;
|
|
// else
|
|
// return null;
|
|
// },
|
|
),
|
|
),
|
|
SizedBox(
|
|
width: 10.0,
|
|
),
|
|
Container(
|
|
width:
|
|
MediaQuery.of(context).size.width *
|
|
0.350,
|
|
child: InkWell(
|
|
onTap: unitsList != null
|
|
? () {
|
|
ListSelectDialog dialog =
|
|
ListSelectDialog(
|
|
list: unitsList,
|
|
attributeName: 'name',
|
|
attributeValueId: 'id',
|
|
okText: TranslationBase.of(
|
|
context)
|
|
.ok,
|
|
okFunction:
|
|
(selectedValue) {
|
|
setState(() {
|
|
units = selectedValue;
|
|
});
|
|
},
|
|
);
|
|
showDialog(
|
|
barrierDismissible: false,
|
|
context: context,
|
|
builder:
|
|
(BuildContext context) {
|
|
return dialog;
|
|
},
|
|
);
|
|
}
|
|
: null,
|
|
child: TextField(
|
|
decoration:
|
|
textFieldSelectorDecoration(
|
|
'UNIT Type',
|
|
units != null
|
|
? units['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;
|
|
});
|
|
},
|
|
);
|
|
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;
|
|
});
|
|
},
|
|
);
|
|
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(() {
|
|
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: 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(
|
|
margin: EdgeInsets.all(
|
|
SizeConfig.widthMultiplier * 5),
|
|
child: Wrap(
|
|
alignment: WrapAlignment.center,
|
|
children: <Widget>[
|
|
AppButton(
|
|
title: TranslationBase.of(context)
|
|
.addMedication,
|
|
onPressed: () {
|
|
// formKey.currentState.save();
|
|
// Navigator.pop(context);
|
|
// openDrugToDrug();
|
|
if (route == null ||
|
|
frequency == null ||
|
|
indication == null ||
|
|
doseTime == null ||
|
|
duration == null ||
|
|
selectedDate == null ||
|
|
units == null) {
|
|
DrAppToastMsg.showErrorToast(
|
|
"Please Fill All Fields");
|
|
return;
|
|
}
|
|
|
|
if (formKey.currentState.validate()) {
|
|
Navigator.pop(context);
|
|
{
|
|
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(
|
|
// context,
|
|
// MaterialPageRoute(
|
|
// builder: (context) =>
|
|
// NewPrescriptionScreen()),
|
|
// );
|
|
}
|
|
},
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}),
|
|
),
|
|
);
|
|
}
|
|
|
|
selectDate(BuildContext context, PrescriptionViewModel model) async {
|
|
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}) {
|
|
return InputDecoration(
|
|
focusedBorder: OutlineInputBorder(
|
|
borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0),
|
|
borderRadius: BorderRadius.circular(8),
|
|
),
|
|
enabledBorder: OutlineInputBorder(
|
|
borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0),
|
|
borderRadius: BorderRadius.circular(8),
|
|
),
|
|
disabledBorder: OutlineInputBorder(
|
|
borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0),
|
|
borderRadius: BorderRadius.circular(8),
|
|
),
|
|
hintText: selectedText != null ? selectedText : hintText,
|
|
suffixIcon: isDropDown
|
|
? suffixIcon != null
|
|
? suffixIcon
|
|
: Icon(
|
|
Icons.arrow_drop_down,
|
|
color: Colors.black,
|
|
)
|
|
: null,
|
|
hintStyle: TextStyle(
|
|
fontSize: 14,
|
|
color: Colors.grey.shade600,
|
|
),
|
|
);
|
|
}
|
|
|
|
openDrugToDrug() {
|
|
showModalBottomSheet(
|
|
context: context,
|
|
builder: (context) {
|
|
return Container(
|
|
height: SizeConfig.realScreenHeight * .5,
|
|
width: SizeConfig.realScreenWidth,
|
|
child: SingleChildScrollView(
|
|
child: Column(
|
|
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
DrugToDrug(widget.patient, widget.prescriptionList),
|
|
Container(
|
|
margin: EdgeInsets.all(SizeConfig.widthMultiplier * 3),
|
|
child: AppButton(
|
|
title: TranslationBase.of(context).addMedication,
|
|
onPressed: () {
|
|
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: selectedDrug['ItemId'].toString(),
|
|
strength: strengthController.text,
|
|
indication: indicationController.text,
|
|
instruction: instructionController.text,
|
|
doseTime: selectedDate);
|
|
},
|
|
))
|
|
],
|
|
)),
|
|
|
|
//],
|
|
//)
|
|
);
|
|
});
|
|
}
|
|
}
|