Create Episode fixes

development-3.3_voipCall
haroon amjad 3 years ago
parent ac74e1e62d
commit 90382a1b27

@ -4,15 +4,15 @@ import 'package:doctor_app_flutter/core/enum/view_state.dart';
import 'package:doctor_app_flutter/core/model/SOAP/progress_note/GetGetProgressNoteResModel.dart'; import 'package:doctor_app_flutter/core/model/SOAP/progress_note/GetGetProgressNoteResModel.dart';
import 'package:doctor_app_flutter/core/model/SOAP/progress_note/get_progress_note_req_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/progress_note/get_progress_note_req_model.dart';
import 'package:doctor_app_flutter/core/model/SOAP/progress_note/post_progress_note_request_model.dart'; import 'package:doctor_app_flutter/core/model/SOAP/progress_note/post_progress_note_request_model.dart';
import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart';
import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart';
import 'package:doctor_app_flutter/core/model/doctor/doctor_profile_model.dart'; import 'package:doctor_app_flutter/core/model/doctor/doctor_profile_model.dart';
import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart';
import 'package:doctor_app_flutter/icons_app/doctor_app_icons.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/plan_call_back.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update/plan/plan_call_back.dart';
import 'package:doctor_app_flutter/utils/date-utils.dart'; import 'package:doctor_app_flutter/utils/date-utils.dart';
import 'package:doctor_app_flutter/utils/utils.dart';
import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart';
import 'package:doctor_app_flutter/utils/utils.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/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.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';
@ -30,31 +30,20 @@ class UpdatePlanPage extends StatefulWidget {
final int currentIndex; final int currentIndex;
UpdatePlanPage( UpdatePlanPage({Key key, this.changePageViewIndex, this.patientInfo, this.changeLoadingState, this.currentIndex, this.sOAPViewModel, this.changeStateFun});
{Key key,
this.changePageViewIndex,
this.patientInfo,
this.changeLoadingState,
this.currentIndex,
this.sOAPViewModel,
this.changeStateFun});
@override @override
_UpdatePlanPageState createState() => _UpdatePlanPageState(); _UpdatePlanPageState createState() => _UpdatePlanPageState();
} }
class _UpdatePlanPageState extends State<UpdatePlanPage> class _UpdatePlanPageState extends State<UpdatePlanPage> implements PlanCallBack {
implements PlanCallBack {
bool isAddProgress = true; bool isAddProgress = true;
bool isProgressExpanded = true; bool isProgressExpanded = true;
GetPatientProgressNoteResModel patientProgressNote = GetPatientProgressNoteResModel patientProgressNote = GetPatientProgressNoteResModel();
GetPatientProgressNoteResModel();
TextEditingController progressNoteController = TextEditingController progressNoteController = TextEditingController(text: null);
TextEditingController(text: null);
BoxDecoration containerBorderDecoration( BoxDecoration containerBorderDecoration(Color containerColor, Color borderColor) {
Color containerColor, Color borderColor) {
return BoxDecoration( return BoxDecoration(
color: containerColor, color: containerColor,
shape: BoxShape.rectangle, shape: BoxShape.rectangle,
@ -76,35 +65,25 @@ class _UpdatePlanPageState extends State<UpdatePlanPage>
} }
} }
getPatientProgressNote(SOAPViewModel model, getPatientProgressNote(SOAPViewModel model, {bool isAddProgress = false}) async {
{bool isAddProgress = false}) async { GetProgressNoteReqModel getGetProgressNoteReqModel = GetProgressNoteReqModel(
GetProgressNoteReqModel getGetProgressNoteReqModel = appointmentNo: int.parse(widget.patientInfo.appointmentNo.toString()),
GetProgressNoteReqModel(
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: '',
doctorID: ''); doctorID: '');
await widget.sOAPViewModel await widget.sOAPViewModel.getPatientProgressNote(getGetProgressNoteReqModel);
.getPatientProgressNote(getGetProgressNoteReqModel);
///TODO set progressNote in model; ///TODO set progressNote in model;
if (widget.sOAPViewModel.patientProgressNoteList.isNotEmpty) { if (widget.sOAPViewModel.patientProgressNoteList.isNotEmpty) {
progressNoteController.text = Utils.parseHtmlString( progressNoteController.text = Utils.parseHtmlString(widget.sOAPViewModel.patientProgressNoteList[0].planNote);
widget.sOAPViewModel.patientProgressNoteList[0].planNote);
patientProgressNote.planNote = progressNoteController.text; patientProgressNote.planNote = progressNoteController.text;
patientProgressNote.createdByName = patientProgressNote.createdByName = widget.sOAPViewModel.patientProgressNoteList[0].createdByName;
widget.sOAPViewModel.patientProgressNoteList[0].createdByName; patientProgressNote.createdOn = widget.sOAPViewModel.patientProgressNoteList[0].createdOn;
patientProgressNote.createdOn = patientProgressNote.editedOn = widget.sOAPViewModel.patientProgressNoteList[0].editedOn;
widget.sOAPViewModel.patientProgressNoteList[0].createdOn; patientProgressNote.editedByName = widget.sOAPViewModel.patientProgressNoteList[0].editedByName;
patientProgressNote.editedOn = patientProgressNote.appointmentNo = widget.sOAPViewModel.patientProgressNoteList[0].appointmentNo;
widget.sOAPViewModel.patientProgressNoteList[0].editedOn;
patientProgressNote.editedByName =
widget.sOAPViewModel.patientProgressNoteList[0].editedByName;
patientProgressNote.appointmentNo =
widget.sOAPViewModel.patientProgressNoteList[0].appointmentNo;
setState(() { setState(() {
isAddProgress = isAddProgress; isAddProgress = isAddProgress;
widget.sOAPViewModel.isAddProgress = isAddProgress; widget.sOAPViewModel.isAddProgress = isAddProgress;
@ -118,31 +97,22 @@ class _UpdatePlanPageState extends State<UpdatePlanPage>
return BaseView<SOAPViewModel>( return BaseView<SOAPViewModel>(
onModelReady: (model) async { onModelReady: (model) async {
widget.sOAPViewModel.setPlanCallBack(this); widget.sOAPViewModel.setPlanCallBack(this);
GetProgressNoteReqModel getGetProgressNoteReqModel = GetProgressNoteReqModel getGetProgressNoteReqModel = GetProgressNoteReqModel(
GetProgressNoteReqModel( appointmentNo: int.parse(widget.patientInfo.appointmentNo.toString()),
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: '',
doctorID: ''); doctorID: '');
await widget.sOAPViewModel await widget.sOAPViewModel.getPatientProgressNote(getGetProgressNoteReqModel);
.getPatientProgressNote(getGetProgressNoteReqModel);
if (widget.sOAPViewModel.patientProgressNoteList.isNotEmpty) { if (widget.sOAPViewModel.patientProgressNoteList.isNotEmpty) {
progressNoteController.text = Utils.parseHtmlString( progressNoteController.text = Utils.parseHtmlString(widget.sOAPViewModel.patientProgressNoteList[0].planNote);
widget.sOAPViewModel.patientProgressNoteList[0].planNote);
patientProgressNote.planNote = progressNoteController.text; patientProgressNote.planNote = progressNoteController.text;
patientProgressNote.createdByName = patientProgressNote.createdByName = widget.sOAPViewModel.patientProgressNoteList[0].createdByName;
widget.sOAPViewModel.patientProgressNoteList[0].createdByName; patientProgressNote.createdOn = widget.sOAPViewModel.patientProgressNoteList[0].createdOn;
patientProgressNote.createdOn = patientProgressNote.editedOn = widget.sOAPViewModel.patientProgressNoteList[0].editedOn;
widget.sOAPViewModel.patientProgressNoteList[0].createdOn; patientProgressNote.editedByName = widget.sOAPViewModel.patientProgressNoteList[0].editedByName;
patientProgressNote.editedOn = patientProgressNote.appointmentNo = widget.sOAPViewModel.patientProgressNoteList[0].appointmentNo;
widget.sOAPViewModel.patientProgressNoteList[0].editedOn;
patientProgressNote.editedByName =
widget.sOAPViewModel.patientProgressNoteList[0].editedByName;
patientProgressNote.appointmentNo =
widget.sOAPViewModel.patientProgressNoteList[0].appointmentNo;
widget.sOAPViewModel.progressNoteText = progressNoteController.text; widget.sOAPViewModel.progressNoteText = progressNoteController.text;
setState(() { setState(() {
@ -185,19 +155,16 @@ class _UpdatePlanPageState extends State<UpdatePlanPage>
children: [ children: [
if (isAddProgress) if (isAddProgress)
Container( Container(
margin: EdgeInsets.only( margin: EdgeInsets.only(left: 10, right: 10, top: 15),
left: 10, right: 10, top: 15),
child: AppTextFieldCustom( child: AppTextFieldCustom(
hintText: TranslationBase.of(context) hintText: TranslationBase.of(context).progressNote,
.progressNote,
controller: progressNoteController, controller: progressNoteController,
minLines: 2, minLines: 2,
maxLines: 4, maxLines: 4,
inputType: TextInputType.multiline, inputType: TextInputType.multiline,
onChanged: (value) { onChanged: (value) {
setState(() { setState(() {
patientProgressNote.planNote = patientProgressNote.planNote = value;
value;
model.progressNoteText = value; model.progressNoteText = value;
widget.changeStateFun(); widget.changeStateFun();
}); });
@ -207,73 +174,48 @@ class _UpdatePlanPageState extends State<UpdatePlanPage>
SizedBox( SizedBox(
height: 9, height: 9,
), ),
if (patientProgressNote.planNote != null && if (patientProgressNote.planNote != null && !isAddProgress)
!isAddProgress)
Container( Container(
margin: EdgeInsets.only( margin: EdgeInsets.only(
left: 5, left: 5,
right: 5, right: 5,
), ),
child: Column( child: Column(
crossAxisAlignment: crossAxisAlignment: CrossAxisAlignment.start,
CrossAxisAlignment.start,
children: [ children: [
Row( Row(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.spaceBetween,
MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [ children: [
Row( Row(
children: [ children: [
AppText( AppText(
'Appointment No: ', 'Appointment No: ',
fontSize: SizeConfig fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3,
.getTextMultiplierBasedOnWidth() *
3,
letterSpacing: -0.4, letterSpacing: -0.4,
color: Color(0xFF575757), color: Color(0xFF575757),
), ),
AppText( AppText(
patientProgressNote patientProgressNote.appointmentNo != null ? patientProgressNote.appointmentNo.toString() : '',
.appointmentNo !=
null
? patientProgressNote
.appointmentNo
.toString()
: '',
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
letterSpacing: -0.48, letterSpacing: -0.48,
color: Color(0xFF2B353E), color: Color(0xFF2B353E),
fontSize: SizeConfig fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3.6,
.getTextMultiplierBasedOnWidth() *
3.6,
), ),
], ],
), ),
AppText( AppText(
patientProgressNote.createdOn != patientProgressNote.createdOn != null
null ? AppDateUtils.getDayMonthYearDateFormatted(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: SizeConfig fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3.6,
.getTextMultiplierBasedOnWidth() *
3.6,
) )
], ],
), ),
Row( Row(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.end,
MainAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [ children: [
// Row( // Row(
// children: [ // children: [
@ -288,19 +230,10 @@ class _UpdatePlanPageState extends State<UpdatePlanPage>
// ], // ],
// ), // ),
AppText( AppText(
patientProgressNote.createdOn != patientProgressNote.createdOn != null ? AppDateUtils.getHour(DateTime.parse(patientProgressNote.createdOn)) : AppDateUtils.getHour(DateTime.now()),
null
? AppDateUtils.getHour(
DateTime.parse(
patientProgressNote
.createdOn))
: AppDateUtils.getHour(
DateTime.now()),
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
color: Color(0xFF575757), color: Color(0xFF575757),
fontSize: SizeConfig fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3.6,
.getTextMultiplierBasedOnWidth() *
3.6,
) )
], ],
), ),
@ -308,8 +241,7 @@ class _UpdatePlanPageState extends State<UpdatePlanPage>
height: 8, height: 8,
), ),
Row( Row(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.start,
MainAxisAlignment.start,
children: [ children: [
Expanded( Expanded(
child: AppText( child: AppText(
@ -321,8 +253,7 @@ class _UpdatePlanPageState extends State<UpdatePlanPage>
onTap: () { onTap: () {
setState(() { setState(() {
isAddProgress = true; isAddProgress = true;
widget.sOAPViewModel widget.sOAPViewModel.isAddProgress = true;
.isAddProgress = true;
}); });
}, },
child: Icon( child: Icon(
@ -341,8 +272,7 @@ class _UpdatePlanPageState extends State<UpdatePlanPage>
isExpanded: isProgressExpanded, isExpanded: isProgressExpanded,
), ),
SizedBox( SizedBox(
height: SizeConfig.heightMultiplier * height: SizeConfig.heightMultiplier * (SizeConfig.isHeightVeryShort ? 20 : 10),
(SizeConfig.isHeightVeryShort ? 20 : 10),
), ),
], ],
), ),
@ -355,8 +285,7 @@ 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 = PostProgressNoteRequestModel postProgressNoteRequestModel = new 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,
@ -365,49 +294,42 @@ class _UpdatePlanPageState extends State<UpdatePlanPage>
editedBy: ''); editedBy: '');
if (widget.sOAPViewModel.patientProgressNoteList.isEmpty) { if (widget.sOAPViewModel.patientProgressNoteList.isEmpty) {
await widget.sOAPViewModel await widget.sOAPViewModel.postProgressNote(postProgressNoteRequestModel);
.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 widget.sOAPViewModel await widget.sOAPViewModel.patchProgressNote(postProgressNoteRequestModel);
.patchProgressNote(postProgressNoteRequestModel);
} }
if (widget.sOAPViewModel.state == ViewState.ErrorLocal) { if (widget.sOAPViewModel.state == ViewState.ErrorLocal) {
Utils.showErrorToast(widget.sOAPViewModel.error); Utils.showErrorToast(widget.sOAPViewModel.error);
} else { } else {
GetProgressNoteReqModel getGetProgressNoteReqModel = GetProgressNoteReqModel getGetProgressNoteReqModel = GetProgressNoteReqModel(
GetProgressNoteReqModel( appointmentNo: int.parse(widget.patientInfo.appointmentNo.toString()),
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: '',
doctorID: ''); doctorID: '');
await widget.sOAPViewModel await widget.sOAPViewModel.getPatientProgressNote(getGetProgressNoteReqModel);
.getPatientProgressNote(getGetProgressNoteReqModel);
if (widget.sOAPViewModel.patientProgressNoteList.isNotEmpty) { if (widget.sOAPViewModel.patientProgressNoteList.isNotEmpty) {
progressNoteController.text = Utils.parseHtmlString( progressNoteController.text = Utils.parseHtmlString(widget.sOAPViewModel.patientProgressNoteList[0].planNote);
widget.sOAPViewModel.patientProgressNoteList[0].planNote);
patientProgressNote.planNote = progressNoteController.text; patientProgressNote.planNote = progressNoteController.text;
patientProgressNote.createdByName = patientProgressNote.createdByName = widget.sOAPViewModel.patientProgressNoteList[0].createdByName;
widget.sOAPViewModel.patientProgressNoteList[0].createdByName; patientProgressNote.createdOn = widget.sOAPViewModel.patientProgressNoteList[0].createdOn;
patientProgressNote.createdOn = patientProgressNote.editedOn = widget.sOAPViewModel.patientProgressNoteList[0].editedOn;
widget.sOAPViewModel.patientProgressNoteList[0].createdOn; patientProgressNote.editedByName = widget.sOAPViewModel.patientProgressNoteList[0].editedByName;
patientProgressNote.editedOn = patientProgressNote.appointmentNo = widget.sOAPViewModel.patientProgressNoteList[0].appointmentNo;
widget.sOAPViewModel.patientProgressNoteList[0].editedOn;
patientProgressNote.editedByName =
widget.sOAPViewModel.patientProgressNoteList[0].editedByName;
patientProgressNote.appointmentNo =
widget.sOAPViewModel.patientProgressNoteList[0].appointmentNo;
setState(() { setState(() {
isAddProgress = false; isAddProgress = false;
widget.sOAPViewModel.isAddProgress = false; widget.sOAPViewModel.isAddProgress = false;
}); });
} }
Navigator.of(context).pop();
Utils.showErrorToast("Episode Created Successfully");
} }
widget.changeLoadingState(false); widget.changeLoadingState(false);
} else { } else {

Loading…
Cancel
Save