allergy inprogress

update_flutter_3.24_vida_plus_episode_v2
Sultan khan 1 year ago
parent fc567213ed
commit 5517d81fef

@ -0,0 +1,4 @@
<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M11.6701 0.495221C12.6572 -0.0918746 13.8747 -0.110273 14.8787 0.447126C15.2952 0.678342 15.675 1.06666 16.24 1.64419L16.3934 1.80091C16.9604 2.37969 17.3398 2.76705 17.5651 3.19051C18.1056 4.20643 18.088 5.43543 17.5183 6.43501C17.2808 6.85167 16.8903 7.22757 16.3071 7.78898L8.29152 15.5093C7.14082 16.618 6.43156 17.3014 5.53412 17.6519C4.63538 18.0029 3.65817 17.9772 2.07716 17.9356L1.67137 17.9249C1.43966 17.9189 1.20543 17.9129 1.01203 17.8806C0.789927 17.8436 0.52612 17.7584 0.317414 17.5215C0.110574 17.2868 0.0574955 17.0159 0.0450756 16.793C0.0340941 16.596 0.0525398 16.3599 0.0710769 16.1227L0.105174 15.685C0.21291 14.2995 0.27877 13.4525 0.613206 12.6828C0.948079 11.912 1.52015 11.2924 2.45354 10.2814L10.3439 1.73254C10.8921 1.13821 11.2606 0.73876 11.6701 0.495221ZM14.2719 1.54C13.6572 1.19868 12.9141 1.20973 12.309 1.56958C12.077 1.70753 11.8391 1.9556 11.1874 2.66174L11.1194 2.73538L15.3547 6.97069L15.3617 6.96398C16.0522 6.29893 16.296 6.05516 16.4323 5.81608C16.7896 5.18915 16.8008 4.41535 16.4615 3.77762C16.3321 3.53437 16.0952 3.28325 15.4243 2.5978C14.7524 1.91149 14.5076 1.67083 14.2719 1.54ZM3.45048 11.0443L10.2709 3.65466L14.4543 7.83799L7.5253 14.5117C6.23985 15.7498 5.71585 16.239 5.07935 16.4876C4.44424 16.7356 3.73726 16.7285 1.97083 16.6823L1.7375 16.6762C1.60457 16.6728 1.49928 16.67 1.40888 16.6652C1.36203 16.6628 1.32351 16.66 1.29159 16.6569C1.29192 16.5567 1.3021 16.415 1.31986 16.187L1.34236 15.8982C1.46224 14.3595 1.5188 13.7353 1.75968 13.1809C2.00008 12.6275 2.41374 12.1675 3.45048 11.0443Z" fill="#2B353E"/>
<path d="M10.6668 16.7083C10.3216 16.7083 10.0418 16.9881 10.0418 17.3333C10.0418 17.6785 10.3216 17.9583 10.6668 17.9583H17.3334C17.6786 17.9583 17.9584 17.6785 17.9584 17.3333C17.9584 16.9881 17.6786 16.7083 17.3334 16.7083H10.6668Z" fill="#2B353E"/>
</svg>

After

Width:  |  Height:  |  Size: 1.9 KiB

@ -0,0 +1,4 @@
<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M12.7941 6.92237C13.0273 6.66792 13.0101 6.27257 12.7557 6.03932C12.5012 5.80608 12.1059 5.82327 11.8726 6.07772L7.73038 10.5965L6.10862 8.97477C5.86454 8.73069 5.46881 8.73069 5.22473 8.97477C4.98066 9.21885 4.98066 9.61457 5.22473 9.85865L7.30807 11.942C7.42861 12.0625 7.59316 12.1286 7.76359 12.1249C7.93402 12.1212 8.09554 12.048 8.21073 11.9224L12.7941 6.92237Z" fill="#359846"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M9.04766 0.458374H8.95236C7.12678 0.458363 5.69288 0.458354 4.57336 0.608869C3.42615 0.763108 2.51594 1.08564 1.80077 1.8008C1.08561 2.51597 0.763077 3.42618 0.608838 4.57339C0.458324 5.69291 0.458333 7.12681 0.458344 8.95239V9.04769C0.458333 10.8733 0.458324 12.3072 0.608838 13.4267C0.763077 14.5739 1.08561 15.4841 1.80077 16.1993C2.51594 16.9144 3.42615 17.237 4.57336 17.3912C5.69287 17.5417 7.12676 17.5417 8.95234 17.5417H9.04765C10.8732 17.5417 12.3071 17.5417 13.4267 17.3912C14.5739 17.237 15.4841 16.9144 16.1992 16.1993C16.9144 15.4841 17.2369 14.5739 17.3912 13.4267C17.5417 12.3072 17.5417 10.8733 17.5417 9.04771V8.9524C17.5417 7.12682 17.5417 5.6929 17.3912 4.57339C17.2369 3.42618 16.9144 2.51597 16.1992 1.8008C15.4841 1.08564 14.5739 0.763108 13.4267 0.608869C12.3071 0.458354 10.8732 0.458363 9.04766 0.458374ZM2.68465 2.68468C3.12886 2.24048 3.73132 1.98333 4.73992 1.84772C5.76651 1.7097 7.11636 1.70837 9.00001 1.70837C10.8837 1.70837 12.2335 1.7097 13.2601 1.84772C14.2687 1.98333 14.8712 2.24048 15.3154 2.68468C15.7596 3.12889 16.0167 3.73135 16.1523 4.73995C16.2903 5.76654 16.2917 7.11639 16.2917 9.00004C16.2917 10.8837 16.2903 12.2335 16.1523 13.2601C16.0167 14.2687 15.7596 14.8712 15.3154 15.3154C14.8712 15.7596 14.2687 16.0168 13.2601 16.1524C12.2335 16.2904 10.8837 16.2917 9.00001 16.2917C7.11636 16.2917 5.76651 16.2904 4.73992 16.1524C3.73132 16.0168 3.12886 15.7596 2.68465 15.3154C2.24045 14.8712 1.98329 14.2687 1.84769 13.2601C1.70967 12.2335 1.70834 10.8837 1.70834 9.00004C1.70834 7.11639 1.70967 5.76654 1.84769 4.73995C1.98329 3.73135 2.24045 3.12889 2.68465 2.68468Z" fill="#359846"/>
</svg>

After

Width:  |  Height:  |  Size: 2.1 KiB

