Refactor add_prescription_form
parent
7afe24c2bc
commit
f769189bee
@ -0,0 +1,110 @@
|
||||
import 'package:doctor_app_flutter/config/size_config.dart';
|
||||
import 'package:doctor_app_flutter/core/viewModel/medicine_view_model.dart';
|
||||
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import '../../../core/model/Prescriptions/prescription_model.dart';
|
||||
import '../../../core/model/patient/patiant_info_model.dart';
|
||||
import '../../../core/model/search_drug/get_medication_response_model.dart';
|
||||
import '../../../core/viewModel/prescription_view_model.dart';
|
||||
import '../../../widgets/shared/buttons/app_buttons_widget.dart';
|
||||
import 'add_prescription_form.dart';
|
||||
import 'drugtodrug.dart';
|
||||
|
||||
class AddDrugWidget extends StatefulWidget {
|
||||
final PatiantInformtion patient;
|
||||
final List<PrescriptionModel> prescriptionList;
|
||||
final PrescriptionViewModel model;
|
||||
|
||||
|
||||
const AddDrugWidget({Key key, this.patient, this.prescriptionList, this.model}) : super(key: key);
|
||||
|
||||
@override
|
||||
_AddDrugWidgetState createState() => _AddDrugWidgetState();
|
||||
}
|
||||
|
||||
class _AddDrugWidgetState extends State<AddDrugWidget> {
|
||||
|
||||
TextEditingController strengthController = TextEditingController();
|
||||
dynamic route;
|
||||
dynamic frequency;
|
||||
dynamic duration;
|
||||
dynamic doseTime;
|
||||
dynamic indication;
|
||||
dynamic units;
|
||||
dynamic uom;
|
||||
dynamic box;
|
||||
dynamic x;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
MedicineViewModel model;
|
||||
GetMedicationResponseModel _selectedMedication;
|
||||
TextEditingController indicationController = TextEditingController();
|
||||
TextEditingController instructionController = TextEditingController();
|
||||
DateTime selectedDate;
|
||||
|
||||
return Container(
|
||||
height: SizeConfig.realScreenHeight * .8,
|
||||
width: SizeConfig.realScreenWidth,
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
DrugToDrug(
|
||||
widget.patient,
|
||||
model.getPrescriptionForDrug(
|
||||
widget.prescriptionList, model
|
||||
),
|
||||
model.patientAssessmentList),
|
||||
Container(
|
||||
margin: EdgeInsets.all(SizeConfig.widthMultiplier * 3),
|
||||
child: AppButton(
|
||||
title: TranslationBase.of(context).addMedication,
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
|
||||
postPrescription(
|
||||
icdCode: model.patientAssessmentList.isNotEmpty
|
||||
? model.patientAssessmentList[0].icdCode10ID
|
||||
.isEmpty
|
||||
? "test"
|
||||
: model.patientAssessmentList[0].icdCode10ID
|
||||
.toString()
|
||||
: "test",
|
||||
dose: strengthController.text,
|
||||
doseUnit: model.itemMedicineListUnit.length == 1
|
||||
? model.itemMedicineListUnit[0]['parameterCode']
|
||||
.toString()
|
||||
: units['parameterCode'].toString(),
|
||||
patient: widget.patient,
|
||||
doseTimeIn: doseTime['id'].toString(),
|
||||
model: widget.model,
|
||||
duration: duration['id'].toString(),
|
||||
frequency: model.itemMedicineList.length == 1
|
||||
? model.itemMedicineList[0]['parameterCode']
|
||||
.toString()
|
||||
: frequency['parameterCode'].toString(),
|
||||
route: model.itemMedicineListRoute.length == 1
|
||||
? model.itemMedicineListRoute[0]['parameterCode']
|
||||
.toString()
|
||||
: route['parameterCode'].toString(),
|
||||
drugId: _selectedMedication.itemId.toString(),
|
||||
strength: strengthController.text,
|
||||
indication: indicationController.text,
|
||||
instruction: instructionController.text,
|
||||
doseTime: selectedDate,
|
||||
);
|
||||
},
|
||||
))
|
||||
],
|
||||
)),
|
||||
|
||||
//],
|
||||
//)
|
||||
);
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue