drug list

merge-requests/234/head
hussam al-habibeh 4 years ago
parent 76cc4d11f8
commit f997561bb8

@ -11,6 +11,8 @@ class PrescriptionService extends BaseService {
List<PrescriptionModel> get prescriptionList => _prescriptionList;
List<SearchDrugModel> _drugsList = List();
List<SearchDrugModel> get drugsList => _drugsList;
List<dynamic> doctorsList = [];
List<dynamic> specialityList = [];
PrescriptionReqModel _prescriptionReqModel = PrescriptionReqModel(
patientMRN: 3120877,
@ -26,7 +28,8 @@ class PrescriptionService extends BaseService {
PostPrescriptionReqModel _postPrescriptionReqModel =
PostPrescriptionReqModel();
Future getPrescription() async {
Future getPrescription({int mrn}) async {
_prescriptionReqModel = PrescriptionReqModel(patientMRN: 3120877);
hasError = false;
_prescriptionList.clear();
await baseAppClient.post(GET_PRESCRIPTION_LIST,
@ -41,10 +44,11 @@ class PrescriptionService extends BaseService {
Future getDrugs() async {
hasError = false;
_drugsList.clear();
await baseAppClient.post(SEARCH_DRUG,
onSuccess: (dynamic response, int statusCode) {
_drugsList.add(SearchDrugModel.fromJson(response['MedicationList']));
doctorsList = [];
doctorsList = response['MedicationList']['entityList'];
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;

@ -12,13 +12,13 @@ class PrescriptionViewModel extends BaseViewModel {
List<PrescriptionModel> get prescriptionList =>
_prescriptionService.prescriptionList;
List<SearchDrugModel> get drugsList => _prescriptionService.drugsList;
List<dynamic> get drugsList => _prescriptionService.doctorsList;
Future getPrescription() async {
Future getPrescription({int mrn}) async {
hasError = false;
//_insuranceCardService.clearInsuranceCard();
setState(ViewState.Busy);
await _prescriptionService.getPrescription();
await _prescriptionService.getPrescription(mrn: mrn);
if (_prescriptionService.hasError) {
error = _prescriptionService.error;
setState(ViewState.ErrorLocal);
@ -27,7 +27,7 @@ class PrescriptionViewModel extends BaseViewModel {
}
Future postPrescription(
PostPrescriptionReqModel postProcedureReqModel) async {
PostPrescriptionReqModel postProcedureReqModel, int mrn) async {
hasError = false;
//_insuranceCardService.clearInsuranceCard();
setState(ViewState.Busy);
@ -36,13 +36,13 @@ class PrescriptionViewModel extends BaseViewModel {
error = _prescriptionService.error;
setState(ViewState.ErrorLocal);
} else {
await getPrescription();
await getPrescription(mrn: mrn);
setState(ViewState.Idle);
}
}
Future updatePrescription(
PostPrescriptionReqModel updatePrescriptionReqModel) async {
PostPrescriptionReqModel updatePrescriptionReqModel, int mrn) async {
hasError = false;
//_insuranceCardService.clearInsuranceCard();
setState(ViewState.Busy);
@ -51,7 +51,7 @@ class PrescriptionViewModel extends BaseViewModel {
error = _prescriptionService.error;
setState(ViewState.ErrorLocal);
} else {
await getPrescription();
await getPrescription(mrn: mrn);
setState(ViewState.Idle);
}
}

@ -124,7 +124,10 @@ class _AdmissionRequestDetailScreenState
ListSelectDialog dialog =
ListSelectDialog(
list: model.speciality,
attributeName: model.selectedLanguage == 'ar' ? 'nameAr' :'nameEn' ,
attributeName:
model.selectedLanguage == 'ar'
? 'nameAr'
: 'nameEn',
attributeValueId: 'id',
okText:
TranslationBase.of(context)
@ -149,7 +152,12 @@ class _AdmissionRequestDetailScreenState
TranslationBase.of(context)
.speciality,
_selectedSpeciality != null
? model.selectedLanguage == 'ar' ? _selectedSpeciality['nameAr'] : _selectedSpeciality['nameEn']
? model.selectedLanguage ==
'ar'
? _selectedSpeciality[
'nameAr']
: _selectedSpeciality[
'nameEn']
: null,
true),
enabled: false,
@ -170,10 +178,13 @@ class _AdmissionRequestDetailScreenState
list: model.doctorsList,
attributeName: 'DoctorName',
attributeValueId: 'DoctorID',
okText: TranslationBase.of(context).ok,
okText:
TranslationBase.of(context)
.ok,
okFunction: (selectedValue) {
setState(() {
_selectedDoctor = selectedValue;
_selectedDoctor =
selectedValue;
});
},
);
@ -187,10 +198,13 @@ class _AdmissionRequestDetailScreenState
}
: null,
child: TextField(
decoration: Helpers.textFieldSelectorDecoration(
TranslationBase.of(context).doctor,
decoration:
Helpers.textFieldSelectorDecoration(
TranslationBase.of(context)
.doctor,
_selectedDoctor != null
? _selectedDoctor['DoctorName']
? _selectedDoctor[
'DoctorName']
: null,
true),
enabled: false,
@ -202,17 +216,16 @@ class _AdmissionRequestDetailScreenState
),
Container(
height: screenSize.height * 0.070,
decoration:
Helpers.containerBorderDecoration(
Color(0xFFEEEEEE),
Color(0xFFCCCCCC),
decoration: Helpers.containerBorderDecoration(
Color(0xFFEEEEEE), Color(0xFFCCCCCC),
borderWidth: 0.0),
child: InkWell(
onTap: () => null,
child: TextField(
decoration:
Helpers.textFieldSelectorDecoration(
TranslationBase.of(context).referringDate,
TranslationBase.of(context)
.referringDate,
null,
true,
suffixIcon: Icon(
@ -236,9 +249,11 @@ class _AdmissionRequestDetailScreenState
child: TextField(
decoration:
Helpers.textFieldSelectorDecoration(
TranslationBase.of(context).referringDoctor,
TranslationBase.of(context)
.referringDoctor,
null,
true, dropDownColor: Color(0xFFCCCCCC)),
true,
dropDownColor: Color(0xFFCCCCCC)),
enabled: false,
// controller: _remarksController,
keyboardType: TextInputType.text,
@ -256,7 +271,9 @@ class _AdmissionRequestDetailScreenState
title: TranslationBase.of(context).next,
color: HexColor("#B8382B"),
onPressed: () {
Navigator.of(context).pushNamed(PATIENT_ADMISSION_REQUEST_2, arguments: {'patient': patient});
Navigator.of(context).pushNamed(
PATIENT_ADMISSION_REQUEST_2,
arguments: {'patient': patient});
},
),
),

@ -139,13 +139,13 @@ class _AdmissionRequestSecondScreenState
_emergencyAdmission = newValue;
});
},
controlAffinity: ListTileControlAffinity.leading,
controlAffinity:
ListTileControlAffinity.leading,
contentPadding: EdgeInsets.all(0),
),
CheckboxListTile(
title: AppText(
TranslationBase.of(context)
.patientPregnant,
TranslationBase.of(context).patientPregnant,
fontWeight: FontWeight.normal,
fontSize: SizeConfig.textMultiplier * 2.1,
),
@ -155,13 +155,16 @@ class _AdmissionRequestSecondScreenState
_patientPregnant = newValue;
});
},
controlAffinity: ListTileControlAffinity.leading,
controlAffinity:
ListTileControlAffinity.leading,
contentPadding: EdgeInsets.all(0),
),
Container(
child: TextField(
decoration: Helpers.textFieldSelectorDecoration(
TranslationBase.of(context).treatmentLine,
decoration:
Helpers.textFieldSelectorDecoration(
TranslationBase.of(context)
.treatmentLine,
null,
false),
enabled: true,
@ -176,7 +179,8 @@ class _AdmissionRequestSecondScreenState
Container(
height: screenSize.height * 0.070,
child: InkWell(
onTap: /*model.doctorsList != null &&
onTap:
/*model.doctorsList != null &&
model.doctorsList.length > 0
? () {
ListSelectDialog dialog =
@ -199,13 +203,16 @@ class _AdmissionRequestSecondScreenState
},
);
}
:*/ null,
:*/
null,
child: TextField(
decoration: Helpers.textFieldSelectorDecoration(
decoration:
Helpers.textFieldSelectorDecoration(
TranslationBase.of(context).ward,
/* _selectedWard != null
? _selectedWard['DoctorName']
:*/ null,
:*/
null,
true),
enabled: false,
),
@ -224,13 +231,15 @@ class _AdmissionRequestSecondScreenState
_preAnesthesiaReferred = newValue;
});
},
controlAffinity: ListTileControlAffinity.leading,
controlAffinity:
ListTileControlAffinity.leading,
contentPadding: EdgeInsets.all(0),
),
Container(
height: screenSize.height * 0.070,
child: InkWell(
onTap: /*model.doctorsList != null &&
onTap:
/*model.doctorsList != null &&
model.doctorsList.length > 0
? () {
ListSelectDialog dialog =
@ -253,13 +262,17 @@ class _AdmissionRequestSecondScreenState
},
);
}
:*/ null,
:*/
null,
child: TextField(
decoration: Helpers.textFieldSelectorDecoration(
TranslationBase.of(context).admissionType,
decoration:
Helpers.textFieldSelectorDecoration(
TranslationBase.of(context)
.admissionType,
/* _admissionType != null
? _admissionType['DoctorName']
:*/ null,
:*/
null,
true),
enabled: false,
),
@ -271,7 +284,8 @@ class _AdmissionRequestSecondScreenState
Container(
height: screenSize.height * 0.070,
child: InkWell(
onTap: /*model.doctorsList != null &&
onTap:
/*model.doctorsList != null &&
model.doctorsList.length > 0
? () {
ListSelectDialog dialog =
@ -294,13 +308,17 @@ class _AdmissionRequestSecondScreenState
},
);
}
:*/ null,
:*/
null,
child: TextField(
decoration: Helpers.textFieldSelectorDecoration(
TranslationBase.of(context).diagnosis,
decoration:
Helpers.textFieldSelectorDecoration(
TranslationBase.of(context)
.diagnosis,
/* _admissionType != null
? _admissionType['DoctorName']
:*/ null,
:*/
null,
true),
enabled: false,
),
@ -311,8 +329,10 @@ class _AdmissionRequestSecondScreenState
),
Container(
child: TextField(
decoration: Helpers.textFieldSelectorDecoration(
TranslationBase.of(context).preOperativeOrders,
decoration:
Helpers.textFieldSelectorDecoration(
TranslationBase.of(context)
.preOperativeOrders,
null,
false),
enabled: true,
@ -327,7 +347,8 @@ class _AdmissionRequestSecondScreenState
Container(
height: screenSize.height * 0.070,
child: InkWell(
onTap: /*model.doctorsList != null &&
onTap:
/*model.doctorsList != null &&
model.doctorsList.length > 0
? () {
ListSelectDialog dialog =
@ -350,13 +371,17 @@ class _AdmissionRequestSecondScreenState
},
);
}
:*/ null,
:*/
null,
child: TextField(
decoration: Helpers.textFieldSelectorDecoration(
TranslationBase.of(context).allergies,
decoration:
Helpers.textFieldSelectorDecoration(
TranslationBase.of(context)
.allergies,
/* _admissionType != null
? _admissionType['DoctorName']
:*/ null,
:*/
null,
true),
enabled: false,
),
@ -375,7 +400,9 @@ class _AdmissionRequestSecondScreenState
title: TranslationBase.of(context).next,
color: HexColor("#B8382B"),
onPressed: () {
Navigator.of(context).pushNamed(PATIENT_ADMISSION_REQUEST_3, arguments: {'patient': patient});
Navigator.of(context).pushNamed(
PATIENT_ADMISSION_REQUEST_3,
arguments: {'patient': patient});
},
),
),

@ -5,78 +5,235 @@ 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/models/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/screens/prescription/prescription_screen.dart';
import 'package:doctor_app_flutter/screens/prescription/prescription_warnings.dart';
import 'package:doctor_app_flutter/util/date-utils.dart';
import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart';
import 'package:doctor_app_flutter/util/helpers.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/patients/dynamic_elements.dart';
import 'package:doctor_app_flutter/widgets/shared/TextFields.dart';
import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_text_form_field.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/dialogs/dailog-list-select.dart';
import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart';
import 'package:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart';
import 'package:intl/intl.dart';
class AddPrescriptionFormScreen extends StatefulWidget {
@override
_AddPrescriptionFormScreenState createState() =>
_AddPrescriptionFormScreenState();
addPrescriptionForm(
context, PrescriptionViewModel model, PatiantInformtion patient) {
showModalBottomSheet(
isScrollControlled: true,
context: context,
builder: (BuildContext bc) {
return PrescriptionFormWidget(model, patient);
});
}
class _AddPrescriptionFormScreenState extends State<AddPrescriptionFormScreen> {
PrescriptionViewModel model = PrescriptionViewModel();
// PostPrescriptionReqModel addPrescriptionModel = PostPrescriptionReqModel();
// List<PrescriptionRequestModel> sss = List();
// void _presentDatePicker(id) {
// showDatePicker(
// context: context,
// initialDate: DateTime.now(),
// firstDate: DateTime(2019),
// lastDate: DateTime(2050),
// ).then((pickedDate) {
// if (pickedDate == null) {
// return;
// }
// setState(() {
// // var selectedDate = DateFormat.yMd().format(pickedDate);
// final df = new DateFormat('yyyy-MM-dd');
// model.startDate = df.format(pickedDate);
//
// strengthController.text = sss.add(PrescriptionRequestModel(doseStartDate: ''));
// //addSickLeave.startDate = selectedDate;
// });
// });
// }
@override
Widget build(BuildContext context) {
return addPrescriptionForm(context, model);
postProcedure(
{String duration,
String doseTimeIn,
String dose,
String drugId,
String strength,
String route,
String frequency,
String indication,
String instruction,
PrescriptionViewModel model,
DateTime doseTime,
PatiantInformtion patient}) async {
PostPrescriptionReqModel postProcedureReqModel =
new PostPrescriptionReqModel();
List<PrescriptionRequestModel> sss = List();
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: 1,
itemId: int.parse(drugId),
doseUnitId: 1,
route: int.parse(route),
frequency: int.parse(frequency),
remarks: instruction,
approvalRequired: true,
icdcode10Id: "test2",
doseTime: int.parse(doseTimeIn),
duration: int.parse(duration),
doseStartDate: doseTime.toIso8601String()));
postProcedureReqModel.prescriptionRequestModel = sss;
//postProcedureReqModel.procedures = controlsProcedure;
await model.postPrescription(postProcedureReqModel, patient.patientMRN);
if (model.state == ViewState.ErrorLocal) {
helpers.showErrorToast(model.error);
} else if (model.state == ViewState.Idle) {
DrAppToastMsg.showSuccesToast('Medication has been added');
}
}
addPrescriptionForm(context, PrescriptionViewModel model) {
class PrescriptionFormWidget extends StatefulWidget {
final PrescriptionViewModel model;
PatiantInformtion patient;
PrescriptionFormWidget(this.model, this.patient);
@override
_PrescriptionFormWidgetState createState() => _PrescriptionFormWidgetState();
}
class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
TextEditingController durationController = TextEditingController();
TextEditingController strengthController = TextEditingController();
TextEditingController routeController = TextEditingController();
TextEditingController frequencyController = TextEditingController();
TextEditingController indicationController = TextEditingController();
TextEditingController instructionController = TextEditingController();
DateTime selectedDate;
dynamic selectedDrug;
TextEditingController drugIdController = TextEditingController();
TextEditingController doseController = TextEditingController();
final GlobalKey<FormState> formKey = GlobalKey<FormState>();
final double spaceBetweenTextFileds = 12;
List<dynamic> referToList;
dynamic type;
dynamic strength;
dynamic route;
dynamic frequency;
dynamic duration;
dynamic doseTime;
showModalBottomSheet(
isScrollControlled: true,
context: context,
builder: (BuildContext bc) {
return //BaseView<PrescriptionViewModel>(
//onModelReady: (model) => model.getDrugs(),
//builder: (BuildContext context, PrescriptionViewModel model,
//Widget child) =>
List<dynamic> strengthList;
List<dynamic> routeList;
List<dynamic> frequencyList;
List<dynamic> durationList;
List<dynamic> doseTimeList;
//PatiantInformtion patient;
dynamic _strength;
dynamic _selectedBranch;
@override
void initState() {
super.initState();
referToList = List();
strengthList = List();
routeList = List();
frequencyList = List();
durationList = List();
doseTimeList = List();
dynamic regularOrder = {"id": 1, "name": "regular Order"};
dynamic urgentOrder = {"id": 2, "name": "urgent Order"};
dynamic strength1 = {"id": 1, "name": "1"};
dynamic strength2 = {"id": 2, "name": "2"};
dynamic strength3 = {"id": 3, "name": "3"};
dynamic route1 = {"id": 7, "name": "By Mouth"};
dynamic route2 = {"id": 10, "name": "Inhale by Mouth"};
dynamic route3 = {"id": 15, "name": "for INJECTION"};
dynamic route4 = {"id": 17, "name": "Drops"};
dynamic route5 = {"id": 18, "name": "Rub On"};
dynamic route6 = {"id": 20, "name": "Spary"};
dynamic route7 = {"id": 27, "name": "In Both EYES"};
dynamic route8 = {"id": 28, "name": "In Both Ears"};
dynamic route9 = {"id": 32, "name": "Intramuscular"};
dynamic 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 duration1 = {"id": 1, "name": "For 1 Day"};
dynamic duration2 = {"id": 2, "name": "For 2 Days"};
dynamic duration3 = {"id": 3, "name": "For 3 Days"};
dynamic duration4 = {"id": 4, "name": "For 4 Days"};
dynamic duration5 = {"id": 5, "name": "For 5 Days"};
dynamic duration6 = {"id": 6, "name": "For 6 Days"};
dynamic duration7 = {"id": 7, "name": "For 7 Days"};
dynamic duration8 = {"id": 8, "name": "For 8 Days"};
dynamic duration9 = {"id": 9, "name": "For 9 Days"};
dynamic duration10 = {"id": 10, "name": "For 10 Days"};
dynamic duration11 = {"id": 14, "name": "For 14 Days"};
dynamic 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"};
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);
frequencyList.add(frequency1);
frequencyList.add(frequency2);
frequencyList.add(frequency3);
frequencyList.add(frequency4);
frequencyList.add(frequency5);
frequencyList.add(frequency6);
frequencyList.add(frequency7);
frequencyList.add(frequency8);
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);
strengthList.add(strength1);
strengthList.add(strength2);
strengthList.add(strength3);
durationList.add(duration1);
durationList.add(duration2);
durationList.add(duration3);
durationList.add(duration4);
durationList.add(duration5);
durationList.add(duration6);
durationList.add(duration7);
durationList.add(duration8);
durationList.add(duration9);
durationList.add(duration10);
durationList.add(duration11);
referToList.add(regularOrder);
referToList.add(urgentOrder);
}
@override
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.getDrugs(),
builder: (BuildContext context, PrescriptionViewModel model,
Widget child) =>
DraggableScrollableSheet(
initialChildSize: 0.90,
maxChildSize: 0.90,
@ -94,9 +251,7 @@ addPrescriptionForm(context, PrescriptionViewModel model) {
//mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
AppText(
TranslationBase.of(context)
.medicines
.toUpperCase(),
TranslationBase.of(context).medicines.toUpperCase(),
fontWeight: FontWeight.w900,
),
SizedBox(
@ -109,126 +264,259 @@ addPrescriptionForm(context, PrescriptionViewModel model) {
//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;
}),
height: screenSize.height * 0.070,
child: InkWell(
onTap: model.drugsList != null &&
model.drugsList.length > 0
? () {
ListSelectDialog dialog =
ListSelectDialog(
list: model.drugsList,
attributeName: 'GenericName',
attributeValueId: 'ItemId',
okText:
TranslationBase.of(context)
.ok,
okFunction: (selectedValue) {
setState(() {
selectedDrug =
selectedValue;
});
},
);
showDialog(
barrierDismissible: false,
context: context,
builder:
(BuildContext context) {
return dialog;
},
);
}
: null,
child: TextField(
decoration: textFieldSelectorDecoration(
TranslationBase.of(context).search,
selectedDrug != null
? selectedDrug['GenericName']
: null,
true),
enabled: false,
),
),
),
SizedBox(
height: spaceBetweenTextFileds,
),
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(6.0)),
border: Border.all(
width: 1.0,
color: HexColor("#CCCCCC"))),
child: TextFields(
hintText: TranslationBase.of(context)
height: screenSize.height * 0.070,
child: InkWell(
onTap: referToList != null
? () {
ListSelectDialog dialog =
ListSelectDialog(
list: referToList,
attributeName: 'name',
attributeValueId: 'id',
okText:
TranslationBase.of(context)
.ok,
okFunction: (selectedValue) {
setState(() {
type = selectedValue;
_selectedBranch = null;
});
},
);
showDialog(
barrierDismissible: false,
context: context,
builder:
(BuildContext context) {
return dialog;
},
);
}
: null,
child: TextField(
decoration: textFieldSelectorDecoration(
TranslationBase.of(context)
.orderType,
type != null ? type['name'] : null,
true),
enabled: false,
),
),
),
SizedBox(height: spaceBetweenTextFileds),
Container(
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;
height: screenSize.height * 0.070,
child: InkWell(
onTap: strengthList != null
? () {
ListSelectDialog dialog =
ListSelectDialog(
list: strengthList,
attributeName: 'name',
attributeValueId: 'id',
okText:
TranslationBase.of(context)
.ok,
okFunction: (selectedValue) {
setState(() {
strength = selectedValue;
_selectedBranch = null;
});
},
);
showDialog(
barrierDismissible: false,
context: context,
builder:
(BuildContext context) {
return dialog;
},
);
}
: null,
child: TextField(
decoration: textFieldSelectorDecoration(
TranslationBase.of(context)
.strength,
strength != null
? strength['name']
: null,
true),
enabled: false,
),
),
),
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;
height: screenSize.height * 0.070,
child: InkWell(
onTap: routeList != null
? () {
ListSelectDialog dialog =
ListSelectDialog(
list: routeList,
attributeName: 'name',
attributeValueId: 'id',
okText:
TranslationBase.of(context)
.ok,
okFunction: (selectedValue) {
setState(() {
route = selectedValue;
_selectedBranch = null;
});
},
);
showDialog(
barrierDismissible: false,
context: context,
builder:
(BuildContext context) {
return dialog;
},
);
}
: null,
child: TextField(
decoration: textFieldSelectorDecoration(
TranslationBase.of(context).route,
route != null
? route['name']
: null,
true),
enabled: false,
),
),
),
SizedBox(height: spaceBetweenTextFileds),
Container(
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;
height: screenSize.height * 0.070,
child: InkWell(
onTap: frequencyList != null
? () {
ListSelectDialog dialog =
ListSelectDialog(
list: frequencyList,
attributeName: 'name',
attributeValueId: 'id',
okText:
TranslationBase.of(context)
.ok,
okFunction: (selectedValue) {
setState(() {
frequency = selectedValue;
_selectedBranch = null;
});
},
);
showDialog(
barrierDismissible: false,
context: context,
builder:
(BuildContext context) {
return dialog;
},
);
}
: null,
child: TextField(
decoration: textFieldSelectorDecoration(
TranslationBase.of(context)
.frequency,
frequency != null
? frequency['name']
: null,
true),
enabled: false,
),
),
),
SizedBox(height: spaceBetweenTextFileds),
Container(
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;
height: screenSize.height * 0.070,
child: InkWell(
onTap: doseTimeList != null
? () {
ListSelectDialog dialog =
ListSelectDialog(
list: doseTimeList,
attributeName: 'name',
attributeValueId: 'id',
okText:
TranslationBase.of(context)
.ok,
okFunction: (selectedValue) {
setState(() {
doseTime = selectedValue;
_selectedBranch = null;
});
},
);
showDialog(
barrierDismissible: false,
context: context,
builder:
(BuildContext context) {
return dialog;
},
);
}
: null,
child: TextField(
decoration: textFieldSelectorDecoration(
TranslationBase.of(context)
.doseTime,
doseTime != null
? doseTime['name']
: null,
true),
enabled: false,
),
),
),
SizedBox(height: spaceBetweenTextFileds),
@ -255,46 +543,69 @@ addPrescriptionForm(context, PrescriptionViewModel model) {
),
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;
},
height: screenSize.height * 0.070,
child: InkWell(
onTap: () =>
selectDate(context, widget.model),
child: TextField(
decoration:
Helpers.textFieldSelectorDecoration(
TranslationBase.of(context)
.date,
selectedDate != null
? "${DateUtils.convertStringToDateFormat(selectedDate.toString(), "yyyy-MM-dd")}"
: null,
true,
suffixIcon: Icon(
Icons.calendar_today,
color: Colors.black,
)),
enabled: false,
),
),
),
SizedBox(height: spaceBetweenTextFileds),
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(6.0)),
border: Border.all(
width: 1.0,
color: HexColor("#CCCCCC"))),
child: TextFields(
hintText: TranslationBase.of(context)
height: screenSize.height * 0.070,
child: InkWell(
onTap: durationList != null
? () {
ListSelectDialog dialog =
ListSelectDialog(
list: durationList,
attributeName: 'name',
attributeValueId: 'id',
okText:
TranslationBase.of(context)
.ok,
okFunction: (selectedValue) {
setState(() {
duration = selectedValue;
_selectedBranch = null;
});
},
);
showDialog(
barrierDismissible: false,
context: context,
builder:
(BuildContext context) {
return dialog;
},
);
}
: null,
child: TextField(
decoration: textFieldSelectorDecoration(
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;
}),
duration != null
? duration['name']
: null,
true),
enabled: false,
),
),
),
SizedBox(height: spaceBetweenTextFileds),
Container(
@ -336,21 +647,25 @@ addPrescriptionForm(context, PrescriptionViewModel model) {
if (formKey.currentState
.validate()) {
postProcedure(
model: model,
patient: widget.patient,
doseTimeIn:
doseTime['id'].toString(),
model: widget.model,
duration:
durationController.text,
dose: doseController.text,
frequency:
frequencyController.text,
route: routeController.text,
drugId: drugIdController.text,
duration['id'].toString(),
frequency: frequency['id']
.toString(),
route: route['id'].toString(),
drugId: selectedDrug['ItemId']
.toString(),
strength:
strengthController.text,
strength['id'].toString(),
indication:
indicationController.text,
instruction:
indicationController.text,
);
instructionController
.text,
doseTime: selectedDate);
Navigator.pop(context);
}
{
@ -375,69 +690,56 @@ addPrescriptionForm(context, PrescriptionViewModel model) {
),
),
);
});
//);
});
}),
);
}
// openAllergiesList(BuildContext context) {
// showModalBottomSheet(
// backgroundColor: Colors.white,
// isScrollControlled: true,
// context: context,
// builder: (context) {
// return AddAllergies(
// addAllergiesFun: (MySelectedAllergy mySelectedAllergy) {
// setState(() {
// widget.myAllergiesList.add(mySelectedAllergy);
// Navigator.of(context).pop();
// });
// },
// );
// });
// }
postProcedure(
{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 = 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: int.parse(drugId),
doseUnitId: 1,
route: int.parse(route),
frequency: int.parse(frequency),
remarks: instruction,
approvalRequired: true,
icdcode10Id: "test2",
doseTime: 1,
duration: int.parse(duration),
doseStartDate: "2020-12-20T13:07:41.769Z"));
postProcedureReqModel.prescriptionRequestModel = sss;
//postProcedureReqModel.procedures = controlsProcedure;
await model.postPrescription(postProcedureReqModel);
selectDate(BuildContext context, PrescriptionViewModel model) async {
DateTime selectedDate;
selectedDate = DateTime.now().add(Duration(hours: 10));
final DateTime picked = await showDatePicker(
context: context,
initialDate: selectedDate,
firstDate: DateTime.now().add(Duration(hours: 15)),
lastDate: DateTime(2040),
initialEntryMode: DatePickerEntryMode.calendar,
);
if (picked != null && picked != selectedDate) {
setState(() {
this.selectedDate = picked;
});
}
}
if (model.state == ViewState.ErrorLocal) {
helpers.showErrorToast(model.error);
} else if (model.state == ViewState.Idle) {
DrAppToastMsg.showSuccesToast('Medication has been added');
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,
),
);
}
}

@ -33,12 +33,13 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
@override
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(),
builder: (BuildContext context, PrescriptionViewModel model,
Widget child) =>
onModelReady: (model) => model.getPrescription(mrn: patient.patientMRN),
builder:
(BuildContext context, PrescriptionViewModel model, Widget child) =>
AppScaffold(
isShowAppBar: true,
appBarTitle: TranslationBase.of(context).prescription,
@ -65,14 +66,17 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
width: 20,
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
AppText(
patient.firstName + ' ' + patient.lastName,
patient.firstName +
' ' +
patient.lastName,
color: Colors.black,
fontWeight: FontWeight.bold,
),
if (model.prescriptionList.length > 0)
//if (model.prescriptionList.length > 0)
Row(
children: [
AppText(
@ -105,27 +109,32 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
thickness: 1.0,
color: Colors.grey,
),
if (model.prescriptionList.length != 0)
SizedBox(
height: model.prescriptionList[0].rowcount == 0
(model.prescriptionList.length != 0)
? SizedBox(
height:
model.prescriptionList[0].rowcount == 0
? 200.0
: 10.0),
: 10.0)
: SizedBox(height: 200.0),
//model.prescriptionList == null
if (model.prescriptionList.length != 0)
model.prescriptionList[0].rowcount == 0
(model.prescriptionList.length != 0)
? model.prescriptionList[0].rowcount == 0
? Column(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisAlignment:
MainAxisAlignment.center,
crossAxisAlignment:
CrossAxisAlignment.stretch,
children: [
InkWell(
onTap: () {
addPrescriptionForm(context, model);
addPrescriptionForm(
context, model, patient);
//model.postPrescription();
},
child: CircleAvatar(
radius: 65,
backgroundColor: Color(0XFFB8382C),
backgroundColor:
Color(0XFFB8382C),
child: CircleAvatar(
radius: 60,
backgroundColor: Colors.white,
@ -157,7 +166,8 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
MainAxisAlignment.center,
children: [
AppText(
TranslationBase.of(context).addNow,
TranslationBase.of(context)
.addNow,
color: Color(0XFFB8382C),
fontWeight: FontWeight.w900,
),
@ -181,10 +191,12 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
border: Border.all(
color: Colors.grey),
borderRadius:
BorderRadius.circular(10.0),
BorderRadius.circular(
10.0),
),
child: Padding(
padding: EdgeInsets.all(8.0),
padding:
EdgeInsets.all(8.0),
child: Row(
mainAxisAlignment:
MainAxisAlignment
@ -192,19 +204,22 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
children: [
AppText(
' Add more medication',
fontWeight: FontWeight.w100,
fontWeight:
FontWeight.w100,
fontSize: 12.5,
),
Icon(
Icons.add,
color: Color(0XFFB8382C),
color:
Color(0XFFB8382C),
)
],
),
),
),
onTap: () {
addPrescriptionForm(context, model);
addPrescriptionForm(
context, model, patient);
//model.postPrescription();
},
),
@ -212,7 +227,8 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
height: 15.0,
),
...List.generate(
model.prescriptionList[0].rowcount,
model.prescriptionList[0]
.rowcount,
(index) => Container(
//height: 240,
child: Column(
@ -225,13 +241,13 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
// CrossAxisAlignment.start,
children: [
Container(
height:
MediaQuery.of(context)
height: MediaQuery.of(
context)
.size
.height *
0.23,
width:
MediaQuery.of(context)
width: MediaQuery.of(
context)
.size
.width *
0.09,
@ -239,19 +255,20 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
children: [
AppText(
'8\nDEC',
color: Colors.green,
color: Colors
.green,
)
],
),
),
Container(
height:
MediaQuery.of(context)
height: MediaQuery.of(
context)
.size
.height *
0.282,
width:
MediaQuery.of(context)
width: MediaQuery.of(
context)
.size
.width *
0.77,
@ -264,37 +281,38 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
fontWeight:
FontWeight
.w700,
fontSize: 14.0,
fontSize:
14.0,
),
Expanded(
child: AppText(
child:
AppText(
model
.prescriptionList[
0]
.entityList[
index]
.prescriptionList[0]
.entityList[index]
.startDate,
fontSize:
12.0,
),
),
SizedBox(
width: 6.0,
width:
6.0,
),
AppText(
'Order Type:',
fontWeight:
FontWeight
.w700,
fontSize: 14.0,
fontSize:
14.0,
),
Expanded(
child: AppText(
child:
AppText(
model
.prescriptionList[
0]
.entityList[
index]
.prescriptionList[0]
.entityList[index]
.orderTypeDescription,
fontSize:
13.0,
@ -308,18 +326,16 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
Row(
children: [
Container(
child: Expanded(
child:
Expanded(
child:
AppText(
model
.prescriptionList[
0]
.entityList[
index]
.prescriptionList[0]
.entityList[index]
.medicationName,
fontWeight:
FontWeight
.w700,
FontWeight.w700,
fontSize:
15.0,
),
@ -333,12 +349,11 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
Row(
children: [
Expanded(
child: AppText(
child:
AppText(
model
.prescriptionList[
0]
.entityList[
index]
.prescriptionList[0]
.entityList[index]
.doseDetail,
fontSize:
15.0,
@ -356,18 +371,16 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
fontWeight:
FontWeight
.w700,
fontSize: 17.0,
fontSize:
17.0,
),
Expanded(
child: AppText(
model
.prescriptionList[
0]
.entityList[
index]
.prescriptionList[0]
.entityList[index]
.indication,
fontSize:
15.0),
fontSize: 15.0),
)
],
),
@ -377,16 +390,14 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
Row(
children: [
Expanded(
child: AppText(
child:
AppText(
model
.prescriptionList[
0]
.entityList[
index]
.prescriptionList[0]
.entityList[index]
.doctorName,
fontWeight:
FontWeight
.w700,
FontWeight.w700,
),
)
],
@ -394,12 +405,11 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
Row(
children: [
Expanded(
child: AppText(
child:
AppText(
model
.prescriptionList[
0]
.entityList[
index]
.prescriptionList[0]
.entityList[index]
.remarks,
fontSize:
14.0,
@ -413,8 +423,10 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
Divider(
height: 0,
thickness: 1.0,
color: Colors.grey,
thickness:
1.0,
color: Colors
.grey,
),
// SizedBox(
// height: 40,
@ -423,13 +435,13 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
),
),
Container(
height:
MediaQuery.of(context)
height: MediaQuery.of(
context)
.size
.height *
0.05,
width:
MediaQuery.of(context)
width: MediaQuery.of(
context)
.size
.width *
0.06,
@ -437,7 +449,8 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
children: [
InkWell(
child: Icon(
Icons.edit),
Icons
.edit),
onTap: () {
updatePrescriptionForm(
context,
@ -471,6 +484,59 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
),
),
)
: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment:
CrossAxisAlignment.stretch,
children: [
InkWell(
onTap: () {
addPrescriptionForm(
context, model, patient);
//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,
),
],
),
],
)
],
),
),
@ -479,6 +545,23 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
);
}
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, PrescriptionViewModel model) {
TextEditingController remarksController = TextEditingController();
@ -637,7 +720,8 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
updatePrescriptionReqModel.prescriptionRequestModel = sss;
//postProcedureReqModel.procedures = controlsProcedure;
await model.updatePrescription(updatePrescriptionReqModel);
await model.updatePrescription(
updatePrescriptionReqModel, patient.patientMRN);
if (model.state == ViewState.ErrorLocal) {
helpers.showErrorToast(model.error);

@ -509,7 +509,7 @@ class _AddSelectedProcedureState extends State<AddSelectedProcedure> {
baseViewModel: widget.model,
child: SingleChildScrollView(
child: Container(
height: 790,
height: 810,
child: Padding(
padding: EdgeInsets.all(12.0),
child: Column(
@ -566,7 +566,7 @@ class _AddSelectedProcedureState extends State<AddSelectedProcedure> {
maxLines: 5,
),
SizedBox(
height: 80.0,
height: 50.0,
),
Container(
margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5),

@ -66,10 +66,13 @@ class _ListSelectDialogState extends State<ListSelectDialog> {
...widget.list
.map((item) => RadioListTile(
title: Text("${item[widget.attributeName].toString()}"),
groupValue: widget.selectedValue[widget.attributeValueId].toString(),
groupValue: widget.selectedValue[widget.attributeValueId]
.toString(),
value: item[widget.attributeValueId].toString(),
activeColor: Colors.blue.shade700,
selected: item[widget.attributeValueId].toString() == widget.selectedValue[widget.attributeValueId].toString(),
selected: item[widget.attributeValueId].toString() ==
widget.selectedValue[widget.attributeValueId]
.toString(),
onChanged: (val) {
setState(() {
widget.selectedValue = item;

Loading…
Cancel
Save