first step for fix first step from fixes soap

merge-requests/773/head
Elham Rababh 5 years ago
parent d63fa42178
commit 638ae40035

@ -5,8 +5,8 @@ const ONLY_NUMBERS = "[0-9]";
const ONLY_LETTERS = "[a-zA-Z &'\"]"; const ONLY_LETTERS = "[a-zA-Z &'\"]";
const ONLY_DATE = "[0-9/]"; const ONLY_DATE = "[0-9/]";
const BASE_URL_LIVE_CARE = 'https://livecare.hmg.com/'; const BASE_URL_LIVE_CARE = 'https://livecare.hmg.com/';
const BASE_URL = 'https://hmgwebservices.com/'; // const BASE_URL = 'https://hmgwebservices.com/';
// const BASE_URL = 'https://uat.hmgwebservices.com/'; const BASE_URL = 'https://uat.hmgwebservices.com/';
const PHARMACY_ITEMS_URL = "Services/Lists.svc/REST/GetPharmcyItems_Region_enh"; const PHARMACY_ITEMS_URL = "Services/Lists.svc/REST/GetPharmcyItems_Region_enh";
const PHARMACY_LIST_URL = "Services/Patients.svc/REST/GetPharmcyList"; const PHARMACY_LIST_URL = "Services/Patients.svc/REST/GetPharmcyList";
const PATIENT_PROGRESS_NOTE_URL = "Services/DoctorApplication.svc/REST/GetProgressNoteForInPatient"; const PATIENT_PROGRESS_NOTE_URL = "Services/DoctorApplication.svc/REST/GetProgressNoteForInPatient";

@ -6,6 +6,7 @@ class MySelectedAllergy {
String remark; String remark;
bool isChecked; bool isChecked;
bool isExpanded; bool isExpanded;
bool isLocal;
int createdBy; int createdBy;
MySelectedAllergy( MySelectedAllergy(
@ -13,7 +14,8 @@ class MySelectedAllergy {
this.selectedAllergy, this.selectedAllergy,
this.remark, this.remark,
this.isChecked, this.isChecked,
this.isExpanded = true, this.isExpanded = true,
this.isLocal = true,
this.createdBy}); this.createdBy});
MySelectedAllergy.fromJson(Map<String, dynamic> json) { MySelectedAllergy.fromJson(Map<String, dynamic> json) {
@ -26,6 +28,7 @@ class MySelectedAllergy {
remark = json['remark']; remark = json['remark'];
isChecked = json['isChecked']; isChecked = json['isChecked'];
isExpanded = json['isExpanded']; isExpanded = json['isExpanded'];
isLocal = json['isLocal'];
createdBy = json['createdBy']; createdBy = json['createdBy'];
} }
@ -41,6 +44,7 @@ class MySelectedAllergy {
data['isChecked'] = this.isChecked; data['isChecked'] = this.isChecked;
data['isExpanded'] = this.isExpanded; data['isExpanded'] = this.isExpanded;
data['createdBy'] = this.createdBy; data['createdBy'] = this.createdBy;
data['isLocal'] = this.isLocal;
return data; return data;
} }
} }

