WD: create dignosis and favorite diagnosis and listing of diagnosis

update_flutter_3.24_vida_plus_episode_v2
taha.alam 11 months ago
parent 76ce759e86
commit 6559dd123f

@ -338,6 +338,10 @@ const POST_PHYSICAL_EXAMINATION = 'Services/DoctorApplication.svc/REST/PostPhysi
const GET_PROGRESS_NOTE_NEW = 'Services/DoctorApplication.svc/REST/GetProgressNote';
const GET_LIST_OF_DIAGNOSIS = 'Services/DoctorApplication.svc/REST/DiagnosisDetailsSearch';
const EDIT_DIAGNOSIS = 'Services/DoctorApplication.svc/REST/EditDiagnosis';
var selectedPatientType = 1;

@ -1208,6 +1208,8 @@ const Map<String, Map<String, String>> localizedValues = {
"kindlySelectCategory": {"en": "Kindly Select Any Diagnosis Category", "ar":"يرجى اختيار أي فئة تشخيص"},
"noRemarks": {"en": "No Remarks", "ar":"لا ملاحظات"},
"event": {"en": "Event: ", "ar":"حدث: "},
"selectedDiagnosis": {"en": "Kindly Select Diagnosis", "ar":"يرجى اختيار التشخيص: "},
"selectConditionFirst": {"en": "Kindly Select Diagnosis Condition", "ar":"يرجى اختيار حالة التشخيص: "},
"deletedRemarks": {"en": "Deleted Remarks: ", "ar":"ملاحظات محذوفة: "},
"newValue": {"en": "New Value: ", "ar":"قيمة جديدة: "},
"fieldName": {"en": "Field Name: ", "ar":"اسم الحقل: "},

@ -26,6 +26,7 @@ class SearchDiagnosis {
String? selectedSectionCode;
String? selectedChapterCode;
String? selectedNandaCode;
bool isFavorite = false;
// Default constructor
SearchDiagnosis();

@ -57,6 +57,7 @@ class SOAPService extends LookupService {
List<GetChiefComplaintVidaPlus> patientChiefComplaintListVidaPlus = [];
List<SearchChiefComplaint> searchChiefComplaintListVidaPlus = [];
List<PatientPreviousDiagnosis> patientPreviousDiagnosisList = [];
List<PatientPreviousDiagnosis> patientDiagnosisList = [];
List<FavoriteDiseaseDetails> favoriteDiagnosisDetailsList = [];
List<AuditDiagnosis> auditDiagnosislist = [];
List<SearchDiagnosis> searchDiagnosisList = [];
@ -66,7 +67,6 @@ class SOAPService extends LookupService {
Map<String, dynamic> diagnosisTypeList = {};
Map<String, dynamic> conditionTypeList = {};
List<String> icdVersionList = [];
bool addedToFavorite = false;
bool showAuditBottomSheet = false;
int? episodeID;
@ -775,6 +775,37 @@ class SOAPService extends LookupService {
}, body: request);
}
getDiagnosis(PatiantInformtion patient) async {
Map<String, dynamic> request = {
"hospitalGroupId": 105,
"hospitalId": 313,
"patientId": 70023498,
"patientPomrId": 9907,
"startRow": 0,
"endRow": 10,
"isSelected": true,
"ProjectID": 313
// "hospitalGroupId": await sharedPref.getString(DOCTOR_SETUP_ID),
// "hospitalId": patient.projectId,
// "patientId": patient.patientId,
// "patientPomrId": patient.pomrId,
// "startRow": 0,
// "endRow": 1000000,
// "ProjectID": patient.projectId
};
hasError = false;
await baseAppClient.post(GET_LIST_OF_DIAGNOSIS,
onSuccess: (dynamic response, int statusCode) {
patientDiagnosisList.clear();
response['ListDiagnosisDetailsSearch']['resultData'].forEach((v) =>
patientDiagnosisList.add(PatientPreviousDiagnosis.fromJson(v)));
}, onFailure: (String error, int statusCode) {
patientDiagnosisList.clear();
hasError = true;
super.error = error;
}, body: request);
}
removeDiagnosis(PatiantInformtion patientInfo, String? patientProblemId,
String? problemId, String? deletedRemarks) async {
Map<String, dynamic> request = {
@ -835,15 +866,15 @@ class SOAPService extends LookupService {
Map<String, dynamic>? user = await sharedPref.getObj(LOGGED_IN_USER);
Map<String, dynamic> request =
// {
// "patientId": 70024978,
// "pomrId": 10819,
// "hospitalId": 313,
// "hospitalGroupId": 105,
// "ProjectID": 313
// };
{
// {
// "patientId": 70024978,
// "pomrId": 10819,
// "hospitalId": 313,
// "hospitalGroupId": 105,
// "ProjectID": 313
// };
{
"patientId": patientInfo.patientId,
"pomrId": patientInfo.pomrId,
"hospitalId": patientInfo.projectId,
@ -907,8 +938,8 @@ class SOAPService extends LookupService {
}, body: request);
}
addToFavoriteDiagnosis(PatiantInformtion paitientInfo, String doctorName,
String subFavoriteCode, String? userId) async {
Future<bool> addToFavoriteDiagnosis(PatiantInformtion paitientInfo, String doctorName,
String subFavoriteCode, dynamic? userId) async {
Map<String, dynamic> request = {
"ProjectID": paitientInfo.projectId,
"listDiagnosisFavourite": [
@ -923,24 +954,27 @@ class SOAPService extends LookupService {
]
};
hasError = false;
addedToFavorite = false;
var isFavoriteAdded = false;
favoriteDiagnosisDetailsList.clear();
await baseAppClient.post(ADD_TO_FAVORITE_DIAGNOSIS,
onSuccess: (dynamic response, int statusCode) {
var result = response['ListDiagnosisAddFavourite']['resultData'];
isFavoriteAdded = true;
if ((result as List).isEmpty) {
addedToFavorite = false;
DrAppToastMsg.showErrorToast(
response['ListDiagnosisAddFavourite']['message']);
} else {
addedToFavorite = true;
DrAppToastMsg.showSuccesToast("Added To Favorite");
DrAppToastMsg.showSuccesToast(response['ListDiagnosisAddFavourite']['message']);
}
}, onFailure: (String error, int statusCode) {
favoriteDiagnosisDetailsList.clear();
hasError = true;
isFavoriteAdded = false;
super.error = error;
}, body: request);
return isFavoriteAdded;
}
convertPreviousDiagnosisCurrent(PatiantInformtion paitientInfo,
@ -960,7 +994,7 @@ class SOAPService extends LookupService {
"ProjectID": paitientInfo.projectId
};
hasError = false;
addedToFavorite = false;
var addedToFavorite = false;
await baseAppClient.post(MAKE_PREVIOUS_AS_CURRENT_DIAGNOSIS,
onSuccess: (dynamic response, int statusCode) {
var result = response['ContinuePreviousEpisode']['resultData'];
@ -1028,41 +1062,68 @@ class SOAPService extends LookupService {
}
}
createDiagnosis(PatiantInformtion patient, SearchDiagnosis searchDiagnosis,
int diagnosisType, String conditionType, String remarks, bool isNew) {
/*{
"codeRange": "A79",
"selectedDisease": "Trench fever",
"categoryId": 3962,
"diseasesCode": "A79.0",
"diseasesId": 17664,
"selectedIcdCode": "A79.0",
"selectedCategoryCode": "A79.0",
"selectedSectionCode": "A79",
"selectedChapterCode": "XX",
"selectedNandaCode": "A79.0",
"codeType": "ICD",
"problemId": 1634,
"icdId": 1,
"problemName": "default",
}*/
Future<bool> createDiagnosis(PatiantInformtion patient, SearchDiagnosis? searchDiagnosis,
String? diagnosisType, String conditionType, String remarks, bool isNew) async{
Map<String, dynamic>? user = await sharedPref.getObj(LOGGED_IN_USER);
var request = {
"pomrId": patient.pomrId,
"appointmentId": patient.appointmentNo,
"clinicGroupId": patient.clinicGroupId,
"clinicId": patient.clinicId,
"patientId": patient.patientId,
"hospitalId": searchDiagnosis.hospitalId,
"hospitalId": searchDiagnosis!.hospitalId,
"hospitalGroupId": searchDiagnosis.hospitalGroupId,
"diagnosisType": diagnosisType,
"condition": conditionType,
"remarks": remarks,
"icdType": searchDiagnosis.icdType,
"icdVersion": searchDiagnosis.icdVersion,
// "icdVersion": searchDiagnosis.icdVersion,
"icdSubVersion": searchDiagnosis.icdSubVersion,
"isNew": isNew,
"specificationId": searchDiagnosis.specificationId,
"selectedDisease": searchDiagnosis.diseasesName,
"diseasesCode": searchDiagnosis.diseasesCode,
"diseasesId": searchDiagnosis.diseasesId,
"selectedIcdCode": searchDiagnosis.selectedIcdCode,
"selectedCategoryCode": searchDiagnosis.selectedCategoryCode,
"selectedSectionCode": searchDiagnosis.selectedSectionCode,
"selectedChapterCode": searchDiagnosis.selectedChapterCode,
"selectedNandaCode": searchDiagnosis.selectedNandaCode,
"isResolved": false,
"doctorId": patient.doctorId,
"doctorCode": user?['List_MemberInformation'][0]['MemberID'],
"ProjectID": patient.projectId,
"codeRange":searchDiagnosis.codeRange
};
var success = false;
await baseAppClient.post(CREATE_DIAGNOSIS,
onSuccess: (dynamic response, int statusCode) {
DrAppToastMsg.showSuccesToast(response['CreatDiagnosis']['message']);
success = true;
}, onFailure: (String error, int statusCode) {
success = false;
hasError = true;
super.error = error;
}, body: request);
return success;
}
Future<bool> editDiagnosis(PatientPreviousDiagnosis diagnosis) async{
Map<String, dynamic>? user = await sharedPref.getObj(LOGGED_IN_USER);
var request = diag;
var success = false;
await baseAppClient.post(CREATE_DIAGNOSIS,
onSuccess: (dynamic response, int statusCode) {
DrAppToastMsg.showSuccesToast(response['CreatDiagnosis']['message']);
success = true;
}, onFailure: (String error, int statusCode) {
success = false;
hasError = true;
super.error = error;
}, body: request);
return success;
}
}

@ -129,6 +129,9 @@ class SOAPViewModel extends BaseViewModel {
List<PatientPreviousDiagnosis> get patientPreviousDiagnosis =>
_SOAPService.patientPreviousDiagnosisList;
List<PatientPreviousDiagnosis> get diagnosisList =>
_SOAPService.patientDiagnosisList;
List<FavoriteDiseaseDetails> get favoriteDiagnosisDetails =>
_SOAPService.favoriteDiagnosisDetailsList;
@ -159,7 +162,6 @@ class SOAPViewModel extends BaseViewModel {
int? get episodeID => _SOAPService.episodeID;
bool get isFavorite => _SOAPService.addedToFavorite;
bool get showAudit => _SOAPService.showAuditBottomSheet;
@ -1096,6 +1098,16 @@ class SOAPViewModel extends BaseViewModel {
setState(ViewState.Idle);
}
getCurrentDiagnosisList(PatiantInformtion patientInfo) async {
setState(ViewState.BusyLocal);
await _SOAPService.getDiagnosis(patientInfo);
if (_SOAPService.hasError) {
error = _SOAPService.error;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
}
getAuditOfDiagnosis(
PatiantInformtion patient,
String patientProblemRevisionID,
@ -1145,21 +1157,29 @@ class SOAPViewModel extends BaseViewModel {
setState(ViewState.Idle);
}
void addToFavoriteDiagnosis(PatiantInformtion patientInfo,
Future<SearchDiagnosis?> addToFavoriteDiagnosis(PatiantInformtion patientInfo,
{SearchDiagnosis? diagnosis}) async {
setState(ViewState.BusyLocal);
Map<String, dynamic>? profile = await sharedPref.getObj(DOCTOR_PROFILE);
Map<String, dynamic>? user = await sharedPref.getObj(LOGGED_IN_USER);
await _SOAPService.addToFavoriteDiagnosis(
var userID = user?['List_MemberInformation'][0]['MemberID'];
bool result = await _SOAPService.addToFavoriteDiagnosis(
patientInfo,
profile?['DoctorName'] ?? '',
diagnosis?.diseasesBCode ?? '',
user?['List_MemberInformation'][0]['MemberID'] ?? '');
userID);
// if (diagnosis != null) {
diagnosis?.isFavorite = result;
// searchDiagnosisList[index] = diagnosis;
// }
if (_SOAPService.hasError) {
error = _SOAPService.error;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
return diagnosis;
}
void convertPreviousDiagnosisCurrent(PatiantInformtion paitientInfo,
@ -1183,21 +1203,21 @@ class SOAPViewModel extends BaseViewModel {
setState(ViewState.Idle);
}
List<Category> getListOfSelectedCategory(){
List<Category> getListOfSelectedCategory() {
List<Category> mappedItems = [];
for (List<Category> category in specialityDetails.values) {
var selectedCategory =
category.where((value) => value.isSelected == true);
category.where((value) => value.isSelected == true);
mappedItems.addAll(selectedCategory);
}
return mappedItems;
}
Future<bool> postPhysicalExamination(PatiantInformtion patientInfo, List<Category> listOfSelectedCategory) async {
Future<bool> postPhysicalExamination(PatiantInformtion patientInfo,
List<Category> listOfSelectedCategory) async {
setState(ViewState.BusyLocal);
bool result =
await _SOAPService.postPhysicalExamination(patientInfo, listOfSelectedCategory);
bool result = await _SOAPService.postPhysicalExamination(
patientInfo, listOfSelectedCategory);
if (_SOAPService.hasError) {
error = _SOAPService.error;
setState(ViewState.ErrorLocal);
@ -1231,9 +1251,6 @@ class SOAPViewModel extends BaseViewModel {
setState(ViewState.Idle);
}
void toggleFavorite(bool status) {
_SOAPService.addedToFavorite = status;
}
void toggleShowBottomSheetValue(bool status) {
_SOAPService.showAuditBottomSheet = status;
@ -1249,6 +1266,25 @@ class SOAPViewModel extends BaseViewModel {
setState(ViewState.Idle);
}
Future<bool> createDiagnosis(
PatiantInformtion patientInformation,
SearchDiagnosis? searchDiagnosis,
String? diagnosisType,
String conditionType,
String remarks,
bool isNew) async {
setState(ViewState.BusyLocal);
bool result = await _SOAPService.createDiagnosis(patientInformation,
searchDiagnosis, diagnosisType, conditionType, remarks, isNew);
if (_SOAPService.hasError) {
error = _SOAPService.error;
setState(ViewState.ErrorLocal);
} else
setState(ViewState.Idle);
return result;
}
void changeCurrentCategorySelectedState(
GeneralSpeciality selectedExamination, bool status) {
final item = speciality.firstWhere(
@ -1264,9 +1300,11 @@ class SOAPViewModel extends BaseViewModel {
if (query.isEmpty) {
speciality = mainSpecialityList ?? [];
}
var searchList =
mainSpecialityList?.where((value) => value.name?.toLowerCase().contains(query.toLowerCase()) == true).toList() ??
[];
var searchList = mainSpecialityList
?.where((value) =>
value.name?.toLowerCase().contains(query.toLowerCase()) == true)
.toList() ??
[];
speciality = searchList;
notifyListeners();
}

@ -38,7 +38,6 @@ class _AddDiagnosisState extends State<AddDiagnosis>
return BaseView<SOAPViewModel>(
onModelReady: (model) {
WidgetsBinding.instance.addPostFrameCallback((_) {
model.toggleFavorite(false);
model.getConditionAndType(widget.patientInfo);
model.favoriteDiagnosis(widget.patientInfo);
setState(() {
@ -98,56 +97,6 @@ class _AddDiagnosisState extends State<AddDiagnosis>
),
],
),
bottomSheet: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(0.0),
),
border: Border.all(color: HexColor('#707070'), width: 0),
),
height: SizeConfig.heightMultiplier! *
(SizeConfig.isHeightVeryShort ? 12 : 10),
width: double.infinity,
child: Padding(
padding: const EdgeInsets.all(10),
child: Column(
children: [
Center(
child: Row(
children: [
Expanded(
child: AppButton(
title: TranslationBase.of(context).previous,
color: Colors.grey[300]!,
// height: SizeConfig.heightMultiplier! *
// (SizeConfig.isHeightVeryShort ? 8 : 6),
// padding: 10,
fontColor: Colors.black,
fontWeight: FontWeight.w600,
onPressed: () {
Navigator.pop(context);
},
),
),
SizedBox(
width: 5,
),
Expanded(
child: AppButton(
title: TranslationBase.of(context).save,
fontWeight: FontWeight.w600,
color: Color(0xFF359846),
onPressed: () async {},
),
),
],
),
)
],
),
),
),
));
}
}

@ -70,6 +70,7 @@ class _UpdateAssessmentPageState extends State<UpdateAssessmentPage>
WidgetsBinding.instance.addPostFrameCallback((_) async {
widget.changeLoadingState(true);
model.getPreviousPatientDetails(widget.patientInfo);
model.getCurrentDiagnosisList(widget.patientInfo);
widget.changeLoadingState(false);
//todo handle get diagnosis list
});
@ -144,7 +145,7 @@ class _UpdateAssessmentPageState extends State<UpdateAssessmentPage>
CurrentDiagnosis(
patientInfo: widget.patientInfo,
model: model,
currentDiagnosisItems: [''],
currentDiagnosisItems: model.diagnosisList,
),
PreviousDiagnosis(
diagnosisItems: model.patientPreviousDiagnosis,

@ -12,7 +12,7 @@ class AuditListBottomSheet extends StatelessWidget {
@override
Widget build(BuildContext context) {
return SizedBox(
height: (auditList.length>1)?MediaQuery.sizeOf(context).height*.56:MediaQuery.sizeOf(context).height*.28,
height: (auditList.length>1)?MediaQuery.sizeOf(context).height*.41:MediaQuery.sizeOf(context).height*.28,
child: Material(
color: Color(0xFFF7F7F7),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.only(topLeft: Radius.circular(20), topRight: Radius.circular(20))),

@ -1,7 +1,11 @@
import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/core/model/SOAP/assessment/audit_diagnosis.dart';
import 'package:doctor_app_flutter/core/model/SOAP/assessment/patient_previous_diagnosis.dart';
import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/assessment/add_diagnosis.dart';
import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/assessment/widget/audit_list_bottom_sheet.dart';
import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/assessment/widget/empty_diagnosis.dart';
import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/subjective/chief_complaint/widgets/add_soap_item.dart';
import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/widgets/SoapDetailItem.dart';
@ -15,7 +19,7 @@ import '../../../../../../widgets/shared/text_fields/app-textfield-custom.dart';
class CurrentDiagnosis extends StatefulWidget {
final PatiantInformtion patientInfo;
final List<dynamic> currentDiagnosisItems;
final List<PatientPreviousDiagnosis> currentDiagnosisItems;
final SOAPViewModel model;
const CurrentDiagnosis(
@ -33,71 +37,102 @@ class _CurrentDiagnosisState extends State<CurrentDiagnosis> {
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
child: Column(
mainAxisSize: MainAxisSize.max,
children: [
SizedBox(
height: 10,
),
AddSoapItem(
title: TranslationBase.of(context).addNewDiagnosis,
onAddSoapItemClicked: () {
Navigator.push(
context,
FadePage(
page: AddDiagnosis(
patientInfo: widget.patientInfo,
)));
}),
SizedBox(
height: 16,
),
Divider(),
SizedBox(
height: 16,
),
if (widget.currentDiagnosisItems.isEmpty) ...{
Center(
child: EmptyDiagnosis(),
),
} else ...{
Flexible(
child: ListView.separated(
itemBuilder: (_, index) {
return SoapDetailItem(
title: 'lorem ipsum',
status: 'active',
condition: 'acute',
remarks: 'initial',
onSoapDetailActionClicked: (action) {
switch (action) {
case SoapDetailItemActions.EDIT:
// TODO: Handle this case.
case SoapDetailItemActions.RESOLVE:
// TODO: Handle this case.
case SoapDetailItemActions.REMOVE:
showConfirmationDialog(context,
"${TranslationBase.of(context).delete} ${TranslationBase.of(context).diagnosis}",
() {
widget.model
.removeDiagnosis(widget.patientInfo);
});
case SoapDetailItemActions.CHANGE_STATUS:
// TODO: Handle this case.
default:
}
},
);
},
separatorBuilder: (_, index) => Divider(),
itemCount: widget.currentDiagnosisItems.length))
return BaseView<SOAPViewModel>(
onModelReady: (model) async {},
builder: (_, model, w) {
if (model.showAudit) {
WidgetsBinding.instance.addPostFrameCallback((_) {
showAuditBottomSheet(context, model.auditDiagnosislist,
model.toggleShowBottomSheetValue);
model.toggleShowBottomSheetValue(false);
});
}
],
),
);
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
child: Column(
mainAxisSize: MainAxisSize.max,
children: [
SizedBox(
height: 10,
),
AddSoapItem(
title: TranslationBase.of(context).addNewDiagnosis,
onAddSoapItemClicked: () async {
bool result = await Navigator.push(
context,
FadePage(
page: AddDiagnosis(
patientInfo: widget.patientInfo,
)));
if (result) {
model.getCurrentDiagnosisList(widget.patientInfo);
}
}),
SizedBox(
height: 16,
),
Divider(),
SizedBox(
height: 16,
),
if (widget.currentDiagnosisItems.isEmpty) ...{
Center(
child: EmptyDiagnosis(),
),
} else ...{
Flexible(
child: ListView.separated(
itemBuilder: (_, index) {
return SoapDetailItem(
title: widget.currentDiagnosisItems[index]
.selectedDisease ??
'',
status:
widget.currentDiagnosisItems[index].status ??
'',
condition: widget
.currentDiagnosisItems[index].condition ??
'',
remarks:
widget.currentDiagnosisItems[index].remarks ??
'',
onSoapDetailActionClicked: (action) {
switch (action) {
case SoapDetailItemActions.AUDIT:
model.getAuditOfDiagnosis(
widget.patientInfo,
widget.currentDiagnosisItems[index]
.patientProblemRevisionId
?.toString() ??
'');
break;
case SoapDetailItemActions.EDIT:
// TODO: Handle this case.
case SoapDetailItemActions.RESOLVE:
// TODO: Handle this case.
case SoapDetailItemActions.REMOVE:
showConfirmationDialog(context,
"${TranslationBase.of(context).delete} ${TranslationBase.of(context).diagnosis}",
() {
widget.model
.removeDiagnosis(widget.patientInfo);
});
case SoapDetailItemActions.CHANGE_STATUS:
// TODO: Handle this case.
default:
}
},
);
},
separatorBuilder: (_, index) => Divider(),
itemCount: widget.currentDiagnosisItems.length))
}
],
),
);
});
}
showConfirmationDialog(
@ -179,4 +214,23 @@ class _CurrentDiagnosisState extends State<CurrentDiagnosis> {
deleteController.clear();
});
}
void showAuditBottomSheet(
BuildContext context,
List<AuditDiagnosis> diagnosis,
void Function(bool status) toggleShowBottomSheetValue,
) {
showModalBottomSheet(
isDismissible: true,
context: context,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(20), topRight: Radius.circular(20))),
builder: (_) {
return AuditListBottomSheet(
auditList: diagnosis,
);
},
).then((value) => toggleShowBottomSheetValue(false));
}
}

@ -0,0 +1,422 @@
import 'dart:async';
import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/core/enum/view_state.dart';
import 'package:doctor_app_flutter/core/model/SOAP/assessment/diagnosis_type.dart';
import 'package:doctor_app_flutter/core/model/SOAP/assessment/patient_previous_diagnosis.dart';
import 'package:doctor_app_flutter/core/model/SOAP/assessment/search_diagnosis.dart';
import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/screens/patients/patient_search/patient_search_header.dart';
import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/assessment/widget/empty_dropdown.dart';
import 'package:doctor_app_flutter/utils/dr_app_toast_msg.dart';
import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:hexcolor/hexcolor.dart';
List<String> patientState = ["", "Stable", "Not Stable", "Not Defined"];
class EnterDiagnosis extends StatefulWidget {
final PatiantInformtion patientInfo;
final PatientPreviousDiagnosis diagnosis;
const EnterDiagnosis({super.key, required this.patientInfo, required this.diagnosis});
@override
State<EnterDiagnosis> createState() => _EnterDiagnosisState();
}
class _EnterDiagnosisState extends State<EnterDiagnosis> {
final TextEditingController filteredSearchController =
TextEditingController();
bool showAllDiagnosis = true;
String status = '';
String? selectedDiagnosisItem;
TextEditingController remarksController = TextEditingController();
Timer? _tTimer;
SOAPViewModel? model;
SearchDiagnosis? selectedDiagnosis;
void _onTextChanged(String text) {
if (_tTimer != null) {
_tTimer!.cancel();
}
_tTimer = Timer(Duration(milliseconds: 500), () {
_onStopped(text);
});
}
void _onStopped(String searchText) async {
await model?.searchDiagnosis(widget.patientInfo, searchText);
}
@override
Widget build(BuildContext context) {
return BaseView<SOAPViewModel>(
onModelReady: (model) {
this.model = model;
},
builder: (_, model, w) => AppScaffold(
isLoading: model.state == ViewState.BusyLocal ,
isShowAppBar: true,
appBar: PatientSearchHeader(
title: TranslationBase.of(context).addDiagnosis),
body: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppText(
TranslationBase.of(context).addDiagnosis,
fontWeight: FontWeight.w600,
color: Color(0xFF2E303A),
fontSize: 16,
),
SizedBox(
height: 16,
),
AppTextFieldCustom(
hintText: TranslationBase.of(context).diagnosis,
isTextFieldHasSuffix: true,
hasBorder: true,
controller: filteredSearchController,
onClick: () {
setState(
() {
selectedDiagnosis = null;
filteredSearchController.text = '';
model.selectedIcd = '';
},
);
},
onChanged: (value) {
if (value != null) _onTextChanged(value);
},
onFieldSubmitted: () {},
suffixIcon: IconButton(
icon: Icon(
Icons.search,
color: Color(0xff2B353E),
size: 30,
),
onPressed: () {},
),
),
Positioned(
child: Material(
elevation: 4.0, // Optional: for shadow effect
child: ConstrainedBox(
constraints: BoxConstraints(minHeight: 0, maxHeight: 300),
child: ListView.builder(
shrinkWrap: true,
itemCount: model.icdVersionList.length,
itemBuilder: (context, index) {
return ListTile(
title: InkWell(
child: AppText(model.icdVersionList[index]),
onTap: () {
setState(
() {
selectedDiagnosis =
model.findTheDiagnosisItem(
model.icdVersionList[index]);
filteredSearchController.text =
model.icdVersionList[index];
model.searchDiagnosisList.clear();
model.icdVersionList.clear();
},
);
},
),
);
},
),
),
),
),
SizedBox(
height: 8,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
Switch(
value: showAllDiagnosis,
activeColor: Colors.red,
onChanged: (bool value) {
setState(() {
showAllDiagnosis = value;
});
},
),
SizedBox(
width: 8,
),
AppText(
TranslationBase.of(context).showAllDiagnosis,
fontWeight: FontWeight.w500,
color: Color(0xFF2E303A),
fontSize: 11,
),
],
),
SvgPicture.asset('assets/images/svgs/information.svg'),
],
),
Container(
margin: EdgeInsets.only(bottom: 12),
child: AppText(
TranslationBase.of(context).condition,
fontWeight: FontWeight.bold,
fontFamily: 'Poppins',
fontSize: 11,
),
),
SizedBox(
width: MediaQuery.sizeOf(context).width,
height: 24,
child: ListView.builder(
shrinkWrap: true,
scrollDirection: Axis.horizontal,
itemCount: model.conditionTypeList.length,
itemBuilder: (context, index) => InkWell(
onTap: () {
setState(() {
status = model.conditionTypeList[index];
});
},
child: Row(
children: [
Container(
padding: EdgeInsets.all(2.0),
margin: EdgeInsets.symmetric(horizontal: 6),
width: 20,
height: 20,
decoration: BoxDecoration(
color: Colors.white,
shape: BoxShape.circle,
border: Border.all(
color: Colors.grey, width: 1),
),
child: Container(
decoration: BoxDecoration(
color: status ==
model.conditionTypeList[index]
? HexColor("#D02127")
: Colors.white,
shape: BoxShape.circle,
),
),
),
AppText(
model.conditionTypeList[index],
fontWeight: FontWeight.normal,
fontFamily: 'Poppins',
fontSize: SizeConfig.textMultiplier! * 1.6,
),
],
),
)),
),
SizedBox(
height: 8,
),
Material(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
side: BorderSide(
width: 1,
color: Color(0xFFEFEFEF),
)),
color: Colors.white,
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 16.0, vertical: 12),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppText(
TranslationBase.of(context).diagnoseType,
textAlign: TextAlign.start,
fontWeight: FontWeight.w600,
fontSize: 11,
color: Color(0xFF2E303A),
),
SizedBox(
height: 4,
),
model.diagnosisTypeList.isEmpty
? EmptyDropDown()
: DropdownButtonHideUnderline(
child: DropdownButton(
dropdownColor: Colors.white,
iconEnabledColor: Colors.black,
icon: Icon(Icons.keyboard_arrow_down),
isExpanded: true,
value: selectedDiagnosisItem == null
? model.diagnosisTypeList.keys.first
: selectedDiagnosisItem,
iconSize: 25,
elevation: 16,
onChanged: (newValue) async {
if (newValue != null)
setState(() {
selectedDiagnosisItem = newValue;
});
},
items:
model.diagnosisTypeList.keys.map((item) {
return DropdownMenuItem(
child: AppText(
item ?? '',
fontSize: 14,
letterSpacing: -0.96,
color: AppGlobal.appTextColor,
fontWeight: FontWeight.normal,
textAlign: TextAlign.left,
),
value: item,
);
}).toList(),
),
),
],
),
),
),
Container(
margin: EdgeInsets.only(top: 8),
child: AppTextFieldCustom(
hintText: TranslationBase.of(context).remarks,
controller: remarksController,
minLines: 2,
maxLines: 4,
inputType: TextInputType.multiline,
onChanged: (value) {},
onClick: () {},
onFieldSubmitted: () {},
),
),
SizedBox(
height: 16,
),
InkWell(
onTap: () async {
if (selectedDiagnosis != null) {
SearchDiagnosis? diagnosis =
await model.addToFavoriteDiagnosis(widget.patientInfo,
diagnosis: selectedDiagnosis);
setState(() {
selectedDiagnosis = diagnosis;
});
}
},
child: Row(
children: [
SvgPicture.asset(selectedDiagnosis?.isFavorite == true
? 'assets/images/svgs/favoriteadded.svg'
: 'assets/images/svgs/favorite.svg'),
SizedBox(
width: 4,
),
AppText(
TranslationBase.of(context).addToFavorite,
textAlign: TextAlign.start,
fontWeight: FontWeight.w600,
fontSize: 10,
color: Color(0xFF449BF1),
),
],
),
)
],
),
),
),
bottomNavigationBar: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(0.0),
),
border: Border.all(color: HexColor('#707070'), width: 0),
),
height: SizeConfig.heightMultiplier! *
(SizeConfig.isHeightVeryShort ? 12 : 10),
width: double.infinity,
child: Padding(
padding: const EdgeInsets.all(10),
child: Column(
children: [
Center(
child: Row(
children: [
Expanded(
child: AppButton(
title: TranslationBase.of(context).previous,
color: Colors.grey[300]!,
fontColor: Colors.black,
fontWeight: FontWeight.w600,
onPressed: () {
Navigator.pop(context);
},
),
),
SizedBox(
width: 5,
),
Expanded(
child: AppButton(
title: TranslationBase.of(context).save,
fontWeight: FontWeight.w600,
color: Color(0xFF359846),
onPressed: () async {
selectedDiagnosisItem ??= model.diagnosisTypeList.keys.first;
if(selectedDiagnosis == null ){
DrAppToastMsg.showErrorToast(TranslationBase.of(context).selectedDiagnosis);
return;
}
if(status.isEmpty){
DrAppToastMsg.showErrorToast(TranslationBase.of(context).selectConditionFirst);
return;
}
if(remarksController.text.isEmpty){
DrAppToastMsg.showErrorToast(TranslationBase.of(context).remarksCanNotBeEmpty);
return;
}
bool result = await model.createDiagnosis(
widget.patientInfo,
selectedDiagnosis,
selectedDiagnosisItem,
status,
remarksController.text,
false);
if (result) {
Navigator.pop(context, result);
}
},
),
),
],
),
)
],
),
),
),
),
);
}
}

@ -8,8 +8,11 @@ import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/assessment/widget/empty_dropdown.dart';
import 'package:doctor_app_flutter/utils/dr_app_toast_msg.dart';
import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
@ -31,7 +34,7 @@ class _EnterDiagnosisState extends State<EnterDiagnosis> {
TextEditingController();
bool showAllDiagnosis = true;
String status = '';
String? selectedItem;
String? selectedDiagnosisItem;
TextEditingController remarksController = TextEditingController();
Timer? _tTimer;
SOAPViewModel? model;
@ -56,392 +59,354 @@ class _EnterDiagnosisState extends State<EnterDiagnosis> {
onModelReady: (model) {
this.model = model;
},
builder: (_, model, w) => SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppText(
TranslationBase.of(context).addDiagnosis,
fontWeight: FontWeight.w600,
color: Color(0xFF2E303A),
fontSize: 16,
),
SizedBox(
height: 16,
),
AppTextFieldCustom(
hintText: TranslationBase.of(context).diagnosis,
isTextFieldHasSuffix: true,
hasBorder: true,
controller: filteredSearchController,
onClick: () {
setState(
() {
selectedDiagnosis = null;
filteredSearchController.text = '';
model.selectedIcd = '';
},
);
},
onChanged: (value) {
if (value != null) _onTextChanged(value);
},
onFieldSubmitted: () {},
suffixIcon: IconButton(
icon: Icon(
Icons.search,
color: Color(0xff2B353E),
size: 30,
),
onPressed: () {},
builder: (_, model, w) => AppScaffold(
isShowAppBar: false,
body: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppText(
TranslationBase.of(context).addDiagnosis,
fontWeight: FontWeight.w600,
color: Color(0xFF2E303A),
fontSize: 16,
),
),
Positioned(
child: Material(
elevation: 4.0, // Optional: for shadow effect
child: ConstrainedBox(
constraints: BoxConstraints(minHeight: 0, maxHeight: 300),
child: ListView.builder(
shrinkWrap: true,
itemCount: model.icdVersionList.length,
itemBuilder: (context, index) {
return ListTile(
title: InkWell(
child: AppText(model.icdVersionList[index]),
onTap: () {
setState(
() {
selectedDiagnosis =
model.findTheDiagnosisItem(
model.icdVersionList[index]);
filteredSearchController.text =
model.icdVersionList[index];
model.searchDiagnosisList.clear();
model.icdVersionList.clear();
},
);
},
),
);
SizedBox(
height: 16,
),
AppTextFieldCustom(
hintText: TranslationBase.of(context).diagnosis,
isTextFieldHasSuffix: true,
hasBorder: true,
controller: filteredSearchController,
onClick: () {
setState(
() {
selectedDiagnosis = null;
filteredSearchController.text = '';
model.selectedIcd = '';
},
);
},
onChanged: (value) {
if (value != null) _onTextChanged(value);
},
onFieldSubmitted: () {},
suffixIcon: IconButton(
icon: Icon(
Icons.search,
color: Color(0xff2B353E),
size: 30,
),
onPressed: () {},
),
),
),
SizedBox(
height: 8,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
Switch(
value: showAllDiagnosis,
activeColor: Colors.red,
onChanged: (bool value) {
setState(() {
showAllDiagnosis = value;
});
Positioned(
child: Material(
elevation: 4.0, // Optional: for shadow effect
child: ConstrainedBox(
constraints: BoxConstraints(minHeight: 0, maxHeight: 300),
child: ListView.builder(
shrinkWrap: true,
itemCount: model.icdVersionList.length,
itemBuilder: (context, index) {
return ListTile(
title: InkWell(
child: AppText(model.icdVersionList[index]),
onTap: () {
setState(
() {
selectedDiagnosis =
model.findTheDiagnosisItem(
model.icdVersionList[index]);
filteredSearchController.text =
model.icdVersionList[index];
model.searchDiagnosisList.clear();
model.icdVersionList.clear();
},
);
},
),
);
},
),
SizedBox(
width: 8,
),
AppText(
TranslationBase.of(context).showAllDiagnosis,
fontWeight: FontWeight.w500,
color: Color(0xFF2E303A),
fontSize: 11,
),
],
),
),
SvgPicture.asset('assets/images/svgs/information.svg'),
],
),
Container(
margin: EdgeInsets.only(bottom: 12),
child: AppText(
TranslationBase.of(context).condition,
fontWeight: FontWeight.bold,
fontFamily: 'Poppins',
fontSize: 11,
),
),
// Row(
// children: [
// Expanded(
// child: InkWell(
// onTap: () {
// setState(() {
// status = "";
// });
// },
// child: Row(
// children: [
// Container(
// padding: EdgeInsets.all(2.0),
// margin: EdgeInsets.symmetric(horizontal: 6),
// width: 20,
// height: 20,
// decoration: BoxDecoration(
// color: Colors.white,
// shape: BoxShape.circle,
// border:
// Border.all(color: Colors.grey, width: 1),
// ),
// child: Container(
// decoration: BoxDecoration(
// color: status == 1
// ? HexColor("#D02127")
// : Colors.white,
// shape: BoxShape.circle,
// ),
// ),
// ),
// AppText(
// TranslationBase.of(context).acute,
// fontWeight: FontWeight.normal,
// fontFamily: 'Poppins',
// fontSize: SizeConfig.textMultiplier! * 1.6,
// ),
// ],
// ),
// )),
// Expanded(
// child: InkWell(
// onTap: () {
// setState(() {
// status = "2";
// });
// },
// child: Row(
// children: [
// Container(
// padding: EdgeInsets.all(2.0),
// margin: EdgeInsets.symmetric(horizontal: 6),
// width: 20,
// height: 20,
// decoration: BoxDecoration(
// color: Colors.white,
// shape: BoxShape.circle,
// border: Border.all(
// color: Colors.grey, width: 1),
// ),
// child: Container(
// decoration: BoxDecoration(
// color: status == 2
// ? HexColor("#D02127")
// : Colors.white,
// shape: BoxShape.circle,
// ),
// ),
// ),
// AppText(
// TranslationBase.of(context).subAcute,
// fontWeight: FontWeight.normal,
// fontFamily: 'Poppins',
// fontSize: SizeConfig.textMultiplier! * 1.6,
// ),
// ],
// ),
// ),
// ),
// Expanded(
// child: InkWell(
// onTap: () {
// setState(() {
// status = "3";
// });
// },
// child: Row(
// children: [
// Container(
// padding: EdgeInsets.all(2.0),
// margin: EdgeInsets.symmetric(horizontal: 6),
// width: 20,
// height: 20,
// decoration: BoxDecoration(
// color: Colors.white,
// shape: BoxShape.circle,
// border: Border.all(
// color: Colors.grey, width: 1),
// ),
// child: Container(
// decoration: BoxDecoration(
// color: status == 3
// ? HexColor("#D02127")
// : Colors.white,
// shape: BoxShape.circle,
// ),
// ),
// ),
// AppText(
// TranslationBase.of(context).chronic,
// fontWeight: FontWeight.normal,
// fontFamily: 'Poppins',
// fontSize: SizeConfig.textMultiplier! * 1.6,
// ),
// ],
// ),
// ),
// ),
// ],
// ),
SizedBox(
width: MediaQuery.sizeOf(context).width,
height: 24,
child: ListView.builder(
shrinkWrap: true,
scrollDirection: Axis.horizontal,
itemCount: model.conditionTypeList.length,
itemBuilder: (context, index) => InkWell(
onTap: () {
SizedBox(
height: 8,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
Switch(
value: showAllDiagnosis,
activeColor: Colors.red,
onChanged: (bool value) {
setState(() {
status = model.conditionTypeList[index];
showAllDiagnosis = value;
});
},
child: Row(
children: [
Container(
padding: EdgeInsets.all(2.0),
margin: EdgeInsets.symmetric(horizontal: 6),
width: 20,
height: 20,
decoration: BoxDecoration(
color: Colors.white,
shape: BoxShape.circle,
border:
Border.all(color: Colors.grey, width: 1),
),
child: Container(
),
SizedBox(
width: 8,
),
AppText(
TranslationBase.of(context).showAllDiagnosis,
fontWeight: FontWeight.w500,
color: Color(0xFF2E303A),
fontSize: 11,
),
],
),
SvgPicture.asset('assets/images/svgs/information.svg'),
],
),
Container(
margin: EdgeInsets.only(bottom: 12),
child: AppText(
TranslationBase.of(context).condition,
fontWeight: FontWeight.bold,
fontFamily: 'Poppins',
fontSize: 11,
),
),
SizedBox(
width: MediaQuery.sizeOf(context).width,
height: 24,
child: ListView.builder(
shrinkWrap: true,
scrollDirection: Axis.horizontal,
itemCount: model.conditionTypeList.length,
itemBuilder: (context, index) => InkWell(
onTap: () {
setState(() {
status = model.conditionTypeList[index];
});
},
child: Row(
children: [
Container(
padding: EdgeInsets.all(2.0),
margin: EdgeInsets.symmetric(horizontal: 6),
width: 20,
height: 20,
decoration: BoxDecoration(
color:
status == model.conditionTypeList[index]
? HexColor("#D02127")
: Colors.white,
color: Colors.white,
shape: BoxShape.circle,
border: Border.all(
color: Colors.grey, width: 1),
),
child: Container(
decoration: BoxDecoration(
color: status ==
model.conditionTypeList[index]
? HexColor("#D02127")
: Colors.white,
shape: BoxShape.circle,
),
),
),
AppText(
model.conditionTypeList[index],
fontWeight: FontWeight.normal,
fontFamily: 'Poppins',
fontSize: SizeConfig.textMultiplier! * 1.6,
),
],
),
)),
),
SizedBox(
height: 8,
),
Material(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
side: BorderSide(
width: 1,
color: Color(0xFFEFEFEF),
)),
color: Colors.white,
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 16.0, vertical: 12),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppText(
TranslationBase.of(context).diagnoseType,
textAlign: TextAlign.start,
fontWeight: FontWeight.w600,
fontSize: 11,
color: Color(0xFF2E303A),
),
SizedBox(
height: 4,
),
model.diagnosisTypeList.isEmpty
? EmptyDropDown()
: DropdownButtonHideUnderline(
child: DropdownButton(
dropdownColor: Colors.white,
iconEnabledColor: Colors.black,
icon: Icon(Icons.keyboard_arrow_down),
isExpanded: true,
value: selectedDiagnosisItem == null
? model.diagnosisTypeList.keys.first
: selectedDiagnosisItem,
iconSize: 25,
elevation: 16,
onChanged: (newValue) async {
if (newValue != null)
setState(() {
selectedDiagnosisItem = newValue;
});
},
items:
model.diagnosisTypeList.keys.map((item) {
return DropdownMenuItem(
child: AppText(
item ?? '',
fontSize: 14,
letterSpacing: -0.96,
color: AppGlobal.appTextColor,
fontWeight: FontWeight.normal,
textAlign: TextAlign.left,
),
value: item,
);
}).toList(),
),
),
AppText(
model.conditionTypeList[index],
fontWeight: FontWeight.normal,
fontFamily: 'Poppins',
fontSize: SizeConfig.textMultiplier! * 1.6,
),
],
),
)),
),
SizedBox(
height: 8,
),
Material(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
side: BorderSide(
width: 1,
color: Color(0xFFEFEFEF),
)),
color: Colors.white,
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 16.0, vertical: 12),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
],
),
),
),
Container(
margin: EdgeInsets.only(top: 8),
child: AppTextFieldCustom(
hintText: TranslationBase.of(context).remarks,
controller: remarksController,
minLines: 2,
maxLines: 4,
inputType: TextInputType.multiline,
onChanged: (value) {},
onClick: () {},
onFieldSubmitted: () {},
),
),
SizedBox(
height: 16,
),
InkWell(
onTap: () async {
if (selectedDiagnosis != null) {
SearchDiagnosis? diagnosis =
await model.addToFavoriteDiagnosis(widget.patientInfo,
diagnosis: selectedDiagnosis);
setState(() {
selectedDiagnosis = diagnosis;
});
}
},
child: Row(
children: [
SvgPicture.asset(selectedDiagnosis?.isFavorite == true
? 'assets/images/svgs/favoriteadded.svg'
: 'assets/images/svgs/favorite.svg'),
SizedBox(
width: 4,
),
AppText(
TranslationBase.of(context).diagnoseType,
TranslationBase.of(context).addToFavorite,
textAlign: TextAlign.start,
fontWeight: FontWeight.w600,
fontSize: 11,
color: Color(0xFF2E303A),
fontSize: 10,
color: Color(0xFF449BF1),
),
],
),
)
],
),
),
),
bottomNavigationBar: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(0.0),
),
border: Border.all(color: HexColor('#707070'), width: 0),
),
height: SizeConfig.heightMultiplier! *
(SizeConfig.isHeightVeryShort ? 12 : 10),
width: double.infinity,
child: Padding(
padding: const EdgeInsets.all(10),
child: Column(
children: [
Center(
child: Row(
children: [
Expanded(
child: AppButton(
title: TranslationBase.of(context).previous,
color: Colors.grey[300]!,
fontColor: Colors.black,
fontWeight: FontWeight.w600,
onPressed: () {
Navigator.pop(context);
},
),
),
SizedBox(
height: 4,
width: 5,
),
Expanded(
child: AppButton(
title: TranslationBase.of(context).save,
fontWeight: FontWeight.w600,
color: Color(0xFF359846),
onPressed: () async {
selectedDiagnosisItem ??= model.diagnosisTypeList.keys.first;
if(selectedDiagnosis == null ){
DrAppToastMsg.showErrorToast(TranslationBase.of(context).selectedDiagnosis);
return;
}
if(status.isEmpty){
DrAppToastMsg.showErrorToast(TranslationBase.of(context).selectConditionFirst);
return;
}
if(remarksController.text.isEmpty){
DrAppToastMsg.showErrorToast(TranslationBase.of(context).remarksCanNotBeEmpty);
return;
}
bool result = await model.createDiagnosis(
widget.patientInfo,
selectedDiagnosis,
selectedDiagnosisItem,
status,
remarksController.text,
false);
if (result) {
Navigator.pop(context, result);
}
},
),
),
model.diagnosisTypeList.isEmpty
? EmptyDropDown()
: DropdownButtonHideUnderline(
child: DropdownButton(
dropdownColor: Colors.white,
iconEnabledColor: Colors.black,
icon: Icon(Icons.keyboard_arrow_down),
isExpanded: true,
value: selectedItem == null
? model.diagnosisTypeList.keys.first
: selectedItem,
iconSize: 25,
elevation: 16,
onChanged: (newValue) async {
if (newValue != null)
setState(() {
selectedItem = newValue;
});
},
items: model.diagnosisTypeList.keys.map((item) {
return DropdownMenuItem(
child: AppText(
item ?? '',
fontSize: 14,
letterSpacing: -0.96,
color: AppGlobal.appTextColor,
fontWeight: FontWeight.normal,
textAlign: TextAlign.left,
),
value: item,
);
}).toList(),
),
),
],
),
),
),
Container(
margin: EdgeInsets.only(top: 8),
child: AppTextFieldCustom(
hintText: TranslationBase.of(context).remarks,
controller: remarksController,
minLines: 2,
maxLines: 4,
inputType: TextInputType.multiline,
onChanged: (value) {},
onClick: () {},
onFieldSubmitted: () {},
),
),
SizedBox(
height: 16,
),
InkWell(
onTap: () {
if (selectedDiagnosis != null)
model.addToFavoriteDiagnosis(widget.patientInfo,
diagnosis: selectedDiagnosis);
},
child: Row(
children: [
SvgPicture.asset(model.isFavorite
? 'assets/images/svgs/favoriteadded.svg'
: 'assets/images/svgs/favorite.svg'),
SizedBox(
width: 4,
),
AppText(
TranslationBase.of(context).addToFavorite,
textAlign: TextAlign.start,
fontWeight: FontWeight.w600,
fontSize: 10,
color: Color(0xFF449BF1),
),
],
),
)
],
)
],
),
),
),
),

