Merge branch 'development' of https://gitlab.com/Cloud_Solution/doctor_app_flutter into sultan
commit
8b7acf7202
@ -0,0 +1,34 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>CLIENT_ID</key>
|
||||||
|
<string>1097451043303-ifgtu6ub88dlk5dmv5tm531a5s47gbre.apps.googleusercontent.com</string>
|
||||||
|
<key>REVERSED_CLIENT_ID</key>
|
||||||
|
<string>com.googleusercontent.apps.1097451043303-ifgtu6ub88dlk5dmv5tm531a5s47gbre</string>
|
||||||
|
<key>API_KEY</key>
|
||||||
|
<string>AIzaSyAKPayaNaI-2RN6S4PH5W9wYExmEgoBUvo</string>
|
||||||
|
<key>GCM_SENDER_ID</key>
|
||||||
|
<string>1097451043303</string>
|
||||||
|
<key>PLIST_VERSION</key>
|
||||||
|
<string>1</string>
|
||||||
|
<key>BUNDLE_ID</key>
|
||||||
|
<string>com.hmg.doctorApp</string>
|
||||||
|
<key>PROJECT_ID</key>
|
||||||
|
<string>doctor-app-35ddc</string>
|
||||||
|
<key>STORAGE_BUCKET</key>
|
||||||
|
<string>doctor-app-35ddc.appspot.com</string>
|
||||||
|
<key>IS_ADS_ENABLED</key>
|
||||||
|
<false></false>
|
||||||
|
<key>IS_ANALYTICS_ENABLED</key>
|
||||||
|
<false></false>
|
||||||
|
<key>IS_APPINVITE_ENABLED</key>
|
||||||
|
<true></true>
|
||||||
|
<key>IS_GCM_ENABLED</key>
|
||||||
|
<true></true>
|
||||||
|
<key>IS_SIGNIN_ENABLED</key>
|
||||||
|
<true></true>
|
||||||
|
<key>GOOGLE_APP_ID</key>
|
||||||
|
<string>1:1097451043303:ios:0e9b87e77dcf397d866542</string>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
@ -0,0 +1,34 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>CLIENT_ID</key>
|
||||||
|
<string>1097451043303-ifgtu6ub88dlk5dmv5tm531a5s47gbre.apps.googleusercontent.com</string>
|
||||||
|
<key>REVERSED_CLIENT_ID</key>
|
||||||
|
<string>com.googleusercontent.apps.1097451043303-ifgtu6ub88dlk5dmv5tm531a5s47gbre</string>
|
||||||
|
<key>API_KEY</key>
|
||||||
|
<string>AIzaSyAKPayaNaI-2RN6S4PH5W9wYExmEgoBUvo</string>
|
||||||
|
<key>GCM_SENDER_ID</key>
|
||||||
|
<string>1097451043303</string>
|
||||||
|
<key>PLIST_VERSION</key>
|
||||||
|
<string>1</string>
|
||||||
|
<key>BUNDLE_ID</key>
|
||||||
|
<string>com.hmg.doctorApp</string>
|
||||||
|
<key>PROJECT_ID</key>
|
||||||
|
<string>doctor-app-35ddc</string>
|
||||||
|
<key>STORAGE_BUCKET</key>
|
||||||
|
<string>doctor-app-35ddc.appspot.com</string>
|
||||||
|
<key>IS_ADS_ENABLED</key>
|
||||||
|
<false></false>
|
||||||
|
<key>IS_ANALYTICS_ENABLED</key>
|
||||||
|
<false></false>
|
||||||
|
<key>IS_APPINVITE_ENABLED</key>
|
||||||
|
<true></true>
|
||||||
|
<key>IS_GCM_ENABLED</key>
|
||||||
|
<true></true>
|
||||||
|
<key>IS_SIGNIN_ENABLED</key>
|
||||||
|
<true></true>
|
||||||
|
<key>GOOGLE_APP_ID</key>
|
||||||
|
<string>1:1097451043303:ios:0e9b87e77dcf397d866542</string>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>aps-environment</key>
|
||||||
|
<string>development</string>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
@ -0,0 +1,26 @@
|
|||||||
|
class WardModel{
|
||||||
|
|
||||||
|
String description;
|
||||||
|
String descriptionN;
|
||||||
|
int floorID;
|
||||||
|
bool isActive;
|
||||||
|
|
||||||
|
WardModel(
|
||||||
|
{this.description, this.descriptionN, this.floorID, this.isActive});
|
||||||
|
|
||||||
|
WardModel.fromJson(Map<String, dynamic> json) {
|
||||||
|
description = json['description'];
|
||||||
|
descriptionN = json['descriptionN'];
|
||||||
|
floorID = json['floorID'];
|
||||||
|
isActive = json['isActive'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||||
|
data['description'] = this.description;
|
||||||
|
data['descriptionN'] = this.descriptionN;
|
||||||
|
data['floorID'] = this.floorID;
|
||||||
|
data['isActive'] = this.isActive;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,624 @@
|
|||||||
|
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/post_prescrition_req_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/util/dr_app_toast_msg.dart';
|
||||||
|
import 'package:doctor_app_flutter/util/translations_delegate_base.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/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
|
import 'package:hexcolor/hexcolor.dart';
|
||||||
|
|
||||||
|
class UpdatePrescriptionForm extends StatefulWidget {
|
||||||
|
final String drugName;
|
||||||
|
final String doseStreangth;
|
||||||
|
final int drugId;
|
||||||
|
final String remarks;
|
||||||
|
final PatiantInformtion patient;
|
||||||
|
final String duration;
|
||||||
|
final String route;
|
||||||
|
final String dose;
|
||||||
|
final String doseUnit;
|
||||||
|
final String enteredRemarks;
|
||||||
|
final String startDate;
|
||||||
|
final String frequency;
|
||||||
|
final PrescriptionViewModel model;
|
||||||
|
|
||||||
|
UpdatePrescriptionForm(
|
||||||
|
{this.drugName,
|
||||||
|
this.doseStreangth,
|
||||||
|
this.drugId,
|
||||||
|
this.remarks,
|
||||||
|
this.patient,
|
||||||
|
this.duration,
|
||||||
|
this.route,
|
||||||
|
this.dose,
|
||||||
|
this.startDate,
|
||||||
|
this.doseUnit,
|
||||||
|
this.enteredRemarks,
|
||||||
|
this.frequency,
|
||||||
|
this.model});
|
||||||
|
@override
|
||||||
|
_UpdatePrescriptionFormState createState() => _UpdatePrescriptionFormState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
|
||||||
|
TextEditingController strengthController = TextEditingController();
|
||||||
|
TextEditingController remarksController = TextEditingController();
|
||||||
|
int testNum = 0;
|
||||||
|
int strengthChar;
|
||||||
|
PatiantInformtion patient;
|
||||||
|
dynamic route;
|
||||||
|
dynamic doseTime;
|
||||||
|
dynamic frequencyUpdate;
|
||||||
|
dynamic updatedDuration;
|
||||||
|
dynamic units;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return StatefulBuilder(builder:
|
||||||
|
(BuildContext context, StateSetter setState /*You can rename this!*/) {
|
||||||
|
return BaseView<MedicineViewModel>(
|
||||||
|
onModelReady: (model) async {
|
||||||
|
await model.getMedicationList();
|
||||||
|
await model.getMedicationStrength();
|
||||||
|
await model.getMedicationDuration();
|
||||||
|
await model.getMedicationRoute();
|
||||||
|
await model.getMedicationFrequency();
|
||||||
|
await model.getMedicationDoseTime();
|
||||||
|
await model.getMedicationIndications();
|
||||||
|
route = model.getLookupById(model.medicationRouteList, widget.route);
|
||||||
|
doseTime =
|
||||||
|
model.getLookupById(model.medicationDoseTimeList, widget.dose);
|
||||||
|
updatedDuration = model.getLookupById(
|
||||||
|
model.medicationDurationList, widget.duration);
|
||||||
|
units = model.getLookupById(
|
||||||
|
model.medicationStrengthList, widget.doseUnit);
|
||||||
|
frequencyUpdate = model.getLookupById(
|
||||||
|
model.medicationFrequencyList, widget.frequency);
|
||||||
|
},
|
||||||
|
builder:
|
||||||
|
(BuildContext context, MedicineViewModel model, Widget child) =>
|
||||||
|
NetworkBaseView(
|
||||||
|
baseViewModel: model,
|
||||||
|
child: DraggableScrollableSheet(
|
||||||
|
initialChildSize: 0.90,
|
||||||
|
maxChildSize: 0.90,
|
||||||
|
minChildSize: 0.6,
|
||||||
|
builder:
|
||||||
|
(BuildContext context, ScrollController scrollController) {
|
||||||
|
return Container(
|
||||||
|
height: MediaQuery.of(context).size.height * 1.0,
|
||||||
|
child: Form(
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.symmetric(
|
||||||
|
horizontal: 20.0, vertical: 12.0),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
AppText(
|
||||||
|
widget.drugName.toUpperCase(),
|
||||||
|
fontWeight: FontWeight.w900,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 10.0,
|
||||||
|
),
|
||||||
|
Column(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
height: MediaQuery.of(context).size.height *
|
||||||
|
0.060,
|
||||||
|
width: double.infinity,
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
width:
|
||||||
|
MediaQuery.of(context).size.width *
|
||||||
|
0.500,
|
||||||
|
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.3700,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: model.medicationStrengthList !=
|
||||||
|
null
|
||||||
|
? () {
|
||||||
|
ListSelectDialog dialog =
|
||||||
|
ListSelectDialog(
|
||||||
|
list: model
|
||||||
|
.medicationStrengthList,
|
||||||
|
attributeName: 'nameEn',
|
||||||
|
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['nameEn']
|
||||||
|
: null,
|
||||||
|
true),
|
||||||
|
enabled: false,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
height: MediaQuery.of(context).size.height *
|
||||||
|
0.070,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: model.medicationRouteList != null
|
||||||
|
? () {
|
||||||
|
ListSelectDialog dialog =
|
||||||
|
ListSelectDialog(
|
||||||
|
list: model.medicationRouteList,
|
||||||
|
attributeName: 'nameEn',
|
||||||
|
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(
|
||||||
|
'Route',
|
||||||
|
route != null
|
||||||
|
? route['nameEn']
|
||||||
|
: null,
|
||||||
|
true),
|
||||||
|
enabled: false,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 12.0,
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
height: MediaQuery.of(context).size.height *
|
||||||
|
0.070,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: model.medicationDoseTimeList != null
|
||||||
|
? () {
|
||||||
|
ListSelectDialog dialog =
|
||||||
|
ListSelectDialog(
|
||||||
|
list:
|
||||||
|
model.medicationDoseTimeList,
|
||||||
|
attributeName: 'nameEn',
|
||||||
|
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['nameEn']
|
||||||
|
: null,
|
||||||
|
true),
|
||||||
|
enabled: false,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 12.0,
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
height: MediaQuery.of(context).size.height *
|
||||||
|
0.070,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: model.medicationFrequencyList != null
|
||||||
|
? () {
|
||||||
|
ListSelectDialog dialog =
|
||||||
|
ListSelectDialog(
|
||||||
|
list:
|
||||||
|
model.medicationFrequencyList,
|
||||||
|
attributeName: 'nameEn',
|
||||||
|
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['nameEn']
|
||||||
|
: null,
|
||||||
|
true),
|
||||||
|
enabled: false,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 12.0,
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
height: MediaQuery.of(context).size.height *
|
||||||
|
0.070,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: model.medicationDurationList != null
|
||||||
|
? () {
|
||||||
|
ListSelectDialog dialog =
|
||||||
|
ListSelectDialog(
|
||||||
|
list:
|
||||||
|
model.medicationDurationList,
|
||||||
|
attributeName: 'nameEn',
|
||||||
|
attributeValueId: 'id',
|
||||||
|
okText:
|
||||||
|
TranslationBase.of(context)
|
||||||
|
.ok,
|
||||||
|
okFunction: (selectedValue) {
|
||||||
|
setState(() {
|
||||||
|
updatedDuration =
|
||||||
|
selectedValue;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
);
|
||||||
|
showDialog(
|
||||||
|
barrierDismissible: false,
|
||||||
|
context: context,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return dialog;
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
: null,
|
||||||
|
child: TextField(
|
||||||
|
decoration: textFieldSelectorDecoration(
|
||||||
|
TranslationBase.of(context).duration,
|
||||||
|
updatedDuration != null
|
||||||
|
? updatedDuration['nameEn']
|
||||||
|
.toString()
|
||||||
|
: 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: widget.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(
|
||||||
|
newDoseStreangth:
|
||||||
|
strengthController
|
||||||
|
.text.isNotEmpty
|
||||||
|
? strengthController.text
|
||||||
|
: widget.doseStreangth,
|
||||||
|
newUnit: units !=
|
||||||
|
null
|
||||||
|
? units['id'].toString()
|
||||||
|
: widget.doseUnit,
|
||||||
|
doseUnit: widget.doseUnit,
|
||||||
|
doseStreangth: widget
|
||||||
|
.doseStreangth,
|
||||||
|
duration: widget.duration,
|
||||||
|
startDate: widget.startDate,
|
||||||
|
doseId: widget.dose,
|
||||||
|
frequencyId: widget.frequency,
|
||||||
|
routeId: widget.route,
|
||||||
|
patient: widget.patient,
|
||||||
|
model: widget.model,
|
||||||
|
newDuration:
|
||||||
|
updatedDuration !=
|
||||||
|
null
|
||||||
|
? updatedDuration[
|
||||||
|
'id']
|
||||||
|
.toString()
|
||||||
|
: widget.duration,
|
||||||
|
drugId: widget.drugId,
|
||||||
|
remarks: remarksController.text,
|
||||||
|
route: route !=
|
||||||
|
null
|
||||||
|
? route['id'].toString()
|
||||||
|
: widget.route,
|
||||||
|
frequency:
|
||||||
|
frequencyUpdate !=
|
||||||
|
null
|
||||||
|
? frequencyUpdate['id']
|
||||||
|
.toString()
|
||||||
|
: widget.frequency,
|
||||||
|
dose: doseTime != null
|
||||||
|
? doseTime['id'].toString()
|
||||||
|
: widget.dose,
|
||||||
|
enteredRemarks:
|
||||||
|
widget.enteredRemarks);
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
));
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
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,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
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 newDoseStreangth,
|
||||||
|
String duration,
|
||||||
|
String newDuration,
|
||||||
|
String newUnit,
|
||||||
|
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: newDoseStreangth.isNotEmpty
|
||||||
|
? int.parse(newDoseStreangth)
|
||||||
|
: int.parse(doseStreangth),
|
||||||
|
//frequency.isNotEmpty ? int.parse(dose) : 1,
|
||||||
|
itemId: drugId,
|
||||||
|
doseUnitId:
|
||||||
|
newUnit.isNotEmpty ? int.parse(newUnit) : 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: newDuration.isNotEmpty
|
||||||
|
? int.parse(newDuration)
|
||||||
|
: 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');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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 UpdatePrescriptionForm(
|
||||||
|
drugName: drugName,
|
||||||
|
patient: patient,
|
||||||
|
doseStreangth: doseStreangth,
|
||||||
|
remarks: remarks,
|
||||||
|
drugId: drugId,
|
||||||
|
enteredRemarks: enteredRemarks,
|
||||||
|
duration: duration,
|
||||||
|
dose: dose,
|
||||||
|
doseUnit: doseUnit,
|
||||||
|
frequency: frequency,
|
||||||
|
route: rouat,
|
||||||
|
startDate: startDate,
|
||||||
|
model: model,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
@ -0,0 +1,323 @@
|
|||||||
|
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/procedure/ControlsModel.dart';
|
||||||
|
import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart';
|
||||||
|
import 'package:doctor_app_flutter/core/model/procedure/post_procedure_req_model.dart';
|
||||||
|
import 'package:doctor_app_flutter/core/viewModel/procedure_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/util/dr_app_toast_msg.dart';
|
||||||
|
import 'package:doctor_app_flutter/util/translations_delegate_base.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 'entity_list_checkbox_search_widget.dart';
|
||||||
|
|
||||||
|
postProcedure(
|
||||||
|
{ProcedureViewModel model,
|
||||||
|
String remarks,
|
||||||
|
String orderType,
|
||||||
|
PatiantInformtion patient,
|
||||||
|
List<EntityList> entityList}) async {
|
||||||
|
PostProcedureReqModel postProcedureReqModel = new PostProcedureReqModel();
|
||||||
|
List<Controls> controls = List();
|
||||||
|
List<Procedures> controlsProcedure = List();
|
||||||
|
|
||||||
|
postProcedureReqModel.appointmentNo = patient.appointmentNo;
|
||||||
|
|
||||||
|
postProcedureReqModel.episodeID = patient.episodeNo;
|
||||||
|
postProcedureReqModel.patientMRN = patient.patientMRN;
|
||||||
|
entityList.forEach((element) {
|
||||||
|
controls.add(
|
||||||
|
Controls(code: "remarks", controlValue: remarks.isEmpty ? '' : remarks),
|
||||||
|
);
|
||||||
|
controls.add(
|
||||||
|
Controls(
|
||||||
|
code: "ordertype",
|
||||||
|
controlValue:
|
||||||
|
orderType.toString().isNotEmpty ? orderType.toString() : '1'),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
entityList.forEach((element) {
|
||||||
|
controlsProcedure.add(Procedures(
|
||||||
|
category: element.categoryID,
|
||||||
|
procedure: element.procedureId,
|
||||||
|
controls: controls));
|
||||||
|
});
|
||||||
|
postProcedureReqModel.procedures = controlsProcedure;
|
||||||
|
|
||||||
|
await model.postProcedure(postProcedureReqModel, patient.patientMRN);
|
||||||
|
|
||||||
|
if (model.state == ViewState.ErrorLocal) {
|
||||||
|
helpers.showErrorToast(model.error);
|
||||||
|
model.getProcedure(mrn: patient.patientMRN);
|
||||||
|
} else if (model.state == ViewState.Idle) {
|
||||||
|
DrAppToastMsg.showSuccesToast('procedure has been added');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void addSelectedProcedure(
|
||||||
|
context, ProcedureViewModel model, PatiantInformtion patient) {
|
||||||
|
showModalBottomSheet(
|
||||||
|
context: context,
|
||||||
|
isScrollControlled: true,
|
||||||
|
builder: (BuildContext bc) {
|
||||||
|
return AddSelectedProcedure(
|
||||||
|
model: model,
|
||||||
|
patient: patient,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
class AddSelectedProcedure extends StatefulWidget {
|
||||||
|
final ProcedureViewModel model;
|
||||||
|
final PatiantInformtion patient;
|
||||||
|
|
||||||
|
const AddSelectedProcedure({Key key, this.model, this.patient})
|
||||||
|
: super(key: key);
|
||||||
|
@override
|
||||||
|
_AddSelectedProcedureState createState() =>
|
||||||
|
_AddSelectedProcedureState(patient: patient, model: model);
|
||||||
|
}
|
||||||
|
|
||||||
|
class _AddSelectedProcedureState extends State<AddSelectedProcedure> {
|
||||||
|
int selectedType;
|
||||||
|
ProcedureViewModel model;
|
||||||
|
PatiantInformtion patient;
|
||||||
|
_AddSelectedProcedureState({this.patient, this.model});
|
||||||
|
TextEditingController procedureController = TextEditingController();
|
||||||
|
TextEditingController remarksController = TextEditingController();
|
||||||
|
List<EntityList> entityList = List();
|
||||||
|
dynamic selectedCategory;
|
||||||
|
setSelectedType(int val) {
|
||||||
|
setState(() {
|
||||||
|
selectedType = val;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final screenSize = MediaQuery.of(context).size;
|
||||||
|
return BaseView<ProcedureViewModel>(
|
||||||
|
onModelReady: (model) => model.getCategory(),
|
||||||
|
builder: (BuildContext context, ProcedureViewModel model, Widget child) =>
|
||||||
|
NetworkBaseView(
|
||||||
|
baseViewModel: model,
|
||||||
|
child: DraggableScrollableSheet(
|
||||||
|
minChildSize: 0.90,
|
||||||
|
initialChildSize: 0.95,
|
||||||
|
maxChildSize: 1.0,
|
||||||
|
builder: (BuildContext context, ScrollController scrollController) {
|
||||||
|
return SingleChildScrollView(
|
||||||
|
child: Container(
|
||||||
|
height: MediaQuery.of(context).size.height * 1.20,
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.all(12.0),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
AppText(
|
||||||
|
TranslationBase.of(context)
|
||||||
|
.selectProcedures
|
||||||
|
.toUpperCase(),
|
||||||
|
fontWeight: FontWeight.w900,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 10.0,
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
height: screenSize.height * 0.070,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: model.categoryList != null &&
|
||||||
|
model.categoryList.length > 0
|
||||||
|
? () {
|
||||||
|
ListSelectDialog dialog = ListSelectDialog(
|
||||||
|
list: model.categoryList,
|
||||||
|
attributeName: 'categoryName',
|
||||||
|
attributeValueId: 'categoryId',
|
||||||
|
okText: TranslationBase.of(context).ok,
|
||||||
|
okFunction: (selectedValue) {
|
||||||
|
setState(() {
|
||||||
|
selectedCategory = selectedValue;
|
||||||
|
model.getProcedureCategory(
|
||||||
|
categoryName: selectedCategory[
|
||||||
|
'categoryName']);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
);
|
||||||
|
showDialog(
|
||||||
|
barrierDismissible: false,
|
||||||
|
context: context,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return dialog;
|
||||||
|
},
|
||||||
|
);
|
||||||
|
//model.getProcedureCategory();
|
||||||
|
}
|
||||||
|
: null,
|
||||||
|
child: TextField(
|
||||||
|
decoration: textFieldSelectorDecoration(
|
||||||
|
TranslationBase.of(context)
|
||||||
|
.procedureCategorise,
|
||||||
|
selectedCategory != null
|
||||||
|
? selectedCategory['categoryName']
|
||||||
|
: null,
|
||||||
|
true,
|
||||||
|
suffixIcon: Icon(
|
||||||
|
Icons.search,
|
||||||
|
color: Colors.black,
|
||||||
|
)),
|
||||||
|
enabled: false,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if (widget.model.categoriesList.length != 0)
|
||||||
|
NetworkBaseView(
|
||||||
|
baseViewModel: model,
|
||||||
|
child: EntityListCheckboxSearchWidget(
|
||||||
|
model: widget.model,
|
||||||
|
masterList:
|
||||||
|
widget.model.categoriesList[0].entityList,
|
||||||
|
removeHistory: (item) {
|
||||||
|
setState(() {
|
||||||
|
entityList.remove(item);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
addHistory: (history) {
|
||||||
|
setState(() {
|
||||||
|
entityList.add(history);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
addSelectedHistories: () {
|
||||||
|
//TODO build your fun herr
|
||||||
|
// widget.addSelectedHistories();
|
||||||
|
},
|
||||||
|
isEntityListSelected: (master) =>
|
||||||
|
isEntityListSelected(master),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 15.0,
|
||||||
|
),
|
||||||
|
Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
AppText(
|
||||||
|
TranslationBase.of(context).orderType),
|
||||||
|
Radio(
|
||||||
|
activeColor: Color(0xFFB9382C),
|
||||||
|
value: 1,
|
||||||
|
groupValue: selectedType,
|
||||||
|
onChanged: (value) {
|
||||||
|
setSelectedType(value);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
Text(TranslationBase.of(context).regular),
|
||||||
|
Radio(
|
||||||
|
activeColor: Color(0xFFB9382C),
|
||||||
|
groupValue: selectedType,
|
||||||
|
value: 0,
|
||||||
|
onChanged: (value) {
|
||||||
|
setSelectedType(value);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
Text(TranslationBase.of(context).urgent),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 15.0,
|
||||||
|
),
|
||||||
|
TextFields(
|
||||||
|
hintText: TranslationBase.of(context).remarks,
|
||||||
|
controller: remarksController,
|
||||||
|
minLines: 3,
|
||||||
|
maxLines: 5,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 50.0,
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.all(
|
||||||
|
SizeConfig.widthMultiplier * 5),
|
||||||
|
child: Wrap(
|
||||||
|
alignment: WrapAlignment.center,
|
||||||
|
children: <Widget>[
|
||||||
|
AppButton(
|
||||||
|
title: TranslationBase.of(context)
|
||||||
|
.addSelectedProcedures,
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
postProcedure(
|
||||||
|
orderType: selectedType.toString(),
|
||||||
|
entityList: entityList,
|
||||||
|
patient: patient,
|
||||||
|
model: widget.model,
|
||||||
|
remarks: remarksController.text);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isEntityListSelected(EntityList masterKey) {
|
||||||
|
Iterable<EntityList> history = entityList
|
||||||
|
.where((element) => masterKey.procedureId == element.procedureId);
|
||||||
|
if (history.length > 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
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,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,347 @@
|
|||||||
|
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/procedure/ControlsModel.dart';
|
||||||
|
import 'package:doctor_app_flutter/core/model/procedure/categories_procedure.dart';
|
||||||
|
import 'package:doctor_app_flutter/core/model/procedure/update_procedure_request_model.dart';
|
||||||
|
import 'package:doctor_app_flutter/core/viewModel/procedure_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/procedures/entity_list_checkbox_search_widget.dart';
|
||||||
|
import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart';
|
||||||
|
import 'package:doctor_app_flutter/util/translations_delegate_base.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';
|
||||||
|
|
||||||
|
void updateProcedureForm(context,
|
||||||
|
{String procedureName,
|
||||||
|
PatiantInformtion patient,
|
||||||
|
String orderType,
|
||||||
|
String procedureId,
|
||||||
|
String remarks,
|
||||||
|
String categoreId}) {
|
||||||
|
ProcedureViewModel model = ProcedureViewModel();
|
||||||
|
TextEditingController remarksController = TextEditingController();
|
||||||
|
TextEditingController orderController = TextEditingController();
|
||||||
|
showModalBottomSheet(
|
||||||
|
context: context,
|
||||||
|
isScrollControlled: true,
|
||||||
|
builder: (BuildContext bc) {
|
||||||
|
return UpdateProcedureWidget(
|
||||||
|
procedureName: procedureName,
|
||||||
|
remarks: remarks,
|
||||||
|
remarksController: remarksController,
|
||||||
|
patient: patient,
|
||||||
|
model: model,
|
||||||
|
procedureId: procedureId,
|
||||||
|
categoryId: categoreId,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
class UpdateProcedureWidget extends StatefulWidget {
|
||||||
|
final PatiantInformtion patient;
|
||||||
|
final ProcedureViewModel model;
|
||||||
|
final String procedureName;
|
||||||
|
final String remarks;
|
||||||
|
final TextEditingController remarksController;
|
||||||
|
final String procedureId;
|
||||||
|
final String categoryId;
|
||||||
|
|
||||||
|
UpdateProcedureWidget(
|
||||||
|
{this.model,
|
||||||
|
this.procedureName,
|
||||||
|
this.remarks,
|
||||||
|
this.remarksController,
|
||||||
|
this.patient,
|
||||||
|
this.procedureId,
|
||||||
|
this.categoryId});
|
||||||
|
@override
|
||||||
|
_UpdateProcedureWidgetState createState() => _UpdateProcedureWidgetState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _UpdateProcedureWidgetState extends State<UpdateProcedureWidget> {
|
||||||
|
int selectedType = 0;
|
||||||
|
setSelectedType(int val) {
|
||||||
|
setState(() {
|
||||||
|
selectedType = val;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
List<EntityList> entityList = List();
|
||||||
|
dynamic selectedCategory;
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final screenSize = MediaQuery.of(context).size;
|
||||||
|
return StatefulBuilder(builder:
|
||||||
|
(BuildContext context, StateSetter setState /*You can rename this!*/) {
|
||||||
|
return BaseView<ProcedureViewModel>(
|
||||||
|
onModelReady: (model) => model.getCategory(),
|
||||||
|
builder:
|
||||||
|
(BuildContext context, ProcedureViewModel model, Widget child) =>
|
||||||
|
NetworkBaseView(
|
||||||
|
baseViewModel: model,
|
||||||
|
child: Container(
|
||||||
|
height: MediaQuery.of(context).size.height * 0.95,
|
||||||
|
child: Form(
|
||||||
|
child: Padding(
|
||||||
|
padding:
|
||||||
|
EdgeInsets.symmetric(horizontal: 20.0, vertical: 10.0),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
AppText(
|
||||||
|
widget.procedureName.toUpperCase(),
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 30.0,
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
height: screenSize.height * 0.070,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: model.categoryList != null &&
|
||||||
|
model.categoryList.length > 0
|
||||||
|
? () {
|
||||||
|
ListSelectDialog dialog = ListSelectDialog(
|
||||||
|
list: model.categoryList,
|
||||||
|
attributeName: 'categoryName',
|
||||||
|
attributeValueId: 'categoryId',
|
||||||
|
okText: TranslationBase.of(context).ok,
|
||||||
|
okFunction: (selectedValue) {
|
||||||
|
setState(() {
|
||||||
|
selectedCategory = selectedValue;
|
||||||
|
model.getProcedureCategory(
|
||||||
|
categoryName: selectedCategory[
|
||||||
|
'categoryName']);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
);
|
||||||
|
showDialog(
|
||||||
|
barrierDismissible: false,
|
||||||
|
context: context,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return dialog;
|
||||||
|
},
|
||||||
|
);
|
||||||
|
//model.getProcedureCategory();
|
||||||
|
}
|
||||||
|
: null,
|
||||||
|
child: TextField(
|
||||||
|
decoration: textFieldSelectorDecoration(
|
||||||
|
TranslationBase.of(context).procedureCategorise,
|
||||||
|
selectedCategory != null
|
||||||
|
? selectedCategory['categoryName']
|
||||||
|
: null,
|
||||||
|
true,
|
||||||
|
suffixIcon: Icon(
|
||||||
|
Icons.search,
|
||||||
|
color: Colors.black,
|
||||||
|
)),
|
||||||
|
enabled: false,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if (widget.model.categoriesList.length != 0)
|
||||||
|
NetworkBaseView(
|
||||||
|
baseViewModel: model,
|
||||||
|
child: EntityListCheckboxSearchWidget(
|
||||||
|
model: widget.model,
|
||||||
|
masterList:
|
||||||
|
widget.model.categoriesList[0].entityList,
|
||||||
|
removeHistory: (item) {
|
||||||
|
setState(() {
|
||||||
|
entityList.remove(item);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
addHistory: (history) {
|
||||||
|
setState(() {
|
||||||
|
entityList.add(history);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
addSelectedHistories: () {
|
||||||
|
//TODO build your fun herr
|
||||||
|
// widget.addSelectedHistories();
|
||||||
|
},
|
||||||
|
isEntityListSelected: (master) =>
|
||||||
|
isEntityListSelected(master),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
AppText(TranslationBase.of(context).orderType),
|
||||||
|
Radio(
|
||||||
|
activeColor: Color(0xFFB9382C),
|
||||||
|
value: 0,
|
||||||
|
groupValue: selectedType,
|
||||||
|
onChanged: (value) {
|
||||||
|
setSelectedType(value);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
Text(TranslationBase.of(context).urgent),
|
||||||
|
Radio(
|
||||||
|
activeColor: Color(0xFFB9382C),
|
||||||
|
groupValue: selectedType,
|
||||||
|
value: 1,
|
||||||
|
onChanged: (value) {
|
||||||
|
setSelectedType(value);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
Text(TranslationBase.of(context).regular),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
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: widget.remarks,
|
||||||
|
controller: widget.remarksController,
|
||||||
|
maxLines: 5,
|
||||||
|
minLines: 3,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 50.0,
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.all(SizeConfig.widthMultiplier * 2),
|
||||||
|
child: Wrap(
|
||||||
|
alignment: WrapAlignment.center,
|
||||||
|
children: <Widget>[
|
||||||
|
AppButton(
|
||||||
|
title: TranslationBase.of(context)
|
||||||
|
.updateProcedure
|
||||||
|
.toUpperCase(),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
updateProcedure(
|
||||||
|
orderType: selectedType.toString(),
|
||||||
|
categorieId: widget.categoryId,
|
||||||
|
procedureId: widget.procedureId,
|
||||||
|
entityList: entityList,
|
||||||
|
patient: widget.patient,
|
||||||
|
model: widget.model,
|
||||||
|
remarks: widget.remarksController.text);
|
||||||
|
// authorizationForm(context);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
updateProcedure(
|
||||||
|
{ProcedureViewModel model,
|
||||||
|
String remarks,
|
||||||
|
String newProcedureId,
|
||||||
|
String newCategorieId,
|
||||||
|
List<EntityList> entityList,
|
||||||
|
String orderType,
|
||||||
|
String procedureId,
|
||||||
|
PatiantInformtion patient,
|
||||||
|
String categorieId}) async {
|
||||||
|
UpdateProcedureRequestModel updateProcedureReqModel =
|
||||||
|
new UpdateProcedureRequestModel();
|
||||||
|
List<Controls> controls = List();
|
||||||
|
ProcedureDetail controlsProcedure = new ProcedureDetail();
|
||||||
|
|
||||||
|
updateProcedureReqModel.appointmentNo = patient.appointmentNo;
|
||||||
|
|
||||||
|
updateProcedureReqModel.episodeID = patient.episodeNo;
|
||||||
|
updateProcedureReqModel.patientMRN = patient.patientMRN;
|
||||||
|
updateProcedureReqModel.lineItemNo = 1;
|
||||||
|
updateProcedureReqModel.orderNo = 0;
|
||||||
|
|
||||||
|
controls.add(
|
||||||
|
Controls(code: "remarks", controlValue: remarks.isEmpty ? '' : remarks),
|
||||||
|
);
|
||||||
|
controls.add(
|
||||||
|
Controls(code: "ordertype", controlValue: "1"),
|
||||||
|
);
|
||||||
|
|
||||||
|
entityList.isNotEmpty
|
||||||
|
? entityList.forEach((element) {
|
||||||
|
controlsProcedure.procedure = element.procedureId;
|
||||||
|
controlsProcedure.category = element.categoryID;
|
||||||
|
controlsProcedure.controls = controls;
|
||||||
|
})
|
||||||
|
: controlsProcedure.procedure = procedureId;
|
||||||
|
controlsProcedure.category = categorieId;
|
||||||
|
controlsProcedure.controls = controls;
|
||||||
|
// controlsProcedure.add(ProcedureDetail(
|
||||||
|
// category: categorieId, procedure: procedureId, controls: controls));
|
||||||
|
updateProcedureReqModel.procedureDetail = controlsProcedure;
|
||||||
|
|
||||||
|
await model.updateProcedure(
|
||||||
|
updateProcedureRequestModel: updateProcedureReqModel,
|
||||||
|
mrn: patient.patientMRN);
|
||||||
|
|
||||||
|
if (model.state == ViewState.ErrorLocal) {
|
||||||
|
helpers.showErrorToast(model.error);
|
||||||
|
model.getProcedure(mrn: patient.patientMRN);
|
||||||
|
} else if (model.state == ViewState.Idle) {
|
||||||
|
DrAppToastMsg.showSuccesToast('procedure has been updated');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isEntityListSelected(EntityList masterKey) {
|
||||||
|
Iterable<EntityList> history = entityList
|
||||||
|
.where((element) => masterKey.procedureId == element.procedureId);
|
||||||
|
if (history.length > 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
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,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue