PostPhysicalExam works

pull/199/head
Elham Rababah 5 years ago
parent d4a1dcfc81
commit 1491a04b39

@ -107,6 +107,7 @@ const GET_MASTER_LOOKUP_LIST = 'Services/DoctorApplication.svc/REST/GetMasterLoo
const POST_ALLERGY = 'Services/DoctorApplication.svc/REST/PostAllergies'; 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';
var selectedPatientType = 1; var selectedPatientType = 1;

@ -4,6 +4,7 @@ import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart';
import 'package:doctor_app_flutter/models/SOAP/post_allergy_request_model.dart'; 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 'base/lookup-service.dart'; import 'base/lookup-service.dart';
@ -60,4 +61,15 @@ class SOAPService extends LookupService {
super.error = error; super.error = error;
}, body: postChiefComplaintRequestModel.toJson()); }, body: postChiefComplaintRequestModel.toJson());
} }
Future postPhysicalExam(PostPhysicalExamRequestModel postPhysicalExamRequestModel) async {
hasError = false;
await baseAppClient.post(POST_PHYSICAL_EXAM,
onSuccess: (dynamic response, int statusCode) {
print("Success");
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: postPhysicalExamRequestModel.toJson());
}
} }

@ -7,6 +7,7 @@ import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart';
import 'package:doctor_app_flutter/models/SOAP/post_allergy_request_model.dart'; 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 '../../locator.dart'; import '../../locator.dart';
import 'base_view_model.dart'; import 'base_view_model.dart';
@ -83,5 +84,15 @@ class SOAPViewModel extends BaseViewModel {
setState(ViewState.Idle); setState(ViewState.Idle);
} }
Future postPhysicalExam(PostPhysicalExamRequestModel postPhysicalExamRequestModel) async {
setState(ViewState.BusyLocal);
await _SOAPService.postPhysicalExam(postPhysicalExamRequestModel);
if (_SOAPService.hasError) {
error = _SOAPService.error;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
}
} }

