finish create episode fixes

merge-requests/773/head
Elham Rababh 5 years ago
parent ac6a6e7855
commit c7c6314a8d

@ -703,4 +703,5 @@ const Map<String, Map<String, String>> localizedValues = {
"addPrescription": {"en": "Add prescription", "ar": "إضافة الوصفات"}, "addPrescription": {"en": "Add prescription", "ar": "إضافة الوصفات"},
"edit": {"en": "Edit", "ar": "تعديل"}, "edit": {"en": "Edit", "ar": "تعديل"},
"summeryReply": {"en": "Summary Reply", "ar": "موجز الرد"}, "summeryReply": {"en": "Summary Reply", "ar": "موجز الرد"},
"finish": {"en": "Finish", "ar": "انهاء"},
}; };

@ -18,6 +18,7 @@ import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.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/buttons/app_buttons_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/dialogs/master_key_dailog.dart'; import 'package:doctor_app_flutter/widgets/shared/dialogs/master_key_dailog.dart';
import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/auto_complete_text_field.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/auto_complete_text_field.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/text_fields_utils.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/text_fields_utils.dart';
@ -254,6 +255,8 @@ class _AddAssessmentDetailsState extends State<AddAssessmentDetails> {
MasterKeyDailog dialog = MasterKeyDailog( MasterKeyDailog dialog = MasterKeyDailog(
list: model.listOfDiagnosisCondition, list: model.listOfDiagnosisCondition,
okText: TranslationBase.of(context).ok, okText: TranslationBase.of(context).ok,
selectedValue: widget.mySelectedAssessment.selectedDiagnosisCondition,
okFunction: okFunction:
(MasterKeyModel selectedValue) { (MasterKeyModel selectedValue) {
setState(() { setState(() {
@ -306,6 +309,7 @@ class _AddAssessmentDetailsState extends State<AddAssessmentDetails> {
MasterKeyDailog dialog = MasterKeyDailog( MasterKeyDailog dialog = MasterKeyDailog(
list: model.listOfDiagnosisType, list: model.listOfDiagnosisType,
okText: TranslationBase.of(context).ok, okText: TranslationBase.of(context).ok,
selectedValue: widget.mySelectedAssessment.selectedDiagnosisType,
okFunction: okFunction:
(MasterKeyModel selectedValue) { (MasterKeyModel selectedValue) {
setState(() { setState(() {
@ -435,6 +439,7 @@ class _AddAssessmentDetailsState extends State<AddAssessmentDetails> {
{SOAPViewModel model, {SOAPViewModel model,
MySelectedAssessment mySelectedAssessment, MySelectedAssessment mySelectedAssessment,
bool isUpdate = false}) async { bool isUpdate = false}) async {
GifLoaderDialogUtils.showMyDialog(context);
if (isUpdate) { if (isUpdate) {
PatchAssessmentReqModel patchAssessmentReqModel = PatchAssessmentReqModel( PatchAssessmentReqModel patchAssessmentReqModel = PatchAssessmentReqModel(
patientMRN: widget.patientInfo.patientMRN, patientMRN: widget.patientInfo.patientMRN,
@ -465,8 +470,9 @@ class _AddAssessmentDetailsState extends State<AddAssessmentDetails> {
await model.postAssessment(postAssessmentRequestModel); await model.postAssessment(postAssessmentRequestModel);
} }
GifLoaderDialogUtils.hideDialog(context);
if (model.state == ViewState.ErrorLocal) { if (model.state == ViewState.ErrorLocal) {
Helpers.showErrorToast(model.error); Helpers.showErrorToast(model.error);
} else { } else {
Map profile = await sharedPref.getObj(DOCTOR_PROFILE); Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
@ -474,10 +480,7 @@ class _AddAssessmentDetailsState extends State<AddAssessmentDetails> {
DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile);
mySelectedAssessment.icdCode10ID = mySelectedAssessment.selectedICD.code; mySelectedAssessment.icdCode10ID = mySelectedAssessment.selectedICD.code;
mySelectedAssessment.doctorName = doctorProfile.doctorName; mySelectedAssessment.doctorName = doctorProfile.doctorName;
if (!isUpdate) {
widget.addSelectedAssessment(mySelectedAssessment, isUpdate); widget.addSelectedAssessment(mySelectedAssessment, isUpdate);
}
Navigator.of(context).pop(); Navigator.of(context).pop();
} }
} }

@ -347,7 +347,7 @@ class _UpdateAssessmentPageState extends State<UpdateAssessmentPage> {
height: 6, height: 6,
), ),
AppText( AppText(
(assessment.remark != null || (assessment.remark != null &&
assessment.remark != assessment.remark !=
'') '')
? TranslationBase.of( ? TranslationBase.of(
@ -546,6 +546,7 @@ class _UpdateAssessmentPageState extends State<UpdateAssessmentPage> {
addSelectedAssessment: (MySelectedAssessment mySelectedAssessment, addSelectedAssessment: (MySelectedAssessment mySelectedAssessment,
bool isUpdate) async { bool isUpdate) async {
setState(() { setState(() {
if(!isUpdate)
mySelectedAssessmentList.add(mySelectedAssessment); mySelectedAssessmentList.add(mySelectedAssessment);
}); });
}); });

@ -42,11 +42,14 @@ class UpdatePlanPage extends StatefulWidget {
class _UpdatePlanPageState extends State<UpdatePlanPage> { class _UpdatePlanPageState extends State<UpdatePlanPage> {
bool isAddProgress = true; bool isAddProgress = true;
bool isProgressExpanded = true; bool isProgressExpanded = true;
GetPatientProgressNoteResModel patientProgressNote =GetPatientProgressNoteResModel(); GetPatientProgressNoteResModel patientProgressNote =
GetPatientProgressNoteResModel();
TextEditingController progressNoteController = TextEditingController(text: null); TextEditingController progressNoteController =
TextEditingController(text: null);
BoxDecoration containerBorderDecoration(Color containerColor, Color borderColor) { BoxDecoration containerBorderDecoration(
Color containerColor, Color borderColor) {
return BoxDecoration( return BoxDecoration(
color: containerColor, color: containerColor,
shape: BoxShape.rectangle, shape: BoxShape.rectangle,
@ -72,8 +75,10 @@ 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 {
GetGetProgressNoteReqModel getGetProgressNoteReqModel = GetGetProgressNoteReqModel( GetGetProgressNoteReqModel getGetProgressNoteReqModel =
appointmentNo: int.parse(widget.patientInfo.appointmentNo.toString()), GetGetProgressNoteReqModel(
appointmentNo:
int.parse(widget.patientInfo.appointmentNo.toString()),
patientMRN: widget.patientInfo.patientMRN, patientMRN: widget.patientInfo.patientMRN,
episodeID: widget.patientInfo.episodeNo.toString(), episodeID: widget.patientInfo.episodeNo.toString(),
editedBy: '', editedBy: '',
@ -81,13 +86,19 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> {
await model.getPatientProgressNote(getGetProgressNoteReqModel); await model.getPatientProgressNote(getGetProgressNoteReqModel);
if (model.patientProgressNoteList.isNotEmpty) { if (model.patientProgressNoteList.isNotEmpty) {
progressNoteController.text = Helpers.parseHtmlString(model.patientProgressNoteList[0].planNote); progressNoteController.text = Helpers.parseHtmlString(
model.patientProgressNoteList[0].planNote);
patientProgressNote.planNote = progressNoteController.text; patientProgressNote.planNote = progressNoteController.text;
patientProgressNote.createdByName = model.patientProgressNoteList[0].createdByName; patientProgressNote.createdByName =
patientProgressNote.createdOn = model.patientProgressNoteList[0].createdOn; model.patientProgressNoteList[0].createdByName;
patientProgressNote.editedOn = model.patientProgressNoteList[0].editedOn; patientProgressNote.createdOn =
patientProgressNote.editedByName = model.patientProgressNoteList[0].editedByName; model.patientProgressNoteList[0].createdOn;
patientProgressNote.appointmentNo = model.patientProgressNoteList[0].appointmentNo; patientProgressNote.editedOn =
model.patientProgressNoteList[0].editedOn;
patientProgressNote.editedByName =
model.patientProgressNoteList[0].editedByName;
patientProgressNote.appointmentNo =
model.patientProgressNoteList[0].appointmentNo;
setState(() { setState(() {
isAddProgress = false; isAddProgress = false;
@ -105,7 +116,9 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> {
widthFactor: 0.90, widthFactor: 0.90,
child: Column( child: Column(
children: [ children: [
SOAPStepHeader(currentIndex: widget.currentIndex, changePageViewIndex: widget.changePageViewIndex), SOAPStepHeader(
currentIndex: widget.currentIndex,
changePageViewIndex: widget.changePageViewIndex),
SizedBox( SizedBox(
height: 10, height: 10,
), ),
@ -124,33 +137,41 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> {
children: [ children: [
if (isAddProgress) if (isAddProgress)
Container( Container(
margin: EdgeInsets.only(left: 10, right: 10, top: 15), margin: EdgeInsets.only(
left: 10, right: 10, top: 15),
child: AppTextFieldCustom( child: AppTextFieldCustom(
hintText: TranslationBase.of(context).progressNote, hintText: TranslationBase.of(context)
.progressNote,
controller: progressNoteController, controller: progressNoteController,
minLines: 2, minLines: 2,
maxLines: 4, maxLines: 4,
inputType: TextInputType.multiline, inputType: TextInputType.multiline,
onChanged: (value) { onChanged: (value) {
setState(() {
patientProgressNote.planNote = value; patientProgressNote.planNote = value;
});
}, },
), ),
), ),
SizedBox( SizedBox(
height: 9, height: 9,
), ),
if (patientProgressNote.planNote != null && !isAddProgress) if (patientProgressNote.planNote != null &&
!isAddProgress)
Container( Container(
margin: EdgeInsets.only( margin: EdgeInsets.only(
left: 5, left: 5,
right: 5, right: 5,
), ),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment:
CrossAxisAlignment.start,
children: [ children: [
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment:
crossAxisAlignment: CrossAxisAlignment.start, MainAxisAlignment.spaceBetween,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [ children: [
Row( Row(
children: [ children: [
@ -159,24 +180,39 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> {
fontSize: 12, fontSize: 12,
), ),
AppText( AppText(
patientProgressNote.appointmentNo.toString() ?? '', patientProgressNote
.appointmentNo !=
null
? patientProgressNote
.appointmentNo
.toString()
: '',
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontSize: 14,
), ),
], ],
), ),
AppText( AppText(
patientProgressNote.createdOn != null patientProgressNote.createdOn !=
? AppDateUtils.getDayMonthYearDateFormatted( null
DateTime.parse(patientProgressNote.createdOn)) ? AppDateUtils
: AppDateUtils.getDayMonthYearDateFormatted(DateTime.now()), .getDayMonthYearDateFormatted(
DateTime.parse(
patientProgressNote
.createdOn))
: AppDateUtils
.getDayMonthYearDateFormatted(
DateTime.now()),
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontSize: 14, fontSize: 14,
) )
], ],
), ),
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment:
crossAxisAlignment: CrossAxisAlignment.start, MainAxisAlignment.spaceBetween,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [ children: [
Row( Row(
children: [ children: [
@ -184,15 +220,21 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> {
'Condition: ', 'Condition: ',
fontSize: 12, fontSize: 12,
), ),
AppText(patientProgressNote.mName ?? '', AppText(
patientProgressNote.mName ??
'',
fontWeight: FontWeight.w600), fontWeight: FontWeight.w600),
], ],
), ),
AppText( AppText(
patientProgressNote.createdOn != null patientProgressNote.createdOn !=
null
? AppDateUtils.getHour( ? AppDateUtils.getHour(
DateTime.parse(patientProgressNote.createdOn)) DateTime.parse(
: AppDateUtils.getHour(DateTime.now()), patientProgressNote
.createdOn))
: AppDateUtils.getHour(
DateTime.now()),
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontSize: 14, fontSize: 14,
) )
@ -202,7 +244,8 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> {
height: 8, height: 8,
), ),
Row( Row(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment:
MainAxisAlignment.start,
children: [ children: [
Expanded( Expanded(
child: AppText( child: AppText(
@ -214,7 +257,6 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> {
onTap: () { onTap: () {
setState(() { setState(() {
isAddProgress = true; isAddProgress = true;
widget.changePageViewIndex(3, isChangeState: false);
}); });
}, },
child: Icon( child: Icon(
@ -275,30 +317,38 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> {
), ),
Expanded( Expanded(
child: AppButton( child: AppButton(
title: TranslationBase.of(context).next, title: isAddProgress
? TranslationBase.of(context).next
: TranslationBase.of(context).finish,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
color: Colors.red[700], color: Colors.red[700],
loading: model.state == ViewState.BusyLocal,
disabled: progressNoteController.text.isEmpty, disabled: progressNoteController.text.isEmpty,
onPressed: () async { onPressed: () async {
if (progressNoteController.text.isNotEmpty) { if (progressNoteController.text.isNotEmpty) {
if (isAddProgress) { if (isAddProgress) {
Map profile = await sharedPref.getObj(DOCTOR_PROFILE); Map profile =
DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); await sharedPref.getObj(DOCTOR_PROFILE);
DoctorProfileModel doctorProfile =
DoctorProfileModel.fromJson(profile);
setState(() { setState(() {
patientProgressNote.createdByName = patientProgressNote.createdByName =
patientProgressNote.createdByName ?? doctorProfile.doctorName; patientProgressNote.createdByName ??
patientProgressNote.editedByName = doctorProfile.doctorName; doctorProfile.doctorName;
patientProgressNote.createdOn = DateTime.now().toString(); patientProgressNote.editedByName =
patientProgressNote.planNote = progressNoteController.text; doctorProfile.doctorName;
isAddProgress = !isAddProgress; patientProgressNote.createdOn =
DateTime.now().toString();
patientProgressNote.planNote =
progressNoteController.text;
}); });
submitPlan(model); submitPlan(model);
} else { } else {
Navigator.of(context).pop(); Navigator.of(context).pop();
} }
} else { } else {
Helpers.showErrorToast(TranslationBase.of(context).progressNoteErrorMsg); Helpers.showErrorToast(
TranslationBase.of(context)
.progressNoteErrorMsg);
} }
}, },
), ),
@ -320,7 +370,8 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> {
submitPlan(SOAPViewModel model) async { submitPlan(SOAPViewModel model) async {
if (progressNoteController.text.isNotEmpty) { if (progressNoteController.text.isNotEmpty) {
widget.changeLoadingState(true); widget.changeLoadingState(true);
PostProgressNoteRequestModel postProgressNoteRequestModel = new PostProgressNoteRequestModel( PostProgressNoteRequestModel postProgressNoteRequestModel =
new PostProgressNoteRequestModel(
patientMRN: widget.patientInfo.patientMRN, patientMRN: widget.patientInfo.patientMRN,
episodeId: widget.patientInfo.episodeNo, episodeId: widget.patientInfo.episodeNo,
appointmentNo: widget.patientInfo.appointmentNo, appointmentNo: widget.patientInfo.appointmentNo,
@ -332,19 +383,19 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> {
await model.postProgressNote(postProgressNoteRequestModel); await model.postProgressNote(postProgressNoteRequestModel);
} else { } else {
Map profile = await sharedPref.getObj(DOCTOR_PROFILE); Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile);
postProgressNoteRequestModel.editedBy = doctorProfile.doctorID; postProgressNoteRequestModel.editedBy = doctorProfile.doctorID;
await model.patchProgressNote(postProgressNoteRequestModel); await model.patchProgressNote(postProgressNoteRequestModel);
} }
if (model.state == ViewState.ErrorLocal) { if (model.state == ViewState.ErrorLocal) {
Helpers.showErrorToast(model.error); Helpers.showErrorToast(model.error);
} else { } else {
widget.changePageViewIndex(4, isChangeState: false); setState(() {
} isAddProgress = !isAddProgress;
});
}
widget.changeLoadingState(false); widget.changeLoadingState(false);
} else { } else {
Helpers.showErrorToast(TranslationBase.of(context).progressNoteErrorMsg); Helpers.showErrorToast(TranslationBase.of(context).progressNoteErrorMsg);

@ -247,6 +247,8 @@ class StepsWidget extends StatelessWidget {
"Plan", "Plan",
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: 12, fontSize: 12,
textAlign: TextAlign.end,
marginLeft: 25,
), ),
StatusLabel( StatusLabel(
selectedStepId: index, selectedStepId: index,
@ -530,12 +532,13 @@ class StatusLabel extends StatelessWidget {
), ),
border: Border.all(color: HexColor('#707070'), width: 0.30), border: Border.all(color: HexColor('#707070'), width: 0.30),
), ),
child: Center(
child: AppText( child: AppText(
stepId == selectedStepId stepId == selectedStepId
? "inProgress" ? "inProgress"
: stepId < selectedStepId : stepId < selectedStepId
? "Completed" ? "Completed"
: " Locked ", : "Locked",
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
textAlign: TextAlign.center, textAlign: TextAlign.center,
fontSize: 10, fontSize: 10,
@ -545,6 +548,7 @@ class StatusLabel extends StatelessWidget {
? Color(0xFF359846) ? Color(0xFF359846)
: Color(0xFF969696), : Color(0xFF969696),
), ),
),
); );
} }
} }

@ -562,6 +562,7 @@ class TranslationBase {
localizedValues['no-priscription-listed'][locale.languageCode]; localizedValues['no-priscription-listed'][locale.languageCode];
String get next => localizedValues['next'][locale.languageCode]; String get next => localizedValues['next'][locale.languageCode];
String get finish => localizedValues['finish'][locale.languageCode];
String get previous => localizedValues['previous'][locale.languageCode]; String get previous => localizedValues['previous'][locale.languageCode];

Loading…
Cancel
Save