|
|
|
|
@ -2,6 +2,7 @@ import 'package:doctor_app_flutter/config/config.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/config/size_config.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/core/enum/view_state.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/core/model/SOAP/master_key_model.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/core/model/admissionRequest/admission-request.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/core/service/AnalyticsService.dart';
|
|
|
|
|
@ -31,10 +32,12 @@ import '../../../../routes.dart';
|
|
|
|
|
|
|
|
|
|
class AdmissionRequestSecondScreen extends StatefulWidget {
|
|
|
|
|
@override
|
|
|
|
|
_AdmissionRequestSecondScreenState createState() => _AdmissionRequestSecondScreenState();
|
|
|
|
|
_AdmissionRequestSecondScreenState createState() =>
|
|
|
|
|
_AdmissionRequestSecondScreenState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class _AdmissionRequestSecondScreenState extends State<AdmissionRequestSecondScreen> {
|
|
|
|
|
class _AdmissionRequestSecondScreenState
|
|
|
|
|
extends State<AdmissionRequestSecondScreen> {
|
|
|
|
|
final _postPlansEstimatedCostController = TextEditingController();
|
|
|
|
|
final _estimatedCostController = TextEditingController();
|
|
|
|
|
final _expectedDaysController = TextEditingController();
|
|
|
|
|
@ -49,6 +52,7 @@ class _AdmissionRequestSecondScreenState extends State<AdmissionRequestSecondScr
|
|
|
|
|
dynamic _selectedWard;
|
|
|
|
|
dynamic _selectedRoomCategory;
|
|
|
|
|
dynamic _selectedAdmissionType;
|
|
|
|
|
dynamic _selectedIntendedStayLength;
|
|
|
|
|
|
|
|
|
|
String costError = '',
|
|
|
|
|
plansError = '',
|
|
|
|
|
@ -60,7 +64,9 @@ class _AdmissionRequestSecondScreenState extends State<AdmissionRequestSecondScr
|
|
|
|
|
treatmentsError = '',
|
|
|
|
|
complicationsError = '',
|
|
|
|
|
proceduresError = '',
|
|
|
|
|
admissionTypeError = '';
|
|
|
|
|
admissionTypeError = '',
|
|
|
|
|
stayLengthError = '';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
@ -74,9 +80,16 @@ class _AdmissionRequestSecondScreenState extends State<AdmissionRequestSecondScr
|
|
|
|
|
ProjectViewModel projectViewModel = Provider.of(context);
|
|
|
|
|
|
|
|
|
|
return BaseView<AdmissionRequestViewModel>(
|
|
|
|
|
onModelReady: (model){
|
|
|
|
|
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
|
|
|
|
await model.getIsKSAProject();
|
|
|
|
|
//todo handle get diagnosis list
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
builder: (_, model, w) => AppScaffold(
|
|
|
|
|
baseViewModel: model,
|
|
|
|
|
isShowAppBar: true,
|
|
|
|
|
isLoading: model.state == ViewState.BusyLocal,
|
|
|
|
|
appBar: PatientProfileAppBar(patient),
|
|
|
|
|
appBarTitle: TranslationBase.of(context).admissionRequest,
|
|
|
|
|
body: GestureDetector(
|
|
|
|
|
@ -104,13 +117,15 @@ class _AdmissionRequestSecondScreenState extends State<AdmissionRequestSecondScr
|
|
|
|
|
height: 15,
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.symmetric(vertical: 0, horizontal: 16),
|
|
|
|
|
margin:
|
|
|
|
|
EdgeInsets.symmetric(vertical: 0, horizontal: 16),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
AppText(
|
|
|
|
|
Utils.convertToTitleCase(
|
|
|
|
|
TranslationBase.of(context).postPlansEstimatedCost,
|
|
|
|
|
TranslationBase.of(context)
|
|
|
|
|
.postPlansEstimatedCost,
|
|
|
|
|
),
|
|
|
|
|
color: Color(0xFF2E303A),
|
|
|
|
|
fontSize: SizeConfig.textMultiplier! * 1.8,
|
|
|
|
|
@ -121,11 +136,15 @@ class _AdmissionRequestSecondScreenState extends State<AdmissionRequestSecondScr
|
|
|
|
|
),
|
|
|
|
|
AppTextFieldCustom(
|
|
|
|
|
height: screenSize.height * 0.075,
|
|
|
|
|
hintText: TranslationBase.of(context).estimatedCost,
|
|
|
|
|
hintText:
|
|
|
|
|
TranslationBase.of(context).estimatedCost,
|
|
|
|
|
controller: _estimatedCostController,
|
|
|
|
|
validationError: costError,
|
|
|
|
|
inputType: TextInputType.number,
|
|
|
|
|
inputFormatters: [FilteringTextInputFormatter.allow(RegExp(ONLY_NUMBERS))],
|
|
|
|
|
inputFormatters: [
|
|
|
|
|
FilteringTextInputFormatter.allow(
|
|
|
|
|
RegExp(ONLY_NUMBERS))
|
|
|
|
|
],
|
|
|
|
|
onClick: () {},
|
|
|
|
|
onChanged: (value) {},
|
|
|
|
|
onFieldSubmitted: () {},
|
|
|
|
|
@ -148,8 +167,10 @@ class _AdmissionRequestSecondScreenState extends State<AdmissionRequestSecondScr
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
AppTextFieldCustom(
|
|
|
|
|
hintText: TranslationBase.of(context).otherDepartmentsInterventions,
|
|
|
|
|
controller: _otherDepartmentsInterventionsController,
|
|
|
|
|
hintText: TranslationBase.of(context)
|
|
|
|
|
.otherDepartmentsInterventions,
|
|
|
|
|
controller:
|
|
|
|
|
_otherDepartmentsInterventionsController,
|
|
|
|
|
inputType: TextInputType.multiline,
|
|
|
|
|
validationError: otherInterventionsError,
|
|
|
|
|
minLines: 2,
|
|
|
|
|
@ -172,7 +193,8 @@ class _AdmissionRequestSecondScreenState extends State<AdmissionRequestSecondScr
|
|
|
|
|
),
|
|
|
|
|
AppTextFieldCustom(
|
|
|
|
|
height: screenSize.height * 0.075,
|
|
|
|
|
hintText: TranslationBase.of(context).expectedDays,
|
|
|
|
|
hintText:
|
|
|
|
|
TranslationBase.of(context).expectedDays,
|
|
|
|
|
controller: _expectedDaysController,
|
|
|
|
|
validationError: expectedDaysError,
|
|
|
|
|
inputType: TextInputType.number,
|
|
|
|
|
@ -190,8 +212,11 @@ class _AdmissionRequestSecondScreenState extends State<AdmissionRequestSecondScr
|
|
|
|
|
),
|
|
|
|
|
AppTextFieldCustom(
|
|
|
|
|
height: screenSize.height * 0.075,
|
|
|
|
|
hintText: TranslationBase.of(context).expectedAdmissionDate,
|
|
|
|
|
dropDownText: _expectedAdmissionDate != null ? "${AppDateUtils.convertStringToDateFormat(_expectedAdmissionDate.toString(), "yyyy-MM-dd")}" : "",
|
|
|
|
|
hintText: TranslationBase.of(context)
|
|
|
|
|
.expectedAdmissionDate,
|
|
|
|
|
dropDownText: _expectedAdmissionDate != null
|
|
|
|
|
? "${AppDateUtils.convertStringToDateFormat(_expectedAdmissionDate.toString(), "yyyy-MM-dd")}"
|
|
|
|
|
: "",
|
|
|
|
|
enabled: false,
|
|
|
|
|
isTextFieldHasSuffix: true,
|
|
|
|
|
validationError: expectedDatesError,
|
|
|
|
|
@ -206,7 +231,8 @@ class _AdmissionRequestSecondScreenState extends State<AdmissionRequestSecondScr
|
|
|
|
|
if (_expectedAdmissionDate == null) {
|
|
|
|
|
_expectedAdmissionDate = DateTime.now();
|
|
|
|
|
}
|
|
|
|
|
_selectDate(context, _expectedAdmissionDate!, (picked) {
|
|
|
|
|
_selectDate(context, _expectedAdmissionDate!,
|
|
|
|
|
(picked) {
|
|
|
|
|
setState(() {
|
|
|
|
|
_expectedAdmissionDate = picked;
|
|
|
|
|
});
|
|
|
|
|
@ -215,37 +241,123 @@ class _AdmissionRequestSecondScreenState extends State<AdmissionRequestSecondScr
|
|
|
|
|
onChanged: (value) {},
|
|
|
|
|
onFieldSubmitted: () {},
|
|
|
|
|
),
|
|
|
|
|
if (model.intendedStayLength != null &&
|
|
|
|
|
model.intendedStayLength.isNotEmpty) ...{
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
AppTextFieldCustom(
|
|
|
|
|
height: screenSize.height * 0.075,
|
|
|
|
|
hintText: TranslationBase.of(context)
|
|
|
|
|
.intendedLengthOfStay,
|
|
|
|
|
dropDownText:
|
|
|
|
|
_selectedIntendedStayLength != null
|
|
|
|
|
? _selectedIntendedStayLength['nameEn']
|
|
|
|
|
: null,
|
|
|
|
|
enabled: false,
|
|
|
|
|
isTextFieldHasSuffix: true,
|
|
|
|
|
validationError: stayLengthError,
|
|
|
|
|
onClick: model.intendedStayLength != null &&
|
|
|
|
|
model.intendedStayLength.length > 0
|
|
|
|
|
? () {
|
|
|
|
|
var attributeName =
|
|
|
|
|
projectViewModel.isArabic
|
|
|
|
|
? 'nameEn'
|
|
|
|
|
: 'nameAr';
|
|
|
|
|
openListDialogField(attributeName, 'id',
|
|
|
|
|
model.intendedStayLength,
|
|
|
|
|
(selectedValue) {
|
|
|
|
|
setState(() {
|
|
|
|
|
_selectedIntendedStayLength =
|
|
|
|
|
selectedValue;
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
: () async {
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(
|
|
|
|
|
context);
|
|
|
|
|
await model.getDiagnosis().then((_) =>
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(
|
|
|
|
|
context));
|
|
|
|
|
if (model.state == ViewState.Idle &&
|
|
|
|
|
model.intendedStayLength
|
|
|
|
|
.isNotEmpty) {
|
|
|
|
|
var attributeName =
|
|
|
|
|
projectViewModel.isArabic
|
|
|
|
|
? 'nameEn'
|
|
|
|
|
: 'nameAr';
|
|
|
|
|
openListDialogField(attributeName,
|
|
|
|
|
'id', model.intendedStayLength,
|
|
|
|
|
(selectedValue) {
|
|
|
|
|
setState(() {
|
|
|
|
|
_selectedIntendedStayLength =
|
|
|
|
|
selectedValue;
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
} else if (model.state ==
|
|
|
|
|
ViewState.ErrorLocal) {
|
|
|
|
|
DrAppToastMsg.showErrorToast(
|
|
|
|
|
model.error);
|
|
|
|
|
} else {
|
|
|
|
|
DrAppToastMsg.showErrorToast(
|
|
|
|
|
"Empty List");
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
onChanged: (value) {},
|
|
|
|
|
onFieldSubmitted: () {},
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
)
|
|
|
|
|
} else ...{
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
},
|
|
|
|
|
AppTextFieldCustom(
|
|
|
|
|
height: screenSize.height * 0.075,
|
|
|
|
|
hintText: TranslationBase.of(context).floor,
|
|
|
|
|
dropDownText: _selectedFloor != null ? _selectedFloor['description'] : null,
|
|
|
|
|
dropDownText: _selectedFloor != null
|
|
|
|
|
? _selectedFloor['description']
|
|
|
|
|
: null,
|
|
|
|
|
enabled: false,
|
|
|
|
|
isTextFieldHasSuffix: true,
|
|
|
|
|
validationError: floorError,
|
|
|
|
|
onClick: model.floorList != null && model.floorList.length > 0
|
|
|
|
|
onClick: model.floorList != null &&
|
|
|
|
|
model.floorList.length > 0
|
|
|
|
|
? () {
|
|
|
|
|
openListDialogField('description', 'floorID', model.floorList, (selectedValue) {
|
|
|
|
|
openListDialogField(
|
|
|
|
|
'description',
|
|
|
|
|
'floorID',
|
|
|
|
|
model.floorList, (selectedValue) {
|
|
|
|
|
setState(() {
|
|
|
|
|
_selectedFloor = selectedValue;
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
: () async {
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
await model.getFloors().then((_) => GifLoaderDialogUtils.hideDialog(context));
|
|
|
|
|
if (model.state == ViewState.Idle && model.floorList.length > 0) {
|
|
|
|
|
openListDialogField('description', 'floorID', model.floorList, (selectedValue) {
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(
|
|
|
|
|
context);
|
|
|
|
|
await model.getFloors().then((_) =>
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(
|
|
|
|
|
context));
|
|
|
|
|
if (model.state == ViewState.Idle &&
|
|
|
|
|
model.floorList.length > 0) {
|
|
|
|
|
openListDialogField(
|
|
|
|
|
'description',
|
|
|
|
|
'floorID',
|
|
|
|
|
model.floorList, (selectedValue) {
|
|
|
|
|
setState(() {
|
|
|
|
|
_selectedFloor = selectedValue;
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
} else if (model.state == ViewState.ErrorLocal) {
|
|
|
|
|
DrAppToastMsg.showErrorToast(model.error);
|
|
|
|
|
} else if (model.state ==
|
|
|
|
|
ViewState.ErrorLocal) {
|
|
|
|
|
DrAppToastMsg.showErrorToast(
|
|
|
|
|
model.error);
|
|
|
|
|
} else {
|
|
|
|
|
DrAppToastMsg.showErrorToast("Empty List");
|
|
|
|
|
DrAppToastMsg.showErrorToast(
|
|
|
|
|
"Empty List");
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
onChanged: (value) {},
|
|
|
|
|
@ -257,30 +369,46 @@ class _AdmissionRequestSecondScreenState extends State<AdmissionRequestSecondScr
|
|
|
|
|
AppTextFieldCustom(
|
|
|
|
|
height: screenSize.height * 0.075,
|
|
|
|
|
hintText: TranslationBase.of(context).ward,
|
|
|
|
|
dropDownText: _selectedWard != null ? _selectedWard['description'] : null,
|
|
|
|
|
dropDownText: _selectedWard != null
|
|
|
|
|
? _selectedWard['description']
|
|
|
|
|
: null,
|
|
|
|
|
enabled: false,
|
|
|
|
|
isTextFieldHasSuffix: true,
|
|
|
|
|
onClick: model.wardList != null && model.wardList.length > 0
|
|
|
|
|
onClick: model.wardList != null &&
|
|
|
|
|
model.wardList.length > 0
|
|
|
|
|
? () {
|
|
|
|
|
openListDialogField('description', 'nursingStationID', model.wardList, (selectedValue) {
|
|
|
|
|
openListDialogField(
|
|
|
|
|
'description',
|
|
|
|
|
'nursingStationID',
|
|
|
|
|
model.wardList, (selectedValue) {
|
|
|
|
|
setState(() {
|
|
|
|
|
_selectedWard = selectedValue;
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
: () async {
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
await model.getWards().then((_) => GifLoaderDialogUtils.hideDialog(context));
|
|
|
|
|
if (model.state == ViewState.Idle && model.wardList.length > 0) {
|
|
|
|
|
openListDialogField('description', 'nursingStationID', model.wardList, (selectedValue) {
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(
|
|
|
|
|
context);
|
|
|
|
|
await model.getWards().then((_) =>
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(
|
|
|
|
|
context));
|
|
|
|
|
if (model.state == ViewState.Idle &&
|
|
|
|
|
model.wardList.length > 0) {
|
|
|
|
|
openListDialogField(
|
|
|
|
|
'description',
|
|
|
|
|
'nursingStationID',
|
|
|
|
|
model.wardList, (selectedValue) {
|
|
|
|
|
setState(() {
|
|
|
|
|
_selectedWard = selectedValue;
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
} else if (model.state == ViewState.ErrorLocal) {
|
|
|
|
|
DrAppToastMsg.showErrorToast(model.error);
|
|
|
|
|
} else if (model.state ==
|
|
|
|
|
ViewState.ErrorLocal) {
|
|
|
|
|
DrAppToastMsg.showErrorToast(
|
|
|
|
|
model.error);
|
|
|
|
|
} else {
|
|
|
|
|
DrAppToastMsg.showErrorToast("Empty List");
|
|
|
|
|
DrAppToastMsg.showErrorToast(
|
|
|
|
|
"Empty List");
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
onChanged: (value) {},
|
|
|
|
|
@ -291,32 +419,51 @@ class _AdmissionRequestSecondScreenState extends State<AdmissionRequestSecondScr
|
|
|
|
|
),
|
|
|
|
|
AppTextFieldCustom(
|
|
|
|
|
height: screenSize.height * 0.075,
|
|
|
|
|
hintText: TranslationBase.of(context).roomCategory,
|
|
|
|
|
dropDownText: _selectedRoomCategory != null ? _selectedRoomCategory['description'] : null,
|
|
|
|
|
hintText:
|
|
|
|
|
TranslationBase.of(context).roomCategory,
|
|
|
|
|
dropDownText: _selectedRoomCategory != null
|
|
|
|
|
? _selectedRoomCategory['description']
|
|
|
|
|
: null,
|
|
|
|
|
enabled: false,
|
|
|
|
|
isTextFieldHasSuffix: true,
|
|
|
|
|
validationError: roomError,
|
|
|
|
|
onClick: model.roomCategoryList != null && model.roomCategoryList.length > 0
|
|
|
|
|
onClick: model.roomCategoryList != null &&
|
|
|
|
|
model.roomCategoryList.length > 0
|
|
|
|
|
? () {
|
|
|
|
|
openListDialogField('description', 'categoryID', model.roomCategoryList, (selectedValue) {
|
|
|
|
|
openListDialogField('description',
|
|
|
|
|
'categoryID', model.roomCategoryList,
|
|
|
|
|
(selectedValue) {
|
|
|
|
|
setState(() {
|
|
|
|
|
_selectedRoomCategory = selectedValue;
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
: () async {
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
await model.getRoomCategories().then((_) => GifLoaderDialogUtils.hideDialog(context));
|
|
|
|
|
if (model.state == ViewState.Idle && model.roomCategoryList.length > 0) {
|
|
|
|
|
openListDialogField('description', 'categoryID', model.roomCategoryList, (selectedValue) {
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(
|
|
|
|
|
context);
|
|
|
|
|
await model.getRoomCategories().then(
|
|
|
|
|
(_) =>
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(
|
|
|
|
|
context));
|
|
|
|
|
if (model.state == ViewState.Idle &&
|
|
|
|
|
model.roomCategoryList.length > 0) {
|
|
|
|
|
openListDialogField(
|
|
|
|
|
'description',
|
|
|
|
|
'categoryID',
|
|
|
|
|
model.roomCategoryList,
|
|
|
|
|
(selectedValue) {
|
|
|
|
|
setState(() {
|
|
|
|
|
_selectedRoomCategory = selectedValue;
|
|
|
|
|
_selectedRoomCategory =
|
|
|
|
|
selectedValue;
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
} else if (model.state == ViewState.ErrorLocal) {
|
|
|
|
|
DrAppToastMsg.showErrorToast(model.error);
|
|
|
|
|
} else if (model.state ==
|
|
|
|
|
ViewState.ErrorLocal) {
|
|
|
|
|
DrAppToastMsg.showErrorToast(
|
|
|
|
|
model.error);
|
|
|
|
|
} else {
|
|
|
|
|
DrAppToastMsg.showErrorToast("Empty List");
|
|
|
|
|
DrAppToastMsg.showErrorToast(
|
|
|
|
|
"Empty List");
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
onChanged: (value) {},
|
|
|
|
|
@ -326,7 +473,8 @@ class _AdmissionRequestSecondScreenState extends State<AdmissionRequestSecondScr
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
AppTextFieldCustom(
|
|
|
|
|
hintText: TranslationBase.of(context).treatmentLine,
|
|
|
|
|
hintText:
|
|
|
|
|
TranslationBase.of(context).treatmentLine,
|
|
|
|
|
controller: _treatmentLineController,
|
|
|
|
|
inputType: TextInputType.multiline,
|
|
|
|
|
validationError: treatmentsError,
|
|
|
|
|
@ -340,7 +488,8 @@ class _AdmissionRequestSecondScreenState extends State<AdmissionRequestSecondScr
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
AppTextFieldCustom(
|
|
|
|
|
hintText: TranslationBase.of(context).complications,
|
|
|
|
|
hintText:
|
|
|
|
|
TranslationBase.of(context).complications,
|
|
|
|
|
controller: _complicationsController,
|
|
|
|
|
inputType: TextInputType.multiline,
|
|
|
|
|
validationError: complicationsError,
|
|
|
|
|
@ -354,7 +503,8 @@ class _AdmissionRequestSecondScreenState extends State<AdmissionRequestSecondScr
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
AppTextFieldCustom(
|
|
|
|
|
hintText: TranslationBase.of(context).otherProcedure,
|
|
|
|
|
hintText:
|
|
|
|
|
TranslationBase.of(context).otherProcedure,
|
|
|
|
|
controller: _otherProceduresController,
|
|
|
|
|
inputType: TextInputType.multiline,
|
|
|
|
|
validationError: proceduresError,
|
|
|
|
|
@ -369,32 +519,52 @@ class _AdmissionRequestSecondScreenState extends State<AdmissionRequestSecondScr
|
|
|
|
|
),
|
|
|
|
|
AppTextFieldCustom(
|
|
|
|
|
height: screenSize.height * 0.075,
|
|
|
|
|
hintText: TranslationBase.of(context).admissionType,
|
|
|
|
|
dropDownText: _selectedAdmissionType != null ? _selectedAdmissionType['nameEn'] : null,
|
|
|
|
|
hintText:
|
|
|
|
|
TranslationBase.of(context).admissionType,
|
|
|
|
|
dropDownText: _selectedAdmissionType != null
|
|
|
|
|
? _selectedAdmissionType['nameEn']
|
|
|
|
|
: null,
|
|
|
|
|
enabled: false,
|
|
|
|
|
isTextFieldHasSuffix: true,
|
|
|
|
|
validationError: admissionTypeError,
|
|
|
|
|
onClick: model.admissionTypeList != null && model.admissionTypeList.length > 0
|
|
|
|
|
onClick: model.admissionTypeList != null &&
|
|
|
|
|
model.admissionTypeList.length > 0
|
|
|
|
|
? () {
|
|
|
|
|
openListDialogField('nameEn', 'id', model.admissionTypeList, (selectedValue) {
|
|
|
|
|
openListDialogField('nameEn', 'id',
|
|
|
|
|
model.admissionTypeList,
|
|
|
|
|
(selectedValue) {
|
|
|
|
|
setState(() {
|
|
|
|
|
_selectedAdmissionType = selectedValue;
|
|
|
|
|
_selectedAdmissionType =
|
|
|
|
|
selectedValue;
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
: () async {
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
await model.getMasterLookup(MasterKeysService.AdmissionRequestType).then((_) => GifLoaderDialogUtils.hideDialog(context));
|
|
|
|
|
if (model.state == ViewState.Idle && model.admissionTypeList.length > 0) {
|
|
|
|
|
openListDialogField('nameEn', 'id', model.admissionTypeList, (selectedValue) {
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(
|
|
|
|
|
context);
|
|
|
|
|
await model
|
|
|
|
|
.getMasterLookup(MasterKeysService
|
|
|
|
|
.AdmissionRequestType)
|
|
|
|
|
.then((_) =>
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(
|
|
|
|
|
context));
|
|
|
|
|
if (model.state == ViewState.Idle &&
|
|
|
|
|
model.admissionTypeList.length > 0) {
|
|
|
|
|
openListDialogField('nameEn', 'id',
|
|
|
|
|
model.admissionTypeList,
|
|
|
|
|
(selectedValue) {
|
|
|
|
|
setState(() {
|
|
|
|
|
_selectedAdmissionType = selectedValue;
|
|
|
|
|
_selectedAdmissionType =
|
|
|
|
|
selectedValue;
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
} else if (model.state == ViewState.ErrorLocal) {
|
|
|
|
|
DrAppToastMsg.showErrorToast(model.error);
|
|
|
|
|
} else if (model.state ==
|
|
|
|
|
ViewState.ErrorLocal) {
|
|
|
|
|
DrAppToastMsg.showErrorToast(
|
|
|
|
|
model.error);
|
|
|
|
|
} else {
|
|
|
|
|
DrAppToastMsg.showErrorToast("Empty List");
|
|
|
|
|
DrAppToastMsg.showErrorToast(
|
|
|
|
|
"Empty List");
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
onChanged: (value) {},
|
|
|
|
|
@ -447,34 +617,55 @@ class _AdmissionRequestSecondScreenState extends State<AdmissionRequestSecondScr
|
|
|
|
|
_expectedAdmissionDate != null &&
|
|
|
|
|
_otherDepartmentsInterventionsController.text != "" &&
|
|
|
|
|
_selectedFloor != null &&
|
|
|
|
|
_selectedRoomCategory != null /*_selectedWard is not required*/ &&
|
|
|
|
|
_selectedRoomCategory !=
|
|
|
|
|
null /*_selectedWard is not required*/ &&
|
|
|
|
|
_treatmentLineController.text != "" &&
|
|
|
|
|
_complicationsController.text != "" &&
|
|
|
|
|
_otherProceduresController.text != "" &&
|
|
|
|
|
_selectedAdmissionType != null) {
|
|
|
|
|
_selectedAdmissionType != null && _selectedIntendedStayLength != null ) {
|
|
|
|
|
model.admissionRequestData = admissionRequest;
|
|
|
|
|
|
|
|
|
|
model.admissionRequestData!.estimatedCost = int.parse(_estimatedCostController.text);
|
|
|
|
|
model.admissionRequestData!.elementsForImprovement = _postPlansEstimatedCostController.text;
|
|
|
|
|
model.admissionRequestData!.estimatedCost =
|
|
|
|
|
int.parse(_estimatedCostController.text);
|
|
|
|
|
model.admissionRequestData!.elementsForImprovement =
|
|
|
|
|
_postPlansEstimatedCostController.text;
|
|
|
|
|
|
|
|
|
|
model.admissionRequestData!.expectedDays = int.parse(_expectedDaysController.text);
|
|
|
|
|
model.admissionRequestData!.admissionDate = _expectedAdmissionDate!.toIso8601String();
|
|
|
|
|
model.admissionRequestData.otherDepartmentinterventions = _otherDepartmentsInterventionsController.text;
|
|
|
|
|
model.admissionRequestData!.admissionLocationID = _selectedFloor['floorID'];
|
|
|
|
|
model.admissionRequestData!.wardID = _selectedWard != null ? _selectedWard['nursingStationID'] : 0;
|
|
|
|
|
model.admissionRequestData!.roomCategoryID = _selectedRoomCategory['categoryID'];
|
|
|
|
|
model.admissionRequestData!.expectedDays =
|
|
|
|
|
int.parse(_expectedDaysController.text);
|
|
|
|
|
model.admissionRequestData!.admissionDate =
|
|
|
|
|
_expectedAdmissionDate!.toIso8601String();
|
|
|
|
|
model.admissionRequestData.otherDepartmentinterventions =
|
|
|
|
|
_otherDepartmentsInterventionsController.text;
|
|
|
|
|
model.admissionRequestData!.admissionLocationID =
|
|
|
|
|
_selectedFloor['floorID'];
|
|
|
|
|
model.admissionRequestData!.wardID = _selectedWard != null
|
|
|
|
|
? _selectedWard['nursingStationID']
|
|
|
|
|
: 0;
|
|
|
|
|
model.admissionRequestData!.roomCategoryID =
|
|
|
|
|
_selectedRoomCategory['categoryID'];
|
|
|
|
|
|
|
|
|
|
model.admissionRequestData!.admissionRequestProcedures = [];
|
|
|
|
|
|
|
|
|
|
model.admissionRequestData!.mainLineOfTreatment = _treatmentLineController.text;
|
|
|
|
|
model.admissionRequestData!.complications = _complicationsController.text;
|
|
|
|
|
model.admissionRequestData!.otherProcedures = _otherProceduresController.text;
|
|
|
|
|
model.admissionRequestData!.admissionType = _selectedAdmissionType['id'];
|
|
|
|
|
model.admissionRequestData!.mainLineOfTreatment =
|
|
|
|
|
_treatmentLineController.text;
|
|
|
|
|
model.admissionRequestData!.complications =
|
|
|
|
|
_complicationsController.text;
|
|
|
|
|
model.admissionRequestData!.otherProcedures =
|
|
|
|
|
_otherProceduresController.text;
|
|
|
|
|
model.admissionRequestData!.admissionType =
|
|
|
|
|
_selectedAdmissionType['id'];
|
|
|
|
|
model.admissionRequestData.intendedLengthOfStayId = (_selectedIntendedStayLength as MasterKeyModel).id;
|
|
|
|
|
|
|
|
|
|
Navigator.of(context)
|
|
|
|
|
.pushNamed(PATIENT_ADMISSION_REQUEST_3, arguments: {'patient': patient, 'patientType': patientType, 'arrivalType': arrivalType, 'admission-data': model.admissionRequestData});
|
|
|
|
|
.pushNamed(PATIENT_ADMISSION_REQUEST_3, arguments: {
|
|
|
|
|
'patient': patient,
|
|
|
|
|
'patientType': patientType,
|
|
|
|
|
'arrivalType': arrivalType,
|
|
|
|
|
'admission-data': model.admissionRequestData
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
DrAppToastMsg.showErrorToast(TranslationBase.of(context).pleaseFill);
|
|
|
|
|
DrAppToastMsg.showErrorToast(
|
|
|
|
|
TranslationBase.of(context).pleaseFill);
|
|
|
|
|
|
|
|
|
|
setState(() {
|
|
|
|
|
if (_estimatedCostController.text == "") {
|
|
|
|
|
@ -490,23 +681,33 @@ class _AdmissionRequestSecondScreenState extends State<AdmissionRequestSecondScr
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (_expectedDaysController.text == "") {
|
|
|
|
|
expectedDaysError = TranslationBase.of(context).fieldRequired;
|
|
|
|
|
expectedDaysError =
|
|
|
|
|
TranslationBase.of(context).fieldRequired;
|
|
|
|
|
} else {
|
|
|
|
|
expectedDaysError = "";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (_expectedAdmissionDate == null) {
|
|
|
|
|
expectedDatesError = TranslationBase.of(context).fieldRequired;
|
|
|
|
|
expectedDatesError =
|
|
|
|
|
TranslationBase.of(context).fieldRequired;
|
|
|
|
|
} else {
|
|
|
|
|
expectedDatesError = "";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (_otherDepartmentsInterventionsController.text == "") {
|
|
|
|
|
otherInterventionsError = TranslationBase.of(context).fieldRequired;
|
|
|
|
|
otherInterventionsError =
|
|
|
|
|
TranslationBase.of(context).fieldRequired;
|
|
|
|
|
} else {
|
|
|
|
|
otherInterventionsError = "";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (_selectedIntendedStayLength == null ) {
|
|
|
|
|
stayLengthError =
|
|
|
|
|
TranslationBase.of(context).fieldRequired;
|
|
|
|
|
} else {
|
|
|
|
|
stayLengthError = "";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (_selectedFloor == null) {
|
|
|
|
|
floorError = TranslationBase.of(context).fieldRequired;
|
|
|
|
|
} else {
|
|
|
|
|
@ -520,25 +721,29 @@ class _AdmissionRequestSecondScreenState extends State<AdmissionRequestSecondScr
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (_treatmentLineController.text == "") {
|
|
|
|
|
treatmentsError = TranslationBase.of(context).fieldRequired;
|
|
|
|
|
treatmentsError =
|
|
|
|
|
TranslationBase.of(context).fieldRequired;
|
|
|
|
|
} else {
|
|
|
|
|
treatmentsError = "";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (_complicationsController.text == "") {
|
|
|
|
|
complicationsError = TranslationBase.of(context).fieldRequired;
|
|
|
|
|
complicationsError =
|
|
|
|
|
TranslationBase.of(context).fieldRequired;
|
|
|
|
|
} else {
|
|
|
|
|
complicationsError = "";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (_otherProceduresController.text == "") {
|
|
|
|
|
proceduresError = TranslationBase.of(context).fieldRequired;
|
|
|
|
|
proceduresError =
|
|
|
|
|
TranslationBase.of(context).fieldRequired;
|
|
|
|
|
} else {
|
|
|
|
|
proceduresError = "";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (_selectedAdmissionType == null) {
|
|
|
|
|
admissionTypeError = TranslationBase.of(context).fieldRequired;
|
|
|
|
|
admissionTypeError =
|
|
|
|
|
TranslationBase.of(context).fieldRequired;
|
|
|
|
|
} else {
|
|
|
|
|
admissionTypeError = "";
|
|
|
|
|
}
|
|
|
|
|
@ -553,7 +758,8 @@ class _AdmissionRequestSecondScreenState extends State<AdmissionRequestSecondScr
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future _selectDate(BuildContext context, DateTime dateTime, Function(DateTime picked) updateDate) async {
|
|
|
|
|
Future _selectDate(BuildContext context, DateTime dateTime,
|
|
|
|
|
Function(DateTime picked) updateDate) async {
|
|
|
|
|
final DateTime? picked = await showDatePicker(
|
|
|
|
|
context: context,
|
|
|
|
|
initialDate: dateTime,
|
|
|
|
|
@ -566,7 +772,8 @@ class _AdmissionRequestSecondScreenState extends State<AdmissionRequestSecondScr
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void openListDialogField(String attributeName, String attributeValueId, List<dynamic> list, Function(dynamic selectedValue) okFunction) {
|
|
|
|
|
void openListDialogField(String attributeName, String attributeValueId,
|
|
|
|
|
List<dynamic> list, Function(dynamic selectedValue) okFunction) {
|
|
|
|
|
ListSelectDialog dialog = ListSelectDialog(
|
|
|
|
|
list: list,
|
|
|
|
|
attributeName: attributeName,
|
|
|
|
|
|