|
|
|
|
@ -32,12 +32,12 @@ import 'package:speech_to_text/speech_recognition_error.dart';
|
|
|
|
|
import 'package:speech_to_text/speech_to_text.dart' as stt;
|
|
|
|
|
|
|
|
|
|
class PrescriptionCheckOutScreen extends StatefulWidget {
|
|
|
|
|
final PrescriptionViewModel model;
|
|
|
|
|
final PatiantInformtion patient;
|
|
|
|
|
final List<PrescriptionModel> prescriptionList;
|
|
|
|
|
final ProcedureTempleteDetailsModel groupProcedures;
|
|
|
|
|
final PrescriptionViewModel? model;
|
|
|
|
|
final PatiantInformtion? patient;
|
|
|
|
|
final List<PrescriptionModel>? prescriptionList;
|
|
|
|
|
final ProcedureTempleteDetailsModel? groupProcedures;
|
|
|
|
|
|
|
|
|
|
const PrescriptionCheckOutScreen({Key ? key, this.model, this.patient, this.prescriptionList, this.groupProcedures})
|
|
|
|
|
const PrescriptionCheckOutScreen({Key? key, this.model, this.patient, this.prescriptionList, this.groupProcedures})
|
|
|
|
|
: super(key: key);
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
@ -46,44 +46,44 @@ class PrescriptionCheckOutScreen extends StatefulWidget {
|
|
|
|
|
|
|
|
|
|
class _PrescriptionCheckOutScreenState extends State<PrescriptionCheckOutScreen> {
|
|
|
|
|
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 {
|
|
|
|
|
{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 = [];
|
|
|
|
|
|
|
|
|
|
postProcedureReqModel.appointmentNo = patient.appointmentNo;
|
|
|
|
|
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),
|
|
|
|
|
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()));
|
|
|
|
|
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);
|
|
|
|
|
await model!.postPrescription(postProcedureReqModel, patient.patientMRN!);
|
|
|
|
|
|
|
|
|
|
if (model.state == ViewState.ErrorLocal) {
|
|
|
|
|
Helpers.showErrorToast(model.error);
|
|
|
|
|
@ -93,14 +93,14 @@ class _PrescriptionCheckOutScreenState extends State<PrescriptionCheckOutScreen>
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String routeError;
|
|
|
|
|
String frequencyError;
|
|
|
|
|
String doseTimeError;
|
|
|
|
|
String durationError;
|
|
|
|
|
String unitError;
|
|
|
|
|
String strengthError;
|
|
|
|
|
String? routeError;
|
|
|
|
|
String? frequencyError;
|
|
|
|
|
String? doseTimeError;
|
|
|
|
|
String? durationError;
|
|
|
|
|
String? unitError;
|
|
|
|
|
String? strengthError;
|
|
|
|
|
|
|
|
|
|
int selectedType;
|
|
|
|
|
late int selectedType;
|
|
|
|
|
|
|
|
|
|
TextEditingController strengthController = TextEditingController();
|
|
|
|
|
TextEditingController indicationController = TextEditingController();
|
|
|
|
|
@ -110,10 +110,10 @@ class _PrescriptionCheckOutScreenState extends State<PrescriptionCheckOutScreen>
|
|
|
|
|
bool visbiltySearch = true;
|
|
|
|
|
|
|
|
|
|
final myController = TextEditingController();
|
|
|
|
|
DateTime selectedDate;
|
|
|
|
|
int strengthChar;
|
|
|
|
|
GetMedicationResponseModel _selectedMedication;
|
|
|
|
|
GlobalKey key = new GlobalKey<AutoCompleteTextFieldState<GetMedicationResponseModel>>();
|
|
|
|
|
late DateTime selectedDate;
|
|
|
|
|
late int strengthChar;
|
|
|
|
|
late GetMedicationResponseModel _selectedMedication;
|
|
|
|
|
late GlobalKey key = new GlobalKey<AutoCompleteTextFieldState<GetMedicationResponseModel>>();
|
|
|
|
|
|
|
|
|
|
TextEditingController drugIdController = TextEditingController();
|
|
|
|
|
TextEditingController doseController = TextEditingController();
|
|
|
|
|
@ -210,17 +210,17 @@ class _PrescriptionCheckOutScreenState extends State<PrescriptionCheckOutScreen>
|
|
|
|
|
final screenSize = MediaQuery.of(context).size;
|
|
|
|
|
return BaseView<MedicineViewModel>(
|
|
|
|
|
onModelReady: (model) async {
|
|
|
|
|
model.getItem(itemID: int.parse(widget.groupProcedures.aliasN.replaceAll("item code ;", "")));
|
|
|
|
|
model.getItem(itemID: int.parse(widget.groupProcedures!.aliasN!.replaceAll("item code ;", "")));
|
|
|
|
|
|
|
|
|
|
x = model.patientAssessmentList.map((element) {
|
|
|
|
|
return element.icdCode10ID;
|
|
|
|
|
});
|
|
|
|
|
GetAssessmentReqModel getAssessmentReqModel = GetAssessmentReqModel(
|
|
|
|
|
patientMRN: widget.patient.patientMRN,
|
|
|
|
|
episodeID: widget.patient.episodeNo.toString(),
|
|
|
|
|
patientMRN: widget.patient!.patientMRN,
|
|
|
|
|
episodeID: widget.patient!.episodeNo.toString(),
|
|
|
|
|
editedBy: '',
|
|
|
|
|
doctorID: '',
|
|
|
|
|
appointmentNo: widget.patient.appointmentNo);
|
|
|
|
|
appointmentNo: widget.patient!.appointmentNo);
|
|
|
|
|
if (model.medicationStrengthList.length == 0) {
|
|
|
|
|
await model.getMedicationStrength();
|
|
|
|
|
}
|
|
|
|
|
@ -235,7 +235,7 @@ class _PrescriptionCheckOutScreenState extends State<PrescriptionCheckOutScreen>
|
|
|
|
|
builder: (
|
|
|
|
|
BuildContext context,
|
|
|
|
|
MedicineViewModel model,
|
|
|
|
|
Widget child,
|
|
|
|
|
Widget? child,
|
|
|
|
|
) =>
|
|
|
|
|
AppScaffold(
|
|
|
|
|
backgroundColor: Color(0xffF8F8F8).withOpacity(0.9),
|
|
|
|
|
@ -309,7 +309,7 @@ class _PrescriptionCheckOutScreenState extends State<PrescriptionCheckOutScreen>
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
AppText(
|
|
|
|
|
widget.groupProcedures.procedureName ?? "",
|
|
|
|
|
widget.groupProcedures!.procedureName ?? "",
|
|
|
|
|
bold: true,
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
@ -323,11 +323,11 @@ class _PrescriptionCheckOutScreenState extends State<PrescriptionCheckOutScreen>
|
|
|
|
|
activeColor: Color(0xFFB9382C),
|
|
|
|
|
value: 1,
|
|
|
|
|
groupValue: selectedType,
|
|
|
|
|
onChanged: (value) {
|
|
|
|
|
setSelectedType(value);
|
|
|
|
|
onChanged: (int? value) {
|
|
|
|
|
setSelectedType(value!);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
Text(TranslationBase.of(context).regular),
|
|
|
|
|
Text(TranslationBase.of(context).regular!),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
@ -366,7 +366,7 @@ class _PrescriptionCheckOutScreenState extends State<PrescriptionCheckOutScreen>
|
|
|
|
|
PrescriptionTextFiled(
|
|
|
|
|
width: MediaQuery.of(context).size.width * 0.560,
|
|
|
|
|
element: units,
|
|
|
|
|
elementError: unitError,
|
|
|
|
|
elementError: unitError ?? "",
|
|
|
|
|
keyName: 'description',
|
|
|
|
|
keyId: 'parameterCode',
|
|
|
|
|
hintText: 'Select',
|
|
|
|
|
@ -385,7 +385,7 @@ class _PrescriptionCheckOutScreenState extends State<PrescriptionCheckOutScreen>
|
|
|
|
|
PrescriptionTextFiled(
|
|
|
|
|
elementList: model.itemMedicineListRoute,
|
|
|
|
|
element: route,
|
|
|
|
|
elementError: routeError,
|
|
|
|
|
elementError: routeError ?? "",
|
|
|
|
|
keyId: 'parameterCode',
|
|
|
|
|
keyName: 'description',
|
|
|
|
|
okFunction: (selectedValue) {
|
|
|
|
|
@ -394,12 +394,12 @@ class _PrescriptionCheckOutScreenState extends State<PrescriptionCheckOutScreen>
|
|
|
|
|
route['isDefault'] = true;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
hintText: TranslationBase.of(context).route,
|
|
|
|
|
hintText: TranslationBase.of(context).route!,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: spaceBetweenTextFileds),
|
|
|
|
|
PrescriptionTextFiled(
|
|
|
|
|
hintText: TranslationBase.of(context).frequency,
|
|
|
|
|
elementError: frequencyError,
|
|
|
|
|
hintText: TranslationBase.of(context).frequency!,
|
|
|
|
|
elementError: frequencyError ?? "",
|
|
|
|
|
element: frequency,
|
|
|
|
|
elementList: model.itemMedicineList,
|
|
|
|
|
keyId: 'parameterCode',
|
|
|
|
|
@ -415,7 +415,7 @@ class _PrescriptionCheckOutScreenState extends State<PrescriptionCheckOutScreen>
|
|
|
|
|
model.getBoxQuantity(
|
|
|
|
|
freq: frequency['parameterCode'],
|
|
|
|
|
duration: duration['id'],
|
|
|
|
|
itemCode: _selectedMedication.itemId,
|
|
|
|
|
itemCode: _selectedMedication.itemId!,
|
|
|
|
|
strength: double.parse(strengthController.text));
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
@ -424,8 +424,8 @@ class _PrescriptionCheckOutScreenState extends State<PrescriptionCheckOutScreen>
|
|
|
|
|
}),
|
|
|
|
|
SizedBox(height: spaceBetweenTextFileds),
|
|
|
|
|
PrescriptionTextFiled(
|
|
|
|
|
hintText: TranslationBase.of(context).doseTime,
|
|
|
|
|
elementError: doseTimeError,
|
|
|
|
|
hintText: TranslationBase.of(context).doseTime! ?? "",
|
|
|
|
|
elementError: doseTimeError!,
|
|
|
|
|
element: doseTime,
|
|
|
|
|
elementList: model.medicationDoseTimeList,
|
|
|
|
|
keyId: 'id',
|
|
|
|
|
@ -475,13 +475,13 @@ class _PrescriptionCheckOutScreenState extends State<PrescriptionCheckOutScreen>
|
|
|
|
|
height: screenSize.height * 0.070,
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
child: InkWell(
|
|
|
|
|
onTap: () => selectDate(context, widget.model),
|
|
|
|
|
onTap: () => selectDate(context, widget.model!),
|
|
|
|
|
child: TextField(
|
|
|
|
|
decoration: textFieldSelectorDecoration(
|
|
|
|
|
TranslationBase.of(context).date,
|
|
|
|
|
TranslationBase.of(context).date!,
|
|
|
|
|
selectedDate != null
|
|
|
|
|
? "${AppDateUtils.convertStringToDateFormat(selectedDate.toString(), "yyyy-MM-dd")}"
|
|
|
|
|
: null,
|
|
|
|
|
: '',
|
|
|
|
|
true,
|
|
|
|
|
suffixIcon: Icon(
|
|
|
|
|
Icons.calendar_today,
|
|
|
|
|
@ -494,8 +494,8 @@ class _PrescriptionCheckOutScreenState extends State<PrescriptionCheckOutScreen>
|
|
|
|
|
SizedBox(height: spaceBetweenTextFileds),
|
|
|
|
|
PrescriptionTextFiled(
|
|
|
|
|
element: duration,
|
|
|
|
|
elementError: durationError,
|
|
|
|
|
hintText: TranslationBase.of(context).duration,
|
|
|
|
|
elementError: durationError ?? "",
|
|
|
|
|
hintText: TranslationBase.of(context).duration!,
|
|
|
|
|
elementList: model.medicationDurationList,
|
|
|
|
|
keyName: 'nameEn',
|
|
|
|
|
keyId: 'id',
|
|
|
|
|
@ -509,7 +509,7 @@ class _PrescriptionCheckOutScreenState extends State<PrescriptionCheckOutScreen>
|
|
|
|
|
model.getBoxQuantity(
|
|
|
|
|
freq: frequency['parameterCode'],
|
|
|
|
|
duration: duration['id'],
|
|
|
|
|
itemCode: _selectedMedication.itemId,
|
|
|
|
|
itemCode: _selectedMedication.itemId!,
|
|
|
|
|
strength: double.parse(strengthController.text),
|
|
|
|
|
);
|
|
|
|
|
box = model.boxQuintity;
|
|
|
|
|
@ -531,7 +531,7 @@ class _PrescriptionCheckOutScreenState extends State<PrescriptionCheckOutScreen>
|
|
|
|
|
TextFields(
|
|
|
|
|
maxLines: 6,
|
|
|
|
|
minLines: 4,
|
|
|
|
|
hintText: TranslationBase.of(context).instruction,
|
|
|
|
|
hintText: TranslationBase.of(context).instruction!,
|
|
|
|
|
controller: instructionController,
|
|
|
|
|
//keyboardType: TextInputType.number,
|
|
|
|
|
),
|
|
|
|
|
@ -586,13 +586,13 @@ class _PrescriptionCheckOutScreenState extends State<PrescriptionCheckOutScreen>
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (formKey.currentState.validate()) {
|
|
|
|
|
if (formKey.currentState!.validate()) {
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
// openDrugToDrug(model);
|
|
|
|
|
{
|
|
|
|
|
postPrescription(
|
|
|
|
|
icdCode: model.patientAssessmentList.isNotEmpty
|
|
|
|
|
? model.patientAssessmentList[0].icdCode10ID.isEmpty
|
|
|
|
|
? model.patientAssessmentList[0].icdCode10ID!.isEmpty
|
|
|
|
|
? "test"
|
|
|
|
|
: model.patientAssessmentList[0].icdCode10ID.toString()
|
|
|
|
|
: "test",
|
|
|
|
|
@ -607,9 +607,9 @@ class _PrescriptionCheckOutScreenState extends State<PrescriptionCheckOutScreen>
|
|
|
|
|
doseUnit: model.itemMedicineListUnit.length == 1
|
|
|
|
|
? model.itemMedicineListUnit[0]['parameterCode'].toString()
|
|
|
|
|
: units['parameterCode'].toString(),
|
|
|
|
|
patient: widget.patient,
|
|
|
|
|
patient: widget.patient!,
|
|
|
|
|
doseTimeIn: doseTime['id'].toString(),
|
|
|
|
|
model: widget.model,
|
|
|
|
|
model: widget.model!,
|
|
|
|
|
duration: duration['id'].toString(),
|
|
|
|
|
frequency: model.itemMedicineList.length == 1
|
|
|
|
|
? model.itemMedicineList[0]['parameterCode'].toString()
|
|
|
|
|
@ -617,8 +617,8 @@ class _PrescriptionCheckOutScreenState extends State<PrescriptionCheckOutScreen>
|
|
|
|
|
route: model.itemMedicineListRoute.length == 1
|
|
|
|
|
? model.itemMedicineListRoute[0]['parameterCode'].toString()
|
|
|
|
|
: route['parameterCode'].toString(),
|
|
|
|
|
drugId: (widget.groupProcedures.aliasN
|
|
|
|
|
.replaceAll("item code ;", "")),
|
|
|
|
|
drugId: (widget.groupProcedures!.aliasN!
|
|
|
|
|
.replaceAll!("item code ;", "")),
|
|
|
|
|
strength: strengthController.text,
|
|
|
|
|
indication: indicationController.text,
|
|
|
|
|
instruction: instructionController.text,
|
|
|
|
|
@ -649,19 +649,19 @@ class _PrescriptionCheckOutScreenState extends State<PrescriptionCheckOutScreen>
|
|
|
|
|
frequencyError = null;
|
|
|
|
|
}
|
|
|
|
|
if (units == null) {
|
|
|
|
|
unitError = TranslationBase.of(context).fieldRequired;
|
|
|
|
|
unitError = TranslationBase.of(context).fieldRequired!;
|
|
|
|
|
} else {
|
|
|
|
|
unitError = null;
|
|
|
|
|
}
|
|
|
|
|
if (strengthController.text == "") {
|
|
|
|
|
strengthError = TranslationBase.of(context).fieldRequired;
|
|
|
|
|
strengthError = TranslationBase.of(context).fieldRequired!;
|
|
|
|
|
} else {
|
|
|
|
|
strengthError = null;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
formKey.currentState.save();
|
|
|
|
|
formKey.currentState!.save();
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
@ -690,12 +690,12 @@ class _PrescriptionCheckOutScreenState extends State<PrescriptionCheckOutScreen>
|
|
|
|
|
Helpers.hideKeyboard(context);
|
|
|
|
|
DateTime selectedDate;
|
|
|
|
|
selectedDate = DateTime.now();
|
|
|
|
|
final DateTime picked = await showDatePicker(
|
|
|
|
|
final DateTime? picked = await showDatePicker(
|
|
|
|
|
context: context,
|
|
|
|
|
initialDate: selectedDate,
|
|
|
|
|
firstDate: DateTime.now(),
|
|
|
|
|
lastDate: DateTime(2040),
|
|
|
|
|
initialEntryMode: DatePickerEntryMode.calendar,
|
|
|
|
|
initialEntryMode: DatePickerEntryMode.calendar!,
|
|
|
|
|
);
|
|
|
|
|
if (picked != null && picked != selectedDate) {
|
|
|
|
|
setState(() {
|
|
|
|
|
@ -704,8 +704,8 @@ class _PrescriptionCheckOutScreenState extends State<PrescriptionCheckOutScreen>
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
InputDecoration textFieldSelectorDecoration(String hintText, String selectedText, bool isDropDown,
|
|
|
|
|
{Icon suffixIcon}) {
|
|
|
|
|
InputDecoration textFieldSelectorDecoration(String hintText, String? selectedText, bool isDropDown,
|
|
|
|
|
{Icon? suffixIcon}) {
|
|
|
|
|
return InputDecoration(
|
|
|
|
|
focusedBorder: OutlineInputBorder(
|
|
|
|
|
borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0),
|
|
|
|
|
|