diff --git a/lib/config/config.dart b/lib/config/config.dart index 6b209e4e..1f51c81c 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -5,8 +5,8 @@ const ONLY_NUMBERS = "[0-9]"; const ONLY_LETTERS = "[a-zA-Z &'\"]"; const ONLY_DATE = "[0-9/]"; const BASE_URL_LIVE_CARE = 'https://livecare.hmg.com/'; -const BASE_URL = 'https://hmgwebservices.com/'; -// const BASE_URL = 'https://uat.hmgwebservices.com/'; +// const BASE_URL = 'https://hmgwebservices.com/'; +const BASE_URL = 'https://uat.hmgwebservices.com/'; const PHARMACY_ITEMS_URL = "Services/Lists.svc/REST/GetPharmcyItems_Region_enh"; const PHARMACY_LIST_URL = "Services/Patients.svc/REST/GetPharmcyList"; const PATIENT_PROGRESS_NOTE_URL = "Services/DoctorApplication.svc/REST/GetProgressNoteForInPatient"; diff --git a/lib/models/SOAP/my_selected_allergy.dart b/lib/models/SOAP/my_selected_allergy.dart index c4e52af7..66234db3 100644 --- a/lib/models/SOAP/my_selected_allergy.dart +++ b/lib/models/SOAP/my_selected_allergy.dart @@ -6,6 +6,7 @@ class MySelectedAllergy { String remark; bool isChecked; bool isExpanded; + bool isLocal; int createdBy; MySelectedAllergy( @@ -13,7 +14,8 @@ class MySelectedAllergy { this.selectedAllergy, this.remark, this.isChecked, - this.isExpanded = true, + this.isExpanded = true, + this.isLocal = true, this.createdBy}); MySelectedAllergy.fromJson(Map json) { @@ -26,6 +28,7 @@ class MySelectedAllergy { remark = json['remark']; isChecked = json['isChecked']; isExpanded = json['isExpanded']; + isLocal = json['isLocal']; createdBy = json['createdBy']; } @@ -41,6 +44,7 @@ class MySelectedAllergy { data['isChecked'] = this.isChecked; data['isExpanded'] = this.isExpanded; data['createdBy'] = this.createdBy; + data['isLocal'] = this.isLocal; return data; } } diff --git a/lib/models/SOAP/my_selected_examination.dart b/lib/models/SOAP/my_selected_examination.dart index 393af944..c791b7cb 100644 --- a/lib/models/SOAP/my_selected_examination.dart +++ b/lib/models/SOAP/my_selected_examination.dart @@ -8,6 +8,8 @@ class MySelectedExamination { bool notExamined; bool isNew; int createdBy; + String createdOn; + String editedOn; MySelectedExamination( {this.selectedExamination, @@ -16,7 +18,9 @@ class MySelectedExamination { this.isAbnormal = false, this.notExamined = true, this.isNew = true, - this.createdBy}); + this.createdBy, this.createdOn, + + this.editedOn,}); MySelectedExamination.fromJson(Map json) { selectedExamination = json['selectedExamination'] != null @@ -28,6 +32,8 @@ class MySelectedExamination { notExamined = json['notExamined']; isNew = json['isNew']; createdBy = json['createdBy']; + createdOn = json['createdOn']; + editedOn = json['editedOn']; } Map toJson() { @@ -42,6 +48,9 @@ class MySelectedExamination { data['notExamined'] = this.notExamined; data['isNew'] = this.isNew; data['createdBy'] = this.createdBy; + data['createdOn'] = this.createdOn; + data['editedOn'] = this.editedOn; + return data; } } diff --git a/lib/models/SOAP/my_selected_history.dart b/lib/models/SOAP/my_selected_history.dart index 11e366c2..91f66910 100644 --- a/lib/models/SOAP/my_selected_history.dart +++ b/lib/models/SOAP/my_selected_history.dart @@ -4,9 +4,10 @@ class MySelectedHistory { MasterKeyModel selectedHistory; String remark; bool isChecked; + bool isLocal; MySelectedHistory( - { this.selectedHistory, this.remark, this.isChecked}); + { this.selectedHistory, this.remark, this.isChecked, this.isLocal = true}); MySelectedHistory.fromJson(Map json) { @@ -15,6 +16,7 @@ class MySelectedHistory { : null; remark = json['remark']; remark = json['isChecked']; + isLocal = json['isLocal']; } Map toJson() { @@ -25,6 +27,7 @@ class MySelectedHistory { } data['remark'] = this.remark; data['isChecked'] = this.remark; + data['isLocal'] = this.isLocal; return data; } } diff --git a/lib/screens/patients/profile/soap_update/assessment/update_assessment_page.dart b/lib/screens/patients/profile/soap_update/assessment/update_assessment_page.dart index fab69c44..a2177eb7 100644 --- a/lib/screens/patients/profile/soap_update/assessment/update_assessment_page.dart +++ b/lib/screens/patients/profile/soap_update/assessment/update_assessment_page.dart @@ -55,7 +55,7 @@ class _UpdateAssessmentPageState extends State { episodeID: widget.patientInfo.episodeNo.toString(), editedBy: '', doctorID: '', - appointmentNo: int.parse(widget.patientInfo.appointmentNo)); + appointmentNo: int.parse(widget.patientInfo.appointmentNo.toString())); await model.getPatientAssessment(getAssessmentReqModel); if (model.patientAssessmentList.isNotEmpty) { if (model.listOfDiagnosisCondition.length == 0) { diff --git a/lib/screens/patients/profile/soap_update/objective/update_objective_page.dart b/lib/screens/patients/profile/soap_update/objective/update_objective_page.dart index 4d36f49f..12004934 100644 --- a/lib/screens/patients/profile/soap_update/objective/update_objective_page.dart +++ b/lib/screens/patients/profile/soap_update/objective/update_objective_page.dart @@ -83,9 +83,11 @@ class _UpdateObjectivePageState extends State { remark: element.remarks, isNormal: element.isNormal, createdBy: element.createdBy, + createdOn:element.createdOn , + editedOn: element.editedOn, notExamined: element.notExamined, isNew: element.isNew, - isAbnormal: element.isAbnormal); + isAbnormal: element.isAbnormal,); widget.mySelectedExamination.add(tempEam); }); } @@ -213,7 +215,8 @@ class _UpdateObjectivePageState extends State { appointmentNo: widget.patientInfo.appointmentNo, remarks: exam.remark ?? '', createdBy: exam.createdBy ?? doctorProfile.doctorID, - createdOn: DateTime.now().toIso8601String(), + createdOn: exam.createdOn?? + DateTime.now().toIso8601String(), editedBy: doctorProfile.doctorID, editedOn: DateTime.now().toIso8601String(), examId: exam.selectedExamination.id, @@ -276,21 +279,6 @@ class _UpdateObjectivePageState extends State { removeExamination: (masterKey) => removeExamination(masterKey)), ), ); - /*showModalBottomSheet( - backgroundColor: Colors.white, - isScrollControlled: true, - context: context, - builder: (context) { - return AddExaminationDailog( - mySelectedExamination: widget.mySelectedExamination, - addSelectedExamination: () { - setState(() { - Navigator.of(context).pop(); - }); - }, - removeExamination: (masterKey) => removeExamination(masterKey), - ); - });*/ } } diff --git a/lib/screens/patients/profile/soap_update/plan/update_plan_page.dart b/lib/screens/patients/profile/soap_update/plan/update_plan_page.dart index 1960ef72..d9d61835 100644 --- a/lib/screens/patients/profile/soap_update/plan/update_plan_page.dart +++ b/lib/screens/patients/profile/soap_update/plan/update_plan_page.dart @@ -74,7 +74,7 @@ class _UpdatePlanPageState extends State { return BaseView( onModelReady: (model) async { GetGetProgressNoteReqModel getGetProgressNoteReqModel = GetGetProgressNoteReqModel( - appointmentNo: int.parse(widget.patientInfo.appointmentNo), + appointmentNo: int.parse(widget.patientInfo.appointmentNo.toString()), patientMRN: widget.patientInfo.patientMRN, episodeID: widget.patientInfo.episodeNo.toString(), editedBy: '', @@ -88,6 +88,8 @@ class _UpdatePlanPageState extends State { widget.patientProgressNote.createdOn = model.patientProgressNoteList[0].createdOn; widget.patientProgressNote.editedOn = model.patientProgressNoteList[0].editedOn; widget.patientProgressNote.editedByName = model.patientProgressNoteList[0].editedByName; + widget.patientProgressNote.appointmentNo = model.patientProgressNoteList[0].appointmentNo; + setState(() { isAddProgress = false; }); @@ -158,7 +160,7 @@ class _UpdatePlanPageState extends State { fontSize: 12, ), AppText( - widget.patientProgressNote.appointmentNo ?? '', + widget.patientProgressNote.appointmentNo.toString() ?? '', fontWeight: FontWeight.w600, ), ], diff --git a/lib/screens/patients/profile/soap_update/subjective/allergies/update_allergies_widget.dart b/lib/screens/patients/profile/soap_update/subjective/allergies/update_allergies_widget.dart index 6f7439e6..1083ed48 100644 --- a/lib/screens/patients/profile/soap_update/subjective/allergies/update_allergies_widget.dart +++ b/lib/screens/patients/profile/soap_update/subjective/allergies/update_allergies_widget.dart @@ -153,13 +153,15 @@ class _UpdateAllergiesWidgetState extends State { ).toList(); if (allergy.length > 0) { + if(allergy.first.isLocal) { + setState(() { + widget.myAllergiesList.remove(allergy.first); + }); + } setState(() { allergy[0].isChecked = false; }); } - - - print(allergy); } openAllergiesList(BuildContext context, Function changeParentState) { @@ -180,7 +182,8 @@ class _UpdateAllergiesWidgetState extends State { }); if (isAllDataFilled) { mySelectedAllergy.forEach((element) { - if (!widget.myAllergiesList.contains(element.selectedAllergySeverity.id)) { + if ((widget.myAllergiesList.singleWhere((it) => it.selectedAllergy.id == element.selectedAllergy.id, + orElse: () => null)) == null) { widget.myAllergiesList.add(element); } }); diff --git a/lib/screens/patients/profile/soap_update/subjective/history/update_history_widget.dart b/lib/screens/patients/profile/soap_update/subjective/history/update_history_widget.dart index f114702d..3b431a69 100644 --- a/lib/screens/patients/profile/soap_update/subjective/history/update_history_widget.dart +++ b/lib/screens/patients/profile/soap_update/subjective/history/update_history_widget.dart @@ -123,10 +123,19 @@ class _UpdateHistoryWidgetState extends State ).toList(); - if (history.length > 0) - setState(() { - history[0].isChecked = false; - }); + if (history.length > 0) { + if(history.first.isLocal) { + setState(() { + widget.myHistoryList.remove(history.first); + }); + } else { + setState(() { + history[0].isChecked = false; + }); + } + + } + } openHistoryList(BuildContext context) { diff --git a/lib/screens/patients/profile/soap_update/subjective/update_subjective_page.dart b/lib/screens/patients/profile/soap_update/subjective/update_subjective_page.dart index 1b6cd274..12db7266 100644 --- a/lib/screens/patients/profile/soap_update/subjective/update_subjective_page.dart +++ b/lib/screens/patients/profile/soap_update/subjective/update_subjective_page.dart @@ -30,16 +30,12 @@ import 'history/update_history_widget.dart'; class UpdateSubjectivePage extends StatefulWidget { final Function changePageViewIndex; final Function changeLoadingState; - final List myAllergiesList; - final List myHistoryList; final PatiantInformtion patientInfo; final int currentIndex; UpdateSubjectivePage( {Key key, this.changePageViewIndex, - this.myAllergiesList, - this.myHistoryList, this.patientInfo, this.changeLoadingState, this.currentIndex}); @@ -59,6 +55,8 @@ class _UpdateSubjectivePageState extends State { String medicationControllerError = ''; String illnessControllerError = ''; final formKey = GlobalKey(); + List myAllergiesList=List(); + List myHistoryList=List(); getHistory(SOAPViewModel model) async { widget.changeLoadingState(true); @@ -93,9 +91,9 @@ class _UpdateSubjectivePageState extends State { ); if (history != null) { MySelectedHistory mySelectedHistory = - MySelectedHistory(selectedHistory: history, isChecked: element.isChecked, remark: element.remarks); + MySelectedHistory(selectedHistory: history, isChecked: element.isChecked, remark: element.remarks,isLocal: false); - widget.myHistoryList.add(mySelectedHistory); + myHistoryList.add(mySelectedHistory); } } if (element.historyType == MasterKeysService.HistoryMedical.getMasterKeyService()) { @@ -105,9 +103,9 @@ class _UpdateSubjectivePageState extends State { ); if (history != null) { MySelectedHistory mySelectedHistory = - MySelectedHistory(selectedHistory: history, isChecked: element.isChecked, remark: element.remarks); + MySelectedHistory(selectedHistory: history, isChecked: element.isChecked, remark: element.remarks,isLocal: false); - widget.myHistoryList.add(mySelectedHistory); + myHistoryList.add(mySelectedHistory); } } if (element.historyType == MasterKeysService.HistorySports.getMasterKeyService()) { @@ -117,9 +115,9 @@ class _UpdateSubjectivePageState extends State { ); if (history != null) { MySelectedHistory mySelectedHistory = - MySelectedHistory(selectedHistory: history, isChecked: element.isChecked, remark: element.remarks); + MySelectedHistory(selectedHistory: history, isChecked: element.isChecked, remark: element.remarks,isLocal: false); - widget.myHistoryList.add(mySelectedHistory); + myHistoryList.add(mySelectedHistory); } } if (element.historyType == MasterKeysService.HistorySurgical.getMasterKeyService()) { @@ -129,9 +127,9 @@ class _UpdateSubjectivePageState extends State { ); if (history != null) { MySelectedHistory mySelectedHistory = - MySelectedHistory(selectedHistory: history, isChecked: element.isChecked, remark: element.remarks); + MySelectedHistory(selectedHistory: history, isChecked: element.isChecked, remark: element.remarks,isLocal: false); - widget.myHistoryList.add(mySelectedHistory); + myHistoryList.add(mySelectedHistory); } } }); @@ -169,8 +167,9 @@ class _UpdateSubjectivePageState extends State { isChecked: element.isChecked, createdBy: element.createdBy, remark: element.remarks, + isLocal : false, selectedAllergySeverity: selectedAllergySeverity); - if (selectedAllergy != null && selectedAllergySeverity != null) widget.myAllergiesList.add(mySelectedAllergy); + if (selectedAllergy != null && selectedAllergySeverity != null) myAllergiesList.add(mySelectedAllergy); }); } } @@ -179,8 +178,8 @@ class _UpdateSubjectivePageState extends State { Widget build(BuildContext context) { return BaseView( onModelReady: (model) async { - widget.myAllergiesList.clear(); - widget.myHistoryList.clear(); + myAllergiesList.clear(); + myHistoryList.clear(); GetChiefComplaintReqModel getChiefComplaintReqModel = GetChiefComplaintReqModel( patientMRN: widget.patientInfo.patientMRN, @@ -246,7 +245,7 @@ class _UpdateSubjectivePageState extends State { }); }, child: Column( - children: [UpdateHistoryWidget(myHistoryList: widget.myHistoryList)], + children: [UpdateHistoryWidget(myHistoryList: myHistoryList)], ), isExpanded: isHistoryExpand, ), @@ -264,7 +263,7 @@ class _UpdateSubjectivePageState extends State { child: Column( children: [ UpdateAllergiesWidget( - myAllergiesList: widget.myAllergiesList, + myAllergiesList: myAllergiesList, ), SizedBox( height: 30, @@ -304,10 +303,10 @@ class _UpdateSubjectivePageState extends State { title: TranslationBase.of(context).next, fontWeight: FontWeight.w600, color: Colors.red[700], - loading: model.state == ViewState.BusyLocal, + // loading: model.state == ViewState.BusyLocal, onPressed: () async { addSubjectiveInfo( - model: model, myAllergiesList: widget.myAllergiesList, myHistoryList: widget.myHistoryList); + model: model, myAllergiesList: myAllergiesList, myHistoryList: myHistoryList); }, ), ), @@ -325,6 +324,7 @@ class _UpdateSubjectivePageState extends State { addSubjectiveInfo( {SOAPViewModel model, List myAllergiesList, List myHistoryList}) async { + widget.changeLoadingState(true); formKey.currentState.save(); formKey.currentState.validate(); @@ -370,6 +370,8 @@ class _UpdateSubjectivePageState extends State { medicationControllerError = TranslationBase.of(context).emptyMessage; } }); + + widget.changeLoadingState(false); Helpers.showErrorToast(TranslationBase.of(context).chiefComplaintErrorMsg); } } @@ -380,7 +382,7 @@ class _UpdateSubjectivePageState extends State { Map profile = await sharedPref.getObj(DOCTOR_PROFILE); DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); - widget.myAllergiesList.forEach((allergy) { + myAllergiesList.forEach((allergy) { if (postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM == null) postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM = []; postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM.add(ListHisProgNotePatientAllergyDiseaseVM( @@ -419,7 +421,7 @@ class _UpdateSubjectivePageState extends State { postHistories({List myHistoryList, SOAPViewModel model}) async { PostHistoriesRequestModel postHistoriesRequestModel = new PostHistoriesRequestModel(doctorID: ''); - widget.myHistoryList.forEach((history) { + myHistoryList.forEach((history) { if (postHistoriesRequestModel.listMedicalHistoryVM == null) postHistoriesRequestModel.listMedicalHistoryVM = []; postHistoriesRequestModel.listMedicalHistoryVM.add(ListMedicalHistoryVM( patientMRN: widget.patientInfo.patientMRN, diff --git a/lib/screens/patients/profile/soap_update/update_soap_index.dart b/lib/screens/patients/profile/soap_update/update_soap_index.dart index 60597b11..fd4e8791 100644 --- a/lib/screens/patients/profile/soap_update/update_soap_index.dart +++ b/lib/screens/patients/profile/soap_update/update_soap_index.dart @@ -105,8 +105,6 @@ class _UpdateSoapIndexState extends State UpdateSubjectivePage( changePageViewIndex: changePageViewIndex, currentIndex: _currentIndex, - myAllergiesList: myAllergiesList, - myHistoryList: myHistoryList, patientInfo: patient, changeLoadingState: changeLoadingState), UpdateObjectivePage(