|
|
|
@ -19,31 +19,41 @@ import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dar
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart';
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_svg/flutter_svg.dart';
|
|
|
|
import 'package:flutter_svg/flutter_svg.dart';
|
|
|
|
|
|
|
|
import 'package:get_it/get_it.dart';
|
|
|
|
import 'package:hexcolor/hexcolor.dart';
|
|
|
|
import 'package:hexcolor/hexcolor.dart';
|
|
|
|
|
|
|
|
|
|
|
|
List<String> patientState = ["", "Stable", "Not Stable", "Not Defined"];
|
|
|
|
class EditDiagnosis extends StatefulWidget {
|
|
|
|
|
|
|
|
|
|
|
|
class EnterDiagnosis extends StatefulWidget {
|
|
|
|
|
|
|
|
final PatiantInformtion patientInfo;
|
|
|
|
final PatiantInformtion patientInfo;
|
|
|
|
final PatientPreviousDiagnosis diagnosis;
|
|
|
|
final PatientPreviousDiagnosis diagnosis;
|
|
|
|
|
|
|
|
|
|
|
|
const EnterDiagnosis({super.key, required this.patientInfo, required this.diagnosis});
|
|
|
|
const EditDiagnosis(
|
|
|
|
|
|
|
|
{super.key, required this.patientInfo, required this.diagnosis});
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
State<EnterDiagnosis> createState() => _EnterDiagnosisState();
|
|
|
|
State<EditDiagnosis> createState() => _EditDiagnosisState();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class _EnterDiagnosisState extends State<EnterDiagnosis> {
|
|
|
|
class _EditDiagnosisState extends State<EditDiagnosis> {
|
|
|
|
final TextEditingController filteredSearchController =
|
|
|
|
final TextEditingController filteredSearchController =
|
|
|
|
TextEditingController();
|
|
|
|
TextEditingController();
|
|
|
|
bool showAllDiagnosis = true;
|
|
|
|
bool showAllDiagnosis = true;
|
|
|
|
String status = '';
|
|
|
|
String status = '';
|
|
|
|
String? selectedDiagnosisItem;
|
|
|
|
String? selectedDiagnosisItem;
|
|
|
|
|
|
|
|
String? selectedDiagnosisItemValue;
|
|
|
|
TextEditingController remarksController = TextEditingController();
|
|
|
|
TextEditingController remarksController = TextEditingController();
|
|
|
|
Timer? _tTimer;
|
|
|
|
Timer? _tTimer;
|
|
|
|
SOAPViewModel? model;
|
|
|
|
SOAPViewModel? model;
|
|
|
|
SearchDiagnosis? selectedDiagnosis;
|
|
|
|
SearchDiagnosis? selectedDiagnosis;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
|
|
|
void initState() {
|
|
|
|
|
|
|
|
super.initState();
|
|
|
|
|
|
|
|
filteredSearchController.text = widget.diagnosis.selectedDisease ?? '';
|
|
|
|
|
|
|
|
filteredSearchController.text = widget.diagnosis.remarks ?? '';
|
|
|
|
|
|
|
|
status = widget.diagnosis.condition ?? '';
|
|
|
|
|
|
|
|
selectedDiagnosisItemValue = widget.diagnosis?.diagnosisType ?? '';
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void _onTextChanged(String text) {
|
|
|
|
void _onTextChanged(String text) {
|
|
|
|
if (_tTimer != null) {
|
|
|
|
if (_tTimer != null) {
|
|
|
|
_tTimer!.cancel();
|
|
|
|
_tTimer!.cancel();
|
|
|
|
@ -59,15 +69,31 @@ class _EnterDiagnosisState extends State<EnterDiagnosis> {
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return BaseView<SOAPViewModel>(
|
|
|
|
return BaseView<SOAPViewModel>(onModelReady: (model) {
|
|
|
|
onModelReady: (model) {
|
|
|
|
|
|
|
|
this.model = model;
|
|
|
|
this.model = model;
|
|
|
|
},
|
|
|
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
|
|
builder: (_, model, w) => AppScaffold(
|
|
|
|
model.getConditionAndType(widget.patientInfo);
|
|
|
|
isLoading: model.state == ViewState.BusyLocal ,
|
|
|
|
});
|
|
|
|
|
|
|
|
}, builder: (_, model, w) {
|
|
|
|
|
|
|
|
if (selectedDiagnosisItem == null && model.diagnosisTypeList.isNotEmpty) {
|
|
|
|
|
|
|
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
|
|
|
|
|
|
if (mounted) {
|
|
|
|
|
|
|
|
setState(() {
|
|
|
|
|
|
|
|
selectedDiagnosisItem = model.diagnosisTypeList.keys.firstWhere(
|
|
|
|
|
|
|
|
(k) =>
|
|
|
|
|
|
|
|
model.diagnosisTypeList[k] == selectedDiagnosisItemValue,
|
|
|
|
|
|
|
|
orElse: () => '');
|
|
|
|
|
|
|
|
if (selectedDiagnosisItem?.isEmpty == true)
|
|
|
|
|
|
|
|
selectedDiagnosisItem = null;
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return AppScaffold(
|
|
|
|
|
|
|
|
isLoading: model.state == ViewState.BusyLocal,
|
|
|
|
isShowAppBar: true,
|
|
|
|
isShowAppBar: true,
|
|
|
|
appBar: PatientSearchHeader(
|
|
|
|
appBar: PatientSearchHeader(
|
|
|
|
title: TranslationBase.of(context).addDiagnosis),
|
|
|
|
title: TranslationBase.of(context).editDiagnosis),
|
|
|
|
body: SingleChildScrollView(
|
|
|
|
body: SingleChildScrollView(
|
|
|
|
child: Padding(
|
|
|
|
child: Padding(
|
|
|
|
padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 16),
|
|
|
|
padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 16),
|
|
|
|
@ -75,7 +101,7 @@ class _EnterDiagnosisState extends State<EnterDiagnosis> {
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
AppText(
|
|
|
|
AppText(
|
|
|
|
TranslationBase.of(context).addDiagnosis,
|
|
|
|
TranslationBase.of(context).editDiagnosis,
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
color: Color(0xFF2E303A),
|
|
|
|
color: Color(0xFF2E303A),
|
|
|
|
fontSize: 16,
|
|
|
|
fontSize: 16,
|
|
|
|
@ -145,34 +171,34 @@ class _EnterDiagnosisState extends State<EnterDiagnosis> {
|
|
|
|
SizedBox(
|
|
|
|
SizedBox(
|
|
|
|
height: 8,
|
|
|
|
height: 8,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Row(
|
|
|
|
// Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
children: [
|
|
|
|
// children: [
|
|
|
|
Row(
|
|
|
|
// Row(
|
|
|
|
children: [
|
|
|
|
// children: [
|
|
|
|
Switch(
|
|
|
|
// Switch(
|
|
|
|
value: showAllDiagnosis,
|
|
|
|
// value: showAllDiagnosis,
|
|
|
|
activeColor: Colors.red,
|
|
|
|
// activeColor: Colors.red,
|
|
|
|
onChanged: (bool value) {
|
|
|
|
// onChanged: (bool value) {
|
|
|
|
setState(() {
|
|
|
|
// setState(() {
|
|
|
|
showAllDiagnosis = value;
|
|
|
|
// showAllDiagnosis = value;
|
|
|
|
});
|
|
|
|
// });
|
|
|
|
},
|
|
|
|
// },
|
|
|
|
),
|
|
|
|
// ),
|
|
|
|
SizedBox(
|
|
|
|
// SizedBox(
|
|
|
|
width: 8,
|
|
|
|
// width: 8,
|
|
|
|
),
|
|
|
|
// ),
|
|
|
|
AppText(
|
|
|
|
// AppText(
|
|
|
|
TranslationBase.of(context).showAllDiagnosis,
|
|
|
|
// TranslationBase.of(context).showAllDiagnosis,
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
// fontWeight: FontWeight.w500,
|
|
|
|
color: Color(0xFF2E303A),
|
|
|
|
// color: Color(0xFF2E303A),
|
|
|
|
fontSize: 11,
|
|
|
|
// fontSize: 11,
|
|
|
|
),
|
|
|
|
// ),
|
|
|
|
],
|
|
|
|
// ],
|
|
|
|
),
|
|
|
|
// ),
|
|
|
|
SvgPicture.asset('assets/images/svgs/information.svg'),
|
|
|
|
// SvgPicture.asset('assets/images/svgs/information.svg'),
|
|
|
|
],
|
|
|
|
// ],
|
|
|
|
),
|
|
|
|
// ),
|
|
|
|
Container(
|
|
|
|
Container(
|
|
|
|
margin: EdgeInsets.only(bottom: 12),
|
|
|
|
margin: EdgeInsets.only(bottom: 12),
|
|
|
|
child: AppText(
|
|
|
|
child: AppText(
|
|
|
|
@ -212,6 +238,7 @@ class _EnterDiagnosisState extends State<EnterDiagnosis> {
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: status ==
|
|
|
|
color: status ==
|
|
|
|
model.conditionTypeList[index]
|
|
|
|
model.conditionTypeList[index]
|
|
|
|
|
|
|
|
.toLowerCase()
|
|
|
|
? HexColor("#D02127")
|
|
|
|
? HexColor("#D02127")
|
|
|
|
: Colors.white,
|
|
|
|
: Colors.white,
|
|
|
|
shape: BoxShape.circle,
|
|
|
|
shape: BoxShape.circle,
|
|
|
|
@ -310,35 +337,35 @@ class _EnterDiagnosisState extends State<EnterDiagnosis> {
|
|
|
|
SizedBox(
|
|
|
|
SizedBox(
|
|
|
|
height: 16,
|
|
|
|
height: 16,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
InkWell(
|
|
|
|
// InkWell(
|
|
|
|
onTap: () async {
|
|
|
|
// onTap: () async {
|
|
|
|
if (selectedDiagnosis != null) {
|
|
|
|
// if (selectedDiagnosis != null) {
|
|
|
|
SearchDiagnosis? diagnosis =
|
|
|
|
// SearchDiagnosis? diagnosis =
|
|
|
|
await model.addToFavoriteDiagnosis(widget.patientInfo,
|
|
|
|
// await model.addToFavoriteDiagnosis(widget.patientInfo,
|
|
|
|
diagnosis: selectedDiagnosis);
|
|
|
|
// diagnosis: selectedDiagnosis);
|
|
|
|
setState(() {
|
|
|
|
// setState(() {
|
|
|
|
selectedDiagnosis = diagnosis;
|
|
|
|
// selectedDiagnosis = diagnosis;
|
|
|
|
});
|
|
|
|
// });
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
},
|
|
|
|
// },
|
|
|
|
child: Row(
|
|
|
|
// child: Row(
|
|
|
|
children: [
|
|
|
|
// children: [
|
|
|
|
SvgPicture.asset(selectedDiagnosis?.isFavorite == true
|
|
|
|
// SvgPicture.asset(selectedDiagnosis?.isFavorite == true
|
|
|
|
? 'assets/images/svgs/favoriteadded.svg'
|
|
|
|
// ? 'assets/images/svgs/favoriteadded.svg'
|
|
|
|
: 'assets/images/svgs/favorite.svg'),
|
|
|
|
// : 'assets/images/svgs/favorite.svg'),
|
|
|
|
SizedBox(
|
|
|
|
// SizedBox(
|
|
|
|
width: 4,
|
|
|
|
// width: 4,
|
|
|
|
),
|
|
|
|
// ),
|
|
|
|
AppText(
|
|
|
|
// AppText(
|
|
|
|
TranslationBase.of(context).addToFavorite,
|
|
|
|
// TranslationBase.of(context).addToFavorite,
|
|
|
|
textAlign: TextAlign.start,
|
|
|
|
// textAlign: TextAlign.start,
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
// fontWeight: FontWeight.w600,
|
|
|
|
fontSize: 10,
|
|
|
|
// fontSize: 10,
|
|
|
|
color: Color(0xFF449BF1),
|
|
|
|
// color: Color(0xFF449BF1),
|
|
|
|
),
|
|
|
|
// ),
|
|
|
|
],
|
|
|
|
// ],
|
|
|
|
),
|
|
|
|
// ),
|
|
|
|
)
|
|
|
|
// )
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
@ -381,33 +408,61 @@ class _EnterDiagnosisState extends State<EnterDiagnosis> {
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
color: Color(0xFF359846),
|
|
|
|
color: Color(0xFF359846),
|
|
|
|
onPressed: () async {
|
|
|
|
onPressed: () async {
|
|
|
|
selectedDiagnosisItem ??= model.diagnosisTypeList.keys.first;
|
|
|
|
selectedDiagnosisItem ??=
|
|
|
|
if(selectedDiagnosis == null ){
|
|
|
|
model.diagnosisTypeList.keys.first;
|
|
|
|
DrAppToastMsg.showErrorToast(TranslationBase.of(context).selectedDiagnosis);
|
|
|
|
if (selectedDiagnosis == null &&
|
|
|
|
|
|
|
|
filteredSearchController.text.isEmpty) {
|
|
|
|
|
|
|
|
DrAppToastMsg.showErrorToast(
|
|
|
|
|
|
|
|
TranslationBase.of(context)
|
|
|
|
|
|
|
|
.selectedDiagnosis);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (status.isEmpty) {
|
|
|
|
|
|
|
|
DrAppToastMsg.showErrorToast(
|
|
|
|
|
|
|
|
TranslationBase.of(context)
|
|
|
|
|
|
|
|
.selectConditionFirst);
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(status.isEmpty){
|
|
|
|
|
|
|
|
DrAppToastMsg.showErrorToast(TranslationBase.of(context).selectConditionFirst);
|
|
|
|
if (remarksController.text.isEmpty) {
|
|
|
|
|
|
|
|
DrAppToastMsg.showErrorToast(
|
|
|
|
|
|
|
|
TranslationBase.of(context)
|
|
|
|
|
|
|
|
.remarksCanNotBeEmpty);
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(remarksController.text.isEmpty){
|
|
|
|
if (filteredSearchController.text ==
|
|
|
|
DrAppToastMsg.showErrorToast(TranslationBase.of(context).remarksCanNotBeEmpty);
|
|
|
|
widget.diagnosis.selectedDisease &&
|
|
|
|
|
|
|
|
status == widget.diagnosis.condition &&
|
|
|
|
|
|
|
|
widget.diagnosis.diagnosisType ==
|
|
|
|
|
|
|
|
selectedDiagnosisItem &&
|
|
|
|
|
|
|
|
widget.diagnosis.remarks ==
|
|
|
|
|
|
|
|
filteredSearchController.text) {
|
|
|
|
|
|
|
|
DrAppToastMsg.showErrorToast(
|
|
|
|
|
|
|
|
TranslationBase.of(context)
|
|
|
|
|
|
|
|
.noChangeRecorded);
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
widget.diagnosis.selectedDisease =
|
|
|
|
|
|
|
|
filteredSearchController.text;
|
|
|
|
|
|
|
|
widget.diagnosis.selectedCategoryCode =
|
|
|
|
|
|
|
|
selectedDiagnosis?.selectedCategoryCode ?? '';
|
|
|
|
|
|
|
|
widget.diagnosis.selectedIcdCode =
|
|
|
|
|
|
|
|
selectedDiagnosis?.selectedIcdCode ?? '';
|
|
|
|
|
|
|
|
widget.diagnosis.selectedChapterCode =
|
|
|
|
|
|
|
|
selectedDiagnosis?.selectedChapterCode ?? '';
|
|
|
|
|
|
|
|
widget.diagnosis.selectedSectionCode =
|
|
|
|
|
|
|
|
selectedDiagnosis?.selectedSectionCode ?? '';
|
|
|
|
|
|
|
|
widget.diagnosis.condition = status;
|
|
|
|
|
|
|
|
widget.diagnosis.diagnosisType =
|
|
|
|
|
|
|
|
selectedDiagnosisItem;
|
|
|
|
|
|
|
|
|
|
|
|
bool result = await model.createDiagnosis(
|
|
|
|
bool result =
|
|
|
|
widget.patientInfo,
|
|
|
|
await model.editDiagnosis(widget.diagnosis);
|
|
|
|
selectedDiagnosis,
|
|
|
|
|
|
|
|
selectedDiagnosisItem,
|
|
|
|
|
|
|
|
status,
|
|
|
|
|
|
|
|
remarksController.text,
|
|
|
|
|
|
|
|
false);
|
|
|
|
|
|
|
|
if (result) {
|
|
|
|
if (result) {
|
|
|
|
Navigator.pop(context, result);
|
|
|
|
Navigator.pop(context, result);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
}),
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
@ -416,7 +471,7 @@ class _EnterDiagnosisState extends State<EnterDiagnosis> {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|