@ -8,6 +8,8 @@ class MySelectedExamination {
bool notExamined; bool notExamined;
bool isNew; bool isNew;
int createdBy; int createdBy;
String createdOn;
String editedOn;
MySelectedExamination( MySelectedExamination(
{this.selectedExamination, {this.selectedExamination,
@ -16,7 +18,9 @@ class MySelectedExamination {
this.isAbnormal = false, this.isAbnormal = false,
this.notExamined = true, this.notExamined = true,
this.isNew = true, this.isNew = true,
this.createdBy}); this.createdBy, this.createdOn,
this.editedOn,});
MySelectedExamination.fromJson(Map<String, dynamic> json) { MySelectedExamination.fromJson(Map<String, dynamic> json) {
selectedExamination = json['selectedExamination'] != null selectedExamination = json['selectedExamination'] != null
@ -28,6 +32,8 @@ class MySelectedExamination {
notExamined = json['notExamined']; notExamined = json['notExamined'];
isNew = json['isNew']; isNew = json['isNew'];
createdBy = json['createdBy']; createdBy = json['createdBy'];
createdOn = json['createdOn'];
editedOn = json['editedOn'];
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
@ -42,6 +48,9 @@ class MySelectedExamination {
data['notExamined'] = this.notExamined; data['notExamined'] = this.notExamined;
data['isNew'] = this.isNew; data['isNew'] = this.isNew;
data['createdBy'] = this.createdBy; data['createdBy'] = this.createdBy;
data['createdOn'] = this.createdOn;
data['editedOn'] = this.editedOn;
return data; return data;
} }
} }

@ -4,9 +4,10 @@ class MySelectedHistory {
MasterKeyModel selectedHistory; MasterKeyModel selectedHistory;
String remark; String remark;
bool isChecked; bool isChecked;
bool isLocal;
MySelectedHistory( MySelectedHistory(
{ this.selectedHistory, this.remark, this.isChecked}); { this.selectedHistory, this.remark, this.isChecked, this.isLocal = true});
MySelectedHistory.fromJson(Map<String, dynamic> json) { MySelectedHistory.fromJson(Map<String, dynamic> json) {
@ -15,6 +16,7 @@ class MySelectedHistory {
: null; : null;
remark = json['remark']; remark = json['remark'];
remark = json['isChecked']; remark = json['isChecked'];
isLocal = json['isLocal'];
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
@ -25,6 +27,7 @@ class MySelectedHistory {
} }
data['remark'] = this.remark; data['remark'] = this.remark;
data['isChecked'] = this.remark; data['isChecked'] = this.remark;
data['isLocal'] = this.isLocal;
return data; return data;
} }
} }

@ -55,7 +55,7 @@ class _UpdateAssessmentPageState extends State<UpdateAssessmentPage> {
episodeID: widget.patientInfo.episodeNo.toString(), episodeID: widget.patientInfo.episodeNo.toString(),
editedBy: '', editedBy: '',
doctorID: '', doctorID: '',
appointmentNo: int.parse(widget.patientInfo.appointmentNo)); appointmentNo: int.parse(widget.patientInfo.appointmentNo.toString()));
await model.getPatientAssessment(getAssessmentReqModel); await model.getPatientAssessment(getAssessmentReqModel);
if (model.patientAssessmentList.isNotEmpty) { if (model.patientAssessmentList.isNotEmpty) {
if (model.listOfDiagnosisCondition.length == 0) { if (model.listOfDiagnosisCondition.length == 0) {

@ -83,9 +83,11 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage> {
remark: element.remarks, remark: element.remarks,
isNormal: element.isNormal, isNormal: element.isNormal,
createdBy: element.createdBy, createdBy: element.createdBy,
createdOn:element.createdOn ,
editedOn: element.editedOn,
notExamined: element.notExamined, notExamined: element.notExamined,
isNew: element.isNew, isNew: element.isNew,
isAbnormal: element.isAbnormal); isAbnormal: element.isAbnormal,);
widget.mySelectedExamination.add(tempEam); widget.mySelectedExamination.add(tempEam);
}); });
} }
@ -213,7 +215,8 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage> {
appointmentNo: widget.patientInfo.appointmentNo, appointmentNo: widget.patientInfo.appointmentNo,
remarks: exam.remark ?? '', remarks: exam.remark ?? '',
createdBy: exam.createdBy ?? doctorProfile.doctorID, createdBy: exam.createdBy ?? doctorProfile.doctorID,
createdOn: DateTime.now().toIso8601String(), createdOn: exam.createdOn??
DateTime.now().toIso8601String(),
editedBy: doctorProfile.doctorID, editedBy: doctorProfile.doctorID,
editedOn: DateTime.now().toIso8601String(), editedOn: DateTime.now().toIso8601String(),
examId: exam.selectedExamination.id, examId: exam.selectedExamination.id,
@ -276,21 +279,6 @@ class _UpdateObjectivePageState extends State<UpdateObjectivePage> {
removeExamination: (masterKey) => removeExamination(masterKey)), 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),
);
});*/
} }
} }

