post prescription

pull/207/head
hussam al-habibeh 4 years ago
parent 17079a1bd9
commit b3345a86ef

@ -9,7 +9,7 @@ class PrescriptionService extends BaseService {
List<PrescriptionModel> get prescriptionList => _prescriptionList;
PrescriptionReqModel _prescriptionReqModel = PrescriptionReqModel(
patientMRN: 1231755,
patientMRN: 3120877,
vidaAuthTokenID:
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIyODA0IiwianRpIjoiNzNiNmUyZDctMjA0ZC00NzAyLTkxMDYtODE3MzI3OTZkYzI5IiwiZW1haWwiOiJNb2hhbWVkLlJlc3dhbkBjbG91ZHNvbHV0aW9uLXNhLmNvbSIsImlkIjoiMjgwNCIsIk5hbWUiOiJNVUhBTU1BRCBBWkFNIiwiRW1wbG95ZWVJZCI6IjE0ODUiLCJGYWNpbGl0eUdyb3VwSWQiOiIwMTAyNjYiLCJGYWNpbGl0eUlkIjoiMTUiLCJQaGFyYW1jeUZhY2lsaXR5SWQiOiI1NSIsIklTX1BIQVJNQUNZX0NPTk5FQ1RFRCI6IlRydWUiLCJEb2N0b3JJZCI6IjE0ODUiLCJTRVNTSU9OSUQiOiIyMTU3NjIwOSIsIkNsaW5pY0lkIjoiMyIsInJvbGUiOlsiU0VDVVJJVFkgQURNSU5JU1RSQVRPUlMiLCJTRVRVUCBBRE1JTklTVFJBVE9SUyIsIkNFTydTIiwiRVhFQ1VUSVZFIERJUkVDVE9SUyIsIk1BTkFHRVJTIiwiU1VQRVJWSVNPUlMiLCJDTElFTlQgU0VSVklDRVMgQ09PUkRJTkFUT1JTIiwiQ0xJRU5UIFNFUlZJQ0VTIFNVUEVSVklTT1JTIiwiQ0xJRU5UIFNFUlZJQ0VTIE1BTkdFUlMiLCJIRUFEIE5VUlNFUyIsIkRPQ1RPUlMiLCJDSElFRiBPRiBNRURJQ0FMIFNUQUZGUyIsIkJJTy1NRURJQ0FMIFRFQ0hOSUNJQU5TIiwiQklPLU1FRElDQUwgRU5HSU5FRVJTIiwiQklPLU1FRElDQUwgREVQQVJUTUVOVCBIRUFEUyIsIklUIEhFTFAgREVTSyIsIkFETUlOSVNUUkFUT1JTIiwiTEFCIEFETUlOSVNUUkFUT1IiLCJMQUIgVEVDSE5JQ0lBTiIsIkJVU0lORVNTIE9GRklDRSBTVEFGRiIsIkZJTkFOQ0UgQUNDT1VOVEFOVFMiLCJQSEFSTUFDWSBTVEFGRiIsIkFDQ09VTlRTIFNUQUZGIiwiTEFCIFJFQ0VQVElPTklTVCIsIkVSIE5VUlNFIiwiSU5QQVRJRU5UIEJJTExJTkcgU1VQRVJWSVNPUiIsIkxEUi1PUiBOVVJTRVMiLCJBRE1JU1NJT04gU1RBRkYiLCJIRUxQIERFU0sgQURNSU4iLCJBUFBST1ZBTCBTVEFGRiIsIklOUEFUSUVOVCBCSUxMSU5HIENPT1JESU5BVE9SIiwiQklMTElORyBTVEFGRiIsIkNPTlNFTlQgIiwiQ29uc2VudCAtIERlbnRhbCIsIldFQkVNUiJdLCJuYmYiOjE2MDgyMzY2MjAsImV4cCI6MTYwOTEwMDYyMCwiaWF0IjoxNjA4MjM2NjIwfQ.z4Lh0dCRr9GWXvaTo7x5GPV7R5z8ONyh3-0uk3PXMu8",
);

@ -33,7 +33,9 @@ class PrescriptionViewModel extends BaseViewModel {
if (_prescriptionService.hasError) {
error = _prescriptionService.error;
setState(ViewState.ErrorLocal);
} else
} else {
await getPrescription();
setState(ViewState.Idle);
}
}
}

@ -45,7 +45,9 @@ class ProcedureViewModel extends BaseViewModel {
if (_procedureService.hasError) {
error = _procedureService.error;
setState(ViewState.ErrorLocal);
} else
} else {
await getProcedure();
setState(ViewState.Idle);
}
}
}

