Merge branch 'development-3.3' of http://34.17.52.79/Haroon6138/doctor_app_flutter into development-3.3

# Conflicts:
#	lib/screens/patients/profile/soap_update/assessment/add_assessment_details.dart
development-3.3_voipCall
Sultan khan 2 years ago
commit 8428c2f632

@ -22,7 +22,7 @@ class VitalSignData {
int patientType; int patientType;
int pulseBeatPerMinute; int pulseBeatPerMinute;
int pulseRhythm; int pulseRhythm;
int respirationBeatPerMinute; num respirationBeatPerMinute;
int respirationPattern; int respirationPattern;
int sao2; int sao2;
int status; int status;

@ -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,8 +137,8 @@ class SOAPViewModel extends BaseViewModel {
nextOnPlanPage(model) { nextOnPlanPage(model) {
planCallBack.nextFunction(model); planCallBack.nextFunction(model);
} }
Future getMasterLookup(MasterKeysService masterKeys,
{bool isBusyLocal = false, String searchKey = ""}) async { Future getMasterLookup(MasterKeysService masterKeys, {bool isBusyLocal = false, String searchKey = ""}) async {
if (isBusyLocal) { if (isBusyLocal) {
setState(ViewState.Busy); setState(ViewState.Busy);
} else } else
@ -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,

@ -14,8 +14,7 @@ class SickLeaveViewModel extends BaseViewModel {
SickLeaveService _sickLeaveService = locator<SickLeaveService>(); SickLeaveService _sickLeaveService = locator<SickLeaveService>();
PatientService _patientService = locator<PatientService>(); PatientService _patientService = locator<PatientService>();
SickLeaveStatisticsModel get sickLeaveStatistics => SickLeaveStatisticsModel get sickLeaveStatistics => _sickLeaveService.sickLeavestatisitics;
_sickLeaveService.sickLeavestatisitics;
get getAllSIckLeave => _sickLeaveService.getAllSickLeave; get getAllSIckLeave => _sickLeaveService.getAllSickLeave;
@ -31,10 +30,7 @@ class SickLeaveViewModel extends BaseViewModel {
get postSechedule => _sickLeaveService.postReschedule; get postSechedule => _sickLeaveService.postReschedule;
get getAllSIckLeavePatient => removeDuplicates([ get getAllSIckLeavePatient => removeDuplicates([..._sickLeaveService.getAllSickLeaveDoctor, ..._sickLeaveService.getAllSickLeavePatient]);
..._sickLeaveService.getAllSickLeavePatient,
..._sickLeaveService.getAllSickLeaveDoctor
]);
Future addSickLeave(AddSickLeaveRequest addSickLeaveRequest) async { Future addSickLeave(AddSickLeaveRequest addSickLeaveRequest) async {
setState(ViewState.BusyLocal); setState(ViewState.BusyLocal);
@ -89,17 +85,13 @@ class SickLeaveViewModel extends BaseViewModel {
setState(ViewState.Idle); setState(ViewState.Idle);
} }
Future getSickLeaveForPatient(PatiantInformtion patient, Future getSickLeaveForPatient(PatiantInformtion patient, {bool isLocalBusy = false}) async {
{bool isLocalBusy = false}) async {
if (isLocalBusy) if (isLocalBusy)
setState(ViewState.BusyLocal); setState(ViewState.BusyLocal);
else else
setState(ViewState.Busy); setState(ViewState.Busy);
var patientMRN = patient.patientMRN ?? patient.patientId; var patientMRN = patient.patientMRN ?? patient.patientId;
var services = [ var services = [_sickLeaveService.getSickLeavePatient(patientMRN), _sickLeaveService.getSickLeaveDoctor(patientMRN)];
_sickLeaveService.getSickLeavePatient(patientMRN),
_sickLeaveService.getSickLeaveDoctor(patientMRN)
];
final results = await Future.wait(services); final results = await Future.wait(services);
if (_sickLeaveService.hasError) { if (_sickLeaveService.hasError) {
@ -184,15 +176,13 @@ class SickLeaveViewModel extends BaseViewModel {
} else } else
setState(ViewState.Idle); setState(ViewState.Idle);
} }
List<SickLeavePatientModel> removeDuplicates(List<SickLeavePatientModel> items) { List<SickLeavePatientModel> removeDuplicates(List<SickLeavePatientModel> items) {
List<SickLeavePatientModel>uniqueItems = []; List<SickLeavePatientModel> uniqueItems = [];
var uniqueIDs = items var uniqueIDs = items.map((e) => e.appointmentNo).toSet();
.map((e) => e.appointmentNo)
.toSet();
uniqueIDs.forEach((e) { uniqueIDs.forEach((e) {
uniqueItems.add(items.firstWhere((i) => i.appointmentNo == e)); uniqueItems.add(items.firstWhere((i) => i.appointmentNo == e));
}); });
return uniqueItems; return uniqueItems;
} }
} }

@ -29,18 +29,14 @@ class PatientSickLeaveScreen extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
ProjectViewModel projectsProvider = Provider.of<ProjectViewModel>(context); ProjectViewModel projectsProvider = Provider.of<ProjectViewModel>(context);
final routeArgs = ModalRoute final routeArgs = ModalRoute.of(context).settings.arguments as Map;
.of(context)
.settings
.arguments as Map;
patient = routeArgs['patient']; patient = routeArgs['patient'];
bool isInpatient = routeArgs['isInpatient']; bool isInpatient = routeArgs['isInpatient'];
return BaseView<SickLeaveViewModel>( return BaseView<SickLeaveViewModel>(
onModelReady: (model) async { onModelReady: (model) async {
await model.getSickLeaveForPatient(patient); await model.getSickLeaveForPatient(patient);
}, },
builder: (_, model, w) => builder: (_, model, w) => AppScaffold(
AppScaffold(
baseViewModel: model, baseViewModel: model,
isShowAppBar: true, isShowAppBar: true,
backgroundColor: Colors.grey[100], backgroundColor: Colors.grey[100],
@ -67,22 +63,15 @@ class PatientSickLeaveScreen extends StatelessWidget {
), ),
if (!projectsProvider.isArabic) if (!projectsProvider.isArabic)
AppText( AppText(
TranslationBase TranslationBase.of(context).patient,
.of(context) fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * (SizeConfig.isWidthLarge ? 3 : 4),
.patient,
fontSize: SizeConfig
.getTextMultiplierBasedOnWidth() * (SizeConfig
.isWidthLarge ? 3 : 4),
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
letterSpacing: -0.72, letterSpacing: -0.72,
color: Color(0xFF2E303A), color: Color(0xFF2E303A),
), ),
AppText( AppText(
TranslationBase TranslationBase.of(context).sickLeave,
.of(context) fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * (SizeConfig.isWidthLarge ? 6 : 6),
.sickLeave,
fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *
(SizeConfig.isWidthLarge ? 6 : 6),
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
letterSpacing: -1.44, letterSpacing: -1.44,
color: Color(0xFF2E303A), color: Color(0xFF2E303A),
@ -91,9 +80,7 @@ class PatientSickLeaveScreen extends StatelessWidget {
), ),
), ),
AddNewOrder( AddNewOrder(
label: TranslationBase label: TranslationBase.of(context).noSickLeaveApplied,
.of(context)
.noSickLeaveApplied,
onTap: () async { onTap: () async {
await locator<AnalyticsService>().logEvent( await locator<AnalyticsService>().logEvent(
eventCategory: "Add Sick Leave Screen" eventCategory: "Add Sick Leave Screen"
@ -114,8 +101,7 @@ class PatientSickLeaveScreen extends StatelessWidget {
shrinkWrap: true, shrinkWrap: true,
itemCount: model.getAllSIckLeavePatient.length, itemCount: model.getAllSIckLeavePatient.length,
itemBuilder: (BuildContext ctxt, int index) { itemBuilder: (BuildContext ctxt, int index) {
SickLeavePatientModel item = model SickLeavePatientModel item = model.getAllSIckLeavePatient[index];
.getAllSIckLeavePatient[index];
return Column( return Column(
children: [ children: [
CardWithBgWidget( CardWithBgWidget(
@ -131,22 +117,16 @@ class PatientSickLeaveScreen extends StatelessWidget {
child: Column( child: Column(
children: [ children: [
if (item.doctorName != null) if (item.doctorName != null)
Row(crossAxisAlignment: CrossAxisAlignment Row(crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start, children: [
.start,
mainAxisAlignment: MainAxisAlignment
.start,
children: [
Expanded( Expanded(
// width: MediaQuery.of(context).size.width*0.51, // width: MediaQuery.of(context).size.width*0.51,
child: AppText( child: AppText(
Utils.capitalize( Utils.capitalize(item.doctorName ?? ""),
item.doctorName ?? ""),
fontSize: 18, fontSize: 18,
color: Color(0xff2e303a), color: Color(0xff2e303a),
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
fontFamily: 'Poppins', fontFamily: 'Poppins',
textOverflow: TextOverflow textOverflow: TextOverflow.ellipsis,
.ellipsis,
), ),
), ),
]), ]),
@ -156,16 +136,12 @@ class PatientSickLeaveScreen extends StatelessWidget {
Row( Row(
children: [ children: [
ClipRRect( ClipRRect(
borderRadius: BorderRadius.circular( borderRadius: BorderRadius.circular(50.0),
50.0),
child: CachedNetworkImage( child: CachedNetworkImage(
imageUrl: item.doctorImageURL ?? imageUrl: item.doctorImageURL ?? "https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown.png",
"https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown.png",
height: 30, height: 30,
width: 30, width: 30,
errorWidget: (context, url, errorWidget: (context, url, error) => AppText(
error) =>
AppText(
'No Image', 'No Image',
fontSize: 10, fontSize: 10,
), ),
@ -178,80 +154,36 @@ class PatientSickLeaveScreen extends StatelessWidget {
child: Column( child: Column(
children: [ children: [
CustomRow( CustomRow(
label: TranslationBase label: TranslationBase.of(context).daysSickleave,
.of(context) labelSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3.3,
.daysSickleave, valueSize: SizeConfig.getTextMultiplierBasedOnWidth() * 4,
labelSize: SizeConfig
.getTextMultiplierBasedOnWidth() *
3.3,
valueSize: SizeConfig
.getTextMultiplierBasedOnWidth() *
4,
value: value:
(item.sickLeaveDays (item.sickLeaveDays.toString() != null && item.sickLeaveDays.toString() != "null") ? item.sickLeaveDays.toString() : item.noOfDays.toString(),
.toString() != null &&
item.sickLeaveDays
.toString() != "null")
? item.sickLeaveDays
.toString()
: item.noOfDays
.toString(),
), ),
CustomRow( CustomRow(
label: TranslationBase label: TranslationBase.of(context).startDate + ' ' ?? "",
.of(context) labelSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3.3,
.startDate + ' ' ?? "", valueSize: SizeConfig.getTextMultiplierBasedOnWidth() * 4,
labelSize: SizeConfig value: AppDateUtils.getDayMonthYearDateFormatted(
.getTextMultiplierBasedOnWidth() * item.startDate.contains("/Date(") ? AppDateUtils.convertStringToDate(item.startDate) : DateTime.parse(item.startDate),
3.3,
valueSize: SizeConfig
.getTextMultiplierBasedOnWidth() *
4,
value: AppDateUtils
.getDayMonthYearDateFormatted(
item.startDate.contains(
"/Date(")
? AppDateUtils
.convertStringToDate(
item.startDate)
: DateTime.parse(
item.startDate),
), ),
), ),
CustomRow( CustomRow(
label: TranslationBase label: TranslationBase.of(context).endDate + ' ' ?? "",
.of(context) labelSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3.3,
.endDate + ' ' ?? "", valueSize: SizeConfig.getTextMultiplierBasedOnWidth() * 4,
labelSize: SizeConfig value: AppDateUtils.getDayMonthYearDateFormatted(
.getTextMultiplierBasedOnWidth() * item.startDate.contains("/Date(")
3.3, ? AppDateUtils.convertStringToDate(item.endDate ?? "").add(
valueSize: SizeConfig Duration(days: item.noOfDays ?? item.sickLeaveDays),
.getTextMultiplierBasedOnWidth() *
4,
value: AppDateUtils
.getDayMonthYearDateFormatted(
item.startDate.contains(
"/Date(")
? AppDateUtils
.convertStringToDate(
item.endDate ?? "").add(
Duration(
days: item.noOfDays ??
item
.sickLeaveDays),
) )
: DateTime.parse( : DateTime.parse(item.startDate ?? "").add(
item.startDate ?? "") Duration(days: item.noOfDays ?? ""),
.add(
Duration(
days: item.noOfDays ??
""),
), ),
), ),
), ),
], ],
crossAxisAlignment: CrossAxisAlignment crossAxisAlignment: CrossAxisAlignment.start,
.start,
), ),
), ),
], ],
@ -268,9 +200,7 @@ class PatientSickLeaveScreen extends StatelessWidget {
) )
: patient.patientStatusType != 43 : patient.patientStatusType != 43
? ErrorMessage( ? ErrorMessage(
error: TranslationBase error: TranslationBase.of(context).noSickLeave,
.of(context)
.noSickLeave,
) )
: SizedBox(), : SizedBox(),
SizedBox( SizedBox(
@ -296,4 +226,3 @@ class PatientSickLeaveScreen extends StatelessWidget {
); );
} }
} }

@ -266,7 +266,7 @@ class _PatientProfileScreenState extends State<PatientProfileScreen> with Single
if (patient.episodeNo != 0) if (patient.episodeNo != 0)
AppButton( AppButton(
loading: model.state == ViewState.BusyLocal, loading: model.state == ViewState.BusyLocal,
disabled: model.state == ViewState.BusyLocal || isSigned, // disabled: model.state == ViewState.BusyLocal || isSigned,
title: "${TranslationBase.of(context).update}\n${TranslationBase.of(context).episode}", title: "${TranslationBase.of(context).update}\n${TranslationBase.of(context).episode}",
color: ((isInpatient) || isFromLiveCare) && model.state != ViewState.BusyLocal color: ((isInpatient) || isFromLiveCare) && model.state != ViewState.BusyLocal
? AppGlobal.appRedColor ? AppGlobal.appRedColor

@ -12,6 +12,7 @@ import 'package:doctor_app_flutter/core/model/doctor/doctor_profile_model.dart';
import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_title.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_title.dart';
import 'package:doctor_app_flutter/utils/dr_app_toast_msg.dart';
import 'package:doctor_app_flutter/utils/utils.dart'; import 'package:doctor_app_flutter/utils/utils.dart';
import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart';
import 'package:doctor_app_flutter/widgets/bottom_sheet/custom_bottom_sheet_container.dart'; import 'package:doctor_app_flutter/widgets/bottom_sheet/custom_bottom_sheet_container.dart';
@ -28,18 +29,11 @@ import 'package:provider/provider.dart';
class AddAssessmentDetails extends StatefulWidget { class AddAssessmentDetails extends StatefulWidget {
final MySelectedAssessment mySelectedAssessment; final MySelectedAssessment mySelectedAssessment;
final List<MySelectedAssessment> mySelectedAssessmentList; final List<MySelectedAssessment> mySelectedAssessmentList;
final Function(MySelectedAssessment mySelectedAssessment, bool isUpdate) final Function(MySelectedAssessment mySelectedAssessment, bool isUpdate) addSelectedAssessment;
addSelectedAssessment;
final PatiantInformtion patientInfo; final PatiantInformtion patientInfo;
final bool isUpdate; final bool isUpdate;
AddAssessmentDetails( AddAssessmentDetails({Key key, this.mySelectedAssessment, this.addSelectedAssessment, this.patientInfo, this.isUpdate = false, this.mySelectedAssessmentList});
{Key key,
this.mySelectedAssessment,
this.addSelectedAssessment,
this.patientInfo,
this.isUpdate = false,
this.mySelectedAssessmentList});
@override @override
_AddAssessmentDetailsState createState() => _AddAssessmentDetailsState(); _AddAssessmentDetailsState createState() => _AddAssessmentDetailsState();
@ -60,48 +54,28 @@ class _AddAssessmentDetailsState extends State<AddAssessmentDetails> {
ProjectViewModel projectViewModel = Provider.of(context); ProjectViewModel projectViewModel = Provider.of(context);
remarkController.text = widget.mySelectedAssessment.remark ?? ""; remarkController.text = widget.mySelectedAssessment.remark ?? "";
appointmentIdController.text = appointmentIdController.text = widget.mySelectedAssessment.appointmentId.toString();
widget.mySelectedAssessment.appointmentId.toString();
if (widget.isUpdate) { if (widget.isUpdate) {
if (widget.mySelectedAssessment.selectedDiagnosisCondition != null) if (widget.mySelectedAssessment.selectedDiagnosisCondition != null)
conditionController.text = projectViewModel.isArabic conditionController.text = projectViewModel.isArabic ? widget.mySelectedAssessment.selectedDiagnosisCondition.nameAr : widget.mySelectedAssessment.selectedDiagnosisCondition.nameEn;
? widget.mySelectedAssessment.selectedDiagnosisCondition.nameAr
: widget.mySelectedAssessment.selectedDiagnosisCondition.nameEn;
if (widget.mySelectedAssessment.selectedDiagnosisType != null) if (widget.mySelectedAssessment.selectedDiagnosisType != null)
typeController.text = projectViewModel.isArabic typeController.text = projectViewModel.isArabic ? widget.mySelectedAssessment.selectedDiagnosisType.nameAr : widget.mySelectedAssessment.selectedDiagnosisType.nameEn;
? widget.mySelectedAssessment.selectedDiagnosisType.nameAr if (widget.mySelectedAssessment.selectedICD != null) icdNameController.text = widget.mySelectedAssessment.selectedICD.code;
: widget.mySelectedAssessment.selectedDiagnosisType.nameEn;
if (widget.mySelectedAssessment.selectedICD != null)
icdNameController.text = widget.mySelectedAssessment.selectedICD.code;
} }
InputDecoration textFieldSelectorDecoration( InputDecoration textFieldSelectorDecoration(String hintText, String selectedText, bool isDropDown, {IconData icon, String validationError}) {
String hintText, String selectedText, bool isDropDown,
{IconData icon, String validationError}) {
return new InputDecoration( return new InputDecoration(
fillColor: Colors.white, fillColor: Colors.white,
contentPadding: EdgeInsets.symmetric(vertical: 15, horizontal: 10), contentPadding: EdgeInsets.symmetric(vertical: 15, horizontal: 10),
focusedBorder: OutlineInputBorder( focusedBorder: OutlineInputBorder(
borderSide: BorderSide( borderSide: BorderSide(color: (validationError != null ? Colors.red.shade700 : Color(0xFFEFEFEF)), width: 2.5),
color: (validationError != null
? Colors.red.shade700
: Color(0xFFEFEFEF)),
width: 2.5),
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(8),
), ),
enabledBorder: OutlineInputBorder( enabledBorder: OutlineInputBorder(
borderSide: BorderSide( borderSide: BorderSide(color: (validationError != null ? Colors.red.shade700 : Color(0xFFEFEFEF)), width: 2.5),
color: (validationError != null
? Colors.red.shade700
: Color(0xFFEFEFEF)),
width: 2.5),
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(8),
), ),
disabledBorder: OutlineInputBorder( disabledBorder: OutlineInputBorder(
borderSide: BorderSide( borderSide: BorderSide(color: (validationError != null ? Colors.red.shade700 : Color(0xFFEFEFEF)), width: 2.5),
color: (validationError != null
? Colors.red.shade700
: Color(0xFFEFEFEF)),
width: 2.5),
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(8),
), ),
hintText: selectedText != null ? selectedText : hintText, hintText: selectedText != null ? selectedText : hintText,
@ -118,13 +92,12 @@ class _AddAssessmentDetailsState extends State<AddAssessmentDetails> {
heightFactor: 1, heightFactor: 1,
child: BaseView<SOAPViewModel>( child: BaseView<SOAPViewModel>(
onModelReady: (model) async { onModelReady: (model) async {
model.callAddAssessmentLookupsServices(); // model.callAddAssessmentLookupsServices();
}, },
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
baseViewModel: model, baseViewModel: model,
isShowAppBar: true, isShowAppBar: true,
appBar: BottomSheetTitle( appBar: BottomSheetTitle(title: TranslationBase.of(context).addAssessmentDetails),
title: TranslationBase.of(context).addAssessmentDetails),
backgroundColor: Theme.of(context).scaffoldBackgroundColor, backgroundColor: Theme.of(context).scaffoldBackgroundColor,
body: SingleChildScrollView( body: SingleChildScrollView(
child: Center( child: Center(
@ -133,9 +106,7 @@ class _AddAssessmentDetailsState extends State<AddAssessmentDetails> {
FractionallySizedBox( FractionallySizedBox(
widthFactor: 0.9, widthFactor: 0.9,
child: Container( child: Container(
child: Column( child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox( SizedBox(
height: 16, height: 16,
), ),
@ -144,9 +115,7 @@ class _AddAssessmentDetailsState extends State<AddAssessmentDetails> {
child: AppTextFieldCustom( child: AppTextFieldCustom(
// height: 55.0, // height: 55.0,
height: Utils.getTextFieldHeight(), height: Utils.getTextFieldHeight(),
hintText: TranslationBase.of(context).appointmentNumber,
hintText:
TranslationBase.of(context).appointmentNumber,
isTextFieldHasSuffix: false, isTextFieldHasSuffix: false,
enabled: false, enabled: false,
controller: appointmentIdController, controller: appointmentIdController,
@ -160,59 +129,58 @@ class _AddAssessmentDetailsState extends State<AddAssessmentDetails> {
onTap: model.listOfICD10 != null onTap: model.listOfICD10 != null
? () { ? () {
setState(() { setState(() {
widget.mySelectedAssessment widget.mySelectedAssessment.selectedICD = null;
.selectedICD = null;
icdNameController.text = null; icdNameController.text = null;
}); });
} }
: null, : null,
child: widget child: widget.mySelectedAssessment.selectedICD == null
.mySelectedAssessment.selectedICD ==
null
? CustomAutoCompleteTextField( ? CustomAutoCompleteTextField(
isShowError: isFormSubmitted && isShowError: isFormSubmitted && widget.mySelectedAssessment.selectedICD == null,
widget.mySelectedAssessment child: Row(
.selectedICD == mainAxisAlignment: MainAxisAlignment.spaceBetween,
null, mainAxisSize: MainAxisSize.min,
child: AutoCompleteTextField< children: [
MasterKeyModel>( Expanded(
decoration: TextFieldsUtils flex: 4,
.textFieldSelectorDecoration( child: AutoCompleteTextField<MasterKeyModel>(
TranslationBase.of(context) decoration: TextFieldsUtils.textFieldSelectorDecoration(TranslationBase.of(context).nameOrICD, null, true, suffixIcon: null),
.nameOrICD, controller: icdNameController,
null,
true,
suffixIcon: Icons.search),
itemSubmitted: (item) => setState(() { itemSubmitted: (item) => setState(() {
widget.mySelectedAssessment widget.mySelectedAssessment.selectedICD = item;
.selectedICD = item; // icdNameController.text = '${item.code.trim()}/${item.description}';
icdNameController.text = icdNameController.text = '${item.description}';
'${item.code.trim()}/${item.description}';
}), }),
key: key, key: key,
suggestions: model.listOfICD10, suggestions: model.listOfICD10,
suggestionsAmount: 10,
itemBuilder: (context, suggestion) => itemBuilder: (context, suggestion) =>
new Padding( new Padding(child: AppText(suggestion.description + " / " + suggestion.code.toString(), fontSize: 12.0), padding: EdgeInsets.all(8.0)),
child: AppText(
suggestion.description +
" / " +
suggestion.code
.toString()),
padding: EdgeInsets.all(8.0)),
itemSorter: (a, b) => 1, itemSorter: (a, b) => 1,
itemFilter: (suggestion, input) => itemFilter: (suggestion, input) =>
suggestion.description // suggestion.description.toLowerCase().startsWith(input.toLowerCase()) ||
.toLowerCase() // suggestion.description.toLowerCase().startsWith(input.toLowerCase()) ||
.startsWith( // suggestion.code.toLowerCase().startsWith(input.toLowerCase()),
input.toLowerCase()) || suggestion.description.toLowerCase().contains(input.toLowerCase()) ||
suggestion.description // suggestion.description.toLowerCase().startsWith(input.toLowerCase()) ||
.toLowerCase() suggestion.code.toLowerCase().contains(input.toLowerCase()),
.startsWith( ),
input.toLowerCase()) || ),
suggestion.code Expanded(
.toLowerCase() child: IconButton(
.startsWith( onPressed: () {
input.toLowerCase()), print(icdNameController.text);
if (icdNameController.text.length <= 3) {
DrAppToastMsg.showErrorToast("Please enter 4 or more characters");
} else {
model.listOfICD10.clear();
model.callAddAssessmentLookupsServices(searchKey: icdNameController.text);
}
},
icon: Icon(Icons.search),
),
),
],
), ),
) )
: AppTextFieldCustom( : AppTextFieldCustom(
@ -220,20 +188,27 @@ class _AddAssessmentDetailsState extends State<AddAssessmentDetails> {
onClick: model.listOfICD10 != null onClick: model.listOfICD10 != null
? () { ? () {
setState(() { setState(() {
widget.mySelectedAssessment widget.mySelectedAssessment.selectedICD = null;
.selectedICD = null;
icdNameController.text = null; icdNameController.text = null;
}); });
} }
: null, : null,
hintText: TranslationBase.of(context) hintText: TranslationBase.of(context).nameOrICD,
.nameOrICD,
maxLines: 1, maxLines: 1,
minLines: 1, minLines: 1,
controller: icdNameController, controller: icdNameController,
enabled: true, enabled: true,
isTextFieldHasSuffix: true, isTextFieldHasSuffix: true,
suffixIcon: IconButton( suffixIcon: IconButton(
onPressed: () {
print(icdNameController.text);
if (icdNameController.text.length <= 3) {
DrAppToastMsg.showErrorToast("Please enter 4 or more characters");
} else {
model.listOfICD10.clear();
model.callAddAssessmentLookupsServices(searchKey: icdNameController.text);
}
},
icon: Icon( icon: Icon(
Icons.search, Icons.search,
color: Colors.grey.shade600, color: Colors.grey.shade600,
@ -247,12 +222,9 @@ class _AddAssessmentDetailsState extends State<AddAssessmentDetails> {
height: 3, height: 3,
), ),
Container( Container(
width: width: MediaQuery.of(context).size.width * 0.7,
MediaQuery.of(context).size.width * 0.7,
child: AppText( child: AppText(
widget.mySelectedAssessment.selectedICD widget.mySelectedAssessment.selectedICD.description + (' (${widget.mySelectedAssessment.selectedICD.code} )'),
.description +
(' (${widget.mySelectedAssessment.selectedICD.code} )'),
color: Color(0xFF575757), color: Color(0xFF575757),
fontSize: 10, fontSize: 10,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
@ -271,25 +243,12 @@ class _AddAssessmentDetailsState extends State<AddAssessmentDetails> {
MasterKeyDailog dialog = MasterKeyDailog( MasterKeyDailog dialog = MasterKeyDailog(
list: model.listOfDiagnosisCondition, list: model.listOfDiagnosisCondition,
okText: TranslationBase.of(context).ok, okText: TranslationBase.of(context).ok,
selectedValue: widget.mySelectedAssessment selectedValue: widget.mySelectedAssessment.selectedDiagnosisCondition,
.selectedDiagnosisCondition, okFunction: (MasterKeyModel selectedValue) {
okFunction:
(MasterKeyModel selectedValue) {
setState(() { setState(() {
widget.mySelectedAssessment widget.mySelectedAssessment.selectedDiagnosisCondition = selectedValue;
.selectedDiagnosisCondition = conditionController.text =
selectedValue; projectViewModel.isArabic ? widget.mySelectedAssessment.selectedDiagnosisCondition.nameAr : widget.mySelectedAssessment.selectedDiagnosisCondition.nameEn;
conditionController
.text = projectViewModel
.isArabic
? widget
.mySelectedAssessment
.selectedDiagnosisCondition
.nameAr
: widget
.mySelectedAssessment
.selectedDiagnosisCondition
.nameEn;
}); });
}, },
); );
@ -309,12 +268,7 @@ class _AddAssessmentDetailsState extends State<AddAssessmentDetails> {
isTextFieldHasSuffix: true, isTextFieldHasSuffix: true,
enabled: false, enabled: false,
hasBorder: true, hasBorder: true,
validationError: isFormSubmitted && validationError: isFormSubmitted && widget.mySelectedAssessment.selectedDiagnosisCondition == null ? TranslationBase.of(context).emptyMessage : null,
widget.mySelectedAssessment
.selectedDiagnosisCondition ==
null
? TranslationBase.of(context).emptyMessage
: null,
), ),
SizedBox( SizedBox(
height: 10, height: 10,
@ -326,18 +280,11 @@ class _AddAssessmentDetailsState extends State<AddAssessmentDetails> {
MasterKeyDailog dialog = MasterKeyDailog( MasterKeyDailog dialog = MasterKeyDailog(
list: model.listOfDiagnosisType, list: model.listOfDiagnosisType,
okText: TranslationBase.of(context).ok, okText: TranslationBase.of(context).ok,
selectedValue: widget.mySelectedAssessment selectedValue: widget.mySelectedAssessment.selectedDiagnosisType,
.selectedDiagnosisType, okFunction: (MasterKeyModel selectedValue) {
okFunction:
(MasterKeyModel selectedValue) {
setState(() { setState(() {
widget.mySelectedAssessment widget.mySelectedAssessment.selectedDiagnosisType = selectedValue;
.selectedDiagnosisType = typeController.text = projectViewModel.isArabic ? selectedValue.nameAr : selectedValue.nameEn;
selectedValue;
typeController.text =
projectViewModel.isArabic
? selectedValue.nameAr
: selectedValue.nameEn;
}); });
}, },
); );
@ -357,12 +304,7 @@ class _AddAssessmentDetailsState extends State<AddAssessmentDetails> {
isTextFieldHasSuffix: true, isTextFieldHasSuffix: true,
controller: typeController, controller: typeController,
hasBorder: true, hasBorder: true,
validationError: isFormSubmitted && validationError: isFormSubmitted && widget.mySelectedAssessment.selectedDiagnosisType == null ? TranslationBase.of(context).emptyMessage : null,
widget.mySelectedAssessment
.selectedDiagnosisType ==
null
? TranslationBase.of(context).emptyMessage
: null,
), ),
SizedBox( SizedBox(
height: 10, height: 10,
@ -376,8 +318,7 @@ class _AddAssessmentDetailsState extends State<AddAssessmentDetails> {
inputType: TextInputType.multiline, inputType: TextInputType.multiline,
controller: remarkController, controller: remarkController,
onChanged: (value) { onChanged: (value) {
widget.mySelectedAssessment.remark = widget.mySelectedAssessment.remark = remarkController.text;
remarkController.text;
}, },
), ),
), ),
@ -400,26 +341,17 @@ class _AddAssessmentDetailsState extends State<AddAssessmentDetails> {
height: 0, height: 0,
) )
: CustomBottomSheetContainer( : CustomBottomSheetContainer(
label: (widget.isUpdate label: (widget.isUpdate ? 'Update Assessment Details' : 'Add Assessment Details'),
? 'Update Assessment Details'
: 'Add Assessment Details'),
onTap: () async { onTap: () async {
setState(() { setState(() {
isFormSubmitted = true; isFormSubmitted = true;
}); });
widget.mySelectedAssessment.remark = remarkController.text; widget.mySelectedAssessment.remark = remarkController.text;
widget.mySelectedAssessment.appointmentId = widget.mySelectedAssessment.appointmentId = int.parse(appointmentIdController.text);
int.parse(appointmentIdController.text); if (widget.mySelectedAssessment.selectedDiagnosisCondition != null &&
if (widget.mySelectedAssessment widget.mySelectedAssessment.selectedDiagnosisType != null &&
.selectedDiagnosisCondition !=
null &&
widget.mySelectedAssessment.selectedDiagnosisType !=
null &&
widget.mySelectedAssessment.selectedICD != null) { widget.mySelectedAssessment.selectedICD != null) {
await submitAssessment( await submitAssessment(isUpdate: widget.isUpdate, model: model, mySelectedAssessment: widget.mySelectedAssessment);
isUpdate: widget.isUpdate,
model: model,
mySelectedAssessment: widget.mySelectedAssessment);
} }
}, },
), ),
@ -428,10 +360,7 @@ class _AddAssessmentDetailsState extends State<AddAssessmentDetails> {
); );
} }
submitAssessment( submitAssessment({SOAPViewModel model, MySelectedAssessment mySelectedAssessment, bool isUpdate = false}) async {
{SOAPViewModel model,
MySelectedAssessment mySelectedAssessment,
bool isUpdate = false}) async {
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
if (isUpdate) { if (isUpdate) {
PatchAssessmentReqModel patchAssessmentReqModel = PatchAssessmentReqModel( PatchAssessmentReqModel patchAssessmentReqModel = PatchAssessmentReqModel(
@ -447,13 +376,15 @@ class _AddAssessmentDetailsState extends State<AddAssessmentDetails> {
await model.patchAssessment(patchAssessmentReqModel); await model.patchAssessment(patchAssessmentReqModel);
} else { } else {
Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile);
PostAssessmentRequestModel postAssessmentRequestModel = PostAssessmentRequestModel postAssessmentRequestModel =
new PostAssessmentRequestModel( new PostAssessmentRequestModel(
patientMRN: widget.patientInfo.patientMRN, patientMRN: widget.patientInfo.patientMRN,
episodeId: widget.patientInfo.episodeNo, episodeId: widget.patientInfo.episodeNo,
appointmentNo: widget.patientInfo.appointmentNo, appointmentNo: widget.patientInfo.appointmentNo,
createdByName: Provider.of(context).doctorProfile.doctorName, createdByName: doctorProfile.doctorName,
createdBy: Provider.of(context).doctorProfile.doctorID, createdBy: doctorProfile.doctorID,
icdCodeDetails: [ icdCodeDetails: [
new IcdCodeDetails( new IcdCodeDetails(
remarks: mySelectedAssessment.remark, remarks: mySelectedAssessment.remark,
@ -462,7 +393,6 @@ class _AddAssessmentDetailsState extends State<AddAssessmentDetails> {
diagnosisTypeId: mySelectedAssessment.selectedDiagnosisType.id, diagnosisTypeId: mySelectedAssessment.selectedDiagnosisType.id,
icdcode10Id: mySelectedAssessment.selectedICD.code) icdcode10Id: mySelectedAssessment.selectedICD.code)
]); ]);
await model.postAssessment(postAssessmentRequestModel); await model.postAssessment(postAssessmentRequestModel);
} }
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);

@ -30,19 +30,13 @@ class UpdateAssessmentPage extends StatefulWidget {
final Function changeLoadingState; final Function changeLoadingState;
final int currentIndex; final int currentIndex;
UpdateAssessmentPage( UpdateAssessmentPage({Key key, this.changePageViewIndex, this.patientInfo, this.changeLoadingState, this.currentIndex});
{Key key,
this.changePageViewIndex,
this.patientInfo,
this.changeLoadingState,
this.currentIndex});
@override @override
_UpdateAssessmentPageState createState() => _UpdateAssessmentPageState(); _UpdateAssessmentPageState createState() => _UpdateAssessmentPageState();
} }
class _UpdateAssessmentPageState extends State<UpdateAssessmentPage> class _UpdateAssessmentPageState extends State<UpdateAssessmentPage> implements AssessmentCallBack {
implements AssessmentCallBack {
bool isAssessmentExpand = false; bool isAssessmentExpand = false;
List<MySelectedAssessment> mySelectedAssessmentList = List(); List<MySelectedAssessment> mySelectedAssessmentList = List();
@ -71,11 +65,8 @@ class _UpdateAssessmentPageState extends State<UpdateAssessmentPage>
masterKeys: MasterKeysService.DiagnosisCondition, masterKeys: MasterKeysService.DiagnosisCondition,
id: element.conditionID, id: element.conditionID,
); );
if (diagnosisCondition != null && if (diagnosisCondition != null && diagnosisType != null && diagnosisCondition != null) {
diagnosisType != null && MySelectedAssessment temMySelectedAssessment = SoapUtils.generateMySelectedAssessment(
diagnosisCondition != null) {
MySelectedAssessment temMySelectedAssessment =
SoapUtils.generateMySelectedAssessment(
appointmentNo: element.appointmentNo, appointmentNo: element.appointmentNo,
remark: element.remarks, remark: element.remarks,
diagnosisType: diagnosisType, diagnosisType: diagnosisType,
@ -126,33 +117,26 @@ class _UpdateAssessmentPageState extends State<UpdateAssessmentPage>
Column( Column(
children: [ children: [
SOAPOpenItems( SOAPOpenItems(
label: label: "${TranslationBase.of(context).addAssessment}",
"${TranslationBase.of(context).addAssessment}",
onTap: () { onTap: () {
openAssessmentDialog(context, openAssessmentDialog(context, isUpdate: false, model: model);
isUpdate: false, model: model);
}, },
), ),
SizedBox( SizedBox(
height: 20, height: 20,
), ),
Column( Column(
children: children: mySelectedAssessmentList.map((assessment) {
mySelectedAssessmentList.map((assessment) {
return Container( return Container(
margin: EdgeInsets.only( margin: EdgeInsets.only(left: 5, right: 5, top: 15, bottom: 15),
left: 5, right: 5, top: 15, bottom: 15),
child: Column( child: Column(
children: [ children: [
Row( Row(
children: [ children: [
RichText( RichText(
text: new TextSpan( text: new TextSpan(
style: new TextStyle( style: new TextStyle(
fontSize: SizeConfig fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3.6,
.getTextMultiplierBasedOnWidth() *
3.6,
color: Color(0xFF2E303A), color: Color(0xFF2E303A),
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
@ -161,47 +145,25 @@ class _UpdateAssessmentPageState extends State<UpdateAssessmentPage>
new TextSpan( new TextSpan(
text: "ICD : ".toUpperCase(), text: "ICD : ".toUpperCase(),
), ),
new TextSpan( new TextSpan(text: (assessment != null && assessment.selectedICD != null) ? assessment.selectedICD.code.trim().toUpperCase() ?? "" : ""),
text: assessment
.selectedICD.code
.trim()
.toUpperCase() ??
""),
], ],
), ),
), ),
Column( Column(
crossAxisAlignment: crossAxisAlignment: CrossAxisAlignment.end,
CrossAxisAlignment.end,
children: [ children: [
AppText( AppText(
assessment.createdOn != null assessment.createdOn != null
? AppDateUtils ? AppDateUtils.getDayMonthYearDateFormatted(DateTime.parse(assessment.createdOn), isMonthShort: true)
.getDayMonthYearDateFormatted( : AppDateUtils.getDayMonthYearDateFormatted(DateTime.now()),
DateTime.parse(
assessment
.createdOn), isMonthShort: true)
: AppDateUtils
.getDayMonthYearDateFormatted(
DateTime.now()),
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontSize: SizeConfig fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3.6,
.getTextMultiplierBasedOnWidth() *
3.6,
), ),
AppText( AppText(
assessment.createdOn != null assessment.createdOn != null ? AppDateUtils.getHour(DateTime.parse(assessment.createdOn)) : AppDateUtils.getHour(DateTime.now()),
? AppDateUtils.getHour(
DateTime.parse(
assessment
.createdOn))
: AppDateUtils.getHour(
DateTime.now()),
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
color: Color(0xFF575757), color: Color(0xFF575757),
fontSize: SizeConfig fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3.6,
.getTextMultiplierBasedOnWidth() *
3.6,
), ),
], ],
), ),
@ -210,27 +172,18 @@ class _UpdateAssessmentPageState extends State<UpdateAssessmentPage>
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
), ),
Row( Row(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.spaceBetween,
MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [ children: [
Column( Column(
crossAxisAlignment: crossAxisAlignment: CrossAxisAlignment.start,
CrossAxisAlignment.start,
children: [ children: [
Container( Container(
width: MediaQuery.of(context) width: MediaQuery.of(context).size.width * 0.50,
.size
.width *
0.50,
child: RichText( child: RichText(
text: new TextSpan( text: new TextSpan(
style: new TextStyle( style: new TextStyle(
fontSize: SizeConfig fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 4.3,
.getTextMultiplierBasedOnWidth() *
4.3,
color: Color(0xFF2E303A), color: Color(0xFF2E303A),
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
@ -238,9 +191,8 @@ class _UpdateAssessmentPageState extends State<UpdateAssessmentPage>
), ),
children: <TextSpan>[ children: <TextSpan>[
new TextSpan( new TextSpan(
text: assessment text: (assessment != null && assessment.selectedICD != null) ? assessment.selectedICD.description.toString() : "",
.selectedICD.description // text: assessment.selectedICD.description.toString(),
.toString(),
), ),
], ],
), ),
@ -249,34 +201,24 @@ class _UpdateAssessmentPageState extends State<UpdateAssessmentPage>
RichText( RichText(
text: new TextSpan( text: new TextSpan(
style: new TextStyle( style: new TextStyle(
fontSize: SizeConfig fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3.5,
.getTextMultiplierBasedOnWidth() *
3.5,
color: Color(0xFF2E303A), color: Color(0xFF2E303A),
fontFamily: 'Poppins', fontFamily: 'Poppins',
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
), ),
children: <TextSpan>[ children: <TextSpan>[
new TextSpan( new TextSpan(
text: TranslationBase.of( text: TranslationBase.of(context).appointmentNo,
context)
.appointmentNo,
style: new TextStyle( style: new TextStyle(
fontSize: SizeConfig fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3,
.getTextMultiplierBasedOnWidth() *
3,
letterSpacing: -0.4, letterSpacing: -0.4,
color: Color(0xFF575757), color: Color(0xFF575757),
), ),
), ),
new TextSpan( new TextSpan(
text: assessment.appointmentId text: assessment.appointmentId.toString() ?? "",
.toString() ??
"",
style: new TextStyle( style: new TextStyle(
fontSize: SizeConfig fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3.6,
.getTextMultiplierBasedOnWidth() *
3.6,
letterSpacing: -0.48, letterSpacing: -0.48,
color: Color(0xFF2B353E), color: Color(0xFF2B353E),
), ),
@ -287,36 +229,19 @@ class _UpdateAssessmentPageState extends State<UpdateAssessmentPage>
RichText( RichText(
text: new TextSpan( text: new TextSpan(
style: new TextStyle( style: new TextStyle(
fontSize: SizeConfig fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3, color: Color(0xFF2E303A), fontFamily: 'Poppins', fontWeight: FontWeight.w600),
.getTextMultiplierBasedOnWidth() *
3,
color: Color(0xFF2E303A),
fontFamily: 'Poppins',
fontWeight: FontWeight.w600),
children: <TextSpan>[ children: <TextSpan>[
new TextSpan( new TextSpan(
text: TranslationBase.of( text: TranslationBase.of(context).condition + " : ",
context)
.condition +
" : ",
style: new TextStyle( style: new TextStyle(
letterSpacing: -0.4, letterSpacing: -0.4,
color: Color(0xFF575757), color: Color(0xFF575757),
), ),
), ),
new TextSpan( new TextSpan(
text: projectViewModel text: projectViewModel.isArabic ? assessment.selectedDiagnosisCondition.nameAr : assessment.selectedDiagnosisCondition.nameEn,
.isArabic
? assessment
.selectedDiagnosisCondition
.nameAr
: assessment
.selectedDiagnosisCondition
.nameEn,
style: new TextStyle( style: new TextStyle(
fontSize: SizeConfig fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3.6,
.getTextMultiplierBasedOnWidth() *
3.6,
letterSpacing: -0.48, letterSpacing: -0.48,
color: Color(0xFF2B353E), color: Color(0xFF2B353E),
), ),
@ -327,36 +252,19 @@ class _UpdateAssessmentPageState extends State<UpdateAssessmentPage>
RichText( RichText(
text: new TextSpan( text: new TextSpan(
style: new TextStyle( style: new TextStyle(
fontSize: SizeConfig fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3, color: Color(0xFF2E303A), fontFamily: 'Poppins', fontWeight: FontWeight.w600),
.getTextMultiplierBasedOnWidth() *
3,
color: Color(0xFF2E303A),
fontFamily: 'Poppins',
fontWeight: FontWeight.w600),
children: <TextSpan>[ children: <TextSpan>[
new TextSpan( new TextSpan(
text: TranslationBase.of( text: TranslationBase.of(context).dType + ' : ',
context)
.dType +
' : ',
style: new TextStyle( style: new TextStyle(
letterSpacing: -0.4, letterSpacing: -0.4,
color: Color(0xFF575757), color: Color(0xFF575757),
), ),
), ),
new TextSpan( new TextSpan(
text: projectViewModel text: projectViewModel.isArabic ? assessment.selectedDiagnosisType.nameAr : assessment.selectedDiagnosisType.nameEn,
.isArabic
? assessment
.selectedDiagnosisType
.nameAr
: assessment
.selectedDiagnosisType
.nameEn,
style: new TextStyle( style: new TextStyle(
fontSize: SizeConfig fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3.6,
.getTextMultiplierBasedOnWidth() *
3.6,
letterSpacing: -0.48, letterSpacing: -0.48,
color: Color(0xFF2B353E), color: Color(0xFF2B353E),
), ),
@ -368,35 +276,20 @@ class _UpdateAssessmentPageState extends State<UpdateAssessmentPage>
RichText( RichText(
text: new TextSpan( text: new TextSpan(
style: new TextStyle( style: new TextStyle(
fontSize: SizeConfig fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3.6, color: Color(0xFF2E303A), fontFamily: 'Poppins', fontWeight: FontWeight.w600),
.getTextMultiplierBasedOnWidth() *
3.6,
color: Color(0xFF2E303A),
fontFamily: 'Poppins',
fontWeight:
FontWeight.w600),
children: <TextSpan>[ children: <TextSpan>[
new TextSpan( new TextSpan(
text: TranslationBase.of( text: TranslationBase.of(context).doctor + ' : ',
context)
.doctor +
' : ',
style: new TextStyle( style: new TextStyle(
fontSize: SizeConfig fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3,
.getTextMultiplierBasedOnWidth() *
3,
letterSpacing: -0.4, letterSpacing: -0.4,
color: Color(0xFF575757), color: Color(0xFF575757),
), ),
), ),
new TextSpan( new TextSpan(
text: text: assessment.doctorName ?? '',
assessment.doctorName ??
'',
style: new TextStyle( style: new TextStyle(
fontSize: SizeConfig fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3.6,
.getTextMultiplierBasedOnWidth() *
3.6,
letterSpacing: -0.48, letterSpacing: -0.48,
color: Color(0xFF2B353E), color: Color(0xFF2B353E),
), ),
@ -408,29 +301,14 @@ class _UpdateAssessmentPageState extends State<UpdateAssessmentPage>
height: 6, height: 6,
), ),
Row( Row(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.start,
MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [ children: [
SizedBox( SizedBox(
height: 6, height: 6,
), ),
AppText( AppText((assessment.remark != null && assessment.remark != '') ? TranslationBase.of(context).remarks + " : " : '',
(assessment.remark != null && fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3, color: Color(0xFF2E303A), fontFamily: 'Poppins', fontWeight: FontWeight.w600),
assessment.remark !=
'')
? TranslationBase.of(
context)
.remarks +
" : "
: '',
fontSize: SizeConfig
.getTextMultiplierBasedOnWidth() *
3,
color: Color(0xFF2E303A),
fontFamily: 'Poppins',
fontWeight: FontWeight.w600),
RemarkText( RemarkText(
remark: assessment.remark ?? "", remark: assessment.remark ?? "",
), ),
@ -439,22 +317,14 @@ class _UpdateAssessmentPageState extends State<UpdateAssessmentPage>
], ],
), ),
Column( Column(
crossAxisAlignment: crossAxisAlignment: CrossAxisAlignment.end,
CrossAxisAlignment.end,
children: [ children: [
SizedBox( SizedBox(
height: MediaQuery.of(context) height: MediaQuery.of(context).size.height * 0.05,
.size
.height *
0.05,
), ),
InkWell( InkWell(
onTap: () { onTap: () {
openAssessmentDialog(context, openAssessmentDialog(context, isUpdate: true, assessment: assessment, model: model);
isUpdate: true,
assessment: assessment,
model: model);
}, },
child: Icon( child: Icon(
DoctorApp.edit, DoctorApp.edit,
@ -488,11 +358,9 @@ class _UpdateAssessmentPageState extends State<UpdateAssessmentPage>
); );
} }
openAssessmentDialog(BuildContext context, openAssessmentDialog(BuildContext context, {MySelectedAssessment assessment, bool isUpdate, SOAPViewModel model}) {
{MySelectedAssessment assessment, bool isUpdate, SOAPViewModel model}) {
if (assessment == null) { if (assessment == null) {
assessment = SoapUtils.generateMySelectedAssessment( assessment = SoapUtils.generateMySelectedAssessment(remark: '', appointmentNo: widget.patientInfo.appointmentNo);
remark: '', appointmentNo: widget.patientInfo.appointmentNo);
} }
showModalBottomSheet( showModalBottomSheet(
backgroundColor: Colors.white, backgroundColor: Colors.white,
@ -504,11 +372,9 @@ class _UpdateAssessmentPageState extends State<UpdateAssessmentPage>
patientInfo: widget.patientInfo, patientInfo: widget.patientInfo,
isUpdate: isUpdate, isUpdate: isUpdate,
mySelectedAssessmentList: mySelectedAssessmentList, mySelectedAssessmentList: mySelectedAssessmentList,
addSelectedAssessment: (MySelectedAssessment mySelectedAssessment, addSelectedAssessment: (MySelectedAssessment mySelectedAssessment, bool isUpdate) async {
bool isUpdate) async {
setState(() { setState(() {
if (!isUpdate) if (!isUpdate) mySelectedAssessmentList.add(mySelectedAssessment);
mySelectedAssessmentList.add(mySelectedAssessment);
}); });
}); });
}); });

@ -29,6 +29,7 @@ class DrugToDrug extends StatefulWidget {
class _DrugToDrug extends State<DrugToDrug> { class _DrugToDrug extends State<DrugToDrug> {
int typeID = 1; int typeID = 1;
bool isLoaded = false; bool isLoaded = false;
/// TODO Elham* fix this /// TODO Elham* fix this
List<Map<dynamic, dynamic>> expandableList = [ List<Map<dynamic, dynamic>> expandableList = [
{'name': 'CRITICAL', 'level': 'LEVEL_4'}, {'name': 'CRITICAL', 'level': 'LEVEL_4'},
@ -38,7 +39,6 @@ class _DrugToDrug extends State<DrugToDrug> {
{'name': 'INFO', 'level': 'INFO'}, {'name': 'INFO', 'level': 'INFO'},
]; ];
VitalSignsViewModel vitalSignsViewModel = new VitalSignsViewModel(); VitalSignsViewModel vitalSignsViewModel = new VitalSignsViewModel();
SOAPViewModel soapViewModel = new SOAPViewModel(); SOAPViewModel soapViewModel = new SOAPViewModel();
@ -53,15 +53,9 @@ class _DrugToDrug extends State<DrugToDrug> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return isLoaded == true return isLoaded == true
? BaseView<PrescriptionViewModel>( ? BaseView<PrescriptionViewModel>(
onModelReady: (prescriptionViewModel) => prescriptionViewModel.getDrugToDrug( onModelReady: (prescriptionViewModel) =>
vitalSignsViewModel.patientVitalSigns, prescriptionViewModel.getDrugToDrug(vitalSignsViewModel.patientVitalSigns, widget.listAssessment, soapViewModel.patientAllergiesList, widget.patient, widget.prescription),
widget.listAssessment, builder: (BuildContext context, PrescriptionViewModel prescriptionViewModel, Widget child) => NetworkBaseView(
soapViewModel.patientAllergiesList,
widget.patient,
widget.prescription),
builder: (BuildContext context, PrescriptionViewModel prescriptionViewModel,
Widget child) =>
NetworkBaseView(
baseViewModel: prescriptionViewModel, baseViewModel: prescriptionViewModel,
child: Container( child: Container(
height: SizeConfig.realScreenHeight * .9, height: SizeConfig.realScreenHeight * .9,
@ -70,20 +64,11 @@ class _DrugToDrug extends State<DrugToDrug> {
itemBuilder: (context, i) { itemBuilder: (context, i) {
return new ExpansionTile( return new ExpansionTile(
title: new AppText( title: new AppText(
expandableList[i]['name'] + expandableList[i]['name'] + ' ' + '(' + getDrugInfo(expandableList[i]['level'], prescriptionViewModel).length.toString() + ')',
' ' +
'(' +
getDrugInfo(expandableList[i]['level'],
prescriptionViewModel)
.length
.toString() +
')',
fontSize: 20, fontSize: 20,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
children: getDrugInfo( children: getDrugInfo(expandableList[i]['level'], prescriptionViewModel).map((item) {
expandableList[i]['level'], prescriptionViewModel)
.map((item) {
return Container( return Container(
padding: EdgeInsets.all(10), padding: EdgeInsets.all(10),
child: AppText( child: AppText(
@ -92,10 +77,7 @@ class _DrugToDrug extends State<DrugToDrug> {
)); ));
}).toList()); }).toList());
})))) }))))
: Container( : Container(height: SizeConfig.realScreenHeight * .45, child: GifLoaderContainer());
height: SizeConfig.realScreenHeight * .45,
child: GifLoaderContainer()
);
} }
getTypeID() async { getTypeID() async {
@ -106,14 +88,12 @@ class _DrugToDrug extends State<DrugToDrug> {
} }
getRequestedData() async { getRequestedData() async {
GeneralGetReqForSOAP generalGetReqForSOAP = GeneralGetReqForSOAP( GeneralGetReqForSOAP generalGetReqForSOAP = GeneralGetReqForSOAP(
/// TODO Elham* fix this today /// TODO Elham* fix this today
patientMRN: widget.patient.patientMRN, patientMRN: widget.patient.patientMRN,
episodeId: widget.patient.episodeNo, episodeId: widget.patient.episodeNo,
appointmentNo: appointmentNo: widget.patient.appointmentNo,
widget.patient.appointmentNo,
doctorID: '', doctorID: '',
editedBy: ''); editedBy: '');

@ -35,13 +35,7 @@ class PrescriptionFormWidget extends StatefulWidget {
final MedicineViewModel medicineViewModel; final MedicineViewModel medicineViewModel;
final GetMedicationResponseModel selectedMedication; final GetMedicationResponseModel selectedMedication;
const PrescriptionFormWidget( const PrescriptionFormWidget({Key key, this.patient, this.prescriptionList, this.prescriptionViewModel, this.medicineViewModel, this.selectedMedication});
{Key key,
this.patient,
this.prescriptionList,
this.prescriptionViewModel,
this.medicineViewModel,
this.selectedMedication});
@override @override
_PrescriptionFormWidgetState createState() => _PrescriptionFormWidgetState(); _PrescriptionFormWidgetState createState() => _PrescriptionFormWidgetState();
@ -67,8 +61,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
DateTime selectedDate = DateTime.now(); DateTime selectedDate = DateTime.now();
int strengthChar; int strengthChar;
GlobalKey key = GlobalKey key = new GlobalKey<AutoCompleteTextFieldState<GetMedicationResponseModel>>();
new GlobalKey<AutoCompleteTextFieldState<GetMedicationResponseModel>>();
TextEditingController drugIdController = TextEditingController(); TextEditingController drugIdController = TextEditingController();
TextEditingController doseController = TextEditingController(); TextEditingController doseController = TextEditingController();
@ -97,8 +90,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
onVoiceText() async { onVoiceText() async {
new SpeechToText(context: context).showAlertDialog(context); new SpeechToText(context: context).showAlertDialog(context);
var lang = TranslationBase.of(AppGlobal.CONTEX).locale.languageCode; var lang = TranslationBase.of(AppGlobal.CONTEX).locale.languageCode;
bool available = await speech.initialize( bool available = await speech.initialize(onStatus: statusListener, onError: errorListener);
onStatus: statusListener, onError: errorListener);
if (available) { if (available) {
speech.listen( speech.listen(
onResult: resultListener, onResult: resultListener,
@ -135,8 +127,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
} }
Future<void> initSpeechState() async { Future<void> initSpeechState() async {
bool hasSpeech = await speech.initialize( bool hasSpeech = await speech.initialize(onError: errorListener, onStatus: statusListener);
onError: errorListener, onStatus: statusListener);
print(hasSpeech); print(hasSpeech);
if (!mounted) return; if (!mounted) return;
} }
@ -197,8 +188,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
}); });
if (strengthChar >= 5) { if (strengthChar >= 5) {
DrAppToastMsg.showErrorToast( DrAppToastMsg.showErrorToast(
TranslationBase.of(context) TranslationBase.of(context).only5DigitsAllowedForStrength,
.only5DigitsAllowedForStrength,
); );
} }
}, },
@ -212,10 +202,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
), ),
PrescriptionTextFiled( PrescriptionTextFiled(
width: MediaQuery.of(context).size.width * 0.510, width: MediaQuery.of(context).size.width * 0.510,
element: element: widget.medicineViewModel.itemMedicineListUnit.length == 1 ? widget.medicineViewModel.itemMedicineListUnit[0] : units,
widget.medicineViewModel.itemMedicineListUnit.length == 1
? widget.medicineViewModel.itemMedicineListUnit[0]
: units,
elementError: unitError, elementError: unitError,
keyName: 'description', keyName: 'description',
keyId: 'parameterCode', keyId: 'parameterCode',
@ -233,9 +220,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
SizedBox(height: spaceBetweenTextFields), SizedBox(height: spaceBetweenTextFields),
PrescriptionTextFiled( PrescriptionTextFiled(
elementList: widget.medicineViewModel.itemMedicineListRoute, elementList: widget.medicineViewModel.itemMedicineListRoute,
element: widget.medicineViewModel.itemMedicineListRoute.length == 1 element: widget.medicineViewModel.itemMedicineListRoute.length == 1 ? route = widget.medicineViewModel.itemMedicineListRoute[0] : route,
? route = widget.medicineViewModel.itemMedicineListRoute[0]
: route,
elementError: routeError, elementError: routeError,
keyId: 'parameterCode', keyId: 'parameterCode',
keyName: 'description', keyName: 'description',
@ -252,9 +237,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
hintText: TranslationBase.of(context).frequency, hintText: TranslationBase.of(context).frequency,
elementError: frequencyError, elementError: frequencyError,
// element: frequency, // element: frequency,
element: widget.medicineViewModel.itemMedicineListRoute.length == 1 element: widget.medicineViewModel.itemMedicineListRoute.length == 1 ? frequency = widget.medicineViewModel.itemMedicineListRoute[0] : frequency,
? frequency = widget.medicineViewModel.itemMedicineListRoute[0]
: frequency,
elementList: widget.medicineViewModel.itemMedicineList, elementList: widget.medicineViewModel.itemMedicineList,
keyId: 'parameterCode', keyId: 'parameterCode',
keyName: 'description', keyName: 'description',
@ -262,15 +245,9 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
setState(() { setState(() {
frequency = selectedValue; frequency = selectedValue;
frequency['isDefault'] = true; frequency['isDefault'] = true;
if (widget.selectedMedication != null && if (widget.selectedMedication != null && duration != null && frequency != null && strengthController.text != null) {
duration != null && widget.medicineViewModel
frequency != null && .getBoxQuantity(freq: frequency['parameterCode'], duration: duration['id'], itemCode: widget.selectedMedication.itemId, strength: double.parse(strengthController.text));
strengthController.text != null) {
widget.medicineViewModel.getBoxQuantity(
freq: frequency['parameterCode'],
duration: duration['id'],
itemCode: widget.selectedMedication.itemId,
strength: double.parse(strengthController.text));
return; return;
} }
@ -300,9 +277,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
Container( Container(
width: MediaQuery.of(context).size.width * 0.29, width: MediaQuery.of(context).size.width * 0.29,
child: AppTextFieldCustom( child: AppTextFieldCustom(
hintText: widget hintText: widget.medicineViewModel.patientAssessmentList[0].icdCode10ID.toString(),
.medicineViewModel.patientAssessmentList[0].icdCode10ID
.toString(),
enabled: true, enabled: true,
), ),
), ),
@ -311,16 +286,15 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
color: Colors.white, color: Colors.white,
child: AppTextFieldCustom( child: AppTextFieldCustom(
maxLines: 5, maxLines: 5,
hintText: widget hintText: widget.medicineViewModel.patientAssessmentList[0].asciiDesc.toString(),
.medicineViewModel.patientAssessmentList[0].asciiDesc
.toString(),
enabled: true, enabled: true,
), ),
), ),
], ],
), ),
), ),
SizedBox(height: spaceBetweenTextFields), Container( SizedBox(height: spaceBetweenTextFields),
Container(
color: Colors.transparent, color: Colors.transparent,
child: InkWell( child: InkWell(
onTap: () => selectDate(context, widget.prescriptionViewModel), onTap: () => selectDate(context, widget.prescriptionViewModel),
@ -334,9 +308,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
color: Colors.black, color: Colors.black,
), ),
), ),
dropDownText: selectedDate != null dropDownText: selectedDate != null ? "${AppDateUtils.convertStringToDateFormat(selectedDate.toString(), "yyyy-MM-dd")}" : null,
? "${AppDateUtils.convertStringToDateFormat(selectedDate.toString(), "yyyy-MM-dd")}"
: null,
enabled: false, enabled: false,
), ),
), ),
@ -352,10 +324,7 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
okFunction: (selectedValue) { okFunction: (selectedValue) {
setState(() { setState(() {
duration = selectedValue; duration = selectedValue;
if (widget.selectedMedication != null && if (widget.selectedMedication != null && duration != null && frequency != null && strengthController.text != null) {
duration != null &&
frequency != null &&
strengthController.text != null) {
box = widget.medicineViewModel.boxQuintity; box = widget.medicineViewModel.boxQuintity;
return; return;
} }
@ -378,17 +347,13 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
child: AppTextFieldCustom( child: AppTextFieldCustom(
hintText: TranslationBase.of(context).boxQuantity, hintText: TranslationBase.of(context).boxQuantity,
isTextFieldHasSuffix: false, isTextFieldHasSuffix: false,
dropDownText: box != null dropDownText: box != null ? widget.medicineViewModel.boxQuintity.toString() : null,
? widget.medicineViewModel.boxQuintity.toString()
: null,
enabled: false, enabled: false,
), ),
), ),
SizedBox(height: spaceBetweenTextFields), SizedBox(height: spaceBetweenTextFields),
Container( Container(
decoration: BoxDecoration( decoration: BoxDecoration(borderRadius: BorderRadius.all(Radius.circular(6.0)), border: Border.all(width: 1.0, color: HexColor("#CCCCCC"))),
borderRadius: BorderRadius.all(Radius.circular(6.0)),
border: Border.all(width: 1.0, color: HexColor("#CCCCCC"))),
child: Stack( child: Stack(
children: [ children: [
TextFields( TextFields(
@ -459,14 +424,9 @@ class _PrescriptionFormWidgetState extends State<PrescriptionFormWidget> {
eventCategory: "Add Prescription Form", eventCategory: "Add Prescription Form",
eventAction: "Add Prescription", eventAction: "Add Prescription",
); );
if (duration != null && if (duration != null && doseTime != null && frequency != null && selectedDate != null && strengthController.text != "") {
doseTime != null &&
frequency != null &&
selectedDate != null &&
strengthController.text != "") {
if (widget.selectedMedication.isNarcotic == true) { if (widget.selectedMedication.isNarcotic == true) {
DrAppToastMsg.showErrorToast(TranslationBase.of(context) DrAppToastMsg.showErrorToast(TranslationBase.of(context).narcoticMedicineCanOnlyBePrescribedFromVida);
.narcoticMedicineCanOnlyBePrescribedFromVida);
Navigator.pop(context); Navigator.pop(context);
return; return;
} }

@ -37,21 +37,13 @@ class PrescriptionCheckOutScreen extends StatefulWidget {
final List<PrescriptionModel> prescriptionList; final List<PrescriptionModel> prescriptionList;
final ProcedureTempleteDetailsModel groupProcedures; final ProcedureTempleteDetailsModel groupProcedures;
const PrescriptionCheckOutScreen( const PrescriptionCheckOutScreen({Key key, this.model, this.patient, this.prescriptionList, this.groupProcedures}) : super(key: key);
{Key key,
this.model,
this.patient,
this.prescriptionList,
this.groupProcedures})
: super(key: key);
@override @override
_PrescriptionCheckOutScreenState createState() => _PrescriptionCheckOutScreenState createState() => _PrescriptionCheckOutScreenState();
_PrescriptionCheckOutScreenState();
} }
class _PrescriptionCheckOutScreenState class _PrescriptionCheckOutScreenState extends State<PrescriptionCheckOutScreen> {
extends State<PrescriptionCheckOutScreen> {
postPrescription( postPrescription(
{String duration, {String duration,
String doseTimeIn, String doseTimeIn,
@ -68,8 +60,7 @@ class _PrescriptionCheckOutScreenState
String icdCode, String icdCode,
PatiantInformtion patient, PatiantInformtion patient,
String patientType}) async { String patientType}) async {
PostPrescriptionReqModel postProcedureReqModel = PostPrescriptionReqModel postProcedureReqModel = new PostPrescriptionReqModel();
new PostPrescriptionReqModel();
List<PrescriptionRequestModel> prescriptionList = List(); List<PrescriptionRequestModel> prescriptionList = List();
postProcedureReqModel.appointmentNo = patient.appointmentNo; postProcedureReqModel.appointmentNo = patient.appointmentNo;
@ -121,8 +112,7 @@ class _PrescriptionCheckOutScreenState
DateTime selectedDate; DateTime selectedDate;
int strengthChar; int strengthChar;
GetMedicationResponseModel _selectedMedication; GetMedicationResponseModel _selectedMedication;
GlobalKey key = GlobalKey key = new GlobalKey<AutoCompleteTextFieldState<GetMedicationResponseModel>>();
new GlobalKey<AutoCompleteTextFieldState<GetMedicationResponseModel>>();
TextEditingController drugIdController = TextEditingController(); TextEditingController drugIdController = TextEditingController();
TextEditingController doseController = TextEditingController(); TextEditingController doseController = TextEditingController();
@ -160,8 +150,7 @@ class _PrescriptionCheckOutScreenState
onVoiceText() async { onVoiceText() async {
new SpeechToText(context: context).showAlertDialog(context); new SpeechToText(context: context).showAlertDialog(context);
var lang = TranslationBase.of(AppGlobal.CONTEX).locale.languageCode; var lang = TranslationBase.of(AppGlobal.CONTEX).locale.languageCode;
bool available = await speech.initialize( bool available = await speech.initialize(onStatus: statusListener, onError: errorListener);
onStatus: statusListener, onError: errorListener);
if (available) { if (available) {
speech.listen( speech.listen(
onResult: resultListener, onResult: resultListener,
@ -204,8 +193,7 @@ class _PrescriptionCheckOutScreenState
} }
Future<void> initSpeechState() async { Future<void> initSpeechState() async {
bool hasSpeech = await speech.initialize( bool hasSpeech = await speech.initialize(onError: errorListener, onStatus: statusListener);
onError: errorListener, onStatus: statusListener);
print(hasSpeech); print(hasSpeech);
if (!mounted) return; if (!mounted) return;
} }
@ -222,19 +210,13 @@ class _PrescriptionCheckOutScreenState
return BaseView<MedicineViewModel>( return BaseView<MedicineViewModel>(
onModelReady: (model) async { onModelReady: (model) async {
// TODO Elham* move this logic to the model // TODO Elham* move this logic to the model
model.getItem( model.getItem(itemID: int.parse(widget.groupProcedures.aliasN.replaceAll("item code ;", "")));
itemID: int.parse(
widget.groupProcedures.aliasN.replaceAll("item code ;", "")));
x = model.patientAssessmentList.map((element) { x = model.patientAssessmentList.map((element) {
return element.icdCode10ID; return element.icdCode10ID;
}); });
GetAssessmentReqModel getAssessmentReqModel = GetAssessmentReqModel( GetAssessmentReqModel getAssessmentReqModel =
patientMRN: widget.patient.patientMRN, GetAssessmentReqModel(patientMRN: widget.patient.patientMRN, episodeID: widget.patient.episodeNo.toString(), editedBy: '', doctorID: '', appointmentNo: widget.patient.appointmentNo);
episodeID: widget.patient.episodeNo.toString(),
editedBy: '',
doctorID: '',
appointmentNo: widget.patient.appointmentNo);
if (model.medicationStrengthList.length == 0) { if (model.medicationStrengthList.length == 0) {
await model.getMedicationStrength(); await model.getMedicationStrength();
} }
@ -265,8 +247,7 @@ class _PrescriptionCheckOutScreenState
height: MediaQuery.of(context).size.height * 1.35, height: MediaQuery.of(context).size.height * 1.35,
color: Color(0xffF8F8F8), color: Color(0xffF8F8F8),
child: Padding( child: Padding(
padding: padding: EdgeInsets.symmetric(horizontal: 12.0, vertical: 10.0),
EdgeInsets.symmetric(horizontal: 12.0, vertical: 10.0),
child: Column( child: Column(
children: [ children: [
Column( Column(
@ -290,8 +271,7 @@ class _PrescriptionCheckOutScreenState
width: 7.0, width: 7.0,
), ),
AppText( AppText(
TranslationBase.of(context) TranslationBase.of(context).newPrescriptionOrder,
.newPrescriptionOrder,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
fontSize: 20, fontSize: 20,
), ),
@ -325,16 +305,14 @@ class _PrescriptionCheckOutScreenState
child: Column( child: Column(
children: [ children: [
AppText( AppText(
widget.groupProcedures.procedureName ?? widget.groupProcedures.procedureName ?? "",
"",
bold: true, bold: true,
), ),
Container( Container(
child: Row( child: Row(
children: [ children: [
AppText( AppText(
TranslationBase.of(context) TranslationBase.of(context).orderType,
.orderType,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
), ),
Radio( Radio(
@ -345,8 +323,7 @@ class _PrescriptionCheckOutScreenState
setSelectedType(value); setSelectedType(value);
}, },
), ),
Text(TranslationBase.of(context) Text(TranslationBase.of(context).regular),
.regular),
], ],
), ),
), ),
@ -356,10 +333,7 @@ class _PrescriptionCheckOutScreenState
child: Row( child: Row(
children: [ children: [
Container( Container(
width: MediaQuery.of(context) width: MediaQuery.of(context).size.width * 0.35,
.size
.width *
0.35,
child: AppTextFieldCustom( child: AppTextFieldCustom(
height: 40, height: 40,
validationError: strengthError, validationError: strengthError,
@ -372,16 +346,12 @@ class _PrescriptionCheckOutScreenState
strengthChar = value.length; strengthChar = value.length;
}); });
if (strengthChar >= 5) { if (strengthChar >= 5) {
DrAppToastMsg DrAppToastMsg.showErrorToast(
.showErrorToast( TranslationBase.of(context).only5DigitsAllowedForStrength,
TranslationBase.of(
context)
.only5DigitsAllowedForStrength,
); );
} }
}, },
inputType: TextInputType inputType: TextInputType.numberWithOptions(
.numberWithOptions(
decimal: true, decimal: true,
), ),
), ),
@ -390,17 +360,13 @@ class _PrescriptionCheckOutScreenState
width: 5.0, width: 5.0,
), ),
PrescriptionTextFiled( PrescriptionTextFiled(
width: MediaQuery.of(context) width: MediaQuery.of(context).size.width * 0.560,
.size
.width *
0.560,
element: units, element: units,
elementError: unitError, elementError: unitError,
keyName: 'description', keyName: 'description',
keyId: 'parameterCode', keyId: 'parameterCode',
hintText: 'Select', hintText: 'Select',
elementList: elementList: model.itemMedicineListUnit,
model.itemMedicineListUnit,
okFunction: (selectedValue) { okFunction: (selectedValue) {
setState(() { setState(() {
units = selectedValue; units = selectedValue;
@ -413,8 +379,7 @@ class _PrescriptionCheckOutScreenState
), ),
SizedBox(height: spaceBetweenTextFields), SizedBox(height: spaceBetweenTextFields),
PrescriptionTextFiled( PrescriptionTextFiled(
elementList: elementList: model.itemMedicineListRoute,
model.itemMedicineListRoute,
element: route, element: route,
elementError: routeError, elementError: routeError,
keyId: 'parameterCode', keyId: 'parameterCode',
@ -425,13 +390,11 @@ class _PrescriptionCheckOutScreenState
route['isDefault'] = true; route['isDefault'] = true;
}); });
}, },
hintText: hintText: TranslationBase.of(context).route,
TranslationBase.of(context).route,
), ),
SizedBox(height: spaceBetweenTextFields), SizedBox(height: spaceBetweenTextFields),
PrescriptionTextFiled( PrescriptionTextFiled(
hintText: TranslationBase.of(context) hintText: TranslationBase.of(context).frequency,
.frequency,
elementError: frequencyError, elementError: frequencyError,
element: frequency, element: frequency,
elementList: model.itemMedicineList, elementList: model.itemMedicineList,
@ -441,21 +404,9 @@ class _PrescriptionCheckOutScreenState
setState(() { setState(() {
frequency = selectedValue; frequency = selectedValue;
frequency['isDefault'] = true; frequency['isDefault'] = true;
if (_selectedMedication != null && if (_selectedMedication != null && duration != null && frequency != null && strengthController.text != null) {
duration != null &&
frequency != null &&
strengthController.text !=
null) {
model.getBoxQuantity( model.getBoxQuantity(
freq: frequency[ freq: frequency['parameterCode'], duration: duration['id'], itemCode: _selectedMedication.itemId, strength: double.parse(strengthController.text));
'parameterCode'],
duration: duration['id'],
itemCode:
_selectedMedication
.itemId,
strength: double.parse(
strengthController
.text));
return; return;
} }
@ -463,12 +414,10 @@ class _PrescriptionCheckOutScreenState
}), }),
SizedBox(height: spaceBetweenTextFields), SizedBox(height: spaceBetweenTextFields),
PrescriptionTextFiled( PrescriptionTextFiled(
hintText: TranslationBase.of(context) hintText: TranslationBase.of(context).doseTime,
.doseTime,
elementError: doseTimeError, elementError: doseTimeError,
element: doseTime, element: doseTime,
elementList: elementList: model.medicationDoseTimeList,
model.medicationDoseTimeList,
keyId: 'id', keyId: 'id',
keyName: 'nameEn', keyName: 'nameEn',
okFunction: (selectedValue) { okFunction: (selectedValue) {
@ -477,8 +426,7 @@ class _PrescriptionCheckOutScreenState
}); });
}), }),
SizedBox(height: spaceBetweenTextFields), SizedBox(height: spaceBetweenTextFields),
if (model if (model.patientAssessmentList.isNotEmpty)
.patientAssessmentList.isNotEmpty)
Container( Container(
height: screenSize.height * 0.070, height: screenSize.height * 0.070,
width: double.infinity, width: double.infinity,
@ -486,47 +434,19 @@ class _PrescriptionCheckOutScreenState
child: Row( child: Row(
children: [ children: [
Container( Container(
width: MediaQuery.of(context) width: MediaQuery.of(context).size.width * 0.29,
.size
.width *
0.29,
child: TextField( child: TextField(
decoration: decoration: textFieldSelectorDecoration(model.patientAssessmentList[0].icdCode10ID.toString(), indication != null ? indication['name'] : null, false),
textFieldSelectorDecoration(
model
.patientAssessmentList[
0]
.icdCode10ID
.toString(),
indication != null
? indication[
'name']
: null,
false),
enabled: true, enabled: true,
readOnly: true, readOnly: true,
), ),
), ),
Container( Container(
width: MediaQuery.of(context) width: MediaQuery.of(context).size.width * 0.65,
.size
.width *
0.65,
color: Colors.white, color: Colors.white,
child: TextField( child: TextField(
maxLines: 5, maxLines: 5,
decoration: decoration: textFieldSelectorDecoration(model.patientAssessmentList[0].asciiDesc.toString(), indication != null ? indication['name'] : null, false),
textFieldSelectorDecoration(
model
.patientAssessmentList[
0]
.asciiDesc
.toString(),
indication != null
? indication[
'name']
: null,
false),
enabled: true, enabled: true,
readOnly: true, readOnly: true,
), ),
@ -539,16 +459,10 @@ class _PrescriptionCheckOutScreenState
height: screenSize.height * 0.070, height: screenSize.height * 0.070,
color: Colors.white, color: Colors.white,
child: InkWell( child: InkWell(
onTap: () => onTap: () => selectDate(context, widget.model),
selectDate(context, widget.model),
child: TextField( child: TextField(
decoration: textFieldSelectorDecoration( decoration: textFieldSelectorDecoration(TranslationBase.of(context).date,
TranslationBase.of(context) selectedDate != null ? "${AppDateUtils.convertStringToDateFormat(selectedDate.toString(), "yyyy-MM-dd")}" : null, true,
.date,
selectedDate != null
? "${AppDateUtils.convertStringToDateFormat(selectedDate.toString(), "yyyy-MM-dd")}"
: null,
true,
suffixIcon: Icon( suffixIcon: Icon(
Icons.calendar_today, Icons.calendar_today,
color: Colors.black, color: Colors.black,
@ -561,28 +475,19 @@ class _PrescriptionCheckOutScreenState
PrescriptionTextFiled( PrescriptionTextFiled(
element: duration, element: duration,
elementError: durationError, elementError: durationError,
hintText: TranslationBase.of(context) hintText: TranslationBase.of(context).duration,
.duration, elementList: model.medicationDurationList,
elementList:
model.medicationDurationList,
keyName: 'nameEn', keyName: 'nameEn',
keyId: 'id', keyId: 'id',
okFunction: (selectedValue) { okFunction: (selectedValue) {
setState(() { setState(() {
duration = selectedValue; duration = selectedValue;
if (_selectedMedication != null && if (_selectedMedication != null && duration != null && frequency != null && strengthController.text != null) {
duration != null &&
frequency != null &&
strengthController.text !=
null) {
model.getBoxQuantity( model.getBoxQuantity(
freq: freq: frequency['parameterCode'],
frequency['parameterCode'],
duration: duration['id'], duration: duration['id'],
itemCode: itemCode: _selectedMedication.itemId,
_selectedMedication.itemId, strength: double.parse(strengthController.text),
strength: double.parse(
strengthController.text),
); );
box = model.boxQuintity; box = model.boxQuintity;
@ -595,20 +500,13 @@ class _PrescriptionCheckOutScreenState
SizedBox(height: spaceBetweenTextFields), SizedBox(height: spaceBetweenTextFields),
SizedBox(height: spaceBetweenTextFields), SizedBox(height: spaceBetweenTextFields),
Container( Container(
decoration: BoxDecoration( decoration: BoxDecoration(borderRadius: BorderRadius.all(Radius.circular(6.0)), border: Border.all(width: 1.0, color: HexColor("#CCCCCC"))),
borderRadius: BorderRadius.all(
Radius.circular(6.0)),
border: Border.all(
width: 1.0,
color: HexColor("#CCCCCC"))),
child: Stack( child: Stack(
children: [ children: [
TextFields( TextFields(
maxLines: 6, maxLines: 6,
minLines: 4, minLines: 4,
hintText: hintText: TranslationBase.of(context).instruction,
TranslationBase.of(context)
.instruction,
controller: instructionController, controller: instructionController,
//keyboardType: TextInputType.number, //keyboardType: TextInputType.number,
), ),
@ -622,9 +520,7 @@ class _PrescriptionCheckOutScreenState
size: 35, size: 35,
), ),
onPressed: () { onPressed: () {
initSpeechState().then( initSpeechState().then((value) => {onVoiceText()});
(value) =>
{onVoiceText()});
}, },
), ),
), ),
@ -633,15 +529,13 @@ class _PrescriptionCheckOutScreenState
), ),
SizedBox(height: spaceBetweenTextFields), SizedBox(height: spaceBetweenTextFields),
Container( Container(
margin: EdgeInsets.all( margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5),
SizeConfig.widthMultiplier * 5),
child: Wrap( child: Wrap(
alignment: WrapAlignment.center, alignment: WrapAlignment.center,
children: <Widget>[ children: <Widget>[
AppButton( AppButton(
color: AppGlobal.appGreenColor, color: AppGlobal.appGreenColor,
title: TranslationBase.of(context) title: TranslationBase.of(context).addMedication,
.addMedication,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
onPressed: () async { onPressed: () async {
if (route != null && if (route != null &&
@ -650,101 +544,41 @@ class _PrescriptionCheckOutScreenState
frequency != null && frequency != null &&
units != null && units != null &&
selectedDate != null && selectedDate != null &&
strengthController.text != strengthController.text != "") {
"") { if (double.parse(strengthController.text) > 1000.0) {
if (double.parse(
strengthController
.text) >
1000.0) {
DrAppToastMsg.showErrorToast( DrAppToastMsg.showErrorToast(
TranslationBase.of(context).thousandIsTheMAXForTheStrength,); TranslationBase.of(context).thousandIsTheMAXForTheStrength,
);
return; return;
} }
if (double.parse( if (double.parse(strengthController.text) < 0.0) {
strengthController
.text) <
0.0) {
DrAppToastMsg.showErrorToast( DrAppToastMsg.showErrorToast(
TranslationBase.of(context).strengthCanNotBeZero,); TranslationBase.of(context).strengthCanNotBeZero,
);
return; return;
} }
if (formKey.currentState if (formKey.currentState.validate()) {
.validate()) {
Navigator.pop(context); Navigator.pop(context);
{ {
postPrescription( postPrescription(
icdCode: model icdCode: model.patientAssessmentList.isNotEmpty
.patientAssessmentList ? model.patientAssessmentList[0].icdCode10ID.isEmpty
.isNotEmpty
? model
.patientAssessmentList[
0]
.icdCode10ID
.isEmpty
? "test" ? "test"
: model : model.patientAssessmentList[0].icdCode10ID.toString()
.patientAssessmentList[
0]
.icdCode10ID
.toString()
: "test", : "test",
dose: strengthController dose: strengthController.text,
.text, doseUnit:
doseUnit: model model.itemMedicineListUnit.length == 1 ? model.itemMedicineListUnit[0]['parameterCode'].toString() : units['parameterCode'].toString(),
.itemMedicineListUnit
.length ==
1
? model
.itemMedicineListUnit[
0][
'parameterCode']
.toString()
: units['parameterCode']
.toString(),
patient: widget.patient, patient: widget.patient,
doseTimeIn: doseTimeIn: doseTime['id'].toString(),
doseTime['id']
.toString(),
model: widget.model, model: widget.model,
duration: duration['id'] duration: duration['id'].toString(),
.toString(), frequency: model.itemMedicineList.length == 1 ? model.itemMedicineList[0]['parameterCode'].toString() : frequency['parameterCode'].toString(),
frequency: model route: model.itemMedicineListRoute.length == 1 ? model.itemMedicineListRoute[0]['parameterCode'].toString() : route['parameterCode'].toString(),
.itemMedicineList drugId: (widget.groupProcedures.aliasN.replaceAll("item code ;", "")),
.length == strength: strengthController.text,
1 indication: indicationController.text,
? model instruction: instructionController.text,
.itemMedicineList[
0][
'parameterCode']
.toString()
: frequency[
'parameterCode']
.toString(),
route: model.itemMedicineListRoute
.length ==
1
? model
.itemMedicineListRoute[
0][
'parameterCode']
.toString()
: route['parameterCode']
.toString(),
drugId: (widget
.groupProcedures
.aliasN
.replaceAll(
"item code ;",
"")),
strength:
strengthController
.text,
indication:
indicationController
.text,
instruction:
instructionController
.text,
doseTime: selectedDate, doseTime: selectedDate,
); );
} }
@ -752,52 +586,32 @@ class _PrescriptionCheckOutScreenState
} else { } else {
setState(() { setState(() {
if (duration == null) { if (duration == null) {
durationError = durationError = TranslationBase.of(context).fieldRequired;
TranslationBase.of(
context)
.fieldRequired;
} else { } else {
durationError = null; durationError = null;
} }
if (doseTime == null) { if (doseTime == null) {
doseTimeError = doseTimeError = TranslationBase.of(context).fieldRequired;
TranslationBase.of(
context)
.fieldRequired;
} else { } else {
doseTimeError = null; doseTimeError = null;
} }
if (route == null) { if (route == null) {
routeError = routeError = TranslationBase.of(context).fieldRequired;
TranslationBase.of(
context)
.fieldRequired;
} else { } else {
routeError = null; routeError = null;
} }
if (frequency == null) { if (frequency == null) {
frequencyError = frequencyError = TranslationBase.of(context).fieldRequired;
TranslationBase.of(
context)
.fieldRequired;
} else { } else {
frequencyError = null; frequencyError = null;
} }
if (units == null) { if (units == null) {
unitError = unitError = TranslationBase.of(context).fieldRequired;
TranslationBase.of(
context)
.fieldRequired;
} else { } else {
unitError = null; unitError = null;
} }
if (strengthController if (strengthController.text == "") {
.text == strengthError = TranslationBase.of(context).fieldRequired;
"") {
strengthError =
TranslationBase.of(
context)
.fieldRequired;
} else { } else {
strengthError = null; strengthError = null;
} }
@ -849,9 +663,7 @@ class _PrescriptionCheckOutScreenState
/// TODO Elham* Use it from the textfeild utils /// TODO Elham* Use it from the textfeild utils
InputDecoration textFieldSelectorDecoration( InputDecoration textFieldSelectorDecoration(String hintText, String selectedText, bool isDropDown, {Icon suffixIcon}) {
String hintText, String selectedText, bool isDropDown,
{Icon suffixIcon}) {
return InputDecoration( return InputDecoration(
focusedBorder: OutlineInputBorder( focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0), borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0),

Loading…
Cancel
Save