Post progress Note

pull/199/head
Elham Rababah 5 years ago
parent b22fd3f7ba
commit dc4250a4de

@ -108,6 +108,7 @@ const POST_ALLERGY = 'Services/DoctorApplication.svc/REST/PostAllergies';
const POST_HISTORY = 'Services/DoctorApplication.svc/REST/PostHistory'; const POST_HISTORY = 'Services/DoctorApplication.svc/REST/PostHistory';
const POST_CHIEF_COMPLAINT = 'Services/DoctorApplication.svc/REST/PostChiefcomplaint'; const POST_CHIEF_COMPLAINT = 'Services/DoctorApplication.svc/REST/PostChiefcomplaint';
const POST_PHYSICAL_EXAM = 'Services/DoctorApplication.svc/REST/PostPhysicalExam'; const POST_PHYSICAL_EXAM = 'Services/DoctorApplication.svc/REST/PostPhysicalExam';
const POST_PROGRESS_NOTE = '/Services/DoctorApplication.svc/REST/PostProgressNote';
var selectedPatientType = 1; var selectedPatientType = 1;

@ -5,6 +5,7 @@ import 'package:doctor_app_flutter/models/SOAP/post_allergy_request_model.dart';
import 'package:doctor_app_flutter/models/SOAP/post_chief_complaint_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_chief_complaint_request_model.dart';
import 'package:doctor_app_flutter/models/SOAP/post_histories_request_model.dart'; 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 'base/lookup-service.dart'; import 'base/lookup-service.dart';
@ -56,20 +57,33 @@ class SOAPService extends LookupService {
await baseAppClient.post(POST_CHIEF_COMPLAINT, await baseAppClient.post(POST_CHIEF_COMPLAINT,
onSuccess: (dynamic response, int statusCode) { onSuccess: (dynamic response, int statusCode) {
print("Success"); print("Success");
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
hasError = true; hasError = true;
super.error = error; super.error = error;
}, body: postChiefComplaintRequestModel.toJson()); }, body: postChiefComplaintRequestModel.toJson());
} }
Future postPhysicalExam(PostPhysicalExamRequestModel postPhysicalExamRequestModel) async { Future postPhysicalExam(
PostPhysicalExamRequestModel postPhysicalExamRequestModel) async {
hasError = false; hasError = false;
await baseAppClient.post(POST_PHYSICAL_EXAM, await baseAppClient.post(POST_PHYSICAL_EXAM,
onSuccess: (dynamic response, int statusCode) { onSuccess: (dynamic response, int statusCode) {
print("Success"); print("Success");
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
hasError = true; hasError = true;
super.error = error; super.error = error;
}, body: postPhysicalExamRequestModel.toJson()); }, body: postPhysicalExamRequestModel.toJson());
}
Future postProgressNote(
PostProgressNoteRequestModel postProgressNoteRequestModel) async {
hasError = false;
await baseAppClient.post(POST_PROGRESS_NOTE,
onSuccess: (dynamic response, int statusCode) {
print("Success");
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: postProgressNoteRequestModel.toJson());
} }
} }

@ -8,6 +8,7 @@ import 'package:doctor_app_flutter/models/SOAP/post_allergy_request_model.dart';
import 'package:doctor_app_flutter/models/SOAP/post_chief_complaint_request_model.dart'; import 'package:doctor_app_flutter/models/SOAP/post_chief_complaint_request_model.dart';
import 'package:doctor_app_flutter/models/SOAP/post_histories_request_model.dart'; 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 '../../locator.dart'; import '../../locator.dart';
import 'base_view_model.dart'; import 'base_view_model.dart';
@ -94,5 +95,15 @@ class SOAPViewModel extends BaseViewModel {
setState(ViewState.Idle); setState(ViewState.Idle);
} }
Future postProgressNote(PostProgressNoteRequestModel postProgressNoteRequestModel) async {
setState(ViewState.BusyLocal);
await _SOAPService.postProgressNote(postProgressNoteRequestModel);
if (_SOAPService.hasError) {
error = _SOAPService.error;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
}
} }

