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/GetAllergiesResModel.dart';
import 'package:doctor_app_flutter/models/SOAP/GetHistoryReqModel.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/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/get_Allergies_request_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/post_allergy_request_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<GetChiefComplaintResModel> patientChiefComplaintList = [];
List<GetAllergiesResModel> patientAllergiesList = []; List<GetAllergiesResModel> patientAllergiesList = [];
List<GetHistoryResModel> patientHistoryList = []; List<GetHistoryResModel> patientHistoryList = [];
List<GetPhysicalExamResModel> patientPhysicalExamList = [];
Future getAllergies(GetAllergiesRequestModel getAllergiesRequestModel) async { Future getAllergies(GetAllergiesRequestModel getAllergiesRequestModel) async {
await baseAppClient.post( await baseAppClient.post(
@ -234,15 +237,18 @@ class SOAPService extends LookupService {
} }
Future getPatientPhysicalExam( Future getPatientPhysicalExam(
PostPhysicalExamRequestModel getPatientPhysicalExamRequestModel) async { GetPhysicalExamReqModel getPhysicalExamReqModel) async {
hasError = false; hasError = false;
await baseAppClient.post (GET_PHYSICAL_EXAM, await baseAppClient.post (GET_PHYSICAL_EXAM,
onSuccess: (dynamic response, int statusCode) { onSuccess: (dynamic response, int statusCode) {
print("Success"); patientPhysicalExamList.clear();
response['PhysicalExamList']['entityList'].forEach((v) {
patientPhysicalExamList.add(GetPhysicalExamResModel.fromJson(v));
});
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
hasError = true; hasError = true;
super.error = error; super.error = error;
}, body: getPatientPhysicalExamRequestModel.toJson()); }, body: getPhysicalExamReqModel.toJson());
} }
Future getPatientProgressNote( 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/GetAllergiesResModel.dart';
import 'package:doctor_app_flutter/models/SOAP/GetHistoryReqModel.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/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/get_Allergies_request_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/post_allergy_request_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<MasterKeyModel> get listOfICD10 => _SOAPService.listOfICD10;
List<GetChiefComplaintResModel> get chiefComplaintList => List<GetChiefComplaintResModel> get patientChiefComplaintList =>
_SOAPService.patientChiefComplaintList; _SOAPService.patientChiefComplaintList;
List<GetAllergiesResModel> get patientAllergiesList => List<GetAllergiesResModel> get patientAllergiesList =>
_SOAPService.patientAllergiesList; _SOAPService.patientAllergiesList;
List<GetHistoryResModel> get patientHistoryList => List<GetHistoryResModel> get patientHistoryList =>
_SOAPService.patientHistoryList; _SOAPService.patientHistoryList;
List<GetPhysicalExamResModel> get patientPhysicalExamList =>
_SOAPService.patientPhysicalExamList;
Future getAllergies(GetAllergiesRequestModel getAllergiesRequestModel) async { Future getAllergies(GetAllergiesRequestModel getAllergiesRequestModel) async {
setState(ViewState.Busy); setState(ViewState.Busy);
@ -235,9 +239,9 @@ class SOAPViewModel extends BaseViewModel {
setState(ViewState.Idle); setState(ViewState.Idle);
} }
Future getPatientPhysicalExam(PostPhysicalExamRequestModel getPatientPhysicalExamRequestModel) async { Future getPatientPhysicalExam(GetPhysicalExamReqModel getPhysicalExamReqModel) async {
setState(ViewState.Busy); setState(ViewState.Busy);
await _SOAPService.getPatientPhysicalExam(getPatientPhysicalExamRequestModel); await _SOAPService.getPatientPhysicalExam(getPhysicalExamReqModel);
if (_SOAPService.hasError) { if (_SOAPService.hasError) {
error = _SOAPService.error; error = _SOAPService.error;
setState(ViewState.Busy); 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/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/ChiefComplaint/GetChiefComplaintReqModel.dart';
import 'package:doctor_app_flutter/models/SOAP/GeneralGetReqForSOAP.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/GetHistoryReqModel.dart';
import 'package:doctor_app_flutter/models/SOAP/master_key_model.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, patientMRN: widget.patientInfo.patientMRN,
episodeId: widget.patientInfo.episodeNo, episodeId: widget.patientInfo.episodeNo,
appointmentNo: widget.patientInfo.appointmentNo); appointmentNo: widget.patientInfo.appointmentNo);
GetChiefComplaintReqModel getChiefComplaintReqModel = GetChiefComplaintReqModel();
await model.getPatientChiefComplaint(generalGetReqForSOAP); await model.getPatientChiefComplaint(generalGetReqForSOAP);
if (model.chiefComplaintList.isNotEmpty) { if (model.patientChiefComplaintList.isNotEmpty) {
complaintsController.text = complaintsController.text =
model.chiefComplaintList[0].chiefComplaint; model.patientChiefComplaintList[0].chiefComplaint;
illnessController.text = model.chiefComplaintList[0].hopi; illnessController.text = model.patientChiefComplaintList[0].hopi;
} }
await model.getPatientAllergy(generalGetReqForSOAP); await model.getPatientAllergy(generalGetReqForSOAP);
if (model.patientAllergiesList.isNotEmpty) { if (model.patientAllergiesList.isNotEmpty) {
@ -499,19 +500,22 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
if(formKey.currentState.validate()){ if(formKey.currentState.validate()){
PostChiefComplaintRequestModel postChiefComplaintRequestModel = PostChiefComplaintRequestModel postChiefComplaintRequestModel =
//TODO: make static value dynamic //TODO: make static value dynamic
new PostChiefComplaintRequestModel( new PostChiefComplaintRequestModel(
patientMRN: widget.patientInfo.patientMRN, patientMRN: widget.patientInfo.patientMRN,
episodeID: widget.patientInfo.episodeNo, episodeID: widget.patientInfo.episodeNo,
appointmentNo: widget.patientInfo.appointmentNo, appointmentNo: widget.patientInfo.appointmentNo,
chiefComplaint: complaintsController.text, chiefComplaint: complaintsController.text,
currentMedication: " currentMedication ", currentMedication: " currentMedication ",
hopi: illnessController.text, hopi: illnessController.text,
isLactation: false, isLactation: false,
ispregnant: false, ispregnant: true,
numberOfWeeks: 22); numberOfWeeks: 22);
if (model.patientChiefComplaintList.isEmpty) {
await model.patchChiefComplaint(postChiefComplaintRequestModel); // 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/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/GetPhysicalExamReqModel.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/models/SOAP/post_physical_exam_request_model.dart';
@ -53,40 +54,67 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage> {
final screenSize = MediaQuery.of(context).size; final screenSize = MediaQuery.of(context).size;
return BaseView<SOAPViewModel>( 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( builder: (_, model, w) => AppScaffold(
isShowAppBar: false, isShowAppBar: false,
body: SingleChildScrollView( body: SingleChildScrollView(
physics: ScrollPhysics(), physics: ScrollPhysics(),
child: Center( child: Center(
child: FractionallySizedBox( child: FractionallySizedBox(
widthFactor: 0.9, widthFactor: 0.9,
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
SizedBox( SizedBox(
height: 30, height: 30,
), ),
HeaderBodyExpandableNotifier( HeaderBodyExpandableNotifier(
headerWidget: Row( headerWidget: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [ children: [
Texts('Physical/System Examination', Row(
variant: children: [
isSysExaminationExpand ? "bodyText" : '', Texts('Physical/System Examination',
bold: isSysExaminationExpand ? true : false, variant: isSysExaminationExpand
color: Colors.black), ? "bodyText"
Icon( : '',
FontAwesomeIcons.asterisk, bold: isSysExaminationExpand ? true : false,
color: AppGlobal.appPrimaryColor, color: Colors.black),
size: 12, Icon(
) FontAwesomeIcons.asterisk,
], color: AppGlobal.appPrimaryColor,
), size: 12,
InkWell( )
onTap: () { ],
),
InkWell(
onTap: () {
setState(() { setState(() {
isSysExaminationExpand = isSysExaminationExpand =
!isSysExaminationExpand; !isSysExaminationExpand;

Loading…
Cancel
Save