@ -72,9 +72,9 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
//_selectedType=='3'?
//=====================
Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
DoctorProfileModel doctorProfile =
new DoctorProfileModel.fromJson(profile);
//Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
// DoctorProfileModel doctorProfile =
// new DoctorProfileModel.fromJson(profile);
if (_formKey.currentState.validate()) {
_formKey.currentState.save();
@ -83,16 +83,16 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
print('_selectedType${_selectedType}');
String token = await sharedPref.getString(TOKEN);
_patientSearchFormValues.TokenID = token;
_patientSearchFormValues.ProjectID = doctorProfile.projectID; //15
_patientSearchFormValues.DoctorID = doctorProfile.doctorID;
_patientSearchFormValues.ClinicID = doctorProfile.clinicID;
// _patientSearchFormValues.TokenID = token;
// _patientSearchFormValues.ProjectID = doctorProfile.projectID; //15
// _patientSearchFormValues.DoctorID = doctorProfile.doctorID;
// _patientSearchFormValues.ClinicID = doctorProfile.clinicID;
//=====================
// _patientSearchFormValues.
//=====================
print("=============doctorProfile.clinicID=" +
doctorProfile.clinicID.toString());
// print("=============doctorProfile.clinicID=" +
// doctorProfile.clinicID.toString());
Navigator.of(context).pushNamed(PATIENTS, arguments: {
"patientSearchForm": _patientSearchFormValues,

@ -5,250 +5,355 @@ 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/models/livecare/transfer_to_admin.dart';
import 'package:doctor_app_flutter/screens/prescription/prescription_screen.dart';
import 'package:doctor_app_flutter/screens/prescription/prescription_warnings.dart';
import 'package:doctor_app_flutter/util/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_text_form_field.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart';
import 'package:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart';
void addPrescriptionForm(context) {
void addPrescriptionForm(context, PrescriptionViewModel model) {
TextEditingController durationController = TextEditingController();
TextEditingController strengthController = TextEditingController();
TextEditingController routeController = TextEditingController();
TextEditingController frequencyController = TextEditingController();
TextEditingController indicationController = TextEditingController();
TextEditingController instructions = TextEditingController();
TextEditingController drugIdController = TextEditingController();
TextEditingController doseController = TextEditingController();
final GlobalKey<FormState> _formKey = GlobalKey<FormState>();
final GlobalKey<FormState> formKey = GlobalKey<FormState>();
final double spaceBetweenTextFileds = 12;
showModalBottomSheet(
isScrollControlled: true,
context: context,
builder: (BuildContext bc) {
return SingleChildScrollView(
child: Container(
height: 700,
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(
decoration: BoxDecoration(
borderRadius:
BorderRadius.all(Radius.circular(6.0)),
border: Border.all(
width: 1.0, color: HexColor("#CCCCCC"))),
child: AppTextFormField(
labelText:
TranslationBase.of(context).searchMedicine,
borderColor: Colors.white,
textInputType: TextInputType.text,
inputFormatter: ONLY_LETTERS,
),
),
SizedBox(
height: spaceBetweenTextFileds,
),
Container(
decoration: BoxDecoration(
borderRadius:
BorderRadius.all(Radius.circular(6.0)),
border: Border.all(
width: 1.0, color: HexColor("#CCCCCC"))),
child: AppTextFormField(
labelText: TranslationBase.of(context).orderType,
borderColor: Colors.white,
textInputType: TextInputType.number,
inputFormatter: ONLY_NUMBERS,
),
),
SizedBox(height: spaceBetweenTextFileds),
Container(
decoration: BoxDecoration(
borderRadius:
BorderRadius.all(Radius.circular(6.0)),
border: Border.all(
width: 1.0, color: HexColor("#CCCCCC"))),
child: AppTextFormField(
labelText: TranslationBase.of(context).strength,
borderColor: Colors.white,
textInputType: TextInputType.number,
inputFormatter: ONLY_NUMBERS,
),
),
SizedBox(height: spaceBetweenTextFileds),
Container(
decoration: BoxDecoration(
borderRadius:
BorderRadius.all(Radius.circular(6.0)),
border: Border.all(
width: 1.0, color: HexColor("#CCCCCC"))),
child: AppTextFormField(
labelText: TranslationBase.of(context).route,
borderColor: Colors.white,
textInputType: TextInputType.number,
inputFormatter: ONLY_NUMBERS,
),
),
SizedBox(height: spaceBetweenTextFileds),
Container(
decoration: BoxDecoration(
borderRadius:
BorderRadius.all(Radius.circular(6.0)),
border: Border.all(
width: 1.0, color: HexColor("#CCCCCC"))),
child: AppTextFormField(
labelText: TranslationBase.of(context).frequency,
borderColor: Colors.white,
textInputType: TextInputType.number,
inputFormatter: ONLY_NUMBERS,
),
),
SizedBox(height: spaceBetweenTextFileds),
Container(
decoration: BoxDecoration(
borderRadius:
BorderRadius.all(Radius.circular(6.0)),
border: Border.all(
width: 1.0, color: HexColor("#CCCCCC"))),
child: AppTextFormField(
labelText: TranslationBase.of(context).doseTime,
borderColor: Colors.white,
textInputType: TextInputType.number,
inputFormatter: ONLY_NUMBERS,
controller: doseController,
),
),
SizedBox(height: spaceBetweenTextFileds),
Container(
decoration: BoxDecoration(
borderRadius:
BorderRadius.all(Radius.circular(6.0)),
border: Border.all(
width: 1.0, color: HexColor("#CCCCCC"))),
child: AppTextFormField(
labelText: TranslationBase.of(context).indication,
borderColor: Colors.white,
textInputType: TextInputType.number,
inputFormatter: ONLY_NUMBERS,
),
),
SizedBox(height: spaceBetweenTextFileds),
Container(
decoration: BoxDecoration(
borderRadius:
BorderRadius.all(Radius.circular(6.0)),
border: Border.all(
width: 1.0, color: HexColor("#CCCCCC"))),
child: AppTextFormField(
labelText: TranslationBase.of(context).fromDate,
borderColor: Colors.white,
textInputType: TextInputType.number,
inputFormatter: ONLY_NUMBERS,
),
),
SizedBox(height: spaceBetweenTextFileds),
Container(
decoration: BoxDecoration(
borderRadius:
BorderRadius.all(Radius.circular(6.0)),
border: Border.all(
width: 1.0, color: HexColor("#CCCCCC"))),
child: AppTextFormField(
labelText: TranslationBase.of(context).duration,
borderColor: Colors.white,
textInputType: TextInputType.number,
inputFormatter: ONLY_NUMBERS,
controller: durationController,
validator: (value) {
if (value == null || value == "")
return TranslationBase.of(context)
.emptyMessage;
else
return null;
}),
),
SizedBox(height: spaceBetweenTextFileds),
Container(
decoration: BoxDecoration(
borderRadius:
BorderRadius.all(Radius.circular(6.0)),
border: Border.all(
width: 1.0, color: HexColor("#CCCCCC"))),
child: AppTextFormField(
labelText:
TranslationBase.of(context).instruction,
borderColor: Colors.white,
textInputType: TextInputType.number,
inputFormatter: ONLY_NUMBERS,
),
),
SizedBox(height: spaceBetweenTextFileds),
Container(
margin:
EdgeInsets.all(SizeConfig.widthMultiplier * 5),
child: Wrap(
alignment: WrapAlignment.center,
children: <Widget>[
AppButton(
title:
TranslationBase.of(context).addMedication,
onPressed: () {
//prescriptionWarning(context);
postProcedure(
duration: durationController.text,
dose: doseController.text);
Navigator.pop(context);
},
return 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(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(6.0)),
border: Border.all(
width: 1.0,
color: HexColor("#CCCCCC"))),
child: TextFields(
hintText: TranslationBase.of(context)
.searchMedicine,
controller: drugIdController,
keyboardType: TextInputType.number,
validator: (value) {
if (value.isEmpty)
return TranslationBase.of(context)
.emptyMessage;
else
return null;
}),
),
SizedBox(
height: spaceBetweenTextFileds,
),
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(6.0)),
border: Border.all(
width: 1.0,
color: HexColor("#CCCCCC"))),
child: TextFields(
hintText:
TranslationBase.of(context).orderType,
),
),
SizedBox(height: spaceBetweenTextFileds),
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(6.0)),
border: Border.all(
width: 1.0,
color: HexColor("#CCCCCC"))),
child: TextFields(
hintText:
TranslationBase.of(context).strength,
keyboardType: TextInputType.number,
controller: strengthController,
validator: (value) {
if (value.isEmpty)
return TranslationBase.of(context)
.emptyMessage;
else
return null;
},
),
),
SizedBox(height: spaceBetweenTextFileds),
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(6.0)),
border: Border.all(
width: 1.0,
color: HexColor("#CCCCCC"))),
child: TextFields(
hintText: TranslationBase.of(context).route,
controller: routeController,
keyboardType: TextInputType.number,
validator: (value) {
if (value.isEmpty)
return TranslationBase.of(context)
.emptyMessage;
else
return null;
},
),
),
SizedBox(height: spaceBetweenTextFileds),
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(6.0)),
border: Border.all(
width: 1.0,
color: HexColor("#CCCCCC"))),
child: TextFields(
hintText:
TranslationBase.of(context).frequency,
controller: frequencyController,
keyboardType: TextInputType.number,
validator: (value) {
if (value.isEmpty)
return TranslationBase.of(context)
.emptyMessage;
else
return null;
},
),
),
SizedBox(height: spaceBetweenTextFileds),
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(6.0)),
border: Border.all(
width: 1.0,
color: HexColor("#CCCCCC"))),
child: TextFields(
hintText:
TranslationBase.of(context).doseTime,
controller: doseController,
keyboardType: TextInputType.number,
validator: (value) {
if (value.isEmpty)
return TranslationBase.of(context)
.emptyMessage;
else
return null;
},
),
),
SizedBox(height: spaceBetweenTextFileds),
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(6.0)),
border: Border.all(
width: 1.0,
color: HexColor("#CCCCCC"))),
child: TextFields(
hintText:
TranslationBase.of(context).indication,
controller: indicationController,
keyboardType: TextInputType.number,
validator: (value) {
if (value.isEmpty)
return TranslationBase.of(context)
.emptyMessage;
else
return null;
},
),
),
SizedBox(height: spaceBetweenTextFileds),
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(6.0)),
border: Border.all(
width: 1.0,
color: HexColor("#CCCCCC"))),
child: TextFields(
hintText:
TranslationBase.of(context).fromDate,
keyboardType: TextInputType.datetime,
validator: (value) {
if (value.isEmpty)
return TranslationBase.of(context)
.emptyMessage;
else
return null;
},
),
),
SizedBox(height: spaceBetweenTextFileds),
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(6.0)),
border: Border.all(
width: 1.0,
color: HexColor("#CCCCCC"))),
child: TextFields(
hintText:
TranslationBase.of(context).duration,
// borderColor: Colors.white,
keyboardType: TextInputType.number,
controller: durationController,
validator: (value) {
if (value.isEmpty)
return TranslationBase.of(context)
.emptyMessage;
else
return null;
}),
),
SizedBox(height: spaceBetweenTextFileds),
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(6.0)),
border: Border.all(
width: 1.0,
color: HexColor("#CCCCCC"))),
child: TextFields(
hintText:
TranslationBase.of(context).instruction,
controller: indicationController,
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();
if (formKey.currentState.validate()) {
postPrescription(
model: model,
duration: durationController.text,
dose: doseController.text,
frequency:
frequencyController.text,
route: routeController.text,
drugId: drugIdController.text,
strength: strengthController.text,
indication:
indicationController.text,
instruction:
indicationController.text,
);
Navigator.pop(context);
}
{
// Navigator.push(
// context,
// MaterialPageRoute(
// builder: (context) =>
// NewPrescriptionScreen()),
// );
}
},
),
],
),
),
],
),
),
],
),
),
],
),
),
],
),
),
),
);
),
);
});
});
}
postProcedure({String duration, String dose}) async {
PrescriptionViewModel model = new PrescriptionViewModel();
postPrescription(
{String duration,
String dose,
String drugId,
String strength,
String route,
String frequency,
String indication,
String instruction,
PrescriptionViewModel model}) async {
PostPrescriptionReqModel postProcedureReqModel =
new PostPrescriptionReqModel();
List<PrescriptionRequestModel> sss = List();
postProcedureReqModel.appointmentNo = 2016055175;
postProcedureReqModel.clinicID = 1;
postProcedureReqModel.episodeID = 200012335;
postProcedureReqModel.patientMRN = 1234;
postProcedureReqModel.appointmentNo = 2016055159;
postProcedureReqModel.clinicID = 17;
postProcedureReqModel.episodeID = 200012330;
postProcedureReqModel.patientMRN = 3120877;
postProcedureReqModel.vidaAuthTokenID =
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMDAyIiwianRpIjoiOGFjNDRjZGQtOWE0Mi00M2YxLWE2YTQtMWQ4NzBmZmYwNTUyIiwiZW1haWwiOiIiLCJpZCI6IjEwMDIiLCJOYW1lIjoiVEVNUCAtIERPQ1RPUiIsIkVtcGxveWVlSWQiOiI0NzA5IiwiRmFjaWxpdHlHcm91cElkIjoiMDEwMjY2IiwiRmFjaWxpdHlJZCI6IjE1IiwiUGhhcmFtY3lGYWNpbGl0eUlkIjoiNTUiLCJJU19QSEFSTUFDWV9DT05ORUNURUQiOiJUcnVlIiwiRG9jdG9ySWQiOiI0NzA5IiwiU0VTU0lPTklEIjoiMjE1OTU2NDkiLCJDbGluaWNJZCI6IjEiLCJyb2xlIjpbIkRPQ1RPUlMiLCJIRUFEIERPQ1RPUlMiLCJBRE1JTklTVFJBVE9SUyIsIlJFQ0VQVElPTklTVCIsIkVSIE5VUlNFIiwiRVIgUkVDRVBUSU9OSVNUIiwiUEhBUk1BQ1kgQUNDT1VOVCBTVEFGRiIsIlBIQVJNQUNZIE5VUlNFIiwiSU5QQVRJRU5UIFBIQVJNQUNJU1QiLCJBRE1JU1NJT04gU1RBRkYiLCJBUFBST1ZBTCBTVEFGRiIsIkNPTlNFTlQgIiwiTUVESUNBTCBSRVBPUlQgLSBTSUNLIExFQVZFIE1BTkFHRVIiXSwibmJmIjoxNjA4NzM2NjY5LCJleHAiOjE2MDk2MDA2NjksImlhdCI6MTYwODczNjY2OX0.9EDgYrbe5fQA2CvgLdFT4s_PL7hD5R_Qggfpv4lDtUY";
sss.add(PrescriptionRequestModel(
covered: true,
dose: int.parse(dose),
itemId: 8,
itemId: int.parse(drugId),
doseUnitId: 1,
route: 1,
frequency: 1,
remarks: "test2",
route: int.parse(route),
frequency: int.parse(frequency),
remarks: instruction,
approvalRequired: true,
icdcode10Id: "test2",
doseTime: 1,
@ -261,7 +366,7 @@ postProcedure({String duration, String dose}) async {
if (model.state == ViewState.ErrorLocal) {
helpers.showErrorToast(model.error);
} else {
} else if (model.state == ViewState.Idle) {
DrAppToastMsg.showSuccesToast('Medication has been added');
}
}

@ -110,7 +110,7 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
children: [
InkWell(
onTap: () {
addPrescriptionForm(context);
addPrescriptionForm(context, model);
//model.postPrescription();
},
child: CircleAvatar(
@ -156,7 +156,7 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
],
)
: Padding(
padding: EdgeInsets.all(12.0),
padding: EdgeInsets.all(14.0),
child: NetworkBaseView(
baseViewModel: model,
child: Column(
@ -194,7 +194,7 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
),
),
onTap: () {
addPrescriptionForm(context);
addPrescriptionForm(context, model);
//model.postPrescription();
},
),
@ -204,19 +204,22 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
...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.2,
0.23,
width:
MediaQuery.of(context)
.size
@ -236,12 +239,12 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
MediaQuery.of(context)
.size
.height *
0.24,
0.282,
width:
MediaQuery.of(context)
.size
.width *
0.81,
0.77,
child: Column(
children: [
Row(
@ -250,17 +253,20 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
'Start Date:',
fontWeight:
FontWeight
.w900,
fontSize: 15.0,
.w700,
fontSize: 14.0,
),
AppText(
model
.prescriptionList[
0]
.entityList[
index]
.startDate,
fontSize: 11.0,
Expanded(
child: AppText(
model
.prescriptionList[
0]
.entityList[
index]
.startDate,
fontSize:
12.0,
),
),
SizedBox(
width: 6.0,
@ -269,22 +275,25 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
'Order Type:',
fontWeight:
FontWeight
.w900,
fontSize: 15.0,
.w700,
fontSize: 14.0,
),
AppText(
model
.prescriptionList[
0]
.entityList[
index]
.orderTypeDescription,
fontSize: 13.0,
Expanded(
child: AppText(
model
.prescriptionList[
0]
.entityList[
index]
.orderTypeDescription,
fontSize:
13.0,
),
),
],
),
SizedBox(
height: 2.5,
height: 5.5,
),
Row(
children: [
@ -298,11 +307,19 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
.entityList[
index]
.medicationName,
fontWeight:
FontWeight
.w700,
fontSize:
15.0,
),
),
)
],
),
SizedBox(
height: 5.5,
),
Row(
children: [
Expanded(
@ -314,7 +331,7 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
index]
.doseDetail,
fontSize:
13.0,
15.0,
),
)
],
@ -328,7 +345,8 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
'Indication: ',
fontWeight:
FontWeight
.w900,
.w700,
fontSize: 17.0,
),
Expanded(
child: AppText(
@ -339,40 +357,48 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
index]
.indication,
fontSize:
12.9),
15.0),
)
],
),
SizedBox(
height: 15.0,
height: 18.0,
),
Row(
children: [
AppText(
model
.prescriptionList[
0]
.entityList[
index]
.doctorName,
fontWeight:
FontWeight
.w900,
Expanded(
child: AppText(
model
.prescriptionList[
0]
.entityList[
index]
.doctorName,
fontWeight:
FontWeight
.w700,
),
)
],
),
Row(
children: [
AppText(model
.prescriptionList[
0]
.entityList[
index]
.remarks),
Expanded(
child: AppText(
model
.prescriptionList[
0]
.entityList[
index]
.remarks,
fontSize:
14.0,
),
),
],
),
SizedBox(
height: 15.0,
height: 10.0,
),
Divider(
@ -386,6 +412,23 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
],
),
),
Container(
height:
MediaQuery.of(context)
.size
.height *
0.05,
width:
MediaQuery.of(context)
.size
.width *
0.06,
child: Column(
children: [
Icon(Icons.edit)
],
),
),
],
),
],