@ -74,7 +74,7 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> {
return BaseView<SOAPViewModel>( return BaseView<SOAPViewModel>(
onModelReady: (model) async { onModelReady: (model) async {
GetGetProgressNoteReqModel getGetProgressNoteReqModel = GetGetProgressNoteReqModel( GetGetProgressNoteReqModel getGetProgressNoteReqModel = GetGetProgressNoteReqModel(
appointmentNo: int.parse(widget.patientInfo.appointmentNo), appointmentNo: int.parse(widget.patientInfo.appointmentNo.toString()),
patientMRN: widget.patientInfo.patientMRN, patientMRN: widget.patientInfo.patientMRN,
episodeID: widget.patientInfo.episodeNo.toString(), episodeID: widget.patientInfo.episodeNo.toString(),
editedBy: '', editedBy: '',
@ -88,6 +88,8 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> {
widget.patientProgressNote.createdOn = model.patientProgressNoteList[0].createdOn; widget.patientProgressNote.createdOn = model.patientProgressNoteList[0].createdOn;
widget.patientProgressNote.editedOn = model.patientProgressNoteList[0].editedOn; widget.patientProgressNote.editedOn = model.patientProgressNoteList[0].editedOn;
widget.patientProgressNote.editedByName = model.patientProgressNoteList[0].editedByName; widget.patientProgressNote.editedByName = model.patientProgressNoteList[0].editedByName;
widget.patientProgressNote.appointmentNo = model.patientProgressNoteList[0].appointmentNo;
setState(() { setState(() {
isAddProgress = false; isAddProgress = false;
}); });
@ -158,7 +160,7 @@ class _UpdatePlanPageState extends State<UpdatePlanPage> {
fontSize: 12, fontSize: 12,
), ),
AppText( AppText(
widget.patientProgressNote.appointmentNo ?? '', widget.patientProgressNote.appointmentNo.toString() ?? '',
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
), ),
], ],

@ -153,13 +153,15 @@ class _UpdateAllergiesWidgetState extends State<UpdateAllergiesWidget> {
).toList(); ).toList();
if (allergy.length > 0) { if (allergy.length > 0) {
if(allergy.first.isLocal) {
setState(() {
widget.myAllergiesList.remove(allergy.first);
});
}
setState(() { setState(() {
allergy[0].isChecked = false; allergy[0].isChecked = false;
}); });
} }
print(allergy);
} }
openAllergiesList(BuildContext context, Function changeParentState) { openAllergiesList(BuildContext context, Function changeParentState) {
@ -180,7 +182,8 @@ class _UpdateAllergiesWidgetState extends State<UpdateAllergiesWidget> {
}); });
if (isAllDataFilled) { if (isAllDataFilled) {
mySelectedAllergy.forEach((element) { 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); widget.myAllergiesList.add(element);
} }
}); });