@ -8,18 +8,18 @@ class PostProgressNoteRequestModel {
{this.appointmentNo, this.episodeId, this.patientMRN, this.planNote}); {this.appointmentNo, this.episodeId, this.patientMRN, this.planNote});
PostProgressNoteRequestModel.fromJson(Map<String, dynamic> json) { PostProgressNoteRequestModel.fromJson(Map<String, dynamic> json) {
appointmentNo = json['appointmentNo']; appointmentNo = json['AppointmentNo'];
episodeId = json['episodeId']; episodeId = json['EpisodeId'];
patientMRN = json['patientMRN']; patientMRN = json['PatientMRN'];
planNote = json['planNote']; planNote = json['PlanNote'];
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>(); final Map<String, dynamic> data = new Map<String, dynamic>();
data['appointmentNo'] = this.appointmentNo; data['AppointmentNo'] = this.appointmentNo;
data['episodeId'] = this.episodeId; data['EpisodeId'] = this.episodeId;
data['patientMRN'] = this.patientMRN; data['PatientMRN'] = this.patientMRN;
data['planNote'] = this.planNote; data['PlanNote'] = this.planNote;
return data; return data;
} }
} }

@ -348,7 +348,8 @@ class Helpers {
String lang = await sharedPref.getString(APP_Language); String lang = await sharedPref.getString(APP_Language);
await clearSharedPref(); await clearSharedPref();
sharedPref.setString(APP_Language, lang); sharedPref.setString(APP_Language, lang);
// Navigator.of(AppGlobal.CONTEX).pushReplacementNamed(LOGIN); Navigator.of(AppGlobal.CONTEX).pushReplacementNamed(LOGIN);
Navigator.of(AppGlobal.CONTEX).popUntil((ModalRoute.withName(LOGIN))); // TODO Fix it
// Navigator.of(AppGlobal.CONTEX).popUntil((ModalRoute.withName(LOGIN)));
} }
} }

@ -108,10 +108,13 @@ class _AddSOAPIndexState extends State<AddSOAPIndex>
), ),
], ],
), ),
AppText( Container(
"ALLERGIC TO: FOOD, ASPIRIN, EGG WHITE", width: MediaQuery.of(context).size.width *0.65,
color: Color(0xFFB9382C), child: AppText(
fontWeight: FontWeight.bold, "ALLERGIC TO: FOOD, ASPIRIN, EGG WHITE",
color: Color(0xFFB9382C),
fontWeight: FontWeight.bold,
),
), ),
], ],
) )

