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';
@ -62,7 +63,8 @@ class SOAPService extends LookupService {
}, 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) {
@ -72,4 +74,16 @@ class SOAPService extends LookupService {
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,11 +108,14 @@ class _AddSOAPIndexState extends State<AddSOAPIndex>
), ),
], ],
), ),
AppText( Container(
width: MediaQuery.of(context).size.width *0.65,
child: AppText(
"ALLERGIC TO: FOOD, ASPIRIN, EGG WHITE", "ALLERGIC TO: FOOD, ASPIRIN, EGG WHITE",
color: Color(0xFFB9382C), color: Color(0xFFB9382C),
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
),
], ],
) )
], ],

@ -320,6 +320,7 @@ class _ObjectivePageState extends State<ObjectivePage> {
} }
submitObjectivePage(SOAPViewModel model) async { submitObjectivePage(SOAPViewModel model) async {
if(widget.mySelectedExamination.isNotEmpty){
PostPhysicalExamRequestModel postPhysicalExamRequestModel = new PostPhysicalExamRequestModel(); PostPhysicalExamRequestModel postPhysicalExamRequestModel = new PostPhysicalExamRequestModel();
widget.mySelectedExamination.forEach((exam) { widget.mySelectedExamination.forEach((exam) {
if (postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM == if (postPhysicalExamRequestModel.listHisProgNotePhysicalExaminationVM ==
@ -352,6 +353,8 @@ class _ObjectivePageState extends State<ObjectivePage> {
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,10 +128,13 @@ class _PlanPageState extends State<PlanPage> {
SizedBox( SizedBox(
height: 20, height: 20,
), ),
if (progressNoteController.text.isNotEmpty)
Container( Container(
margin: EdgeInsets.only(left: 5, right: 5, top: 15), margin:
EdgeInsets.only(left: 5, right: 5, top: 15),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment:
MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Column( Column(
@ -151,7 +161,8 @@ class _PlanPageState extends State<PlanPage> {
], ],
), ),
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment
.start,
children: [ children: [
Row( Row(
@ -164,7 +175,10 @@ class _PlanPageState extends State<PlanPage> {
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
.of(context)
.size
.width * 0.6,
child: AppText( child: AppText(
progressNoteController.text, progressNoteController.text,
fontSize: 10, fontSize: 10,
@ -174,7 +188,7 @@ class _PlanPageState extends State<PlanPage> {
), ),
), ),
], ],
),SizedBox( ), SizedBox(
height: 8, height: 8,
), ),
Row( Row(
@ -232,9 +246,14 @@ 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(
@ -247,35 +266,26 @@ class _PlanPageState extends State<PlanPage> {
),),); ),),);
} }
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