improve code inside my eam

pull/197/head
Elham Rababah 5 years ago
parent e96d38454c
commit 4560706d55

@ -79,11 +79,12 @@ class BaseAppClient {
onFailure('Error While Fetching data', statusCode);
} else {
var parsed = json.decode(response.body.toString());
// if (!parsed['IsAuthenticated']) {
// await helpers.logout();
//
// helpers.showErrorToast('Your session expired Please login agian');
// } else
if (!parsed['IsAuthenticated']) {
// TODO: return it back when IsAuthenticated work fine in all service
// await helpers.logout();
helpers.showErrorToast('Your session expired Please login agian');
} else
if (parsed['MessageStatus'] == 1) {
onSuccess(parsed, statusCode);
} else {

@ -0,0 +1,33 @@
import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart';
class MySelectedExamination {
MasterKeyModel selectedExamination;
String remark;
bool isNormal;
bool isAbnormal;
MySelectedExamination(
{this.selectedExamination, this.remark, this.isNormal = true, this.isAbnormal = false});
MySelectedExamination.fromJson(Map<String, dynamic> json) {
selectedExamination = json['selectedExamination'] != null
? new MasterKeyModel.fromJson(json['selectedExamination'])
: null;
remark = json['remark'];
remark = json['isNormal'];
remark = json['isAbnormal'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
if (this.selectedExamination != null) {
data['selectedExamination'] = this.selectedExamination.toJson();
}
data['remark'] = this.remark;
data['isNormal'] = this.isNormal;
data['isAbnormal'] = this.isAbnormal;
return data;
}
}

@ -0,0 +1,99 @@
import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart';
class PostPhysicalExamRequestModel {
List<ListHisProgNotePhysicalVM> listHisProgNotePhysicalVM;
PostPhysicalExamRequestModel({this.listHisProgNotePhysicalVM});
PostPhysicalExamRequestModel.fromJson(Map<String, dynamic> json) {
if (json['listHisProgNotePhysicalVM'] != null) {
listHisProgNotePhysicalVM = new List<ListHisProgNotePhysicalVM>();
json['listHisProgNotePhysicalVM'].forEach((v) {
listHisProgNotePhysicalVM
.add(new ListHisProgNotePhysicalVM.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
if (this.listHisProgNotePhysicalVM != null) {
data['listHisProgNotePhysicalVM'] =
this.listHisProgNotePhysicalVM.map((v) => v.toJson()).toList();
}
return data;
}
}
class ListHisProgNotePhysicalVM {
int episodeId;
int appointmentNo;
int examType;
int examId;
int patientMRN;
bool isNormal;
bool isAbnormal;
String remarks;
int createdBy;
String createdOn;
int editedBy;
String editedOn;
bool notExamined;
MasterKeyModel masterDescription;
ListHisProgNotePhysicalVM(
{this.episodeId,
this.appointmentNo,
this.examType,
this.examId,
this.patientMRN,
this.isNormal,
this.isAbnormal,
this.remarks,
this.createdBy,
this.createdOn,
this.editedBy,
this.editedOn,
this.notExamined,
this.masterDescription});
ListHisProgNotePhysicalVM.fromJson(Map<String, dynamic> json) {
episodeId = json['episodeId'];
appointmentNo = json['appointmentNo'];
examType = json['examType'];
examId = json['examId'];
patientMRN = json['patientMRN'];
isNormal = json['isNormal'];
isAbnormal = json['isAbnormal'];
remarks = json['remarks'];
createdBy = json['createdBy'];
createdOn = json['createdOn'];
editedBy = json['editedBy'];
editedOn = json['editedOn'];
notExamined = json['notExamined'];
masterDescription = json['masterDescription'] != null
? new MasterKeyModel.fromJson(json['masterDescription'])
: null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['episodeId'] = this.episodeId;
data['appointmentNo'] = this.appointmentNo;
data['examType'] = this.examType;
data['examId'] = this.examId;
data['patientMRN'] = this.patientMRN;
data['isNormal'] = this.isNormal;
data['isAbnormal'] = this.isAbnormal;
data['remarks'] = this.remarks;
data['createdBy'] = this.createdBy;
data['createdOn'] = this.createdOn;
data['editedBy'] = this.editedBy;
data['editedOn'] = this.editedOn;
data['notExamined'] = this.notExamined;
if (this.masterDescription != null) {
data['masterDescription'] = this.masterDescription.toJson();
}
return data;
}
}

@ -2,6 +2,7 @@ import 'package:doctor_app_flutter/core/viewModel/doctor_replay_view_model.dart'
import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart';
import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart';
import 'package:doctor_app_flutter/models/SOAP/my_selected_allergy.dart';
import 'package:doctor_app_flutter/models/SOAP/my_selected_examination.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
@ -30,7 +31,7 @@ class _AddSOAPIndexState extends State<AddSOAPIndex>
int _currentIndex = 0;
List<MySelectedAllergy> myAllergiesList= List();
List<MasterKeyModel> myHistoryList = List();
List<MasterKeyModel> myExaminationList = List();
List<MySelectedExamination> mySelectedExamination = List();
changePageViewIndex(pageIndex) {
_controller.jumpToPage(pageIndex);
}
@ -154,7 +155,7 @@ class _AddSOAPIndexState extends State<AddSOAPIndex>
scrollDirection: Axis.horizontal,
children: <Widget>[
SubjectivePage(changePageViewIndex: changePageViewIndex,myAllergiesList: myAllergiesList,myHistoryList: myHistoryList,),
ObjectivePage(changePageViewIndex: changePageViewIndex,myExaminationList:myExaminationList),
ObjectivePage(changePageViewIndex: changePageViewIndex,mySelectedExamination:mySelectedExamination),
AssessmentPage(changePageViewIndex: changePageViewIndex,),
PlanPage(changePageViewIndex: changePageViewIndex,)
],

@ -3,6 +3,7 @@ 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/screens/base/base_view.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/shared/Text.dart';
@ -19,9 +20,10 @@ import 'package:font_awesome_flutter/font_awesome_flutter.dart';
class ObjectivePage extends StatefulWidget {
final Function changePageViewIndex;
final List<MasterKeyModel> myExaminationList;
final List<MySelectedExamination> mySelectedExamination;
ObjectivePage({Key key, this.changePageViewIndex, this.myExaminationList});
ObjectivePage(
{Key key, this.changePageViewIndex, this.mySelectedExamination});
@override
_ObjectivePageState createState() => _ObjectivePageState();
@ -29,7 +31,6 @@ class ObjectivePage extends StatefulWidget {
class _ObjectivePageState extends State<ObjectivePage> {
bool isSysExaminationExpand = false;
List<dynamic> examinationsList;
TextEditingController remarksController = TextEditingController();
BoxDecoration containerBorderDecoration(
@ -124,7 +125,8 @@ class _ObjectivePageState extends State<ObjectivePage> {
height: 20,
),
Column(
children: widget.myExaminationList.map((examination) {
children:
widget.mySelectedExamination.map((examination) {
return Container(
margin: EdgeInsets.only(
left: 15, right: 15, top: 15),
@ -133,7 +135,10 @@ class _ObjectivePageState extends State<ObjectivePage> {
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Texts(examination.nameEn.toUpperCase(),
Texts(
examination
.selectedExamination.nameEn
.toUpperCase(),
variant: "bodyText",
bold: true,
color: Colors.black)
@ -216,13 +221,14 @@ class _ObjectivePageState extends State<ObjectivePage> {
],
),
InkWell(
child: Icon(
FontAwesomeIcons.trash,
color: Colors.grey,
size: 20,
),
onTap: ()=>removeExamination(examination),
onTap: () => removeExamination(
examination.selectedExamination),
)
],
),
@ -277,13 +283,15 @@ class _ObjectivePageState extends State<ObjectivePage> {
}
removeExamination(MasterKeyModel masterKey) {
Iterable<MasterKeyModel> history = widget.myExaminationList.where(
Iterable<MySelectedExamination> history = widget.mySelectedExamination
.where(
(element) =>
masterKey.id == element.id && masterKey.typeId == element.typeId);
masterKey.id == element.selectedExamination.id &&
masterKey.typeId == element.selectedExamination.typeId);
if (history.length > 0)
setState(() {
widget.myExaminationList.remove(history.first);
widget.mySelectedExamination.remove(history.first);
});
}
@ -321,7 +329,7 @@ class _ObjectivePageState extends State<ObjectivePage> {
context: context,
builder: (context) {
return AddExaminationDailog(
myExaminationList: widget.myExaminationList,
mySelectedExamination: widget.mySelectedExamination,
addSelectedExamination: () {
setState(() {
Navigator.of(context).pop();
@ -333,12 +341,12 @@ class _ObjectivePageState extends State<ObjectivePage> {
}
class AddExaminationDailog extends StatefulWidget {
final List<MasterKeyModel> myExaminationList;
final List<MySelectedExamination> mySelectedExamination;
final Function addSelectedExamination;
final Function (MasterKeyModel) removeExamination;
const AddExaminationDailog(
{Key key, this.myExaminationList, this.addSelectedExamination, this.removeExamination})
{Key key, this.mySelectedExamination, this.addSelectedExamination, this.removeExamination})
: super(key: key);
@override
@ -422,10 +430,13 @@ class _AddExaminationDailogState extends State<AddExaminationDailog> {
);
}
else {
MySelectedExamination mySelectedExamination = new MySelectedExamination(
selectedExamination: examinationInfo
);
widget
.myExaminationList
.mySelectedExamination
.add(
examinationInfo);
mySelectedExamination);
}
});
}),
@ -475,12 +486,13 @@ class _AddExaminationDailogState extends State<AddExaminationDailog> {
}
isServiceSelected(MasterKeyModel masterKey) {
Iterable<MasterKeyModel> history =
Iterable<MySelectedExamination> exam =
widget
.myExaminationList
.mySelectedExamination
.where((element) =>
masterKey.id == element.id && masterKey.typeId == element.typeId);
if (history.length > 0) {
masterKey.id == element.selectedExamination.id &&
masterKey.typeId == element.selectedExamination.typeId);
if (exam.length > 0) {
return true;
}
return false;

Loading…
Cancel
Save