@ -320,38 +320,41 @@ class _ObjectivePageState extends State<ObjectivePage> {
} }
submitObjectivePage(SOAPViewModel model) async { submitObjectivePage(SOAPViewModel model) async {
PostPhysicalExamRequestModel postPhysicalExamRequestModel = new PostPhysicalExamRequestModel(); if(widget.mySelectedExamination.isNotEmpty){
widget.mySelectedExamination.forEach((exam) { PostPhysicalExamRequestModel postPhysicalExamRequestModel = new PostPhysicalExamRequestModel();
if (postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM == widget.mySelectedExamination.forEach((exam) {
null) if (postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM ==
postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM = []; null)
postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM = [];
postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM.add( postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM.add(
ListHisProgNotePhysicalExaminationVM( ListHisProgNotePhysicalExaminationVM(
patientMRN: 3120690, patientMRN: 3120690,
episodeId: 200012117, episodeId: 200012117,
appointmentNo: 2016054573, appointmentNo: 2016054573,
remarks: exam.remark ?? '', remarks: exam.remark ?? '',
createdBy: 1485, createdBy: 1485,
createdOn: DateTime.now().toIso8601String(), createdOn: DateTime.now().toIso8601String(),
editedBy: 1485, editedBy: 1485,
editedOn: DateTime.now().toIso8601String(), editedOn: DateTime.now().toIso8601String(),
examId: exam.selectedExamination.id, examId: exam.selectedExamination.id,
examType: exam.selectedExamination.typeId, examType: exam.selectedExamination.typeId,
isAbnormal: exam.isAbnormal, isAbnormal: exam.isAbnormal,
isNormal: exam.isNormal, isNormal: exam.isNormal,
masterDescription: exam.selectedExamination, masterDescription: exam.selectedExamination,
notExamined: false notExamined: false
)); ));
}); });
await model.postPhysicalExam(postPhysicalExamRequestModel); await model.postPhysicalExam(postPhysicalExamRequestModel);
if (model.state == ViewState.ErrorLocal) { if (model.state == ViewState.ErrorLocal) {
helpers.showErrorToast(model.error); helpers.showErrorToast(model.error);
} else { } else {
}
} }
// TODO move it back to else stat when it work. // TODO move it back to else stat when it work.
widget.changePageViewIndex(2); widget.changePageViewIndex(2);

@ -1,5 +1,8 @@
import 'package:doctor_app_flutter/client/base_app_client.dart';
import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/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/SOAP_view_model.dart';
import 'package:doctor_app_flutter/models/SOAP/post_progress_note_request_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/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/shared/Text.dart'; import 'package:doctor_app_flutter/widgets/shared/Text.dart';
@ -27,7 +30,9 @@ class _PlanPageState extends State<PlanPage> {
List<dynamic> progressNoteList; List<dynamic> progressNoteList;
TextEditingController progressNoteController = TextEditingController(); TextEditingController progressNoteController =
TextEditingController(text: null);
BoxDecoration containerBorderDecoration( BoxDecoration containerBorderDecoration(
Color containerColor, Color borderColor) { Color containerColor, Color borderColor) {
return BoxDecoration( return BoxDecoration(
@ -40,6 +45,7 @@ class _PlanPageState extends State<PlanPage> {
)), )),
); );
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final screenSize = MediaQuery.of(context).size; final screenSize = MediaQuery.of(context).size;
@ -112,7 +118,8 @@ class _PlanPageState extends State<PlanPage> {
// controller: messageController, // controller: messageController,
validator: (value) { validator: (value) {
if (value == null) if (value == null)
return TranslationBase.of(context) return TranslationBase
.of(context)
.emptyMessage; .emptyMessage;
else else
return null; return null;
@ -121,110 +128,117 @@ class _PlanPageState extends State<PlanPage> {
SizedBox( SizedBox(
height: 20, height: 20,
), ),
Container( if (progressNoteController.text.isNotEmpty)
margin: EdgeInsets.only(left: 5, right: 5, top: 15), Container(
child: Row( margin:
mainAxisAlignment: MainAxisAlignment.spaceBetween, EdgeInsets.only(left: 5, right: 5, top: 15),
crossAxisAlignment: CrossAxisAlignment.start, child: Row(
children: [ mainAxisAlignment:
Column( MainAxisAlignment.spaceBetween,
mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Column( Column(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.start,
MainAxisAlignment.start, children: [
crossAxisAlignment: Column(
CrossAxisAlignment.start, mainAxisAlignment:
children: [ MainAxisAlignment.start,
AppText( crossAxisAlignment:
"12".toUpperCase(), CrossAxisAlignment.start,
fontWeight: FontWeight.bold, children: [
fontSize: 16, AppText(
), "12".toUpperCase(),
AppText( fontWeight: FontWeight.bold,
"DEC".toUpperCase(), fontSize: 16,
fontSize: 10, ),
color: Colors.grey, AppText(
), "DEC".toUpperCase(),
], fontSize: 10,
) color: Colors.grey,
], ),
), ],
Column( )
crossAxisAlignment: CrossAxisAlignment.start, ],
children: [ ),
Column(
crossAxisAlignment: CrossAxisAlignment
.start,
children: [
Row( Row(
mainAxisAlignment: mainAxisAlignment:
MainAxisAlignment.start, MainAxisAlignment.start,
children: [ children: [
SizedBox( SizedBox(
height: 6, height: 6,
), ),
Padding( Padding(
padding: const EdgeInsets.all(0.0), padding: const EdgeInsets.all(0.0),
child: Container( child: Container(
width: MediaQuery.of(context).size.width * 0.6, width: MediaQuery
child: AppText( .of(context)
progressNoteController.text, .size
fontSize: 10, .width * 0.6,
child: AppText(
progressNoteController.text,
fontSize: 10,
color: Colors.grey, color: Colors.grey,
),
), ),
), ),
), ],
], ), SizedBox(
),SizedBox( height: 8,
height: 8, ),
), Row(
Row( mainAxisAlignment:
mainAxisAlignment: MainAxisAlignment.start,
MainAxisAlignment.start, children: [
children: [ AppText(
AppText( "Created By : ",
"Created By : ", fontWeight: FontWeight.bold,
fontWeight: FontWeight.bold, fontSize: 16,
fontSize: 16, ),
), AppText(
AppText( "Anas Abdullah on 12 De",
"Anas Abdullah on 12 De", fontSize: 10,
fontSize: 10, color: Colors.grey,
color: Colors.grey, ),
), ],
], ),
), Row(
Row( mainAxisAlignment:
mainAxisAlignment: MainAxisAlignment.start,
MainAxisAlignment.start, children: [
children: [ AppText(
AppText( "Edited By : ",
"Edited By : ", fontWeight: FontWeight.bold,
fontWeight: FontWeight.bold, fontSize: 16,
fontSize: 16, ),
), AppText(
AppText( "Rahim on 13 Dec",
"Rahim on 13 Dec", fontSize: 10,
fontSize: 10, color: Colors.grey,
color: Colors.grey, ),
), ],
], ),
),
], ],
), ),
Column( Column(
children: [ children: [
InkWell( InkWell(
onTap: () { onTap: () {
openProgressNote(context); openProgressNote(context);
}, },
child: Icon(EvaIcons.edit2Outline), child: Icon(EvaIcons.edit2Outline),
) )
], ],
), ),
], ],
), ),
) )
], ],
) )
]), ]),
@ -232,50 +246,46 @@ class _PlanPageState extends State<PlanPage> {
), ),
DividerWithSpacesAround(height: 30,), DividerWithSpacesAround(height: 30,),
AppButton( AppButton(
title: TranslationBase.of(context).next, title: TranslationBase
.of(context)
.next,
loading: model.state == ViewState.BusyLocal,
onPressed: () { onPressed: () {
widget.changePageViewIndex(2);
submitPlan(model);
// widget.changePageViewIndex(2);
}, },
), ),
SizedBox( SizedBox(
height: 30, height: 30,
),
],
), ),
), ],
), ),
),),); ),
),
),),);
} }
openProgressNote(BuildContext context) { submitPlan(SOAPViewModel model) async {
final screenSize = MediaQuery if (progressNoteController.text.isNotEmpty) {
.of(context) PostProgressNoteRequestModel postProgressNoteRequestModel = new PostProgressNoteRequestModel(
.size; patientMRN: 3120690,
InputDecoration textFieldSelectorDecoration(String hintText, episodeId: 200012117,
String selectedText, bool isDropDown) { appointmentNo: 2016054573,
return InputDecoration( planNote: progressNoteController.text);
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0),
borderRadius: BorderRadius.circular(8), await model.postProgressNote(postProgressNoteRequestModel);
),
enabledBorder: OutlineInputBorder( if (model.state == ViewState.ErrorLocal) {
borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), helpers.showErrorToast(model.error);
borderRadius: BorderRadius.circular(8), } else {
), Navigator.of(context).pop();
disabledBorder: OutlineInputBorder( }
borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0),
borderRadius: BorderRadius.circular(8),
),
hintText: selectedText != null ? selectedText : hintText,
suffixIcon: isDropDown ? Icon(Icons.arrow_drop_down) : null,
hintStyle: TextStyle(
fontSize: 14,
color: Colors.grey.shade600,
),
);
} }
}
; openProgressNote(BuildContext context) {
showModalBottomSheet( showModalBottomSheet(
backgroundColor: Colors.white, backgroundColor: Colors.white,
isScrollControlled: true, isScrollControlled: true,

Loading…
Cancel
Save