|
|
|
|
@ -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);
|
|
|
|
|
|