Fix some issues in prescription pages

merge-requests/967/head
RoaaGhali98 4 years ago
parent cdc0d2f4a9
commit 85a6f4965f

@ -18,7 +18,6 @@ class PrescriptionReqModel {
data['VidaAuthTokenID'] = this.vidaAuthTokenID; data['VidaAuthTokenID'] = this.vidaAuthTokenID;
data['PatientMRN'] = this.patientMRN; data['PatientMRN'] = this.patientMRN;
data['AppointmentNo'] = this.appNo; data['AppointmentNo'] = this.appNo;
return data; return data;
} }
} }

@ -209,7 +209,7 @@ class PatientService extends BaseService {
super.error = error; super.error = error;
}, },
body: patient, body: patient,
); return patient; );
} }
Future getOutPatientPrescriptions(patient) async { Future getOutPatientPrescriptions(patient) async {

@ -66,9 +66,6 @@ class MedicineViewModel extends BaseViewModel {
_prescriptionService.itemMedicineListUnit; _prescriptionService.itemMedicineListUnit;
Future getItem({int itemID, bool isLocalBusy = false}) async { Future getItem({int itemID, bool isLocalBusy = false}) async {
if (isLocalBusy) { if (isLocalBusy) {
setState(ViewState.BusyLocal); setState(ViewState.BusyLocal);
@ -83,15 +80,6 @@ class MedicineViewModel extends BaseViewModel {
setState(ViewState.Idle); setState(ViewState.Idle);
} }
// async {
// setState(ViewState.BusyLocal);
// await _prescriptionService.getItem(itemID: itemID);
// if (_prescriptionService.hasError) {
// error = _prescriptionService.error;
// setState(ViewState.ErrorLocal);
// } else
// setState(ViewState.Idle);
// }
setTemplateListDependOnId() { setTemplateListDependOnId() {
procedureTemplate.forEach((element) { procedureTemplate.forEach((element) {
@ -200,6 +188,8 @@ class MedicineViewModel extends BaseViewModel {
} }
} else { } else {
setState(ViewState.Idle); setState(ViewState.Idle);
// TODO Elham* to investigate why we are calling that
setTemplateListDependOnId();
} }
} }
@ -319,10 +309,7 @@ class MedicineViewModel extends BaseViewModel {
if (medicationDoseTimeList.length == 0) { if (medicationDoseTimeList.length == 0) {
await getMedicationDoseTime(); await getMedicationDoseTime();
} }
// await model.getPatientAssessment(getAssessmentReqModel);
// GifLoaderDialogUtils.showMyDialog(context);
await getPatientAssessment(getAssessmentReqModel); await getPatientAssessment(getAssessmentReqModel);
// GifLoaderDialogUtils.hideDialog(context);
} }
Future getMedicationStrength({bool isLocalBusy = false}) async { Future getMedicationStrength({bool isLocalBusy = false}) async {
@ -335,8 +322,11 @@ class MedicineViewModel extends BaseViewModel {
.getMasterLookup(MasterKeysService.MedicationStrength); .getMasterLookup(MasterKeysService.MedicationStrength);
if (_prescriptionService.hasError) { if (_prescriptionService.hasError) {
error = _prescriptionService.error; error = _prescriptionService.error;
setState(ViewState.ErrorLocal); if (isLocalBusy) {
} else setState(ViewState.ErrorLocal);
} else {
setState(ViewState.Error);
}} else
setState(ViewState.Idle); setState(ViewState.Idle);
} }

@ -41,7 +41,6 @@ class PrescriptionViewModel extends BaseViewModel {
List<dynamic> get drugsList => _prescriptionService.doctorsList; List<dynamic> get drugsList => _prescriptionService.doctorsList;
//List<dynamic> get allMedicationList => _prescriptionService.allMedicationList;
List<dynamic> get drugToDrug => _prescriptionService.drugToDrugList; List<dynamic> get drugToDrug => _prescriptionService.drugToDrugList;
List<dynamic> get itemMedicineList => _prescriptionService.itemMedicineList; List<dynamic> get itemMedicineList => _prescriptionService.itemMedicineList;
@ -70,7 +69,7 @@ class PrescriptionViewModel extends BaseViewModel {
List<PrescriotionInPatient> get inPatientPrescription => List<PrescriotionInPatient> get inPatientPrescription =>
_prescriptionsService.prescriptionInPatientList; _prescriptionsService.prescriptionInPatientList;
Future getOutPatientPrescriptions(patient, {bool isLocalBusy = false, BuildContext context, PatiantInformtion patientInformation}) async { Future getOutPatientPrescriptions(patient, {bool isLocalBusy = false, PatiantInformtion patientInformation}) async {
if (isLocalBusy) { if (isLocalBusy) {
setState(ViewState.BusyLocal); setState(ViewState.BusyLocal);
} else { } else {
@ -108,7 +107,6 @@ class PrescriptionViewModel extends BaseViewModel {
Future getItem({int itemID}) async { Future getItem({int itemID}) async {
hasError = false; hasError = false;
//_insuranceCardService.clearInsuranceCard();
setState(ViewState.BusyLocal); setState(ViewState.BusyLocal);
await _prescriptionService.getItem(itemID: itemID); await _prescriptionService.getItem(itemID: itemID);
if (_prescriptionService.hasError) { if (_prescriptionService.hasError) {
@ -120,7 +118,6 @@ class PrescriptionViewModel extends BaseViewModel {
Future getPrescription({int mrn, BuildContext context}) async { Future getPrescription({int mrn, BuildContext context}) async {
hasError = false; hasError = false;
//_insuranceCardService.clearInsuranceCard();
setState(ViewState.BusyLocal); setState(ViewState.BusyLocal);
await _prescriptionService.getPrescription(mrn: mrn); await _prescriptionService.getPrescription(mrn: mrn);
if (_prescriptionService.hasError) { if (_prescriptionService.hasError) {
@ -133,7 +130,6 @@ class PrescriptionViewModel extends BaseViewModel {
Future postPrescription( Future postPrescription(
PostPrescriptionReqModel postProcedureReqModel, int mrn) async { PostPrescriptionReqModel postProcedureReqModel, int mrn) async {
hasError = false; hasError = false;
//_insuranceCardService.clearInsuranceCard();
setState(ViewState.BusyLocal); setState(ViewState.BusyLocal);
await _prescriptionService.postPrescription(postProcedureReqModel); await _prescriptionService.postPrescription(postProcedureReqModel);
if (_prescriptionService.hasError) { if (_prescriptionService.hasError) {
@ -158,7 +154,6 @@ class PrescriptionViewModel extends BaseViewModel {
Future updatePrescription( Future updatePrescription(
PostPrescriptionReqModel updatePrescriptionReqModel, int mrn) async { PostPrescriptionReqModel updatePrescriptionReqModel, int mrn) async {
hasError = false; hasError = false;
//_insuranceCardService.clearInsuranceCard();
setState(ViewState.BusyLocal); setState(ViewState.BusyLocal);
await _prescriptionService.updatePrescription(updatePrescriptionReqModel); await _prescriptionService.updatePrescription(updatePrescriptionReqModel);
if (_prescriptionService.hasError) { if (_prescriptionService.hasError) {
@ -172,7 +167,6 @@ class PrescriptionViewModel extends BaseViewModel {
Future getDrugs({String drugName}) async { Future getDrugs({String drugName}) async {
hasError = false; hasError = false;
//_insuranceCardService.clearInsuranceCard();
setState(ViewState.BusyLocal); setState(ViewState.BusyLocal);
await _prescriptionService.getDrugs(drugName: drugName); await _prescriptionService.getDrugs(drugName: drugName);
if (_prescriptionService.hasError) { if (_prescriptionService.hasError) {
@ -296,14 +290,15 @@ class PrescriptionViewModel extends BaseViewModel {
getPrescriptions(PatiantInformtion patient, {String patientType, bool isLocalBusy = true}) async { getPrescriptions(PatiantInformtion patient, {String patientType, bool isLocalBusy = true}) async {
if(isLocalBusy) if(isLocalBusy)
setState(ViewState.BusyLocal); else setState(ViewState.Busy); setState(ViewState.BusyLocal);
else setState(ViewState.Busy);
await _prescriptionsService.getPrescriptions(patient); await _prescriptionsService.getPrescriptions(patient);
if (_prescriptionsService.hasError) { if (_prescriptionsService.hasError) {
error = _prescriptionsService.error; error = _prescriptionsService.error;
if (isLocalBusy) if (isLocalBusy)
setState(ViewState.Error);
else
setState(ViewState.ErrorLocal); setState(ViewState.ErrorLocal);
else
setState(ViewState.Error);
} else { } else {
_filterList(); _filterList();
await _getPrescriptionsOrders(); await _getPrescriptionsOrders();

@ -1,13 +1,10 @@
import 'dart:math'; import 'dart:math';
import 'package:autocomplete_textfield/autocomplete_textfield.dart'; import 'package:autocomplete_textfield/autocomplete_textfield.dart';
import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/core/model/search_drug/get_medication_response_model.dart'; import 'package:doctor_app_flutter/core/model/search_drug/get_medication_response_model.dart';
import 'package:doctor_app_flutter/core/viewModel/medicine_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/medicine_view_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/screens/medicine/pharmacies_list_screen.dart'; import 'package:doctor_app_flutter/screens/medicine/pharmacies_list_screen.dart';
import 'package:doctor_app_flutter/screens/patients/patient_search/patient_search_header.dart';
import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_title.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_title.dart';
import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart';
import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart';
@ -21,7 +18,6 @@ import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils
import 'package:doctor_app_flutter/widgets/shared/text_fields/app_text_field_custom_serach.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/app_text_field_custom_serach.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart'; import 'package:hexcolor/hexcolor.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:speech_to_text/speech_recognition_error.dart'; import 'package:speech_to_text/speech_recognition_error.dart';
import 'package:speech_to_text/speech_recognition_result.dart'; import 'package:speech_to_text/speech_recognition_result.dart';
import 'package:speech_to_text/speech_to_text.dart'; import 'package:speech_to_text/speech_to_text.dart';
@ -45,15 +41,11 @@ class _MedicineSearchState extends State<MedicineSearchScreen> {
Helpers helpers = new Helpers(); Helpers helpers = new Helpers();
bool _hasSpeech = false; bool _hasSpeech = false;
String _currentLocaleId = ""; String _currentLocaleId = "";
bool _isInit = true;
final SpeechToText speech = SpeechToText(); final SpeechToText speech = SpeechToText();
String lastStatus = ''; String lastStatus = '';
GetMedicationResponseModel _selectedMedication;
GlobalKey key = GlobalKey key =
new GlobalKey<AutoCompleteTextFieldState<GetMedicationResponseModel>>(); new GlobalKey<AutoCompleteTextFieldState<GetMedicationResponseModel>>();
// String lastWords;
List<LocaleName> _localeNames = [];
String lastError; String lastError;
double level = 0.0; double level = 0.0;
double minSoundLevel = 50000; double minSoundLevel = 50000;
@ -65,24 +57,13 @@ class _MedicineSearchState extends State<MedicineSearchScreen> {
super.didChangeDependencies(); super.didChangeDependencies();
} }
void requestPermissions() async {
Map<Permission, PermissionStatus> statuses = await [
Permission.microphone,
].request();
}
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);
// if (hasSpeech) {
// _localeNames = await speech.locales();
// var systemLocale = await speech.systemLocale();
_currentLocaleId = TranslationBase.of(context).locale.languageCode == 'en' _currentLocaleId = TranslationBase.of(context).locale.languageCode == 'en'
? 'en-GB' ? 'en-GB'
: 'ar-SA'; // systemLocale.localeId; : 'ar-SA'; // systemLocale.localeId;
// }
if (!mounted) return; if (!mounted) return;
setState(() { setState(() {
@ -101,7 +82,6 @@ class _MedicineSearchState extends State<MedicineSearchScreen> {
appBar: BottomSheetTitle( appBar: BottomSheetTitle(
title: TranslationBase.of(context).searchMedicine, title: TranslationBase.of(context).searchMedicine,
), ),
//appBarTitle: TranslationBase.of(context).searchMedicine + "6",
body: SingleChildScrollView( body: SingleChildScrollView(
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
@ -153,7 +133,6 @@ class _MedicineSearchState extends State<MedicineSearchScreen> {
child: ListView.builder( child: ListView.builder(
padding: const EdgeInsets.only(top: 20), padding: const EdgeInsets.only(top: 20),
scrollDirection: Axis.vertical, scrollDirection: Axis.vertical,
// shrinkWrap: true,
itemCount: model.pharmacyItemsList == null itemCount: model.pharmacyItemsList == null
? 0 ? 0
: model.pharmacyItemsList.length, : model.pharmacyItemsList.length,
@ -208,9 +187,7 @@ class _MedicineSearchState extends State<MedicineSearchScreen> {
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
title: TranslationBase.of(context).search, title: TranslationBase.of(context).search,
onPressed: () async { onPressed: () async {
// onSubmitSearch();
await searchMedicine(context, model); await searchMedicine(context, model);
}, },
color: AppGlobal.appRedColor, color: AppGlobal.appRedColor,
), ),
@ -232,7 +209,6 @@ class _MedicineSearchState extends State<MedicineSearchScreen> {
FocusScope.of(context).unfocus(); FocusScope.of(context).unfocus();
if (myController.text.isNullOrEmpty()) { if (myController.text.isNullOrEmpty()) {
Helpers.showErrorToast(TranslationBase.of(context).typeMedicineName); Helpers.showErrorToast(TranslationBase.of(context).typeMedicineName);
//"Type Medicine Name")
return; return;
} }
if (myController.text.length < 3) { if (myController.text.length < 3) {
@ -247,7 +223,6 @@ class _MedicineSearchState extends State<MedicineSearchScreen> {
} }
startVoiceSearch() { startVoiceSearch() {
// lastWords = "";
lastError = ""; lastError = "";
speech.listen( speech.listen(
onResult: resultListener, onResult: resultListener,
@ -263,18 +238,15 @@ class _MedicineSearchState extends State<MedicineSearchScreen> {
void resultListener(SpeechRecognitionResult result) { void resultListener(SpeechRecognitionResult result) {
setState(() { setState(() {
// lastWords = "${result.recognizedWords} - ${result.finalResult}";
recognizedWord = result.recognizedWords; recognizedWord = result.recognizedWords;
lastStatus = ''; lastStatus = '';
myController.text = recognizedWord; myController.text = recognizedWord;
Future.delayed(const Duration(seconds: 2), () { Future.delayed(const Duration(seconds: 2), () {
// searchMedicine(context);
}); });
}); });
} }
void errorListener(SpeechRecognitionError error) { void errorListener(SpeechRecognitionError error) {
// print("Received error status: $error, listening: ${speech.isListening}");
setState(() { setState(() {
lastError = "${error.errorMsg} - ${error.permanent}"; lastError = "${error.errorMsg} - ${error.permanent}";
}); });
@ -282,23 +254,15 @@ class _MedicineSearchState extends State<MedicineSearchScreen> {
void statusListener(String status) { void statusListener(String status) {
// print( // print(
// "Received listener status: $status, listening: ${speech.isListening}");
setState(() { setState(() {
lastStatus = status; lastStatus = status;
}); });
} }
// _switchLang(selectedVal) {
// setState(() {
// _currentLocaleId = selectedVal;
// });
// print(selectedVal);
// }
void soundLevelListener(double level) { void soundLevelListener(double level) {
minSoundLevel = min(minSoundLevel, level); minSoundLevel = min(minSoundLevel, level);
maxSoundLevel = max(maxSoundLevel, level); maxSoundLevel = max(maxSoundLevel, level);
// print("sound level $level: $minSoundLevel - $maxSoundLevel ");
setState(() { setState(() {
this.level = level; this.level = level;
}); });

@ -5,14 +5,6 @@ import 'package:flutter/material.dart';
import '../../../../config/config.dart'; import '../../../../config/config.dart';
/// *
/// By Mousa Zaid Mousa Abuzaid
/// At 13/4/2021
/*
All hex value from 100% to 0% alpha: used in line 122
https://gist.github.com/lopspower/03fb1cc0ac9f32ef38f4
*/
class PageStepperWidget extends StatelessWidget { class PageStepperWidget extends StatelessWidget {
final int stepsCount; final int stepsCount;

@ -54,7 +54,6 @@ class _AddDrugWidgetState extends State<AddDrugWidget> {
width: SizeConfig.realScreenWidth, width: SizeConfig.realScreenWidth,
child: SingleChildScrollView( child: SingleChildScrollView(
child: Column( child: Column(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
DrugToDrug( DrugToDrug(
widget.patient, widget.patient,

@ -220,7 +220,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
? widget.medicineViewModel.itemMedicineListUnit[0] ? widget.medicineViewModel.itemMedicineListUnit[0]
: units, : units,
elementError: unitError, elementError: unitError,
keyName: TranslationBase.of(context).description, keyName: 'description',
keyId: 'parameterCode', keyId: 'parameterCode',
hintText: TranslationBase.of(context).unit, hintText: TranslationBase.of(context).unit,
elementList: widget.medicineViewModel.itemMedicineListUnit, elementList: widget.medicineViewModel.itemMedicineListUnit,
@ -241,7 +241,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
: route, : route,
elementError: routeError, elementError: routeError,
keyId: 'parameterCode', keyId: 'parameterCode',
keyName: TranslationBase.of(context).description, keyName: 'description',
okFunction: (selectedValue) { okFunction: (selectedValue) {
setState(() { setState(() {
route = selectedValue; route = selectedValue;
@ -260,7 +260,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
: frequency, : frequency,
elementList: widget.medicineViewModel.itemMedicineList, elementList: widget.medicineViewModel.itemMedicineList,
keyId: 'parameterCode', keyId: 'parameterCode',
keyName: TranslationBase.of(context).description, keyName: 'description',
okFunction: (selectedValue) { okFunction: (selectedValue) {
setState(() { setState(() {
frequency = selectedValue; frequency = selectedValue;
@ -507,6 +507,8 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
), ),
), ),
); );
// Navigator.pop(context);
// openDrugToDrug(model, prescriptionViewModel);
} }
} else { } else {
setState(() { setState(() {

@ -1,991 +0,0 @@
import 'package:autocomplete_textfield/autocomplete_textfield.dart';
import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/model/Prescriptions/post_prescrition_req_model.dart';
import 'package:doctor_app_flutter/core/model/search_drug/get_medication_response_model.dart';
import 'package:doctor_app_flutter/core/viewModel/medicine_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/prescription_view_model.dart';
import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/util/date-utils.dart';
import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart';
import 'package:doctor_app_flutter/util/helpers.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/shared/TextFields.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/dialogs/dailog-list-select.dart';
import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:hexcolor/hexcolor.dart';
class UpdatePrescriptionForm extends StatefulWidget {
final String drugName;
final String doseStreangth;
final int drugId;
final String remarks;
final PatiantInformtion patient;
final String duration;
final String route;
final String dose;
final String doseUnit;
final String enteredRemarks;
final String startDate;
final String frequency;
final String drugNameGeneric;
final String uom;
final int box;
final PrescriptionViewModel model;
UpdatePrescriptionForm(
{this.drugName,
this.doseStreangth,
this.drugId,
this.remarks,
this.patient,
this.duration,
this.route,
this.dose,
this.startDate,
this.doseUnit,
this.enteredRemarks,
this.frequency,
this.model,
this.drugNameGeneric,
this.uom,
this.box});
@override
_UpdatePrescriptionFormState createState() => _UpdatePrescriptionFormState();
}
class _UpdatePrescriptionFormState extends State<UpdatePrescriptionForm> {
TextEditingController strengthController = TextEditingController();
TextEditingController remarksController = TextEditingController();
int testNum = 0;
int strengthChar;
PatiantInformtion patient;
/// TODO Elham* add type
dynamic route;
dynamic doseTime;
dynamic frequencyUpdate;
dynamic updatedDuration;
dynamic units;
GetMedicationResponseModel newSelectedMedication;
GlobalKey key =
new GlobalKey<AutoCompleteTextFieldState<GetMedicationResponseModel>>();
List<dynamic> indicationList;
dynamic indication;
DateTime selectedDate;
@override
void initState() {
super.initState();
strengthController.text = widget.doseStreangth;
remarksController.text = widget.remarks;
indicationList = List();
/// TODO Elham* create model and try to have them form service and add translation
dynamic indication1 = {"id": 545, "name": "Gingival Hyperplasia"};
dynamic indication2 = {"id": 546, "name": "Mild Drowsiness"};
dynamic indication3 = {"id": 547, "name": "Hypertrichosis"};
dynamic indication4 = {"id": 548, "name": "Mild Dizziness"};
dynamic indication5 = {"id": 549, "name": "Enlargement of Facial Features"};
dynamic indication6 = {
"id": 550,
"name": "Phenytoin Hypersensitivity Syndrome"
};
dynamic indication7 = {"id": 551, "name": "Asterixis"};
dynamic indication8 = {"id": 552, "name": "Bullous Dermatitis"};
dynamic indication9 = {"id": 554, "name": "Purpuric Dermatitis"};
dynamic indication10 = {"id": 555, "name": "Systemic Lupus Erythematosus"};
indicationList.add(indication1);
indicationList.add(indication2);
indicationList.add(indication3);
indicationList.add(indication4);
indicationList.add(indication5);
indicationList.add(indication6);
indicationList.add(indication7);
indicationList.add(indication8);
indicationList.add(indication9);
indicationList.add(indication10);
}
/// TODO Elham* Add Translation
@override
Widget build(BuildContext context) {
final screenSize = MediaQuery.of(context).size;
return StatefulBuilder(builder:
(BuildContext context, StateSetter setState /*You can rename this!*/) {
return BaseView<MedicineViewModel>(
onModelReady: (model) async {
/// TODO Elham* Move this to view model and remove unused data
await model.getMedicationList();
await model.getMedicationStrength();
await model.getMedicationDuration();
await model.getMedicationRoute();
await model.getMedicationFrequency();
await model.getMedicationDoseTime();
await model.getItem(itemID: widget.drugId);
//await model.getMedicationIndications();
route = model.getLookupByIdFilter(
model.itemMedicineListRoute, widget.route);
doseTime =
model.getLookupById(model.medicationDoseTimeList, widget.dose);
updatedDuration = model.getLookupById(
model.medicationDurationList, widget.duration);
units = model.getLookupByIdFilter(
model.itemMedicineListUnit, widget.doseUnit);
frequencyUpdate = model.getLookupById(
model.medicationFrequencyList, widget.frequency);
},
builder:
(BuildContext context, MedicineViewModel model, Widget child) =>
NetworkBaseView(
baseViewModel: model,
child: GestureDetector(
onTap: () {
FocusScope.of(context).requestFocus(new FocusNode());
},
child: DraggableScrollableSheet(
initialChildSize: 0.98,
maxChildSize: 0.99,
minChildSize: 0.6,
builder:
(BuildContext context, ScrollController scrollController) {
return SingleChildScrollView(
child: Container(
height: MediaQuery.of(context).size.height * 1.5,
child: Form(
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: 20.0, vertical: 12.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppText(
widget.drugName.toUpperCase(),
fontWeight: FontWeight.w900,
),
SizedBox(
height: 10.0,
),
Column(
children: [
Container(
height:
MediaQuery.of(context).size.height *
0.060,
width: double.infinity,
child: Row(
children: [
Container(
width: MediaQuery.of(context)
.size
.width *
0.4900,
height: MediaQuery.of(context)
.size
.height *
0.55,
child: TextFields(
inputFormatters: [
LengthLimitingTextInputFormatter(
5),
// WhitelistingTextInputFormatter
// .digitsOnly
],
hintText: widget.doseStreangth,
fontSize: 15.0,
controller: strengthController,
keyboardType: TextInputType
.numberWithOptions(
decimal: true,
),
onChanged: (String value) {
setState(() {
strengthChar = value.length;
});
if (strengthChar >= 5) {
DrAppToastMsg.showErrorToast(
"Only 5 Digits allowed for strength");
}
},
),
),
SizedBox(
width: 10.0,
),
Container(
width: MediaQuery.of(context)
.size
.width *
0.3700,
child: InkWell(
onTap:
model.itemMedicineListUnit !=
null
? () {
Helpers.hideKeyboard(
context);
ListSelectDialog
dialog =
ListSelectDialog(
list: model
.itemMedicineListUnit,
attributeName:
'description',
attributeValueId:
'parameterCode',
okText:
TranslationBase.of(
context)
.ok,
okFunction:
(selectedValue) {
setState(() {
units =
selectedValue;
});
},
);
showDialog(
barrierDismissible:
false,
context: context,
builder:
(BuildContext
context) {
return dialog;
},
);
}
: null,
child: TextField(
decoration:
textFieldSelectorDecoration(
'UNIT Type',
units != null
? units[
'description']
: null,
true),
enabled: false,
),
),
),
],
),
),
SizedBox(
height: 12,
),
Container(
height:
MediaQuery.of(context).size.height *
0.070,
child: InkWell(
onTap: model.itemMedicineListRoute !=
null
? () {
Helpers.hideKeyboard(context);
ListSelectDialog dialog =
ListSelectDialog(
list: model
.itemMedicineListRoute,
attributeName: 'description',
attributeValueId:
'parameterCode',
okText: TranslationBase.of(
context)
.ok,
okFunction: (selectedValue) {
setState(() {
route = selectedValue;
});
if (route == null) {
route = route['id'];
}
},
);
showDialog(
barrierDismissible: false,
context: context,
builder:
(BuildContext context) {
return dialog;
},
);
}
: null,
child: TextField(
decoration:
textFieldSelectorDecoration(
'Route',
route != null
? route['description']
: null,
true),
enabled: false,
),
),
),
SizedBox(
height: 12.0,
),
Container(
height:
MediaQuery.of(context).size.height *
0.070,
child: InkWell(
onTap: model.medicationDoseTimeList !=
null
? () {
Helpers.hideKeyboard(context);
ListSelectDialog dialog =
ListSelectDialog(
list: model
.medicationDoseTimeList,
attributeName: 'nameEn',
attributeValueId: 'id',
okText: TranslationBase.of(
context)
.ok,
okFunction: (selectedValue) {
setState(() {
doseTime = selectedValue;
});
},
);
showDialog(
barrierDismissible: false,
context: context,
builder:
(BuildContext context) {
return dialog;
},
);
}
: null,
child: TextField(
decoration:
textFieldSelectorDecoration(
TranslationBase.of(context)
.doseTime,
doseTime != null
? doseTime['nameEn']
: null,
true),
enabled: false,
),
),
),
SizedBox(
height: 12.0,
),
Container(
height:
MediaQuery.of(context).size.height *
0.070,
child: InkWell(
onTap: model.medicationFrequencyList !=
null
? () {
Helpers.hideKeyboard(context);
ListSelectDialog dialog =
ListSelectDialog(
list: model
.medicationFrequencyList,
attributeName: 'nameEn',
attributeValueId: 'id',
okText: TranslationBase.of(
context)
.ok,
okFunction: (selectedValue) {
setState(() {
frequencyUpdate =
selectedValue;
});
},
);
showDialog(
barrierDismissible: false,
context: context,
builder:
(BuildContext context) {
return dialog;
},
);
}
: null,
child: TextField(
decoration:
textFieldSelectorDecoration(
TranslationBase.of(context)
.frequency,
frequencyUpdate != null
? frequencyUpdate[
'nameEn']
: null,
true),
enabled: false,
),
),
),
SizedBox(
height: 12.0,
),
Container(
height:
MediaQuery.of(context).size.height *
0.070,
child: InkWell(
onTap: model.medicationDurationList !=
null
? () {
Helpers.hideKeyboard(context);
ListSelectDialog dialog =
ListSelectDialog(
list: model
.medicationDurationList,
attributeName: 'nameEn',
attributeValueId: 'id',
okText: TranslationBase.of(
context)
.ok,
okFunction: (selectedValue) {
setState(() {
updatedDuration =
selectedValue;
});
},
);
showDialog(
barrierDismissible: false,
context: context,
builder:
(BuildContext context) {
return dialog;
},
);
}
: null,
child: TextField(
decoration:
textFieldSelectorDecoration(
TranslationBase.of(context)
.duration,
updatedDuration != null
? updatedDuration[
'nameEn']
.toString()
: null,
true),
enabled: false,
),
),
),
SizedBox(
height: 12.0,
),
Container(
height: model.patientAssessmentList
.isNotEmpty
? screenSize.height * 0.070
: 0.0,
width: model.patientAssessmentList
.isNotEmpty
? double.infinity
: 0.0,
child: model.patientAssessmentList
.isNotEmpty
? Row(
children: [
Container(
width:
MediaQuery.of(context)
.size
.width *
0.29,
child: InkWell(
onTap:
indicationList != null
? () {
Helpers.hideKeyboard(
context);
}
: null,
child: TextField(
decoration: textFieldSelectorDecoration(
model.patientAssessmentList
.isNotEmpty
? model
.patientAssessmentList[
0]
.icdCode10ID
.toString()
: '',
indication != null
? indication[
'name']
: null,
true),
enabled: true,
readOnly: true,
),
),
),
Container(
width:
MediaQuery.of(context)
.size
.width *
0.61,
child: InkWell(
onTap:
indicationList != null
? () {
Helpers.hideKeyboard(
context);
}
: null,
child: TextField(
maxLines: 3,
decoration: textFieldSelectorDecoration(
model.patientAssessmentList
.isNotEmpty
? model
.patientAssessmentList[
0]
.asciiDesc
.toString()
: '',
indication != null
? indication[
'name']
: null,
true),
enabled: true,
readOnly: true,
),
),
),
],
)
: null),
SizedBox(
height: 12.0,
),
Container(
height: screenSize.height * 0.070,
child: InkWell(
onTap: () =>
selectDate(context, widget.model),
child: TextField(
decoration: Helpers
.textFieldSelectorDecoration(
AppDateUtils.getDateFormatted(
DateTime.parse(
widget.startDate)),
selectedDate != null
? "${AppDateUtils.convertStringToDateFormat(selectedDate.toString(), "yyyy-MM-dd")}"
: null,
true,
suffixIcon: Icon(
Icons.calendar_today,
color: Colors.black,
)),
enabled: false,
),
),
),
SizedBox(
height: 12.0,
),
Container(
height: screenSize.height * 0.070,
child: InkWell(
onTap: model.allMedicationList != null
? () {
Helpers.hideKeyboard(context);
ListSelectDialog dialog =
ListSelectDialog(
list: model.allMedicationList,
attributeName: 'nameEn',
attributeValueId: 'id',
okText: TranslationBase.of(
context)
.ok,
okFunction: (selectedValue) {
setState(() {
// duration = selectedValue;
});
},
);
showDialog(
barrierDismissible: false,
context: context,
builder:
(BuildContext context) {
return dialog;
},
);
}
: null,
child: TextField(
decoration:
textFieldSelectorDecoration(
"UOM",
widget.uom != null
? widget.uom
: null,
true),
// enabled: false,
readOnly: true,
),
),
),
Container(
height: screenSize.height * 0.070,
child: InkWell(
onTap: model.allMedicationList != null
? () {
Helpers.hideKeyboard(context);
ListSelectDialog dialog =
ListSelectDialog(
list: model.allMedicationList,
attributeName: 'nameEn',
attributeValueId: 'id',
okText: TranslationBase.of(
context)
.ok,
okFunction: (selectedValue) {
setState(() {
// duration = selectedValue;
});
},
);
showDialog(
barrierDismissible: false,
context: context,
builder:
(BuildContext context) {
return dialog;
},
);
}
: null,
child: TextField(
decoration:
textFieldSelectorDecoration(
'Box Quantity',
widget.box != null
? "Box Quantity: " +
widget.box.toString()
: null,
true),
// enabled: false,
readOnly: true,
),
),
),
SizedBox(
height: 12.0,
),
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(6.0)),
border: Border.all(
width: 1.0,
color: HexColor("#CCCCCC"))),
child: TextFields(
controller: remarksController,
maxLines: 7,
minLines: 4,
),
),
SizedBox(
height: 10.0,
),
SizedBox(
height:
MediaQuery.of(context).size.height *
0.08,
),
Container(
margin: EdgeInsets.all(
SizeConfig.widthMultiplier * 2),
child: Wrap(
alignment: WrapAlignment.center,
children: <Widget>[
AppButton(
title: 'update prescription'
.toUpperCase(),
onPressed: () {
/// TODO Elham* Move this to function
if (double.parse(
strengthController.text) >
1000.0) {
DrAppToastMsg.showErrorToast(
"1000 is the MAX for the strength");
return;
}
if (double.parse(
strengthController
.text) ==
0.0) {
DrAppToastMsg.showErrorToast(
"strength can't be zero");
return;
}
if (strengthController
.text.length >
4) {
DrAppToastMsg.showErrorToast(
"strength can't be more then 4 digits ");
return;
}
// if(units==null&& updatedDuration==null&&frequencyUpdate==null&&)
updatePrescription(
newStartDate: selectedDate,
newDoseStreangth:
strengthController
.text.isNotEmpty
? strengthController
.text
: widget
.doseStreangth,
newUnit: units != null
? units['parameterCode']
.toString()
: widget.doseUnit,
doseUnit: widget.doseUnit,
doseStreangth:
widget.doseStreangth,
duration: widget.duration,
startDate: widget.startDate,
doseId: widget.dose,
frequencyId: widget.frequency,
routeId: widget.route,
patient: widget.patient,
model: widget.model,
newDuration:
updatedDuration != null
? updatedDuration['id']
.toString()
: widget.duration,
drugId: widget.drugId,
remarks: remarksController
.text,
route: route != null
? route['parameterCode']
.toString()
: widget.route,
frequency:
frequencyUpdate != null
? frequencyUpdate[
'id']
.toString()
: widget.frequency,
dose: doseTime != null
? doseTime['id']
.toString()
: widget.dose,
enteredRemarks:
widget.enteredRemarks);
Navigator.pop(context);
},
),
],
),
),
],
),
],
),
),
)),
);
}),
),
),
);
});
}
selectDate(BuildContext context, PrescriptionViewModel model) async {
Helpers.hideKeyboard(context);
DateTime selectedDate;
selectedDate = DateTime.now();
final DateTime picked = await showDatePicker(
context: context,
initialDate: selectedDate,
firstDate: DateTime.now(),
lastDate: DateTime(2040),
initialEntryMode: DatePickerEntryMode.calendar,
);
if (picked != null && picked != selectedDate) {
setState(() {
this.selectedDate = picked;
});
}
}
// /// TODO Elham* Use it from the textfeild utils
InputDecoration textFieldSelectorDecoration(
String hintText, String selectedText, bool isDropDown,
{Icon suffixIcon}) {
return InputDecoration(
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0),
borderRadius: BorderRadius.circular(8),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0),
borderRadius: BorderRadius.circular(8),
),
disabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0),
borderRadius: BorderRadius.circular(8),
),
hintText: selectedText != null ? selectedText : hintText,
suffixIcon: isDropDown
? suffixIcon != null
? suffixIcon
: Icon(
Icons.arrow_drop_down,
color: Colors.black,
)
: null,
hintStyle: TextStyle(
fontSize: 14,
color: Colors.grey.shade600,
),
);
}
/// TODO Elham* Move this to view model and pass all data as model
updatePrescription(
{PrescriptionViewModel model,
int drugId,
String newDrugId,
String frequencyId,
String remarks,
String dose,
String doseId,
String frequency,
String route,
String routeId,
String startDate,
DateTime newStartDate,
String doseUnit,
String doseStreangth,
String newDoseStreangth,
String duration,
String newDuration,
String newUnit,
String enteredRemarks,
PatiantInformtion patient}) async {
//PrescriptionViewModel model = PrescriptionViewModel();
PostPrescriptionReqModel updatePrescriptionReqModel =
new PostPrescriptionReqModel();
List<PrescriptionRequestModel> sss = List();
updatePrescriptionReqModel.appointmentNo = patient.appointmentNo;
updatePrescriptionReqModel.clinicID = patient.clinicId;
updatePrescriptionReqModel.episodeID = patient.episodeNo;
updatePrescriptionReqModel.patientMRN = patient.patientMRN;
sss.add(PrescriptionRequestModel(
covered: true,
dose: newDoseStreangth.isNotEmpty
? double.parse(newDoseStreangth)
: double.parse(doseStreangth),
//frequency.isNotEmpty ? int.parse(dose) : 1,
itemId: drugId,
doseUnitId:
newUnit.isNotEmpty ? int.parse(newUnit) : int.parse(doseUnit),
route: route.isNotEmpty ? int.parse(route) : int.parse(routeId),
frequency: frequency.isNotEmpty
? int.parse(frequency)
: int.parse(frequencyId),
remarks: remarks.isEmpty ? enteredRemarks : remarks,
approvalRequired: true,
icdcode10Id: "test2",
doseTime: dose.isNotEmpty ? int.parse(dose) : int.parse(doseId),
duration: newDuration.isNotEmpty
? int.parse(newDuration)
: int.parse(duration),
doseStartDate:
newStartDate != null ? newStartDate.toIso8601String() : startDate));
updatePrescriptionReqModel.prescriptionRequestModel = sss;
//postProcedureReqModel.procedures = controlsProcedure;
await model.updatePrescription(
updatePrescriptionReqModel, patient.patientMRN);
if (model.state == ViewState.ErrorLocal) {
Helpers.showErrorToast(model.error);
} else if (model.state == ViewState.Idle) {
DrAppToastMsg.showSuccesToast('Medication has been updated');
}
}
}
void updatePrescriptionForm(
{context,
String drugName,
String drugNameGeneric,
int drugId,
String remarks,
PrescriptionViewModel model,
PatiantInformtion patient,
String rouat,
String frequency,
String dose,
String duration,
String doseStreangth,
String doseUnit,
String enteredRemarks,
String uom,
int box,
String startDate}) {
/// TODO Elham* remove unused code.
TextEditingController remarksController = TextEditingController();
TextEditingController doseController = TextEditingController();
TextEditingController frequencyController = TextEditingController();
TextEditingController routeController = TextEditingController();
showModalBottomSheet(
context: context,
isScrollControlled: true,
builder: (BuildContext context) {
return UpdatePrescriptionForm(
box: box,
uom: uom,
drugName: drugName,
patient: patient,
doseStreangth: doseStreangth,
remarks: remarks,
drugId: drugId,
enteredRemarks: enteredRemarks,
duration: duration,
dose: dose,
doseUnit: doseUnit,
frequency: frequency,
route: rouat,
startDate: startDate,
model: model,
drugNameGeneric: drugNameGeneric,
);
});
}

@ -221,6 +221,7 @@ class _PrescriptionCheckOutScreenState
final screenSize = MediaQuery.of(context).size; final screenSize = MediaQuery.of(context).size;
return BaseView<MedicineViewModel>( return BaseView<MedicineViewModel>(
onModelReady: (model) async { onModelReady: (model) async {
// TODO Elham* move this logic to the model
model.getItem( model.getItem(
itemID: int.parse( itemID: int.parse(
widget.groupProcedures.aliasN.replaceAll("item code ;", ""))); widget.groupProcedures.aliasN.replaceAll("item code ;", "")));
@ -395,7 +396,7 @@ class _PrescriptionCheckOutScreenState
0.560, 0.560,
element: units, element: units,
elementError: unitError, elementError: unitError,
keyName: TranslationBase.of(context).description, keyName: 'description',
keyId: 'parameterCode', keyId: 'parameterCode',
hintText: 'Select', hintText: 'Select',
elementList: elementList:
@ -417,7 +418,7 @@ class _PrescriptionCheckOutScreenState
element: route, element: route,
elementError: routeError, elementError: routeError,
keyId: 'parameterCode', keyId: 'parameterCode',
keyName: TranslationBase.of(context).description, keyName: 'description',
okFunction: (selectedValue) { okFunction: (selectedValue) {
setState(() { setState(() {
route = selectedValue; route = selectedValue;
@ -435,7 +436,7 @@ class _PrescriptionCheckOutScreenState
element: frequency, element: frequency,
elementList: model.itemMedicineList, elementList: model.itemMedicineList,
keyId: 'parameterCode', keyId: 'parameterCode',
keyName: TranslationBase.of(context).description, keyName: 'description',
okFunction: (selectedValue) { okFunction: (selectedValue) {
setState(() { setState(() {
frequency = selectedValue; frequency = selectedValue;

@ -44,7 +44,7 @@ class _PrescriptionTextFiledState extends State<PrescriptionTextFiled> {
list: widget.elementList, list: widget.elementList,
attributeName: '${widget.keyName}', attributeName: '${widget.keyName}',
attributeValueId: widget.elementList.length == 1 attributeValueId: widget.elementList.length == 1
? widget.elementList[0]['${widget.keyId}'].toString() ? widget.elementList[0]['${widget.keyId}']
: '${widget.keyId}', : '${widget.keyId}',
okText: TranslationBase.of(context).ok, okText: TranslationBase.of(context).ok,
okFunction: (selectedValue) => okFunction: (selectedValue) =>

@ -48,9 +48,12 @@ class PrescriptionItemsPage extends StatelessWidget {
child: Container( child: Container(
child: Column( child: Column(
children: [ children: [
...List.generate( ListView.builder(
model.prescriptionReportList.length, scrollDirection: Axis.vertical,
(index) => PrescriptionItemsWidget( physics: NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemCount: model.prescriptionReportEnhList.length,
itemBuilder: (context, index) => PrescriptionItemsWidget(
frequency: model.prescriptionReportEnhList[index].frequency, frequency: model.prescriptionReportEnhList[index].frequency,
itemDescription: model.prescriptionReportEnhList[index].itemDescription, itemDescription: model.prescriptionReportEnhList[index].itemDescription,
days: model.prescriptionReportEnhList[index].days, days: model.prescriptionReportEnhList[index].days,
@ -60,7 +63,7 @@ class PrescriptionItemsPage extends StatelessWidget {
remarks: model.prescriptionReportEnhList[index].remarks, remarks: model.prescriptionReportEnhList[index].remarks,
prescriptionsViewModel: model, prescriptionsViewModel: model,
), ),
) ),
], ],
), ),
), ),

@ -32,7 +32,8 @@ class PrescriptionsPage extends StatelessWidget {
return BaseView<PrescriptionViewModel>( return BaseView<PrescriptionViewModel>(
onModelReady: (model) async { onModelReady: (model) async {
patient.admissionNo == null patient.admissionNo == null
? model.getPrescriptions(patient, patientType: patientType, isLocalBusy: false) ? model.getPrescriptions(patient,
patientType: patientType, isLocalBusy: false)
: model.getMedicationForInPatient(patient); : model.getMedicationForInPatient(patient);
}, },
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
@ -46,96 +47,113 @@ class PrescriptionsPage extends StatelessWidget {
body: patient.admissionNo == null body: patient.admissionNo == null
? FractionallySizedBox( ? FractionallySizedBox(
widthFactor: 1.0, widthFactor: 1.0,
child: ListView( child: SingleChildScrollView(
physics: BouncingScrollPhysics(), child: Column(
children: <Widget>[ crossAxisAlignment: CrossAxisAlignment.start,
SizedBox( children: <Widget>[
height: 12, SizedBox(
), height: 12,
if (model.prescriptionsList.isNotEmpty &&
patient.patientStatusType != 43)
Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
ServiceTitle(
title: TranslationBase.of(context).orders,
subTitle:
TranslationBase.of(context).prescriptions,
),
],
),
), ),
if (patient.patientStatusType != null && if (model.prescriptionsList.isNotEmpty &&
patient.patientStatusType == 43) patient.patientStatusType != 43)
Padding( Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
ServiceTitle( ServiceTitle(
title: TranslationBase.of(context).orders, title: TranslationBase.of(context).orders,
subTitle: subTitle: TranslationBase.of(context)
TranslationBase.of(context).prescriptions, .prescriptions,
), ),
], ],
),
), ),
), if (patient.patientStatusType != null &&
if ((patient.patientStatusType != null && patient.patientStatusType == 43)
patient.patientStatusType == 43) || Padding(
(isFromLiveCare && patient.appointmentNo != null)) padding: const EdgeInsets.all(8.0),
AddNewOrder( child: Column(
onTap: () { crossAxisAlignment: CrossAxisAlignment.start,
Navigator.push( children: [
context, ServiceTitle(
SlideUpPageRoute( title: TranslationBase.of(context).orders,
widget: BaseAddProcedureTabPage( subTitle: TranslationBase.of(context)
patient: patient, .prescriptions,
prescriptionModel: model, ),
procedureType: ProcedureType.PRESCRIPTION, ],
), ),
settingRoute: 'AddProcedureTabPage'), ),
); if ((patient.patientStatusType != null &&
}, patient.patientStatusType == 43) ||
label: TranslationBase.of(context) (isFromLiveCare && patient.appointmentNo != null))
.applyForNewPrescriptionsOrder, AddNewOrder(
), onTap: () {
...List.generate Navigator.push(
( context,
model.prescriptionsList.length, SlideUpPageRoute(
(index) => InkWell( widget: BaseAddProcedureTabPage(
onTap: () => Navigator.push( patient: patient,
context, prescriptionModel: model,
FadePage( procedureType:
page: PrescriptionItemsPage( ProcedureType.PRESCRIPTION,
prescriptions: model.prescriptionsList[index],
patient: patient,
arrivalType: arrivalType,
),
), ),
), settingRoute: 'AddProcedureTabPage'),
child: Column( );
children: [ },
DoctorCard( label: TranslationBase.of(context)
doctorName: .applyForNewPrescriptionsOrder,
Helpers.convertToTitleCase(model.prescriptionsList[index].doctorName), ),
profileUrl: model.prescriptionsList[index].doctorImageURL, ListView.builder(
branch: model.prescriptionsList[index].name, physics: BouncingScrollPhysics(),
clinic: model.prescriptionsList[index].clinicDescription, itemCount: model.prescriptionsList.length,
isPrescriptions: true, shrinkWrap: true,
appointmentDate: AppDateUtils.getDateTimeFromServerFormat(model.prescriptionsList[index].appointmentDate,), itemBuilder: (BuildContext ctxt, int index) {
), return InkWell(
], onTap: () => Navigator.push(
))), context,
if (model.prescriptionsList.isEmpty && FadePage(
patient.patientStatusType != 43) page: PrescriptionItemsPage(
Center( prescriptions: model
child: ErrorMessage( .prescriptionsList[index],
error: TranslationBase.of(context) patient: patient,
.noPrescriptionsFound, arrivalType: arrivalType,
)) ),
], ),
),
child: Column(
children: [
DoctorCard(
doctorName:
Helpers.convertToTitleCase(model
.prescriptionsList[index]
.doctorName),
profileUrl: model
.prescriptionsList[index]
.doctorImageURL,
branch: model
.prescriptionsList[index].name,
clinic: model.prescriptionsList[index]
.clinicDescription,
isPrescriptions: true,
appointmentDate: AppDateUtils
.getDateTimeFromServerFormat(
model.prescriptionsList[index]
.appointmentDate,
),
),
],
));
}),
if (model.prescriptionsList.isEmpty &&
patient.patientStatusType != 43)
Center(
child: ErrorMessage(
error: TranslationBase.of(context)
.noPrescriptionsFound,
))
],
),
), ),
) )
: NetworkBaseView( : NetworkBaseView(
@ -154,29 +172,45 @@ class PrescriptionsPage extends StatelessWidget {
//model.medicationForInPatient.length, //model.medicationForInPatient.length,
return InkWell( return InkWell(
child: DoctorCard( child: DoctorCard(
doctorName: Helpers.convertToTitleCase(model.medicationForInPatient[index].pHRItemDescription,), doctorName: Helpers.convertToTitleCase(
profileUrl: model.prescriptionsList[index].doctorImageURL, model.medicationForInPatient[index]
.pHRItemDescription,
),
profileUrl: model.prescriptionsList[index]
.doctorImageURL,
branch: model.prescriptionsList[index].name, branch: model.prescriptionsList[index].name,
clinic: model.prescriptionsList[index].clinicDescription, clinic: model.prescriptionsList[index]
.clinicDescription,
isPrescriptions: true, isPrescriptions: true,
appointmentDate: AppDateUtils.getDateTimeFromServerFormat(model.medicationForInPatient[index].prescriptionDatetime,), appointmentDate: AppDateUtils
.getDateTimeFromServerFormat(
model.medicationForInPatient[index]
.prescriptionDatetime,
),
), ),
onTap: () => Navigator.push( onTap: () => Navigator.push(
context, context,
FadePage( FadePage(
page: page: PrescriptionItemsInPatientPage(
PrescriptionItemsInPatientPage( prescriptionIndex: index,
prescriptionIndex: index, prescriptions:
prescriptions: model.medicationForInPatient[index], model.medicationForInPatient[index],
patient: patient, patient: patient,
patientType: patientType, patientType: patientType,
arrivalType: arrivalType, arrivalType: arrivalType,
startOn: AppDateUtils.getDateTimeFromServerFormat(model.medicationForInPatient[index].startDatetime,), startOn: AppDateUtils
stopOn: AppDateUtils.getDateTimeFromServerFormat(model.medicationForInPatient[index].stopDatetime, .getDateTimeFromServerFormat(
), model.medicationForInPatient[index]
), .startDatetime,
), ),
stopOn: AppDateUtils
.getDateTimeFromServerFormat(
model.medicationForInPatient[index]
.stopDatetime,
), ),
),
),
),
); );
}), }),
if (model.medicationForInPatient.length == 0) if (model.medicationForInPatient.length == 0)

Loading…
Cancel
Save