@ -111,7 +111,10 @@ class _ProcedureScreenState extends State<ProcedureScreen> {
children: [
InkWell(
onTap: () {
addSelectedProcedure(context);
model.getCategories().then((value) {
addSelectedProcedure(context, model);
});
//model.postPrescription();
},
child: CircleAvatar(
@ -149,7 +152,7 @@ class _ProcedureScreenState extends State<ProcedureScreen> {
AppText(
TranslationBase.of(context).addNow,
color: Color(0XFFB8382C),
fontWeight: FontWeight.w900,
fontWeight: FontWeight.w700,
),
],
),
@ -194,7 +197,12 @@ class _ProcedureScreenState extends State<ProcedureScreen> {
),
),
onTap: () {
addSelectedProcedure(context);
model.getCategories().then((value) {
addSelectedProcedure(
context, model);
});
//model.postPrescription();
},
),
// Container(
@ -252,7 +260,7 @@ class _ProcedureScreenState extends State<ProcedureScreen> {
'Code #: ',
fontWeight:
FontWeight
.w900,
.w700,
fontSize: 15.0,
),
AppText(
@ -272,7 +280,7 @@ class _ProcedureScreenState extends State<ProcedureScreen> {
'Order Type: ',
fontWeight:
FontWeight
.w900,
.w700,
fontSize: 15.0,
),
AppText(
@ -310,7 +318,7 @@ class _ProcedureScreenState extends State<ProcedureScreen> {
'Price: ',
fontWeight:
FontWeight
.w900,
.w700,
),
Expanded(
child: AppText(
@ -382,7 +390,6 @@ class _ProcedureScreenState extends State<ProcedureScreen> {
}
postProcedure({ProcedureViewModel model}) async {
model = new ProcedureViewModel();
PostProcedureReqModel postProcedureReqModel = new PostProcedureReqModel();
List<Controls> controls = List();
List<Procedures> controlsProcedure = List();
@ -402,98 +409,248 @@ postProcedure({ProcedureViewModel model}) async {
postProcedureReqModel.procedures = controlsProcedure;
await model.postProcedure(postProcedureReqModel);
DrAppToastMsg.showSuccesToast('Procedure had been added');
if (model.state == ViewState.ErrorLocal) {
helpers.showErrorToast(model.error);
} else if (model.state == ViewState.Idle) {
DrAppToastMsg.showSuccesToast('procedure has been added');
}
}
void addSelectedProcedure(context) {
void addSelectedProcedure(context, ProcedureViewModel model) {
showModalBottomSheet(
context: context,
builder: (BuildContext bc) {
return AddSelectedProcedure(
model: model,
);
});
}
class AddSelectedProcedure extends StatefulWidget {
final ProcedureViewModel model;
const AddSelectedProcedure({Key key, this.model}) : super(key: key);
@override
_AddSelectedProcedureState createState() => _AddSelectedProcedureState();
}
class _AddSelectedProcedureState extends State<AddSelectedProcedure> {
TextEditingController procedureController = TextEditingController();
@override
Widget build(BuildContext context) {
return NetworkBaseView(
baseViewModel: widget.model,
child: SingleChildScrollView(
child: Container(
height: 490,
child: Padding(
padding: EdgeInsets.all(12.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppText(
'Select Procedure'.toUpperCase(),
fontWeight: FontWeight.w900,
),
if (widget.model.categoriesList.length != 0)
Container(
// child: ListView(
// children: [
// Column(
// children: model.historyFamilyList
// .map((historyInfo) {
// return Column(
// children: [
// Row(
// children: [
// Checkbox(
// value: isServiceSelected(
// historyInfo),
// activeColor:
// Colors.red[800],
// onChanged:
// (bool newValue) {
// setState(() {
// if (isServiceSelected(
// historyInfo
// )) {
// widget
// .removeHistory(
// historyInfo
// );
// }
// else {
// widget
// .myHistoryList
// .add(
// historyInfo);
// }
// });
// }),
// Expanded(
// child: Padding(
// padding:
// const EdgeInsets
// .symmetric(
// horizontal: 10,
// vertical: 0),
// child: Texts(
// historyInfo.nameEn,
// variant: "bodyText",
// bold: true,
// color:
// Colors.black),
// ),
// ),
// ],
// ),
// DividerWithSpacesAround(),
// ],
// );
// }).toList(),
// ),
// ],
// ),
height: 120.0,
child: ListView.builder(
scrollDirection: Axis.vertical,
shrinkWrap: true,
itemCount: widget.model.categoriesList[0].rowcount,
itemBuilder: (BuildContext ctxt, int index) {
return Container(
child: AppText(widget.model.categoriesList[0]
.entityList[index].procedureName),
);
}),
),
SizedBox(
height: 0.0,
),
Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(6.0)),
border: Border.all(
width: 1.0, color: HexColor("#CCCCCC"))),
child: AppTextFormField(
labelText: 'Add Delected Procedures'.toUpperCase(),
borderColor: Colors.white,
textInputType: TextInputType.text,
inputFormatter: ONLY_LETTERS,
controller: procedureController,
),
),
SizedBox(
height: 80.0,
),
Container(
margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5),
child: Wrap(
alignment: WrapAlignment.center,
children: <Widget>[
AppButton(
title: TranslationBase.of(context).addMedication,
onPressed: () {
Navigator.pop(context);
postProcedure(model: widget.model);
},
),
],
),
),
],
)
],
),
),
),
),
);
}
}
// isServiceSelected(ProcedureViewModel masterKey) {
// Iterable<MasterKeyModel> history = widget.myHistoryList.where((element) =>
// masterKey.id == element.id && masterKey.typeId == element.typeId);
// if (history.length > 0) {
// return true;
// }
// return false;
// }
void updateProcedureForm(context) {
showModalBottomSheet(
context: context,
isScrollControlled: true,
builder: (BuildContext bc) {
return BaseView(
onModelReady: (model) => model.getCategories(),
builder:
(BuildContext context, ProcedureViewModel model, Widget child) =>
NetworkBaseView(
baseViewModel: model,
child: SingleChildScrollView(
child: Container(
height: 490,
child: Padding(
padding: EdgeInsets.all(12.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppText(
'Select Procedure'.toUpperCase(),
fontWeight: FontWeight.w900,
return Container(
height: 500,
child: Form(
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 20.0, vertical: 10.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppText(
'Procedure Name'.toUpperCase(),
fontWeight: FontWeight.w900,
),
SizedBox(
height: 30.0,
),
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(6.0)),
border: Border.all(
width: 1.0, color: HexColor("#CCCCCC"))),
child: AppTextFormField(
labelText: 'Order ',
borderColor: Colors.white,
textInputType: TextInputType.number,
inputFormatter: ONLY_NUMBERS,
),
if (model.categoriesList.length != 0)
Container(
height: 120.0,
child: ListView.builder(
scrollDirection: Axis.vertical,
shrinkWrap: true,
itemCount: model.categoriesList[0].rowcount,
itemBuilder: (BuildContext ctxt, int index) {
return Container(
child: AppText(model.categoriesList[0]
.entityList[index].procedureName),
);
}),
),
SizedBox(
height: 0.0,
),
SizedBox(
height: 12.0,
),
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(6.0)),
border: Border.all(
width: 1.0, color: HexColor("#CCCCCC"))),
child: AppTextFormField(
labelText: 'Password',
borderColor: Colors.white,
textInputType: TextInputType.text,
inputFormatter: ONLY_LETTERS,
obscureText: true,
),
Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
decoration: BoxDecoration(
borderRadius:
BorderRadius.all(Radius.circular(6.0)),
border: Border.all(
width: 1.0, color: HexColor("#CCCCCC"))),
child: AppTextFormField(
labelText:
'Add Delected Procedures'.toUpperCase(),
borderColor: Colors.white,
textInputType: TextInputType.text,
inputFormatter: ONLY_LETTERS,
controller: procedureController,
),
),
SizedBox(
height: 80.0,
),
Container(
margin:
EdgeInsets.all(SizeConfig.widthMultiplier * 5),
child: Wrap(
alignment: WrapAlignment.center,
children: <Widget>[
AppButton(
title:
TranslationBase.of(context).addMedication,
onPressed: () {
Navigator.pop(context);
postProcedure();
},
),
],
),
),
SizedBox(
height: 190.0,
),
Container(
margin: EdgeInsets.all(SizeConfig.widthMultiplier * 2),
child: Wrap(
alignment: WrapAlignment.center,
children: <Widget>[
AppButton(
title: 'CONTINUE',
onPressed: () {
Navigator.pop(context);
// authorizationForm(context);
},
),
],
)
],
),
),
),
],
),
),
),
),
);
));
});
}