@ -75,6 +75,7 @@ class AllergyReactionDTOs {
int? hospitalID;
bool? isActive;
String? reactionSelection ="";
bool? isSelected =false;
AllergyReactionDTOs(
{this.allergyReactionID,
this.allergyReactionName,
@ -82,7 +83,8 @@ class AllergyReactionDTOs {
this.hospitalGroupID,
this.hospitalID,
this.isActive,
this.reactionSelection
this.reactionSelection,
this.isSelected,
});
AllergyReactionDTOs.fromJson(Map<String, dynamic> json) {

@ -0,0 +1,124 @@
class PatientAllergiesVidaPlus {
int? allergyID;
String? allergyName;
int? allergyTypeID;
String? allergyTypeName;
int? hospitalGroupID;
int? hospitalID;
bool? isActivePatientsAllergy;
int? patientID;
List<PatientsAllergyReactionsDTOs>? patientsAllergyReactionsDTOs;
int? patientsAllergyRevisionID;
int? pomrID;
String? remark;
PatientAllergiesVidaPlus(
{this.allergyID,
this.allergyName,
this.allergyTypeID,
this.allergyTypeName,
this.hospitalGroupID,
this.hospitalID,
this.isActivePatientsAllergy,
this.patientID,
this.patientsAllergyReactionsDTOs,
this.patientsAllergyRevisionID,
this.pomrID,
this.remark});
PatientAllergiesVidaPlus.fromJson(Map<String, dynamic> json) {
allergyID = json['allergyID'];
allergyName = json['allergyName'];
allergyTypeID = json['allergyTypeID'];
allergyTypeName = json['allergyTypeName'];
hospitalGroupID = json['hospitalGroupID'];
hospitalID = json['hospitalID'];
isActivePatientsAllergy = json['isActivePatientsAllergy'];
patientID = json['patientID'];
if (json['patientsAllergyReactionsDTOs'] != null) {
patientsAllergyReactionsDTOs = <PatientsAllergyReactionsDTOs>[];
json['patientsAllergyReactionsDTOs'].forEach((v) {
patientsAllergyReactionsDTOs!
.add(new PatientsAllergyReactionsDTOs.fromJson(v));
});
}
patientsAllergyRevisionID = json['patientsAllergyRevisionID'];
pomrID = json['pomrID'];
remark = json['remark'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['allergyID'] = this.allergyID;
data['allergyName'] = this.allergyName;
data['allergyTypeID'] = this.allergyTypeID;
data['allergyTypeName'] = this.allergyTypeName;
data['hospitalGroupID'] = this.hospitalGroupID;
data['hospitalID'] = this.hospitalID;
data['isActivePatientsAllergy'] = this.isActivePatientsAllergy;
data['patientID'] = this.patientID;
if (this.patientsAllergyReactionsDTOs != null) {
data['patientsAllergyReactionsDTOs'] =
this.patientsAllergyReactionsDTOs!.map((v) => v.toJson()).toList();
}
data['patientsAllergyRevisionID'] = this.patientsAllergyRevisionID;
data['pomrID'] = this.pomrID;
data['remark'] = this.remark;
return data;
}
}
class PatientsAllergyReactionsDTOs {
int? allergyReactionID;
int? allergyReactionMappingID;
String? allergyReactionName;
int? hospitalGroupID;
int? hospitalID;
bool? isActive;
int? patientID;
int? patientsAllergyReactionRevisionID;
int? pomrId;
int? severity;
PatientsAllergyReactionsDTOs(
{this.allergyReactionID,
this.allergyReactionMappingID,
this.allergyReactionName,
this.hospitalGroupID,
this.hospitalID,
this.isActive,
this.patientID,
this.patientsAllergyReactionRevisionID,
this.pomrId,
this.severity});
PatientsAllergyReactionsDTOs.fromJson(Map<String, dynamic> json) {
allergyReactionID = json['allergyReactionID'];
allergyReactionMappingID = json['allergyReactionMappingID'];
allergyReactionName = json['allergyReactionName'];
hospitalGroupID = json['hospitalGroupID'];
hospitalID = json['hospitalID'];
isActive = json['isActive'];
patientID = json['patientID'];
patientsAllergyReactionRevisionID =
json['patientsAllergyReactionRevisionID'];
pomrId = json['pomrId'];
severity = json['severity'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['allergyReactionID'] = this.allergyReactionID;
data['allergyReactionMappingID'] = this.allergyReactionMappingID;
data['allergyReactionName'] = this.allergyReactionName;
data['hospitalGroupID'] = this.hospitalGroupID;
data['hospitalID'] = this.hospitalID;
data['isActive'] = this.isActive;
data['patientID'] = this.patientID;
data['patientsAllergyReactionRevisionID'] =
this.patientsAllergyReactionRevisionID;
data['pomrId'] = this.pomrId;
data['severity'] = this.severity;
return data;
}
}

@ -2,6 +2,7 @@ import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/core/model/SOAP/Allergy/get_allergies_res_model.dart';
import 'package:doctor_app_flutter/core/model/SOAP/Assessment/get_assessment_res_model.dart';
import 'package:doctor_app_flutter/core/model/SOAP/allergy/get_allergies_list_vida_plus.dart';
import 'package:doctor_app_flutter/core/model/SOAP/allergy/get_patient_allergies_list_vida_plus.dart';
import 'package:doctor_app_flutter/core/model/SOAP/general_get_req_for_SOAP.dart';
import 'package:doctor_app_flutter/core/model/SOAP/Assessment/get_assessment_req_model.dart';
import 'package:doctor_app_flutter/core/model/SOAP/post_episode_req_model.dart';
@ -34,6 +35,7 @@ class SOAPService extends LookupService {
List<GetPatientProgressNoteResModel> patientProgressNoteList = [];
List<GetAssessmentResModel> patientAssessmentList = [];
List<AllergiesListVidaPlus> searchAllergiesList =[];
List<PatientAllergiesVidaPlus> patientAllergiesVidaPlus =[];
int? episodeID;
bool isPrescriptionOrder =false;
Future postEpisode(PostEpisodeReqModel postEpisodeReqModel) async {
@ -345,10 +347,10 @@ class SOAPService extends LookupService {
await baseAppClient.post(PATIENT_ALLERGIES,
onSuccess: (dynamic response, int statusCode) {
print("Success");
patientAllergiesList.clear();
patientAllergiesVidaPlus.clear();
response['List_Allergies']['entityList'].forEach((v) {
patientAllergiesList.add(GetAllergiesResModel.fromJson(v));
response['List_PatientAllergies']['resultData'].forEach((v) {
patientAllergiesVidaPlus.add(PatientAllergiesVidaPlus.fromJson(v));
});
}, onFailure: (String error, int statusCode) {
hasError = true;

@ -36,6 +36,7 @@ import 'package:doctor_app_flutter/screens/patients/profile/soap_update/plan/pla
import 'package:doctor_app_flutter/screens/patients/profile/soap_update/subjective/subjective_call_back.dart';
import '../../locator.dart';
import '../model/SOAP/allergy/get_patient_allergies_list_vida_plus.dart';
import '../model/SOAP/assessment/patch_assessment_req_model.dart';
import 'base_view_model.dart';
@ -82,7 +83,7 @@ class SOAPViewModel extends BaseViewModel {
List<AllergiesListVidaPlus> get searchAllergiesVidaPlus => _SOAPService.searchAllergiesList;
List<PatientAllergiesVidaPlus> get patientAllergiesVidaPlus => _SOAPService.patientAllergiesVidaPlus;
int? get episodeID => _SOAPService.episodeID;

@ -9,6 +9,7 @@ class PatientSearchHeader extends StatelessWidget implements PreferredSizeWidget
@override
Widget build(BuildContext context) {
return Container(
height: 120,
padding: EdgeInsets.only(left: 0, right: 5, bottom: 5, top: 5),
decoration: BoxDecoration(
color: Colors.white,

@ -6,8 +6,9 @@ class BottomSheetTitle extends StatelessWidget implements PreferredSizeWidget {
BottomSheetTitle({
Key? key,
this.title = '',
this.isClose =true
}) : super(key: key);
bool isClose;
final String title;
double headerHeight = SizeConfig.heightMultiplier! * 15;
@ -41,7 +42,7 @@ class BottomSheetTitle extends StatelessWidget implements PreferredSizeWidget {
onTap: () {
Navigator.pop(context);
},
child: Icon(DoctorApp.close_1, size: SizeConfig.getTextMultiplierBasedOnWidth() * 5, color: Color(0xFF2B353E)))
child: isClose ? Icon(DoctorApp.close_1, size: SizeConfig.getTextMultiplierBasedOnWidth() * 5, color: Color(0xFF2B353E)) :SizedBox())
],
),
],

@ -10,15 +10,14 @@ import 'package:doctor_app_flutter/widgets/shared/divider_with_spaces_around.dar
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../../../../../../core/model/SOAP/allergy/get_allergies_list_vida_plus.dart';
import '../../shared_soap_widgets/SOAP_open_items.dart';
import 'add_allergies.dart';
// ignore: must_be_immutable
class UpdateAllergiesWidget extends StatefulWidget {
// AllergiesListVidaPlus? selectedAllergy;
List<MySelectedAllergy>? myAllergiesList;
UpdateAllergiesWidget({Key? key});
UpdateAllergiesWidget({Key? key, this.myAllergiesList});
@override
_UpdateAllergiesWidgetState createState() => _UpdateAllergiesWidgetState();
@ -30,7 +29,7 @@ class _UpdateAllergiesWidgetState extends State<UpdateAllergiesWidget> {
ProjectViewModel projectViewModel = Provider.of(context);
changeAllState() {
setState(() {
// print(widget.myAllergiesList);
print(widget.myAllergiesList);
});
}
@ -45,97 +44,94 @@ class _UpdateAllergiesWidgetState extends State<UpdateAllergiesWidget> {
SizedBox(
height: 20,
),
// Container(
// margin: EdgeInsets.only(left: 15, right: 15, top: 15),
// child: Column(
// children: widget.myAllergiesList!.map((selectedAllergy) {
// return Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// mainAxisAlignment: MainAxisAlignment.start,
// children: [
// Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Container(
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// AppText(
// projectViewModel.isArabic ? selectedAllergy.selectedAllergy!.nameAr! : selectedAllergy.selectedAllergy!.nameEn!.toUpperCase(),
// textDecoration: selectedAllergy.isChecked! ? TextDecoration.none : TextDecoration.lineThrough,
// bold: true,
// color: Color(0xFF2B353E),
// fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3.5,
// fontWeight: FontWeight.w700,
// letterSpacing: -0.48,
// // fontHeight:0.18 ,
// ),
// AppText(
// projectViewModel.isArabic ? selectedAllergy.selectedAllergySeverity!.nameAr! : selectedAllergy.selectedAllergySeverity!.nameEn ?? ""!.toUpperCase(),
// textDecoration: selectedAllergy.isChecked! ? TextDecoration.none : TextDecoration.lineThrough,
// color: Color(0xFFCC9B14),
// fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3,
// fontWeight: FontWeight.w700,
// letterSpacing: -0.48,
// ),
// ],
// ),
// width: MediaQuery.of(context).size.width * 0.5,
// ),
// if (selectedAllergy.isChecked)
// RemoveButton(
// onTap: () => removeAllergy(selectedAllergy),
// )
// ],
// ),
// Padding(
// padding: const EdgeInsets.symmetric(vertical: 8),
// child: Row(
// children: [
// RemarkText(
// remark: selectedAllergy.remark ?? "",
// ),
// ],
// ),
// ),
// DividerWithSpacesAround()
// ],
// ),
// SizedBox(
// height: 10,
// ),
// ],
// );
// }).toList()),
],
Container(
margin: EdgeInsets.only(left: 15, right: 15, top: 15),
child: Column(
children: widget.myAllergiesList!.map((selectedAllergy) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppText(
projectViewModel.isArabic ? selectedAllergy.selectedAllergy!.nameAr! : selectedAllergy.selectedAllergy!.nameEn!.toUpperCase(),
textDecoration: selectedAllergy.isChecked! ? TextDecoration.none : TextDecoration.lineThrough,
bold: true,
color: Color(0xFF2B353E),
fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3.5,
fontWeight: FontWeight.w700,
letterSpacing: -0.48,
// fontHeight:0.18 ,
),
AppText(
projectViewModel.isArabic ? selectedAllergy.selectedAllergySeverity!.nameAr! : selectedAllergy.selectedAllergySeverity!.nameEn ?? ""!.toUpperCase(),
textDecoration: selectedAllergy.isChecked! ? TextDecoration.none : TextDecoration.lineThrough,
color: Color(0xFFCC9B14),
fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3,
fontWeight: FontWeight.w700,
letterSpacing: -0.48,
),
],
),
width: MediaQuery.of(context).size.width * 0.5,
),
if (selectedAllergy.isChecked)
RemoveButton(
onTap: () => removeAllergy(selectedAllergy),
)
],
),
Padding(
padding: const EdgeInsets.symmetric(vertical: 8),
child: Row(
children: [
RemarkText(
remark: selectedAllergy.remark ?? "",
),
],
),
),
DividerWithSpacesAround()
],
),
SizedBox(
height: 10,
),
],
);
}).toList()),
)
],
);
}
removeAllergy(MySelectedAllergy mySelectedAllergy) {
// List<MySelectedAllergy> allergy =
// // ignore: missing_return
// widget.myAllergiesList!
// .where((element) => mySelectedAllergy.selectedAllergySeverity!.id == element.selectedAllergySeverity!.id && mySelectedAllergy.selectedAllergy!.id == element.selectedAllergy!.id)
// .toList();
//
// if (allergy.length > 0) {
// if (allergy.first.isLocal) {
// setState(() {
// widget.myAllergiesList!.remove(allergy.first);
// });
// }
// setState(() {
// allergy[0].isChecked = false;
// });
// }
}
openReaction(){
List<MySelectedAllergy> allergy =
// ignore: missing_return
widget.myAllergiesList!
.where((element) => mySelectedAllergy.selectedAllergySeverity!.id == element.selectedAllergySeverity!.id && mySelectedAllergy.selectedAllergy!.id == element.selectedAllergy!.id)
.toList();
if (allergy.length > 0) {
if (allergy.first.isLocal) {
setState(() {
widget.myAllergiesList!.remove(allergy.first);
});
}
setState(() {
allergy[0].isChecked = false;
});
}
}
openAllergiesList(BuildContext context, Function changeParentState, removeAllergy) {
@ -146,53 +142,51 @@ class _UpdateAllergiesWidgetState extends State<UpdateAllergiesWidget> {
context: context,
builder: (context) {
return AddAllergies(
addAllergiesFun: (AllergiesListVidaPlus selectedAllergy) {
myAllergiesList: widget.myAllergiesList,
addAllergiesFun: (List<MySelectedAllergy> mySelectedAllergy) {
bool isAllDataFilled = true;
mySelectedAllergy.forEach((element) {
if (element.selectedAllergySeverity == null) {
element.hasValidationError = true;
isAllDataFilled = false;
}
});
if (isAllDataFilled) {
mySelectedAllergy.forEach((element) {
if (
widget.myAllergiesList!.singleWhere(
(it) => it.selectedAllergy!.id == element.selectedAllergy!.id,
orElse: () => MySelectedAllergy(),
).selectedAllergySeverity
==
null) {
widget.myAllergiesList!.add(element);
}
});
openReaction();
/// remove items.
List<MySelectedAllergy> removedList = [];
widget.myAllergiesList!.forEach((element) {
if (
mySelectedAllergy.singleWhere(
(it) => it.selectedAllergy!.id == element.selectedAllergy!.id,
orElse: () => MySelectedAllergy(),
)
.selectedAllergySeverity ==
null) {
removedList.add(element);
}
});
// bool isAllDataFilled = true;
// mySelectedAllergy.forEach((element) {
// if (element.selectedAllergySeverity == null) {
// element.hasValidationError = true;
// isAllDataFilled = false;
// }
// });
// if (isAllDataFilled) {
// mySelectedAllergy.forEach((element) {
// if (
// widget.myAllergiesList!.singleWhere(
// (it) => it.selectedAllergy!.id == element.selectedAllergy!.id,
// orElse: () => MySelectedAllergy(),
// ).selectedAllergySeverity
// ==
// null) {
// widget.myAllergiesList!.add(element);
// }
// });
//
// /// remove items.
// List<MySelectedAllergy> removedList = [];
// widget.myAllergiesList!.forEach((element) {
// if (
// mySelectedAllergy.singleWhere(
// (it) => it.selectedAllergy!.id == element.selectedAllergy!.id,
// orElse: () => MySelectedAllergy(),
// )
// .selectedAllergySeverity ==
// null) {
// removedList.add(element);
// }
// });
//
// removedList.forEach((element) {
// removeAllergy(element);
// });
// changeParentState();
removedList.forEach((element) {
removeAllergy(element);
});
changeParentState();
// Navigator.of(context).pop();
// } else {
// Utils.showErrorToast(TranslationBase.of(context).requiredMsg);
// }
Navigator.of(context).pop();
} else {
Utils.showErrorToast(TranslationBase.of(context).requiredMsg);
}
});
});
}

@ -8,8 +8,10 @@ import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart';
import 'package:doctor_app_flutter/utils/utils.dart';
import 'package:doctor_app_flutter/widgets/bottom_sheet/custom_bottom_sheet_container.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:flutter/material.dart';
import '../../../../patient_search/patient_search_header.dart';
import '../../../soap_update/shared_soap_widgets/bottom_sheet_title.dart';
import 'master_key_checkbox_search_allergies_widget.dart';
@ -17,7 +19,8 @@ class AddAllergies extends StatefulWidget {
final Function? addAllergiesFun;
final AllergiesListVidaPlus? myAllergiesList;
const AddAllergies({Key? key, this.addAllergiesFun, this.myAllergiesList}) : super(key: key);
const AddAllergies({Key? key, this.addAllergiesFun, this.myAllergiesList})
: super(key: key);
@override
_AddAllergiesState createState() => _AddAllergiesState();
@ -26,8 +29,8 @@ class AddAllergies extends StatefulWidget {
class _AddAllergiesState extends State<AddAllergies> {
// List<MasterKeyModel> allergiesList = [];
// List<MasterKeyModel> allergySeverityList = [];
//
// myAllergiesListLocal = [];
//
// myAllergiesListLocal = [];
@override
initState() {
@ -40,106 +43,71 @@ class _AddAllergiesState extends State<AddAllergies> {
@override
Widget build(BuildContext context) {
return AppScaffold(
// baseViewModel: model,
isShowAppBar: true,
appBar: BottomSheetTitle(
title: TranslationBase.of(context).addAllergies,
),
body: Center(
child: Container(
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
SizedBox(
height: 10,
),
SizedBox(
height: 16,
),
Expanded(
child: Center(
child: FractionallySizedBox(
widthFactor: 0.9,
child: Center(
child: BaseView<SOAPViewModel>(
onModelReady: (model) async {},
builder: (_, model, w) {
return MasterKeyCheckboxSearchAllergiesWidget(
model: model,
return BaseView<SOAPViewModel>(
builder: (_, model, w) => AppScaffold(
isShowAppBar: true,
addAllergy: (AllergiesListVidaPlus mySelectedAllergy) {
widget.addAllergiesFun!(mySelectedAllergy);
},
appBar: PatientSearchHeader(
);
}),
),
),
title: TranslationBase.of(context).addAllergies),
body: MasterKeyCheckboxSearchAllergiesWidget(
model: model,
// addAllergy: (AllergiesListVidaPlus mySelectedAllergy) {
// widget.addAllergiesFun!(mySelectedAllergy);
// },
),
),
SizedBox(
height: MediaQuery.of(context).size.height * 0.11,
),
]),
),
),
bottomSheet:
// model.state != ViewState.Idle
// ?
// Container(
// height: 0,
// )
// :
CustomBottomSheetContainer(
buttonColor: Color(0xffEAEAEA),
fontColor: Colors.black,
label: TranslationBase.of(context).cancel,
onTap: () {
Navigator.of(context).pop();
},
),
);
bottomSheet: CustomBottomSheetContainer(
buttonColor: Color(0xffEAEAEA),
fontColor: Colors.black,
label: TranslationBase.of(context).cancel,
onTap: () {
Navigator.of(context).pop();
},
),
));
}
//
// isServiceSelected(MasterKeyModel masterKey) {
// Iterable<MySelectedAllergy> allergy =
// myAllergiesListLocal.where((element) => masterKey.id == element.selectedAllergy!.id && masterKey.typeId == element.selectedAllergy!.typeId && element.isChecked);
// if (allergy.length > 0) {
// return true;
// }
// return false;
// }
//
// removeAllergyFromLocalList(MasterKeyModel masterKey) {
// myAllergiesListLocal.removeWhere((element) => element.selectedAllergy!.id == masterKey.id);
// }
//
// MySelectedAllergy getSelectedAllergy(MasterKeyModel masterKey) {
// Iterable<MySelectedAllergy> allergy =
// myAllergiesListLocal.where((element) => masterKey.id == element.selectedAllergy!.id && masterKey.typeId == element.selectedAllergy!.typeId && element.isChecked);
// if (allergy.length > 0) {
// return allergy.first;
// }
// return MySelectedAllergy();
// }
//
// addAllergyLocally(AllergiesListVidaPlus mySelectedAllergy) {
// if (mySelectedAllergy.selectedAllergy == null) {
// Utils.showErrorToast(TranslationBase.of(context).requiredMsg);
// } else {
// setState(() {
// List<MySelectedAllergy> allergy =
// // ignore: missing_return
// myAllergiesListLocal.where((element) => mySelectedAllergy.selectedAllergy!.id == element.selectedAllergy!.id).toList();
//
// if (allergy.isEmpty) {
// myAllergiesListLocal.add(mySelectedAllergy);
// } else {
// allergy.first.selectedAllergy = mySelectedAllergy.selectedAllergy;
// allergy.first.selectedAllergySeverity = mySelectedAllergy.selectedAllergySeverity;
// allergy.first.remark = mySelectedAllergy.remark;
// allergy.first.isChecked = mySelectedAllergy.isChecked;
// }
// });
// }
// }
//
// isServiceSelected(MasterKeyModel masterKey) {
// Iterable<MySelectedAllergy> allergy =
// myAllergiesListLocal.where((element) => masterKey.id == element.selectedAllergy!.id && masterKey.typeId == element.selectedAllergy!.typeId && element.isChecked);
// if (allergy.length > 0) {
// return true;
// }
// return false;
// }
//
// removeAllergyFromLocalList(MasterKeyModel masterKey) {
// myAllergiesListLocal.removeWhere((element) => element.selectedAllergy!.id == masterKey.id);
// }
//
// MySelectedAllergy getSelectedAllergy(MasterKeyModel masterKey) {
// Iterable<MySelectedAllergy> allergy =
// myAllergiesListLocal.where((element) => masterKey.id == element.selectedAllergy!.id && masterKey.typeId == element.selectedAllergy!.typeId && element.isChecked);
// if (allergy.length > 0) {
// return allergy.first;
// }
// return MySelectedAllergy();
// }
//
// addAllergyLocally(AllergiesListVidaPlus mySelectedAllergy) {
// if (mySelectedAllergy.selectedAllergy == null) {
// Utils.showErrorToast(TranslationBase.of(context).requiredMsg);
// } else {
// setState(() {
// List<MySelectedAllergy> allergy =
// // ignore: missing_return
// myAllergiesListLocal.where((element) => mySelectedAllergy.selectedAllergy!.id == element.selectedAllergy!.id).toList();
//
// if (allergy.isEmpty) {
// myAllergiesListLocal.add(mySelectedAllergy);
// } else {
// allergy.first.selectedAllergy = mySelectedAllergy.selectedAllergy;
// allergy.first.selectedAllergySeverity = mySelectedAllergy.selectedAllergySeverity;
// allergy.first.remark = mySelectedAllergy.remark;
// allergy.first.isChecked = mySelectedAllergy.isChecked;
// }
// });
// }
// }
}

@ -1,43 +1,32 @@
import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart';
import 'package:doctor_app_flutter/core/enum/view_state.dart';
import 'package:doctor_app_flutter/core/model/SOAP/allergy/get_allergies_list_vida_plus.dart';
import 'package:doctor_app_flutter/core/model/SOAP/master_key_model.dart';
import 'package:doctor_app_flutter/core/model/SOAP/selected_items/my_selected_allergy.dart';
import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart';
import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/subjective/allergies/reactions_selection.dart';
import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart';
import 'package:doctor_app_flutter/utils/utils.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/divider_with_spaces_around.dart';
import 'package:doctor_app_flutter/widgets/shared/rounded_container_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 'allergies_item.dart';
import '../../../../../../widgets/transitions/fade_page.dart';
class MasterKeyCheckboxSearchAllergiesWidget extends StatefulWidget {
final SOAPViewModel model;
// final Function() addSelectedAllergy;
// final Function(MasterKeyModel) removeAllergy;
final Function(AllergiesListVidaPlus mySelectedAllergy) addAllergy;
// final bool Function(MasterKeyModel) isServiceSelected;
// final MySelectedAllergy Function(MasterKeyModel) getServiceSelectedAllergy;
// final List<MasterKeyModel> masterList;
final String? buttonName;
final String? hintSearchText;
MasterKeyCheckboxSearchAllergiesWidget(
{Key? key,
required this.model,
// required this.addSelectedAllergy,
// required this.removeAllergy,
// required this.masterList,
required this.addAllergy,
// required this.isServiceSelected,
// required this.addAllergy,
this.buttonName,
this.hintSearchText,
// required this.getServiceSelectedAllergy
})
: super(key: key);
@ -58,15 +47,17 @@ bool loading =false;
@override
Widget build(BuildContext context) {
return Container(
child: Column(
return Column(
children: [
Expanded(
child: Container(
margin: EdgeInsets.all(20),
height: Utils.getTextFieldHeight(),
child: Center(
child: Container(
decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white),
decoration: BoxDecoration(borderRadius: BorderRadius.circular(12)),
child: Column(
children: [
AppTextFieldCustom(
@ -80,17 +71,8 @@ bool loading =false;
},
onFieldSubmitted: () {
// widget.model.getMasterLookup(
// MasterKeysService.Allergies,
// searchKey: filteredSearchController.text);
// widget.model.getMasterLookup(
// MasterKeysService.AllergySeverity,
// searchKey: "");
},
// onFieldSubmitted: (value) {
// widget.model.getMasterLookup(MasterKeysService.Allergies!, searchKey: filteredSearchController.text!);
// widget.model.getMasterLookup(MasterKeysService.AllergySeverity, searchKey: "");
// },
suffixIcon: IconButton(
icon: Icon(
Icons.search,
@ -110,9 +92,8 @@ bool loading =false;
height: 10,
),
Expanded(
child: FractionallySizedBox(
widthFactor: 0.9,
child: Container(
child: RoundedContainer(
width:MediaQuery.of(context).size.width ,
height: MediaQuery.of(context).size.height * 0.60,
child: widget.model.state == ViewState.Idle
? ListView.builder(
@ -120,27 +101,17 @@ bool loading =false;
itemBuilder: (context, index) {
loading =false;
return ListTile(title: AppText(widget.model.searchAllergiesVidaPlus[index].allergyName!), trailing: TextButton.icon(icon: SvgPicture.asset("assets/images/svgs/add-square.svg", color: Color(0xffD02127),), style: ButtonStyle(iconColor: WidgetStateProperty.all<Color>(Color(0xffD02127)), ), onPressed: (){
widget.addAllergy(widget.model.searchAllergiesVidaPlus[index]);
openReaction(widget.model, widget.model.searchAllergiesVidaPlus[index]);
}, label: AppText(TranslationBase.of(context).add, fontSize:12, color:Color(0xffD02127) ,),
),
);
// return AddAllergiesItem(
// item: widget.model.allergiesList[index],
// model: widget.model,
// removeAllergy: widget.removeAllergy,
// addAllergy: widget.addAllergy,
// isServiceSelected: widget.isServiceSelected,
// getServiceSelectedAllergy: widget.getServiceSelectedAllergy,
// );
},
)
: loading ? Center(child: CircularProgressIndicator()) :SizedBox()
),
),
),
],
@ -149,34 +120,24 @@ bool loading =false;
),
),
),
SizedBox(
height: 10,
),
],
),
);
}
//
// void filterSearchResults(String query) {
// List<MasterKeyModel> dummySearchList = [];
// dummySearchList.addAll(widget.masterList);
// if (query.isNotEmpty) {
// List<MasterKeyModel> dummyListData = [];
// dummySearchList.forEach((items) {
// if (items.nameAr!.toLowerCase().contains(query.toLowerCase()) || items.nameEn!.toLowerCase().contains(query.toLowerCase())) {
// dummyListData.add(items);
// }
// });
// setState(() {
// items.clear();
// items.addAll(dummyListData);
// });
// return;
// } else {
// setState(() {
// items.clear();
// items.addAll(widget.masterList);
// });
// }
// }
openReaction(model, AllergiesListVidaPlus mySelectedAllergy){
Navigator.push(
context,
FadePage(
page:ReactionsSelectionAllergiesWidget(
model:model,
mySelectedAllergy: mySelectedAllergy,
addReactionFun: (AllergiesListVidaPlus mySelectedAllergy) {
Navigator.of(context).pop();
})
));
}
}

@ -8,7 +8,11 @@ import 'package:doctor_app_flutter/widgets/shared/rounded_container_widget.dart'
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import '../../../../../../config/config.dart';
import '../../../../../../widgets/bottom_sheet/custom_bottom_sheet_container.dart';
import '../../../../../../widgets/shared/app_scaffold_widget.dart';
import '../../../../../../widgets/shared/buttons/app_buttons_widget.dart';
import '../../../../patient_search/patient_search_header.dart';
import '../../../soap_update/shared_soap_widgets/bottom_sheet_title.dart';
class ReactionsSelectionAllergiesWidget extends StatefulWidget {
@ -46,124 +50,207 @@ class _ReactionsSelectionAllergiesWidgetState
@override
Widget build(BuildContext context) {
return AppScaffold(
// baseViewModel: model,
isShowAppBar: true,
appBar: BottomSheetTitle(
title: "Select Reactions" // TranslationBase.of(context).reac,
),
backgroundColor: Color(0xffbacF7F7F7),
body: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: RoundedContainer(
margin: EdgeInsets.all(15),
child: ListView.builder(
itemCount:
widget.mySelectedAllergy.allergyReactionDTOs!.length,
itemBuilder: (context, index) {
loading = false;
return Column(children: [ ExpansionTile(
dense: false,
enableFeedback: false,
showTrailingIcon: false,
leading: Checkbox(value: false, onChanged: (bool) {}),
title: AppText(widget.mySelectedAllergy
.allergyReactionDTOs![index].allergyReactionName!),
children: [
Row(
// isShowAppBar: true,
appBar: PatientSearchHeader(
title: "Select Reaction"
),
body: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: RoundedContainer(
margin: EdgeInsets.all(15),
child: ListView.builder(
itemCount:
widget.mySelectedAllergy.allergyReactionDTOs!.length,
itemBuilder: (context, index) {
loading = false;
return Column(children: [
ExpansionTile(
key: Key(index.toString()),
dense: false,
enableFeedback: false,
showTrailingIcon: false,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: ListTile(
title: Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Radio(
initiallyExpanded: widget
.mySelectedAllergy
.allergyReactionDTOs![index].isSelected!,
leading:
Checkbox(
activeColor: Color(0xffD02127),
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, // Reduces padding around checkbox
visualDensity: VisualDensity.compact,
value: "Mild",
groupValue: widget
.mySelectedAllergy
.allergyReactionDTOs![index].reactionSelection,
onChanged: (value) {
widget
.mySelectedAllergy
.allergyReactionDTOs![index].reactionSelection =value;
setState(() {
});
},
),
AppText('Mild', fontSize: 10,),
],
))),
Expanded(
child: ListTile(
title: Row(
value: widget
.mySelectedAllergy
.allergyReactionDTOs![index].isSelected!, onChanged: (value) {
children: <Widget>[
Radio(
activeColor: Color(0xffD02127),
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, // Reduces padding around checkbox
visualDensity: VisualDensity.compact,
value: "moderate",
groupValue: widget
.mySelectedAllergy
widget
.mySelectedAllergy
.allergyReactionDTOs![index].isSelected = value;
setState(() {
.allergyReactionDTOs![index].reactionSelection,
onChanged: (value) {
widget
.mySelectedAllergy
.allergyReactionDTOs![index].reactionSelection =value;
setState(() {
});
});
},
),
AppText('Moderate', fontSize: 10,),
],
))),
Expanded(
child: ListTile(
title: Row(
}),
title: AppText(widget
.mySelectedAllergy
.allergyReactionDTOs![index]
.allergyReactionName!),
children: [
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: ListTile(
title: Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Radio(
activeColor: Color(0xffD02127),
materialTapTargetSize:
MaterialTapTargetSize.shrinkWrap,
// Reduces padding around checkbox
visualDensity: VisualDensity.compact,
value: "Mild",
groupValue: widget
.mySelectedAllergy
.allergyReactionDTOs![index]
.reactionSelection,
onChanged: (value) {
widget
.mySelectedAllergy
.allergyReactionDTOs![index]
.reactionSelection = value;
setState(() {});
},
),
AppText(
'Mild',
fontSize: 10,
),
],
))),
Expanded(
child: ListTile(
title: Row(
children: <Widget>[
Radio(
activeColor: Color(0xffD02127),
materialTapTargetSize:
MaterialTapTargetSize.shrinkWrap,
// Reduces padding around checkbox
visualDensity: VisualDensity.compact,
value: "moderate",
groupValue: widget
.mySelectedAllergy
.allergyReactionDTOs![index]
.reactionSelection,
onChanged: (value) {
widget
.mySelectedAllergy
.allergyReactionDTOs![index]
.reactionSelection = value;
setState(() {});
},
),
AppText(
'Moderate',
fontSize: 10,
),
],
))),
Expanded(
child: ListTile(
title: Row(
children: <Widget>[
Radio(
activeColor: Color(0xffD02127),
materialTapTargetSize:
MaterialTapTargetSize.shrinkWrap,
// Reduces padding around checkbox
visualDensity: VisualDensity.compact,
value: "severe",
groupValue: widget
.mySelectedAllergy
.allergyReactionDTOs![index]
.reactionSelection,
onChanged: (value) {
widget
.mySelectedAllergy
.allergyReactionDTOs![index]
.reactionSelection = value;
setState(() {});
},
),
AppText(
'Severe',
fontSize: 10,
),
],
)))
],
)
],
),
Divider(),
]);
},
)))
],
),
bottomSheet: Container(
height: 90,
color: Colors.white,
margin: EdgeInsets.all(10),
child: Row(
children: [
Expanded(
child: Container(
child: AppButton(
title: TranslationBase.of(context).cancel,
vPadding: 8,
hPadding: 8,
color: Color(0xffEAEAEA),
fontColor: Colors.black,
onPressed: () {
Navigator.of(context).pop();
},
),
),
),
SizedBox(
width: 8,
),
Expanded(
child: Container(
child: AppButton(
title: TranslationBase.of(context).save,
vPadding: 8,
hPadding: 8,
color: AppGlobal.appGreenColor,
fontColor: Colors.white,
onPressed: () {
widget.addReactionFun(widget
.mySelectedAllergy
);
},
),
),
),
],
))
children: <Widget>[
Radio(
activeColor: Color(0xffD02127),
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, // Reduces padding around checkbox
visualDensity: VisualDensity.compact,
value: "severe",
groupValue: widget
.mySelectedAllergy
.allergyReactionDTOs![index].reactionSelection,
onChanged: (value) {
widget
.mySelectedAllergy
.allergyReactionDTOs![index].reactionSelection =value;
setState(() {
// CustomBottomSheetContainer(
// buttonColor: Color(0xff359846),
// fontColor: Colors.white,
// label: TranslationBase.of(context).next,
// onTap: () {
// widget.addReactionFun(widget
// .mySelectedAllergy
// );
// },
// )
});
},
),
AppText('Severe', fontSize: 10,),
],
)))
],
)
],
),
Divider(),
]);
},
)))
],
),
);
);
}
}

