|
|
|
|
@ -95,7 +95,7 @@ class SOAPViewModel extends BaseViewModel {
|
|
|
|
|
|
|
|
|
|
get medicationFrequencyList => _SOAPService.medicationFrequencyListWithModel;
|
|
|
|
|
|
|
|
|
|
List<GetMedicationResponseModel> get allMedicationList => _prescriptionService.allMedicationList;
|
|
|
|
|
List<GetMedicationResponseModel>? get allMedicationList => _prescriptionService.allMedicationList;
|
|
|
|
|
|
|
|
|
|
late SubjectiveCallBack subjectiveCallBack;
|
|
|
|
|
|
|
|
|
|
@ -249,8 +249,8 @@ class SOAPViewModel extends BaseViewModel {
|
|
|
|
|
String getAllergicNames(isArabic) {
|
|
|
|
|
String allergiesString = '';
|
|
|
|
|
patientAllergiesList.forEach((element) {
|
|
|
|
|
MasterKeyModel selectedAllergy = getOneMasterKey(masterKeys: MasterKeysService.Allergies, id: element.allergyDiseaseId, typeId: element.allergyDiseaseType!)!;
|
|
|
|
|
if (selectedAllergy != null && element.isChecked!) allergiesString += ((isArabic ? selectedAllergy.nameAr : selectedAllergy.nameEn)! + ' , ')!;
|
|
|
|
|
MasterKeyModel? selectedAllergy = getOneMasterKey(masterKeys: MasterKeysService.Allergies, id: element.allergyDiseaseId, typeId: element.allergyDiseaseType!);
|
|
|
|
|
if (selectedAllergy != null && element.isChecked!) allergiesString += ((isArabic ? selectedAllergy.nameAr : selectedAllergy.nameEn)! + ' , ');
|
|
|
|
|
});
|
|
|
|
|
return allergiesString;
|
|
|
|
|
}
|
|
|
|
|
@ -447,7 +447,7 @@ class SOAPViewModel extends BaseViewModel {
|
|
|
|
|
episodeId: patientInfo.episodeNo,
|
|
|
|
|
episodeID: patientInfo.episodeNo,
|
|
|
|
|
doctorID: '');
|
|
|
|
|
var services = [_SOAPService.getPatientChiefComplaint(getChiefComplaintReqModel)];
|
|
|
|
|
var services = [await _SOAPService.getPatientChiefComplaint(getChiefComplaintReqModel)];
|
|
|
|
|
|
|
|
|
|
if (patientInfo.admissionNo == null) {
|
|
|
|
|
complaintsControllerError = '';
|
|
|
|
|
@ -455,62 +455,62 @@ class SOAPViewModel extends BaseViewModel {
|
|
|
|
|
illnessControllerError = '';
|
|
|
|
|
GetHistoryReqModel getHistoryReqModel = GetHistoryReqModel(
|
|
|
|
|
patientMRN: patientInfo.patientMRN, episodeID: patientInfo.episodeNo.toString(), appointmentNo: int.parse(patientInfo.appointmentNo.toString()), doctorID: '', editedBy: '');
|
|
|
|
|
services.add(_SOAPService.getPatientHistories(getHistoryReqModel, isFirst: true));
|
|
|
|
|
services.add(await _SOAPService.getPatientHistories(getHistoryReqModel, isFirst: true));
|
|
|
|
|
|
|
|
|
|
GeneralGetReqForSOAP generalGetReqForSOAP =
|
|
|
|
|
GeneralGetReqForSOAP(patientMRN: patientInfo.patientMRN, episodeId: patientInfo.episodeNo, appointmentNo: int.parse(patientInfo.appointmentNo.toString()), doctorID: '', editedBy: '');
|
|
|
|
|
|
|
|
|
|
services.add(_SOAPService.getPatientAllergy(generalGetReqForSOAP));
|
|
|
|
|
services.add(await _SOAPService.getPatientAllergy(generalGetReqForSOAP));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
final results = await Future.wait(services);
|
|
|
|
|
final results = services;
|
|
|
|
|
await callServicesAfterGetPatientInfoForUpdateSubject();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
callServicesAfterGetPatientInfoForUpdateSubject() async {
|
|
|
|
|
var services;
|
|
|
|
|
List services = [];
|
|
|
|
|
if (patientHistoryList.isNotEmpty) {
|
|
|
|
|
if (historyFamilyList.isEmpty) {
|
|
|
|
|
if (services == null) {
|
|
|
|
|
services = [_SOAPService.getMasterLookup(MasterKeysService.HistoryFamily)];
|
|
|
|
|
if (services.isEmpty) {
|
|
|
|
|
services = [await _SOAPService.getMasterLookup(MasterKeysService.HistoryFamily)];
|
|
|
|
|
} else {
|
|
|
|
|
services.add(_SOAPService.getMasterLookup(MasterKeysService.HistoryFamily));
|
|
|
|
|
services.add(await _SOAPService.getMasterLookup(MasterKeysService.HistoryFamily));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (historyMedicalList.isEmpty) {
|
|
|
|
|
if (services == null) {
|
|
|
|
|
services = [_SOAPService.getMasterLookup(MasterKeysService.HistoryMedical)];
|
|
|
|
|
if (services.isEmpty) {
|
|
|
|
|
services = [await _SOAPService.getMasterLookup(MasterKeysService.HistoryMedical)];
|
|
|
|
|
} else
|
|
|
|
|
services.add(_SOAPService.getMasterLookup(MasterKeysService.HistoryMedical));
|
|
|
|
|
services.add(await _SOAPService.getMasterLookup(MasterKeysService.HistoryMedical));
|
|
|
|
|
}
|
|
|
|
|
if (historySurgicalList.length == 0) {
|
|
|
|
|
if (services == null) {
|
|
|
|
|
services = [_SOAPService.getMasterLookup(MasterKeysService.HistorySurgical)];
|
|
|
|
|
if (services.isEmpty) {
|
|
|
|
|
services = [await _SOAPService.getMasterLookup(MasterKeysService.HistorySurgical)];
|
|
|
|
|
} else
|
|
|
|
|
services.add(_SOAPService.getMasterLookup(MasterKeysService.HistorySurgical));
|
|
|
|
|
services.add(await _SOAPService.getMasterLookup(MasterKeysService.HistorySurgical));
|
|
|
|
|
}
|
|
|
|
|
if (historySportList.length == 0) {
|
|
|
|
|
if (services == null) {
|
|
|
|
|
services = [_SOAPService.getMasterLookup(MasterKeysService.HistorySports)];
|
|
|
|
|
if (services.isEmpty) {
|
|
|
|
|
services = [await _SOAPService.getMasterLookup(MasterKeysService.HistorySports)];
|
|
|
|
|
} else
|
|
|
|
|
services.add(_SOAPService.getMasterLookup(MasterKeysService.HistorySports));
|
|
|
|
|
services.add(await _SOAPService.getMasterLookup(MasterKeysService.HistorySports));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (patientAllergiesList.isNotEmpty) {
|
|
|
|
|
if (allergiesList.isEmpty) if (services == null) {
|
|
|
|
|
services = [_SOAPService.getMasterLookup(MasterKeysService.Allergies)];
|
|
|
|
|
if (allergiesList.isEmpty) if (services.isEmpty) {
|
|
|
|
|
services = [await _SOAPService.getMasterLookup(MasterKeysService.Allergies)];
|
|
|
|
|
} else
|
|
|
|
|
services.add(_SOAPService.getMasterLookup(MasterKeysService.Allergies));
|
|
|
|
|
services.add(await _SOAPService.getMasterLookup(MasterKeysService.Allergies));
|
|
|
|
|
if (allergySeverityList.isEmpty) {
|
|
|
|
|
if (services == null) {
|
|
|
|
|
services = [_SOAPService.getMasterLookup(MasterKeysService.AllergySeverity)];
|
|
|
|
|
if (services.isEmpty) {
|
|
|
|
|
services = [await _SOAPService.getMasterLookup(MasterKeysService.AllergySeverity)];
|
|
|
|
|
} else
|
|
|
|
|
services.add(_SOAPService.getMasterLookup(MasterKeysService.AllergySeverity));
|
|
|
|
|
services.add(await _SOAPService.getMasterLookup(MasterKeysService.AllergySeverity));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
final results = await Future.wait(services ?? []);
|
|
|
|
|
final results = services;
|
|
|
|
|
|
|
|
|
|
if (_SOAPService.hasError) {
|
|
|
|
|
error = _SOAPService.error;
|
|
|
|
|
@ -524,37 +524,37 @@ class SOAPViewModel extends BaseViewModel {
|
|
|
|
|
List services = [];
|
|
|
|
|
if (medicationStrengthList.length == 0) {
|
|
|
|
|
if (services.isEmpty) {
|
|
|
|
|
services = [_SOAPService.getMasterLookup(MasterKeysService.MedicationStrength)];
|
|
|
|
|
services = [await _SOAPService.getMasterLookup(MasterKeysService.MedicationStrength)];
|
|
|
|
|
} else {
|
|
|
|
|
services.add(_SOAPService.getMasterLookup(MasterKeysService.MedicationStrength));
|
|
|
|
|
services.add(await _SOAPService.getMasterLookup(MasterKeysService.MedicationStrength));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (medicationFrequencyList.length == 0) {
|
|
|
|
|
if (services.isEmpty) {
|
|
|
|
|
services = [_SOAPService.getMasterLookup(MasterKeysService.MedicationFrequency)];
|
|
|
|
|
services = [await _SOAPService.getMasterLookup(MasterKeysService.MedicationFrequency)];
|
|
|
|
|
} else {
|
|
|
|
|
services.add(_SOAPService.getMasterLookup(MasterKeysService.MedicationFrequency));
|
|
|
|
|
services.add(await _SOAPService.getMasterLookup(MasterKeysService.MedicationFrequency));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (medicationDoseTimeList.length == 0) {
|
|
|
|
|
if (services.isEmpty) {
|
|
|
|
|
services = [_SOAPService.getMasterLookup(MasterKeysService.MedicationDoseTime)];
|
|
|
|
|
services = [await _SOAPService.getMasterLookup(MasterKeysService.MedicationDoseTime)];
|
|
|
|
|
} else {
|
|
|
|
|
services.add(_SOAPService.getMasterLookup(MasterKeysService.MedicationDoseTime));
|
|
|
|
|
services.add(await _SOAPService.getMasterLookup(MasterKeysService.MedicationDoseTime));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (medicationRouteList.length == 0) {
|
|
|
|
|
if (services.isEmpty) {
|
|
|
|
|
services = [_SOAPService.getMasterLookup(MasterKeysService.MedicationRoute)];
|
|
|
|
|
services = [await _SOAPService.getMasterLookup(MasterKeysService.MedicationRoute)];
|
|
|
|
|
} else {
|
|
|
|
|
services.add(_SOAPService.getMasterLookup(MasterKeysService.MedicationRoute));
|
|
|
|
|
services.add(await _SOAPService.getMasterLookup(MasterKeysService.MedicationRoute));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (allMedicationList.length == 0) {
|
|
|
|
|
if (allMedicationList!.isEmpty) {
|
|
|
|
|
if (services.isEmpty) {
|
|
|
|
|
services = [_prescriptionService.getMedicationList()];
|
|
|
|
|
services = [await _prescriptionService.getMedicationList()];
|
|
|
|
|
} else {
|
|
|
|
|
services.add(_prescriptionService.getMedicationList());
|
|
|
|
|
services.add(await _prescriptionService.getMedicationList());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -568,30 +568,30 @@ class SOAPViewModel extends BaseViewModel {
|
|
|
|
|
|
|
|
|
|
callAddAssessmentLookupsServices({String searchKey = "", bool allowSetState = true}) async {
|
|
|
|
|
if (allowSetState) setState(ViewState.Busy);
|
|
|
|
|
var services;
|
|
|
|
|
if (listOfDiagnosisCondition.length == 0) {
|
|
|
|
|
if (services == null) {
|
|
|
|
|
services = [_SOAPService.getMasterLookup(MasterKeysService.DiagnosisCondition)];
|
|
|
|
|
List services = [];
|
|
|
|
|
if (listOfDiagnosisCondition.isEmpty) {
|
|
|
|
|
if (services.isEmpty) {
|
|
|
|
|
services = [await _SOAPService.getMasterLookup(MasterKeysService.DiagnosisCondition)];
|
|
|
|
|
} else {
|
|
|
|
|
services.add(_SOAPService.getMasterLookup(MasterKeysService.DiagnosisCondition));
|
|
|
|
|
services.add(await _SOAPService.getMasterLookup(MasterKeysService.DiagnosisCondition));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (listOfDiagnosisType.length == 0) {
|
|
|
|
|
if (services == null) {
|
|
|
|
|
services = [_SOAPService.getMasterLookup(MasterKeysService.DiagnosisType)];
|
|
|
|
|
if (services.isEmpty) {
|
|
|
|
|
services = [await _SOAPService.getMasterLookup(MasterKeysService.DiagnosisType)];
|
|
|
|
|
} else {
|
|
|
|
|
services.add(_SOAPService.getMasterLookup(MasterKeysService.DiagnosisType));
|
|
|
|
|
services.add(await _SOAPService.getMasterLookup(MasterKeysService.DiagnosisType));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (listOfICD10.length == 0) {
|
|
|
|
|
if (services == null) {
|
|
|
|
|
services = [_SOAPService.getMasterLookup(MasterKeysService.ICD10, searchKey: searchKey)];
|
|
|
|
|
if (services.isEmpty) {
|
|
|
|
|
services = [await _SOAPService.getMasterLookup(MasterKeysService.ICD10, searchKey: searchKey)];
|
|
|
|
|
} else {
|
|
|
|
|
services.add(_SOAPService.getMasterLookup(MasterKeysService.ICD10, searchKey: searchKey));
|
|
|
|
|
services.add(await _SOAPService.getMasterLookup(MasterKeysService.ICD10, searchKey: searchKey));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
final results = await Future.wait(services ?? []);
|
|
|
|
|
final results = services;
|
|
|
|
|
if (allowSetState) {
|
|
|
|
|
if (_SOAPService.hasError) {
|
|
|
|
|
error = _SOAPService.error;
|
|
|
|
|
@ -605,9 +605,9 @@ class SOAPViewModel extends BaseViewModel {
|
|
|
|
|
GetAssessmentReqModel getAssessmentReqModel = GetAssessmentReqModel(
|
|
|
|
|
patientMRN: patientInfo.patientMRN, episodeID: patientInfo.episodeNo.toString(), editedBy: '', doctorID: '', appointmentNo: int.parse(patientInfo.appointmentNo.toString()));
|
|
|
|
|
|
|
|
|
|
var services = [_SOAPService.getPatientAssessment(getAssessmentReqModel)];
|
|
|
|
|
var services = [await _SOAPService.getPatientAssessment(getAssessmentReqModel)];
|
|
|
|
|
|
|
|
|
|
final results = await Future.wait(services);
|
|
|
|
|
final results = services;
|
|
|
|
|
|
|
|
|
|
if (patientAssessmentList.isNotEmpty) {
|
|
|
|
|
await callAddAssessmentLookupsServices(allowSetState: false);
|
|
|
|
|
@ -621,38 +621,38 @@ class SOAPViewModel extends BaseViewModel {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
postSubjectServices({patientInfo, String? complaintsText, String? medicationText, String? illnessText, List<MySelectedHistory>? myHistoryList, List<MySelectedAllergy>? myAllergiesList}) async {
|
|
|
|
|
var services;
|
|
|
|
|
List services = [];
|
|
|
|
|
|
|
|
|
|
PostChiefComplaintRequestModel postChiefComplaintRequestModel =
|
|
|
|
|
createPostChiefComplaintRequestModel(patientInfo: patientInfo, illnessText: illnessText!, medicationText: medicationText!, complaintsText: complaintsText!);
|
|
|
|
|
if (patientChiefComplaintList.isEmpty) {
|
|
|
|
|
postChiefComplaintRequestModel.editedBy = '';
|
|
|
|
|
services = [_SOAPService.postChiefComplaint(postChiefComplaintRequestModel)];
|
|
|
|
|
services = [await _SOAPService.postChiefComplaint(postChiefComplaintRequestModel)];
|
|
|
|
|
} else {
|
|
|
|
|
postChiefComplaintRequestModel.editedBy = '';
|
|
|
|
|
services = [_SOAPService.patchChiefComplaint(postChiefComplaintRequestModel)];
|
|
|
|
|
services = [await _SOAPService.patchChiefComplaint(postChiefComplaintRequestModel)];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (myHistoryList!.length != 0) {
|
|
|
|
|
PostHistoriesRequestModel postHistoriesRequestModel = createPostHistoriesRequestModel(patientInfo: patientInfo, myHistoryList: myHistoryList);
|
|
|
|
|
|
|
|
|
|
if (patientHistoryList.isEmpty) {
|
|
|
|
|
services.add(_SOAPService.postHistories(postHistoriesRequestModel));
|
|
|
|
|
services.add(await _SOAPService.postHistories(postHistoriesRequestModel));
|
|
|
|
|
} else {
|
|
|
|
|
services.add(_SOAPService.patchHistories(postHistoriesRequestModel));
|
|
|
|
|
services.add(await _SOAPService.patchHistories(postHistoriesRequestModel));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (myAllergiesList!.length != 0) {
|
|
|
|
|
PostAllergyRequestModel postAllergyRequestModel = createPostAllergyRequestModel(myAllergiesList: myAllergiesList, patientInfo: patientInfo);
|
|
|
|
|
if (patientAllergiesList.isEmpty) {
|
|
|
|
|
services.add(_SOAPService.postAllergy(postAllergyRequestModel));
|
|
|
|
|
services.add(await _SOAPService.postAllergy(postAllergyRequestModel));
|
|
|
|
|
} else {
|
|
|
|
|
services.add(_SOAPService.patchAllergy(postAllergyRequestModel));
|
|
|
|
|
services.add(await _SOAPService.patchAllergy(postAllergyRequestModel));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
final results = await Future.wait(services);
|
|
|
|
|
final results = services;
|
|
|
|
|
|
|
|
|
|
if (_SOAPService.hasError) {
|
|
|
|
|
error = _SOAPService.error;
|
|
|
|
|
@ -662,7 +662,7 @@ class SOAPViewModel extends BaseViewModel {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PostChiefComplaintRequestModel createPostChiefComplaintRequestModel({patientInfo, String? complaintsText, String? medicationText, String? illnessText}) {
|
|
|
|
|
return new PostChiefComplaintRequestModel(
|
|
|
|
|
return PostChiefComplaintRequestModel(
|
|
|
|
|
admissionNo: patientInfo.admissionNo != null ? int.parse(patientInfo.admissionNo) : null,
|
|
|
|
|
patientMRN: patientInfo.patientMRN,
|
|
|
|
|
episodeID: patientInfo.episodeNo ?? 0,
|
|
|
|
|
|