PostPhysicalExam works

pull/199/head
Elham Rababah 4 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_HISTORY = 'Services/DoctorApplication.svc/REST/PostHistory';
const POST_CHIEF_COMPLAINT = 'Services/DoctorApplication.svc/REST/PostChiefcomplaint';
const POST_PHYSICAL_EXAM = 'Services/DoctorApplication.svc/REST/PostPhysicalExam';
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_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_physical_exam_request_model.dart';
import 'base/lookup-service.dart';
@ -60,4 +61,15 @@ class SOAPService extends LookupService {
super.error = error;
}, 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_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_physical_exam_request_model.dart';
import '../../locator.dart';
import 'base_view_model.dart';
@ -83,5 +84,15 @@ class SOAPViewModel extends BaseViewModel {
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/core/enum/master_lookup_key.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/models/SOAP/master_key_model.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/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/shared/Text.dart';
@ -49,7 +51,9 @@ class _ObjectivePageState extends State<ObjectivePage> {
Widget build(BuildContext context) {
final screenSize = MediaQuery.of(context).size;
return AppScaffold(
return BaseView<SOAPViewModel>(
// onModelReady: (model) => model.getMasterLookup(MasterKeysService.Allergies),
builder: (_, model, w) => AppScaffold(
isShowAppBar: false,
body: SingleChildScrollView(
physics: ScrollPhysics(),
@ -161,7 +165,12 @@ class _ObjectivePageState extends State<ObjectivePage> {
0.070,
decoration:
containerBorderDecoration(
Colors.white,
examination
.isNormal
? Color(
0xFF515A5D)
: Colors
.white,
Colors.grey),
child: Center(
child: Padding(
@ -173,17 +182,28 @@ class _ObjectivePageState extends State<ObjectivePage> {
style: TextStyle(
fontSize: 12,
color:
Colors.black,
examination
.isNormal
? Colors.white
: Colors
.black,
//Colors.black,
fontWeight:
FontWeight
.bold,
FontWeight
.bold,
),
),
),
)),
),
onTap: () {}),
onTap: () {
setState(() {
examination.isAbnormal =
!examination.isAbnormal;
examination.isNormal =
!examination.isNormal;
});
}),
SizedBox(
width: 12,
),
@ -191,33 +211,49 @@ class _ObjectivePageState extends State<ObjectivePage> {
child: Center(
child: Container(
height:
screenSize.height *
0.070,
screenSize.height *
0.070,
decoration:
containerBorderDecoration(
Color(0xFF515A5D),
Colors.black),
containerBorderDecoration(
examination
.isAbnormal
? Color(
0xFF515A5D)
: Colors
.white,
Colors.black),
child: Center(
child: Padding(
padding:
const EdgeInsets
.all(8.0),
const EdgeInsets
.all(8.0),
child: Text(
"Abnormal",
style: TextStyle(
fontSize: 12,
color:
Colors.white,
examination
.isAbnormal
? Colors.white
: Colors
.black,
//Colors.black,
fontWeight:
FontWeight
.bold,
FontWeight
.bold,
),
),
),
)),
),
onTap: () {}),
onTap: () {
setState(() {
examination.isAbnormal =
!examination.isAbnormal;
examination.isNormal =
!examination.isNormal;
});
}),
],
),
InkWell(
@ -267,9 +303,11 @@ class _ObjectivePageState extends State<ObjectivePage> {
),
DividerWithSpacesAround(height: 30,),
AppButton(
title: TranslationBase.of(context).next,
onPressed: () {
widget.changePageViewIndex(2);
title: TranslationBase
.of(context)
.next,
onPressed: () async {
await submitObjectivePage(model);
},
),
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) {

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

Loading…
Cancel
Save