move bottom sheet to index page

episode_fixes
Elham Rababh 5 years ago
parent b341bd5f47
commit e58ce34aa4

@ -27,6 +27,10 @@ import 'package:doctor_app_flutter/models/SOAP/post_histories_request_model.dart
import 'package:doctor_app_flutter/models/SOAP/post_physical_exam_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_physical_exam_request_model.dart';
import 'package:doctor_app_flutter/models/SOAP/post_progress_note_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_progress_note_request_model.dart';
import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_examination.dart'; import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_examination.dart';
import 'package:doctor_app_flutter/screens/patients/profile/soap_update/assessment/assessmentCallBack.dart';
import 'package:doctor_app_flutter/screens/patients/profile/soap_update/objective/objectiveCallBack.dart';
import 'package:doctor_app_flutter/screens/patients/profile/soap_update/plan/planCallBack.dart';
import 'package:doctor_app_flutter/screens/patients/profile/soap_update/subjective/subjectiveCallBack.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../../locator.dart'; import '../../locator.dart';
@ -86,6 +90,9 @@ class SOAPViewModel extends BaseViewModel {
_SOAPService.patientAssessmentList; _SOAPService.patientAssessmentList;
int get episodeID => _SOAPService.episodeID; int get episodeID => _SOAPService.episodeID;
bool isAddProgress = true;
String progressNoteText ="";
get medicationStrengthList => _SOAPService.medicationStrengthListWithModel; get medicationStrengthList => _SOAPService.medicationStrengthListWithModel;
get medicationDoseTimeList => _SOAPService.medicationDoseTimeListWithModel; get medicationDoseTimeList => _SOAPService.medicationDoseTimeListWithModel;
get medicationRouteList => _SOAPService.medicationRouteListWithModel; get medicationRouteList => _SOAPService.medicationRouteListWithModel;
@ -93,6 +100,43 @@ class SOAPViewModel extends BaseViewModel {
List<GetMedicationResponseModel> get allMedicationList => List<GetMedicationResponseModel> get allMedicationList =>
_prescriptionService.allMedicationList; _prescriptionService.allMedicationList;
SubjectiveCallBack subjectiveCallBack;
setSubjectiveCallBack(SubjectiveCallBack callBack)
{
this.subjectiveCallBack = callBack;
}
nextOnSubjectPage(model){
subjectiveCallBack.nextFunction(model);
}
ObjectiveCallBack objectiveCallBack;
setObjectiveCallBack(ObjectiveCallBack callBack)
{
this.objectiveCallBack = callBack;
}
nextOnObjectivePage(model){
objectiveCallBack.nextFunction(model);
}
AssessmentCallBack assessmentCallBack;
setAssessmentCallBack(AssessmentCallBack callBack)
{
this.assessmentCallBack = callBack;
}
nextOnAssessmentPage(model){
assessmentCallBack.nextFunction(model);
}
PlanCallBack planCallBack;
setPlanCallBack(PlanCallBack callBack)
{
this.planCallBack = callBack;
}
nextOnPlanPage(model){
planCallBack.nextFunction(model);
}
Future getAllergies(GetAllergiesRequestModel getAllergiesRequestModel) async { Future getAllergies(GetAllergiesRequestModel getAllergiesRequestModel) async {
setState(ViewState.Busy); setState(ViewState.Busy);
await _SOAPService.getAllergies(getAllergiesRequestModel); await _SOAPService.getAllergies(getAllergiesRequestModel);

@ -109,7 +109,7 @@ void setupLocator() {
locator.registerFactory(() => PatientViewModel()); locator.registerFactory(() => PatientViewModel());
locator.registerFactory(() => DashboardViewModel()); locator.registerFactory(() => DashboardViewModel());
locator.registerFactory(() => SickLeaveViewModel()); locator.registerFactory(() => SickLeaveViewModel());
locator.registerFactory(() => SOAPViewModel()); locator.registerLazySingleton(() => SOAPViewModel());
locator.registerFactory(() => PatientReferralViewModel()); locator.registerFactory(() => PatientReferralViewModel());
locator.registerFactory(() => PrescriptionViewModel()); locator.registerFactory(() => PrescriptionViewModel());
locator.registerFactory(() => ProcedureViewModel()); locator.registerFactory(() => ProcedureViewModel());

@ -251,6 +251,32 @@ class _AddAssessmentDetailsState extends State<AddAssessmentDetails> {
)), )),
)), )),
), ),
if(widget.mySelectedAssessment
.selectedICD != null)
Column(
children: [
SizedBox(
height: 3,
),
Container(
width: MediaQuery
.of(context)
.size
.width * 0.7,
child: AppText(
widget.mySelectedAssessment
.selectedICD.description +
(' (${widget.mySelectedAssessment
.selectedICD.code} )'),
color: Color(0xFF575757),
fontSize: 10,
fontWeight: FontWeight.w700,
letterSpacing: -0.4,
),
),
],
),
SizedBox( SizedBox(
height: 7, height: 7,
), ),

@ -0,0 +1,3 @@
abstract class AssessmentCallBack{
nextFunction(model);
}

