|
|
|
|
@ -37,64 +37,58 @@ import 'package:provider/provider.dart';
|
|
|
|
|
import 'package:speech_to_text/speech_recognition_error.dart';
|
|
|
|
|
import 'package:speech_to_text/speech_to_text.dart' as stt;
|
|
|
|
|
|
|
|
|
|
addPrescriptionForm(context, PrescriptionViewModel model,
|
|
|
|
|
PatiantInformtion patient, prescription) {
|
|
|
|
|
showModalBottomSheet(
|
|
|
|
|
isScrollControlled: true,
|
|
|
|
|
context: context,
|
|
|
|
|
builder: (BuildContext bc) {
|
|
|
|
|
return PrescriptionFormWidget(model, patient, prescription);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
postPrescription(
|
|
|
|
|
{String duration,
|
|
|
|
|
String doseTimeIn,
|
|
|
|
|
String dose,
|
|
|
|
|
String drugId,
|
|
|
|
|
String strength,
|
|
|
|
|
String route,
|
|
|
|
|
String frequency,
|
|
|
|
|
String indication,
|
|
|
|
|
String instruction,
|
|
|
|
|
PrescriptionViewModel model,
|
|
|
|
|
DateTime doseTime,
|
|
|
|
|
String doseUnit,
|
|
|
|
|
String icdCode,
|
|
|
|
|
PatiantInformtion patient,
|
|
|
|
|
String patientType}) async {
|
|
|
|
|
PostPrescriptionReqModel postProcedureReqModel =
|
|
|
|
|
new PostPrescriptionReqModel();
|
|
|
|
|
List<PrescriptionRequestModel> prescriptionList = List();
|
|
|
|
|
|
|
|
|
|
postProcedureReqModel.appointmentNo = patient.appointmentNo;
|
|
|
|
|
postProcedureReqModel.clinicID = patient.clinicId;
|
|
|
|
|
postProcedureReqModel.episodeID = patient.episodeNo;
|
|
|
|
|
postProcedureReqModel.patientMRN = patient.patientMRN;
|
|
|
|
|
|
|
|
|
|
prescriptionList.add(PrescriptionRequestModel(
|
|
|
|
|
covered: true,
|
|
|
|
|
dose: double.parse(dose),
|
|
|
|
|
itemId: drugId.isEmpty ? 1 : int.parse(drugId),
|
|
|
|
|
doseUnitId: int.parse(doseUnit),
|
|
|
|
|
route: route.isEmpty ? 1 : int.parse(route),
|
|
|
|
|
frequency: frequency.isEmpty ? 1 : int.parse(frequency),
|
|
|
|
|
remarks: instruction,
|
|
|
|
|
approvalRequired: true,
|
|
|
|
|
icdcode10Id: icdCode.toString(),
|
|
|
|
|
doseTime: doseTimeIn.isEmpty ? 1 : int.parse(doseTimeIn),
|
|
|
|
|
duration: duration.isEmpty ? 1 : int.parse(duration),
|
|
|
|
|
doseStartDate: doseTime.toIso8601String()));
|
|
|
|
|
postProcedureReqModel.prescriptionRequestModel = prescriptionList;
|
|
|
|
|
await model.postPrescription(postProcedureReqModel, patient.patientMRN);
|
|
|
|
|
|
|
|
|
|
if (model.state == ViewState.ErrorLocal) {
|
|
|
|
|
Helpers.showErrorToast(model.error);
|
|
|
|
|
} else if (model.state == ViewState.Idle) {
|
|
|
|
|
model.getPrescriptions(patient);
|
|
|
|
|
DrAppToastMsg.showSuccesToast('Medication has been added');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
import 'add_drug_widget.dart';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// postPrescription(
|
|
|
|
|
// {String duration,
|
|
|
|
|
// String doseTimeIn,
|
|
|
|
|
// String dose,
|
|
|
|
|
// String drugId,
|
|
|
|
|
// String strength,
|
|
|
|
|
// String route,
|
|
|
|
|
// String frequency,
|
|
|
|
|
// String indication,
|
|
|
|
|
// String instruction,
|
|
|
|
|
// PrescriptionViewModel model,
|
|
|
|
|
// DateTime doseTime,
|
|
|
|
|
// String doseUnit,
|
|
|
|
|
// String icdCode,
|
|
|
|
|
// PatiantInformtion patient,
|
|
|
|
|
// String patientType}) async {
|
|
|
|
|
// PostPrescriptionReqModel postProcedureReqModel =
|
|
|
|
|
// new PostPrescriptionReqModel();
|
|
|
|
|
// List<PrescriptionRequestModel> prescriptionList = List();
|
|
|
|
|
//
|
|
|
|
|
// postProcedureReqModel.appointmentNo = patient.appointmentNo;
|
|
|
|
|
// postProcedureReqModel.clinicID = patient.clinicId;
|
|
|
|
|
// postProcedureReqModel.episodeID = patient.episodeNo;
|
|
|
|
|
// postProcedureReqModel.patientMRN = patient.patientMRN;
|
|
|
|
|
//
|
|
|
|
|
// prescriptionList.add(PrescriptionRequestModel(
|
|
|
|
|
// covered: true,
|
|
|
|
|
// dose: double.parse(dose),
|
|
|
|
|
// itemId: drugId.isEmpty ? 1 : int.parse(drugId),
|
|
|
|
|
// doseUnitId: int.parse(doseUnit),
|
|
|
|
|
// route: route.isEmpty ? 1 : int.parse(route),
|
|
|
|
|
// frequency: frequency.isEmpty ? 1 : int.parse(frequency),
|
|
|
|
|
// remarks: instruction,
|
|
|
|
|
// approvalRequired: true,
|
|
|
|
|
// icdcode10Id: icdCode.toString(),
|
|
|
|
|
// doseTime: doseTimeIn.isEmpty ? 1 : int.parse(doseTimeIn),
|
|
|
|
|
// duration: duration.isEmpty ? 1 : int.parse(duration),
|
|
|
|
|
// doseStartDate: doseTime.toIso8601String()));
|
|
|
|
|
// postProcedureReqModel.prescriptionRequestModel = prescriptionList;
|
|
|
|
|
// await model.postPrescription(postProcedureReqModel, patient.patientMRN);
|
|
|
|
|
//
|
|
|
|
|
// if (model.state == ViewState.ErrorLocal) {
|
|
|
|
|
// Helpers.showErrorToast(model.error);
|
|
|
|
|
// } else if (model.state == ViewState.Idle) {
|
|
|
|
|
// model.getPrescriptions(patient);
|
|
|
|
|
// DrAppToastMsg.showSuccesToast('Medication has been added');
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
class PrescriptionFormWidget extends StatefulWidget {
|
|
|
|
|
final PrescriptionViewModel model;
|
|
|
|
|
@ -196,6 +190,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
|
recognizedWord = status == 'listening' ? 'Listening...' : 'Sorry....';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// void requestPermissions() async {
|
|
|
|
|
// void requestPermissions() async {
|
|
|
|
|
// Map<Permission, PermissionStatus> statuses = await [
|
|
|
|
|
// Permission.microphone,
|
|
|
|
|
@ -234,6 +229,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
|
builder: (
|
|
|
|
|
BuildContext context,
|
|
|
|
|
MedicineViewModel model,
|
|
|
|
|
|
|
|
|
|
Widget child,) =>
|
|
|
|
|
NetworkBaseView(
|
|
|
|
|
baseViewModel: model,
|
|
|
|
|
@ -858,89 +854,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
|
if (formKey.currentState
|
|
|
|
|
.validate()) {
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
openDrugToDrug(model);
|
|
|
|
|
{
|
|
|
|
|
// postProcedure(
|
|
|
|
|
// icdCode: model
|
|
|
|
|
// .patientAssessmentList
|
|
|
|
|
// .isNotEmpty
|
|
|
|
|
// ? model
|
|
|
|
|
// .patientAssessmentList[
|
|
|
|
|
// 0]
|
|
|
|
|
// .icdCode10ID
|
|
|
|
|
// .isEmpty
|
|
|
|
|
// ? "test"
|
|
|
|
|
// : model
|
|
|
|
|
// .patientAssessmentList[
|
|
|
|
|
// 0]
|
|
|
|
|
// .icdCode10ID
|
|
|
|
|
// .toString()
|
|
|
|
|
// : "test",
|
|
|
|
|
// // icdCode: model
|
|
|
|
|
// // .patientAssessmentList
|
|
|
|
|
// // .map((value) => value
|
|
|
|
|
// // .icdCode10ID
|
|
|
|
|
// // .trim())
|
|
|
|
|
// // .toList()
|
|
|
|
|
// // .join(' '),
|
|
|
|
|
// 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,
|
|
|
|
|
// );
|
|
|
|
|
}
|
|
|
|
|
openDrugToDrug(model, widget.model);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
setState(() {
|
|
|
|
|
@ -996,7 +910,6 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
formKey.currentState.save();
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
@ -1039,154 +952,20 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// 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(MedicineViewModel model) {
|
|
|
|
|
openDrugToDrug(MedicineViewModel model, PrescriptionViewModel modelPrescription) {
|
|
|
|
|
showModalBottomSheet(
|
|
|
|
|
context: context,
|
|
|
|
|
builder: (context) {
|
|
|
|
|
/// TODO Elham* Move this to widget
|
|
|
|
|
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,
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
))
|
|
|
|
|
],
|
|
|
|
|
)),
|
|
|
|
|
return AddDrugWidget(
|
|
|
|
|
patient: widget.patient,
|
|
|
|
|
medicineModel: model,
|
|
|
|
|
modelPrescription: modelPrescription,
|
|
|
|
|
prescriptionList: widget.prescriptionList,
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 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();
|
|
|
|
|
|