@ -1,32 +1,37 @@
import 'package:doctor_app_flutter/core/model/SOAP/allergy/get_allergies_list_vida_plus.dart';
import 'package:doctor_app_flutter/core/model/SOAP/allergy/get_patient_allergies_list_vida_plus.dart';
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
import 'package:doctor_app_flutter/core/model/SOAP/selected_items/my_selected_allergy.dart';
import 'package:doctor_app_flutter/screens/patients/profile/soap_update_vida_plus/subjective/allergies/reactions_selection.dart';
import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:provider/provider.dart';
import '../../../../../../widgets/transitions/fade_page.dart';
import '../chief_complaint/widgets/add_chief_complaint.dart';
import 'add_allergies.dart';
import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart';
// ignore: must_be_immutable
class UpdateAllergiesWidgetVidaPlus extends StatefulWidget {
List<MySelectedAllergy>? myAllergiesList;
List<PatientAllergiesVidaPlus>? myAllergiesList;
UpdateAllergiesWidgetVidaPlus({Key? key, this.myAllergiesList});
@override
_UpdateAllergiesWidgetState createState() => _UpdateAllergiesWidgetState();
}
bool noKnownAllergies = false;
bool noKnownAllergies = false;
enum Severity {mild,moderate,severe }
class _UpdateAllergiesWidgetState extends State<UpdateAllergiesWidgetVidaPlus> {
SOAPViewModel? model;
@override
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
changeAllState() {
setState(() {
print(widget.myAllergiesList);
print(widget.myAllergiesList);
});
}
@ -37,160 +42,135 @@ class _UpdateAllergiesWidgetState extends State<UpdateAllergiesWidgetVidaPlus> {
),
AddSoapItem(
title: "${TranslationBase.of(context).addAllergies}",
onAddSoapItemClicked: (){
openAllergiesList(context, changeAllState);
onAddSoapItemClicked: () {
Navigator.push(
context,
FadePage(
page: AddAllergies(),
),
);
},
),
SizedBox(
height: 20,
),
widget.myAllergiesList!.isEmpty
? Row(
mainAxisSize: MainAxisSize.max,
children: [
Checkbox(
value: noKnownAllergies,
checkColor: Colors.white,
activeColor: Colors.red,
onChanged: (value) {
noKnownAllergies = value!;
setState(() {});
},
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
// Reduces padding around checkbox
visualDensity:
VisualDensity.compact, // Minimizes size further
),
AppText(TranslationBase.of(context).noKnownAllergies)
],
)
: Divider(
thickness: 1,
color: Color(0xffEFEFEF),
),
ListView(
padding: EdgeInsets.all(10),
shrinkWrap: true,
children: widget.myAllergiesList!.map((selectedAllergy) {
return Column(
Row(
mainAxisSize: MainAxisSize.max,
children: [
Checkbox(
value: noKnownAllergies,
checkColor: Colors.white,
activeColor: Colors.red,
onChanged: (value) {
noKnownAllergies = value!;
setState(() {});
},
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, // Reduces padding around checkbox
visualDensity: VisualDensity.compact, // Minimizes size further
),
AppText(TranslationBase.of(context).noKnownAllergies)
],
),
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppText(
selectedAllergy.allergyName!,
fontSize: 12,
fontWeight: FontWeight.w800,
letterSpacing: -0.48,
),
selectedAllergy.patientsAllergyReactionsDTOs!.isNotEmpty ? ListView(
shrinkWrap: true,
children: selectedAllergy.patientsAllergyReactionsDTOs!.map((PatientsAllergyReactionsDTOs reaction) => Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Container(
// margin: EdgeInsets.only(left: 15, right: 15, top: 15),
// child: Column(
// children: widget.myAllergiesList!.map((selectedAllergy) {
// return Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// mainAxisAlignment: MainAxisAlignment.start,
// children: [
// Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Container(
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// AppText(
// projectViewModel.isArabic ? selectedAllergy.selectedAllergy!.nameAr! : selectedAllergy.selectedAllergy!.nameEn!.toUpperCase(),
// textDecoration: selectedAllergy.isChecked! ? TextDecoration.none : TextDecoration.lineThrough,
// bold: true,
// color: Color(0xFF2B353E),
// fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3.5,
// fontWeight: FontWeight.w700,
// letterSpacing: -0.48,
// // fontHeight:0.18 ,
// ),
// AppText(
// projectViewModel.isArabic ? selectedAllergy.selectedAllergySeverity!.nameAr! : selectedAllergy.selectedAllergySeverity!.nameEn ?? ""!.toUpperCase(),
// textDecoration: selectedAllergy.isChecked! ? TextDecoration.none : TextDecoration.lineThrough,
// color: Color(0xFFCC9B14),
// fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 3,
// fontWeight: FontWeight.w700,
// letterSpacing: -0.48,
// ),
// ],
// ),
// width: MediaQuery.of(context).size.width * 0.5,
// ),
// if (selectedAllergy.isChecked)
// RemoveButton(
// onTap: () => removeAllergy(selectedAllergy),
// )
// ],
// ),
// Padding(
// padding: const EdgeInsets.symmetric(vertical: 8),
// child: Row(
// children: [
// RemarkText(
// remark: selectedAllergy.remark ?? "",
// ),
// ],
// ),
// ),
// DividerWithSpacesAround()
// ],
// ),
// SizedBox(
// height: 10,
// ),
// ],
// );
// }).toList()),
// )
],
);
}
//
// removeAllergy(MySelectedAllergy mySelectedAllergy) {
// List<MySelectedAllergy> allergy =
// // ignore: missing_return
// widget.myAllergiesList!
// .where((element) => mySelectedAllergy.selectedAllergySeverity!.id == element.selectedAllergySeverity!.id && mySelectedAllergy.selectedAllergy!.id == element.selectedAllergy!.id)
// .toList();
//
// if (allergy.length > 0) {
// if (allergy.first.isLocal) {
// setState(() {
// widget.myAllergiesList!.remove(allergy.first);
// });
// }
// setState(() {
// allergy[0].isChecked = false;
// });
// }
// }
openAllergiesList(BuildContext context, Function changeParentState) {
showModalBottomSheet(
backgroundColor: Colors.white,
isScrollControlled: true,
isDismissible: false,
context: context,
builder: (context) {
return AddAllergies(
addAllergiesFun: (AllergiesListVidaPlus mySelectedAllergy) {
Navigator.of(context).pop();
openReactionScreen(mySelectedAllergy);
print(mySelectedAllergy);
AppText(reaction.allergyReactionName!),
AppText(
Severity.values[reaction.severity! -1].name,
color: Color(0xFFCC9B14),
fontSize: 10,
fontWeight: FontWeight.w600,
letterSpacing: -0.48,
)
],)).toList()) : AppText("----", color: Color(0xFFCC9B14)),
// } else {
// Utils.showErrorToast(TranslationBase.of(context).requiredMsg);
// }
});
});
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
SizedBox(
height: 10,
),
TextButton.icon(
onPressed: () {},
icon: SvgPicture.asset(
"assets/images/svgs/edit-icon.svg",
height: 16,
),
label: AppText(
"Edit",
fontSize: 12,
),
),
TextButton.icon(
onPressed: () {},
icon: SvgPicture.asset(
"assets/images/svgs/resolve.svg",
height: 18,
),
label: AppText("Resolve",
fontSize: 12, color: Color(0xff359846)))
],
)
],
);
}).toList()),
],
);
}
openReactionScreen(AllergiesListVidaPlus mySelectedAllergy){
showModalBottomSheet(
backgroundColor: Colors.white,
isScrollControlled: true,
isDismissible: false,
context: context,
builder: (context) {
return ReactionsSelectionAllergiesWidget(
model:model,
mySelectedAllergy: mySelectedAllergy,
addReactionFun: (AllergiesListVidaPlus mySelectedAllergy) {
//
// removeAllergy(MySelectedAllergy mySelectedAllergy) {
// List<MySelectedAllergy> allergy =
// // ignore: missing_return
// widget.myAllergiesList!
// .where((element) => mySelectedAllergy.selectedAllergySeverity!.id == element.selectedAllergySeverity!.id && mySelectedAllergy.selectedAllergy!.id == element.selectedAllergy!.id)
// .toList();
//
// if (allergy.length > 0) {
// if (allergy.first.isLocal) {
// setState(() {
// widget.myAllergiesList!.remove(allergy.first);
// });
// }
// setState(() {
// allergy[0].isChecked = false;
// });
// }
// }
Navigator.of(context).pop();
// } else {
// Utils.showErrorToast(TranslationBase.of(context).requiredMsg);
// }
});
});
}
// openAllergiesList(BuildContext context, Function changeParentState) {
// showModalBottomSheet(
// backgroundColor: Colors.white,
// isScrollControlled: true,
// isDismissible: false,
// context: context,
// builder: (context) {
// return AddAllergies();
// });
// }
}