@ -1,9 +1,11 @@
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/master_lookup_key.dart'; import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart';
import 'package:doctor_app_flutter/core/enum/viewstate.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/master_key_model.dart'; import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart';
import 'package:doctor_app_flutter/models/SOAP/my_selected_examination.dart'; import 'package:doctor_app_flutter/models/SOAP/my_selected_examination.dart';
import 'package:doctor_app_flutter/models/SOAP/post_physical_exam_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';
@ -49,7 +51,9 @@ class _ObjectivePageState extends State<ObjectivePage> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
final screenSize = MediaQuery.of(context).size; final screenSize = MediaQuery.of(context).size;
return AppScaffold( return BaseView<SOAPViewModel>(
// onModelReady: (model) => model.getMasterLookup(MasterKeysService.Allergies),
builder: (_, model, w) => AppScaffold(
isShowAppBar: false, isShowAppBar: false,
body: SingleChildScrollView( body: SingleChildScrollView(
physics: ScrollPhysics(), physics: ScrollPhysics(),
@ -161,7 +165,12 @@ class _ObjectivePageState extends State<ObjectivePage> {
0.070, 0.070,
decoration: decoration:
containerBorderDecoration( containerBorderDecoration(
Colors.white, examination
.isNormal
? Color(
0xFF515A5D)
: Colors
.white,
Colors.grey), Colors.grey),
child: Center( child: Center(
child: Padding( child: Padding(
@ -173,17 +182,28 @@ class _ObjectivePageState extends State<ObjectivePage> {
style: TextStyle( style: TextStyle(
fontSize: 12, fontSize: 12,
color: color:
Colors.black, examination
.isNormal
? Colors.white
: Colors
.black,
//Colors.black, //Colors.black,
fontWeight: fontWeight:
FontWeight FontWeight
.bold, .bold,
), ),
), ),
), ),
)), )),
), ),
onTap: () {}), onTap: () {
setState(() {
examination.isAbnormal =
!examination.isAbnormal;
examination.isNormal =
!examination.isNormal;
});
}),
SizedBox( SizedBox(
width: 12, width: 12,
), ),
@ -191,33 +211,49 @@ class _ObjectivePageState extends State<ObjectivePage> {
child: Center( child: Center(
child: Container( child: Container(
height: height:
screenSize.height * screenSize.height *
0.070, 0.070,
decoration: decoration:
containerBorderDecoration( containerBorderDecoration(
Color(0xFF515A5D), examination
Colors.black), .isAbnormal
? Color(
0xFF515A5D)
: Colors
.white,
Colors.black),
child: Center( child: Center(
child: Padding( child: Padding(
padding: padding:
const EdgeInsets const EdgeInsets
.all(8.0), .all(8.0),
child: Text( child: Text(
"Abnormal", "Abnormal",
style: TextStyle( style: TextStyle(
fontSize: 12, fontSize: 12,
color: color:
Colors.white, examination
.isAbnormal
? Colors.white
: Colors
.black,
//Colors.black, //Colors.black,
fontWeight: fontWeight:
FontWeight FontWeight
.bold, .bold,
), ),
), ),
), ),
)), )),
), ),
onTap: () {}), onTap: () {
setState(() {
examination.isAbnormal =
!examination.isAbnormal;
examination.isNormal =
!examination.isNormal;
});
}),
], ],
), ),
InkWell( InkWell(
@ -267,9 +303,11 @@ class _ObjectivePageState extends State<ObjectivePage> {
), ),
DividerWithSpacesAround(height: 30,), DividerWithSpacesAround(height: 30,),
AppButton( AppButton(
title: TranslationBase.of(context).next, title: TranslationBase
onPressed: () { .of(context)
widget.changePageViewIndex(2); .next,
onPressed: () async {
await submitObjectivePage(model);
}, },
), ),
SizedBox( SizedBox(
@ -279,7 +317,43 @@ class _ObjectivePageState extends State<ObjectivePage> {
), ),
), ),
), ),
)); )));
}
submitObjectivePage(SOAPViewModel model) async {
PostPhysicalExamRequestModel postPhysicalExamRequestModel = new PostPhysicalExamRequestModel();
widget.mySelectedExamination.forEach((exam) {
if (postPhysicalExamRequestModel.listHisProgNotePhysicalVM ==
null)
postPhysicalExamRequestModel.listHisProgNotePhysicalVM = [];
postPhysicalExamRequestModel.listHisProgNotePhysicalVM.add(
ListHisProgNotePhysicalVM(
patientMRN: 3120690,
episodeId: 200012117,
appointmentNo: 2016054573,
remarks: exam.remark ?? '',
createdBy: 1485,
createdOn: DateTime.now().toIso8601String(),
editedBy: 1485,
editedOn: DateTime.now().toIso8601String(),
examId: exam.selectedExamination.id,
examType: exam.selectedExamination.typeId,
isAbnormal: exam.isAbnormal,
isNormal: exam.isNormal,
masterDescription: exam.selectedExamination,
));
});
await model.postPhysicalExam(postPhysicalExamRequestModel);
if (model.state == ViewState.ErrorLocal) {
helpers.showErrorToast(model.error);
} else {
}
// TODO move it back to else stat when it work.
widget.changePageViewIndex(2);
} }
removeExamination(MasterKeyModel masterKey) { removeExamination(MasterKeyModel masterKey) {

@ -140,7 +140,8 @@ class _SubjectivePageState extends State<SubjectivePage> {
SizedBox( SizedBox(
height: 20, height: 20,
), ),
AddMedication(), // TODO return it back when we need it.
// AddMedication(),
]), ]),
), ),
isExpand: isChiefExpand, isExpand: isChiefExpand,
@ -305,9 +306,9 @@ class _SubjectivePageState extends State<SubjectivePage> {
remarks: allergy.remark, remarks: allergy.remark,
createdBy: 1485, createdBy: 1485,
// //
createdOn: "2020-08-14T20:37:22.780Z", createdOn: DateTime.now().toIso8601String(),//"2020-08-14T20:37:22.780Z",
editedBy: 1485, editedBy: 1485,
editedOn: "2020-08-14T20:37:22.780Z", editedOn: DateTime.now().toIso8601String(),//"2020-08-14T20:37:22.780Z",
isChecked: false, isChecked: false,
isUpdatedByNurse: false)); isUpdatedByNurse: false));
}); });

Loading…
Cancel
Save