@ -25,6 +25,7 @@ import '../shared_soap_widgets/SOAP_open_items.dart';
import '../shared_soap_widgets/SOAP_step_header.dart'; import '../shared_soap_widgets/SOAP_step_header.dart';
import '../shared_soap_widgets/expandable_SOAP_widget.dart'; import '../shared_soap_widgets/expandable_SOAP_widget.dart';
import 'add_assessment_details.dart'; import 'add_assessment_details.dart';
import 'assessmentCallBack.dart';
// ignore: must_be_immutable // ignore: must_be_immutable
class UpdateAssessmentPage extends StatefulWidget { class UpdateAssessmentPage extends StatefulWidget {
@ -44,7 +45,7 @@ class UpdateAssessmentPage extends StatefulWidget {
_UpdateAssessmentPageState createState() => _UpdateAssessmentPageState(); _UpdateAssessmentPageState createState() => _UpdateAssessmentPageState();
} }
class _UpdateAssessmentPageState extends State<UpdateAssessmentPage> { class _UpdateAssessmentPageState extends State<UpdateAssessmentPage> implements AssessmentCallBack{
bool isAssessmentExpand = false; bool isAssessmentExpand = false;
List<MySelectedAssessment> mySelectedAssessmentList = List(); List<MySelectedAssessment> mySelectedAssessmentList = List();
@ -54,6 +55,7 @@ class _UpdateAssessmentPageState extends State<UpdateAssessmentPage> {
return BaseView<SOAPViewModel>( return BaseView<SOAPViewModel>(
onModelReady: (model) async { onModelReady: (model) async {
model.setAssessmentCallBack(this);
mySelectedAssessmentList.clear(); mySelectedAssessmentList.clear();
GetAssessmentReqModel getAssessmentReqModel = GetAssessmentReqModel( GetAssessmentReqModel getAssessmentReqModel = GetAssessmentReqModel(
patientMRN: widget.patientInfo.patientMRN, patientMRN: widget.patientInfo.patientMRN,
@ -525,16 +527,7 @@ class _UpdateAssessmentPageState extends State<UpdateAssessmentPage> {
disabled: model.state == ViewState.BusyLocal, disabled: model.state == ViewState.BusyLocal,
onPressed: () async { onPressed: () async {
// TODO Elham*
widget.changePageViewIndex(3);
// if (mySelectedAssessmentList.isEmpty) {
// Helpers.showErrorToast(
// TranslationBase.of(context)
// .assessmentErrorMsg);
// } else {
// widget.changeLoadingState(true);
// widget.changePageViewIndex(3);
// }
}, },
), ),
), ),
@ -577,4 +570,18 @@ class _UpdateAssessmentPageState extends State<UpdateAssessmentPage> {
}); });
}); });
} }
@override
nextFunction(model) {
// TODO Elham*
widget.changePageViewIndex(3);
// if (mySelectedAssessmentList.isEmpty) {
// Helpers.showErrorToast(
// TranslationBase.of(context)
// .assessmentErrorMsg);
// } else {
// widget.changeLoadingState(true);
// widget.changePageViewIndex(3);
// }
}
} }

@ -0,0 +1,3 @@
abstract class ObjectiveCallBack{
nextFunction(model);
}

@ -10,6 +10,7 @@ import 'package:doctor_app_flutter/models/SOAP/post_physical_exam_request_model.
import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_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/patients/profile/soap_update/objective/objectiveCallBack.dart';
import 'package:doctor_app_flutter/screens/patients/profile/soap_update/soap_utils.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update/soap_utils.dart';
import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/helpers.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
@ -43,7 +44,7 @@ class UpdateObjectivePage extends StatefulWidget {
_UpdateObjectivePageState createState() => _UpdateObjectivePageState(); _UpdateObjectivePageState createState() => _UpdateObjectivePageState();
} }
class _UpdateObjectivePageState extends State<UpdateObjectivePage> { class _UpdateObjectivePageState extends State<UpdateObjectivePage> implements ObjectiveCallBack {
bool isSysExaminationExpand = false; bool isSysExaminationExpand = false;
List<MySelectedExamination> mySelectedExamination = List(); List<MySelectedExamination> mySelectedExamination = List();
@ -64,6 +65,7 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BaseView<SOAPViewModel>( return BaseView<SOAPViewModel>(
onModelReady: (model) async { onModelReady: (model) async {
model.setObjectiveCallBack(this);
mySelectedExamination.clear(); mySelectedExamination.clear();
GetPhysicalExamReqModel getPhysicalExamReqModel = GetPhysicalExamReqModel getPhysicalExamReqModel =
GetPhysicalExamReqModel( GetPhysicalExamReqModel(
@ -71,7 +73,6 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage> {
episodeID: widget.patientInfo.episodeNo.toString(), episodeID: widget.patientInfo.episodeNo.toString(),
appointmentNo: appointmentNo:
int.parse(widget.patientInfo.appointmentNo.toString())); int.parse(widget.patientInfo.appointmentNo.toString()));
await model.getPatientPhysicalExam(getPhysicalExamReqModel); await model.getPatientPhysicalExam(getPhysicalExamReqModel);
if (model.patientPhysicalExamList.isNotEmpty) { if (model.patientPhysicalExamList.isNotEmpty) {
if (model.physicalExaminationList.length == 0) { if (model.physicalExaminationList.length == 0) {
@ -204,70 +205,7 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage> {
), ),
), ),
), ),
bottomSheet: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(0.0),
),
border: Border.all(color: HexColor('#707070'), width: 0),
),
height: SizeConfig.heightMultiplier *
(SizeConfig.isHeightVeryShort ? 12 : 10),
width: double.infinity,
child: Column(
children: [
SizedBox(
height: 10,
), ),
Container(
child: FractionallySizedBox(
widthFactor: .80,
child: Center(
child: Row(
children: [
Expanded(
child: AppButton(
title: TranslationBase.of(context).previous,
color: Colors.grey[300],
height: SizeConfig.heightMultiplier *
(SizeConfig.isHeightVeryShort ? 8 : 6),
padding: 10,
fontColor: Colors.black,
fontWeight: FontWeight.w600,
onPressed: () {
widget.changePageViewIndex(0);
},
),
),
SizedBox(
width: 5,
),
Expanded(
child: AppButton(
title: TranslationBase.of(context).next,
fontWeight: FontWeight.w600,
color: Colors.red[700],
height: SizeConfig.heightMultiplier *
(SizeConfig.isHeightVeryShort ? 8 : 6),
padding: 10,
disabled: model.state == ViewState.BusyLocal,
onPressed: () async {
await submitUpdateObjectivePage(model);
},
),
),
],
),
),
),
),
SizedBox(
height: 5,
),
],
),
)),
); );
} }
@ -397,4 +335,9 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage> {
), ),
); );
} }
@override
nextFunction(model) async {
await submitUpdateObjectivePage(model);
}
} }

