merge-requests/719/head
hussam al-habibeh 5 years ago
parent a6a8f616e1
commit 4af94e6b71

@ -25,12 +25,10 @@ import 'package:speech_to_text/speech_to_text.dart' as stt;
class PatientMakeInPatientReferralScreen extends StatefulWidget { class PatientMakeInPatientReferralScreen extends StatefulWidget {
@override @override
_PatientMakeInPatientReferralScreenState createState() => _PatientMakeInPatientReferralScreenState createState() => _PatientMakeInPatientReferralScreenState();
_PatientMakeInPatientReferralScreenState();
} }
class _PatientMakeInPatientReferralScreenState class _PatientMakeInPatientReferralScreenState extends State<PatientMakeInPatientReferralScreen> {
extends State<PatientMakeInPatientReferralScreen> {
PatiantInformtion patient; PatiantInformtion patient;
List<dynamic> referToList; List<dynamic> referToList;
dynamic _referTo; dynamic _referTo;
@ -68,8 +66,7 @@ class _PatientMakeInPatientReferralScreenState
onVoiceText() async { onVoiceText() async {
new SpeechToText(context: context).showAlertDialog(context); new SpeechToText(context: context).showAlertDialog(context);
var lang = TranslationBase.of(AppGlobal.CONTEX).locale.languageCode; var lang = TranslationBase.of(AppGlobal.CONTEX).locale.languageCode;
bool available = await speech.initialize( bool available = await speech.initialize(onStatus: statusListener, onError: errorListener);
onStatus: statusListener, onError: errorListener);
if (available) { if (available) {
speech.listen( speech.listen(
onResult: resultListener, onResult: resultListener,
@ -113,8 +110,7 @@ class _PatientMakeInPatientReferralScreenState
} }
Future<void> initSpeechState() async { Future<void> initSpeechState() async {
bool hasSpeech = await speech.initialize( bool hasSpeech = await speech.initialize(onError: errorListener, onStatus: statusListener);
onError: errorListener, onStatus: statusListener);
print(hasSpeech); print(hasSpeech);
if (!mounted) return; if (!mounted) return;
} }
@ -127,14 +123,8 @@ class _PatientMakeInPatientReferralScreenState
String arrivalType = routeArgs['arrivalType']; String arrivalType = routeArgs['arrivalType'];
bool isInpatient = routeArgs['isInpatient']; bool isInpatient = routeArgs['isInpatient'];
referToList = List(); referToList = List();
dynamic sameBranch = { dynamic sameBranch = {"id": 1, "name": TranslationBase.of(context).sameBranch};
"id": 1, dynamic otherBranch = {"id": 2, "name": TranslationBase.of(context).otherBranch};
"name": TranslationBase.of(context).sameBranch
};
dynamic otherBranch = {
"id": 2,
"name": TranslationBase.of(context).otherBranch
};
referToList.add(sameBranch); referToList.add(sameBranch);
referToList.add(otherBranch); referToList.add(otherBranch);
@ -188,8 +178,7 @@ class _PatientMakeInPatientReferralScreenState
AppTextFieldCustom( AppTextFieldCustom(
height: screenSize.height * 0.075, height: screenSize.height * 0.075,
hintText: TranslationBase.of(context).branch, hintText: TranslationBase.of(context).branch,
dropDownText: dropDownText: _referTo != null ? _referTo['name'] : null,
_referTo != null ? _referTo['name'] : null,
enabled: false, enabled: false,
isTextFieldHasSuffix: true, isTextFieldHasSuffix: true,
validationError: branchError, validationError: branchError,
@ -206,23 +195,15 @@ class _PatientMakeInPatientReferralScreenState
_selectedBranch = null; _selectedBranch = null;
_selectedClinic = null; _selectedClinic = null;
_selectedDoctor = null; _selectedDoctor = null;
model model.getDoctorBranch().then((value) async {
.getDoctorBranch()
.then((value) async {
_selectedBranch = value; _selectedBranch = value;
if (_referTo['id'] == 1) { if (_referTo['id'] == 1) {
GifLoaderDialogUtils.showMyDialog( GifLoaderDialogUtils.showMyDialog(context);
context);
await model await model
.getClinics(_selectedBranch[ .getClinics(_selectedBranch['facilityId'])
'facilityId']) .then((_) => GifLoaderDialogUtils.hideDialog(context));
.then((_) => if (model.state == ViewState.ErrorLocal) {
GifLoaderDialogUtils DrAppToastMsg.showErrorToast(model.error);
.hideDialog(context));
if (model.state ==
ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(
model.error);
} }
} else { } else {
_selectedBranch = null; _selectedBranch = null;
@ -247,9 +228,7 @@ class _PatientMakeInPatientReferralScreenState
AppTextFieldCustom( AppTextFieldCustom(
height: screenSize.height * 0.075, height: screenSize.height * 0.075,
hintText: TranslationBase.of(context).hospital, hintText: TranslationBase.of(context).hospital,
dropDownText: _selectedBranch != null dropDownText: _selectedBranch != null ? _selectedBranch['facilityName'] : null,
? _selectedBranch['facilityName']
: null,
enabled: false, enabled: false,
isTextFieldHasSuffix: true, isTextFieldHasSuffix: true,
validationError: hospitalError, validationError: hospitalError,
@ -268,17 +247,12 @@ class _PatientMakeInPatientReferralScreenState
_selectedBranch = selectedValue; _selectedBranch = selectedValue;
_selectedClinic = null; _selectedClinic = null;
_selectedDoctor = null; _selectedDoctor = null;
GifLoaderDialogUtils.showMyDialog( GifLoaderDialogUtils.showMyDialog(context);
context);
await model await model
.getClinics( .getClinics(_selectedBranch['facilityId'])
_selectedBranch['facilityId']) .then((_) => GifLoaderDialogUtils.hideDialog(context));
.then((_) => GifLoaderDialogUtils if (model.state == ViewState.ErrorLocal) {
.hideDialog(context)); DrAppToastMsg.showErrorToast(model.error);
if (model.state ==
ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(
model.error);
} }
}); });
}, },
@ -299,9 +273,7 @@ class _PatientMakeInPatientReferralScreenState
AppTextFieldCustom( AppTextFieldCustom(
height: screenSize.height * 0.075, height: screenSize.height * 0.075,
hintText: TranslationBase.of(context).clinic, hintText: TranslationBase.of(context).clinic,
dropDownText: _selectedClinic != null dropDownText: _selectedClinic != null ? _selectedClinic['ClinicDescription'] : null,
? _selectedClinic['ClinicDescription']
: null,
enabled: false, enabled: false,
isTextFieldHasSuffix: true, isTextFieldHasSuffix: true,
validationError: clinicError, validationError: clinicError,
@ -314,27 +286,19 @@ class _PatientMakeInPatientReferralScreenState
attributeName: 'ClinicDescription', attributeName: 'ClinicDescription',
attributeValueId: 'ClinicID', attributeValueId: 'ClinicID',
usingSearch: true, usingSearch: true,
hintSearchText: hintSearchText: TranslationBase.of(context).clinicSearch,
TranslationBase.of(context)
.clinicSearch,
okText: TranslationBase.of(context).ok, okText: TranslationBase.of(context).ok,
okFunction: (selectedValue) { okFunction: (selectedValue) {
setState(() async { setState(() async {
_selectedDoctor = null; _selectedDoctor = null;
_selectedClinic = selectedValue; _selectedClinic = selectedValue;
GifLoaderDialogUtils.showMyDialog( GifLoaderDialogUtils.showMyDialog(context);
context);
await model await model
.getClinicDoctors( .getClinicDoctors(
patient, patient, _selectedClinic['ClinicID'], _selectedBranch['facilityId'])
_selectedClinic['ClinicID'], .then((_) => GifLoaderDialogUtils.hideDialog(context));
_selectedBranch['facilityId']) if (model.state == ViewState.ErrorLocal) {
.then((_) => GifLoaderDialogUtils DrAppToastMsg.showErrorToast(model.error);
.hideDialog(context));
if (model.state ==
ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(
model.error);
} }
}); });
}, },
@ -355,24 +319,19 @@ class _PatientMakeInPatientReferralScreenState
AppTextFieldCustom( AppTextFieldCustom(
height: screenSize.height * 0.075, height: screenSize.height * 0.075,
hintText: TranslationBase.of(context).doctor, hintText: TranslationBase.of(context).doctor,
dropDownText: _selectedDoctor != null dropDownText: _selectedDoctor != null ? _selectedDoctor['Name'] : null,
? _selectedDoctor['Name']
: null,
enabled: false, enabled: false,
isTextFieldHasSuffix: true, isTextFieldHasSuffix: true,
validationError: doctorError, validationError: doctorError,
onClick: _selectedClinic != null && onClick:
model.doctorsList != null && _selectedClinic != null && model.doctorsList != null && model.doctorsList.length > 0
model.doctorsList.length > 0
? () { ? () {
ListSelectDialog dialog = ListSelectDialog( ListSelectDialog dialog = ListSelectDialog(
list: model.doctorsList, list: model.doctorsList,
attributeName: 'Name', attributeName: 'Name',
attributeValueId: 'DoctorID', attributeValueId: 'DoctorID',
usingSearch: true, usingSearch: true,
hintSearchText: hintSearchText: TranslationBase.of(context).doctorSearch,
TranslationBase.of(context)
.doctorSearch,
okText: TranslationBase.of(context).ok, okText: TranslationBase.of(context).ok,
okFunction: (selectedValue) { okFunction: (selectedValue) {
setState(() { setState(() {
@ -390,12 +349,9 @@ class _PatientMakeInPatientReferralScreenState
} }
: () { : () {
if (_selectedClinic == null) { if (_selectedClinic == null) {
DrAppToastMsg.showErrorToast( DrAppToastMsg.showErrorToast("You need to select a clinic first");
"You need to select a clinic first"); } else if (model.doctorsList == null || model.doctorsList.length == 0) {
} else if (model.doctorsList == null || DrAppToastMsg.showErrorToast("There is no doctors for this clinic");
model.doctorsList.length == 0) {
DrAppToastMsg.showErrorToast(
"There is no doctors for this clinic");
} }
}, },
), ),
@ -425,11 +381,8 @@ class _PatientMakeInPatientReferralScreenState
), ),
AppTextFieldCustom( AppTextFieldCustom(
height: screenSize.height * 0.075, height: screenSize.height * 0.075,
hintText: hintText: TranslationBase.of(context).referralFrequency,
TranslationBase.of(context).referralFrequency, dropDownText: _selectedFrequency != null ? _selectedFrequency['Description'] : null,
dropDownText: _selectedFrequency != null
? _selectedFrequency['Description']
: null,
enabled: false, enabled: false,
isTextFieldHasSuffix: true, isTextFieldHasSuffix: true,
validationError: frequencyError, validationError: frequencyError,
@ -439,8 +392,7 @@ class _PatientMakeInPatientReferralScreenState
attributeName: 'Description', attributeName: 'Description',
attributeValueId: 'ParameterCode', attributeValueId: 'ParameterCode',
usingSearch: true, usingSearch: true,
hintSearchText: TranslationBase.of(context) hintSearchText: TranslationBase.of(context).selectReferralFrequency,
.selectReferralFrequency,
okText: TranslationBase.of(context).ok, okText: TranslationBase.of(context).ok,
okFunction: (selectedValue) { okFunction: (selectedValue) {
setState(() { setState(() {
@ -478,8 +430,7 @@ class _PatientMakeInPatientReferralScreenState
maxLines: 6, maxLines: 6,
), ),
Positioned( Positioned(
top: top: 0, //MediaQuery.of(context).size.height * 0,
0, //MediaQuery.of(context).size.height * 0,
right: 15, right: 15,
child: IconButton( child: IconButton(
icon: Icon( icon: Icon(
@ -488,8 +439,7 @@ class _PatientMakeInPatientReferralScreenState
size: 35, size: 35,
), ),
onPressed: () { onPressed: () {
initSpeechState() initSpeechState().then((value) => {onVoiceText()});
.then((value) => {onVoiceText()});
}, },
), ),
), ),
@ -524,32 +474,27 @@ class _PatientMakeInPatientReferralScreenState
onPressed: () async { onPressed: () async {
setState(() { setState(() {
if (_referTo == null) { if (_referTo == null) {
branchError = branchError = TranslationBase.of(context).fieldRequired;
TranslationBase.of(context).fieldRequired;
} else { } else {
branchError = null; branchError = null;
} }
if (_selectedBranch == null) { if (_selectedBranch == null) {
hospitalError = hospitalError = TranslationBase.of(context).fieldRequired;
TranslationBase.of(context).fieldRequired;
} else { } else {
hospitalError = null; hospitalError = null;
} }
if (_selectedClinic == null) { if (_selectedClinic == null) {
clinicError = clinicError = TranslationBase.of(context).fieldRequired;
TranslationBase.of(context).fieldRequired;
} else { } else {
clinicError = null; clinicError = null;
} }
if (_selectedDoctor == null) { if (_selectedDoctor == null) {
doctorError = doctorError = TranslationBase.of(context).fieldRequired;
TranslationBase.of(context).fieldRequired;
} else { } else {
doctorError = null; doctorError = null;
} }
if (_selectedFrequency == null) { if (_selectedFrequency == null) {
frequencyError = frequencyError = TranslationBase.of(context).fieldRequired;
TranslationBase.of(context).fieldRequired;
} else { } else {
frequencyError = null; frequencyError = null;
} }
@ -566,8 +511,7 @@ class _PatientMakeInPatientReferralScreenState
projectID: _selectedBranch['facilityId'], projectID: _selectedBranch['facilityId'],
clinicID: _selectedClinic['ClinicID'], clinicID: _selectedClinic['ClinicID'],
doctorID: _selectedDoctor['DoctorID'], doctorID: _selectedDoctor['DoctorID'],
frequencyCode: frequencyCode: _selectedFrequency['ParameterCode'],
_selectedFrequency['ParameterCode'],
ext: _extController.text, ext: _extController.text,
remarks: _remarksController.text, remarks: _remarksController.text,
priority: _activePriority, priority: _activePriority,
@ -575,9 +519,7 @@ class _PatientMakeInPatientReferralScreenState
if (model.state == ViewState.ErrorLocal) if (model.state == ViewState.ErrorLocal)
DrAppToastMsg.showErrorToast(model.error); DrAppToastMsg.showErrorToast(model.error);
else { else {
DrAppToastMsg.showSuccesToast( DrAppToastMsg.showSuccesToast(TranslationBase.of(context).referralSuccessMsg);
TranslationBase.of(context)
.referralSuccessMsg);
Navigator.pop(context); Navigator.pop(context);
} }
} }
@ -602,8 +544,7 @@ class _PatientMakeInPatientReferralScreenState
]; ];
return Container( return Container(
height: screenSize.height * 0.070, height: screenSize.height * 0.070,
decoration: decoration: containerBorderDecoration(Color(0Xffffffff), Color(0xFFCCCCCC)),
containerBorderDecoration(Color(0Xffffffff), Color(0xFFCCCCCC)),
child: Row( child: Row(
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
@ -615,16 +556,13 @@ class _PatientMakeInPatientReferralScreenState
child: Container( child: Container(
height: screenSize.height * 0.070, height: screenSize.height * 0.070,
decoration: containerBorderDecoration( decoration: containerBorderDecoration(
_isActive ? Color(0XFFB8382B) : Colors.white, _isActive ? Color(0XFFB8382B) : Colors.white, _isActive ? Color(0XFFB8382B) : Colors.white),
_isActive ? Color(0XFFB8382B) : Colors.white),
child: Center( child: Center(
child: Text( child: Text(
item, item,
style: TextStyle( style: TextStyle(
fontSize: 12, fontSize: 12,
color: _isActive color: _isActive ? Colors.white : Colors.black, //Colors.black,
? Colors.white
: Colors.black, //Colors.black,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),
@ -664,8 +602,7 @@ class _PatientMakeInPatientReferralScreenState
return time; return time;
} }
BoxDecoration containerBorderDecoration( BoxDecoration containerBorderDecoration(Color containerColor, Color borderColor) {
Color containerColor, Color borderColor) {
return BoxDecoration( return BoxDecoration(
color: containerColor, color: containerColor,
shape: BoxShape.rectangle, shape: BoxShape.rectangle,

@ -147,8 +147,16 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
@override @override
void initState() { void initState() {
super.initState(); requestPermissions();
event.controller.stream.listen((p) {
if (p['startPopUp'] == 'true') {
if (this.mounted) {
initSpeechState().then((value) => {onVoiceText()});
}
}
});
selectedType = 1; selectedType = 1;
super.initState();
} }
setSelectedType(int val) { setSelectedType(int val) {
@ -195,7 +203,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
setState(() { setState(() {
SpeechToText.closeAlertDialog(context); SpeechToText.closeAlertDialog(context);
speech.stop(); speech.stop();
indicationController.text += reconizedWord + '\n'; instructionController.text += reconizedWord + '\n';
}); });
} else { } else {
print(result.finalResult); print(result.finalResult);
@ -263,25 +271,6 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
SizedBox( SizedBox(
height: 60, height: 60,
), ),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
AppText(
TranslationBase.of(context).newPrescriptionOrder,
fontWeight: FontWeight.w700,
fontSize: 20,
),
InkWell(
child: Icon(
Icons.close,
size: 24.0,
),
onTap: () {
Navigator.pop(context);
},
)
],
),
], ],
), ),
SizedBox( SizedBox(
@ -635,9 +624,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
size: 35, size: 35,
), ),
onPressed: () { onPressed: () {
setState(() {
initSpeechState().then((value) => {onVoiceText()}); initSpeechState().then((value) => {onVoiceText()});
});
}, },
), ),
), ),

@ -136,8 +136,16 @@ class _PrescriptionCheckOutScreenState extends State<PrescriptionCheckOutScreen>
@override @override
void initState() { void initState() {
super.initState(); requestPermissions();
event.controller.stream.listen((p) {
if (p['startPopUp'] == 'true') {
if (this.mounted) {
initSpeechState().then((value) => {onVoiceText()});
}
}
});
selectedType = 1; selectedType = 1;
super.initState();
} }
onVoiceText() async { onVoiceText() async {
@ -512,29 +520,7 @@ class _PrescriptionCheckOutScreenState extends State<PrescriptionCheckOutScreen>
}, },
), ),
SizedBox(height: spaceBetweenTextFileds), SizedBox(height: spaceBetweenTextFileds),
// Container(
// color: Colors.white,
// child: AppTextFieldCustom(
// hintText: "UOM",
// isTextFieldHasSuffix: false,
// dropDownText: uom != null ? uom : null,
// enabled: false,
// ),
// ),
SizedBox(height: spaceBetweenTextFileds), SizedBox(height: spaceBetweenTextFileds),
// Container(
// color: Colors.white,
// child: AppTextFieldCustom(
// hintText: TranslationBase.of(context).boxQuantity,
// isTextFieldHasSuffix: false,
// dropDownText: box != null
// ? TranslationBase.of(context).boxQuantity +
// ": " +
// model.boxQuintity.toString()
// : null,
// enabled: false,
// ),
// ),
SizedBox(height: spaceBetweenTextFileds), SizedBox(height: spaceBetweenTextFileds),
Container( Container(
decoration: BoxDecoration( decoration: BoxDecoration(
@ -559,9 +545,7 @@ class _PrescriptionCheckOutScreenState extends State<PrescriptionCheckOutScreen>
size: 35, size: 35,
), ),
onPressed: () { onPressed: () {
setState(() {
initSpeechState().then((value) => {onVoiceText()}); initSpeechState().then((value) => {onVoiceText()});
});
}, },
), ),
), ),

@ -18,7 +18,6 @@ class NewPrescriptionScreen extends StatefulWidget {
class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> { class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
PersistentBottomSheetController _controller; PersistentBottomSheetController _controller;
final _scaffoldKey = GlobalKey<ScaffoldState>();
TextEditingController strengthController = TextEditingController(); TextEditingController strengthController = TextEditingController();
int testNum = 0; int testNum = 0;
int strengthChar; int strengthChar;
@ -35,9 +34,7 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
patient = routeArgs['patient']; patient = routeArgs['patient'];
return BaseView<PrescriptionViewModel>( return BaseView<PrescriptionViewModel>(
onModelReady: (model) => model.getPrescription(mrn: patient.patientId), onModelReady: (model) => model.getPrescription(mrn: patient.patientId),
builder: builder: (BuildContext context, PrescriptionViewModel model, Widget child) => AppScaffold(
(BuildContext context, PrescriptionViewModel model, Widget child) =>
AppScaffold(
isShowAppBar: true, isShowAppBar: true,
appBarTitle: TranslationBase.of(context).prescription, appBarTitle: TranslationBase.of(context).prescription,
body: NetworkBaseView( body: NetworkBaseView(
@ -54,34 +51,23 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
color: Colors.grey, color: Colors.grey,
), ),
(model.prescriptionList.length != 0) (model.prescriptionList.length != 0)
? SizedBox( ? SizedBox(height: model.prescriptionList[0].rowcount == 0 ? 200.0 : 10.0)
height:
model.prescriptionList[0].rowcount == 0
? 200.0
: 10.0)
: SizedBox(height: 200.0), : SizedBox(height: 200.0),
//model.prescriptionList == null //model.prescriptionList == null
(model.prescriptionList.length != 0) (model.prescriptionList.length != 0)
? model.prescriptionList[0].rowcount == 0 ? model.prescriptionList[0].rowcount == 0
? Column( ? Column(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.center,
MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.stretch,
crossAxisAlignment:
CrossAxisAlignment.stretch,
children: [ children: [
InkWell( InkWell(
onTap: () { onTap: () {
addPrescriptionForm( addPrescriptionForm(context, model, patient, model.prescriptionList);
context,
model,
patient,
model.prescriptionList);
//model.postPrescription(); //model.postPrescription();
}, },
child: CircleAvatar( child: CircleAvatar(
radius: 65, radius: 65,
backgroundColor: backgroundColor: Color(0XFFB8382C),
Color(0XFFB8382C),
child: CircleAvatar( child: CircleAvatar(
radius: 60, radius: 60,
backgroundColor: Colors.white, backgroundColor: Colors.white,
@ -97,24 +83,20 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
height: 15.0, height: 15.0,
), ),
Row( Row(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.center,
MainAxisAlignment.center,
children: [ children: [
AppText( AppText(
TranslationBase.of(context) TranslationBase.of(context).noPrescriptionListed,
.noPrescriptionListed,
color: Colors.black, color: Colors.black,
fontWeight: FontWeight.w900, fontWeight: FontWeight.w900,
), ),
], ],
), ),
Row( Row(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.center,
MainAxisAlignment.center,
children: [ children: [
AppText( AppText(
TranslationBase.of(context) TranslationBase.of(context).addNow,
.addNow,
color: Color(0XFFB8382C), color: Color(0XFFB8382C),
fontWeight: FontWeight.w900, fontWeight: FontWeight.w900,
), ),
@ -127,8 +109,7 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
child: NetworkBaseView( child: NetworkBaseView(
baseViewModel: model, baseViewModel: model,
child: Column( child: Column(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.start,
MainAxisAlignment.start,
children: [ children: [
InkWell( InkWell(
child: Container( child: Container(
@ -136,41 +117,29 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
width: 450.0, width: 450.0,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
border: Border.all( border: Border.all(color: Colors.grey),
color: Colors.grey), borderRadius: BorderRadius.circular(10.0),
borderRadius:
BorderRadius.circular(
10.0),
), ),
child: Padding( child: Padding(
padding: padding: EdgeInsets.all(8.0),
EdgeInsets.all(8.0),
child: Row( child: Row(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.spaceBetween,
MainAxisAlignment
.spaceBetween,
children: [ children: [
AppText( AppText(
' Add more medication', ' Add more medication',
fontWeight: fontWeight: FontWeight.w100,
FontWeight.w100,
fontSize: 12.5, fontSize: 12.5,
), ),
Icon( Icon(
Icons.add, Icons.add,
color: color: Color(0XFFB8382C),
Color(0XFFB8382C),
) )
], ],
), ),
), ),
), ),
onTap: () { onTap: () {
addPrescriptionForm( addPrescriptionForm(context, model, patient, model.prescriptionList);
context,
model,
patient,
model.prescriptionList);
//model.postPrescription(); //model.postPrescription();
}, },
), ),
@ -178,86 +147,61 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
height: 10.0, height: 10.0,
), ),
...List.generate( ...List.generate(
model.prescriptionList[0] model.prescriptionList[0].rowcount,
.rowcount,
(index) => Container( (index) => Container(
color: Colors.white, color: Colors.white,
child: Column( child: Column(
children: [ children: [
SizedBox( SizedBox(
height: MediaQuery.of( height: MediaQuery.of(context).size.height * 0.022,
context)
.size
.height *
0.022,
), ),
Row( Row(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.spaceBetween,
MainAxisAlignment
.spaceBetween,
// crossAxisAlignment: // crossAxisAlignment:
// CrossAxisAlignment.start, // CrossAxisAlignment.start,
children: [ children: [
Container( Container(
color: Colors.white, color: Colors.white,
height: MediaQuery.of( height: MediaQuery.of(context).size.height * 0.21,
context) width: MediaQuery.of(context).size.width * 0.1,
.size
.height *
0.21,
width: MediaQuery.of(
context)
.size
.width *
0.1,
child: Column( child: Column(
children: [ children: [
AppText( AppText(
(DateTime.parse(model.prescriptionList[0].entityList[index].createdOn) != (DateTime.parse(model.prescriptionList[0].entityList[index]
.createdOn) !=
null null
? (DateTime.parse(model.prescriptionList[0].entityList[index].createdOn).year) ? (DateTime.parse(model.prescriptionList[0]
.toString() .entityList[index].createdOn)
: DateTime.now()
.year) .year)
.toString()
: DateTime.now().year)
.toString(), .toString(),
color: Colors color: Colors.green,
.green, fontSize: 13.5,
fontSize:
13.5,
), ),
AppText( AppText(
AppDateUtils.getMonth(model.prescriptionList[0].entityList[index].createdOn != AppDateUtils.getMonth(model.prescriptionList[0]
.entityList[index].createdOn !=
null null
? (DateTime.parse(model.prescriptionList[0].entityList[index].createdOn) ? (DateTime.parse(model.prescriptionList[0]
.month) .entityList[index].createdOn)
: DateTime.now()
.month) .month)
: DateTime.now().month)
.toUpperCase(), .toUpperCase(),
color: Colors color: Colors.green,
.green,
), ),
AppText( AppText(
DateTime.parse(model DateTime.parse(
.prescriptionList[ model.prescriptionList[0].entityList[index].createdOn)
0]
.entityList[
index]
.createdOn)
.day .day
.toString(), .toString(),
color: Colors color: Colors.green,
.green,
), ),
AppText( AppText(
AppDateUtils.getTimeFormated(DateTime.parse(model AppDateUtils.getTimeFormated(DateTime.parse(model
.prescriptionList[ .prescriptionList[0].entityList[index].createdOn))
0]
.entityList[
index]
.createdOn))
.toString(), .toString(),
color: Colors color: Colors.green,
.green,
), ),
], ],
), ),
@ -269,55 +213,36 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
// .size // .size
// .height * // .height *
// 0.3499, // 0.3499,
width: MediaQuery.of( width: MediaQuery.of(context).size.width * 0.77,
context)
.size
.width *
0.77,
child: Column( child: Column(
children: [ children: [
Row( Row(
children: [ children: [
AppText( AppText(
'Start Date:', 'Start Date:',
fontWeight: fontWeight: FontWeight.w700,
FontWeight fontSize: 14.0,
.w700,
fontSize:
14.0,
), ),
Expanded( Expanded(
child: child: AppText(
AppText(
AppDateUtils.getDateFormatted(DateTime.parse(model AppDateUtils.getDateFormatted(DateTime.parse(model
.prescriptionList[0] .prescriptionList[0].entityList[index].startDate)),
.entityList[index] fontSize: 13.5,
.startDate)),
fontSize:
13.5,
), ),
), ),
SizedBox( SizedBox(
width: width: 6.0,
6.0,
), ),
AppText( AppText(
'Order Type:', 'Order Type:',
fontWeight: fontWeight: FontWeight.w700,
FontWeight fontSize: 14.0,
.w700,
fontSize:
14.0,
), ),
Expanded( Expanded(
child: child: AppText(
AppText( model.prescriptionList[0].entityList[index]
model
.prescriptionList[0]
.entityList[index]
.orderTypeDescription, .orderTypeDescription,
fontSize: fontSize: 13.0,
13.0,
), ),
), ),
], ],
@ -328,20 +253,13 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
Row( Row(
children: [ children: [
Container( Container(
color: Colors color: Colors.white,
.white, child: Expanded(
child: child: AppText(
Expanded( model.prescriptionList[0].entityList[index]
child:
AppText(
model
.prescriptionList[0]
.entityList[index]
.medicationName, .medicationName,
fontWeight: fontWeight: FontWeight.w700,
FontWeight.w700, fontSize: 15.0,
fontSize:
15.0,
), ),
), ),
) )
@ -353,14 +271,9 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
Row( Row(
children: [ children: [
Expanded( Expanded(
child: child: AppText(
AppText( model.prescriptionList[0].entityList[index].doseDetail,
model fontSize: 15.0,
.prescriptionList[0]
.entityList[index]
.doseDetail,
fontSize:
15.0,
), ),
) )
], ],
@ -372,25 +285,18 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
children: [ children: [
AppText( AppText(
'Indication: ', 'Indication: ',
fontWeight: fontWeight: FontWeight.w700,
FontWeight fontSize: 17.0,
.w700,
fontSize:
17.0,
), ),
Expanded( Expanded(
child: child: RichText(
RichText( maxLines: 3,
maxLines: overflow: TextOverflow.ellipsis,
3, strutStyle: StrutStyle(fontSize: 12.0),
overflow:
TextOverflow.ellipsis,
strutStyle:
StrutStyle(fontSize: 12.0),
text: TextSpan( text: TextSpan(
style: style: TextStyle(color: Colors.black),
TextStyle(color: Colors.black), text: model.prescriptionList[0].entityList[index]
text: model.prescriptionList[0].entityList[index].indication), .indication),
), ),
), ),
], ],
@ -399,25 +305,18 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
children: [ children: [
AppText( AppText(
'UOM: ', 'UOM: ',
fontWeight: fontWeight: FontWeight.w700,
FontWeight fontSize: 17.0,
.w700,
fontSize:
17.0,
), ),
Expanded( Expanded(
child: child: RichText(
RichText( maxLines: 3,
maxLines: overflow: TextOverflow.ellipsis,
3, strutStyle: StrutStyle(fontSize: 12.0),
overflow:
TextOverflow.ellipsis,
strutStyle:
StrutStyle(fontSize: 12.0),
text: TextSpan( text: TextSpan(
style: style: TextStyle(color: Colors.black),
TextStyle(color: Colors.black), text: model
text: model.prescriptionList[0].entityList[index].uom), .prescriptionList[0].entityList[index].uom),
), ),
), ),
], ],
@ -426,25 +325,24 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
children: [ children: [
AppText( AppText(
'BOX Quantity: ', 'BOX Quantity: ',
fontWeight: fontWeight: FontWeight.w700,
FontWeight fontSize: 17.0,
.w700,
fontSize:
17.0,
), ),
Expanded( Expanded(
child: child: RichText(
RichText( maxLines: 3,
maxLines: overflow: TextOverflow.ellipsis,
3, strutStyle: StrutStyle(fontSize: 12.0),
overflow:
TextOverflow.ellipsis,
strutStyle:
StrutStyle(fontSize: 12.0),
text: TextSpan( text: TextSpan(
style: style: TextStyle(color: Colors.black),
TextStyle(color: Colors.black), text: model.prescriptionList[0].entityList[index]
text: model.prescriptionList[0].entityList[index].quantity.toString() == null ? "" : model.prescriptionList[0].entityList[index].quantity.toString()), .quantity
.toString() ==
null
? ""
: model.prescriptionList[0].entityList[index]
.quantity
.toString()),
), ),
), ),
], ],
@ -453,46 +351,43 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
children: [ children: [
AppText( AppText(
'pharmacy Intervention ', 'pharmacy Intervention ',
fontWeight: fontWeight: FontWeight.w700,
FontWeight fontSize: 17.0,
.w700,
fontSize:
17.0,
), ),
Expanded( Expanded(
child: child: RichText(
RichText( maxLines: 3,
maxLines: overflow: TextOverflow.ellipsis,
3, strutStyle: StrutStyle(fontSize: 12.0),
overflow:
TextOverflow.ellipsis,
strutStyle:
StrutStyle(fontSize: 12.0),
text: TextSpan( text: TextSpan(
style: style: TextStyle(color: Colors.black),
TextStyle(color: Colors.black), text: model.prescriptionList[0].entityList[index]
text: model.prescriptionList[0].entityList[index].pharmacyInervention == null ? "" : model.prescriptionList[0].entityList[index].pharmacyInervention.toString()), .pharmacyInervention ==
null
? ""
: model.prescriptionList[0].entityList[index]
.pharmacyInervention
.toString()),
), ),
), ),
], ],
), ),
SizedBox( SizedBox(height: 5.0),
height:
5.0),
Row( Row(
children: [ children: [
AppText( AppText(
'pharmacist Remarks : ', 'pharmacist Remarks : ',
fontWeight: fontWeight: FontWeight.w700,
FontWeight fontSize: 15.0,
.w700,
fontSize:
15.0,
), ),
Expanded( Expanded(
child: AppText( child: AppText(
// commening below code because there is an error coming in the model please fix it before pushing it model.prescriptionList[0].entityList[index]
model.prescriptionList[0].entityList[index].pharmacistRemarks == null ? "" : model.prescriptionList[0].entityList[index].pharmacistRemarks, .pharmacistRemarks ==
null
? ""
: model.prescriptionList[0].entityList[index]
.pharmacistRemarks,
fontSize: 15.0), fontSize: 15.0),
) )
], ],
@ -503,22 +398,13 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
Row( Row(
children: [ children: [
AppText( AppText(
TranslationBase.of(context) TranslationBase.of(context).doctorName + ": ",
.doctorName + fontWeight: FontWeight.w600,
": ",
fontWeight:
FontWeight
.w600,
), ),
Expanded( Expanded(
child: child: AppText(
AppText( model.prescriptionList[0].entityList[index].doctorName,
model fontWeight: FontWeight.w700,
.prescriptionList[0]
.entityList[index]
.doctorName,
fontWeight:
FontWeight.w700,
), ),
) )
], ],
@ -530,33 +416,27 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
children: [ children: [
AppText( AppText(
'Doctor Remarks : ', 'Doctor Remarks : ',
fontWeight: fontWeight: FontWeight.w700,
FontWeight fontSize: 13.0,
.w700,
fontSize:
13.0,
), ),
Expanded( Expanded(
child: child: Container(
Container( color: Colors.white,
color: Colors
.white,
// height: MediaQuery.of(context).size.height * // height: MediaQuery.of(context).size.height *
// 0.038, // 0.038,
child: child: RichText(
RichText(
// maxLines: // maxLines:
// 2, // 2,
// overflow: // overflow:
// TextOverflow.ellipsis, // TextOverflow.ellipsis,
strutStyle: strutStyle: StrutStyle(fontSize: 10.0),
StrutStyle(fontSize: 10.0), text: TextSpan(
text: style: TextStyle(color: Colors.black),
TextSpan( text: model.prescriptionList[0].entityList[index]
style: .remarks !=
TextStyle(color: Colors.black), null
text: model.prescriptionList[0].entityList[index].remarks != null ? model.prescriptionList[0].entityList[index]
? model.prescriptionList[0].entityList[index].remarks .remarks
: "", : "",
), ),
), ),
@ -576,66 +456,37 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
), ),
Container( Container(
color: Colors.white, color: Colors.white,
height: MediaQuery.of( height: MediaQuery.of(context).size.height * 0.16,
context) width: MediaQuery.of(context).size.width * 0.06,
.size
.height *
0.16,
width: MediaQuery.of(
context)
.size
.width *
0.06,
child: Column( child: Column(
children: [ children: [
InkWell( InkWell(
child: Icon( child: Icon(Icons.edit),
Icons
.edit),
onTap: () { onTap: () {
updatePrescriptionForm( updatePrescriptionForm(
box: model box: model
.prescriptionList[ .prescriptionList[0].entityList[index].quantity,
0] uom: model.prescriptionList[0].entityList[index].uom,
.entityList[ drugNameGeneric: model.prescriptionList[0]
index] .entityList[index].medicationName,
.quantity, doseUnit: model.prescriptionList[0].entityList[index]
uom: model .doseDailyUnitID
.prescriptionList[
0]
.entityList[
index]
.uom,
drugNameGeneric: model
.prescriptionList[
0]
.entityList[
index]
.medicationName,
doseUnit: model.prescriptionList[0].entityList[index].doseDailyUnitID
.toString(), .toString(),
doseStreangth: model.prescriptionList[0].entityList[index].doseDailyQuantity doseStreangth: model.prescriptionList[0]
.entityList[index].doseDailyQuantity
.toString(), .toString(),
duration: duration: model.prescriptionList[0].entityList[index]
model.prescriptionList[0].entityList[index].doseDurationDays .doseDurationDays
.toString(), .toString(),
startDate: startDate: model
model.prescriptionList[0].entityList[index].startDate .prescriptionList[0].entityList[index].startDate
.toString(), .toString(),
dose: model dose: model.prescriptionList[0].entityList[index].doseTimingID
.prescriptionList[
0]
.entityList[
index]
.doseTimingID
.toString(), .toString(),
frequency: frequency: model
model.prescriptionList[0].entityList[index].frequencyID .prescriptionList[0].entityList[index].frequencyID
.toString(), .toString(),
rouat: model rouat: model.prescriptionList[0].entityList[index].routeID
.prescriptionList[0]
.entityList[index]
.routeID
.toString(), .toString(),
patient: patient, patient: patient,
drugId: model.prescriptionList[0].entityList[index].medicineCode, drugId: model.prescriptionList[0].entityList[index].medicineCode,
@ -667,13 +518,11 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
) )
: Column( : Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: crossAxisAlignment: CrossAxisAlignment.stretch,
CrossAxisAlignment.stretch,
children: [ children: [
InkWell( InkWell(
onTap: () { onTap: () {
addPrescriptionForm(context, model, addPrescriptionForm(context, model, patient, model.prescriptionList);
patient, model.prescriptionList);
//model.postPrescription(); //model.postPrescription();
}, },
child: CircleAvatar( child: CircleAvatar(
@ -694,20 +543,17 @@ class _NewPrescriptionScreenState extends State<NewPrescriptionScreen> {
height: 15.0, height: 15.0,
), ),
Row( Row(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.center,
MainAxisAlignment.center,
children: [ children: [
AppText( AppText(
TranslationBase.of(context) TranslationBase.of(context).noPrescriptionListed,
.noPrescriptionListed,
color: Colors.black, color: Colors.black,
fontWeight: FontWeight.w900, fontWeight: FontWeight.w900,
), ),
], ],
), ),
Row( Row(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.center,
MainAxisAlignment.center,
children: [ children: [
AppText( AppText(
TranslationBase.of(context).addNow, TranslationBase.of(context).addNow,

Loading…
Cancel
Save