@ -24,9 +24,13 @@ import 'package:font_awesome_flutter/font_awesome_flutter.dart';
class SubjectivePage extends StatefulWidget {
final Function changePageViewIndex;
final List<MySelectedAllergy> myAllergiesList;
final List<MasterKeyModel> myHistoryList ;
final List<MasterKeyModel> myHistoryList;
SubjectivePage({Key key, this.changePageViewIndex, this.myAllergiesList, this.myHistoryList});
SubjectivePage(
{Key key,
this.changePageViewIndex,
this.myAllergiesList,
this.myHistoryList});
@override
_SubjectivePageState createState() => _SubjectivePageState();
@ -102,15 +106,13 @@ class _SubjectivePageState extends State<SubjectivePage> {
minLines: 13,
controller: complaintsController,
validator: (value) {
if (value == null || value =="")
return TranslationBase
.of(context)
if (value == null || value == "")
return TranslationBase.of(context)
.emptyMessage;
else if (value.length < 25)
return TranslationBase
.of(context)
return TranslationBase.of(context)
.chiefComplaintLength;
//"";
//"";
else
return null;
}),
@ -129,9 +131,8 @@ class _SubjectivePageState extends State<SubjectivePage> {
minLines: 13,
controller: illnessController,
validator: (value) {
if (value == null || value =="")
return TranslationBase
.of(context)
if (value == null || value == "")
return TranslationBase.of(context)
.emptyMessage;
else
return null;
@ -146,7 +147,6 @@ class _SubjectivePageState extends State<SubjectivePage> {
),
isExpand: isChiefExpand,
),
SizedBox(
height: 30,
),
@ -222,15 +222,16 @@ class _SubjectivePageState extends State<SubjectivePage> {
: EvaIcons.plus))
],
),
bodyWidget:Column(
bodyWidget: Column(
children: [
AddAllergiesWidget(myAllergiesList: widget.myAllergiesList,),
AddAllergiesWidget(
myAllergiesList: widget.myAllergiesList,
),
SizedBox(
height: 30,
),
],
)
,
),
isExpand: isAllergiesExpand,
),
SizedBox(
@ -308,7 +309,6 @@ class _SubjectivePageState extends State<SubjectivePage> {
// } else {
// helpers.showErrorToast('Please add required field correctly');
// }
}
postAllergy(
@ -320,8 +320,8 @@ class _SubjectivePageState extends State<SubjectivePage> {
null)
postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM = [];
//TODO: make static value dynamic
postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM
.add(ListHisProgNotePatientAllergyDiseaseVM(
postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM.add(
ListHisProgNotePatientAllergyDiseaseVM(
allergyDiseaseId: allergy.selectedAllergy.id,
allergyDiseaseType: allergy.selectedAllergy.typeId,
patientMRN: 3120690,
@ -331,9 +331,11 @@ class _SubjectivePageState extends State<SubjectivePage> {
remarks: allergy.remark,
createdBy: 1485,
//
createdOn: DateTime.now().toIso8601String(),//"2020-08-14T20:37:22.780Z",
createdOn: DateTime.now()
.toIso8601String(), //"2020-08-14T20:37:22.780Z",
editedBy: 1485,
editedOn: DateTime.now().toIso8601String(),//"2020-08-14T20:37:22.780Z",
editedOn: DateTime.now()
.toIso8601String(), //"2020-08-14T20:37:22.780Z",
isChecked: false,
isUpdatedByNurse: false));
});
@ -371,23 +373,21 @@ class _SubjectivePageState extends State<SubjectivePage> {
postChiefComplaint({SOAPViewModel model}) async {
formKey.currentState.save();
if(formKey.currentState.validate()){
if (formKey.currentState.validate()) {
PostChiefComplaintRequestModel postChiefComplaintRequestModel =
//TODO: make static value dynamic
new PostChiefComplaintRequestModel(
patientMRN: 3120690,
episodeID: 200012117,
appointmentNo: 2016054573,
chiefComplaint: complaintsController.text,
currentMedication: "currentMedication",
hopi: illnessController.text,
isLactation: false,
ispregnant: false,
numberOfWeeks: 22);
//TODO: make static value dynamic
new PostChiefComplaintRequestModel(
patientMRN: 3120690,
episodeID: 200012117,
appointmentNo: 2016054573,
chiefComplaint: complaintsController.text,
currentMedication: "currentMedication",
hopi: illnessController.text,
isLactation: false,
ispregnant: false,
numberOfWeeks: 22);
await model.postChiefComplaint(postChiefComplaintRequestModel);
}
}
}

Loading…
Cancel
Save