|
|
|
|
@ -28,13 +28,12 @@ import 'package:speech_to_text/speech_to_text.dart' as stt;
|
|
|
|
|
|
|
|
|
|
class PatientMakeInPatientReferralScreen extends StatefulWidget {
|
|
|
|
|
@override
|
|
|
|
|
_PatientMakeInPatientReferralScreenState createState() =>
|
|
|
|
|
_PatientMakeInPatientReferralScreenState();
|
|
|
|
|
_PatientMakeInPatientReferralScreenState createState() => _PatientMakeInPatientReferralScreenState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class _PatientMakeInPatientReferralScreenState extends State<PatientMakeInPatientReferralScreen>{
|
|
|
|
|
PatiantInformtion patient;
|
|
|
|
|
List<dynamic> referToList;
|
|
|
|
|
class _PatientMakeInPatientReferralScreenState extends State<PatientMakeInPatientReferralScreen> {
|
|
|
|
|
PatiantInformtion? patient;
|
|
|
|
|
List<dynamic>? referToList;
|
|
|
|
|
dynamic _referTo;
|
|
|
|
|
dynamic _selectedBranch;
|
|
|
|
|
dynamic _selectedClinic;
|
|
|
|
|
@ -44,19 +43,17 @@ class _PatientMakeInPatientReferralScreenState extends State<PatientMakeInPatien
|
|
|
|
|
final _remarksController = TextEditingController();
|
|
|
|
|
final _extController = TextEditingController();
|
|
|
|
|
int _activePriority = 1;
|
|
|
|
|
String appointmentDate;
|
|
|
|
|
String branchError;
|
|
|
|
|
String hospitalError;
|
|
|
|
|
String clinicError;
|
|
|
|
|
String doctorError;
|
|
|
|
|
String frequencyError;
|
|
|
|
|
String remarkError;
|
|
|
|
|
String? appointmentDate;
|
|
|
|
|
String? branchError;
|
|
|
|
|
String? hospitalError;
|
|
|
|
|
String? clinicError;
|
|
|
|
|
String? doctorError;
|
|
|
|
|
String? frequencyError;
|
|
|
|
|
String? remarkError;
|
|
|
|
|
stt.SpeechToText speech = stt.SpeechToText();
|
|
|
|
|
var recognizedWord;
|
|
|
|
|
var event = RobotProvider();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
requestPermissions();
|
|
|
|
|
@ -73,8 +70,7 @@ class _PatientMakeInPatientReferralScreenState extends State<PatientMakeInPatien
|
|
|
|
|
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,
|
|
|
|
|
@ -118,15 +114,13 @@ class _PatientMakeInPatientReferralScreenState extends State<PatientMakeInPatien
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
|
|
|
|
|
dynamic priority1 = {
|
|
|
|
|
"ParameterCode": 1,
|
|
|
|
|
"Description": TranslationBase.of(context).veryUrgent.toUpperCase(),
|
|
|
|
|
@ -145,503 +139,427 @@ class _PatientMakeInPatientReferralScreenState extends State<PatientMakeInPatien
|
|
|
|
|
_priorityList.add(priority2);
|
|
|
|
|
_priorityList.add(priority3);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final routeArgs = ModalRoute.of(context).settings.arguments as Map;
|
|
|
|
|
final routeArgs = ModalRoute.of(context)!.settings.arguments as Map;
|
|
|
|
|
patient = routeArgs['patient'];
|
|
|
|
|
bool isInpatient = routeArgs['isInpatient'];
|
|
|
|
|
referToList = [];
|
|
|
|
|
dynamic sameBranch = {
|
|
|
|
|
"id": 1,
|
|
|
|
|
"name": TranslationBase.of(context).sameBranch
|
|
|
|
|
};
|
|
|
|
|
dynamic otherBranch = {
|
|
|
|
|
"id": 2,
|
|
|
|
|
"name": TranslationBase.of(context).otherBranch
|
|
|
|
|
};
|
|
|
|
|
referToList.add(sameBranch);
|
|
|
|
|
referToList.add(otherBranch);
|
|
|
|
|
dynamic sameBranch = {"id": 1, "name": TranslationBase.of(context).sameBranch};
|
|
|
|
|
dynamic otherBranch = {"id": 2, "name": TranslationBase.of(context).otherBranch};
|
|
|
|
|
referToList!.add(sameBranch);
|
|
|
|
|
referToList!.add(otherBranch);
|
|
|
|
|
|
|
|
|
|
final screenSize = MediaQuery.of(context).size;
|
|
|
|
|
|
|
|
|
|
return BaseView<PatientReferralViewModel>(
|
|
|
|
|
onModelReady: (model) => model.getReferralFrequencyList(),
|
|
|
|
|
builder: (_, model, w) => AppScaffold(
|
|
|
|
|
baseViewModel: model,
|
|
|
|
|
appBarTitle: TranslationBase.of(context).referPatient,
|
|
|
|
|
isShowAppBar: true,
|
|
|
|
|
appBar: PatientProfileAppBar(
|
|
|
|
|
patient,
|
|
|
|
|
isInpatient: isInpatient,
|
|
|
|
|
),
|
|
|
|
|
body: SingleChildScrollView(
|
|
|
|
|
child: Container(
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
|
|
|
children: [
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.all(8.0),
|
|
|
|
|
child: ServiceTitle(
|
|
|
|
|
title: TranslationBase.of(context).refer,
|
|
|
|
|
subTitle: TranslationBase.of(context).patient,
|
|
|
|
|
baseViewModel: model,
|
|
|
|
|
appBarTitle: TranslationBase.of(context).referPatient,
|
|
|
|
|
isShowAppBar: true,
|
|
|
|
|
appBar: PatientProfileAppBar(
|
|
|
|
|
patient!,
|
|
|
|
|
isInpatient: isInpatient,
|
|
|
|
|
),
|
|
|
|
|
body: SingleChildScrollView(
|
|
|
|
|
child: Container(
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
|
|
|
children: [
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.symmetric(vertical: 0, horizontal: 16),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
AppTextFieldCustom(
|
|
|
|
|
height: screenSize.height * 0.075,
|
|
|
|
|
hintText: TranslationBase.of(context).branch,
|
|
|
|
|
dropDownText:
|
|
|
|
|
_referTo != null ? _referTo['name'] : null,
|
|
|
|
|
enabled: false,
|
|
|
|
|
isTextFieldHasSuffix: true,
|
|
|
|
|
validationError: branchError,
|
|
|
|
|
onClick: referToList != null
|
|
|
|
|
? () {
|
|
|
|
|
ListSelectDialog dialog = ListSelectDialog(
|
|
|
|
|
list: referToList,
|
|
|
|
|
attributeName: 'name',
|
|
|
|
|
attributeValueId: 'id',
|
|
|
|
|
okText: TranslationBase.of(context).ok,
|
|
|
|
|
okFunction: (selectedValue) {
|
|
|
|
|
setState(() {
|
|
|
|
|
_referTo = selectedValue;
|
|
|
|
|
_selectedBranch = null;
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.all(8.0),
|
|
|
|
|
child: ServiceTitle(
|
|
|
|
|
title: TranslationBase.of(context).refer,
|
|
|
|
|
subTitle: TranslationBase.of(context).patient,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.symmetric(vertical: 0, horizontal: 16),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
AppTextFieldCustom(
|
|
|
|
|
height: screenSize.height * 0.075,
|
|
|
|
|
hintText: TranslationBase.of(context).branch,
|
|
|
|
|
dropDownText: _referTo != null ? _referTo['name'] : null,
|
|
|
|
|
enabled: false,
|
|
|
|
|
isTextFieldHasSuffix: true,
|
|
|
|
|
validationError: branchError!,
|
|
|
|
|
onClick: referToList != null
|
|
|
|
|
? () {
|
|
|
|
|
ListSelectDialog dialog = ListSelectDialog(
|
|
|
|
|
list: referToList!,
|
|
|
|
|
attributeName: 'name',
|
|
|
|
|
attributeValueId: 'id',
|
|
|
|
|
okText: TranslationBase.of(context).ok,
|
|
|
|
|
okFunction: (selectedValue) {
|
|
|
|
|
setState(() {
|
|
|
|
|
_referTo = selectedValue;
|
|
|
|
|
_selectedBranch = null;
|
|
|
|
|
_selectedClinic = null;
|
|
|
|
|
_selectedDoctor = null;
|
|
|
|
|
model.getDoctorBranch().then((value) async {
|
|
|
|
|
_selectedBranch = value;
|
|
|
|
|
if (_referTo['id'] == 1) {
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
await model.getClinics(_selectedBranch['facilityId']).then((_) => GifLoaderDialogUtils.hideDialog(context));
|
|
|
|
|
if (model.state == ViewState.ErrorLocal) {
|
|
|
|
|
DrAppToastMsg.showErrorToast(model.error);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
_selectedBranch = null;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
showDialog(
|
|
|
|
|
barrierDismissible: false,
|
|
|
|
|
context: context,
|
|
|
|
|
builder: (BuildContext context) {
|
|
|
|
|
return dialog;
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
: () {},
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
AppTextFieldCustom(
|
|
|
|
|
height: screenSize.height * 0.075,
|
|
|
|
|
hintText: TranslationBase.of(context).hospital,
|
|
|
|
|
dropDownText: _selectedBranch != null ? _selectedBranch['facilityName'] : null,
|
|
|
|
|
enabled: false,
|
|
|
|
|
isTextFieldHasSuffix: true,
|
|
|
|
|
validationError: hospitalError!,
|
|
|
|
|
onClick: model.branchesList != null && model.branchesList.length > 0 && _referTo != null && _referTo['id'] == 2
|
|
|
|
|
? () {
|
|
|
|
|
ListSelectDialog dialog = ListSelectDialog(
|
|
|
|
|
list: model.branchesList,
|
|
|
|
|
attributeName: 'facilityName',
|
|
|
|
|
attributeValueId: 'facilityId',
|
|
|
|
|
okText: TranslationBase.of(context).ok,
|
|
|
|
|
okFunction: (selectedValue) async {
|
|
|
|
|
_selectedBranch = selectedValue;
|
|
|
|
|
_selectedClinic = null;
|
|
|
|
|
_selectedDoctor = null;
|
|
|
|
|
model
|
|
|
|
|
.getDoctorBranch()
|
|
|
|
|
.then((value) async {
|
|
|
|
|
_selectedBranch = value;
|
|
|
|
|
if (_referTo['id'] == 1) {
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(
|
|
|
|
|
context);
|
|
|
|
|
await model
|
|
|
|
|
.getClinics(_selectedBranch[
|
|
|
|
|
'facilityId'])
|
|
|
|
|
.then((_) =>
|
|
|
|
|
GifLoaderDialogUtils
|
|
|
|
|
.hideDialog(context));
|
|
|
|
|
if (model.state ==
|
|
|
|
|
ViewState.ErrorLocal) {
|
|
|
|
|
DrAppToastMsg.showErrorToast(
|
|
|
|
|
model.error);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
_selectedBranch = null;
|
|
|
|
|
}
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
await model.getClinics(_selectedBranch['facilityId']).then((_) => GifLoaderDialogUtils.hideDialog(context));
|
|
|
|
|
if (model.state == ViewState.ErrorLocal) {
|
|
|
|
|
DrAppToastMsg.showErrorToast(model.error);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
showDialog(
|
|
|
|
|
barrierDismissible: false,
|
|
|
|
|
context: context,
|
|
|
|
|
builder: (BuildContext context) {
|
|
|
|
|
return dialog;
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
: () {},
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
AppTextFieldCustom(
|
|
|
|
|
height: screenSize.height * 0.075,
|
|
|
|
|
hintText: TranslationBase.of(context).clinic,
|
|
|
|
|
dropDownText: _selectedClinic != null ? _selectedClinic['ClinicDescription'] : null,
|
|
|
|
|
enabled: false,
|
|
|
|
|
isTextFieldHasSuffix: true,
|
|
|
|
|
validationError: clinicError!,
|
|
|
|
|
onClick: _selectedBranch != null && model.clinicsList != null && model.clinicsList.length > 0
|
|
|
|
|
? () {
|
|
|
|
|
ListSelectDialog dialog = ListSelectDialog(
|
|
|
|
|
list: model.clinicsList,
|
|
|
|
|
attributeName: 'ClinicDescription',
|
|
|
|
|
attributeValueId: 'ClinicID',
|
|
|
|
|
usingSearch: true,
|
|
|
|
|
hintSearchText: TranslationBase.of(context).clinicSearch,
|
|
|
|
|
okText: TranslationBase.of(context).ok,
|
|
|
|
|
okFunction: (selectedValue) async {
|
|
|
|
|
_selectedDoctor = null;
|
|
|
|
|
_selectedClinic = selectedValue;
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
await model.getClinicDoctors(patient!, _selectedClinic['ClinicID'], _selectedBranch['facilityId']).then((_) => GifLoaderDialogUtils.hideDialog(context));
|
|
|
|
|
if (model.state == ViewState.ErrorLocal) {
|
|
|
|
|
DrAppToastMsg.showErrorToast(model.error);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
showDialog(
|
|
|
|
|
barrierDismissible: false,
|
|
|
|
|
context: context,
|
|
|
|
|
builder: (BuildContext context) {
|
|
|
|
|
return dialog;
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
: () {},
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
AppTextFieldCustom(
|
|
|
|
|
height: screenSize.height * 0.075,
|
|
|
|
|
hintText: TranslationBase.of(context).doctor,
|
|
|
|
|
dropDownText: _selectedDoctor != null ? _selectedDoctor['Name'] : null,
|
|
|
|
|
enabled: false,
|
|
|
|
|
isTextFieldHasSuffix: true,
|
|
|
|
|
validationError: doctorError!,
|
|
|
|
|
onClick: _selectedClinic != null && model.doctorsList != null && model.doctorsList.length > 0
|
|
|
|
|
? () {
|
|
|
|
|
ListSelectDialog dialog = ListSelectDialog(
|
|
|
|
|
list: model.doctorsList,
|
|
|
|
|
attributeName: 'Name',
|
|
|
|
|
attributeValueId: 'DoctorID',
|
|
|
|
|
usingSearch: true,
|
|
|
|
|
hintSearchText: TranslationBase.of(context).doctorSearch,
|
|
|
|
|
okText: TranslationBase.of(context).ok,
|
|
|
|
|
okFunction: (selectedValue) {
|
|
|
|
|
setState(() {
|
|
|
|
|
_selectedDoctor = selectedValue;
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
showDialog(
|
|
|
|
|
barrierDismissible: false,
|
|
|
|
|
context: context,
|
|
|
|
|
builder: (BuildContext context) {
|
|
|
|
|
return dialog;
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
: null,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
AppTextFieldCustom(
|
|
|
|
|
height: screenSize.height * 0.075,
|
|
|
|
|
hintText: TranslationBase.of(context).hospital,
|
|
|
|
|
dropDownText: _selectedBranch != null
|
|
|
|
|
? _selectedBranch['facilityName']
|
|
|
|
|
: null,
|
|
|
|
|
enabled: false,
|
|
|
|
|
isTextFieldHasSuffix: true,
|
|
|
|
|
validationError: hospitalError,
|
|
|
|
|
onClick: model.branchesList != null &&
|
|
|
|
|
model.branchesList.length > 0 &&
|
|
|
|
|
_referTo != null &&
|
|
|
|
|
_referTo['id'] == 2
|
|
|
|
|
? () {
|
|
|
|
|
ListSelectDialog dialog = ListSelectDialog(
|
|
|
|
|
list: model.branchesList,
|
|
|
|
|
attributeName: 'facilityName',
|
|
|
|
|
attributeValueId: 'facilityId',
|
|
|
|
|
okText: TranslationBase.of(context).ok,
|
|
|
|
|
okFunction: (selectedValue) async {
|
|
|
|
|
_selectedBranch = selectedValue;
|
|
|
|
|
_selectedClinic = null;
|
|
|
|
|
_selectedDoctor = null;
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(
|
|
|
|
|
context);
|
|
|
|
|
await model
|
|
|
|
|
.getClinics(
|
|
|
|
|
_selectedBranch['facilityId'])
|
|
|
|
|
.then((_) =>
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(
|
|
|
|
|
context));
|
|
|
|
|
if (model.state ==
|
|
|
|
|
ViewState.ErrorLocal) {
|
|
|
|
|
DrAppToastMsg.showErrorToast(
|
|
|
|
|
model.error);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
showDialog(
|
|
|
|
|
barrierDismissible: false,
|
|
|
|
|
context: context,
|
|
|
|
|
builder: (BuildContext context) {
|
|
|
|
|
return dialog;
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
: null,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
AppTextFieldCustom(
|
|
|
|
|
height: screenSize.height * 0.075,
|
|
|
|
|
hintText: TranslationBase.of(context).clinic,
|
|
|
|
|
dropDownText: _selectedClinic != null
|
|
|
|
|
? _selectedClinic['ClinicDescription']
|
|
|
|
|
: null,
|
|
|
|
|
enabled: false,
|
|
|
|
|
isTextFieldHasSuffix: true,
|
|
|
|
|
validationError: clinicError,
|
|
|
|
|
onClick: _selectedBranch != null &&
|
|
|
|
|
model.clinicsList != null &&
|
|
|
|
|
model.clinicsList.length > 0
|
|
|
|
|
? () {
|
|
|
|
|
ListSelectDialog dialog = ListSelectDialog(
|
|
|
|
|
list: model.clinicsList,
|
|
|
|
|
attributeName: 'ClinicDescription',
|
|
|
|
|
attributeValueId: 'ClinicID',
|
|
|
|
|
usingSearch: true,
|
|
|
|
|
hintSearchText:
|
|
|
|
|
TranslationBase.of(context)
|
|
|
|
|
.clinicSearch,
|
|
|
|
|
okText: TranslationBase.of(context).ok,
|
|
|
|
|
okFunction: (selectedValue) async {
|
|
|
|
|
_selectedDoctor = null;
|
|
|
|
|
_selectedClinic = selectedValue;
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(
|
|
|
|
|
context);
|
|
|
|
|
await model
|
|
|
|
|
.getClinicDoctors(
|
|
|
|
|
patient,
|
|
|
|
|
_selectedClinic['ClinicID'],
|
|
|
|
|
_selectedBranch['facilityId'])
|
|
|
|
|
.then((_) =>
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(
|
|
|
|
|
context));
|
|
|
|
|
if (model.state ==
|
|
|
|
|
ViewState.ErrorLocal) {
|
|
|
|
|
DrAppToastMsg.showErrorToast(
|
|
|
|
|
model.error);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
showDialog(
|
|
|
|
|
barrierDismissible: false,
|
|
|
|
|
context: context,
|
|
|
|
|
builder: (BuildContext context) {
|
|
|
|
|
return dialog;
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
: null,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
AppTextFieldCustom(
|
|
|
|
|
height: screenSize.height * 0.075,
|
|
|
|
|
hintText: TranslationBase.of(context).doctor,
|
|
|
|
|
dropDownText: _selectedDoctor != null
|
|
|
|
|
? _selectedDoctor['Name']
|
|
|
|
|
: null,
|
|
|
|
|
enabled: false,
|
|
|
|
|
isTextFieldHasSuffix: true,
|
|
|
|
|
validationError: doctorError,
|
|
|
|
|
onClick: _selectedClinic != null &&
|
|
|
|
|
model.doctorsList != null &&
|
|
|
|
|
model.doctorsList.length > 0
|
|
|
|
|
? () {
|
|
|
|
|
ListSelectDialog dialog = ListSelectDialog(
|
|
|
|
|
list: model.doctorsList,
|
|
|
|
|
attributeName: 'Name',
|
|
|
|
|
attributeValueId: 'DoctorID',
|
|
|
|
|
usingSearch: true,
|
|
|
|
|
hintSearchText:
|
|
|
|
|
TranslationBase.of(context)
|
|
|
|
|
.doctorSearch,
|
|
|
|
|
okText: TranslationBase.of(context).ok,
|
|
|
|
|
okFunction: (selectedValue) {
|
|
|
|
|
setState(() {
|
|
|
|
|
_selectedDoctor = selectedValue;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
showDialog(
|
|
|
|
|
barrierDismissible: false,
|
|
|
|
|
context: context,
|
|
|
|
|
builder: (BuildContext context) {
|
|
|
|
|
return dialog;
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
: () {
|
|
|
|
|
if (_selectedClinic == null) {
|
|
|
|
|
DrAppToastMsg.showErrorToast(
|
|
|
|
|
"You need to select a clinic first");
|
|
|
|
|
} else if (model.doctorsList == null ||
|
|
|
|
|
model.doctorsList.length == 0) {
|
|
|
|
|
DrAppToastMsg.showErrorToast(
|
|
|
|
|
"There is no doctors for this clinic");
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
showDialog(
|
|
|
|
|
barrierDismissible: false,
|
|
|
|
|
context: context,
|
|
|
|
|
builder: (BuildContext context) {
|
|
|
|
|
return dialog;
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
: () {
|
|
|
|
|
if (_selectedClinic == null) {
|
|
|
|
|
DrAppToastMsg.showErrorToast("You need to select a clinic first");
|
|
|
|
|
} else if (model.doctorsList == null || model.doctorsList.length == 0) {
|
|
|
|
|
DrAppToastMsg.showErrorToast("There is no doctors for this clinic");
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
AppTextFieldCustom(
|
|
|
|
|
height: screenSize.height * 0.075,
|
|
|
|
|
hintText: TranslationBase.of(context).priority,
|
|
|
|
|
dropDownText: _selectedPriority != null ? _selectedPriority['Description'] : null,
|
|
|
|
|
enabled: false,
|
|
|
|
|
isTextFieldHasSuffix: true,
|
|
|
|
|
validationError: frequencyError!,
|
|
|
|
|
onClick: () {
|
|
|
|
|
ListSelectDialog dialog = ListSelectDialog(
|
|
|
|
|
list: _priorityList,
|
|
|
|
|
attributeName: 'Description',
|
|
|
|
|
attributeValueId: 'Description',
|
|
|
|
|
usingSearch: false,
|
|
|
|
|
okText: TranslationBase.of(context).ok,
|
|
|
|
|
okFunction: (selectedValue) {
|
|
|
|
|
setState(() {
|
|
|
|
|
_selectedPriority = selectedValue;
|
|
|
|
|
_activePriority = selectedValue["ParameterCode"];
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
AppTextFieldCustom(
|
|
|
|
|
height: screenSize.height * 0.075,
|
|
|
|
|
hintText:
|
|
|
|
|
TranslationBase.of(context).priority,
|
|
|
|
|
dropDownText: _selectedPriority != null
|
|
|
|
|
? _selectedPriority['Description']
|
|
|
|
|
: null,
|
|
|
|
|
enabled: false,
|
|
|
|
|
isTextFieldHasSuffix: true,
|
|
|
|
|
validationError: frequencyError,
|
|
|
|
|
onClick: () {
|
|
|
|
|
ListSelectDialog dialog = ListSelectDialog(
|
|
|
|
|
list: _priorityList,
|
|
|
|
|
attributeName: 'Description',
|
|
|
|
|
attributeValueId: 'Description',
|
|
|
|
|
usingSearch: false,
|
|
|
|
|
okText: TranslationBase.of(context).ok,
|
|
|
|
|
okFunction: (selectedValue) {
|
|
|
|
|
setState(() {
|
|
|
|
|
_selectedPriority = selectedValue;
|
|
|
|
|
_activePriority = selectedValue["ParameterCode"];
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
showDialog(
|
|
|
|
|
barrierDismissible: false,
|
|
|
|
|
context: context,
|
|
|
|
|
builder: (BuildContext context) {
|
|
|
|
|
return dialog;
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.all(4.0),
|
|
|
|
|
child: AppText(
|
|
|
|
|
"${TranslationBase.of(context).replayBefore}: ${getPriority()}",
|
|
|
|
|
fontWeight: FontWeight.normal,
|
|
|
|
|
fontSize: SizeConfig.textMultiplier * 1.9,
|
|
|
|
|
);
|
|
|
|
|
showDialog(
|
|
|
|
|
barrierDismissible: false,
|
|
|
|
|
context: context,
|
|
|
|
|
builder: (BuildContext context) {
|
|
|
|
|
return dialog;
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
AppTextFieldCustom(
|
|
|
|
|
height: screenSize.height * 0.075,
|
|
|
|
|
hintText:
|
|
|
|
|
TranslationBase.of(context).referralFrequency,
|
|
|
|
|
dropDownText: _selectedFrequency != null
|
|
|
|
|
? _selectedFrequency['Description']
|
|
|
|
|
: null,
|
|
|
|
|
enabled: false,
|
|
|
|
|
isTextFieldHasSuffix: true,
|
|
|
|
|
validationError: frequencyError,
|
|
|
|
|
onClick: () {
|
|
|
|
|
ListSelectDialog dialog = ListSelectDialog(
|
|
|
|
|
list: model.referralFrequencyList,
|
|
|
|
|
attributeName: 'Description',
|
|
|
|
|
attributeValueId: 'ParameterCode',
|
|
|
|
|
usingSearch: true,
|
|
|
|
|
hintSearchText: TranslationBase.of(context)
|
|
|
|
|
.selectReferralFrequency,
|
|
|
|
|
okText: TranslationBase.of(context).ok,
|
|
|
|
|
okFunction: (selectedValue) {
|
|
|
|
|
setState(() {
|
|
|
|
|
_selectedFrequency = selectedValue;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
showDialog(
|
|
|
|
|
barrierDismissible: false,
|
|
|
|
|
context: context,
|
|
|
|
|
builder: (BuildContext context) {
|
|
|
|
|
return dialog;
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
AppTextFieldCustom(
|
|
|
|
|
hintText: TranslationBase.of(context).ext,
|
|
|
|
|
controller: _extController,
|
|
|
|
|
inputType: TextInputType.text,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
Stack(
|
|
|
|
|
children: [
|
|
|
|
|
AppTextFieldCustom(
|
|
|
|
|
validationError: remarkError,
|
|
|
|
|
hintText: "Remarks",
|
|
|
|
|
controller: _remarksController,
|
|
|
|
|
inputType: TextInputType.multiline,
|
|
|
|
|
minLines: 4,
|
|
|
|
|
maxLines: 6,
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.all(4.0),
|
|
|
|
|
child: AppText(
|
|
|
|
|
"${TranslationBase.of(context).replayBefore}: ${getPriority()}",
|
|
|
|
|
fontWeight: FontWeight.normal,
|
|
|
|
|
fontSize: SizeConfig.textMultiplier! * 1.9,
|
|
|
|
|
),
|
|
|
|
|
Positioned(
|
|
|
|
|
top: 0,
|
|
|
|
|
right: 15,
|
|
|
|
|
child: IconButton(
|
|
|
|
|
icon: Icon(
|
|
|
|
|
DoctorApp.speechtotext,
|
|
|
|
|
color: Colors.black,
|
|
|
|
|
size: 35,
|
|
|
|
|
),
|
|
|
|
|
onPressed: () {
|
|
|
|
|
initSpeechState()
|
|
|
|
|
.then((value) => {onVoiceText()});
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
AppTextFieldCustom(
|
|
|
|
|
height: screenSize.height * 0.075,
|
|
|
|
|
hintText: TranslationBase.of(context).referralFrequency,
|
|
|
|
|
dropDownText: _selectedFrequency != null ? _selectedFrequency['Description'] : null,
|
|
|
|
|
enabled: false,
|
|
|
|
|
isTextFieldHasSuffix: true,
|
|
|
|
|
validationError: frequencyError!,
|
|
|
|
|
onClick: () {
|
|
|
|
|
ListSelectDialog dialog = ListSelectDialog(
|
|
|
|
|
list: model.referralFrequencyList,
|
|
|
|
|
attributeName: 'Description',
|
|
|
|
|
attributeValueId: 'ParameterCode',
|
|
|
|
|
usingSearch: true,
|
|
|
|
|
hintSearchText: TranslationBase.of(context).selectReferralFrequency,
|
|
|
|
|
okText: TranslationBase.of(context).ok,
|
|
|
|
|
okFunction: (selectedValue) {
|
|
|
|
|
setState(() {
|
|
|
|
|
_selectedFrequency = selectedValue;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
showDialog(
|
|
|
|
|
barrierDismissible: false,
|
|
|
|
|
context: context,
|
|
|
|
|
builder: (BuildContext context) {
|
|
|
|
|
return dialog;
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
AppTextFieldCustom(
|
|
|
|
|
hintText: TranslationBase.of(context).ext,
|
|
|
|
|
controller: _extController,
|
|
|
|
|
inputType: TextInputType.text,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
Stack(
|
|
|
|
|
children: [
|
|
|
|
|
AppTextFieldCustom(
|
|
|
|
|
validationError: remarkError!,
|
|
|
|
|
hintText: "Remarks",
|
|
|
|
|
controller: _remarksController,
|
|
|
|
|
inputType: TextInputType.multiline,
|
|
|
|
|
minLines: 4,
|
|
|
|
|
maxLines: 6,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 100,
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
Positioned(
|
|
|
|
|
top: 0,
|
|
|
|
|
right: 15,
|
|
|
|
|
child: IconButton(
|
|
|
|
|
icon: Icon(
|
|
|
|
|
DoctorApp.speechtotext,
|
|
|
|
|
color: Colors.black,
|
|
|
|
|
size: 35,
|
|
|
|
|
),
|
|
|
|
|
onPressed: () {
|
|
|
|
|
initSpeechState().then((value) => {onVoiceText()});
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 100,
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
Column(
|
|
|
|
|
children: [
|
|
|
|
|
_remarksController.text.isEmpty
|
|
|
|
|
? SizedBox()
|
|
|
|
|
: Container(
|
|
|
|
|
margin: EdgeInsets.all(5),
|
|
|
|
|
child: AppButton(
|
|
|
|
|
title: TranslationBase.of(context).clearText,
|
|
|
|
|
onPressed: () {
|
|
|
|
|
setState(() {
|
|
|
|
|
_remarksController.text = '';
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
)),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
Column(
|
|
|
|
|
children: [
|
|
|
|
|
_remarksController.text.isEmpty
|
|
|
|
|
? SizedBox()
|
|
|
|
|
: Container(
|
|
|
|
|
margin: EdgeInsets.all(5),
|
|
|
|
|
child: AppButton(
|
|
|
|
|
title: TranslationBase.of(context).clearText,
|
|
|
|
|
onPressed: () {
|
|
|
|
|
setState(() {
|
|
|
|
|
_remarksController.text = '';
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
)),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 10,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
bottomSheet:
|
|
|
|
|
model.state != ViewState.Idle
|
|
|
|
|
bottomSheet: model.state != ViewState.Idle
|
|
|
|
|
? Container(
|
|
|
|
|
height: 0,
|
|
|
|
|
)
|
|
|
|
|
:CustomBottomSheetContainer(
|
|
|
|
|
label: "${TranslationBase.of(context).refer}",
|
|
|
|
|
onTap: () async {
|
|
|
|
|
setState(() {
|
|
|
|
|
if (_referTo == null) {
|
|
|
|
|
branchError =
|
|
|
|
|
TranslationBase.of(context).fieldRequired;
|
|
|
|
|
} else {
|
|
|
|
|
branchError = null;
|
|
|
|
|
}
|
|
|
|
|
if (_selectedBranch == null) {
|
|
|
|
|
hospitalError =
|
|
|
|
|
TranslationBase.of(context).fieldRequired;
|
|
|
|
|
} else {
|
|
|
|
|
hospitalError = null;
|
|
|
|
|
}
|
|
|
|
|
if (_selectedClinic == null) {
|
|
|
|
|
clinicError =
|
|
|
|
|
TranslationBase.of(context).fieldRequired;
|
|
|
|
|
} else {
|
|
|
|
|
clinicError = null;
|
|
|
|
|
}
|
|
|
|
|
if (_selectedDoctor == null) {
|
|
|
|
|
doctorError =
|
|
|
|
|
TranslationBase.of(context).fieldRequired;
|
|
|
|
|
} else {
|
|
|
|
|
doctorError = null;
|
|
|
|
|
}
|
|
|
|
|
if (_selectedFrequency == null) {
|
|
|
|
|
frequencyError =
|
|
|
|
|
TranslationBase.of(context).fieldRequired;
|
|
|
|
|
} else {
|
|
|
|
|
frequencyError = null;
|
|
|
|
|
}
|
|
|
|
|
if (_selectedPriority == null) {
|
|
|
|
|
remarkError =
|
|
|
|
|
TranslationBase.of(context).fieldRequired;
|
|
|
|
|
} else {
|
|
|
|
|
remarkError = null;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
if (_selectedFrequency == null ||
|
|
|
|
|
_selectedPriority == null ||
|
|
|
|
|
_selectedBranch == null ||
|
|
|
|
|
_selectedClinic == null ||
|
|
|
|
|
_selectedDoctor == null ||
|
|
|
|
|
_remarksController.text == null ||
|
|
|
|
|
_extController.text == null) return;
|
|
|
|
|
{
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
await model.makeInPatientReferral(
|
|
|
|
|
patient: patient,
|
|
|
|
|
projectID: _selectedBranch['facilityId'],
|
|
|
|
|
clinicID: _selectedClinic['ClinicID'],
|
|
|
|
|
doctorID: _selectedDoctor['DoctorID'],
|
|
|
|
|
frequencyCode:
|
|
|
|
|
_selectedFrequency['ParameterCode'],
|
|
|
|
|
ext: _extController.text,
|
|
|
|
|
remarks: _remarksController.text,
|
|
|
|
|
priority: _activePriority,
|
|
|
|
|
referralDate: appointmentDate,
|
|
|
|
|
isLocalBusy: true);
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
if (model.state == ViewState.ErrorLocal)
|
|
|
|
|
DrAppToastMsg.showErrorToast(model.error);
|
|
|
|
|
else {
|
|
|
|
|
DrAppToastMsg.showSuccesToast(
|
|
|
|
|
TranslationBase.of(context)
|
|
|
|
|
.referralSuccessMsg);
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
)
|
|
|
|
|
),
|
|
|
|
|
height: 0,
|
|
|
|
|
)
|
|
|
|
|
: CustomBottomSheetContainer(
|
|
|
|
|
label: "${TranslationBase.of(context).refer}",
|
|
|
|
|
onTap: () async {
|
|
|
|
|
setState(() {
|
|
|
|
|
if (_referTo == null) {
|
|
|
|
|
branchError = TranslationBase.of(context).fieldRequired;
|
|
|
|
|
} else {
|
|
|
|
|
branchError = null;
|
|
|
|
|
}
|
|
|
|
|
if (_selectedBranch == null) {
|
|
|
|
|
hospitalError = TranslationBase.of(context).fieldRequired;
|
|
|
|
|
} else {
|
|
|
|
|
hospitalError = null;
|
|
|
|
|
}
|
|
|
|
|
if (_selectedClinic == null) {
|
|
|
|
|
clinicError = TranslationBase.of(context).fieldRequired;
|
|
|
|
|
} else {
|
|
|
|
|
clinicError = null;
|
|
|
|
|
}
|
|
|
|
|
if (_selectedDoctor == null) {
|
|
|
|
|
doctorError = TranslationBase.of(context).fieldRequired;
|
|
|
|
|
} else {
|
|
|
|
|
doctorError = null;
|
|
|
|
|
}
|
|
|
|
|
if (_selectedFrequency == null) {
|
|
|
|
|
frequencyError = TranslationBase.of(context).fieldRequired;
|
|
|
|
|
} else {
|
|
|
|
|
frequencyError = null;
|
|
|
|
|
}
|
|
|
|
|
if (_selectedPriority == null) {
|
|
|
|
|
remarkError = TranslationBase.of(context).fieldRequired;
|
|
|
|
|
} else {
|
|
|
|
|
remarkError = null;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
if (_selectedFrequency == null ||
|
|
|
|
|
_selectedPriority == null ||
|
|
|
|
|
_selectedBranch == null ||
|
|
|
|
|
_selectedClinic == null ||
|
|
|
|
|
_selectedDoctor == null ||
|
|
|
|
|
_remarksController.text == null ||
|
|
|
|
|
_extController.text == null) return;
|
|
|
|
|
{
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
await model.makeInPatientReferral(
|
|
|
|
|
patient: patient,
|
|
|
|
|
projectID: _selectedBranch['facilityId'],
|
|
|
|
|
clinicID: _selectedClinic['ClinicID'],
|
|
|
|
|
doctorID: _selectedDoctor['DoctorID'],
|
|
|
|
|
frequencyCode: _selectedFrequency['ParameterCode'],
|
|
|
|
|
ext: _extController.text,
|
|
|
|
|
remarks: _remarksController.text,
|
|
|
|
|
priority: _activePriority,
|
|
|
|
|
referralDate: appointmentDate,
|
|
|
|
|
isLocalBusy: true);
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
if (model.state == ViewState.ErrorLocal)
|
|
|
|
|
DrAppToastMsg.showErrorToast(model.error);
|
|
|
|
|
else {
|
|
|
|
|
DrAppToastMsg.showSuccesToast(TranslationBase.of(context).referralSuccessMsg);
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
)),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -666,8 +584,7 @@ class _PatientMakeInPatientReferralScreenState extends State<PatientMakeInPatien
|
|
|
|
|
return time;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BoxDecoration containerBorderDecoration(
|
|
|
|
|
Color containerColor, Color borderColor) {
|
|
|
|
|
BoxDecoration containerBorderDecoration(Color containerColor, Color borderColor) {
|
|
|
|
|
return BoxDecoration(
|
|
|
|
|
color: containerColor,
|
|
|
|
|
shape: BoxShape.rectangle,
|
|
|
|
|
|