@ -0,0 +1,3 @@
abstract class PlanCallBack{
nextFunction(model);
}

@ -2,6 +2,7 @@ import 'package:doctor_app_flutter/config/shared_pref_kay.dart';
import 'package:doctor_app_flutter/config/size_config.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/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart';
import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart';
import 'package:doctor_app_flutter/models/SOAP/GetGetProgressNoteReqModel.dart'; import 'package:doctor_app_flutter/models/SOAP/GetGetProgressNoteReqModel.dart';
import 'package:doctor_app_flutter/models/SOAP/GetGetProgressNoteResModel.dart'; import 'package:doctor_app_flutter/models/SOAP/GetGetProgressNoteResModel.dart';
@ -9,6 +10,7 @@ import 'package:doctor_app_flutter/models/SOAP/post_progress_note_request_model.
import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_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/patients/profile/soap_update/plan/planCallBack.dart';
import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/date-utils.dart';
import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/helpers.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
@ -40,7 +42,7 @@ class UpdatePlanPage extends StatefulWidget {
_UpdatePlanPageState createState() => _UpdatePlanPageState(); _UpdatePlanPageState createState() => _UpdatePlanPageState();
} }
class _UpdatePlanPageState extends State<UpdatePlanPage> { class _UpdatePlanPageState extends State<UpdatePlanPage> implements PlanCallBack {
bool isAddProgress = true; bool isAddProgress = true;
bool isProgressExpanded = true; bool isProgressExpanded = true;
GetPatientProgressNoteResModel patientProgressNote = GetPatientProgressNoteResModel patientProgressNote =
@ -73,7 +75,7 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> {
} }
getPatientProgressNote(model, {bool isAddProgress = false}) async { getPatientProgressNote(SOAPViewModel model, {bool isAddProgress = false}) async {
GetGetProgressNoteReqModel getGetProgressNoteReqModel = GetGetProgressNoteReqModel getGetProgressNoteReqModel =
GetGetProgressNoteReqModel( GetGetProgressNoteReqModel(
appointmentNo: appointmentNo:
@ -83,11 +85,12 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> {
editedBy: '', editedBy: '',
doctorID: ''); doctorID: '');
await model.getPatientProgressNote(getGetProgressNoteReqModel); await model.getPatientProgressNote(getGetProgressNoteReqModel);
///TODO set progressNote in model;
if (model.patientProgressNoteList.isNotEmpty) { if (model.patientProgressNoteList.isNotEmpty) {
progressNoteController.text = Helpers.parseHtmlString( progressNoteController.text = Helpers.parseHtmlString(
model.patientProgressNoteList[0].planNote); model.patientProgressNoteList[0].planNote);
patientProgressNote.planNote = progressNoteController.text; patientProgressNote.planNote = progressNoteController.text;
patientProgressNote.createdByName = patientProgressNote.createdByName =
model.patientProgressNoteList[0].createdByName; model.patientProgressNoteList[0].createdByName;
patientProgressNote.createdOn = patientProgressNote.createdOn =
@ -100,6 +103,7 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> {
model.patientProgressNoteList[0].appointmentNo; model.patientProgressNoteList[0].appointmentNo;
setState(() { setState(() {
isAddProgress = isAddProgress; isAddProgress = isAddProgress;
model.isAddProgress = isAddProgress;
}); });
} }
} }
@ -108,6 +112,7 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BaseView<SOAPViewModel>( return BaseView<SOAPViewModel>(
onModelReady: (model) async { onModelReady: (model) async {
model.setPlanCallBack(this);
GetGetProgressNoteReqModel getGetProgressNoteReqModel = GetGetProgressNoteReqModel getGetProgressNoteReqModel =
GetGetProgressNoteReqModel( GetGetProgressNoteReqModel(
appointmentNo: appointmentNo:
@ -135,6 +140,7 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> {
setState(() { setState(() {
isAddProgress = false; isAddProgress = false;
model.isAddProgress = false;
}); });
} }
widget.changeLoadingState(false); widget.changeLoadingState(false);
@ -320,84 +326,7 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> {
), ),
), ),
), ),
), ),)
bottomSheet: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(0.0),
),
border: Border.all(color: HexColor('#707070'), width: 0),
),
height: SizeConfig.heightMultiplier *
(SizeConfig.isHeightVeryShort ? 12 : 10),
width: double.infinity,
child: Column(
children: [
SizedBox(
height: 10,
),
Container(
child: FractionallySizedBox(
widthFactor: .80,
child: Center(
child: Row(
children: [
Expanded(
child: AppButton(
height: SizeConfig.heightMultiplier *
(SizeConfig.isHeightVeryShort ? 8 : 6),
padding: 10,
title: TranslationBase.of(context).previous,
color: Colors.grey[300],
fontColor: Colors.black,
fontWeight: FontWeight.w600,
disabled: model.state == ViewState.BusyLocal,
onPressed: () async {
widget.changePageViewIndex(2);
},
),
),
SizedBox(
width: 5,
),
Expanded(
child: AppButton(
height: SizeConfig.heightMultiplier *
(SizeConfig.isHeightVeryShort ? 8 : 6),
padding: 10,
title: isAddProgress
? TranslationBase.of(context).next
: TranslationBase.of(context).finish,
fontWeight: FontWeight.w600,
color: Colors.red[700],
disabled: progressNoteController.text.isEmpty,
onPressed: () async {
if (progressNoteController.text.isNotEmpty) {
if (isAddProgress) {
submitPlan(model);
} else {
Navigator.of(context).pop();
}
} else {
Helpers.showErrorToast(
TranslationBase.of(context)
.progressNoteErrorMsg);
}
},
),
),
],
),
),
),
),
SizedBox(
height: 5,
),
],
),
)),
); );
} }
@ -452,6 +381,7 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> {
setState(() { setState(() {
isAddProgress = false; isAddProgress = false;
model.isAddProgress = false;
}); });
} }
} }
@ -460,4 +390,20 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> {
Helpers.showErrorToast(TranslationBase.of(context).progressNoteErrorMsg); Helpers.showErrorToast(TranslationBase.of(context).progressNoteErrorMsg);
} }
} }
@override
nextFunction(model) {
print("dfdfdf");
if (progressNoteController.text.isNotEmpty) {
if (isAddProgress) {
submitPlan(model);
} else {
Navigator.of(context).pop();
}
} else {
Helpers.showErrorToast(
TranslationBase.of(context)
.progressNoteErrorMsg);
}
}
} }

