Finish Update objective code Page

pull/209/head
Elham Rababah 5 years ago
parent c92a848851
commit 46043efb42

@ -4,6 +4,8 @@ import 'package:doctor_app_flutter/models/SOAP/GeneralGetReqForSOAP.dart';
import 'package:doctor_app_flutter/models/SOAP/GetAllergiesResModel.dart';
import 'package:doctor_app_flutter/models/SOAP/GetHistoryReqModel.dart';
import 'package:doctor_app_flutter/models/SOAP/GetHistoryResModel.dart';
import 'package:doctor_app_flutter/models/SOAP/GetPhysicalExamListResModel.dart';
import 'package:doctor_app_flutter/models/SOAP/GetPhysicalExamReqModel.dart';
import 'package:doctor_app_flutter/models/SOAP/get_Allergies_request_model.dart';
import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart';
import 'package:doctor_app_flutter/models/SOAP/post_allergy_request_model.dart';
@ -20,6 +22,7 @@ class SOAPService extends LookupService {
List<GetChiefComplaintResModel> patientChiefComplaintList = [];
List<GetAllergiesResModel> patientAllergiesList = [];
List<GetHistoryResModel> patientHistoryList = [];
List<GetPhysicalExamResModel> patientPhysicalExamList = [];
Future getAllergies(GetAllergiesRequestModel getAllergiesRequestModel) async {
await baseAppClient.post(
@ -234,15 +237,18 @@ class SOAPService extends LookupService {
}
Future getPatientPhysicalExam(
PostPhysicalExamRequestModel getPatientPhysicalExamRequestModel) async {
GetPhysicalExamReqModel getPhysicalExamReqModel) async {
hasError = false;
await baseAppClient.post (GET_PHYSICAL_EXAM,
onSuccess: (dynamic response, int statusCode) {
print("Success");
patientPhysicalExamList.clear();
response['PhysicalExamList']['entityList'].forEach((v) {
patientPhysicalExamList.add(GetPhysicalExamResModel.fromJson(v));
});
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: getPatientPhysicalExamRequestModel.toJson());
}, body: getPhysicalExamReqModel.toJson());
}
Future getPatientProgressNote(

@ -6,6 +6,8 @@ import 'package:doctor_app_flutter/models/SOAP/GeneralGetReqForSOAP.dart';
import 'package:doctor_app_flutter/models/SOAP/GetAllergiesResModel.dart';
import 'package:doctor_app_flutter/models/SOAP/GetHistoryReqModel.dart';
import 'package:doctor_app_flutter/models/SOAP/GetHistoryResModel.dart';
import 'package:doctor_app_flutter/models/SOAP/GetPhysicalExamListResModel.dart';
import 'package:doctor_app_flutter/models/SOAP/GetPhysicalExamReqModel.dart';
import 'package:doctor_app_flutter/models/SOAP/get_Allergies_request_model.dart';
import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart';
import 'package:doctor_app_flutter/models/SOAP/post_allergy_request_model.dart';
@ -54,13 +56,15 @@ class SOAPViewModel extends BaseViewModel {
List<MasterKeyModel> get listOfICD10 => _SOAPService.listOfICD10;
List<GetChiefComplaintResModel> get chiefComplaintList =>
List<GetChiefComplaintResModel> get patientChiefComplaintList =>
_SOAPService.patientChiefComplaintList;
List<GetAllergiesResModel> get patientAllergiesList =>
_SOAPService.patientAllergiesList;
List<GetHistoryResModel> get patientHistoryList =>
_SOAPService.patientHistoryList;
List<GetPhysicalExamResModel> get patientPhysicalExamList =>
_SOAPService.patientPhysicalExamList;
Future getAllergies(GetAllergiesRequestModel getAllergiesRequestModel) async {
setState(ViewState.Busy);
@ -235,9 +239,9 @@ class SOAPViewModel extends BaseViewModel {
setState(ViewState.Idle);
}
Future getPatientPhysicalExam(PostPhysicalExamRequestModel getPatientPhysicalExamRequestModel) async {
Future getPatientPhysicalExam(GetPhysicalExamReqModel getPhysicalExamReqModel) async {
setState(ViewState.Busy);
await _SOAPService.getPatientPhysicalExam(getPatientPhysicalExamRequestModel);
await _SOAPService.getPatientPhysicalExam(getPhysicalExamReqModel);
if (_SOAPService.hasError) {
error = _SOAPService.error;
setState(ViewState.Busy);

@ -0,0 +1,25 @@
class GetChiefComplaintReqModel {
int patientMRN;
int appointmentNo;
int episodeId;
int episodeID;
GetChiefComplaintReqModel(
{this.patientMRN, this.appointmentNo, this.episodeId, this.episodeID});
GetChiefComplaintReqModel.fromJson(Map<String, dynamic> json) {
patientMRN = json['PatientMRN'];
appointmentNo = json['AppointmentNo'];
episodeId = json['EpisodeId'];
episodeID = json['EpisodeID'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['PatientMRN'] = this.patientMRN;
data['AppointmentNo'] = this.appointmentNo;
data['EpisodeId'] = this.episodeId;
data['EpisodeID'] = this.episodeID;
return data;
}
}

@ -0,0 +1,64 @@
class GetPhysicalExamResModel {
int appointmentNo;
int createdBy;
String createdOn;
int editedBy;
String editedOn;
int episodeId;
int examId;
int examType;
bool isAbnormal;
bool isNormal;
bool notExamined;
int patientMRN;
String remarks;
GetPhysicalExamResModel(
{this.appointmentNo,
this.createdBy,
this.createdOn,
this.editedBy,
this.editedOn,
this.episodeId,
this.examId,
this.examType,
this.isAbnormal,
this.isNormal,
this.notExamined,
this.patientMRN,
this.remarks});
GetPhysicalExamResModel.fromJson(Map<String, dynamic> json) {
appointmentNo = json['appointmentNo'];
createdBy = json['createdBy'];
createdOn = json['createdOn'];
editedBy = json['editedBy'];
editedOn = json['editedOn'];
episodeId = json['episodeId'];
examId = json['examId'];
examType = json['examType'];
isAbnormal = json['isAbnormal'];
isNormal = json['isNormal'];
notExamined = json['notExamined'];
patientMRN = json['patientMRN'];
remarks = json['remarks'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['appointmentNo'] = this.appointmentNo;
data['createdBy'] = this.createdBy;
data['createdOn'] = this.createdOn;
data['editedBy'] = this.editedBy;
data['editedOn'] = this.editedOn;
data['episodeId'] = this.episodeId;
data['examId'] = this.examId;
data['examType'] = this.examType;
data['isAbnormal'] = this.isAbnormal;
data['isNormal'] = this.isNormal;
data['notExamined'] = this.notExamined;
data['patientMRN'] = this.patientMRN;
data['remarks'] = this.remarks;
return data;
}
}

@ -0,0 +1,32 @@
class GetPhysicalExamReqModel {
int patientMRN;
int appointmentNo;
String episodeID;
String from;
String to;
GetPhysicalExamReqModel(
{this.patientMRN,
this.appointmentNo,
this.episodeID,
this.from,
this.to});
GetPhysicalExamReqModel.fromJson(Map<String, dynamic> json) {
patientMRN = json['PatientMRN'];
appointmentNo = json['AppointmentNo'];
episodeID = json['EpisodeID'];
from = json['From'];
to = json['To'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['PatientMRN'] = this.patientMRN;
data['AppointmentNo'] = this.appointmentNo;
data['EpisodeID'] = this.episodeID;
data['From'] = this.from;
data['To'] = this.to;
return data;
}
}

@ -3,6 +3,7 @@ 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/ChiefComplaint/GetChiefComplaintReqModel.dart';
import 'package:doctor_app_flutter/models/SOAP/GeneralGetReqForSOAP.dart';
import 'package:doctor_app_flutter/models/SOAP/GetHistoryReqModel.dart';
import 'package:doctor_app_flutter/models/SOAP/master_key_model.dart';
@ -117,12 +118,12 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
patientMRN: widget.patientInfo.patientMRN,
episodeId: widget.patientInfo.episodeNo,
appointmentNo: widget.patientInfo.appointmentNo);
GetChiefComplaintReqModel getChiefComplaintReqModel = GetChiefComplaintReqModel();
await model.getPatientChiefComplaint(generalGetReqForSOAP);
if (model.chiefComplaintList.isNotEmpty) {
if (model.patientChiefComplaintList.isNotEmpty) {
complaintsController.text =
model.chiefComplaintList[0].chiefComplaint;
illnessController.text = model.chiefComplaintList[0].hopi;
model.patientChiefComplaintList[0].chiefComplaint;
illnessController.text = model.patientChiefComplaintList[0].hopi;
}
await model.getPatientAllergy(generalGetReqForSOAP);
if (model.patientAllergiesList.isNotEmpty) {
@ -499,19 +500,22 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
if(formKey.currentState.validate()){
PostChiefComplaintRequestModel postChiefComplaintRequestModel =
//TODO: make static value dynamic
new PostChiefComplaintRequestModel(
patientMRN: widget.patientInfo.patientMRN,
episodeID: widget.patientInfo.episodeNo,
appointmentNo: widget.patientInfo.appointmentNo,
chiefComplaint: complaintsController.text,
currentMedication: " currentMedication ",
hopi: illnessController.text,
isLactation: false,
ispregnant: false,
numberOfWeeks: 22);
await model.patchChiefComplaint(postChiefComplaintRequestModel);
new PostChiefComplaintRequestModel(
patientMRN: widget.patientInfo.patientMRN,
episodeID: widget.patientInfo.episodeNo,
appointmentNo: widget.patientInfo.appointmentNo,
chiefComplaint: complaintsController.text,
currentMedication: " currentMedication ",
hopi: illnessController.text,
isLactation: false,
ispregnant: true,
numberOfWeeks: 22);
if (model.patientChiefComplaintList.isEmpty) {
// TODO: make it postChiefComplaint after it start to work
await model.postChiefComplaint(postChiefComplaintRequestModel);
} else {
await model.patchChiefComplaint(postChiefComplaintRequestModel);
}
}
}

@ -3,6 +3,7 @@ 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/GetPhysicalExamReqModel.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';
@ -53,40 +54,67 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage> {
final screenSize = MediaQuery.of(context).size;
return BaseView<SOAPViewModel>(
// onModelReady: (model) => model.getMasterLookup(MasterKeysService.Allergies),
onModelReady: (model) async {
GetPhysicalExamReqModel getPhysicalExamReqModel =
GetPhysicalExamReqModel(
patientMRN: widget.patientInfo.patientMRN,
episodeID: widget.patientInfo.episodeNo.toString(),
appointmentNo: widget.patientInfo.appointmentNo);
await model.getPatientPhysicalExam(getPhysicalExamReqModel);
if (model.patientPhysicalExamList.isNotEmpty) {
if (model.physicalExaminationList.length == 0) {
await model
.getMasterLookup(MasterKeysService.PhysicalExamination);
}
model.patientPhysicalExamList.forEach((element) {
MasterKeyModel examMaster = model.getOneMasterKey(
masterKeys: MasterKeysService.PhysicalExamination,
id: element.examId,
);
MySelectedExamination tempEam = MySelectedExamination(
selectedExamination: examMaster,
remark: element.remarks,
isNormal: element.isNormal,
isAbnormal: element.isAbnormal);
widget.mySelectedExamination.add(tempEam);
});
}
},
builder: (_, model, w) => AppScaffold(
isShowAppBar: false,
body: SingleChildScrollView(
physics: ScrollPhysics(),
child: Center(
child: FractionallySizedBox(
widthFactor: 0.9,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
SizedBox(
height: 30,
),
HeaderBodyExpandableNotifier(
headerWidget: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
isShowAppBar: false,
body: SingleChildScrollView(
physics: ScrollPhysics(),
child: Center(
child: FractionallySizedBox(
widthFactor: 0.9,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
SizedBox(
height: 30,
),
HeaderBodyExpandableNotifier(
headerWidget: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Texts('Physical/System Examination',
variant:
isSysExaminationExpand ? "bodyText" : '',
bold: isSysExaminationExpand ? true : false,
color: Colors.black),
Icon(
FontAwesomeIcons.asterisk,
color: AppGlobal.appPrimaryColor,
size: 12,
)
],
),
InkWell(
onTap: () {
Row(
children: [
Texts('Physical/System Examination',
variant: isSysExaminationExpand
? "bodyText"
: '',
bold: isSysExaminationExpand ? true : false,
color: Colors.black),
Icon(
FontAwesomeIcons.asterisk,
color: AppGlobal.appPrimaryColor,
size: 12,
)
],
),
InkWell(
onTap: () {
setState(() {
isSysExaminationExpand =
!isSysExaminationExpand;

Loading…
Cancel
Save