|
|
|
@ -1,8 +1,9 @@
|
|
|
|
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/model/get_medication_response_model.dart';
|
|
|
|
import 'package:doctor_app_flutter/core/model/search_drug/get_medication_response_model.dart';
|
|
|
|
import 'package:doctor_app_flutter/core/service/SOAP_service.dart';
|
|
|
|
import 'package:doctor_app_flutter/core/service/patient_medical_file/prescription/prescription_service.dart';
|
|
|
|
import 'package:doctor_app_flutter/core/service/prescription_service.dart';
|
|
|
|
import 'package:doctor_app_flutter/core/service/patient_medical_file/soap/SOAP_service.dart';
|
|
|
|
|
|
|
|
|
|
|
|
import 'package:doctor_app_flutter/models/SOAP/ChiefComplaint/GetChiefComplaintReqModel.dart';
|
|
|
|
import 'package:doctor_app_flutter/models/SOAP/ChiefComplaint/GetChiefComplaintReqModel.dart';
|
|
|
|
import 'package:doctor_app_flutter/models/SOAP/ChiefComplaint/GetChiefComplaintResModel.dart';
|
|
|
|
import 'package:doctor_app_flutter/models/SOAP/ChiefComplaint/GetChiefComplaintResModel.dart';
|
|
|
|
import 'package:doctor_app_flutter/models/SOAP/GeneralGetReqForSOAP.dart';
|
|
|
|
import 'package:doctor_app_flutter/models/SOAP/GeneralGetReqForSOAP.dart';
|
|
|
|
@ -39,10 +40,10 @@ class SOAPViewModel extends BaseViewModel {
|
|
|
|
List<MasterKeyModel> get allergySeverityList =>
|
|
|
|
List<MasterKeyModel> get allergySeverityList =>
|
|
|
|
_SOAPService.allergySeverityList;
|
|
|
|
_SOAPService.allergySeverityList;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<MasterKeyModel> get historyFamilyList => _SOAPService.historyFamilyList;
|
|
|
|
List<MasterKeyModel> get historyFamilyList => _SOAPService.historyFamilyList;
|
|
|
|
|
|
|
|
|
|
|
|
List<MasterKeyModel> get historyMedicalList => _SOAPService.historyMedicalList;
|
|
|
|
List<MasterKeyModel> get historyMedicalList =>
|
|
|
|
|
|
|
|
_SOAPService.historyMedicalList;
|
|
|
|
|
|
|
|
|
|
|
|
List<MasterKeyModel> get historySportList => _SOAPService.historySportList;
|
|
|
|
List<MasterKeyModel> get historySportList => _SOAPService.historySportList;
|
|
|
|
|
|
|
|
|
|
|
|
@ -82,8 +83,7 @@ class SOAPViewModel extends BaseViewModel {
|
|
|
|
|
|
|
|
|
|
|
|
List<GetAssessmentResModel> get patientAssessmentList =>
|
|
|
|
List<GetAssessmentResModel> get patientAssessmentList =>
|
|
|
|
_SOAPService.patientAssessmentList;
|
|
|
|
_SOAPService.patientAssessmentList;
|
|
|
|
int get episodeID =>
|
|
|
|
int get episodeID => _SOAPService.episodeID;
|
|
|
|
_SOAPService.episodeID;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
get medicationStrengthList => _SOAPService.medicationStrengthListWithModel;
|
|
|
|
get medicationStrengthList => _SOAPService.medicationStrengthListWithModel;
|
|
|
|
get medicationDoseTimeList => _SOAPService.medicationDoseTimeListWithModel;
|
|
|
|
get medicationDoseTimeList => _SOAPService.medicationDoseTimeListWithModel;
|
|
|
|
@ -102,7 +102,8 @@ class SOAPViewModel extends BaseViewModel {
|
|
|
|
setState(ViewState.Idle);
|
|
|
|
setState(ViewState.Idle);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Future getMasterLookup(MasterKeysService masterKeys, {bool isBusyLocal = false}) async {
|
|
|
|
Future getMasterLookup(MasterKeysService masterKeys,
|
|
|
|
|
|
|
|
{bool isBusyLocal = false}) async {
|
|
|
|
if (isBusyLocal) {
|
|
|
|
if (isBusyLocal) {
|
|
|
|
setState(ViewState.Busy);
|
|
|
|
setState(ViewState.Busy);
|
|
|
|
} else
|
|
|
|
} else
|
|
|
|
@ -115,7 +116,6 @@ class SOAPViewModel extends BaseViewModel {
|
|
|
|
setState(ViewState.Idle);
|
|
|
|
setState(ViewState.Idle);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Future postEpisode(PostEpisodeReqModel postEpisodeReqModel) async {
|
|
|
|
Future postEpisode(PostEpisodeReqModel postEpisodeReqModel) async {
|
|
|
|
setState(ViewState.BusyLocal);
|
|
|
|
setState(ViewState.BusyLocal);
|
|
|
|
await _SOAPService.postEpisode(postEpisodeReqModel);
|
|
|
|
await _SOAPService.postEpisode(postEpisodeReqModel);
|
|
|
|
@ -136,7 +136,8 @@ class SOAPViewModel extends BaseViewModel {
|
|
|
|
setState(ViewState.Idle);
|
|
|
|
setState(ViewState.Idle);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Future postHistories(PostHistoriesRequestModel postHistoriesRequestModel) async {
|
|
|
|
Future postHistories(
|
|
|
|
|
|
|
|
PostHistoriesRequestModel postHistoriesRequestModel) async {
|
|
|
|
setState(ViewState.BusyLocal);
|
|
|
|
setState(ViewState.BusyLocal);
|
|
|
|
await _SOAPService.postHistories(postHistoriesRequestModel);
|
|
|
|
await _SOAPService.postHistories(postHistoriesRequestModel);
|
|
|
|
if (_SOAPService.hasError) {
|
|
|
|
if (_SOAPService.hasError) {
|
|
|
|
@ -146,7 +147,8 @@ class SOAPViewModel extends BaseViewModel {
|
|
|
|
setState(ViewState.Idle);
|
|
|
|
setState(ViewState.Idle);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Future postChiefComplaint(PostChiefComplaintRequestModel postChiefComplaintRequestModel) async {
|
|
|
|
Future postChiefComplaint(
|
|
|
|
|
|
|
|
PostChiefComplaintRequestModel postChiefComplaintRequestModel) async {
|
|
|
|
setState(ViewState.BusyLocal);
|
|
|
|
setState(ViewState.BusyLocal);
|
|
|
|
await _SOAPService.postChiefComplaint(postChiefComplaintRequestModel);
|
|
|
|
await _SOAPService.postChiefComplaint(postChiefComplaintRequestModel);
|
|
|
|
if (_SOAPService.hasError) {
|
|
|
|
if (_SOAPService.hasError) {
|
|
|
|
@ -156,7 +158,8 @@ class SOAPViewModel extends BaseViewModel {
|
|
|
|
setState(ViewState.Idle);
|
|
|
|
setState(ViewState.Idle);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Future postPhysicalExam(PostPhysicalExamRequestModel postPhysicalExamRequestModel) async {
|
|
|
|
Future postPhysicalExam(
|
|
|
|
|
|
|
|
PostPhysicalExamRequestModel postPhysicalExamRequestModel) async {
|
|
|
|
setState(ViewState.BusyLocal);
|
|
|
|
setState(ViewState.BusyLocal);
|
|
|
|
await _SOAPService.postPhysicalExam(postPhysicalExamRequestModel);
|
|
|
|
await _SOAPService.postPhysicalExam(postPhysicalExamRequestModel);
|
|
|
|
if (_SOAPService.hasError) {
|
|
|
|
if (_SOAPService.hasError) {
|
|
|
|
@ -166,7 +169,8 @@ class SOAPViewModel extends BaseViewModel {
|
|
|
|
setState(ViewState.Idle);
|
|
|
|
setState(ViewState.Idle);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Future postProgressNote(PostProgressNoteRequestModel postProgressNoteRequestModel) async {
|
|
|
|
Future postProgressNote(
|
|
|
|
|
|
|
|
PostProgressNoteRequestModel postProgressNoteRequestModel) async {
|
|
|
|
setState(ViewState.BusyLocal);
|
|
|
|
setState(ViewState.BusyLocal);
|
|
|
|
await _SOAPService.postProgressNote(postProgressNoteRequestModel);
|
|
|
|
await _SOAPService.postProgressNote(postProgressNoteRequestModel);
|
|
|
|
if (_SOAPService.hasError) {
|
|
|
|
if (_SOAPService.hasError) {
|
|
|
|
@ -176,7 +180,8 @@ class SOAPViewModel extends BaseViewModel {
|
|
|
|
setState(ViewState.Idle);
|
|
|
|
setState(ViewState.Idle);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Future postAssessment(PostAssessmentRequestModel postAssessmentRequestModel) async {
|
|
|
|
Future postAssessment(
|
|
|
|
|
|
|
|
PostAssessmentRequestModel postAssessmentRequestModel) async {
|
|
|
|
setState(ViewState.BusyLocal);
|
|
|
|
setState(ViewState.BusyLocal);
|
|
|
|
await _SOAPService.postAssessment(postAssessmentRequestModel);
|
|
|
|
await _SOAPService.postAssessment(postAssessmentRequestModel);
|
|
|
|
if (_SOAPService.hasError) {
|
|
|
|
if (_SOAPService.hasError) {
|
|
|
|
@ -186,7 +191,6 @@ class SOAPViewModel extends BaseViewModel {
|
|
|
|
setState(ViewState.Idle);
|
|
|
|
setState(ViewState.Idle);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Future patchAllergy(PostAllergyRequestModel patchAllergyRequestModel) async {
|
|
|
|
Future patchAllergy(PostAllergyRequestModel patchAllergyRequestModel) async {
|
|
|
|
setState(ViewState.BusyLocal);
|
|
|
|
setState(ViewState.BusyLocal);
|
|
|
|
await _SOAPService.patchAllergy(patchAllergyRequestModel);
|
|
|
|
await _SOAPService.patchAllergy(patchAllergyRequestModel);
|
|
|
|
@ -197,7 +201,8 @@ class SOAPViewModel extends BaseViewModel {
|
|
|
|
setState(ViewState.Idle);
|
|
|
|
setState(ViewState.Idle);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Future patchHistories(PostHistoriesRequestModel patchHistoriesRequestModel) async {
|
|
|
|
Future patchHistories(
|
|
|
|
|
|
|
|
PostHistoriesRequestModel patchHistoriesRequestModel) async {
|
|
|
|
setState(ViewState.BusyLocal);
|
|
|
|
setState(ViewState.BusyLocal);
|
|
|
|
await _SOAPService.patchHistories(patchHistoriesRequestModel);
|
|
|
|
await _SOAPService.patchHistories(patchHistoriesRequestModel);
|
|
|
|
if (_SOAPService.hasError) {
|
|
|
|
if (_SOAPService.hasError) {
|
|
|
|
@ -207,7 +212,8 @@ class SOAPViewModel extends BaseViewModel {
|
|
|
|
setState(ViewState.Idle);
|
|
|
|
setState(ViewState.Idle);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Future patchChiefComplaint(PostChiefComplaintRequestModel patchChiefComplaintRequestModel) async {
|
|
|
|
Future patchChiefComplaint(
|
|
|
|
|
|
|
|
PostChiefComplaintRequestModel patchChiefComplaintRequestModel) async {
|
|
|
|
setState(ViewState.BusyLocal);
|
|
|
|
setState(ViewState.BusyLocal);
|
|
|
|
await _SOAPService.patchChiefComplaint(patchChiefComplaintRequestModel);
|
|
|
|
await _SOAPService.patchChiefComplaint(patchChiefComplaintRequestModel);
|
|
|
|
if (_SOAPService.hasError) {
|
|
|
|
if (_SOAPService.hasError) {
|
|
|
|
@ -217,7 +223,8 @@ class SOAPViewModel extends BaseViewModel {
|
|
|
|
setState(ViewState.Idle);
|
|
|
|
setState(ViewState.Idle);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Future patchPhysicalExam(PostPhysicalExamRequestModel patchPhysicalExamRequestModel) async {
|
|
|
|
Future patchPhysicalExam(
|
|
|
|
|
|
|
|
PostPhysicalExamRequestModel patchPhysicalExamRequestModel) async {
|
|
|
|
setState(ViewState.BusyLocal);
|
|
|
|
setState(ViewState.BusyLocal);
|
|
|
|
await _SOAPService.patchPhysicalExam(patchPhysicalExamRequestModel);
|
|
|
|
await _SOAPService.patchPhysicalExam(patchPhysicalExamRequestModel);
|
|
|
|
if (_SOAPService.hasError) {
|
|
|
|
if (_SOAPService.hasError) {
|
|
|
|
@ -227,7 +234,8 @@ class SOAPViewModel extends BaseViewModel {
|
|
|
|
setState(ViewState.Idle);
|
|
|
|
setState(ViewState.Idle);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Future patchProgressNote(PostProgressNoteRequestModel patchProgressNoteRequestModel) async {
|
|
|
|
Future patchProgressNote(
|
|
|
|
|
|
|
|
PostProgressNoteRequestModel patchProgressNoteRequestModel) async {
|
|
|
|
setState(ViewState.BusyLocal);
|
|
|
|
setState(ViewState.BusyLocal);
|
|
|
|
await _SOAPService.patchProgressNote(patchProgressNoteRequestModel);
|
|
|
|
await _SOAPService.patchProgressNote(patchProgressNoteRequestModel);
|
|
|
|
if (_SOAPService.hasError) {
|
|
|
|
if (_SOAPService.hasError) {
|
|
|
|
@ -237,7 +245,8 @@ class SOAPViewModel extends BaseViewModel {
|
|
|
|
setState(ViewState.Idle);
|
|
|
|
setState(ViewState.Idle);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Future patchAssessment(PatchAssessmentReqModel patchAssessmentRequestModel) async {
|
|
|
|
Future patchAssessment(
|
|
|
|
|
|
|
|
PatchAssessmentReqModel patchAssessmentRequestModel) async {
|
|
|
|
setState(ViewState.BusyLocal);
|
|
|
|
setState(ViewState.BusyLocal);
|
|
|
|
await _SOAPService.patchAssessment(patchAssessmentRequestModel);
|
|
|
|
await _SOAPService.patchAssessment(patchAssessmentRequestModel);
|
|
|
|
if (_SOAPService.hasError) {
|
|
|
|
if (_SOAPService.hasError) {
|
|
|
|
@ -273,14 +282,17 @@ class SOAPViewModel extends BaseViewModel {
|
|
|
|
typeId: element.allergyDiseaseType);
|
|
|
|
typeId: element.allergyDiseaseType);
|
|
|
|
if (selectedAllergy != null && element.isChecked)
|
|
|
|
if (selectedAllergy != null && element.isChecked)
|
|
|
|
allergiesString +=
|
|
|
|
allergiesString +=
|
|
|
|
(isArabic ? selectedAllergy.nameAr : selectedAllergy.nameEn )+ ' , ';
|
|
|
|
(isArabic ? selectedAllergy.nameAr : selectedAllergy.nameEn) +
|
|
|
|
|
|
|
|
' , ';
|
|
|
|
});
|
|
|
|
});
|
|
|
|
return allergiesString;
|
|
|
|
return allergiesString;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Future getPatientHistories(GetHistoryReqModel getHistoryReqModel, {bool isFirst = false}) async {
|
|
|
|
Future getPatientHistories(GetHistoryReqModel getHistoryReqModel,
|
|
|
|
|
|
|
|
{bool isFirst = false}) async {
|
|
|
|
setState(ViewState.Busy);
|
|
|
|
setState(ViewState.Busy);
|
|
|
|
await _SOAPService.getPatientHistories(getHistoryReqModel, isFirst: isFirst);
|
|
|
|
await _SOAPService.getPatientHistories(getHistoryReqModel,
|
|
|
|
|
|
|
|
isFirst: isFirst);
|
|
|
|
if (_SOAPService.hasError) {
|
|
|
|
if (_SOAPService.hasError) {
|
|
|
|
error = _SOAPService.error;
|
|
|
|
error = _SOAPService.error;
|
|
|
|
setState(ViewState.Error);
|
|
|
|
setState(ViewState.Error);
|
|
|
|
@ -299,7 +311,8 @@ class SOAPViewModel extends BaseViewModel {
|
|
|
|
setState(ViewState.Idle);
|
|
|
|
setState(ViewState.Idle);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Future getPatientPhysicalExam(GetPhysicalExamReqModel getPhysicalExamReqModel) async {
|
|
|
|
Future getPatientPhysicalExam(
|
|
|
|
|
|
|
|
GetPhysicalExamReqModel getPhysicalExamReqModel) async {
|
|
|
|
setState(ViewState.Busy);
|
|
|
|
setState(ViewState.Busy);
|
|
|
|
await _SOAPService.getPatientPhysicalExam(getPhysicalExamReqModel);
|
|
|
|
await _SOAPService.getPatientPhysicalExam(getPhysicalExamReqModel);
|
|
|
|
if (_SOAPService.hasError) {
|
|
|
|
if (_SOAPService.hasError) {
|
|
|
|
@ -309,7 +322,8 @@ class SOAPViewModel extends BaseViewModel {
|
|
|
|
setState(ViewState.Idle);
|
|
|
|
setState(ViewState.Idle);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Future getPatientProgressNote(GetGetProgressNoteReqModel getGetProgressNoteReqModel) async {
|
|
|
|
Future getPatientProgressNote(
|
|
|
|
|
|
|
|
GetGetProgressNoteReqModel getGetProgressNoteReqModel) async {
|
|
|
|
setState(ViewState.Busy);
|
|
|
|
setState(ViewState.Busy);
|
|
|
|
await _SOAPService.getPatientProgressNote(getGetProgressNoteReqModel);
|
|
|
|
await _SOAPService.getPatientProgressNote(getGetProgressNoteReqModel);
|
|
|
|
if (_SOAPService.hasError) {
|
|
|
|
if (_SOAPService.hasError) {
|
|
|
|
@ -339,6 +353,7 @@ class SOAPViewModel extends BaseViewModel {
|
|
|
|
} else
|
|
|
|
} else
|
|
|
|
setState(ViewState.Idle);
|
|
|
|
setState(ViewState.Idle);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ignore: missing_return
|
|
|
|
// ignore: missing_return
|
|
|
|
MasterKeyModel getOneMasterKey(
|
|
|
|
MasterKeyModel getOneMasterKey(
|
|
|
|
{@required MasterKeysService masterKeys, dynamic id, int typeId}) {
|
|
|
|
{@required MasterKeysService masterKeys, dynamic id, int typeId}) {
|
|
|
|
@ -391,7 +406,8 @@ class SOAPViewModel extends BaseViewModel {
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case MasterKeysService.HistorySurgical:
|
|
|
|
case MasterKeysService.HistorySurgical:
|
|
|
|
List<MasterKeyModel> result = historySurgicalList.where((element) {
|
|
|
|
List<MasterKeyModel> result = historySurgicalList.where((element) {
|
|
|
|
return element.id == id;}).toList();
|
|
|
|
return element.id == id;
|
|
|
|
|
|
|
|
}).toList();
|
|
|
|
if (result.isNotEmpty) {
|
|
|
|
if (result.isNotEmpty) {
|
|
|
|
return result.first;
|
|
|
|
return result.first;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -450,6 +466,4 @@ class SOAPViewModel extends BaseViewModel {
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|