@ -64,7 +64,8 @@ class _AddMedicationState extends State<AddMedication> {
); );
} }
if (model.medicationFrequencyList.length == 0) { if (model.medicationFrequencyList.length == 0) {
await model.getMasterLookup(MasterKeysService.MedicationFrequency); await model.getMasterLookup(
MasterKeysService.MedicationFrequency);
} }
if (model.medicationDoseTimeList.length == 0) { if (model.medicationDoseTimeList.length == 0) {
await model.getMasterLookup(MasterKeysService.MedicationDoseTime); await model.getMasterLookup(MasterKeysService.MedicationDoseTime);
@ -75,11 +76,14 @@ class _AddMedicationState extends State<AddMedication> {
if (model.allMedicationList.length == 0) if (model.allMedicationList.length == 0)
await model.getMedicationList(); await model.getMedicationList();
}, },
builder: (_, model, w) => AppScaffold( builder: (_, model, w) =>
AppScaffold(
baseViewModel: model, baseViewModel: model,
isShowAppBar: true, isShowAppBar: true,
appBar: BottomSheetTitle( appBar: BottomSheetTitle(
title: TranslationBase.of(context).addMedication, title: TranslationBase
.of(context)
.addMedication,
), ),
body: Center( body: Center(
child: Container( child: Container(
@ -96,7 +100,9 @@ class _AddMedicationState extends State<AddMedication> {
child: Column( child: Column(
children: [ children: [
SizedBox( SizedBox(
height: SizeConfig.heightMultiplier * (SizeConfig.isHeightVeryShort ?2:SizeConfig.isHeightShort?2:2), height: SizeConfig.heightMultiplier * (
SizeConfig.isHeightVeryShort ?2:SizeConfig.isHeightShort?
2:2),
), ),
Container( Container(
// height: screenSize.height * 0.070, // height: screenSize.height * 0.070,
@ -116,7 +122,8 @@ class _AddMedicationState extends State<AddMedication> {
GetMedicationResponseModel>( GetMedicationResponseModel>(
decoration: TextFieldsUtils decoration: TextFieldsUtils
.textFieldSelectorDecoration( .textFieldSelectorDecoration(
TranslationBase.of( TranslationBase
.of(
context) context)
.searchMedicineNameHere, .searchMedicineNameHere,
null, null,
@ -144,7 +151,8 @@ class _AddMedicationState extends State<AddMedication> {
itemSorter: (a, b) => 1, itemSorter: (a, b) => 1,
itemFilter: (suggestion, itemFilter: (suggestion,
input) => input) =>
suggestion.genericName.toLowerCase().startsWith(input.toLowerCase()) || suggestion.genericName.toLowerCase()
.startsWith(input.toLowerCase()) ||
suggestion.description suggestion.description
.toLowerCase() .toLowerCase()
.startsWith(input .startsWith(input
@ -162,7 +170,8 @@ class _AddMedicationState extends State<AddMedication> {
? _selectedMedication ? _selectedMedication
.description + .description +
(' (${_selectedMedication.genericName} )') (' (${_selectedMedication.genericName} )')
: TranslationBase.of( : TranslationBase
.of(
context) context)
.searchMedicineNameHere, .searchMedicineNameHere,
minLines: 1, minLines: 1,
@ -177,6 +186,29 @@ class _AddMedicationState extends State<AddMedication> {
), ),
), ),
), ),
if(_selectedMedication != null)
Column(
children: [
SizedBox(
height: 3,
),
Container(
width: MediaQuery
.of(context)
.size
.width * 0.7,
child: AppText(
_selectedMedication.description +
(' (${_selectedMedication.genericName} )'),
color: Color(0xFF575757),
fontSize: 10,
fontWeight: FontWeight.w700,
letterSpacing: -0.4,
),
),
],
),
SizedBox( SizedBox(
height: 5, height: 5,
), ),
@ -191,7 +223,8 @@ class _AddMedicationState extends State<AddMedication> {
list: model list: model
.medicationDoseTimeList, .medicationDoseTimeList,
okText: okText:
TranslationBase.of(context) TranslationBase
.of(context)
.ok, .ok,
selectedValue: selectedValue:
_selectedMedicationDose, _selectedMedicationDose,
@ -221,14 +254,17 @@ class _AddMedicationState extends State<AddMedication> {
} }
: null, : null,
hintText: hintText:
TranslationBase.of(context).doseTime, TranslationBase
.of(context)
.doseTime,
maxLines: 1, maxLines: 1,
minLines: 1, minLines: 1,
isTextFieldHasSuffix: true, isTextFieldHasSuffix: true,
controller: doseController, controller: doseController,
validationError: isFormSubmitted && validationError: isFormSubmitted &&
_selectedMedicationDose == null _selectedMedicationDose == null
? TranslationBase.of(context) ? TranslationBase
.of(context)
.emptyMessage .emptyMessage
: null, : null,
), ),
@ -247,7 +283,8 @@ class _AddMedicationState extends State<AddMedication> {
list: model list: model
.medicationStrengthList, .medicationStrengthList,
okText: okText:
TranslationBase.of(context) TranslationBase
.of(context)
.ok, .ok,
selectedValue: selectedValue:
_selectedMedicationStrength, _selectedMedicationStrength,
@ -277,14 +314,17 @@ class _AddMedicationState extends State<AddMedication> {
} }
: null, : null,
hintText: hintText:
TranslationBase.of(context).strength, TranslationBase
.of(context)
.strength,
maxLines: 1, maxLines: 1,
minLines: 1, minLines: 1,
controller: strengthController, controller: strengthController,
validationError: isFormSubmitted && validationError: isFormSubmitted &&
_selectedMedicationStrength == _selectedMedicationStrength ==
null null
? TranslationBase.of(context) ? TranslationBase
.of(context)
.emptyMessage .emptyMessage
: null, : null,
), ),
@ -306,7 +346,8 @@ class _AddMedicationState extends State<AddMedication> {
selectedValue: selectedValue:
_selectedMedicationRoute, _selectedMedicationRoute,
okText: okText:
TranslationBase.of(context) TranslationBase
.of(context)
.ok, .ok,
okFunction: (selectedValue) { okFunction: (selectedValue) {
setState(() { setState(() {
@ -334,13 +375,16 @@ class _AddMedicationState extends State<AddMedication> {
} }
: null, : null,
hintText: hintText:
TranslationBase.of(context).route, TranslationBase
.of(context)
.route,
maxLines: 1, maxLines: 1,
minLines: 1, minLines: 1,
controller: routeController, controller: routeController,
validationError: isFormSubmitted && validationError: isFormSubmitted &&
_selectedMedicationRoute == null _selectedMedicationRoute == null
? TranslationBase.of(context) ? TranslationBase
.of(context)
.emptyMessage .emptyMessage
: null, : null,
), ),
@ -360,7 +404,8 @@ class _AddMedicationState extends State<AddMedication> {
list: model list: model
.medicationFrequencyList, .medicationFrequencyList,
okText: okText:
TranslationBase.of(context) TranslationBase
.of(context)
.ok, .ok,
selectedValue: selectedValue:
_selectedMedicationFrequency, _selectedMedicationFrequency,
@ -390,7 +435,9 @@ class _AddMedicationState extends State<AddMedication> {
} }
: null, : null,
hintText: hintText:
TranslationBase.of(context).frequency, TranslationBase
.of(context)
.frequency,
enabled: false, enabled: false,
maxLines: 1, maxLines: 1,
minLines: 1, minLines: 1,
@ -399,12 +446,15 @@ class _AddMedicationState extends State<AddMedication> {
validationError: isFormSubmitted && validationError: isFormSubmitted &&
_selectedMedicationFrequency == _selectedMedicationFrequency ==
null null
? TranslationBase.of(context) ? TranslationBase
.of(context)
.emptyMessage .emptyMessage
: null, : null,
), ),
SizedBox( SizedBox(
height: SizeConfig.heightMultiplier * (SizeConfig.isHeightVeryShort ?20:SizeConfig.isHeightShort?15:10), height: SizeConfig.heightMultiplier *
(SizeConfig.isHeightVeryShort ? 20 : SizeConfig
.isHeightShort ? 15 : 10),
), ),
], ],
@ -436,8 +486,11 @@ class _AddMedicationState extends State<AddMedication> {
Navigator.of(context).pop(); Navigator.of(context).pop();
} }
}, },
)), )
), )
,
)
,
); );
} }
} }

