Refactor add_prescription_form

merge-requests/967/head
RoaaGhali98 4 years ago
parent 228237bf96
commit 7afe24c2bc

@ -1,5 +1,6 @@
import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart';
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/core/model/procedure/procedure_template_details_model.dart';
import 'package:doctor_app_flutter/core/model/search_drug/get_medication_response_model.dart';
import 'package:doctor_app_flutter/core/service/patient_medical_file/prescription/medicine_service.dart';
@ -7,12 +8,20 @@ import 'package:doctor_app_flutter/core/service/patient_medical_file/prescriptio
import 'package:doctor_app_flutter/core/service/patient_medical_file/procedure/procedure_service.dart';
import 'package:doctor_app_flutter/core/model/SOAP/GetAssessmentReqModel.dart';
import 'package:doctor_app_flutter/core/model/SOAP/GetAssessmentResModel.dart';
import 'package:flutter/cupertino.dart';
import '../../locator.dart';
import '../model/Prescriptions/prescription_model.dart';
import 'base_view_model.dart';
class MedicineViewModel extends BaseViewModel {
bool hasError = false;
// dynamic route;
// dynamic frequency;
// dynamic duration;
// dynamic units;
MedicineService _medicineService = locator<MedicineService>();
ProcedureService _procedureService = locator<ProcedureService>();
PrescriptionService _prescriptionService = locator<PrescriptionService>();
@ -21,6 +30,8 @@ class MedicineViewModel extends BaseViewModel {
_procedureService.templateList;
List<ProcedureTempleteDetailsModelList> templateList = List();
GetMedicationResponseModel _selectedMedication;
get pharmacyItemsList => _medicineService.pharmacyItemsList;
get searchText => _medicineService.searchText;
@ -56,6 +67,10 @@ class MedicineViewModel extends BaseViewModel {
List<dynamic> get itemMedicineListUnit =>
_prescriptionService.itemMedicineListUnit;
Future getItem({int itemID}) async {
//hasError = false;
//_insuranceCardService.clearInsuranceCard();
@ -90,6 +105,82 @@ class MedicineViewModel extends BaseViewModel {
print(templateList.length.toString());
}
getPrescriptionForDrug(
List<PrescriptionModel> prescriptionList,
MedicineViewModel model,
) {
var prescriptionDetails = [];
if (prescriptionList.length > 0) {
prescriptionList[0].entityList.forEach((element) {
if (element.mediSpanGPICode != null) {
prescriptionDetails.add({
'DrugId': element.mediSpanGPICode,
'DrugName': element.medicationName,
'Dose': element.doseDailyQuantity,
'DoseType': element.doseDailyUnitID,
'Unit': element.uom,
'FrequencyType': element.frequencyID,
'Duration': element.doseDurationDays,
'RouteID': element.routeID,
'IsScreen': element.isSIG
});
}
});
}
// if (_selectedMedication.mediSpanGPICode != null) {
// prescriptionDetails.add({
// 'DrugId': _selectedMedication.mediSpanGPICode,
// 'DrugName': _selectedMedication.description,
// // 'Dose': strengthController.text,
// 'DoseType': model.itemMedicineListUnit.length == 1
// ? model.itemMedicineListUnit[0]['parameterCode'].toString()
// : units['parameterCode'].toString(),
// 'Unit': model.itemMedicineListUnit.length == 1
// ? model.itemMedicineListUnit[0]['description']
// : units['description'],
// 'FrequencyType': model.itemMedicineList.length == 1
// ? model.itemMedicineList[0]['parameterCode'].toString()
// : frequency['parameterCode'].toString(),
// 'Duration': duration['id'].toString(),
// 'RouteID': model.itemMedicineListRoute.length == 1
// ? model.itemMedicineListRoute[0]['parameterCode'].toString()
// : route['parameterCode'].toString(),
// 'IsScreen': true
// });
// }
return prescriptionDetails;
}
Future getAssessmentList ({
PatiantInformtion patientInfo,
bool isBusyLocal = false
}) async {
patientAssessmentList.map((element) {
return element.icdCode10ID;
});
GetAssessmentReqModel getAssessmentReqModel = GetAssessmentReqModel(
patientMRN: patientInfo.patientMRN,
episodeID: patientInfo.episodeNo.toString(),
editedBy: '',
doctorID: '',
appointmentNo: patientInfo.appointmentNo);
if (medicationStrengthList.length == 0) {
await getMedicationStrength();
}
if (medicationDurationList.length == 0) {
await getMedicationDuration();
}
if (medicationDoseTimeList.length == 0) {
await getMedicationDoseTime();
}
await getPatientAssessment(getAssessmentReqModel);
}
Future getProcedureTemplate({String categoryID}) async {
hasError = false;
setState(ViewState.Busy);

@ -32,7 +32,7 @@ class LivaCareTransferToAdmin extends StatefulWidget {
class _LivaCareTransferToAdminState extends State<LivaCareTransferToAdmin> {
stt.SpeechToText speech = stt.SpeechToText();
var reconizedWord;
var recognizedWord;
var event = RobotProvider();
ProjectViewModel projectViewModel;
@ -168,7 +168,7 @@ class _LivaCareTransferToAdminState extends State<LivaCareTransferToAdmin> {
}
void statusListener(String status) {
reconizedWord = status == 'listening' ? 'Lisening...' : 'Sorry....';
recognizedWord = status == 'listening' ? 'Listening...' : 'Sorry....';
}
void requestPermissions() async {
@ -178,14 +178,14 @@ class _LivaCareTransferToAdminState extends State<LivaCareTransferToAdmin> {
}
void resultListener(result) {
reconizedWord = result.recognizedWords;
event.setValue({"searchText": reconizedWord});
recognizedWord = result.recognizedWords;
event.setValue({"searchText": recognizedWord});
if (result.finalResult == true) {
setState(() {
SpeechToText.closeAlertDialog(context);
speech.stop();
noteController.text += reconizedWord + '\n';
noteController.text += recognizedWord + '\n';
});
} else {
print(result.finalResult);

@ -58,7 +58,7 @@ class _MedicineSearchState extends State<MedicineSearchScreen> {
double level = 0.0;
double minSoundLevel = 50000;
double maxSoundLevel = -50000;
String reconizedWord;
String recognizedWord;
@override
void didChangeDependencies() {
@ -264,9 +264,9 @@ class _MedicineSearchState extends State<MedicineSearchScreen> {
void resultListener(SpeechRecognitionResult result) {
setState(() {
// lastWords = "${result.recognizedWords} - ${result.finalResult}";
reconizedWord = result.recognizedWords;
recognizedWord = result.recognizedWords;
lastStatus = '';
myController.text = reconizedWord;
myController.text = recognizedWord;
Future.delayed(const Duration(seconds: 2), () {
// searchMedicine(context);
});

@ -51,7 +51,7 @@ class _UpdateNoteOrderState extends State<UpdateNoteOrder> {
int selectedType;
bool isSubmitted = false;
stt.SpeechToText speech = stt.SpeechToText();
var reconizedWord;
var recognizedWord;
var event = RobotProvider();
ProjectViewModel projectViewModel;
@ -296,7 +296,7 @@ class _UpdateNoteOrderState extends State<UpdateNoteOrder> {
}
void statusListener(String status) {
reconizedWord = status == 'listening' ? 'Lisening...' : 'Sorry....';
recognizedWord = status == 'listening' ? 'Listening...' : 'Sorry....';
}
void requestPermissions() async {
@ -306,14 +306,14 @@ class _UpdateNoteOrderState extends State<UpdateNoteOrder> {
}
void resultListener(result) {
reconizedWord = result.recognizedWords;
event.setValue({"searchText": reconizedWord});
recognizedWord = result.recognizedWords;
event.setValue({"searchText": recognizedWord});
if (result.finalResult == true) {
setState(() {
SpeechToText.closeAlertDialog(context);
speech.stop();
progressNoteController.text += reconizedWord + '\n';
progressNoteController.text += recognizedWord + '\n';
});
} else {
print(result.finalResult);

@ -47,7 +47,7 @@ class _UpdateOperationReportState extends State<UpdateOperationReport> {
int selectedType;
bool isSubmitted = false;
stt.SpeechToText speech = stt.SpeechToText();
var reconizedWord;
var recognizedWord;
var event = RobotProvider();
ProjectViewModel projectViewModel;

@ -46,7 +46,7 @@ class _AddReplayOnReferralPatientState
int replay = 1;
int reject = 2;
stt.SpeechToText speech = stt.SpeechToText();
var reconizedWord;
var recognizedWord;
var event = RobotProvider();
TextEditingController replayOnReferralController = TextEditingController();
@ -248,7 +248,7 @@ class _AddReplayOnReferralPatientState
void errorListener(SpeechRecognitionError error) {}
void statusListener(String status) {
reconizedWord = status == 'listening' ? 'Lisening...' : 'Sorry....';
recognizedWord = status == 'listening' ? 'Listening...' : 'Sorry....';
}
void requestPermissions() async {
@ -258,13 +258,13 @@ class _AddReplayOnReferralPatientState
}
void resultListener(result) {
reconizedWord = result.recognizedWords;
event.setValue({"searchText": reconizedWord});
recognizedWord = result.recognizedWords;
event.setValue({"searchText": recognizedWord});
if (result.finalResult == true) {
setState(() {
SpeechToText.closeAlertDialog(context);
replayOnReferralController.text += reconizedWord + '\n';
replayOnReferralController.text += recognizedWord + '\n';
});
}
}

@ -49,7 +49,7 @@ class _PatientMakeInPatientReferralScreenState
String doctorError;
String frequencyError;
stt.SpeechToText speech = stt.SpeechToText();
var reconizedWord;
var recognizedWord;
var event = RobotProvider();
@override
@ -88,7 +88,7 @@ class _PatientMakeInPatientReferralScreenState
}
void statusListener(String status) {
reconizedWord = status == 'listening' ? 'Lisening...' : 'Sorry....';
recognizedWord = status == 'listening' ? 'Listening...' : 'Sorry....';
}
void requestPermissions() async {
@ -98,14 +98,14 @@ class _PatientMakeInPatientReferralScreenState
}
void resultListener(result) {
reconizedWord = result.recognizedWords;
event.setValue({"searchText": reconizedWord});
recognizedWord = result.recognizedWords;
event.setValue({"searchText": recognizedWord});
if (result.finalResult == true) {
setState(() {
SpeechToText.closeAlertDialog(context);
speech.stop();
_remarksController.text += reconizedWord + '\n';
_remarksController.text += recognizedWord + '\n';
});
} else {
print(result.finalResult);

@ -15,7 +15,7 @@ import 'package:doctor_app_flutter/locator.dart';
import 'package:doctor_app_flutter/core/model/SOAP/GetAssessmentReqModel.dart';
import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/screens/prescription/drugtodrug.dart';
import 'package:doctor_app_flutter/screens/prescription/add_prescription/drugtodrug.dart';
import 'package:doctor_app_flutter/screens/prescription/prescription_text_filed.dart';
import 'package:doctor_app_flutter/util/date-utils.dart';
import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart';
@ -122,8 +122,8 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
TextEditingController indicationController = TextEditingController();
TextEditingController instructionController = TextEditingController();
bool visbiltyPrescriptionForm = false;
bool visbiltySearch = true;
bool visibilityPrescriptionForm = false;
bool visibilitySearch = true;
final myController = TextEditingController();
DateTime selectedDate;
@ -137,10 +137,10 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
final searchController = TextEditingController();
stt.SpeechToText speech = stt.SpeechToText();
var event = RobotProvider();
var reconizedWord;
var recognizedWord;
final GlobalKey<FormState> formKey = GlobalKey<FormState>();
final double spaceBetweenTextFileds = 12;
final double spaceBetweenTextFields = 12;
dynamic route;
dynamic frequency;
dynamic duration;
@ -151,19 +151,19 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
dynamic box;
dynamic x;
@override
void initState() {
requestPermissions();
event.controller.stream.listen((p) {
if (p['startPopUp'] == 'true') {
if (this.mounted) {
initSpeechState().then((value) => {onVoiceText()});
}
}
});
selectedType = 1;
super.initState();
}
// @override
// void initState() {
// requestPermissions();
// event.controller.stream.listen((p) {
// if (p['startPopUp'] == 'true') {
// if (this.mounted) {
// initSpeechState().then((value) => {onVoiceText()});
// }
// }
// });
// selectedType = 1;
// super.initState();
// }
setSelectedType(int val) {
setState(() {
@ -193,24 +193,24 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
}
void statusListener(String status) {
reconizedWord = status == 'listening' ? 'Lisening...' : 'Sorry....';
recognizedWord = status == 'listening' ? 'Listening...' : 'Sorry....';
}
void requestPermissions() async {
Map<Permission, PermissionStatus> statuses = await [
Permission.microphone,
].request();
}
// void requestPermissions() async {
// Map<Permission, PermissionStatus> statuses = await [
// Permission.microphone,
// ].request();
// }
void resultListener(result) {
reconizedWord = result.recognizedWords;
event.setValue({"searchText": reconizedWord});
recognizedWord = result.recognizedWords;
event.setValue({"searchText": recognizedWord});
if (result.finalResult == true) {
setState(() {
SpeechToText.closeAlertDialog(context);
speech.stop();
instructionController.text += reconizedWord + '\n';
instructionController.text += recognizedWord + '\n';
});
} else {
print(result.finalResult);
@ -227,42 +227,21 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
@override
Widget build(BuildContext context) {
final screenSize = MediaQuery.of(context).size;
ProjectViewModel projectViewModel = Provider.of(context);
return BaseView<MedicineViewModel>(
onModelReady: (model) async {
/// TODO Elham* Move this to view model
x = model.patientAssessmentList.map((element) {
return element.icdCode10ID;
});
GetAssessmentReqModel getAssessmentReqModel = GetAssessmentReqModel(
patientMRN: widget.patient.patientMRN,
episodeID: widget.patient.episodeNo.toString(),
editedBy: '',
doctorID: '',
appointmentNo: widget.patient.appointmentNo);
if (model.medicationStrengthList.length == 0) {
await model.getMedicationStrength();
}
if (model.medicationDurationList.length == 0) {
await model.getMedicationDuration();
}
if (model.medicationDoseTimeList.length == 0) {
await model.getMedicationDoseTime();
}
await model.getPatientAssessment(getAssessmentReqModel);
},
onModelReady: (model) => model.getAssessmentList(
patientInfo: widget.patient
),
builder: (
BuildContext context,
MedicineViewModel model,
Widget child,
) =>
Widget child,) =>
NetworkBaseView(
baseViewModel: model,
child: GestureDetector(
onTap: () {
baseViewModel: model,
child: GestureDetector(
onTap: () {
FocusScope.of(context).requestFocus(new FocusNode());
},
child: DraggableScrollableSheet(
},
child: DraggableScrollableSheet(
initialChildSize: 0.98,
maxChildSize: 0.98,
minChildSize: 0.9,
@ -285,7 +264,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
],
),
SizedBox(
height: spaceBetweenTextFileds,
height: spaceBetweenTextFields,
),
Container(
child: Form(
@ -304,8 +283,8 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
padding: EdgeInsets.all(10),
child: AppTextFormField(
onTap: () {
visbiltyPrescriptionForm = false;
visbiltySearch = true;
visibilityPrescriptionForm = false;
visibilitySearch = true;
},
borderColor: Colors.white,
hintText: TranslationBase.of(context)
@ -323,7 +302,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
height: 15.0,
),
Visibility(
visible: visbiltySearch,
visible: visibilitySearch,
child: Container(
child: Column(
children: [
@ -378,9 +357,9 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
.allMedicationList[
index]
.itemId);
visbiltyPrescriptionForm =
visibilityPrescriptionForm =
true;
visbiltySearch = false;
visibilitySearch = false;
_selectedMedication =
model.allMedicationList[
index];
@ -396,10 +375,10 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
),
),
SizedBox(
height: spaceBetweenTextFileds,
height: spaceBetweenTextFields,
),
Visibility(
visible: visbiltyPrescriptionForm,
visible: visibilityPrescriptionForm,
child: Container(
child: Column(
children: [
@ -424,7 +403,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
SizedBox(width: 18,),
Radio(
activeColor:
Color(0xFFB9382C),
AppGlobal.appRedColor,
value: 1,
groupValue: selectedType,
onChanged: (value) {
@ -540,14 +519,14 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
),
),
SizedBox(
height: spaceBetweenTextFileds),
height: spaceBetweenTextFields),
PrescriptionTextFiled(
elementList:
model.itemMedicineListRoute,
element: model.itemMedicineListRoute
.length ==
1
? model.itemMedicineListRoute[0]
? route = model.itemMedicineListRoute[0]
: route,
elementError: routeError,
keyId: 'parameterCode',
@ -563,45 +542,37 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
.route,
),
SizedBox(
height: spaceBetweenTextFileds),
height: spaceBetweenTextFields),
PrescriptionTextFiled(
hintText:
TranslationBase.of(context)
.frequency,
hintText: TranslationBase.of(context).frequency,
elementError: frequencyError,
element: frequency,
elementList:
model.itemMedicineList,
// element: frequency,
element: model.itemMedicineListRoute
.length ==
1
? frequency = model.itemMedicineListRoute[0]
: frequency,
elementList: model.itemMedicineList,
keyId: 'parameterCode',
keyName: 'description',
okFunction: (selectedValue) {
setState(() {
frequency = selectedValue;
frequency['isDefault'] = true;
if (_selectedMedication !=
null &&
duration != null &&
frequency != null &&
strengthController.text !=
null) {
if (_selectedMedication != null && duration != null && frequency != null && strengthController.text != null) {
model.getBoxQuantity(
freq: frequency[
'parameterCode'],
duration:
duration['id'],
itemCode:
_selectedMedication
.itemId,
strength: double.parse(
strengthController
.text));
freq: frequency['parameterCode'],
duration: duration['id'],
itemCode: _selectedMedication.itemId,
strength: double.parse(strengthController.text)
);
return;
}
});
}),
SizedBox(
height: spaceBetweenTextFileds),
height: spaceBetweenTextFields),
PrescriptionTextFiled(
hintText:
TranslationBase.of(context)
@ -618,7 +589,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
});
}),
SizedBox(
height: spaceBetweenTextFileds),
height: spaceBetweenTextFields),
if (model
.patientAssessmentList.isNotEmpty)
Container(
@ -633,21 +604,19 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
.size
.width *
0.29,
child: TextField(
decoration:
textFieldSelectorDecoration(
child: AppTextFieldCustom(
hintText:
model
.patientAssessmentList[
0]
.icdCode10ID
.toString(),
indication != null
? indication[
'name']
: null,
false),
// indication != null
// ? indication[
// 'name']
// : null,
enabled: true,
readOnly: true,
),
),
Container(
@ -657,57 +626,68 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
.width *
0.57,
color: Colors.white,
child: TextField(
child: AppTextFieldCustom(
maxLines: 5,
decoration:
textFieldSelectorDecoration(
hintText:
model
.patientAssessmentList[
0]
.asciiDesc
.toString(),
indication != null
? indication[
'name']
: null,
false),
// indication != null
// ? indication[
// 'name']
// : null,
enabled: true,
readOnly: true,
),
),
],
),
),
SizedBox(
height: spaceBetweenTextFileds),
height: spaceBetweenTextFields),
Container(
height: screenSize.height * 0.070,
color: Colors.white,
color: Colors.transparent,
child: InkWell(
onTap: () => selectDate(
context, widget.model),
/// TODO Elham* Use customTextFields for all TextFields here
child: TextField(
decoration:
textFieldSelectorDecoration(
TranslationBase.of(
context)
.date,
selectedDate != null
? "${AppDateUtils.convertStringToDateFormat(selectedDate.toString(), "yyyy-MM-dd")}"
: null,
true,
suffixIcon: Icon(
Icons.calendar_today,
color: Colors.black,
)),
child: AppTextFieldCustom(
validationError:
strengthError,
hintText: 'Date',
isTextFieldHasSuffix: true,
suffixIcon: IconButton(
icon: Icon(
Icons.calendar_today,
color: Colors.black,),
),
dropDownText: selectedDate != null
? "${AppDateUtils.convertStringToDateFormat(selectedDate.toString(), "yyyy-MM-dd")}"
: null,
enabled: false,
controller: strengthController,
),
// TextField(
// decoration:
// textFieldSelectorDecoration(
// TranslationBase.of(
// context)
// .date,
// selectedDate != null
// ? "${AppDateUtils.convertStringToDateFormat(selectedDate.toString(), "yyyy-MM-dd")}"
// : null,
// true,
// suffixIcon: Icon(
// Icons.calendar_today,
// color: Colors.black,
// )),
// enabled: false,
// ),
),
),
SizedBox(
height: spaceBetweenTextFileds),
/// TODO Elham* Use customTextFields for all
height: spaceBetweenTextFields),
PrescriptionTextFiled(
element: duration,
elementError: durationError,
@ -746,7 +726,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
},
),
SizedBox(
height: spaceBetweenTextFileds),
height: spaceBetweenTextFields),
Container(
color: Colors.white,
child: AppTextFieldCustom(
@ -758,7 +738,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
),
),
SizedBox(
height: spaceBetweenTextFileds),
height: spaceBetweenTextFields),
Container(
color: Colors.white,
child: AppTextFieldCustom(
@ -773,7 +753,8 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
),
),
SizedBox(
height: spaceBetweenTextFileds),
height: spaceBetweenTextFields
),
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
@ -814,7 +795,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
),
),
SizedBox(
height: spaceBetweenTextFileds),
height: spaceBetweenTextFields),
Container(
margin: EdgeInsets.all(
SizeConfig.widthMultiplier * 5),
@ -1058,49 +1039,48 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
});
}
}
/// TODO Elham* Use it from the textfeild utils
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(0xFFEFEFEF), width: 2.0),
borderRadius: BorderRadius.circular(8),
),
disabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Color(0xFFEFEFEF), width: 2.0),
borderRadius: BorderRadius.circular(8),
),
hintText: selectedText != null ? selectedText : hintText,
suffixIcon: isDropDown
? suffixIcon != null
? suffixIcon
: Icon(
Icons.keyboard_arrow_down_sharp,
color: Color(0xff2E303A),
)
: null,
hintStyle: TextStyle(
fontSize: 13,
color: Color(0xff2E303A),
fontFamily: 'Poppins',
fontWeight: FontWeight.w600,
),
labelText: selectedText != null ? '$hintText\n$selectedText' : null,
labelStyle: TextStyle(
fontSize: 13,
color: Color(0xff2E303A),
fontFamily: 'Poppins',
fontWeight: FontWeight.w600,
),
);
}
// 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(0xFFEFEFEF), width: 2.0),
// borderRadius: BorderRadius.circular(8),
// ),
// disabledBorder: OutlineInputBorder(
// borderSide: BorderSide(color: Color(0xFFEFEFEF), width: 2.0),
// borderRadius: BorderRadius.circular(8),
// ),
// hintText: selectedText != null ? selectedText : hintText,
// suffixIcon: isDropDown
// ? suffixIcon != null
// ? suffixIcon
// : Icon(
// Icons.keyboard_arrow_down_sharp,
// color: Color(0xff2E303A),
// )
// : null,
// hintStyle: TextStyle(
// fontSize: 13,
// color: Color(0xff2E303A),
// fontFamily: 'Poppins',
// fontWeight: FontWeight.w600,
// ),
// labelText: selectedText != null ? '$hintText\n$selectedText' : null,
// labelStyle: TextStyle(
// fontSize: 13,
// color: Color(0xff2E303A),
// fontFamily: 'Poppins',
// fontWeight: FontWeight.w600,
// ),
// );
// }
openDrugToDrug(model) {
openDrugToDrug(MedicineViewModel model) {
showModalBottomSheet(
context: context,
builder: (context) {
@ -1114,7 +1094,9 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
children: [
DrugToDrug(
widget.patient,
getPriscriptionforDrug(widget.prescriptionList, model),
model.getPrescriptionForDrug(
widget.prescriptionList, model
),
model.patientAssessmentList),
Container(
margin: EdgeInsets.all(SizeConfig.widthMultiplier * 3),
@ -1158,57 +1140,53 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
))
],
)),
//],
//)
);
});
}
/// TODO Elham* Move this to view model
getPriscriptionforDrug(
List<PrescriptionModel> prescriptionList, MedicineViewModel model) {
var prescriptionDetails = [];
if (prescriptionList.length > 0) {
prescriptionList[0].entityList.forEach((element) {
if (element.mediSpanGPICode != null) {
prescriptionDetails.add({
'DrugId': element.mediSpanGPICode,
'DrugName': element.medicationName,
'Dose': element.doseDailyQuantity,
'DoseType': element.doseDailyUnitID,
'Unit': element.uom,
'FrequencyType': element.frequencyID,
'Duration': element.doseDurationDays,
'RouteID': element.routeID,
'IsScreen': element.isSIG
});
}
});
}
if (_selectedMedication.mediSpanGPICode != null) {
prescriptionDetails.add({
'DrugId': _selectedMedication.mediSpanGPICode,
'DrugName': _selectedMedication.description,
'Dose': strengthController.text,
'DoseType': model.itemMedicineListUnit.length == 1
? model.itemMedicineListUnit[0]['parameterCode'].toString()
: units['parameterCode'].toString(),
'Unit': model.itemMedicineListUnit.length == 1
? model.itemMedicineListUnit[0]['description']
: units['description'],
'FrequencyType': model.itemMedicineList.length == 1
? model.itemMedicineList[0]['parameterCode'].toString()
: frequency['parameterCode'].toString(),
'Duration': duration['id'].toString(),
'RouteID': model.itemMedicineListRoute.length == 1
? model.itemMedicineListRoute[0]['parameterCode'].toString()
: route['parameterCode'].toString(),
'IsScreen': true
});
}
return prescriptionDetails;
}
// getPrescriptionForDrug(
// List<PrescriptionModel> prescriptionList, MedicineViewModel model) {
// var prescriptionDetails = [];
// if (prescriptionList.length > 0) {
// prescriptionList[0].entityList.forEach((element) {
// if (element.mediSpanGPICode != null) {
// prescriptionDetails.add({
// 'DrugId': element.mediSpanGPICode,
// 'DrugName': element.medicationName,
// 'Dose': element.doseDailyQuantity,
// 'DoseType': element.doseDailyUnitID,
// 'Unit': element.uom,
// 'FrequencyType': element.frequencyID,
// 'Duration': element.doseDurationDays,
// 'RouteID': element.routeID,
// 'IsScreen': element.isSIG
// });
// }
// });
// }
// if (_selectedMedication.mediSpanGPICode != null) {
// prescriptionDetails.add({
// 'DrugId': _selectedMedication.mediSpanGPICode,
// 'DrugName': _selectedMedication.description,
// 'Dose': strengthController.text,
// 'DoseType': model.itemMedicineListUnit.length == 1
// ? model.itemMedicineListUnit[0]['parameterCode'].toString()
// : units['parameterCode'].toString(),
// 'Unit': model.itemMedicineListUnit.length == 1
// ? model.itemMedicineListUnit[0]['description']
// : units['description'],
// 'FrequencyType': model.itemMedicineList.length == 1
// ? model.itemMedicineList[0]['parameterCode'].toString()
// : frequency['parameterCode'].toString(),
// 'Duration': duration['id'].toString(),
// 'RouteID': model.itemMedicineListRoute.length == 1
// ? model.itemMedicineListRoute[0]['parameterCode'].toString()
// : route['parameterCode'].toString(),
// 'IsScreen': true
// });
// }
// return prescriptionDetails;
// }
searchMedicine(context, MedicineViewModel model) async {
FocusScope.of(context).unfocus();

@ -114,8 +114,8 @@ class _PrescriptionCheckOutScreenState
TextEditingController indicationController = TextEditingController();
TextEditingController instructionController = TextEditingController();
bool visbiltyPrescriptionForm = true;
bool visbiltySearch = true;
bool visibilityPrescriptionForm = true;
bool visibilitySearch = true;
final myController = TextEditingController();
DateTime selectedDate;
@ -129,10 +129,10 @@ class _PrescriptionCheckOutScreenState
final searchController = TextEditingController();
stt.SpeechToText speech = stt.SpeechToText();
var event = RobotProvider();
var reconizedWord;
var recognizedWord;
final GlobalKey<FormState> formKey = GlobalKey<FormState>();
final double spaceBetweenTextFileds = 12;
final double spaceBetweenTextFields = 12;
dynamic route;
dynamic frequency;
dynamic duration;
@ -179,7 +179,7 @@ class _PrescriptionCheckOutScreenState
}
void statusListener(String status) {
reconizedWord = status == 'listening' ? 'Lisening...' : 'Sorry....';
recognizedWord = status == 'listening' ? 'Listening...' : 'Sorry....';
}
void requestPermissions() async {
@ -189,14 +189,14 @@ class _PrescriptionCheckOutScreenState
}
void resultListener(result) {
reconizedWord = result.recognizedWords;
event.setValue({"searchText": reconizedWord});
recognizedWord = result.recognizedWords;
event.setValue({"searchText": recognizedWord});
if (result.finalResult == true) {
setState(() {
SpeechToText.closeAlertDialog(context);
speech.stop();
instructionController.text += reconizedWord + '\n';
instructionController.text += recognizedWord + '\n';
});
} else {
print(result.finalResult);
@ -299,7 +299,7 @@ class _PrescriptionCheckOutScreenState
],
),
SizedBox(
height: spaceBetweenTextFileds,
height: spaceBetweenTextFields,
),
Container(
child: Form(
@ -316,10 +316,10 @@ class _PrescriptionCheckOutScreenState
),
),
SizedBox(
height: spaceBetweenTextFileds,
height: spaceBetweenTextFields,
),
Visibility(
visible: visbiltyPrescriptionForm,
visible: visibilityPrescriptionForm,
child: Container(
child: Column(
children: [
@ -337,7 +337,7 @@ class _PrescriptionCheckOutScreenState
fontWeight: FontWeight.w600,
),
Radio(
activeColor: Color(0xFFB9382C),
activeColor: AppGlobal.appRedColor,
value: 1,
groupValue: selectedType,
onChanged: (value) {
@ -349,7 +349,7 @@ class _PrescriptionCheckOutScreenState
],
),
),
SizedBox(height: spaceBetweenTextFileds),
SizedBox(height: spaceBetweenTextFields),
Container(
width: double.infinity,
child: Row(
@ -410,7 +410,7 @@ class _PrescriptionCheckOutScreenState
],
),
),
SizedBox(height: spaceBetweenTextFileds),
SizedBox(height: spaceBetweenTextFields),
PrescriptionTextFiled(
elementList:
model.itemMedicineListRoute,
@ -427,7 +427,7 @@ class _PrescriptionCheckOutScreenState
hintText:
TranslationBase.of(context).route,
),
SizedBox(height: spaceBetweenTextFileds),
SizedBox(height: spaceBetweenTextFields),
PrescriptionTextFiled(
hintText: TranslationBase.of(context)
.frequency,
@ -460,7 +460,7 @@ class _PrescriptionCheckOutScreenState
}
});
}),
SizedBox(height: spaceBetweenTextFileds),
SizedBox(height: spaceBetweenTextFields),
PrescriptionTextFiled(
hintText: TranslationBase.of(context)
.doseTime,
@ -475,7 +475,7 @@ class _PrescriptionCheckOutScreenState
doseTime = selectedValue;
});
}),
SizedBox(height: spaceBetweenTextFileds),
SizedBox(height: spaceBetweenTextFields),
if (model
.patientAssessmentList.isNotEmpty)
Container(
@ -533,7 +533,7 @@ class _PrescriptionCheckOutScreenState
],
),
),
SizedBox(height: spaceBetweenTextFileds),
SizedBox(height: spaceBetweenTextFields),
Container(
height: screenSize.height * 0.070,
color: Colors.white,
@ -556,7 +556,7 @@ class _PrescriptionCheckOutScreenState
),
),
),
SizedBox(height: spaceBetweenTextFileds),
SizedBox(height: spaceBetweenTextFields),
PrescriptionTextFiled(
element: duration,
elementError: durationError,
@ -590,9 +590,9 @@ class _PrescriptionCheckOutScreenState
});
},
),
SizedBox(height: spaceBetweenTextFileds),
SizedBox(height: spaceBetweenTextFileds),
SizedBox(height: spaceBetweenTextFileds),
SizedBox(height: spaceBetweenTextFields),
SizedBox(height: spaceBetweenTextFields),
SizedBox(height: spaceBetweenTextFields),
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
@ -630,7 +630,7 @@ class _PrescriptionCheckOutScreenState
],
),
),
SizedBox(height: spaceBetweenTextFileds),
SizedBox(height: spaceBetweenTextFields),
Container(
margin: EdgeInsets.all(
SizeConfig.widthMultiplier * 5),

@ -1,168 +0,0 @@
import 'package:doctor_app_flutter/core/model/Prescriptions/prescription_report.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class PrescriptionDetailsPage extends StatelessWidget {
final PrescriptionReport prescriptionReport;
PrescriptionDetailsPage({Key key, this.prescriptionReport});
@override
Widget build(BuildContext context) {
return AppScaffold(
isShowAppBar: true,
appBarTitle: TranslationBase.of(context).prescriptions,
body: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Container(
width: double.infinity,
margin: EdgeInsets.only(top: 10, left: 10, right: 10),
padding: EdgeInsets.all(8.0),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(10.0),
),
border: Border.all(color: Colors.grey[200], width: 0.5),
),
child: Row(
children: <Widget>[
ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(5)),
child: Image.network(
prescriptionReport.imageSRCUrl,
fit: BoxFit.cover,
width: 60,
height: 70,
),
),
Expanded(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Center(
child: AppText(
prescriptionReport.itemDescription.isNotEmpty
? prescriptionReport.itemDescription
: prescriptionReport.itemDescriptionN),
),
),
)
],
),
),
Container(
color: Colors.white,
margin: EdgeInsets.only(top: 10, left: 10, right: 10),
child: Table(
border: TableBorder.symmetric(
inside: BorderSide(width: 0.5),
outside: BorderSide(width: 0.5)),
children: [
TableRow(
children: [
Container(
color: Colors.white,
height: 30,
width: double.infinity,
child: Center(
child: AppText(
TranslationBase.of(context).route,
fontSize: 14,
))),
Container(
color: Colors.white,
height: 30,
width: double.infinity,
child: Center(
child: AppText(
TranslationBase.of(context).frequency,
fontSize: 14,
))),
Container(
color: Colors.white,
width: double.infinity,
padding: EdgeInsets.symmetric(horizontal: 4),
child: Center(
child: AppText(
"${TranslationBase.of(context).dailyDoses}",
fontSize: 14,
))),
Container(
color: Colors.white,
height: 30,
width: double.infinity,
child: Center(
child: AppText(
TranslationBase.of(context).duration,
fontSize: 14,
))),
],
),
TableRow(
children: [
Container(
color: Colors.white,
height: 50,
width: double.infinity,
child:
Center(child: Text(prescriptionReport.routeN))),
Container(
color: Colors.white,
height: 50,
width: double.infinity,
child: Center(
child:
Text(prescriptionReport.frequencyN ?? ''))),
Container(
color: Colors.white,
height: 50,
width: double.infinity,
child: Center(
child: Text(
'${prescriptionReport.doseDailyQuantity}'))),
Container(
color: Colors.white,
height: 50,
width: double.infinity,
child:
Center(child: Text('${prescriptionReport.days}')))
],
),
],
),
),
Container(
margin: EdgeInsets.only(top: 10, left: 10, right: 10),
width: double.infinity,
color: Colors.white,
padding: EdgeInsets.all(5),
child: Center(
child: Column(
children: <Widget>[
AppText(TranslationBase.of(context).notes),
SizedBox(
height: 5,
),
Divider(
height: 0.5,
color: Colors.grey[300],
),
SizedBox(
height: 5,
),
AppText(prescriptionReport.remarks ?? ''),
],
),
),
)
],
),
),
);
}
}