@ -9,7 +9,9 @@ import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/assessment/widget/empty_dropdown.dart';
import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
@ -60,357 +62,406 @@ class _FavoriteDiagnosisState extends State<FavoriteDiagnosis> {
model.favoriteDiagnosis(widget.patientInfo);
});
},
builder: (_, model, w) => SingleChildScrollView(
child: Padding(
padding:
const EdgeInsets.symmetric(vertical: 12, horizontal: 16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppText(
TranslationBase.of(context).addDiagnosis,
fontWeight: FontWeight.w600,
color: Color(0xFF2E303A),
fontSize: 16,
),
SizedBox(
height: 16,
),
Material(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
side: BorderSide(
width: 1,
color: Color(0xFFEFEFEF),
)),
color: Colors.white,
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 16.0, vertical: 12),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppText(
TranslationBase.of(context).diagnosis,
textAlign: TextAlign.start,
fontWeight: FontWeight.w600,
fontSize: 11,
color: Color(0xFF2E303A),
),
SizedBox(
height: 4,
),
model.favoriteDiagnosisDetails.isEmpty
? EmptyDropDown()
: DropdownButtonHideUnderline(
child: DropdownButton(
dropdownColor: Colors.white,
iconEnabledColor: Colors.black,
icon: Icon(Icons.keyboard_arrow_down),
isExpanded: true,
itemHeight: null,
value: selectedFavorite == null
? model.favoriteDiagnosisDetails.first
.diseases
: selectedFavorite,
iconSize: 25,
elevation: 16,
onChanged: (newValue) async {
if (newValue != null)
setState(() {
selectedFavorite = newValue;
});
},
items: model.favoriteDiagnosisDetails
.map((item) {
return DropdownMenuItem(
child: AppText(
item.diseases ?? '',
fontSize: 14,
letterSpacing: -0.96,
color: AppGlobal.appTextColor,
fontWeight: FontWeight.normal,
textAlign: TextAlign.left,
),
value: item.diseases,
);
}).toList(),
),
),
],
),
builder: (_, model, w) => AppScaffold(
body: SingleChildScrollView(
child: Padding(
padding:
const EdgeInsets.symmetric(vertical: 12, horizontal: 16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppText(
TranslationBase.of(context).addDiagnosis,
fontWeight: FontWeight.w600,
color: Color(0xFF2E303A),
fontSize: 16,
),
),
SizedBox(
height: 8,
),
Container(
margin: EdgeInsets.only(bottom: 12),
child: AppText(
TranslationBase.of(context).condition,
fontWeight: FontWeight.bold,
fontFamily: 'Poppins',
fontSize: 11,
SizedBox(
height: 16,
),
),
// Row(
// children: [
// Expanded(
// child: InkWell(
// onTap: () {
// setState(() {
// status = "";
// });
// },
// child: Row(
// children: [
// Container(
// padding: EdgeInsets.all(2.0),
// margin: EdgeInsets.symmetric(horizontal: 6),
// width: 20,
// height: 20,
// decoration: BoxDecoration(
// color: Colors.white,
// shape: BoxShape.circle,
// border:
// Border.all(color: Colors.grey, width: 1),
// ),
// child: Container(
// decoration: BoxDecoration(
// color: status == 1
// ? HexColor("#D02127")
// : Colors.white,
// shape: BoxShape.circle,
// ),
// ),
// ),
// AppText(
// TranslationBase.of(context).acute,
// fontWeight: FontWeight.normal,
// fontFamily: 'Poppins',
// fontSize: SizeConfig.textMultiplier! * 1.6,
// ),
// ],
// ),
// )),
// Expanded(
// child: InkWell(
// onTap: () {
// setState(() {
// status = "2";
// });
// },
// child: Row(
// children: [
// Container(
// padding: EdgeInsets.all(2.0),
// margin: EdgeInsets.symmetric(horizontal: 6),
// width: 20,
// height: 20,
// decoration: BoxDecoration(
// color: Colors.white,
// shape: BoxShape.circle,
// border: Border.all(
// color: Colors.grey, width: 1),
// ),
// child: Container(
// decoration: BoxDecoration(
// color: status == 2
// ? HexColor("#D02127")
// : Colors.white,
// shape: BoxShape.circle,
// ),
// ),
// ),
// AppText(
// TranslationBase.of(context).subAcute,
// fontWeight: FontWeight.normal,
// fontFamily: 'Poppins',
// fontSize: SizeConfig.textMultiplier! * 1.6,
// ),
// ],
// ),
// ),
// ),
// Expanded(
// child: InkWell(
// onTap: () {
// setState(() {
// status = "3";
// });
// },
// child: Row(
// children: [
// Container(
// padding: EdgeInsets.all(2.0),
// margin: EdgeInsets.symmetric(horizontal: 6),
// width: 20,
// height: 20,
// decoration: BoxDecoration(
// color: Colors.white,
// shape: BoxShape.circle,
// border: Border.all(
// color: Colors.grey, width: 1),
// ),
// child: Container(
// decoration: BoxDecoration(
// color: status == 3
// ? HexColor("#D02127")
// : Colors.white,
// shape: BoxShape.circle,
// ),
// ),
// ),
// AppText(
// TranslationBase.of(context).chronic,
// fontWeight: FontWeight.normal,
// fontFamily: 'Poppins',
// fontSize: SizeConfig.textMultiplier! * 1.6,
// ),
// ],
// ),
// ),
// ),
// ],
// ),
SizedBox(
width: MediaQuery.sizeOf(context).width,
height: 24,
child: ListView.builder(
shrinkWrap: true,
scrollDirection: Axis.horizontal,
itemCount: model.conditionTypeList.length,
itemBuilder: (context, index) => InkWell(
onTap: () {
setState(() {
status = model.conditionTypeList[index];
});
},
child: Row(
children: [
Container(
padding: EdgeInsets.all(2.0),
margin:
EdgeInsets.symmetric(horizontal: 6),
width: 20,
height: 20,
decoration: BoxDecoration(
color: Colors.white,
shape: BoxShape.circle,
border: Border.all(
color: Colors.grey, width: 1),
),
child: Container(
decoration: BoxDecoration(
color: status ==
model.conditionTypeList[index]
? HexColor("#D02127")
: Colors.white,
shape: BoxShape.circle,
),
),
),
AppText(
model.conditionTypeList[index],
fontWeight: FontWeight.normal,
fontFamily: 'Poppins',
fontSize:
SizeConfig.textMultiplier! * 1.6,
),
],
),
)),
),
SizedBox(
height: 8,
),
Material(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
side: BorderSide(
width: 1,
color: Color(0xFFEFEFEF),
)),
color: Colors.white,
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 16.0, vertical: 12),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppText(
TranslationBase.of(context).diagnoseType,
textAlign: TextAlign.start,
fontWeight: FontWeight.w600,
fontSize: 11,
color: Color(0xFF2E303A),
),
SizedBox(
height: 4,
),
model.diagnosisTypeList.isEmpty
? EmptyDropDown()
: DropdownButtonHideUnderline(
child: DropdownButton(
itemHeight: null,
dropdownColor: Colors.white,
iconEnabledColor: Colors.black,
icon: Icon(Icons.keyboard_arrow_down),
isExpanded: true,
value: selectedItem == null
? model.diagnosisTypeList.keys.first
: selectedItem,
iconSize: 25,
elevation: 16,
onChanged: (newValue) async {
if (newValue != null)
setState(() {
selectedItem = newValue;
});
},
items: model.diagnosisTypeList.keys
.map((item) {
return DropdownMenuItem(
child: Padding(
padding: const EdgeInsets.all(8.0),
Material(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
side: BorderSide(
width: 1,
color: Color(0xFFEFEFEF),
)),
color: Colors.white,
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 16.0, vertical: 12),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppText(
TranslationBase.of(context).diagnosis,
textAlign: TextAlign.start,
fontWeight: FontWeight.w600,
fontSize: 11,
color: Color(0xFF2E303A),
),
SizedBox(
height: 4,
),
model.favoriteDiagnosisDetails.isEmpty
? EmptyDropDown()
: DropdownButtonHideUnderline(
child: DropdownButton(
dropdownColor: Colors.white,
iconEnabledColor: Colors.black,
icon: Icon(Icons.keyboard_arrow_down),
isExpanded: true,
itemHeight: null,
value: selectedFavorite == null
? model.favoriteDiagnosisDetails.first
.diseases
: selectedFavorite,
iconSize: 25,
elevation: 16,
onChanged: (newValue) async {
if (newValue != null)
setState(() {
selectedFavorite = newValue;
});
},
items: model.favoriteDiagnosisDetails
.map((item) {
return DropdownMenuItem(
child: AppText(
item ?? '',
item.diseases ?? '',
fontSize: 14,
letterSpacing: -0.96,
color: AppGlobal.appTextColor,
fontWeight: FontWeight.normal,
textAlign: TextAlign.left,
),
),
value: item,
);
}).toList(),
value: item.diseases,
);
}).toList(),
),
),
],
),
),
),
SizedBox(
height: 8,
),
Container(
margin: EdgeInsets.only(bottom: 12),
child: AppText(
TranslationBase.of(context).condition,
fontWeight: FontWeight.bold,
fontFamily: 'Poppins',
fontSize: 11,
),
),
// Row(
// children: [
// Expanded(
// child: InkWell(
// onTap: () {
// setState(() {
// status = "";
// });
// },
// child: Row(
// children: [
// Container(
// padding: EdgeInsets.all(2.0),
// margin: EdgeInsets.symmetric(horizontal: 6),
// width: 20,
// height: 20,
// decoration: BoxDecoration(
// color: Colors.white,
// shape: BoxShape.circle,
// border:
// Border.all(color: Colors.grey, width: 1),
// ),
// child: Container(
// decoration: BoxDecoration(
// color: status == 1
// ? HexColor("#D02127")
// : Colors.white,
// shape: BoxShape.circle,
// ),
// ),
// ),
// AppText(
// TranslationBase.of(context).acute,
// fontWeight: FontWeight.normal,
// fontFamily: 'Poppins',
// fontSize: SizeConfig.textMultiplier! * 1.6,
// ),
// ],
// ),
// )),
// Expanded(
// child: InkWell(
// onTap: () {
// setState(() {
// status = "2";
// });
// },
// child: Row(
// children: [
// Container(
// padding: EdgeInsets.all(2.0),
// margin: EdgeInsets.symmetric(horizontal: 6),
// width: 20,
// height: 20,
// decoration: BoxDecoration(
// color: Colors.white,
// shape: BoxShape.circle,
// border: Border.all(
// color: Colors.grey, width: 1),
// ),
// child: Container(
// decoration: BoxDecoration(
// color: status == 2
// ? HexColor("#D02127")
// : Colors.white,
// shape: BoxShape.circle,
// ),
// ),
// ),
// AppText(
// TranslationBase.of(context).subAcute,
// fontWeight: FontWeight.normal,
// fontFamily: 'Poppins',
// fontSize: SizeConfig.textMultiplier! * 1.6,
// ),
// ],
// ),
// ),
// ),
// Expanded(
// child: InkWell(
// onTap: () {
// setState(() {
// status = "3";
// });
// },
// child: Row(
// children: [
// Container(
// padding: EdgeInsets.all(2.0),
// margin: EdgeInsets.symmetric(horizontal: 6),
// width: 20,
// height: 20,
// decoration: BoxDecoration(
// color: Colors.white,
// shape: BoxShape.circle,
// border: Border.all(
// color: Colors.grey, width: 1),
// ),
// child: Container(
// decoration: BoxDecoration(
// color: status == 3
// ? HexColor("#D02127")
// : Colors.white,
// shape: BoxShape.circle,
// ),
// ),
// ),
// AppText(
// TranslationBase.of(context).chronic,
// fontWeight: FontWeight.normal,
// fontFamily: 'Poppins',
// fontSize: SizeConfig.textMultiplier! * 1.6,
// ),
// ],
// ),
// ),
// ),
// ],
// ),
SizedBox(
width: MediaQuery.sizeOf(context).width,
height: 24,
child: ListView.builder(
shrinkWrap: true,
scrollDirection: Axis.horizontal,
itemCount: model.conditionTypeList.length,
itemBuilder: (context, index) => InkWell(
onTap: () {
setState(() {
status = model.conditionTypeList[index];
});
},
child: Row(
children: [
Container(
padding: EdgeInsets.all(2.0),
margin:
EdgeInsets.symmetric(horizontal: 6),
width: 20,
height: 20,
decoration: BoxDecoration(
color: Colors.white,
shape: BoxShape.circle,
border: Border.all(
color: Colors.grey, width: 1),
),
child: Container(
decoration: BoxDecoration(
color: status ==
model.conditionTypeList[index]
? HexColor("#D02127")
: Colors.white,
shape: BoxShape.circle,
),
),
),
AppText(
model.conditionTypeList[index],
fontWeight: FontWeight.normal,
fontFamily: 'Poppins',
fontSize:
SizeConfig.textMultiplier! * 1.6,
),
],
),
],
)),
),
SizedBox(
height: 8,
),
Material(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
side: BorderSide(
width: 1,
color: Color(0xFFEFEFEF),
)),
color: Colors.white,
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 16.0, vertical: 12),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppText(
TranslationBase.of(context).diagnoseType,
textAlign: TextAlign.start,
fontWeight: FontWeight.w600,
fontSize: 11,
color: Color(0xFF2E303A),
),
SizedBox(
height: 4,
),
model.diagnosisTypeList.isEmpty
? EmptyDropDown()
: DropdownButtonHideUnderline(
child: DropdownButton(
itemHeight: null,
dropdownColor: Colors.white,
iconEnabledColor: Colors.black,
icon: Icon(Icons.keyboard_arrow_down),
isExpanded: true,
value: selectedItem == null
? model.diagnosisTypeList.keys.first
: selectedItem,
iconSize: 25,
elevation: 16,
onChanged: (newValue) async {
if (newValue != null)
setState(() {
selectedItem = newValue;
});
},
items: model.diagnosisTypeList.keys
.map((item) {
return DropdownMenuItem(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: AppText(
item ?? '',
fontSize: 14,
letterSpacing: -0.96,
color: AppGlobal.appTextColor,
fontWeight: FontWeight.normal,
textAlign: TextAlign.left,
),
),
value: item,
);
}).toList(),
),
),
],
),
),
),
),
Container(
margin: EdgeInsets.only(top: 8),
child: AppTextFieldCustom(
hintText: TranslationBase.of(context).remarks,
controller: remarksController,
minLines: 2,
maxLines: 4,
inputType: TextInputType.multiline,
onChanged: (value) {},
onClick: () {},
onFieldSubmitted: () {},
Container(
margin: EdgeInsets.only(top: 8),
child: AppTextFieldCustom(
hintText: TranslationBase.of(context).remarks,
controller: remarksController,
minLines: 2,
maxLines: 4,
inputType: TextInputType.multiline,
onChanged: (value) {},
onClick: () {},
onFieldSubmitted: () {},
),
),
),
SizedBox(
height: 16,
),
],
SizedBox(
height: 16,
),
],
),
),
),
));
bottomNavigationBar: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(0.0),
),
border: Border.all(color: HexColor('#707070'), width: 0),
),
height: SizeConfig.heightMultiplier! *
(SizeConfig.isHeightVeryShort ? 12 : 10),
width: double.infinity,
child: Padding(
padding: const EdgeInsets.all(10),
child: Column(
children: [
Center(
child: Row(
children: [
Expanded(
child: AppButton(
title: TranslationBase.of(context).previous,
color: Colors.grey[300]!,
fontColor: Colors.black,
fontWeight: FontWeight.w600,
onPressed: () {
Navigator.pop(context);
},
),
),
SizedBox(
width: 5,
),
Expanded(
child: AppButton(
title: TranslationBase.of(context).save,
fontWeight: FontWeight.w600,
color: Color(0xFF359846),
onPressed: () async {},
),
),
],
),
)
],
),
),
),
));
}
}