@ -123,10 +123,19 @@ class _UpdateHistoryWidgetState extends State<UpdateHistoryWidget>
).toList(); ).toList();
if (history.length > 0) if (history.length > 0) {
setState(() { if(history.first.isLocal) {
history[0].isChecked = false; setState(() {
}); widget.myHistoryList.remove(history.first);
});
} else {
setState(() {
history[0].isChecked = false;
});
}
}
} }
openHistoryList(BuildContext context) { openHistoryList(BuildContext context) {

@ -30,16 +30,12 @@ import 'history/update_history_widget.dart';
class UpdateSubjectivePage extends StatefulWidget { class UpdateSubjectivePage extends StatefulWidget {
final Function changePageViewIndex; final Function changePageViewIndex;
final Function changeLoadingState; final Function changeLoadingState;
final List<MySelectedAllergy> myAllergiesList;
final List<MySelectedHistory> myHistoryList;
final PatiantInformtion patientInfo; final PatiantInformtion patientInfo;
final int currentIndex; final int currentIndex;
UpdateSubjectivePage( UpdateSubjectivePage(
{Key key, {Key key,
this.changePageViewIndex, this.changePageViewIndex,
this.myAllergiesList,
this.myHistoryList,
this.patientInfo, this.patientInfo,
this.changeLoadingState, this.changeLoadingState,
this.currentIndex}); this.currentIndex});
@ -59,6 +55,8 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
String medicationControllerError = ''; String medicationControllerError = '';
String illnessControllerError = ''; String illnessControllerError = '';
final formKey = GlobalKey<FormState>(); final formKey = GlobalKey<FormState>();
List<MySelectedAllergy> myAllergiesList=List();
List<MySelectedHistory> myHistoryList=List();
getHistory(SOAPViewModel model) async { getHistory(SOAPViewModel model) async {
widget.changeLoadingState(true); widget.changeLoadingState(true);
@ -93,9 +91,9 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
); );
if (history != null) { if (history != null) {
MySelectedHistory mySelectedHistory = 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()) { if (element.historyType == MasterKeysService.HistoryMedical.getMasterKeyService()) {
@ -105,9 +103,9 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
); );
if (history != null) { if (history != null) {
MySelectedHistory mySelectedHistory = 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()) { if (element.historyType == MasterKeysService.HistorySports.getMasterKeyService()) {
@ -117,9 +115,9 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
); );
if (history != null) { if (history != null) {
MySelectedHistory mySelectedHistory = 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()) { if (element.historyType == MasterKeysService.HistorySurgical.getMasterKeyService()) {
@ -129,9 +127,9 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
); );
if (history != null) { if (history != null) {
MySelectedHistory mySelectedHistory = 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<UpdateSubjectivePage> {
isChecked: element.isChecked, isChecked: element.isChecked,
createdBy: element.createdBy, createdBy: element.createdBy,
remark: element.remarks, remark: element.remarks,
isLocal : false,
selectedAllergySeverity: selectedAllergySeverity); 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<UpdateSubjectivePage> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BaseView<SOAPViewModel>( return BaseView<SOAPViewModel>(
onModelReady: (model) async { onModelReady: (model) async {
widget.myAllergiesList.clear(); myAllergiesList.clear();
widget.myHistoryList.clear(); myHistoryList.clear();
GetChiefComplaintReqModel getChiefComplaintReqModel = GetChiefComplaintReqModel( GetChiefComplaintReqModel getChiefComplaintReqModel = GetChiefComplaintReqModel(
patientMRN: widget.patientInfo.patientMRN, patientMRN: widget.patientInfo.patientMRN,
@ -246,7 +245,7 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
}); });
}, },
child: Column( child: Column(
children: [UpdateHistoryWidget(myHistoryList: widget.myHistoryList)], children: [UpdateHistoryWidget(myHistoryList: myHistoryList)],
), ),
isExpanded: isHistoryExpand, isExpanded: isHistoryExpand,
), ),
@ -264,7 +263,7 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
child: Column( child: Column(
children: [ children: [
UpdateAllergiesWidget( UpdateAllergiesWidget(
myAllergiesList: widget.myAllergiesList, myAllergiesList: myAllergiesList,
), ),
SizedBox( SizedBox(
height: 30, height: 30,
@ -304,10 +303,10 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
title: TranslationBase.of(context).next, title: TranslationBase.of(context).next,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
color: Colors.red[700], color: Colors.red[700],
loading: model.state == ViewState.BusyLocal, // loading: model.state == ViewState.BusyLocal,
onPressed: () async { onPressed: () async {
addSubjectiveInfo( addSubjectiveInfo(
model: model, myAllergiesList: widget.myAllergiesList, myHistoryList: widget.myHistoryList); model: model, myAllergiesList: myAllergiesList, myHistoryList: myHistoryList);
}, },
), ),
), ),
@ -325,6 +324,7 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
addSubjectiveInfo( addSubjectiveInfo(
{SOAPViewModel model, List<MySelectedAllergy> myAllergiesList, List<MySelectedHistory> myHistoryList}) async { {SOAPViewModel model, List<MySelectedAllergy> myAllergiesList, List<MySelectedHistory> myHistoryList}) async {
widget.changeLoadingState(true);
formKey.currentState.save(); formKey.currentState.save();
formKey.currentState.validate(); formKey.currentState.validate();
@ -370,6 +370,8 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
medicationControllerError = TranslationBase.of(context).emptyMessage; medicationControllerError = TranslationBase.of(context).emptyMessage;
} }
}); });
widget.changeLoadingState(false);
Helpers.showErrorToast(TranslationBase.of(context).chiefComplaintErrorMsg); Helpers.showErrorToast(TranslationBase.of(context).chiefComplaintErrorMsg);
} }
} }
@ -380,7 +382,7 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
Map profile = await sharedPref.getObj(DOCTOR_PROFILE); Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile);
widget.myAllergiesList.forEach((allergy) { myAllergiesList.forEach((allergy) {
if (postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM == null) if (postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM == null)
postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM = []; postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM = [];
postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM.add(ListHisProgNotePatientAllergyDiseaseVM( postAllergyRequestModel.listHisProgNotePatientAllergyDiseaseVM.add(ListHisProgNotePatientAllergyDiseaseVM(
@ -419,7 +421,7 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
postHistories({List<MySelectedHistory> myHistoryList, SOAPViewModel model}) async { postHistories({List<MySelectedHistory> myHistoryList, SOAPViewModel model}) async {
PostHistoriesRequestModel postHistoriesRequestModel = new PostHistoriesRequestModel(doctorID: ''); PostHistoriesRequestModel postHistoriesRequestModel = new PostHistoriesRequestModel(doctorID: '');
widget.myHistoryList.forEach((history) { myHistoryList.forEach((history) {
if (postHistoriesRequestModel.listMedicalHistoryVM == null) postHistoriesRequestModel.listMedicalHistoryVM = []; if (postHistoriesRequestModel.listMedicalHistoryVM == null) postHistoriesRequestModel.listMedicalHistoryVM = [];
postHistoriesRequestModel.listMedicalHistoryVM.add(ListMedicalHistoryVM( postHistoriesRequestModel.listMedicalHistoryVM.add(ListMedicalHistoryVM(
patientMRN: widget.patientInfo.patientMRN, patientMRN: widget.patientInfo.patientMRN,

@ -105,8 +105,6 @@ class _UpdateSoapIndexState extends State<UpdateSoapIndex>
UpdateSubjectivePage( UpdateSubjectivePage(
changePageViewIndex: changePageViewIndex, changePageViewIndex: changePageViewIndex,
currentIndex: _currentIndex, currentIndex: _currentIndex,
myAllergiesList: myAllergiesList,
myHistoryList: myHistoryList,
patientInfo: patient, patientInfo: patient,
changeLoadingState: changeLoadingState), changeLoadingState: changeLoadingState),
UpdateObjectivePage( UpdateObjectivePage(

Loading…
Cancel
Save