|
|
|
@ -37,21 +37,13 @@ class PrescriptionCheckOutScreen extends StatefulWidget {
|
|
|
|
|
final List<PrescriptionModel> prescriptionList;
|
|
|
|
|
final ProcedureTempleteDetailsModel groupProcedures;
|
|
|
|
|
|
|
|
|
|
const PrescriptionCheckOutScreen(
|
|
|
|
|
{Key key,
|
|
|
|
|
this.model,
|
|
|
|
|
this.patient,
|
|
|
|
|
this.prescriptionList,
|
|
|
|
|
this.groupProcedures})
|
|
|
|
|
: super(key: key);
|
|
|
|
|
const PrescriptionCheckOutScreen({Key key, this.model, this.patient, this.prescriptionList, this.groupProcedures}) : super(key: key);
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
_PrescriptionCheckOutScreenState createState() =>
|
|
|
|
|
_PrescriptionCheckOutScreenState();
|
|
|
|
|
_PrescriptionCheckOutScreenState createState() => _PrescriptionCheckOutScreenState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class _PrescriptionCheckOutScreenState
|
|
|
|
|
extends State<PrescriptionCheckOutScreen> {
|
|
|
|
|
class _PrescriptionCheckOutScreenState extends State<PrescriptionCheckOutScreen> {
|
|
|
|
|
postPrescription(
|
|
|
|
|
{String duration,
|
|
|
|
|
String doseTimeIn,
|
|
|
|
@ -68,8 +60,7 @@ class _PrescriptionCheckOutScreenState
|
|
|
|
|
String icdCode,
|
|
|
|
|
PatiantInformtion patient,
|
|
|
|
|
String patientType}) async {
|
|
|
|
|
PostPrescriptionReqModel postProcedureReqModel =
|
|
|
|
|
new PostPrescriptionReqModel();
|
|
|
|
|
PostPrescriptionReqModel postProcedureReqModel = new PostPrescriptionReqModel();
|
|
|
|
|
List<PrescriptionRequestModel> prescriptionList = List();
|
|
|
|
|
|
|
|
|
|
postProcedureReqModel.appointmentNo = patient.appointmentNo;
|
|
|
|
@ -121,8 +112,7 @@ class _PrescriptionCheckOutScreenState
|
|
|
|
|
DateTime selectedDate;
|
|
|
|
|
int strengthChar;
|
|
|
|
|
GetMedicationResponseModel _selectedMedication;
|
|
|
|
|
GlobalKey key =
|
|
|
|
|
new GlobalKey<AutoCompleteTextFieldState<GetMedicationResponseModel>>();
|
|
|
|
|
GlobalKey key = new GlobalKey<AutoCompleteTextFieldState<GetMedicationResponseModel>>();
|
|
|
|
|
|
|
|
|
|
TextEditingController drugIdController = TextEditingController();
|
|
|
|
|
TextEditingController doseController = TextEditingController();
|
|
|
|
@ -160,8 +150,7 @@ class _PrescriptionCheckOutScreenState
|
|
|
|
|
onVoiceText() async {
|
|
|
|
|
new SpeechToText(context: context).showAlertDialog(context);
|
|
|
|
|
var lang = TranslationBase.of(AppGlobal.CONTEX).locale.languageCode;
|
|
|
|
|
bool available = await speech.initialize(
|
|
|
|
|
onStatus: statusListener, onError: errorListener);
|
|
|
|
|
bool available = await speech.initialize(onStatus: statusListener, onError: errorListener);
|
|
|
|
|
if (available) {
|
|
|
|
|
speech.listen(
|
|
|
|
|
onResult: resultListener,
|
|
|
|
@ -204,8 +193,7 @@ class _PrescriptionCheckOutScreenState
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future<void> initSpeechState() async {
|
|
|
|
|
bool hasSpeech = await speech.initialize(
|
|
|
|
|
onError: errorListener, onStatus: statusListener);
|
|
|
|
|
bool hasSpeech = await speech.initialize(onError: errorListener, onStatus: statusListener);
|
|
|
|
|
print(hasSpeech);
|
|
|
|
|
if (!mounted) return;
|
|
|
|
|
}
|
|
|
|
@ -222,19 +210,13 @@ class _PrescriptionCheckOutScreenState
|
|
|
|
|
return BaseView<MedicineViewModel>(
|
|
|
|
|
onModelReady: (model) async {
|
|
|
|
|
// TODO Elham* move this logic to the model
|
|
|
|
|
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(),
|
|
|
|
|
editedBy: '',
|
|
|
|
|
doctorID: '',
|
|
|
|
|
appointmentNo: widget.patient.appointmentNo);
|
|
|
|
|
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();
|
|
|
|
|
}
|
|
|
|
@ -265,8 +247,7 @@ class _PrescriptionCheckOutScreenState
|
|
|
|
|
height: MediaQuery.of(context).size.height * 1.35,
|
|
|
|
|
color: Color(0xffF8F8F8),
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding:
|
|
|
|
|
EdgeInsets.symmetric(horizontal: 12.0, vertical: 10.0),
|
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 12.0, vertical: 10.0),
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
Column(
|
|
|
|
@ -290,8 +271,7 @@ class _PrescriptionCheckOutScreenState
|
|
|
|
|
width: 7.0,
|
|
|
|
|
),
|
|
|
|
|
AppText(
|
|
|
|
|
TranslationBase.of(context)
|
|
|
|
|
.newPrescriptionOrder,
|
|
|
|
|
TranslationBase.of(context).newPrescriptionOrder,
|
|
|
|
|
fontWeight: FontWeight.w700,
|
|
|
|
|
fontSize: 20,
|
|
|
|
|
),
|
|
|
|
@ -325,16 +305,14 @@ class _PrescriptionCheckOutScreenState
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
AppText(
|
|
|
|
|
widget.groupProcedures.procedureName ??
|
|
|
|
|
"",
|
|
|
|
|
widget.groupProcedures.procedureName ?? "",
|
|
|
|
|
bold: true,
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
AppText(
|
|
|
|
|
TranslationBase.of(context)
|
|
|
|
|
.orderType,
|
|
|
|
|
TranslationBase.of(context).orderType,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
),
|
|
|
|
|
Radio(
|
|
|
|
@ -345,8 +323,7 @@ class _PrescriptionCheckOutScreenState
|
|
|
|
|
setSelectedType(value);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
Text(TranslationBase.of(context)
|
|
|
|
|
.regular),
|
|
|
|
|
Text(TranslationBase.of(context).regular),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
@ -356,10 +333,7 @@ class _PrescriptionCheckOutScreenState
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
width: MediaQuery.of(context)
|
|
|
|
|
.size
|
|
|
|
|
.width *
|
|
|
|
|
0.35,
|
|
|
|
|
width: MediaQuery.of(context).size.width * 0.35,
|
|
|
|
|
child: AppTextFieldCustom(
|
|
|
|
|
height: 40,
|
|
|
|
|
validationError: strengthError,
|
|
|
|
@ -372,16 +346,12 @@ class _PrescriptionCheckOutScreenState
|
|
|
|
|
strengthChar = value.length;
|
|
|
|
|
});
|
|
|
|
|
if (strengthChar >= 5) {
|
|
|
|
|
DrAppToastMsg
|
|
|
|
|
.showErrorToast(
|
|
|
|
|
TranslationBase.of(
|
|
|
|
|
context)
|
|
|
|
|
.only5DigitsAllowedForStrength,
|
|
|
|
|
DrAppToastMsg.showErrorToast(
|
|
|
|
|
TranslationBase.of(context).only5DigitsAllowedForStrength,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
inputType: TextInputType
|
|
|
|
|
.numberWithOptions(
|
|
|
|
|
inputType: TextInputType.numberWithOptions(
|
|
|
|
|
decimal: true,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
@ -390,17 +360,13 @@ class _PrescriptionCheckOutScreenState
|
|
|
|
|
width: 5.0,
|
|
|
|
|
),
|
|
|
|
|
PrescriptionTextFiled(
|
|
|
|
|
width: MediaQuery.of(context)
|
|
|
|
|
.size
|
|
|
|
|
.width *
|
|
|
|
|
0.560,
|
|
|
|
|
width: MediaQuery.of(context).size.width * 0.560,
|
|
|
|
|
element: units,
|
|
|
|
|
elementError: unitError,
|
|
|
|
|
keyName: 'description',
|
|
|
|
|
keyId: 'parameterCode',
|
|
|
|
|
hintText: 'Select',
|
|
|
|
|
elementList:
|
|
|
|
|
model.itemMedicineListUnit,
|
|
|
|
|
elementList: model.itemMedicineListUnit,
|
|
|
|
|
okFunction: (selectedValue) {
|
|
|
|
|
setState(() {
|
|
|
|
|
units = selectedValue;
|
|
|
|
@ -413,8 +379,7 @@ class _PrescriptionCheckOutScreenState
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: spaceBetweenTextFields),
|
|
|
|
|
PrescriptionTextFiled(
|
|
|
|
|
elementList:
|
|
|
|
|
model.itemMedicineListRoute,
|
|
|
|
|
elementList: model.itemMedicineListRoute,
|
|
|
|
|
element: route,
|
|
|
|
|
elementError: routeError,
|
|
|
|
|
keyId: 'parameterCode',
|
|
|
|
@ -425,13 +390,11 @@ class _PrescriptionCheckOutScreenState
|
|
|
|
|
route['isDefault'] = true;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
hintText:
|
|
|
|
|
TranslationBase.of(context).route,
|
|
|
|
|
hintText: TranslationBase.of(context).route,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: spaceBetweenTextFields),
|
|
|
|
|
PrescriptionTextFiled(
|
|
|
|
|
hintText: TranslationBase.of(context)
|
|
|
|
|
.frequency,
|
|
|
|
|
hintText: TranslationBase.of(context).frequency,
|
|
|
|
|
elementError: frequencyError,
|
|
|
|
|
element: frequency,
|
|
|
|
|
elementList: model.itemMedicineList,
|
|
|
|
@ -441,21 +404,9 @@ class _PrescriptionCheckOutScreenState
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
@ -463,12 +414,10 @@ class _PrescriptionCheckOutScreenState
|
|
|
|
|
}),
|
|
|
|
|
SizedBox(height: spaceBetweenTextFields),
|
|
|
|
|
PrescriptionTextFiled(
|
|
|
|
|
hintText: TranslationBase.of(context)
|
|
|
|
|
.doseTime,
|
|
|
|
|
hintText: TranslationBase.of(context).doseTime,
|
|
|
|
|
elementError: doseTimeError,
|
|
|
|
|
element: doseTime,
|
|
|
|
|
elementList:
|
|
|
|
|
model.medicationDoseTimeList,
|
|
|
|
|
elementList: model.medicationDoseTimeList,
|
|
|
|
|
keyId: 'id',
|
|
|
|
|
keyName: 'nameEn',
|
|
|
|
|
okFunction: (selectedValue) {
|
|
|
|
@ -477,8 +426,7 @@ class _PrescriptionCheckOutScreenState
|
|
|
|
|
});
|
|
|
|
|
}),
|
|
|
|
|
SizedBox(height: spaceBetweenTextFields),
|
|
|
|
|
if (model
|
|
|
|
|
.patientAssessmentList.isNotEmpty)
|
|
|
|
|
if (model.patientAssessmentList.isNotEmpty)
|
|
|
|
|
Container(
|
|
|
|
|
height: screenSize.height * 0.070,
|
|
|
|
|
width: double.infinity,
|
|
|
|
@ -486,47 +434,19 @@ class _PrescriptionCheckOutScreenState
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
width: MediaQuery.of(context)
|
|
|
|
|
.size
|
|
|
|
|
.width *
|
|
|
|
|
0.29,
|
|
|
|
|
width: MediaQuery.of(context).size.width * 0.29,
|
|
|
|
|
child: TextField(
|
|
|
|
|
decoration:
|
|
|
|
|
textFieldSelectorDecoration(
|
|
|
|
|
model
|
|
|
|
|
.patientAssessmentList[
|
|
|
|
|
0]
|
|
|
|
|
.icdCode10ID
|
|
|
|
|
.toString(),
|
|
|
|
|
indication != null
|
|
|
|
|
? indication[
|
|
|
|
|
'name']
|
|
|
|
|
: null,
|
|
|
|
|
false),
|
|
|
|
|
decoration: textFieldSelectorDecoration(model.patientAssessmentList[0].icdCode10ID.toString(), indication != null ? indication['name'] : null, false),
|
|
|
|
|
enabled: true,
|
|
|
|
|
readOnly: true,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
width: MediaQuery.of(context)
|
|
|
|
|
.size
|
|
|
|
|
.width *
|
|
|
|
|
0.65,
|
|
|
|
|
width: MediaQuery.of(context).size.width * 0.65,
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
child: TextField(
|
|
|
|
|
maxLines: 5,
|
|
|
|
|
decoration:
|
|
|
|
|
textFieldSelectorDecoration(
|
|
|
|
|
model
|
|
|
|
|
.patientAssessmentList[
|
|
|
|
|
0]
|
|
|
|
|
.asciiDesc
|
|
|
|
|
.toString(),
|
|
|
|
|
indication != null
|
|
|
|
|
? indication[
|
|
|
|
|
'name']
|
|
|
|
|
: null,
|
|
|
|
|
false),
|
|
|
|
|
decoration: textFieldSelectorDecoration(model.patientAssessmentList[0].asciiDesc.toString(), indication != null ? indication['name'] : null, false),
|
|
|
|
|
enabled: true,
|
|
|
|
|
readOnly: true,
|
|
|
|
|
),
|
|
|
|
@ -539,16 +459,10 @@ class _PrescriptionCheckOutScreenState
|
|
|
|
|
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,
|
|
|
|
|
selectedDate != null
|
|
|
|
|
? "${AppDateUtils.convertStringToDateFormat(selectedDate.toString(), "yyyy-MM-dd")}"
|
|
|
|
|
: null,
|
|
|
|
|
true,
|
|
|
|
|
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,
|
|
|
|
@ -561,28 +475,19 @@ class _PrescriptionCheckOutScreenState
|
|
|
|
|
PrescriptionTextFiled(
|
|
|
|
|
element: duration,
|
|
|
|
|
elementError: durationError,
|
|
|
|
|
hintText: TranslationBase.of(context)
|
|
|
|
|
.duration,
|
|
|
|
|
elementList:
|
|
|
|
|
model.medicationDurationList,
|
|
|
|
|
hintText: TranslationBase.of(context).duration,
|
|
|
|
|
elementList: model.medicationDurationList,
|
|
|
|
|
keyName: 'nameEn',
|
|
|
|
|
keyId: 'id',
|
|
|
|
|
okFunction: (selectedValue) {
|
|
|
|
|
setState(() {
|
|
|
|
|
duration = selectedValue;
|
|
|
|
|
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'],
|
|
|
|
|
freq: frequency['parameterCode'],
|
|
|
|
|
duration: duration['id'],
|
|
|
|
|
itemCode:
|
|
|
|
|
_selectedMedication.itemId,
|
|
|
|
|
strength: double.parse(
|
|
|
|
|
strengthController.text),
|
|
|
|
|
itemCode: _selectedMedication.itemId,
|
|
|
|
|
strength: double.parse(strengthController.text),
|
|
|
|
|
);
|
|
|
|
|
box = model.boxQuintity;
|
|
|
|
|
|
|
|
|
@ -595,20 +500,13 @@ class _PrescriptionCheckOutScreenState
|
|
|
|
|
SizedBox(height: spaceBetweenTextFields),
|
|
|
|
|
SizedBox(height: spaceBetweenTextFields),
|
|
|
|
|
Container(
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
borderRadius: BorderRadius.all(
|
|
|
|
|
Radius.circular(6.0)),
|
|
|
|
|
border: Border.all(
|
|
|
|
|
width: 1.0,
|
|
|
|
|
color: HexColor("#CCCCCC"))),
|
|
|
|
|
decoration: BoxDecoration(borderRadius: BorderRadius.all(Radius.circular(6.0)), border: Border.all(width: 1.0, color: HexColor("#CCCCCC"))),
|
|
|
|
|
child: Stack(
|
|
|
|
|
children: [
|
|
|
|
|
TextFields(
|
|
|
|
|
maxLines: 6,
|
|
|
|
|
minLines: 4,
|
|
|
|
|
hintText:
|
|
|
|
|
TranslationBase.of(context)
|
|
|
|
|
.instruction,
|
|
|
|
|
hintText: TranslationBase.of(context).instruction,
|
|
|
|
|
controller: instructionController,
|
|
|
|
|
//keyboardType: TextInputType.number,
|
|
|
|
|
),
|
|
|
|
@ -622,9 +520,7 @@ class _PrescriptionCheckOutScreenState
|
|
|
|
|
size: 35,
|
|
|
|
|
),
|
|
|
|
|
onPressed: () {
|
|
|
|
|
initSpeechState().then(
|
|
|
|
|
(value) =>
|
|
|
|
|
{onVoiceText()});
|
|
|
|
|
initSpeechState().then((value) => {onVoiceText()});
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
@ -633,15 +529,13 @@ class _PrescriptionCheckOutScreenState
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: spaceBetweenTextFields),
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.all(
|
|
|
|
|
SizeConfig.widthMultiplier * 5),
|
|
|
|
|
margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5),
|
|
|
|
|
child: Wrap(
|
|
|
|
|
alignment: WrapAlignment.center,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
AppButton(
|
|
|
|
|
color: AppGlobal.appGreenColor,
|
|
|
|
|
title: TranslationBase.of(context)
|
|
|
|
|
.addMedication,
|
|
|
|
|
title: TranslationBase.of(context).addMedication,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
onPressed: () async {
|
|
|
|
|
if (route != null &&
|
|
|
|
@ -650,101 +544,41 @@ class _PrescriptionCheckOutScreenState
|
|
|
|
|
frequency != null &&
|
|
|
|
|
units != null &&
|
|
|
|
|
selectedDate != null &&
|
|
|
|
|
strengthController.text !=
|
|
|
|
|
"") {
|
|
|
|
|
if (double.parse(
|
|
|
|
|
strengthController
|
|
|
|
|
.text) >
|
|
|
|
|
1000.0) {
|
|
|
|
|
strengthController.text != "") {
|
|
|
|
|
if (double.parse(strengthController.text) > 1000.0) {
|
|
|
|
|
DrAppToastMsg.showErrorToast(
|
|
|
|
|
TranslationBase.of(context).thousandIsTheMAXForTheStrength,);
|
|
|
|
|
TranslationBase.of(context).thousandIsTheMAXForTheStrength,
|
|
|
|
|
);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (double.parse(
|
|
|
|
|
strengthController
|
|
|
|
|
.text) <
|
|
|
|
|
0.0) {
|
|
|
|
|
if (double.parse(strengthController.text) < 0.0) {
|
|
|
|
|
DrAppToastMsg.showErrorToast(
|
|
|
|
|
TranslationBase.of(context).strengthCanNotBeZero,);
|
|
|
|
|
TranslationBase.of(context).strengthCanNotBeZero,
|
|
|
|
|
);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (formKey.currentState
|
|
|
|
|
.validate()) {
|
|
|
|
|
if (formKey.currentState.validate()) {
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
{
|
|
|
|
|
postPrescription(
|
|
|
|
|
icdCode: model
|
|
|
|
|
.patientAssessmentList
|
|
|
|
|
.isNotEmpty
|
|
|
|
|
? model
|
|
|
|
|
.patientAssessmentList[
|
|
|
|
|
0]
|
|
|
|
|
.icdCode10ID
|
|
|
|
|
.isEmpty
|
|
|
|
|
icdCode: model.patientAssessmentList.isNotEmpty
|
|
|
|
|
? model.patientAssessmentList[0].icdCode10ID.isEmpty
|
|
|
|
|
? "test"
|
|
|
|
|
: model
|
|
|
|
|
.patientAssessmentList[
|
|
|
|
|
0]
|
|
|
|
|
.icdCode10ID
|
|
|
|
|
.toString()
|
|
|
|
|
: model.patientAssessmentList[0].icdCode10ID.toString()
|
|
|
|
|
: "test",
|
|
|
|
|
dose: strengthController
|
|
|
|
|
.text,
|
|
|
|
|
doseUnit: model
|
|
|
|
|
.itemMedicineListUnit
|
|
|
|
|
.length ==
|
|
|
|
|
1
|
|
|
|
|
? model
|
|
|
|
|
.itemMedicineListUnit[
|
|
|
|
|
0][
|
|
|
|
|
'parameterCode']
|
|
|
|
|
.toString()
|
|
|
|
|
: units['parameterCode']
|
|
|
|
|
.toString(),
|
|
|
|
|
dose: strengthController.text,
|
|
|
|
|
doseUnit:
|
|
|
|
|
model.itemMedicineListUnit.length == 1 ? model.itemMedicineListUnit[0]['parameterCode'].toString() : units['parameterCode'].toString(),
|
|
|
|
|
patient: widget.patient,
|
|
|
|
|
doseTimeIn:
|
|
|
|
|
doseTime['id']
|
|
|
|
|
.toString(),
|
|
|
|
|
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: (widget
|
|
|
|
|
.groupProcedures
|
|
|
|
|
.aliasN
|
|
|
|
|
.replaceAll(
|
|
|
|
|
"item code ;",
|
|
|
|
|
"")),
|
|
|
|
|
strength:
|
|
|
|
|
strengthController
|
|
|
|
|
.text,
|
|
|
|
|
indication:
|
|
|
|
|
indicationController
|
|
|
|
|
.text,
|
|
|
|
|
instruction:
|
|
|
|
|
instructionController
|
|
|
|
|
.text,
|
|
|
|
|
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: (widget.groupProcedures.aliasN.replaceAll("item code ;", "")),
|
|
|
|
|
strength: strengthController.text,
|
|
|
|
|
indication: indicationController.text,
|
|
|
|
|
instruction: instructionController.text,
|
|
|
|
|
doseTime: selectedDate,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
@ -752,52 +586,32 @@ class _PrescriptionCheckOutScreenState
|
|
|
|
|
} else {
|
|
|
|
|
setState(() {
|
|
|
|
|
if (duration == null) {
|
|
|
|
|
durationError =
|
|
|
|
|
TranslationBase.of(
|
|
|
|
|
context)
|
|
|
|
|
.fieldRequired;
|
|
|
|
|
durationError = TranslationBase.of(context).fieldRequired;
|
|
|
|
|
} else {
|
|
|
|
|
durationError = null;
|
|
|
|
|
}
|
|
|
|
|
if (doseTime == null) {
|
|
|
|
|
doseTimeError =
|
|
|
|
|
TranslationBase.of(
|
|
|
|
|
context)
|
|
|
|
|
.fieldRequired;
|
|
|
|
|
doseTimeError = TranslationBase.of(context).fieldRequired;
|
|
|
|
|
} else {
|
|
|
|
|
doseTimeError = null;
|
|
|
|
|
}
|
|
|
|
|
if (route == null) {
|
|
|
|
|
routeError =
|
|
|
|
|
TranslationBase.of(
|
|
|
|
|
context)
|
|
|
|
|
.fieldRequired;
|
|
|
|
|
routeError = TranslationBase.of(context).fieldRequired;
|
|
|
|
|
} else {
|
|
|
|
|
routeError = null;
|
|
|
|
|
}
|
|
|
|
|
if (frequency == null) {
|
|
|
|
|
frequencyError =
|
|
|
|
|
TranslationBase.of(
|
|
|
|
|
context)
|
|
|
|
|
.fieldRequired;
|
|
|
|
|
frequencyError = TranslationBase.of(context).fieldRequired;
|
|
|
|
|
} else {
|
|
|
|
|
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;
|
|
|
|
|
if (strengthController.text == "") {
|
|
|
|
|
strengthError = TranslationBase.of(context).fieldRequired;
|
|
|
|
|
} else {
|
|
|
|
|
strengthError = null;
|
|
|
|
|
}
|
|
|
|
@ -849,9 +663,7 @@ class _PrescriptionCheckOutScreenState
|
|
|
|
|
|
|
|
|
|
/// TODO Elham* Use it from the textfeild utils
|
|
|
|
|
|
|
|
|
|
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),
|
|
|
|
|