@ -101,13 +101,13 @@ class _UpdatePlanPageVidaPlusState extends State<UpdatePlanPageVidaPlus>
return BaseView<SOAPViewModel>(
onModelReady: (model) async {
widget.sOAPViewModel.setPlanCallBack(this);
widget.changeLoadingState(true);
WidgetsBinding.instance.addPostFrameCallback((_) async {
if (model.progressNote.isEmpty) {
widget.changeLoadingState(true);
model.getProgressNote(widget.patientInfo);
}
widget.changeLoadingState(false);
});
widget.changeLoadingState(false);
},
builder: (_, model, w) => AppScaffold(
backgroundColor: Theme.of(context).scaffoldBackgroundColor,

@ -32,7 +32,7 @@ class UpdateSoapIndexVidaPlus extends StatefulWidget {
class _UpdateSoapIndexVidaPlusState extends State<UpdateSoapIndexVidaPlus>
with TickerProviderStateMixin {
PageController? _controller;
int _currentIndex =3;
int _currentIndex =2;
List<MySelectedAllergy> myAllergiesList = [];
List<MySelectedHistory> myHistoryList = [];
@ -97,6 +97,12 @@ class _UpdateSoapIndexVidaPlusState extends State<UpdateSoapIndexVidaPlus>
},
scrollDirection: Axis.horizontal,
children: <Widget>[
UpdateAssessmentPage(
changePageViewIndex: changePageViewIndex,
currentIndex: _currentIndex,
patientInfo: patient,
changeLoadingState: changeLoadingState,
),
UpdatePlanPageVidaPlus(
changePageViewIndex: changePageViewIndex,
currentIndex: _currentIndex,
@ -110,12 +116,7 @@ class _UpdateSoapIndexVidaPlusState extends State<UpdateSoapIndexVidaPlus>
currentIndex: _currentIndex,
patientInfo: patient,
changeLoadingState: changeLoadingState),
UpdateAssessmentPage(
changePageViewIndex: changePageViewIndex,
currentIndex: _currentIndex,
patientInfo: patient,
changeLoadingState: changeLoadingState,
),
UpdateSubjectivePageVidaPlus(
changePageViewIndex: changePageViewIndex,
currentIndex: _currentIndex,

@ -1945,6 +1945,8 @@ class TranslationBase {
String get kindlySelectCategory => localizedValues['kindlySelectCategory']![locale.languageCode]!;
String get remarksCanNotBeEmpty => localizedValues['remarksCanNotBeEmpty']![locale.languageCode]!;
String get selectedDiagnosis => localizedValues['selectedDiagnosis']![locale.languageCode]!;
String get selectConditionFirst => localizedValues['selectConditionFirst']![locale.languageCode]!;
}

Loading…
Cancel
Save