@ -45,52 +45,39 @@ class SOAPViewModel extends BaseViewModel {
List < MasterKeyModel > get allergiesList = > _SOAPService . allergiesList ;
List < MasterKeyModel > get allergiesList = > _SOAPService . allergiesList ;
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 = >
List < MasterKeyModel > get historyMedicalList = > _SOAPService . historyMedicalList ;
_SOAPService . historyMedicalList ;
List < MasterKeyModel > get historySportList = > _SOAPService . historySportList ;
List < MasterKeyModel > get historySportList = > _SOAPService . historySportList ;
List < MasterKeyModel > get historySocialList = > _SOAPService . historySocialList ;
List < MasterKeyModel > get historySocialList = > _SOAPService . historySocialList ;
List < MasterKeyModel > get historySurgicalList = >
List < MasterKeyModel > get historySurgicalList = > _SOAPService . historySurgicalList ;
_SOAPService . historySurgicalList ;
List < MasterKeyModel > get mergeHistorySurgicalWithHistorySportList = >
List < MasterKeyModel > get mergeHistorySurgicalWithHistorySportList = > [ . . . historySurgicalList , . . . historySportList ] ;
[ . . . historySurgicalList , . . . historySportList ] ;
List < MasterKeyModel > get physicalExaminationList = >
List < MasterKeyModel > get physicalExaminationList = > _SOAPService . physicalExaminationList ;
_SOAPService . physicalExaminationList ;
List < MasterKeyModel > get listOfDiagnosisType = >
List < MasterKeyModel > get listOfDiagnosisType = > _SOAPService . listOfDiagnosisType ;
_SOAPService . listOfDiagnosisType ;
List < MasterKeyModel > get listOfDiagnosisCondition = >
List < MasterKeyModel > get listOfDiagnosisCondition = > _SOAPService . listOfDiagnosisCondition ;
_SOAPService . listOfDiagnosisCondition ;
List < MasterKeyModel > get listOfICD10 = > _SOAPService . listOfICD10 ;
List < MasterKeyModel > get listOfICD10 = > _SOAPService . listOfICD10 ;
List < GetChiefComplaintResModel > get patientChiefComplaintList = >
List < GetChiefComplaintResModel > get patientChiefComplaintList = > _SOAPService . patientChiefComplaintList ;
_SOAPService . patientChiefComplaintList ;
List < GetAllergiesResModel > get patientAllergiesList = >
List < GetAllergiesResModel > get patientAllergiesList = > _SOAPService . patientAllergiesList ;
_SOAPService . patientAllergiesList ;
List < GetHistoryResModel > get patientHistoryList = >
List < GetHistoryResModel > get patientHistoryList = > _SOAPService . patientHistoryList ;
_SOAPService . patientHistoryList ;
List < GetPhysicalExamResModel > get patientPhysicalExamList = >
List < GetPhysicalExamResModel > get patientPhysicalExamList = > _SOAPService . patientPhysicalExamList ;
_SOAPService . patientPhysicalExamList ;
List < GetPatientProgressNoteResModel > get patientProgressNoteList = >
List < GetPatientProgressNoteResModel > get patientProgressNoteList = > _SOAPService . patientProgressNoteList ;
_SOAPService . patientProgressNoteList ;
List < GetAssessmentResModel > get patientAssessmentList = >
List < GetAssessmentResModel > get patientAssessmentList = > _SOAPService . patientAssessmentList ;
_SOAPService . patientAssessmentList ;
int get episodeID = > _SOAPService . episodeID ;
int get episodeID = > _SOAPService . episodeID ;
@ -109,8 +96,7 @@ class SOAPViewModel extends BaseViewModel {
get medicationFrequencyList = > _SOAPService . medicationFrequencyListWithModel ;
get medicationFrequencyList = > _SOAPService . medicationFrequencyListWithModel ;
List < GetMedicationResponseModel > get allMedicationList = >
List < GetMedicationResponseModel > get allMedicationList = > _prescriptionService . allMedicationList ;
_prescriptionService . allMedicationList ;
SubjectiveCallBack subjectiveCallBack ;
SubjectiveCallBack subjectiveCallBack ;
@ -151,13 +137,13 @@ class SOAPViewModel extends BaseViewModel {
nextOnPlanPage ( model ) {
nextOnPlanPage ( model ) {
planCallBack . nextFunction ( model ) ;
planCallBack . nextFunction ( model ) ;
}
}
Future getMasterLookup ( MasterKeysService masterKeys ,
{ bool isBusyLocal = false } ) async {
Future getMasterLookup ( MasterKeysService masterKeys , { bool isBusyLocal = false , String searchKey = " " } ) async {
if ( isBusyLocal ) {
if ( isBusyLocal ) {
setState ( ViewState . Busy ) ;
setState ( ViewState . Busy ) ;
} else
} else
setState ( ViewState . Busy ) ;
setState ( ViewState . Busy ) ;
await _SOAPService . getMasterLookup ( masterKeys );
await _SOAPService . getMasterLookup ( masterKeys , searchKey: searchKey );
if ( _SOAPService . hasError ) {
if ( _SOAPService . hasError ) {
error = _SOAPService . error ;
error = _SOAPService . error ;
setState ( ViewState . Error ) ;
setState ( ViewState . Error ) ;
@ -175,12 +161,9 @@ class SOAPViewModel extends BaseViewModel {
setState ( ViewState . Idle ) ;
setState ( ViewState . Idle ) ;
}
}
Future postEpisodeForInPatient (
Future postEpisodeForInPatient ( PostEpisodeForInpatientRequestModel postEpisodeForInpatientRequestModel ) async {
PostEpisodeForInpatientRequestModel
postEpisodeForInpatientRequestModel ) async {
setState ( ViewState . BusyLocal ) ;
setState ( ViewState . BusyLocal ) ;
await _SOAPService . postEpisodeForInPatient (
await _SOAPService . postEpisodeForInPatient ( postEpisodeForInpatientRequestModel ) ;
postEpisodeForInpatientRequestModel ) ;
if ( _SOAPService . hasError ) {
if ( _SOAPService . hasError ) {
error = _SOAPService . error ;
error = _SOAPService . error ;
setState ( ViewState . ErrorLocal ) ;
setState ( ViewState . ErrorLocal ) ;
@ -188,8 +171,7 @@ class SOAPViewModel extends BaseViewModel {
setState ( ViewState . Idle ) ;
setState ( ViewState . Idle ) ;
}
}
Future postPhysicalExam (
Future postPhysicalExam ( PostPhysicalExamRequestModel postPhysicalExamRequestModel ) async {
PostPhysicalExamRequestModel postPhysicalExamRequestModel ) async {
setState ( ViewState . BusyLocal ) ;
setState ( ViewState . BusyLocal ) ;
await _SOAPService . postPhysicalExam ( postPhysicalExamRequestModel ) ;
await _SOAPService . postPhysicalExam ( postPhysicalExamRequestModel ) ;
if ( _SOAPService . hasError ) {
if ( _SOAPService . hasError ) {
@ -199,8 +181,7 @@ class SOAPViewModel extends BaseViewModel {
setState ( ViewState . Idle ) ;
setState ( ViewState . Idle ) ;
}
}
Future postProgressNote (
Future postProgressNote ( PostProgressNoteRequestModel postProgressNoteRequestModel ) async {
PostProgressNoteRequestModel postProgressNoteRequestModel ) async {
setState ( ViewState . BusyLocal ) ;
setState ( ViewState . BusyLocal ) ;
await _SOAPService . postProgressNote ( postProgressNoteRequestModel ) ;
await _SOAPService . postProgressNote ( postProgressNoteRequestModel ) ;
if ( _SOAPService . hasError ) {
if ( _SOAPService . hasError ) {
@ -210,8 +191,7 @@ class SOAPViewModel extends BaseViewModel {
setState ( ViewState . Idle ) ;
setState ( ViewState . Idle ) ;
}
}
Future postAssessment (
Future postAssessment ( PostAssessmentRequestModel postAssessmentRequestModel ) async {
PostAssessmentRequestModel postAssessmentRequestModel ) async {
setState ( ViewState . BusyLocal ) ;
setState ( ViewState . BusyLocal ) ;
await _SOAPService . postAssessment ( postAssessmentRequestModel ) ;
await _SOAPService . postAssessment ( postAssessmentRequestModel ) ;
if ( _SOAPService . hasError ) {
if ( _SOAPService . hasError ) {
@ -221,8 +201,7 @@ class SOAPViewModel extends BaseViewModel {
setState ( ViewState . Idle ) ;
setState ( ViewState . Idle ) ;
}
}
Future patchPhysicalExam (
Future patchPhysicalExam ( PostPhysicalExamRequestModel patchPhysicalExamRequestModel ) async {
PostPhysicalExamRequestModel patchPhysicalExamRequestModel ) async {
setState ( ViewState . BusyLocal ) ;
setState ( ViewState . BusyLocal ) ;
await _SOAPService . patchPhysicalExam ( patchPhysicalExamRequestModel ) ;
await _SOAPService . patchPhysicalExam ( patchPhysicalExamRequestModel ) ;
if ( _SOAPService . hasError ) {
if ( _SOAPService . hasError ) {
@ -232,8 +211,7 @@ class SOAPViewModel extends BaseViewModel {
setState ( ViewState . Idle ) ;
setState ( ViewState . Idle ) ;
}
}
Future patchProgressNote (
Future patchProgressNote ( PostProgressNoteRequestModel patchProgressNoteRequestModel ) async {
PostProgressNoteRequestModel patchProgressNoteRequestModel ) async {
setState ( ViewState . BusyLocal ) ;
setState ( ViewState . BusyLocal ) ;
await _SOAPService . patchProgressNote ( patchProgressNoteRequestModel ) ;
await _SOAPService . patchProgressNote ( patchProgressNoteRequestModel ) ;
if ( _SOAPService . hasError ) {
if ( _SOAPService . hasError ) {
@ -243,8 +221,7 @@ class SOAPViewModel extends BaseViewModel {
setState ( ViewState . Idle ) ;
setState ( ViewState . Idle ) ;
}
}
Future patchAssessment (
Future patchAssessment ( PatchAssessmentReqModel patchAssessmentRequestModel ) async {
PatchAssessmentReqModel patchAssessmentRequestModel ) async {
setState ( ViewState . BusyLocal ) ;
setState ( ViewState . BusyLocal ) ;
await _SOAPService . patchAssessment ( patchAssessmentRequestModel ) ;
await _SOAPService . patchAssessment ( patchAssessmentRequestModel ) ;
if ( _SOAPService . hasError ) {
if ( _SOAPService . hasError ) {
@ -254,8 +231,7 @@ class SOAPViewModel extends BaseViewModel {
setState ( ViewState . Idle ) ;
setState ( ViewState . Idle ) ;
}
}
Future getPatientAllergy ( GeneralGetReqForSOAP generalGetReqForSOAP ,
Future getPatientAllergy ( GeneralGetReqForSOAP generalGetReqForSOAP , { isLocalBusy = false } ) async {
{ isLocalBusy = false } ) async {
if ( isLocalBusy ) {
if ( isLocalBusy ) {
setState ( ViewState . BusyLocal ) ;
setState ( ViewState . BusyLocal ) ;
} else
} else
@ -274,14 +250,8 @@ class SOAPViewModel extends BaseViewModel {
String getAllergicNames ( isArabic ) {
String getAllergicNames ( isArabic ) {
String allergiesString = ' ' ;
String allergiesString = ' ' ;
patientAllergiesList . forEach ( ( element ) {
patientAllergiesList . forEach ( ( element ) {
MasterKeyModel selectedAllergy = getOneMasterKey (
MasterKeyModel selectedAllergy = getOneMasterKey ( masterKeys: MasterKeysService . Allergies , id: element . allergyDiseaseId , typeId: element . allergyDiseaseType ) ;
masterKeys: MasterKeysService . Allergies ,
if ( selectedAllergy ! = null & & element . isChecked ) allergiesString + = ( isArabic ? selectedAllergy . nameAr : selectedAllergy . nameEn ) + ' , ' ;
id: element . allergyDiseaseId ,
typeId: element . allergyDiseaseType ) ;
if ( selectedAllergy ! = null & & element . isChecked )
allergiesString + =
( isArabic ? selectedAllergy . nameAr : selectedAllergy . nameEn ) +
' , ' ;
} ) ;
} ) ;
return allergiesString ;
return allergiesString ;
}
}
@ -291,9 +261,7 @@ class SOAPViewModel extends BaseViewModel {
) async {
) async {
GetPhysicalExamReqModel getPhysicalExamReqModel = GetPhysicalExamReqModel (
GetPhysicalExamReqModel getPhysicalExamReqModel = GetPhysicalExamReqModel (
patientMRN: patientInfo . patientMRN ,
patientMRN: patientInfo . patientMRN ,
episodeID: patientInfo . episodeNo = = null
episodeID: patientInfo . episodeNo = = null ? " 0 " : patientInfo . episodeNo . toString ( ) ,
? " 0 "
: patientInfo . episodeNo . toString ( ) ,
appointmentNo: patientInfo . appointmentNo = = null
appointmentNo: patientInfo . appointmentNo = = null
? 0
? 0
: int . parse (
: int . parse (
@ -313,8 +281,7 @@ class SOAPViewModel extends BaseViewModel {
setState ( ViewState . Idle ) ;
setState ( ViewState . Idle ) ;
}
}
Future getPatientProgressNote (
Future getPatientProgressNote ( GetProgressNoteReqModel getGetProgressNoteReqModel ) async {
GetProgressNoteReqModel getGetProgressNoteReqModel ) async {
setState ( ViewState . Busy ) ;
setState ( ViewState . Busy ) ;
await _SOAPService . getPatientProgressNote ( getGetProgressNoteReqModel ) ;
await _SOAPService . getPatientProgressNote ( getGetProgressNoteReqModel ) ;
if ( _SOAPService . hasError ) {
if ( _SOAPService . hasError ) {
@ -324,7 +291,6 @@ class SOAPViewModel extends BaseViewModel {
setState ( ViewState . Idle ) ;
setState ( ViewState . Idle ) ;
}
}
Future getMedicationList ( ) async {
Future getMedicationList ( ) async {
setState ( ViewState . Busy ) ;
setState ( ViewState . Busy ) ;
await _prescriptionService . getMedicationList ( ) ;
await _prescriptionService . getMedicationList ( ) ;
@ -337,11 +303,7 @@ class SOAPViewModel extends BaseViewModel {
Future getEpisodeForInpatient ( PatiantInformtion patient ) async {
Future getEpisodeForInpatient ( PatiantInformtion patient ) async {
setState ( ViewState . BusyLocal ) ;
setState ( ViewState . BusyLocal ) ;
GetEpisodeForInpatientReqModel getEpisodeForInpatientReqModel =
GetEpisodeForInpatientReqModel getEpisodeForInpatientReqModel = GetEpisodeForInpatientReqModel ( patientID: patient . patientId , admissionNo: int . parse ( patient . admissionNo ) , patientTypeID: 1 ) ;
GetEpisodeForInpatientReqModel (
patientID: patient . patientId ,
admissionNo: int . parse ( patient . admissionNo ) ,
patientTypeID: 1 ) ;
await _SOAPService . getEpisodeForInpatient ( getEpisodeForInpatientReqModel ) ;
await _SOAPService . getEpisodeForInpatient ( getEpisodeForInpatientReqModel ) ;
if ( _SOAPService . hasError ) {
if ( _SOAPService . hasError ) {
error = _SOAPService . error ;
error = _SOAPService . error ;
@ -353,13 +315,11 @@ class SOAPViewModel extends BaseViewModel {
}
}
/ / ignore: missing_return
/ / ignore: missing_return
MasterKeyModel getOneMasterKey (
MasterKeyModel getOneMasterKey ( { @ required MasterKeysService masterKeys , dynamic id , int typeId } ) {
{ @ required MasterKeysService masterKeys , dynamic id , int typeId } ) {
switch ( masterKeys ) {
switch ( masterKeys ) {
case MasterKeysService . Allergies:
case MasterKeysService . Allergies:
List < MasterKeyModel > result = allergiesList . where ( ( element ) {
List < MasterKeyModel > result = allergiesList . where ( ( element ) {
return element . id = = id & &
return element . id = = id & & element . typeId = = masterKeys . getMasterKeyService ( ) ;
element . typeId = = masterKeys . getMasterKeyService ( ) ;
} ) . toList ( ) ;
} ) . toList ( ) ;
if ( result . isNotEmpty ) {
if ( result . isNotEmpty ) {
return result . first ;
return result . first ;
@ -368,8 +328,7 @@ class SOAPViewModel extends BaseViewModel {
case MasterKeysService . HistoryFamily:
case MasterKeysService . HistoryFamily:
List < MasterKeyModel > result = historyFamilyList . where ( ( element ) {
List < MasterKeyModel > result = historyFamilyList . where ( ( element ) {
return element . id = = id & &
return element . id = = id & & element . typeId = = masterKeys . getMasterKeyService ( ) ;
element . typeId = = masterKeys . getMasterKeyService ( ) ;
} ) . toList ( ) ;
} ) . toList ( ) ;
if ( result . isNotEmpty ) {
if ( result . isNotEmpty ) {
return result . first ;
return result . first ;
@ -377,8 +336,7 @@ class SOAPViewModel extends BaseViewModel {
break ;
break ;
case MasterKeysService . HistoryMedical:
case MasterKeysService . HistoryMedical:
List < MasterKeyModel > result = historyMedicalList . where ( ( element ) {
List < MasterKeyModel > result = historyMedicalList . where ( ( element ) {
return element . id = = id & &
return element . id = = id & & element . typeId = = masterKeys . getMasterKeyService ( ) ;
element . typeId = = masterKeys . getMasterKeyService ( ) ;
} ) . toList ( ) ;
} ) . toList ( ) ;
if ( result . isNotEmpty ) {
if ( result . isNotEmpty ) {
return result . first ;
return result . first ;
@ -386,8 +344,7 @@ class SOAPViewModel extends BaseViewModel {
break ;
break ;
case MasterKeysService . HistorySocial:
case MasterKeysService . HistorySocial:
List < MasterKeyModel > result = historySocialList . where ( ( element ) {
List < MasterKeyModel > result = historySocialList . where ( ( element ) {
return element . id = = id & &
return element . id = = id & & element . typeId = = masterKeys . getMasterKeyService ( ) ;
element . typeId = = masterKeys . getMasterKeyService ( ) ;
} ) . toList ( ) ;
} ) . toList ( ) ;
if ( result . isNotEmpty ) {
if ( result . isNotEmpty ) {
return result . first ;
return result . first ;
@ -395,8 +352,7 @@ class SOAPViewModel extends BaseViewModel {
break ;
break ;
case MasterKeysService . HistorySports:
case MasterKeysService . HistorySports:
List < MasterKeyModel > result = historySocialList . where ( ( element ) {
List < MasterKeyModel > result = historySocialList . where ( ( element ) {
return element . id = = id & &
return element . id = = id & & element . typeId = = masterKeys . getMasterKeyService ( ) ;
element . typeId = = masterKeys . getMasterKeyService ( ) ;
} ) . toList ( ) ;
} ) . toList ( ) ;
if ( result . isNotEmpty ) {
if ( result . isNotEmpty ) {
return result . first ;
return result . first ;
@ -412,8 +368,7 @@ class SOAPViewModel extends BaseViewModel {
break ;
break ;
case MasterKeysService . PhysicalExamination:
case MasterKeysService . PhysicalExamination:
List < MasterKeyModel > result = physicalExaminationList . where ( ( element ) {
List < MasterKeyModel > result = physicalExaminationList . where ( ( element ) {
return element . id = = id & &
return element . id = = id & & element . typeId = = masterKeys . getMasterKeyService ( ) ;
element . typeId = = masterKeys . getMasterKeyService ( ) ;
} ) . toList ( ) ;
} ) . toList ( ) ;
if ( result . isNotEmpty ) {
if ( result . isNotEmpty ) {
return result . first ;
return result . first ;
@ -421,8 +376,7 @@ class SOAPViewModel extends BaseViewModel {
break ;
break ;
case MasterKeysService . AllergySeverity:
case MasterKeysService . AllergySeverity:
List < MasterKeyModel > result = allergySeverityList . where ( ( element ) {
List < MasterKeyModel > result = allergySeverityList . where ( ( element ) {
return element . id = = id & &
return element . id = = id & & element . typeId = = masterKeys . getMasterKeyService ( ) ;
element . typeId = = masterKeys . getMasterKeyService ( ) ;
} ) . toList ( ) ;
} ) . toList ( ) ;
if ( result . isNotEmpty ) {
if ( result . isNotEmpty ) {
return result . first ;
return result . first ;
@ -430,8 +384,7 @@ class SOAPViewModel extends BaseViewModel {
break ;
break ;
case MasterKeysService . DiagnosisType:
case MasterKeysService . DiagnosisType:
List < MasterKeyModel > result = listOfDiagnosisType . where ( ( element ) {
List < MasterKeyModel > result = listOfDiagnosisType . where ( ( element ) {
return element . id = = id & &
return element . id = = id & & element . typeId = = masterKeys . getMasterKeyService ( ) ;
element . typeId = = masterKeys . getMasterKeyService ( ) ;
} ) . toList ( ) ;
} ) . toList ( ) ;
if ( result . isNotEmpty ) {
if ( result . isNotEmpty ) {
return result . first ;
return result . first ;
@ -439,8 +392,7 @@ class SOAPViewModel extends BaseViewModel {
break ;
break ;
case MasterKeysService . DiagnosisCondition:
case MasterKeysService . DiagnosisCondition:
List < MasterKeyModel > result = listOfDiagnosisCondition . where ( ( element ) {
List < MasterKeyModel > result = listOfDiagnosisCondition . where ( ( element ) {
return element . id = = id & &
return element . id = = id & & element . typeId = = masterKeys . getMasterKeyService ( ) ;
element . typeId = = masterKeys . getMasterKeyService ( ) ;
} ) . toList ( ) ;
} ) . toList ( ) ;
if ( result . isNotEmpty ) {
if ( result . isNotEmpty ) {
return result . first ;
return result . first ;
@ -458,10 +410,8 @@ class SOAPViewModel extends BaseViewModel {
}
}
}
}
int getFirstIndexForOldExamination (
int getFirstIndexForOldExamination ( List < MySelectedExamination > mySelectedExamination ) {
List < MySelectedExamination > mySelectedExamination ) {
Iterable < MySelectedExamination > examList = mySelectedExamination . where ( ( element ) = > ! element . isLocal ) ;
Iterable < MySelectedExamination > examList =
mySelectedExamination . where ( ( element ) = > ! element . isLocal ) ;
if ( examList . length > 0 ) {
if ( examList . length > 0 ) {
return mySelectedExamination . indexOf ( examList . first ) ;
return mySelectedExamination . indexOf ( examList . first ) ;
@ -470,44 +420,25 @@ class SOAPViewModel extends BaseViewModel {
}
}
onUpdateSubjectStepStart ( PatiantInformtion patientInfo ) async {
onUpdateSubjectStepStart ( PatiantInformtion patientInfo ) async {
GetChiefComplaintReqModel getChiefComplaintReqModel =
GetChiefComplaintReqModel getChiefComplaintReqModel = GetChiefComplaintReqModel (
GetChiefComplaintReqModel (
admissionNo: patientInfo . admissionNo ! = null ? int . parse ( patientInfo . admissionNo ) : null ,
admissionNo:
patientInfo
. admissionNo ! =
null
? int . parse ( patientInfo . admissionNo )
: null ,
patientMRN: patientInfo . patientMRN ,
patientMRN: patientInfo . patientMRN ,
appointmentNo: patientInfo . appointmentNo ! = null
appointmentNo: patientInfo . appointmentNo ! = null ? int . parse ( patientInfo . appointmentNo . toString ( ) ) : null ,
? int . parse ( patientInfo . appointmentNo . toString ( ) )
: null ,
episodeId: patientInfo . episodeNo ,
episodeId: patientInfo . episodeNo ,
episodeID: patientInfo . episodeNo ,
episodeID: patientInfo . episodeNo ,
doctorID: ' ' ) ;
doctorID: ' ' ) ;
var services = [
var services = [ _SOAPService . getPatientChiefComplaint ( getChiefComplaintReqModel ) ] ;
_SOAPService . getPatientChiefComplaint ( getChiefComplaintReqModel )
] ;
if ( patientInfo . admissionNo = = null ) {
if ( patientInfo . admissionNo = = null ) {
complaintsControllerError = ' ' ;
complaintsControllerError = ' ' ;
medicationControllerError = ' ' ;
medicationControllerError = ' ' ;
illnessControllerError = ' ' ;
illnessControllerError = ' ' ;
GetHistoryReqModel getHistoryReqModel = GetHistoryReqModel (
GetHistoryReqModel getHistoryReqModel = GetHistoryReqModel (
patientMRN: patientInfo . patientMRN ,
patientMRN: patientInfo . patientMRN , episodeID: patientInfo . episodeNo . toString ( ) , appointmentNo: int . parse ( patientInfo . appointmentNo . toString ( ) ) , doctorID: ' ' , editedBy: ' ' ) ;
episodeID: patientInfo . episodeNo . toString ( ) ,
services . add ( _SOAPService . getPatientHistories ( getHistoryReqModel , isFirst: true ) ) ;
appointmentNo: int . parse ( patientInfo . appointmentNo . toString ( ) ) ,
doctorID: ' ' ,
editedBy: ' ' ) ;
services . add (
_SOAPService . getPatientHistories ( getHistoryReqModel , isFirst: true ) ) ;
GeneralGetReqForSOAP generalGetReqForSOAP = GeneralGetReqForSOAP (
GeneralGetReqForSOAP generalGetReqForSOAP =
patientMRN: patientInfo . patientMRN ,
GeneralGetReqForSOAP ( patientMRN: patientInfo . patientMRN , episodeId: patientInfo . episodeNo , appointmentNo: int . parse ( patientInfo . appointmentNo . toString ( ) ) , doctorID: ' ' , editedBy: ' ' ) ;
episodeId: patientInfo . episodeNo ,
appointmentNo: int . parse ( patientInfo . appointmentNo . toString ( ) ) ,
doctorID: ' ' ,
editedBy: ' ' ) ;
services . add ( _SOAPService . getPatientAllergy ( generalGetReqForSOAP ) ) ;
services . add ( _SOAPService . getPatientAllergy ( generalGetReqForSOAP ) ) ;
}
}
@ -521,40 +452,28 @@ class SOAPViewModel extends BaseViewModel {
if ( patientHistoryList . isNotEmpty ) {
if ( patientHistoryList . isNotEmpty ) {
if ( historyFamilyList . isEmpty ) {
if ( historyFamilyList . isEmpty ) {
if ( services = = null ) {
if ( services = = null ) {
services = [
services = [ _SOAPService . getMasterLookup ( MasterKeysService . HistoryFamily ) ] ;
_SOAPService . getMasterLookup ( MasterKeysService . HistoryFamily )
] ;
} else {
} else {
services . add (
services . add ( _SOAPService . getMasterLookup ( MasterKeysService . HistoryFamily ) ) ;
_SOAPService . getMasterLookup ( MasterKeysService . HistoryFamily ) ) ;
}
}
}
}
if ( historyMedicalList . isEmpty ) {
if ( historyMedicalList . isEmpty ) {
if ( services = = null ) {
if ( services = = null ) {
services = [
services = [ _SOAPService . getMasterLookup ( MasterKeysService . HistoryMedical ) ] ;
_SOAPService . getMasterLookup ( MasterKeysService . HistoryMedical )
] ;
} else
} else
services . add (
services . add ( _SOAPService . getMasterLookup ( MasterKeysService . HistoryMedical ) ) ;
_SOAPService . getMasterLookup ( MasterKeysService . HistoryMedical ) ) ;
}
}
if ( historySurgicalList . length = = 0 ) {
if ( historySurgicalList . length = = 0 ) {
if ( services = = null ) {
if ( services = = null ) {
services = [
services = [ _SOAPService . getMasterLookup ( MasterKeysService . HistorySurgical ) ] ;
_SOAPService . getMasterLookup ( MasterKeysService . HistorySurgical )
] ;
} else
} else
services . add (
services . add ( _SOAPService . getMasterLookup ( MasterKeysService . HistorySurgical ) ) ;
_SOAPService . getMasterLookup ( MasterKeysService . HistorySurgical ) ) ;
}
}
if ( historySportList . length = = 0 ) {
if ( historySportList . length = = 0 ) {
if ( services = = null ) {
if ( services = = null ) {
services = [
services = [ _SOAPService . getMasterLookup ( MasterKeysService . HistorySports ) ] ;
_SOAPService . getMasterLookup ( MasterKeysService . HistorySports )
] ;
} else
} else
services . add (
services . add ( _SOAPService . getMasterLookup ( MasterKeysService . HistorySports ) ) ;
_SOAPService . getMasterLookup ( MasterKeysService . HistorySports ) ) ;
}
}
}
}
@ -565,12 +484,9 @@ class SOAPViewModel extends BaseViewModel {
services . add ( _SOAPService . getMasterLookup ( MasterKeysService . Allergies ) ) ;
services . add ( _SOAPService . getMasterLookup ( MasterKeysService . Allergies ) ) ;
if ( allergySeverityList . isEmpty ) {
if ( allergySeverityList . isEmpty ) {
if ( services = = null ) {
if ( services = = null ) {
services = [
services = [ _SOAPService . getMasterLookup ( MasterKeysService . AllergySeverity ) ] ;
_SOAPService . getMasterLookup ( MasterKeysService . AllergySeverity )
] ;
} else
} else
services . add (
services . add ( _SOAPService . getMasterLookup ( MasterKeysService . AllergySeverity ) ) ;
_SOAPService . getMasterLookup ( MasterKeysService . AllergySeverity ) ) ;
}
}
}
}
@ -588,42 +504,30 @@ class SOAPViewModel extends BaseViewModel {
var services ;
var services ;
if ( medicationStrengthList . length = = 0 ) {
if ( medicationStrengthList . length = = 0 ) {
if ( services = = null ) {
if ( services = = null ) {
services = [
services = [ _SOAPService . getMasterLookup ( MasterKeysService . MedicationStrength ) ] ;
_SOAPService . getMasterLookup ( MasterKeysService . MedicationStrength )
] ;
} else {
} else {
services . add (
services . add ( _SOAPService . getMasterLookup ( MasterKeysService . MedicationStrength ) ) ;
_SOAPService . getMasterLookup ( MasterKeysService . MedicationStrength ) ) ;
}
}
}
}
if ( medicationFrequencyList . length = = 0 ) {
if ( medicationFrequencyList . length = = 0 ) {
if ( services = = null ) {
if ( services = = null ) {
services = [
services = [ _SOAPService . getMasterLookup ( MasterKeysService . MedicationFrequency ) ] ;
_SOAPService . getMasterLookup ( MasterKeysService . MedicationFrequency )
] ;
} else {
} else {
services . add ( _SOAPService . getMasterLookup (
services . add ( _SOAPService . getMasterLookup ( MasterKeysService . MedicationFrequency ) ) ;
MasterKeysService . MedicationFrequency ) ) ;
}
}
}
}
if ( medicationDoseTimeList . length = = 0 ) {
if ( medicationDoseTimeList . length = = 0 ) {
if ( services = = null ) {
if ( services = = null ) {
services = [
services = [ _SOAPService . getMasterLookup ( MasterKeysService . MedicationDoseTime ) ] ;
_SOAPService . getMasterLookup ( MasterKeysService . MedicationDoseTime )
] ;
} else {
} else {
services . add (
services . add ( _SOAPService . getMasterLookup ( MasterKeysService . MedicationDoseTime ) ) ;
_SOAPService . getMasterLookup ( MasterKeysService . MedicationDoseTime ) ) ;
}
}
}
}
if ( medicationRouteList . length = = 0 ) {
if ( medicationRouteList . length = = 0 ) {
if ( services = = null ) {
if ( services = = null ) {
services = [
services = [ _SOAPService . getMasterLookup ( MasterKeysService . MedicationRoute ) ] ;
_SOAPService . getMasterLookup ( MasterKeysService . MedicationRoute )
] ;
} else {
} else {
services . add (
services . add ( _SOAPService . getMasterLookup ( MasterKeysService . MedicationRoute ) ) ;
_SOAPService . getMasterLookup ( MasterKeysService . MedicationRoute ) ) ;
}
}
}
}
if ( allMedicationList . length = = 0 ) {
if ( allMedicationList . length = = 0 ) {
@ -643,34 +547,28 @@ class SOAPViewModel extends BaseViewModel {
setState ( ViewState . Idle ) ;
setState ( ViewState . Idle ) ;
}
}
callAddAssessmentLookupsServices ( { bool allowSetState = true } ) async {
callAddAssessmentLookupsServices ( { String searchKey = " " , bool allowSetState = true } ) async {
if ( allowSetState ) setState ( ViewState . Busy ) ;
if ( allowSetState ) setState ( ViewState . Busy ) ;
var services ;
var services ;
if ( listOfDiagnosisCondition . length = = 0 ) {
if ( listOfDiagnosisCondition . length = = 0 ) {
if ( services = = null ) {
if ( services = = null ) {
services = [
services = [ _SOAPService . getMasterLookup ( MasterKeysService . DiagnosisCondition ) ] ;
_SOAPService . getMasterLookup ( MasterKeysService . DiagnosisCondition )
] ;
} else {
} else {
services . add (
services . add ( _SOAPService . getMasterLookup ( MasterKeysService . DiagnosisCondition ) ) ;
_SOAPService . getMasterLookup ( MasterKeysService . DiagnosisCondition ) ) ;
}
}
}
}
if ( listOfDiagnosisType . length = = 0 ) {
if ( listOfDiagnosisType . length = = 0 ) {
if ( services = = null ) {
if ( services = = null ) {
services = [
services = [ _SOAPService . getMasterLookup ( MasterKeysService . DiagnosisType ) ] ;
_SOAPService . getMasterLookup ( MasterKeysService . DiagnosisType )
] ;
} else {
} else {
services
services . add ( _SOAPService . getMasterLookup ( MasterKeysService . DiagnosisType ) ) ;
. add ( _SOAPService . getMasterLookup ( MasterKeysService . DiagnosisType ) ) ;
}
}
}
}
if ( listOfICD10 . length = = 0 ) {
if ( listOfICD10 . length = = 0 ) {
if ( services = = null ) {
if ( services = = null ) {
services = [ _SOAPService . getMasterLookup ( MasterKeysService . ICD10 )] ;
services = [ _SOAPService . getMasterLookup ( MasterKeysService . ICD10 , searchKey: searchKey )] ;
} else {
} else {
services . add ( _SOAPService . getMasterLookup ( MasterKeysService . ICD10 )) ;
services . add ( _SOAPService . getMasterLookup ( MasterKeysService . ICD10 , searchKey: searchKey )) ;
}
}
}
}
@ -686,11 +584,7 @@ class SOAPViewModel extends BaseViewModel {
onUpdateAssessmentStepStart ( PatiantInformtion patientInfo ) async {
onUpdateAssessmentStepStart ( PatiantInformtion patientInfo ) async {
GetAssessmentReqModel getAssessmentReqModel = GetAssessmentReqModel (
GetAssessmentReqModel getAssessmentReqModel = GetAssessmentReqModel (
patientMRN: patientInfo . patientMRN ,
patientMRN: patientInfo . patientMRN , episodeID: patientInfo . episodeNo . toString ( ) , editedBy: ' ' , doctorID: ' ' , appointmentNo: int . parse ( patientInfo . appointmentNo . toString ( ) ) ) ;
episodeID: patientInfo . episodeNo . toString ( ) ,
editedBy: ' ' ,
doctorID: ' ' ,
appointmentNo: int . parse ( patientInfo . appointmentNo . toString ( ) ) ) ;
var services = [ _SOAPService . getPatientAssessment ( getAssessmentReqModel ) ] ;
var services = [ _SOAPService . getPatientAssessment ( getAssessmentReqModel ) ] ;
@ -707,37 +601,21 @@ class SOAPViewModel extends BaseViewModel {
setState ( ViewState . Idle ) ;
setState ( ViewState . Idle ) ;
}
}
postSubjectServices (
postSubjectServices ( { patientInfo , String complaintsText , String medicationText , String illnessText , List < MySelectedHistory > myHistoryList , List < MySelectedAllergy > myAllergiesList } ) async {
{ patientInfo ,
String complaintsText ,
String medicationText ,
String illnessText ,
List < MySelectedHistory > myHistoryList ,
List < MySelectedAllergy > myAllergiesList } ) async {
var services ;
var services ;
PostChiefComplaintRequestModel postChiefComplaintRequestModel =
PostChiefComplaintRequestModel postChiefComplaintRequestModel =
createPostChiefComplaintRequestModel (
createPostChiefComplaintRequestModel ( patientInfo: patientInfo , illnessText: illnessText , medicationText: medicationText , complaintsText: complaintsText ) ;
patientInfo: patientInfo ,
illnessText: illnessText ,
medicationText: medicationText ,
complaintsText: complaintsText ) ;
if ( patientChiefComplaintList . isEmpty ) {
if ( patientChiefComplaintList . isEmpty ) {
postChiefComplaintRequestModel . editedBy = ' ' ;
postChiefComplaintRequestModel . editedBy = ' ' ;
services = [
services = [ _SOAPService . postChiefComplaint ( postChiefComplaintRequestModel ) ] ;
_SOAPService . postChiefComplaint ( postChiefComplaintRequestModel )
] ;
} else {
} else {
postChiefComplaintRequestModel . editedBy = ' ' ;
postChiefComplaintRequestModel . editedBy = ' ' ;
services = [
services = [ _SOAPService . patchChiefComplaint ( postChiefComplaintRequestModel ) ] ;
_SOAPService . patchChiefComplaint ( postChiefComplaintRequestModel )
] ;
}
}
if ( myHistoryList . length ! = 0 ) {
if ( myHistoryList . length ! = 0 ) {
PostHistoriesRequestModel postHistoriesRequestModel =
PostHistoriesRequestModel postHistoriesRequestModel = createPostHistoriesRequestModel ( patientInfo: patientInfo , myHistoryList: myHistoryList ) ;
createPostHistoriesRequestModel (
patientInfo: patientInfo , myHistoryList: myHistoryList ) ;
if ( patientHistoryList . isEmpty ) {
if ( patientHistoryList . isEmpty ) {
services . add ( _SOAPService . postHistories ( postHistoriesRequestModel ) ) ;
services . add ( _SOAPService . postHistories ( postHistoriesRequestModel ) ) ;
@ -747,9 +625,7 @@ class SOAPViewModel extends BaseViewModel {
}
}
if ( myAllergiesList . length ! = 0 ) {
if ( myAllergiesList . length ! = 0 ) {
PostAllergyRequestModel postAllergyRequestModel =
PostAllergyRequestModel postAllergyRequestModel = createPostAllergyRequestModel ( myAllergiesList: myAllergiesList , patientInfo: patientInfo ) ;
createPostAllergyRequestModel (
myAllergiesList: myAllergiesList , patientInfo: patientInfo ) ;
if ( patientAllergiesList . isEmpty ) {
if ( patientAllergiesList . isEmpty ) {
services . add ( _SOAPService . postAllergy ( postAllergyRequestModel ) ) ;
services . add ( _SOAPService . postAllergy ( postAllergyRequestModel ) ) ;
} else {
} else {
@ -766,15 +642,9 @@ class SOAPViewModel extends BaseViewModel {
setState ( ViewState . Idle ) ;
setState ( ViewState . Idle ) ;
}
}
PostChiefComplaintRequestModel createPostChiefComplaintRequestModel (
PostChiefComplaintRequestModel createPostChiefComplaintRequestModel ( { patientInfo , String complaintsText , String medicationText , String illnessText } ) {
{ patientInfo ,
String complaintsText ,
String medicationText ,
String illnessText } ) {
return new PostChiefComplaintRequestModel (
return new PostChiefComplaintRequestModel (
admissionNo: patientInfo . admissionNo ! = null
admissionNo: patientInfo . admissionNo ! = null ? int . parse ( patientInfo . admissionNo ) : null ,
? int . parse ( patientInfo . admissionNo )
: null ,
patientMRN: patientInfo . patientMRN ,
patientMRN: patientInfo . patientMRN ,
episodeID: patientInfo . episodeNo ? ? 0 ,
episodeID: patientInfo . episodeNo ? ? 0 ,
appointmentNo: patientInfo . appointmentNo ? ? 0 ,
appointmentNo: patientInfo . appointmentNo ? ? 0 ,
@ -787,13 +657,10 @@ class SOAPViewModel extends BaseViewModel {
numberOfWeeks: 0 ) ;
numberOfWeeks: 0 ) ;
}
}
PostHistoriesRequestModel createPostHistoriesRequestModel (
PostHistoriesRequestModel createPostHistoriesRequestModel ( { patientInfo , List < MySelectedHistory > myHistoryList } ) {
{ patientInfo , List < MySelectedHistory > myHistoryList } ) {
PostHistoriesRequestModel postHistoriesRequestModel = new PostHistoriesRequestModel ( doctorID: ' ' ) ;
PostHistoriesRequestModel postHistoriesRequestModel =
new PostHistoriesRequestModel ( doctorID: ' ' ) ;
myHistoryList . forEach ( ( history ) {
myHistoryList . forEach ( ( history ) {
if ( postHistoriesRequestModel . listMedicalHistoryVM = = null )
if ( postHistoriesRequestModel . listMedicalHistoryVM = = null ) postHistoriesRequestModel . listMedicalHistoryVM = [ ] ;
postHistoriesRequestModel . listMedicalHistoryVM = [ ] ;
postHistoriesRequestModel . listMedicalHistoryVM . add ( ListMedicalHistoryVM (
postHistoriesRequestModel . listMedicalHistoryVM . add ( ListMedicalHistoryVM (
patientMRN: patientInfo . patientMRN ,
patientMRN: patientInfo . patientMRN ,
episodeId: patientInfo . episodeNo ,
episodeId: patientInfo . episodeNo ,
@ -808,16 +675,11 @@ class SOAPViewModel extends BaseViewModel {
return postHistoriesRequestModel ;
return postHistoriesRequestModel ;
}
}
PostAllergyRequestModel createPostAllergyRequestModel (
PostAllergyRequestModel createPostAllergyRequestModel ( { myAllergiesList , patientInfo } ) {
{ myAllergiesList , patientInfo } ) {
PostAllergyRequestModel postAllergyRequestModel = new PostAllergyRequestModel ( ) ;
PostAllergyRequestModel postAllergyRequestModel =
new PostAllergyRequestModel ( ) ;
myAllergiesList . forEach ( ( allergy ) {
myAllergiesList . forEach ( ( allergy ) {
if ( postAllergyRequestModel . listHisProgNotePatientAllergyDiseaseVM = =
if ( postAllergyRequestModel . listHisProgNotePatientAllergyDiseaseVM = = null ) postAllergyRequestModel . listHisProgNotePatientAllergyDiseaseVM = [ ] ;
null )
postAllergyRequestModel . listHisProgNotePatientAllergyDiseaseVM . add ( ListHisProgNotePatientAllergyDiseaseVM (
postAllergyRequestModel . listHisProgNotePatientAllergyDiseaseVM = [ ] ;
postAllergyRequestModel . listHisProgNotePatientAllergyDiseaseVM . add (
ListHisProgNotePatientAllergyDiseaseVM (
allergyDiseaseId: allergy . selectedAllergy . id ,
allergyDiseaseId: allergy . selectedAllergy . id ,
allergyDiseaseType: allergy . selectedAllergy . typeId ,
allergyDiseaseType: allergy . selectedAllergy . typeId ,
patientMRN: patientInfo . patientMRN ,
patientMRN: patientInfo . patientMRN ,