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": "إضافة الوصفات"},
"edit": {"en": "Edit", "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/buttons/app_buttons_widget.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/auto_complete_text_field.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(
list: model.listOfDiagnosisCondition,
okText: TranslationBase.of(context).ok,
selectedValue: widget.mySelectedAssessment.selectedDiagnosisCondition,
okFunction:
(MasterKeyModel selectedValue) {
setState(() {
@ -306,6 +309,7 @@ class _AddAssessmentDetailsState extends State<AddAssessmentDetails> {
MasterKeyDailog dialog = MasterKeyDailog(
list: model.listOfDiagnosisType,
okText: TranslationBase.of(context).ok,
selectedValue: widget.mySelectedAssessment.selectedDiagnosisType,
okFunction:
(MasterKeyModel selectedValue) {
setState(() {
@ -435,6 +439,7 @@ class _AddAssessmentDetailsState extends State<AddAssessmentDetails> {
{SOAPViewModel model,
MySelectedAssessment mySelectedAssessment,
bool isUpdate = false}) async {
GifLoaderDialogUtils.showMyDialog(context);
if (isUpdate) {
PatchAssessmentReqModel patchAssessmentReqModel = PatchAssessmentReqModel(
patientMRN: widget.patientInfo.patientMRN,
@ -465,8 +470,9 @@ class _AddAssessmentDetailsState extends State<AddAssessmentDetails> {
await model.postAssessment(postAssessmentRequestModel);
}
GifLoaderDialogUtils.hideDialog(context);
if (model.state == ViewState.ErrorLocal) {
Helpers.showErrorToast(model.error);
} else {
Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
@ -474,10 +480,7 @@ class _AddAssessmentDetailsState extends State<AddAssessmentDetails> {
DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile);
mySelectedAssessment.icdCode10ID = mySelectedAssessment.selectedICD.code;
mySelectedAssessment.doctorName = doctorProfile.doctorName;
if (!isUpdate) {
widget.addSelectedAssessment(mySelectedAssessment, isUpdate);
}
widget.addSelectedAssessment(mySelectedAssessment, isUpdate);
Navigator.of(context).pop();
}
}

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

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

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

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

Loading…
Cancel
Save