@ -0,0 +1,3 @@
abstract class SubjectiveCallBack{
Function nextFunction(model);
}

@ -16,6 +16,7 @@ import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_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/patients/profile/soap_update/soap_utils.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update/soap_utils.dart';
import 'package:doctor_app_flutter/screens/patients/profile/soap_update/subjective/subjectiveCallBack.dart';
import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/helpers.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
@ -46,7 +47,8 @@ class UpdateSubjectivePage extends StatefulWidget {
_UpdateSubjectivePageState createState() => _UpdateSubjectivePageState(); _UpdateSubjectivePageState createState() => _UpdateSubjectivePageState();
} }
class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> { class _UpdateSubjectivePageState extends State<UpdateSubjectivePage>
implements SubjectiveCallBack {
bool isChiefExpand = false; bool isChiefExpand = false;
bool isHistoryExpand = false; bool isHistoryExpand = false;
bool isAllergiesExpand = false; bool isAllergiesExpand = false;
@ -208,7 +210,7 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
onModelReady: (model) async { onModelReady: (model) async {
myAllergiesList.clear(); myAllergiesList.clear();
myHistoryList.clear(); myHistoryList.clear();
model.setSubjectiveCallBack(this);
GetChiefComplaintReqModel getChiefComplaintReqModel = GetChiefComplaintReqModel getChiefComplaintReqModel =
GetChiefComplaintReqModel( GetChiefComplaintReqModel(
patientMRN: widget.patientInfo.patientMRN, patientMRN: widget.patientInfo.patientMRN,
@ -320,49 +322,6 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
), ),
), ),
), ),
bottomSheet: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(0.0),
),
border: Border.all(color: HexColor('#707070'), width: 0),
),
height: SizeConfig.heightMultiplier *
(SizeConfig.isHeightVeryShort ? 12 : 10),
width: double.infinity,
child: Column(
children: [
SizedBox(
height: 10,
),
Container(
child: FractionallySizedBox(
widthFactor: .80,
child: Center(
child: AppButton(
title: TranslationBase.of(context).next,
fontWeight: FontWeight.w600,
height: SizeConfig.heightMultiplier *
(SizeConfig.isHeightVeryShort ? 8 : 6),
padding: 10,
color: Colors.red[700],
onPressed: () async {
addSubjectiveInfo(
model: model,
myAllergiesList: myAllergiesList,
myHistoryList: myHistoryList);
},
),
),
),
),
SizedBox(
height: 5,
),
],
),
),
), ),
); );
} }
@ -371,7 +330,6 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
{SOAPViewModel model, {SOAPViewModel model,
List<MySelectedAllergy> myAllergiesList, List<MySelectedAllergy> myAllergiesList,
List<MySelectedHistory> myHistoryList}) async { List<MySelectedHistory> myHistoryList}) async {
if (FocusScope.of(context).hasFocus) FocusScope.of(context).unfocus(); if (FocusScope.of(context).hasFocus) FocusScope.of(context).unfocus();
widget.changeLoadingState(true); widget.changeLoadingState(true);
formKey.currentState.save(); formKey.currentState.save();
@ -380,50 +338,54 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
complaintsControllerError = ''; complaintsControllerError = '';
medicationControllerError = ''; medicationControllerError = '';
illnessControllerError = ''; illnessControllerError = '';
if (complaintsController.text.isNotEmpty &&
illnessController.text.isNotEmpty &&
complaintsController.text.length > 25) {
await postChiefComplaint(model: model);
if (model.state == ViewState.ErrorLocal) {
Helpers.showErrorToast(model.error);
}
if (myHistoryList.length != 0) {
await postHistories(model: model, myHistoryList: myHistoryList);
if (model.state == ViewState.ErrorLocal) {
Helpers.showErrorToast(model.error);
}
}
if (myAllergiesList.length != 0) {
await postAllergy(myAllergiesList: myAllergiesList, model: model);
if (model.state == ViewState.ErrorLocal) {
Helpers.showErrorToast(model.error);
}
}
widget.changeLoadingState(true);
///TODO Elham*
///
widget.changePageViewIndex(1); widget.changePageViewIndex(1);
} else { // if (complaintsController.text.isNotEmpty &&
setState(() { // illnessController.text.isNotEmpty &&
if (complaintsController.text.isEmpty) { // complaintsController.text.length > 25) {
complaintsControllerError = TranslationBase.of(context).emptyMessage; // await postChiefComplaint(model: model);
} else if (complaintsController.text.length < 25) { // if (model.state == ViewState.ErrorLocal) {
complaintsControllerError = // Helpers.showErrorToast(model.error);
TranslationBase.of(context).chiefComplaintLength; // }
} // if (myHistoryList.length != 0) {
// await postHistories(model: model, myHistoryList: myHistoryList);
if (illnessController.text.isEmpty) { // if (model.state == ViewState.ErrorLocal) {
illnessControllerError = TranslationBase.of(context).emptyMessage; // Helpers.showErrorToast(model.error);
} // }
// }
if (medicationController.text.isEmpty) { // if (myAllergiesList.length != 0) {
medicationControllerError = TranslationBase.of(context).emptyMessage; // await postAllergy(myAllergiesList: myAllergiesList, model: model);
} // if (model.state == ViewState.ErrorLocal) {
}); // Helpers.showErrorToast(model.error);
// }
widget.changeLoadingState(false); // }
Helpers.showErrorToast( // widget.changeLoadingState(true);
TranslationBase.of(context).chiefComplaintErrorMsg); //
} // widget.changePageViewIndex(1);
// } else {
// setState(() {
// if (complaintsController.text.isEmpty) {
// complaintsControllerError = TranslationBase.of(context).emptyMessage;
// } else if (complaintsController.text.length < 25) {
// complaintsControllerError =
// TranslationBase.of(context).chiefComplaintLength;
// }
//
// if (illnessController.text.isEmpty) {
// illnessControllerError = TranslationBase.of(context).emptyMessage;
// }
//
// if (medicationController.text.isEmpty) {
// medicationControllerError = TranslationBase.of(context).emptyMessage;
// }
// });
//
// widget.changeLoadingState(false);
// Helpers.showErrorToast(
// TranslationBase.of(context).chiefComplaintErrorMsg);
// }
} }
postAllergy( postAllergy(
@ -528,4 +490,12 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
} }
} }
} }
@override
Function nextFunction(model) {
addSubjectiveInfo(
model: model,
myAllergiesList: myAllergiesList,
myHistoryList: myHistoryList);
}
} }

