Merge branch 'jan_fix_bugs' into 'development'

plan for refactor prescriptions

See merge request Cloud_Solution/doctor_app_flutter!956
merge-requests/953/merge
Elham Ali 4 years ago
commit 74501dbf07

@ -229,6 +229,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
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;
});
@ -331,7 +332,6 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
child: Wrap(
alignment: WrapAlignment.center,
children: <Widget>[
// TODO change it secondary button and add loading
AppButton(
title: TranslationBase.of(
context)
@ -647,6 +647,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
child: InkWell(
onTap: () => selectDate(
context, widget.model),
/// TODO Elham* Use customTextFields for all TextFields here
child: TextField(
decoration:
textFieldSelectorDecoration(
@ -667,6 +668,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
),
SizedBox(
height: spaceBetweenTextFileds),
/// TODO Elham* Use customTextFields for all
PrescriptionTextFiled(
element: duration,
elementError: durationError,
@ -787,6 +789,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
.addMedication,
fontWeight: FontWeight.w600,
onPressed: () async {
/// TODO Elham* Use it to separate function
await locator<
AnalyticsService>()
.logEvent(
@ -1016,7 +1019,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
});
}
}
/// TODO Elham* Use it from the textfeild utils
InputDecoration textFieldSelectorDecoration(
String hintText, String selectedText, bool isDropDown,
{Icon suffixIcon}) {
@ -1062,6 +1065,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
showModalBottomSheet(
context: context,
builder: (context) {
/// TODO Elham* Move this to widget
return Container(
height: SizeConfig.realScreenHeight * .8,
width: SizeConfig.realScreenWidth,
@ -1122,6 +1126,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
});
}
/// TODO Elham* Move this to view model
getPriscriptionforDrug(
List<PrescriptionModel> prescriptionList, MedicineViewModel model) {
var prescriptionDetails = [];

@ -114,6 +114,9 @@ class _DrugToDrug extends State<DrugToDrug> {
}
getRequestedData() async {
/// TODO Elham* rename model to meaning full not just modle with number
await model.getPatientVitalSign(widget.patient);
await model2.getPatientAllergy(generalGetReqForSOAP);
await model2.getMasterLookup(MasterKeysService.DiagnosisType);

@ -862,6 +862,8 @@ class _PrescriptionCheckOutScreenState
}
}
/// TODO Elham* Use it from the textfeild utils
InputDecoration textFieldSelectorDecoration(
String hintText, String selectedText, bool isDropDown,
{Icon suffixIcon}) {

@ -44,7 +44,7 @@ class _PrescriptionTextFiledState extends State<PrescriptionTextFiled> {
list: widget.elementList,
attributeName: '${widget.keyName}',
attributeValueId: widget.elementList.length == 1
? widget.elementList[0]['${widget.keyId}']
? widget.elementList[0]['${widget.keyId}'].toString()
: '${widget.keyId}',
okText: TranslationBase.of(context).ok,
okFunction: (selectedValue) =>

@ -68,6 +68,7 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
int testNum = 0;
int strengthChar;
PatiantInformtion patient;
/// TODO Elham* add type
dynamic route;
dynamic doseTime;
dynamic frequencyUpdate;
@ -86,6 +87,7 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
strengthController.text = widget.doseStreangth;
remarksController.text = widget.remarks;
indicationList = List();
/// TODO Elham* create model and try to have them form service and add translation
dynamic indication1 = {"id": 545, "name": "Gingival Hyperplasia"};
dynamic indication2 = {"id": 546, "name": "Mild Drowsiness"};
@ -112,6 +114,7 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
indicationList.add(indication9);
indicationList.add(indication10);
}
/// TODO Elham* Add Translation
@override
Widget build(BuildContext context) {
@ -120,6 +123,8 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
(BuildContext context, StateSetter setState /*You can rename this!*/) {
return BaseView<MedicineViewModel>(
onModelReady: (model) async {
/// TODO Elham* Move this to view model and remove unused data
await model.getMedicationList();
await model.getMedicationStrength();
await model.getMedicationDuration();
@ -172,78 +177,6 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
),
Column(
children: [
// Container(
// height: MediaQuery.of(context).size.height *
// 0.070,
// child: InkWell(
// onTap: model.allMedicationList != null
// ? () {
// setState(() {
// newSelectedMedication = null;
// });
// }
// : null,
// child: newSelectedMedication == null
// ? AutoCompleteTextField<
// GetMedicationResponseModel>(
// decoration:
// textFieldSelectorDecoration(
// widget.drugNameGeneric,
// newSelectedMedication != null
// ? newSelectedMedication
// .genericName
// : null,
// true,
// ),
// itemSubmitted: (item) => setState(
// () => newSelectedMedication =
// item),
// key: key,
// suggestions:
// model.allMedicationList,
// itemBuilder: (context,
// suggestion) =>
// new Padding(
// child: AppText(suggestion
// .description +
// '/' +
// suggestion.genericName),
// padding:
// EdgeInsets.all(8.0)),
// itemSorter: (a, b) => 1,
// itemFilter: (suggestion, input) =>
// suggestion.genericName
// .toLowerCase()
// .startsWith(
// input.toLowerCase()) ||
// suggestion.description
// .toLowerCase()
// .startsWith(
// input.toLowerCase()) ||
// suggestion.keywords
// .toLowerCase()
// .startsWith(
// input.toLowerCase()),
// )
// : TextField(
// decoration:
// textFieldSelectorDecoration(
// TranslationBase.of(context)
// .searchMedicineNameHere,
// newSelectedMedication != null
// ? newSelectedMedication
// .description +
// ('${newSelectedMedication.genericName}')
// : null,
// true,
// ),
// enabled: false,
// ),
// ),
// ),
// SizedBox(
// height: 12,
// ),
Container(
height:
MediaQuery.of(context).size.height *
@ -284,15 +217,6 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
"Only 5 Digits allowed for strength");
}
},
// validator: (value) {
// if (value.isEmpty &&
// strengthController.text.length >
// 4)
// return TranslationBase.of(context)
// .emptyMessage;
// else
// return null;
// },
),
),
SizedBox(
@ -805,6 +729,9 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
title: 'update prescription'
.toUpperCase(),
onPressed: () {
/// TODO Elham* Move this to function
if (double.parse(
strengthController.text) >
1000.0) {
@ -912,7 +839,7 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
});
}
}
// /// TODO Elham* Use it from the textfeild utils
InputDecoration textFieldSelectorDecoration(
String hintText, String selectedText, bool isDropDown,
{Icon suffixIcon}) {
@ -945,6 +872,7 @@ class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
);
}
/// TODO Elham* Move this to view model and pass all data as model
updatePrescription(
{PrescriptionViewModel model,
int drugId,
@ -1030,6 +958,9 @@ void updatePrescriptionForm(
String uom,
int box,
String startDate}) {
/// TODO Elham* remove unused code.
TextEditingController remarksController = TextEditingController();
TextEditingController doseController = TextEditingController();
TextEditingController frequencyController = TextEditingController();

Loading…
Cancel
Save