|
|
|
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/post_prescrition_req_model.dart';
|
|
|
|
import 'package:doctor_app_flutter/core/viewModel/prescription_view_model.dart';
|
|
|
|
import 'package:doctor_app_flutter/icons_app/doctor_app_icons.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/add_prescription_form.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/profile/patient_profile_widget.dart';
|
|
|
|
import 'package:doctor_app_flutter/widgets/patients/profile/profile_medical_info_widget.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_scaffold_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/network_base_view.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:hexcolor/hexcolor.dart';
|
|
|
|
|
|
|
|
class NewPrescriptionScreen extends StatefulWidget {
|
|
|
|
@override
|
|
|
|
_NewPrescriptionScreenState createState() => _NewPrescriptionScreenState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
|
|
|
|
PersistentBottomSheetController _controller;
|
|
|
|
final _scaffoldKey = GlobalKey<ScaffoldState>();
|
|
|
|
int testNum = 0;
|
|
|
|
PatiantInformtion patient;
|
|
|
|
dynamic route;
|
|
|
|
dynamic doseTime;
|
|
|
|
dynamic frequencyUpdate;
|
|
|
|
|
|
|
|
List<dynamic> doseTimeList;
|
|
|
|
List<dynamic> routeList;
|
|
|
|
List<dynamic> frequencyList;
|
|
|
|
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
super.initState();
|
|
|
|
routeList = List();
|
|
|
|
doseTimeList = List();
|
|
|
|
frequencyList = List();
|
|
|
|
|
|
|
|
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 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 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 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"};
|
|
|
|
|
|
|
|
frequencyList.add(frequency1);
|
|
|
|
frequencyList.add(frequency2);
|
|
|
|
frequencyList.add(frequency3);
|
|
|
|
frequencyList.add(frequency4);
|
|
|
|
frequencyList.add(frequency5);
|
|
|
|
frequencyList.add(frequency6);
|
|
|
|
frequencyList.add(frequency7);
|
|
|
|
frequencyList.add(frequency8);
|
|
|
|
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);
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
final screenSize = MediaQuery.of(context).size;
|
|
|
|
final routeArgs = ModalRoute.of(context).settings.arguments as Map;
|
|
|
|
patient = routeArgs['patient'];
|
|
|
|
return BaseView<PrescriptionViewModel>(
|
|
|
|
onModelReady: (model) => model.getPrescription(mrn: patient.patientMRN),
|
|
|
|
builder:
|
|
|
|
(BuildContext context, PrescriptionViewModel model, Widget child) =>
|
|
|
|
AppScaffold(
|
|
|
|
isShowAppBar: true,
|
|
|
|
appBarTitle: TranslationBase.of(context).prescription,
|
|
|
|
body: NetworkBaseView(
|
|
|
|
baseViewModel: model,
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
child: Container(
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.all(8.0),
|
|
|
|
child: Row(
|
|
|
|
children: <Widget>[
|
|
|
|
AvatarWidget(
|
|
|
|
Icon(
|
|
|
|
patient.genderDescription == "Male"
|
|
|
|
? DoctorApp.male
|
|
|
|
: DoctorApp.female_icon,
|
|
|
|
size: 70,
|
|
|
|
color: Colors.white,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
width: 20,
|
|
|
|
),
|
|
|
|
Column(
|
|
|
|
crossAxisAlignment:
|
|
|
|
CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
AppText(
|
|
|
|
patient.firstName +
|
|
|
|
' ' +
|
|
|
|
patient.lastName,
|
|
|
|
color: Colors.black,
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
),
|
|
|
|
//if (model.prescriptionList.length > 0)
|
|
|
|
Row(
|
|
|
|
children: [
|
|
|
|
AppText(
|
|
|
|
TranslationBase.of(context).age2,
|
|
|
|
color: Colors.black,
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
width: 5.0,
|
|
|
|
),
|
|
|
|
AppText(
|
|
|
|
patient.age.toString(),
|
|
|
|
color: Colors.black,
|
|
|
|
fontWeight: FontWeight.normal,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
AppText(
|
|
|
|
"ALLERGIC TO: FOOD, ASPIRIN",
|
|
|
|
color: Color(0xFFB9382C),
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Divider(
|
|
|
|
height: 1.0,
|
|
|
|
thickness: 1.0,
|
|
|
|
color: Colors.grey,
|
|
|
|
),
|
|
|
|
(model.prescriptionList.length != 0)
|
|
|
|
? SizedBox(
|
|
|
|
height:
|
|
|
|
model.prescriptionList[0].rowcount == 0
|
|
|
|
? 200.0
|
|
|
|
: 10.0)
|
|
|
|
: SizedBox(height: 200.0),
|
|
|
|
//model.prescriptionList == null
|
|
|
|
(model.prescriptionList.length != 0)
|
|
|
|
? model.prescriptionList[0].rowcount == 0
|
|
|
|
? Column(
|
|
|
|
mainAxisAlignment:
|
|
|
|
MainAxisAlignment.center,
|
|
|
|
crossAxisAlignment:
|
|
|
|
CrossAxisAlignment.stretch,
|
|
|
|
children: [
|
|
|
|
InkWell(
|
|
|
|
onTap: () {
|
|
|
|
addPrescriptionForm(
|
|
|
|
context,
|
|
|
|
model,
|
|
|
|
patient,
|
|
|
|
model.prescriptionList);
|
|
|
|
//model.postPrescription();
|
|
|
|
},
|
|
|
|
child: CircleAvatar(
|
|
|
|
radius: 65,
|
|
|
|
backgroundColor:
|
|
|
|
Color(0XFFB8382C),
|
|
|
|
child: CircleAvatar(
|
|
|
|
radius: 60,
|
|
|
|
backgroundColor: Colors.white,
|
|
|
|
child: Icon(
|
|
|
|
Icons.add,
|
|
|
|
color: Colors.black,
|
|
|
|
size: 45.0,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
height: 15.0,
|
|
|
|
),
|
|
|
|
Row(
|
|
|
|
mainAxisAlignment:
|
|
|
|
MainAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
AppText(
|
|
|
|
TranslationBase.of(context)
|
|
|
|
.noPrescriptionListed,
|
|
|
|
color: Colors.black,
|
|
|
|
fontWeight: FontWeight.w900,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
Row(
|
|
|
|
mainAxisAlignment:
|
|
|
|
MainAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
AppText(
|
|
|
|
TranslationBase.of(context)
|
|
|
|
.addNow,
|
|
|
|
color: Color(0XFFB8382C),
|
|
|
|
fontWeight: FontWeight.w900,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
],
|
|
|
|
)
|
|
|
|
: Padding(
|
|
|
|
padding: EdgeInsets.all(14.0),
|
|
|
|
child: NetworkBaseView(
|
|
|
|
baseViewModel: model,
|
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment:
|
|
|
|
MainAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
InkWell(
|
|
|
|
child: Container(
|
|
|
|
height: 50.0,
|
|
|
|
width: 450.0,
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
border: Border.all(
|
|
|
|
color: Colors.grey),
|
|
|
|
borderRadius:
|
|
|
|
BorderRadius.circular(
|
|
|
|
10.0),
|
|
|
|
),
|
|
|
|
child: Padding(
|
|
|
|
padding:
|
|
|
|
EdgeInsets.all(8.0),
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment:
|
|
|
|
MainAxisAlignment
|
|
|
|
.spaceBetween,
|
|
|
|
children: [
|
|
|
|
AppText(
|
|
|
|
' Add more medication',
|
|
|
|
fontWeight:
|
|
|
|
FontWeight.w100,
|
|
|
|
fontSize: 12.5,
|
|
|
|
),
|
|
|
|
Icon(
|
|
|
|
Icons.add,
|
|
|
|
color:
|
|
|
|
Color(0XFFB8382C),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
onTap: () {
|
|
|
|
addPrescriptionForm(
|
|
|
|
context,
|
|
|
|
model,
|
|
|
|
patient,
|
|
|
|
model.prescriptionList);
|
|
|
|
//model.postPrescription();
|
|
|
|
},
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
height: 15.0,
|
|
|
|
),
|
|
|
|
...List.generate(
|
|
|
|
model.prescriptionList[0]
|
|
|
|
.rowcount,
|
|
|
|
(index) => Container(
|
|
|
|
//height: 240,
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
Row(
|
|
|
|
mainAxisAlignment:
|
|
|
|
MainAxisAlignment
|
|
|
|
.spaceBetween,
|
|
|
|
// crossAxisAlignment:
|
|
|
|
// CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
height: MediaQuery.of(
|
|
|
|
context)
|
|
|
|
.size
|
|
|
|
.height *
|
|
|
|
0.23,
|
|
|
|
width: MediaQuery.of(
|
|
|
|
context)
|
|
|
|
.size
|
|
|
|
.width *
|
|
|
|
0.09,
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
AppText(
|
|
|
|
DateTime.parse(model
|
|
|
|
.prescriptionList[
|
|
|
|
0]
|
|
|
|
.entityList[
|
|
|
|
index]
|
|
|
|
.startDate)
|
|
|
|
.day
|
|
|
|
.toString(),
|
|
|
|
color: Colors
|
|
|
|
.green,
|
|
|
|
),
|
|
|
|
AppText(
|
|
|
|
Helpers.getMonth(model.prescriptionList[0].entityList[index].startDate !=
|
|
|
|
null
|
|
|
|
? (DateTime.parse(model.prescriptionList[0].entityList[index].startDate)
|
|
|
|
.month)
|
|
|
|
: DateTime.now()
|
|
|
|
.month)
|
|
|
|
.toUpperCase(),
|
|
|
|
color: Colors
|
|
|
|
.green,
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
height: MediaQuery.of(
|
|
|
|
context)
|
|
|
|
.size
|
|
|
|
.height *
|
|
|
|
0.282,
|
|
|
|
width: MediaQuery.of(
|
|
|
|
context)
|
|
|
|
.size
|
|
|
|
.width *
|
|
|
|
0.77,
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
Row(
|
|
|
|
children: [
|
|
|
|
AppText(
|
|
|
|
'Start Date:',
|
|
|
|
fontWeight:
|
|
|
|
FontWeight
|
|
|
|
.w700,
|
|
|
|
fontSize:
|
|
|
|
14.0,
|
|
|
|
),
|
|
|
|
Expanded(
|
|
|
|
child:
|
|
|
|
AppText(
|
|
|
|
model
|
|
|
|
.prescriptionList[0]
|
|
|
|
.entityList[index]
|
|
|
|
.startDate,
|
|
|
|
fontSize:
|
|
|
|
12.0,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
width:
|
|
|
|
6.0,
|
|
|
|
),
|
|
|
|
AppText(
|
|
|
|
'Order Type:',
|
|
|
|
fontWeight:
|
|
|
|
FontWeight
|
|
|
|
.w700,
|
|
|
|
fontSize:
|
|
|
|
14.0,
|
|
|
|
),
|
|
|
|
Expanded(
|
|
|
|
child:
|
|
|
|
AppText(
|
|
|
|
model
|
|
|
|
.prescriptionList[0]
|
|
|
|
.entityList[index]
|
|
|
|
.orderTypeDescription,
|
|
|
|
fontSize:
|
|
|
|
13.0,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
height: 5.5,
|
|
|
|
),
|
|
|
|
Row(
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
child:
|
|
|
|
Expanded(
|
|
|
|
child:
|
|
|
|
AppText(
|
|
|
|
model
|
|
|
|
.prescriptionList[0]
|
|
|
|
.entityList[index]
|
|
|
|
.medicationName,
|
|
|
|
fontWeight:
|
|
|
|
FontWeight.w700,
|
|
|
|
fontSize:
|
|
|
|
15.0,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
height: 5.5,
|
|
|
|
),
|
|
|
|
Row(
|
|
|
|
children: [
|
|
|
|
Expanded(
|
|
|
|
child:
|
|
|
|
AppText(
|
|
|
|
model
|
|
|
|
.prescriptionList[0]
|
|
|
|
.entityList[index]
|
|
|
|
.doseDetail,
|
|
|
|
fontSize:
|
|
|
|
15.0,
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
height: 3.0,
|
|
|
|
),
|
|
|
|
Row(
|
|
|
|
children: [
|
|
|
|
AppText(
|
|
|
|
'Indication: ',
|
|
|
|
fontWeight:
|
|
|
|
FontWeight
|
|
|
|
.w700,
|
|
|
|
fontSize:
|
|
|
|
17.0,
|
|
|
|
),
|
|
|
|
Expanded(
|
|
|
|
child: AppText(
|
|
|
|
model
|
|
|
|
.prescriptionList[0]
|
|
|
|
.entityList[index]
|
|
|
|
.indication,
|
|
|
|
fontSize: 15.0),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
height: 18.0,
|
|
|
|
),
|
|
|
|
Row(
|
|
|
|
children: [
|
|
|
|
Expanded(
|
|
|
|
child:
|
|
|
|
AppText(
|
|
|
|
model
|
|
|
|
.prescriptionList[0]
|
|
|
|
.entityList[index]
|
|
|
|
.doctorName,
|
|
|
|
fontWeight:
|
|
|
|
FontWeight.w700,
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
Row(
|
|
|
|
children: [
|
|
|
|
Expanded(
|
|
|
|
child:
|
|
|
|
AppText(
|
|
|
|
model
|
|
|
|
.prescriptionList[0]
|
|
|
|
.entityList[index]
|
|
|
|
.remarks,
|
|
|
|
fontSize:
|
|
|
|
14.0,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
height: 10.0,
|
|
|
|
),
|
|
|
|
|
|
|
|
Divider(
|
|
|
|
height: 0,
|
|
|
|
thickness:
|
|
|
|
1.0,
|
|
|
|
color: Colors
|
|
|
|
.grey,
|
|
|
|
),
|
|
|
|
// SizedBox(
|
|
|
|
// height: 40,
|
|
|
|
// ),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
height: MediaQuery.of(
|
|
|
|
context)
|
|
|
|
.size
|
|
|
|
.height *
|
|
|
|
0.05,
|
|
|
|
width: MediaQuery.of(
|
|
|
|
context)
|
|
|
|
.size
|
|
|
|
.width *
|
|
|
|
0.06,
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
InkWell(
|
|
|
|
child: Icon(
|
|
|
|
Icons
|
|
|
|
.edit),
|
|
|
|
onTap: () {
|
|
|
|
updatePrescriptionForm(
|
|
|
|
doseUnit:
|
|
|
|
model.prescriptionList[0].entityList[index].doseDailyUnitID
|
|
|
|
.toString(),
|
|
|
|
doseStreangth:
|
|
|
|
model.prescriptionList[0].entityList[index].doseDailyQuantity
|
|
|
|
.toString(),
|
|
|
|
duration:
|
|
|
|
model.prescriptionList[0].entityList[index].doseDurationDays
|
|
|
|
.toString(),
|
|
|
|
startDate:
|
|
|
|
model.prescriptionList[0].entityList[index].startDate
|
|
|
|
.toString(),
|
|
|
|
dose: model
|
|
|
|
.prescriptionList[
|
|
|
|
0]
|
|
|
|
.entityList[
|
|
|
|
index]
|
|
|
|
.doseTimingID
|
|
|
|
.toString(),
|
|
|
|
frequency: model
|
|
|
|
.prescriptionList[
|
|
|
|
0]
|
|
|
|
.entityList[
|
|
|
|
index]
|
|
|
|
.frequencyID
|
|
|
|
.toString(),
|
|
|
|
rouat: model
|
|
|
|
.prescriptionList[
|
|
|
|
0]
|
|
|
|
.entityList[
|
|
|
|
index]
|
|
|
|
.routeID
|
|
|
|
.toString(),
|
|
|
|
patient:
|
|
|
|
patient,
|
|
|
|
drugId: model
|
|
|
|
.prescriptionList[0]
|
|
|
|
.entityList[index]
|
|
|
|
.medicineCode,
|
|
|
|
drugName: model.prescriptionList[0].entityList[index].doseDetail,
|
|
|
|
remarks: model.prescriptionList[0].entityList[index].remarks,
|
|
|
|
model: model,
|
|
|
|
enteredRemarks: model.prescriptionList[0].entityList[index].remarks,
|
|
|
|
context: context);
|
|
|
|
//model.postPrescription();
|
|
|
|
},
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
: Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
crossAxisAlignment:
|
|
|
|
CrossAxisAlignment.stretch,
|
|
|
|
children: [
|
|
|
|
InkWell(
|
|
|
|
onTap: () {
|
|
|
|
addPrescriptionForm(context, model,
|
|
|
|
patient, model.prescriptionList);
|
|
|
|
//model.postPrescription();
|
|
|
|
},
|
|
|
|
child: CircleAvatar(
|
|
|
|
radius: 65,
|
|
|
|
backgroundColor: Color(0XFFB8382C),
|
|
|
|
child: CircleAvatar(
|
|
|
|
radius: 60,
|
|
|
|
backgroundColor: Colors.white,
|
|
|
|
child: Icon(
|
|
|
|
Icons.add,
|
|
|
|
color: Colors.black,
|
|
|
|
size: 45.0,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
height: 15.0,
|
|
|
|
),
|
|
|
|
Row(
|
|
|
|
mainAxisAlignment:
|
|
|
|
MainAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
AppText(
|
|
|
|
TranslationBase.of(context)
|
|
|
|
.noPrescriptionListed,
|
|
|
|
color: Colors.black,
|
|
|
|
fontWeight: FontWeight.w900,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
Row(
|
|
|
|
mainAxisAlignment:
|
|
|
|
MainAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
AppText(
|
|
|
|
TranslationBase.of(context).addNow,
|
|
|
|
color: Color(0XFFB8382C),
|
|
|
|
fontWeight: FontWeight.w900,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
],
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
selectDate(BuildContext context, PrescriptionViewModel model) async {
|
|
|
|
DateTime selectedDate;
|
|
|
|
selectedDate = DateTime.now();
|
|
|
|
final DateTime picked = await showDatePicker(
|
|
|
|
context: context,
|
|
|
|
initialDate: selectedDate,
|
|
|
|
firstDate: DateTime.now().add(Duration(hours: 2)),
|
|
|
|
lastDate: DateTime(2040),
|
|
|
|
initialEntryMode: DatePickerEntryMode.calendar,
|
|
|
|
);
|
|
|
|
if (picked != null && picked != selectedDate) {
|
|
|
|
setState(() {
|
|
|
|
selectedDate = picked;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void updatePrescriptionForm(
|
|
|
|
{context,
|
|
|
|
String drugName,
|
|
|
|
int drugId,
|
|
|
|
String remarks,
|
|
|
|
PrescriptionViewModel model,
|
|
|
|
PatiantInformtion patient,
|
|
|
|
String rouat,
|
|
|
|
String frequency,
|
|
|
|
String dose,
|
|
|
|
String duration,
|
|
|
|
String doseStreangth,
|
|
|
|
String doseUnit,
|
|
|
|
String enteredRemarks,
|
|
|
|
String startDate}) {
|
|
|
|
TextEditingController remarksController = TextEditingController();
|
|
|
|
TextEditingController doseController = TextEditingController();
|
|
|
|
TextEditingController frequencyController = TextEditingController();
|
|
|
|
TextEditingController routeController = TextEditingController();
|
|
|
|
showModalBottomSheet(
|
|
|
|
context: context,
|
|
|
|
isScrollControlled: true,
|
|
|
|
builder: (BuildContext context) {
|
|
|
|
return StatefulBuilder(builder: (BuildContext context,
|
|
|
|
StateSetter setState /*You can rename this!*/) {
|
|
|
|
return Container(
|
|
|
|
height: MediaQuery.of(context).size.height * 0.73,
|
|
|
|
child: Form(
|
|
|
|
child: Padding(
|
|
|
|
padding:
|
|
|
|
EdgeInsets.symmetric(horizontal: 20.0, vertical: 12.0),
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
AppText(
|
|
|
|
drugName.toUpperCase(),
|
|
|
|
fontWeight: FontWeight.w900,
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
height: 30.0,
|
|
|
|
),
|
|
|
|
Column(
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
height:
|
|
|
|
MediaQuery.of(context).size.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) {
|
|
|
|
route = route['id'];
|
|
|
|
}
|
|
|
|
},
|
|
|
|
);
|
|
|
|
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: 12.0,
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
height:
|
|
|
|
MediaQuery.of(context).size.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: 12.0,
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
height:
|
|
|
|
MediaQuery.of(context).size.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(() {
|
|
|
|
frequencyUpdate = selectedValue;
|
|
|
|
});
|
|
|
|
},
|
|
|
|
);
|
|
|
|
showDialog(
|
|
|
|
barrierDismissible: false,
|
|
|
|
context: context,
|
|
|
|
builder: (BuildContext context) {
|
|
|
|
return dialog;
|
|
|
|
},
|
|
|
|
);
|
|
|
|
}
|
|
|
|
: null,
|
|
|
|
child: TextField(
|
|
|
|
decoration: textFieldSelectorDecoration(
|
|
|
|
TranslationBase.of(context).frequency,
|
|
|
|
frequencyUpdate != null
|
|
|
|
? frequencyUpdate['name']
|
|
|
|
: null,
|
|
|
|
true),
|
|
|
|
enabled: false,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
height: 12.0,
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
borderRadius:
|
|
|
|
BorderRadius.all(Radius.circular(6.0)),
|
|
|
|
border: Border.all(
|
|
|
|
width: 1.0, color: HexColor("#CCCCCC"))),
|
|
|
|
child: TextFields(
|
|
|
|
hintText: remarks,
|
|
|
|
controller: remarksController,
|
|
|
|
maxLines: 7,
|
|
|
|
minLines: 4,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
height: 12.0,
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
height: MediaQuery.of(context).size.height * 0.12,
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
margin: EdgeInsets.all(
|
|
|
|
SizeConfig.widthMultiplier * 2),
|
|
|
|
child: Wrap(
|
|
|
|
alignment: WrapAlignment.center,
|
|
|
|
children: <Widget>[
|
|
|
|
AppButton(
|
|
|
|
title: 'update prescription'.toUpperCase(),
|
|
|
|
onPressed: () {
|
|
|
|
updatePrescription(
|
|
|
|
doseUnit: doseUnit,
|
|
|
|
doseStreangth: doseStreangth,
|
|
|
|
duration: duration,
|
|
|
|
startDate: startDate,
|
|
|
|
doseId: dose,
|
|
|
|
frequencyId: frequency,
|
|
|
|
routeId: rouat,
|
|
|
|
patient: patient,
|
|
|
|
model: model,
|
|
|
|
drugId: drugId,
|
|
|
|
remarks: remarksController.text,
|
|
|
|
route: route != null
|
|
|
|
? route['id'].toString()
|
|
|
|
: rouat,
|
|
|
|
frequency: frequencyUpdate != null
|
|
|
|
? frequencyUpdate['id'].toString()
|
|
|
|
: frequency,
|
|
|
|
dose: doseTime != null
|
|
|
|
? doseTime['id'].toString()
|
|
|
|
: dose,
|
|
|
|
enteredRemarks: enteredRemarks);
|
|
|
|
Navigator.pop(context);
|
|
|
|
},
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
));
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
updatePrescription(
|
|
|
|
{PrescriptionViewModel model,
|
|
|
|
int drugId,
|
|
|
|
String frequencyId,
|
|
|
|
String remarks,
|
|
|
|
String dose,
|
|
|
|
String doseId,
|
|
|
|
String frequency,
|
|
|
|
String route,
|
|
|
|
String routeId,
|
|
|
|
String startDate,
|
|
|
|
String doseUnit,
|
|
|
|
String doseStreangth,
|
|
|
|
String duration,
|
|
|
|
String enteredRemarks,
|
|
|
|
PatiantInformtion patient}) async {
|
|
|
|
//PrescriptionViewModel model = PrescriptionViewModel();
|
|
|
|
PostPrescriptionReqModel updatePrescriptionReqModel =
|
|
|
|
new PostPrescriptionReqModel();
|
|
|
|
List<PrescriptionRequestModel> sss = List();
|
|
|
|
|
|
|
|
updatePrescriptionReqModel.appointmentNo = patient.appointmentNo;
|
|
|
|
updatePrescriptionReqModel.clinicID = patient.clinicId;
|
|
|
|
updatePrescriptionReqModel.episodeID = patient.episodeNo;
|
|
|
|
updatePrescriptionReqModel.patientMRN = patient.patientMRN;
|
|
|
|
|
|
|
|
sss.add(PrescriptionRequestModel(
|
|
|
|
covered: true,
|
|
|
|
dose: int.parse(
|
|
|
|
doseStreangth), //frequency.isNotEmpty ? int.parse(dose) : 1,
|
|
|
|
itemId: drugId,
|
|
|
|
doseUnitId: int.parse(doseUnit),
|
|
|
|
route: route.isNotEmpty ? int.parse(route) : int.parse(routeId),
|
|
|
|
frequency: frequency.isNotEmpty
|
|
|
|
? int.parse(frequency)
|
|
|
|
: int.parse(frequencyId),
|
|
|
|
remarks: remarks.isEmpty ? enteredRemarks : remarks,
|
|
|
|
approvalRequired: true,
|
|
|
|
icdcode10Id: "test2",
|
|
|
|
doseTime: dose.isNotEmpty ? int.parse(dose) : int.parse(doseId),
|
|
|
|
duration: int.parse(duration),
|
|
|
|
doseStartDate: startDate));
|
|
|
|
updatePrescriptionReqModel.prescriptionRequestModel = sss;
|
|
|
|
//postProcedureReqModel.procedures = controlsProcedure;
|
|
|
|
|
|
|
|
await model.updatePrescription(
|
|
|
|
updatePrescriptionReqModel, patient.patientMRN);
|
|
|
|
|
|
|
|
if (model.state == ViewState.ErrorLocal) {
|
|
|
|
helpers.showErrorToast(model.error);
|
|
|
|
} else if (model.state == ViewState.Idle) {
|
|
|
|
DrAppToastMsg.showSuccesToast('Medication has been updated');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
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,
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|