@ -51,6 +51,7 @@ class PrescriptionItemsPage extends StatelessWidget {
children: [
if (!prescriptions.isInOutPatient)
...List.generate(
// TODO Elham* List.generate to list.builder
model.prescriptionReportList.length,
(index) => Container(
decoration: BoxDecoration(
@ -204,6 +205,7 @@ class PrescriptionItemsPage extends StatelessWidget {
))
else
...List.generate(
// TODO Elham* List.generate to list.builder
model.prescriptionReportEnhList.length,
(index) => Container(
decoration: BoxDecoration(
@ -211,6 +213,7 @@ class PrescriptionItemsPage extends StatelessWidget {
color: Colors.white,
),
margin: EdgeInsets.all(12),
// TODO Elham* use custom card
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(

@ -1,168 +0,0 @@
import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/app_text_form_field.dart';
import 'package:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart';
void prescriptionWarning(context) {
showModalBottomSheet(
context: context,
isScrollControlled: true,
builder: (BuildContext bc) {
return SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.all(12.0),
child: Container(
height: 600,
child: Column(
children: [
...List.generate(
5,
(index) => Container(
child: ExpansionTile(
title: AppText('Prescription warning and alerts(0)'),
children: [
Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
AppText(
'DOSESCREENINGRESULTFORETCETC',
color: Color(0XFFB8382C),
)
],
)
],
),
),
),
SizedBox(
height: 10.0,
),
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(6.0)),
border:
Border.all(width: 1.0, color: HexColor("#CCCCCC"))),
child: AppTextFormField(
labelText: 'Remarks',
borderColor: Colors.white,
textInputType: TextInputType.number,
inputFormatter: ONLY_NUMBERS,
),
),
SizedBox(
height: 95.0,
),
Container(
margin: EdgeInsets.all(SizeConfig.widthMultiplier * 2),
child: Wrap(
alignment: WrapAlignment.center,
children: <Widget>[
AppButton(
title: 'CONTINUE',
onPressed: () {
Navigator.pop(context);
authorizationForm(context);
},
),
],
),
),
Container(
margin: EdgeInsets.all(SizeConfig.widthMultiplier * 2),
child: Wrap(
alignment: WrapAlignment.center,
children: <Widget>[
AppButton(
color: Colors.white,
title: 'remove',
fontColor: Colors.red,
onPressed: () {
Navigator.pop(context);
prescriptionWarning(context);
},
),
],
),
),
],
),
),
));
});
}
void authorizationForm(context) {
showModalBottomSheet(
context: context,
isScrollControlled: true,
builder: (BuildContext bc) {
return Container(
height: 500,
child: Form(
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 20.0, vertical: 10.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppText(
'Prescription authorization'.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: 'Auth ID',
borderColor: Colors.white,
textInputType: TextInputType.number,
inputFormatter: ONLY_NUMBERS,
),
),
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,
),
),
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);
},
),
],
),
),
],
),
),
));
});
}