@ -17,24 +17,28 @@ import 'package:doctor_app_flutter/utils/utils.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:flutter/material.dart';
import '../../../../../core/model/SOAP/allergy/get_patient_allergies_list_vida_plus.dart';
import 'allergies/update_allergies_widget.dart';
import 'chief_complaint/chief_complaints.dart';
class UpdateSubjectivePageVidaPlus extends StatefulWidget {
final Function changePageViewIndex;
final Function changeLoadingState;
final PatiantInformtion patientInfo;
final int currentIndex;
UpdateSubjectivePageVidaPlus({Key? key, required this.changePageViewIndex, required this.patientInfo, required this.changeLoadingState, required this.currentIndex});
UpdateSubjectivePageVidaPlus(
{Key? key, required this.changePageViewIndex, required this.patientInfo, required this.changeLoadingState, required this.currentIndex});
@override
_UpdateSubjectivePageVidaPlusState createState() => _UpdateSubjectivePageVidaPlusState();
_UpdateSubjectivePageVidaPlusState createState() =>
_UpdateSubjectivePageVidaPlusState();
}
class _UpdateSubjectivePageVidaPlusState extends State<UpdateSubjectivePageVidaPlus> implements SubjectiveCallBack {
class _UpdateSubjectivePageVidaPlusState
extends State<UpdateSubjectivePageVidaPlus>
implements SubjectiveCallBack {
bool isChiefExpand = false;
bool isHistoryExpand = false;
bool isAllergiesExpand = false;
@ -43,50 +47,70 @@ class _UpdateSubjectivePageVidaPlusState extends State<UpdateSubjectivePageVidaP
TextEditingController medicationController = TextEditingController();
final formKey = GlobalKey<FormState>();
List<MySelectedAllergy> myAllergiesList = [];
List<PatientAllergiesVidaPlus> myAllergiesList = [];
List<MySelectedHistory> myHistoryList = [];
getHistory(SOAPViewModel model) async {
widget.changeLoadingState(true);
if (model.patientHistoryList.isNotEmpty) {
model.patientHistoryList.forEach((element) {
if (element.historyType == MasterKeysService.HistoryFamily.getMasterKeyService()) {
if (element.historyType ==
MasterKeysService.HistoryFamily.getMasterKeyService()) {
MasterKeyModel? history = model.getOneMasterKey(
masterKeys: MasterKeysService.HistoryFamily,
id: element.historyId,
);
if (history != null) {
MySelectedHistory mySelectedHistory = SoapUtils.generateMySelectedHistory(history: history, isChecked: element.isChecked, remark: element.remarks, isLocal: false);
MySelectedHistory mySelectedHistory = SoapUtils
.generateMySelectedHistory(history: history,
isChecked: element.isChecked,
remark: element.remarks,
isLocal: false);
myHistoryList.add(mySelectedHistory);
}
}
if (element.historyType == MasterKeysService.HistoryMedical.getMasterKeyService()) {
if (element.historyType ==
MasterKeysService.HistoryMedical.getMasterKeyService()) {
MasterKeyModel? history = model.getOneMasterKey(
masterKeys: MasterKeysService.HistoryMedical,
id: element.historyId,
);
if (history != null) {
MySelectedHistory mySelectedHistory = SoapUtils.generateMySelectedHistory(history: history, isChecked: element.isChecked, remark: element.remarks, isLocal: false);
MySelectedHistory mySelectedHistory = SoapUtils
.generateMySelectedHistory(history: history,
isChecked: element.isChecked,
remark: element.remarks,
isLocal: false);
myHistoryList.add(mySelectedHistory);
}
}
if (element.historyType == MasterKeysService.HistorySports.getMasterKeyService()) {
if (element.historyType ==
MasterKeysService.HistorySports.getMasterKeyService()) {
MasterKeyModel? history = model.getOneMasterKey(
masterKeys: MasterKeysService.HistorySports,
id: element.historyId,
);
if (history != null) {
MySelectedHistory mySelectedHistory = SoapUtils.generateMySelectedHistory(history: history, isChecked: element.isChecked, remark: element.remarks, isLocal: false);
MySelectedHistory mySelectedHistory = SoapUtils
.generateMySelectedHistory(history: history,
isChecked: element.isChecked,
remark: element.remarks,
isLocal: false);
myHistoryList.add(mySelectedHistory);
}
}
if (element.historyType == MasterKeysService.HistorySurgical.getMasterKeyService()) {
if (element.historyType ==
MasterKeysService.HistorySurgical.getMasterKeyService()) {
MasterKeyModel? history = model.getOneMasterKey(
masterKeys: MasterKeysService.HistorySurgical,
id: element.historyId,
);
if (history != null) {
MySelectedHistory mySelectedHistory = SoapUtils.generateMySelectedHistory(history: history, isChecked: element.isChecked, remark: element.remarks, isLocal: false);
MySelectedHistory mySelectedHistory = SoapUtils
.generateMySelectedHistory(history: history,
isChecked: element.isChecked,
remark: element.remarks,
isLocal: false);
myHistoryList.add(mySelectedHistory);
}
}
@ -95,25 +119,27 @@ class _UpdateSubjectivePageVidaPlusState extends State<UpdateSubjectivePageVidaP
}
getAllergies(SOAPViewModel model) async {
if (model.patientAllergiesList.isNotEmpty) {
model.patientAllergiesList.forEach((element) {
MasterKeyModel? selectedAllergy = model.getOneMasterKey(masterKeys: MasterKeysService.Allergies, id: element.allergyDiseaseId, typeId: element.allergyDiseaseType);
MasterKeyModel? selectedAllergySeverity;
if (element.severity == 0) {
selectedAllergySeverity = MasterKeyModel(id: 0, typeId: MasterKeysService.AllergySeverity.getMasterKeyService(), nameAr: '', nameEn: '');
} else {
selectedAllergySeverity = model.getOneMasterKey(
masterKeys: MasterKeysService.AllergySeverity,
id: element.severity,
)!;
}
MySelectedAllergy mySelectedAllergy = SoapUtils.generateMySelectedAllergy(
allergy: selectedAllergy, isChecked: element.isChecked, createdBy: element.createdBy!, remark: element.remarks, isLocal: false, allergySeverity: selectedAllergySeverity);
if (selectedAllergy != null && selectedAllergySeverity != null) myAllergiesList.add(mySelectedAllergy);
});
}
await model.getAllergiesVidaPlus(widget.patientInfo);
myAllergiesList = model.patientAllergiesVidaPlus;
// if (model.patientAllergiesList.isNotEmpty) {
// model.patientAllergiesList.forEach((element) {
// MasterKeyModel? selectedAllergy = model.getOneMasterKey(masterKeys: MasterKeysService.Allergies, id: element.allergyDiseaseId, typeId: element.allergyDiseaseType);
// MasterKeyModel? selectedAllergySeverity;
// if (element.severity == 0) {
// selectedAllergySeverity = MasterKeyModel(id: 0, typeId: MasterKeysService.AllergySeverity.getMasterKeyService(), nameAr: '', nameEn: '');
// } else {
// selectedAllergySeverity = model.getOneMasterKey(
// masterKeys: MasterKeysService.AllergySeverity,
// id: element.severity,
// )!;
// }
//
// MySelectedAllergy mySelectedAllergy = SoapUtils.generateMySelectedAllergy(
// allergy: selectedAllergy, isChecked: element.isChecked, createdBy: element.createdBy!, remark: element.remarks, isLocal: false, allergySeverity: selectedAllergySeverity);
//
// if (selectedAllergy != null && selectedAllergySeverity != null) myAllergiesList.add(mySelectedAllergy);
// });
// }
}
@override
@ -127,106 +153,125 @@ class _UpdateSubjectivePageVidaPlusState extends State<UpdateSubjectivePageVidaP
if (model.patientChiefComplaintList.isNotEmpty) {
isChiefExpand = true;
complaintsController.text = Utils.parseHtmlString(model.patientChiefComplaintList[0].chiefComplaint!);
complaintsController.text = Utils.parseHtmlString(
model.patientChiefComplaintList[0].chiefComplaint!);
illnessController.text = model.patientChiefComplaintList[0].hopi!;
medicationController.text = model.patientChiefComplaintList[0].currentMedication != null
? !(model.patientChiefComplaintList[0].currentMedication!).isNotEmpty
? model.patientChiefComplaintList[0].currentMedication! + '\n \n'
: model.patientChiefComplaintList[0].currentMedication!
medicationController.text =
model.patientChiefComplaintList[0].currentMedication != null
? !(model.patientChiefComplaintList[0].currentMedication!)
.isNotEmpty
? model.patientChiefComplaintList[0].currentMedication! + '\n \n'
: model.patientChiefComplaintList[0].currentMedication!
: "";
}
if (widget.patientInfo.admissionNo == null) {
await getHistory(model);
// await getHistory(model);
await getAllergies(model);
}
widget.changeLoadingState(false);
},
builder: (_, model, w) => AppScaffold(
isShowAppBar: false,
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
body: SingleChildScrollView(
physics: ScrollPhysics(),
child: Center(
child: FractionallySizedBox(
widthFactor: 0.9,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SOAPStepHeader(
currentIndex: widget.currentIndex,
changePageViewIndex: widget.changePageViewIndex,
patientInfo: widget.patientInfo,
),
ExpandableSOAPWidget(
headerTitle: TranslationBase.of(context).chiefComplaints,
onTap: () {
setState(() {
isChiefExpand = !isChiefExpand;
});
},
child: UpdateChiefComplaints(
complaints: [],
),
isExpanded: isChiefExpand,
),
SizedBox(
height: SizeConfig.heightMultiplier! * (SizeConfig.isHeightVeryShort ? 4 : 2),
),
if (widget.patientInfo.admissionNo == null)
ExpandableSOAPWidget(
headerTitle: TranslationBase.of(context).historyOfIllness,
isRequired: false,
onTap: () {
setState(() {
isHistoryExpand = !isHistoryExpand;
});
},
child: Column(
children: [UpdatePresentIllness()],
builder: (_, model, w) =>
AppScaffold(
isShowAppBar: false,
backgroundColor: Theme
.of(context)
.scaffoldBackgroundColor,
body: SingleChildScrollView(
physics: ScrollPhysics(),
child: Center(
child: FractionallySizedBox(
widthFactor: 0.9,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SOAPStepHeader(
currentIndex: widget.currentIndex,
changePageViewIndex: widget.changePageViewIndex,
patientInfo: widget.patientInfo,
),
isExpanded: isHistoryExpand,
),
SizedBox(
height: SizeConfig.heightMultiplier! * (SizeConfig.isHeightVeryShort ? 4 : 2),
),
if (widget.patientInfo.admissionNo == null)
ExpandableSOAPWidget(
headerTitle: TranslationBase.of(context).allergiesSoap,
isRequired: false,
onTap: () {
setState(() {
isAllergiesExpand = !isAllergiesExpand;
});
},
child: Column(
children: [
UpdateAllergiesWidgetVidaPlus(
myAllergiesList: myAllergiesList,
ExpandableSOAPWidget(
headerTitle: TranslationBase
.of(context)
.chiefComplaints,
onTap: () {
setState(() {
isChiefExpand = !isChiefExpand;
});
},
child: UpdateChiefComplaints(
complaints: [],
),
isExpanded: isChiefExpand,
),
SizedBox(
height: SizeConfig.heightMultiplier! *
(SizeConfig.isHeightVeryShort ? 4 : 2),
),
if (widget.patientInfo.admissionNo == null)
ExpandableSOAPWidget(
headerTitle: TranslationBase
.of(context)
.historyOfIllness,
isRequired: false,
onTap: () {
setState(() {
isHistoryExpand = !isHistoryExpand;
});
},
child: Column(
children: [UpdatePresentIllness()],
),
SizedBox(
height: 30,
isExpanded: isHistoryExpand,
),
SizedBox(
height: SizeConfig.heightMultiplier! *
(SizeConfig.isHeightVeryShort ? 4 : 2),
),
if (widget.patientInfo.admissionNo == null)
ExpandableSOAPWidget(
headerTitle: TranslationBase
.of(context)
.allergiesSoap,
isRequired: false,
onTap: () {
setState(() {
isAllergiesExpand = !isAllergiesExpand;
});
},
child: Column(
children: [
UpdateAllergiesWidgetVidaPlus(
myAllergiesList: myAllergiesList,
),
SizedBox(
height: 30,
),
],
),
],
isExpanded: isAllergiesExpand,
),
SizedBox(
height: SizeConfig.heightMultiplier! *
(SizeConfig.isHeightVeryShort ? 20 : 10),
),
isExpanded: isAllergiesExpand,
),
SizedBox(
height: SizeConfig.heightMultiplier! * (SizeConfig.isHeightVeryShort ? 20 : 10),
],
),
],
),
),
),
),
),
),
);
}
addSubjectiveInfo({required SOAPViewModel model, required List<MySelectedAllergy> myAllergiesList, required List<MySelectedHistory> myHistoryList}) async {
if (FocusScope.of(context).hasFocus) FocusScope.of(context).unfocus();
addSubjectiveInfo({required SOAPViewModel model, required List<
MySelectedAllergy> myAllergiesList, required List<
MySelectedHistory> myHistoryList}) async {
if (FocusScope
.of(context)
.hasFocus) FocusScope.of(context).unfocus();
widget.changeLoadingState(true);
formKey.currentState!.save();
formKey.currentState!.validate();
@ -234,7 +279,8 @@ class _UpdateSubjectivePageVidaPlusState extends State<UpdateSubjectivePageVidaP
model.complaintsControllerError = '';
model.medicationControllerError = '';
model.illnessControllerError = '';
if (complaintsController.text.isNotEmpty && illnessController.text.isNotEmpty) {
if (complaintsController.text.isNotEmpty &&
illnessController.text.isNotEmpty) {
await model.postSubjectServices(
patientInfo: widget.patientInfo,
complaintsText: complaintsController.text,
@ -250,26 +296,36 @@ class _UpdateSubjectivePageVidaPlusState extends State<UpdateSubjectivePageVidaP
} else {
setState(() {
if (complaintsController.text.isEmpty) {
model.complaintsControllerError = TranslationBase.of(context).emptyMessage;
model.complaintsControllerError = TranslationBase
.of(context)
.emptyMessage;
}
if (illnessController.text.isEmpty) {
model.illnessControllerError = TranslationBase.of(context).emptyMessage;
model.illnessControllerError = TranslationBase
.of(context)
.emptyMessage;
}
if (medicationController.text.isEmpty) {
model.medicationControllerError = TranslationBase.of(context).emptyMessage;
model.medicationControllerError = TranslationBase
.of(context)
.emptyMessage;
}
});
widget.changeLoadingState(false);
Utils.showErrorToast(TranslationBase.of(context).chiefComplaintErrorMsg);
Utils.showErrorToast(TranslationBase
.of(context)
.chiefComplaintErrorMsg);
}
}
@override
Function nextFunction(model) {
addSubjectiveInfo(model: model, myAllergiesList: myAllergiesList.where((i) => i.isChecked).toList(), myHistoryList: myHistoryList);
// addSubjectiveInfo(model: model,
// // myAllergiesList: myAllergiesList.where((i) => i.isChecked).toList(),
// myHistoryList: myHistoryList);
return () {};
}
}

Loading…
Cancel
Save