@ -1,3 +1,6 @@
import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/doctor_replay_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/doctor_replay_view_model.dart';
import 'package:doctor_app_flutter/models/SOAP/GetGetProgressNoteResModel.dart'; import 'package:doctor_app_flutter/models/SOAP/GetGetProgressNoteResModel.dart';
import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_allergy.dart'; import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_allergy.dart';
@ -6,10 +9,13 @@ import 'package:doctor_app_flutter/models/SOAP/selected_items/my_selected_histor
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_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/patients/profile/soap_update/subjective/update_subjective_page.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update/subjective/update_subjective_page.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-bar.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-bar.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart';
import 'assessment/update_assessment_page.dart'; import 'assessment/update_assessment_page.dart';
import 'objective/update_objective_page.dart'; import 'objective/update_objective_page.dart';
@ -31,10 +37,8 @@ class _UpdateSoapIndexState extends State<UpdateSoapIndex>
List<MySelectedAllergy> myAllergiesList = List(); List<MySelectedAllergy> myAllergiesList = List();
List<MySelectedHistory> myHistoryList = List(); List<MySelectedHistory> myHistoryList = List();
changePageViewIndex(pageIndex, {isChangeState = true}) {
changePageViewIndex(pageIndex,{isChangeState = true}) { if (pageIndex != _currentIndex && isChangeState) changeLoadingState(true);
if (pageIndex != _currentIndex && isChangeState)
changeLoadingState(true);
_controller.jumpToPage(pageIndex); _controller.jumpToPage(pageIndex);
setState(() { setState(() {
_currentIndex = pageIndex; _currentIndex = pageIndex;
@ -60,7 +64,8 @@ class _UpdateSoapIndexState extends State<UpdateSoapIndex>
Widget build(BuildContext context) { Widget build(BuildContext context) {
final routeArgs = ModalRoute.of(context).settings.arguments as Map; final routeArgs = ModalRoute.of(context).settings.arguments as Map;
PatiantInformtion patient = routeArgs['patient']; PatiantInformtion patient = routeArgs['patient'];
return AppScaffold( return BaseView<SOAPViewModel>(
builder: (_,model,w)=>AppScaffold(
isLoading: _isLoading, isLoading: _isLoading,
isShowAppBar: true, isShowAppBar: true,
appBar: PatientProfileAppBar(patient), appBar: PatientProfileAppBar(patient),
@ -76,7 +81,6 @@ class _UpdateSoapIndexState extends State<UpdateSoapIndex>
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
Container( Container(
color: Theme.of(context).scaffoldBackgroundColor, color: Theme.of(context).scaffoldBackgroundColor,
height: MediaQuery.of(context).size.height * 0.73, height: MediaQuery.of(context).size.height * 0.73,
@ -119,6 +123,185 @@ class _UpdateSoapIndexState extends State<UpdateSoapIndex>
], ],
), ),
), ),
bottomSheet: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(0.0),
),
border: Border.all(color: HexColor('#707070'), width: 0),
),
height: SizeConfig.heightMultiplier *
(SizeConfig.isHeightVeryShort ? 12 : 10),
width: double.infinity,
child: Column(
children: [
SizedBox(
height: 10,
),
Container(
child: FractionallySizedBox(
widthFactor: .80,
child: getBottomSheet(model)
),
),
SizedBox(
height: 5,
),
],
),
),
),
);
}
Widget getBottomSheet(SOAPViewModel model) {
switch (_currentIndex) {
case 0:
{
return Center(
child: AppButton(
title: TranslationBase.of(context).next,
fontWeight: FontWeight.w600,
height: SizeConfig.heightMultiplier *
(SizeConfig.isHeightVeryShort ? 8 : 6),
padding: 10,
color: Colors.red[700],
onPressed: () async {
model.nextOnSubjectPage(model);
},
),
);
}
break;
case 1:
{
return Center(
child: Row(
children: [
Expanded(
child: AppButton(
title: TranslationBase.of(context).previous,
color: Colors.grey[300],
height: SizeConfig.heightMultiplier *
(SizeConfig.isHeightVeryShort ? 8 : 6),
padding: 10,
fontColor: Colors.black,
fontWeight: FontWeight.w600,
onPressed: () {
changePageViewIndex(0);
},
),
),
SizedBox(
width: 5,
),
Expanded(
child: AppButton(
title: TranslationBase.of(context).next,
fontWeight: FontWeight.w600,
color: Colors.red[700],
height: SizeConfig.heightMultiplier *
(SizeConfig.isHeightVeryShort ? 8 : 6),
padding: 10,
disabled: model.state == ViewState.BusyLocal,
onPressed: () async {
await model.nextOnObjectivePage(model);
},
),
),
],
),
);
}
break;
case 2:
{
return Center(
child: Row(
children: [
Expanded(
child: AppButton(
title: TranslationBase.of(context).previous,
color: Colors.grey[300],
fontColor: Colors.black,
height: SizeConfig.heightMultiplier *
(SizeConfig.isHeightVeryShort ? 8 : 6),
padding: 10,
fontWeight: FontWeight.w600,
disabled: model.state == ViewState.BusyLocal,
onPressed: () async {
changePageViewIndex(1);
},
),
),
SizedBox(
width: 5,
),
Expanded(
child: AppButton(
title: TranslationBase.of(context).next,
fontWeight: FontWeight.w600,
color: Colors.red[700],
height: SizeConfig.heightMultiplier *
(SizeConfig.isHeightVeryShort ? 8 : 6),
padding: 10,
disabled: model.state == ViewState.BusyLocal,
onPressed: () async {
model.nextOnAssessmentPage(model);
},
),
),
],
),
);
}
break;
case 3:
{
return Center(
child: Row(
children: [
Expanded(
child: AppButton(
height: SizeConfig.heightMultiplier *
(SizeConfig.isHeightVeryShort ? 8 : 6),
padding: 10,
title: TranslationBase.of(context).previous,
color: Colors.grey[300],
fontColor: Colors.black,
fontWeight: FontWeight.w600,
disabled: model.state == ViewState.BusyLocal,
onPressed: () async {
changePageViewIndex(2);
},
),
),
SizedBox(
width: 5,
),
Expanded(
child: AppButton(
height: SizeConfig.heightMultiplier *
(SizeConfig.isHeightVeryShort ? 8 : 6),
padding: 10,
title: model.isAddProgress
? TranslationBase.of(context).next
: TranslationBase.of(context).finish,
fontWeight: FontWeight.w600,
color: Colors.red[700],
disabled: model.progressNoteText.isEmpty,
onPressed: () async {
model.nextOnPlanPage(model);
},
),
),
],
),
); );
} }
break;
}
}
} }

@ -552,6 +552,6 @@ class PatientProfileAppBar extends StatelessWidget
@override @override
Size get preferredSize => Size get preferredSize =>
Size(double.maxFinite, height == 0 Size(double.maxFinite, height == 0
? isInpatient ? (isFromLabResult?200:170) : isAppointmentHeader ? 290 : SizeConfig.isHeightVeryShort?137:SizeConfig.isHeightShort?180: SizeConfig.heightMultiplier * (SizeConfig.isWidthLarge?25:20) ? isInpatient ? (isFromLabResult?200:190) : isAppointmentHeader ? 290 : SizeConfig.isHeightVeryShort?137:SizeConfig.isHeightShort?190: SizeConfig.heightMultiplier * (SizeConfig.isWidthLarge?25:20)
: height); : height);
} }

Loading…
Cancel
Save