@ -101,7 +101,8 @@ class PrescriptionsPage extends StatelessWidget {
label: TranslationBase.of(context)
.applyForNewPrescriptionsOrder,
),
...List.generate(
...List.generate
(
model.prescriptionsList.length,
(index) => InkWell(
onTap: () => Navigator.push(

@ -3,7 +3,7 @@ import 'package:doctor_app_flutter/core/viewModel/prescription_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart';
import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/screens/prescription/add_prescription_form.dart';
import 'package:doctor_app_flutter/screens/prescription/add_prescription/add_prescription_form.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart';

@ -9,6 +9,8 @@ import 'package:eva_icons_flutter/eva_icons_flutter.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../../config/config.dart';
class EntityListCheckboxSearchWidget extends StatefulWidget {
final ProcedureViewModel model;
final Function addSelectedHistories;
@ -229,7 +231,7 @@ class _EntityListCheckboxSearchWidgetState
: Center(
child: Container(
child: AppText("Sorry , No Match",
color: Color(0xFFB9382C)),
color: AppGlobal.appRedColor),
),
)
],

@ -8,6 +8,7 @@ import 'package:eva_icons_flutter/eva_icons_flutter.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../../config/config.dart';
import 'ExpansionProcedure.dart';
class EntityListCheckboxSearchFavProceduresWidget extends StatefulWidget {
@ -125,7 +126,7 @@ class _EntityListCheckboxSearchFavProceduresWidgetState
: Center(
child: Container(
child: AppText("Sorry , No Match",
color: Color(0xFFB9382C)),
color: AppGlobal.appRedColor),
),
)
],

@ -247,7 +247,7 @@ class _UpdateProcedureWidgetState extends State<UpdateProcedureWidget> {
children: [
AppText(TranslationBase.of(context).orderType),
Radio(
activeColor: Color(0xFFB9382C),
activeColor: AppGlobal.appRedColor,
value: 0,
groupValue: selectedType,
onChanged: (value) {
@ -256,7 +256,7 @@ class _UpdateProcedureWidgetState extends State<UpdateProcedureWidget> {
),
Text('routine'),
Radio(
activeColor: Color(0xFFB9382C),
activeColor: AppGlobal.appRedColor,
groupValue: selectedType,
value: 1,
onChanged: (value) {

@ -2,6 +2,8 @@ import 'package:doctor_app_flutter/util/helpers.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:flutter/material.dart';
import '../../../config/config.dart';
class ListSelectDialog extends StatefulWidget {
final List<dynamic> list;
final String attributeName;
@ -104,7 +106,7 @@ class _ListSelectDialogState extends State<ListSelectDialog> {
.selectedValue[widget.attributeValueId]
.toString(),
value: item[widget.attributeValueId].toString(),
activeColor: Color(0xFFB9382C),
activeColor: AppGlobal.appRedColor,
selected: item[widget.attributeValueId]
.toString() ==
widget.selectedValue[widget.attributeValueId]

@ -134,7 +134,7 @@ class _HtmlRichEditorState extends State<HtmlRichEditor> {
}
void statusListener(String status) {
recognizedWord = status == 'listening' ? 'Lisening...' : 'Sorry....';
recognizedWord = status == 'listening' ? 'Listening...' : 'Sorry....';
}
void requestPermissions() async {

Loading…
Cancel
Save