diff --git a/lib/core/service/SOAP_service.dart b/lib/core/service/SOAP_service.dart index 9679293b..a7cc33ce 100644 --- a/lib/core/service/SOAP_service.dart +++ b/lib/core/service/SOAP_service.dart @@ -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 patientChiefComplaintList = []; List patientAllergiesList = []; List patientHistoryList = []; + List 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( diff --git a/lib/core/viewModel/SOAP_view_model.dart b/lib/core/viewModel/SOAP_view_model.dart index 8a3b787e..849d2333 100644 --- a/lib/core/viewModel/SOAP_view_model.dart +++ b/lib/core/viewModel/SOAP_view_model.dart @@ -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 get listOfICD10 => _SOAPService.listOfICD10; - List get chiefComplaintList => + List get patientChiefComplaintList => _SOAPService.patientChiefComplaintList; List get patientAllergiesList => _SOAPService.patientAllergiesList; List get patientHistoryList => _SOAPService.patientHistoryList; + List 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); diff --git a/lib/models/SOAP/ChiefComplaint/GetChiefComplaintReqModel.dart b/lib/models/SOAP/ChiefComplaint/GetChiefComplaintReqModel.dart new file mode 100644 index 00000000..68ab6c40 --- /dev/null +++ b/lib/models/SOAP/ChiefComplaint/GetChiefComplaintReqModel.dart @@ -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 json) { + patientMRN = json['PatientMRN']; + appointmentNo = json['AppointmentNo']; + episodeId = json['EpisodeId']; + episodeID = json['EpisodeID']; + } + + Map toJson() { + final Map data = new Map(); + data['PatientMRN'] = this.patientMRN; + data['AppointmentNo'] = this.appointmentNo; + data['EpisodeId'] = this.episodeId; + data['EpisodeID'] = this.episodeID; + return data; + } +} diff --git a/lib/models/SOAP/GetPhysicalExamListResModel.dart b/lib/models/SOAP/GetPhysicalExamListResModel.dart new file mode 100644 index 00000000..f9b2f44f --- /dev/null +++ b/lib/models/SOAP/GetPhysicalExamListResModel.dart @@ -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 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 toJson() { + final Map data = new Map(); + 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; + } +} diff --git a/lib/models/SOAP/GetPhysicalExamReqModel.dart b/lib/models/SOAP/GetPhysicalExamReqModel.dart new file mode 100644 index 00000000..ce045c22 --- /dev/null +++ b/lib/models/SOAP/GetPhysicalExamReqModel.dart @@ -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 json) { + patientMRN = json['PatientMRN']; + appointmentNo = json['AppointmentNo']; + episodeID = json['EpisodeID']; + from = json['From']; + to = json['To']; + } + + Map toJson() { + final Map data = new Map(); + data['PatientMRN'] = this.patientMRN; + data['AppointmentNo'] = this.appointmentNo; + data['EpisodeID'] = this.episodeID; + data['From'] = this.from; + data['To'] = this.to; + return data; + } +} diff --git a/lib/widgets/patients/profile/soap_update/subjective/update_subjective_page.dart b/lib/widgets/patients/profile/soap_update/subjective/update_subjective_page.dart index 33a691cb..cbdc12b0 100644 --- a/lib/widgets/patients/profile/soap_update/subjective/update_subjective_page.dart +++ b/lib/widgets/patients/profile/soap_update/subjective/update_subjective_page.dart @@ -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 { 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 { 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); + } } } diff --git a/lib/widgets/patients/profile/soap_update/update_objective_page.dart b/lib/widgets/patients/profile/soap_update/update_objective_page.dart index a073c578..d7123678 100644 --- a/lib/widgets/patients/profile/soap_update/update_objective_page.dart +++ b/lib/widgets/patients/profile/soap_update/update_objective_page.dart @@ -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 { final screenSize = MediaQuery.of(context).size; return BaseView( - // 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;