Changes for AI Lab analysis

haroon_dev
Haroon Amjad 2 weeks ago
parent 30bdfac442
commit 657f886391

File diff suppressed because it is too large Load Diff

@ -199,8 +199,8 @@ class ApiClientImp implements ApiClient {
body['TokenID'] = "@dm!n"; body['TokenID'] = "@dm!n";
} }
body['TokenID'] = "@dm!n"; // body['TokenID'] = "@dm!n";
body['PatientID'] = 2007395; // body['PatientID'] = 2007395;
// body['PatientTypeID'] = 1; // body['PatientTypeID'] = 1;
// body['PatientOutSA'] = 0; // body['PatientOutSA'] = 0;
// body['SessionID'] = "45786230487560q"; // body['SessionID'] = "45786230487560q";

@ -106,6 +106,11 @@ class LabViewModel extends ChangeNotifier {
notifyListeners(); notifyListeners();
} }
closeAILabResultAnalysis() {
labOrderResponseByAi = null;
notifyListeners();
}
void setIsSortByClinic(bool value) { void setIsSortByClinic(bool value) {
isSortByClinic = value; isSortByClinic = value;
patientLabOrdersViewList = isSortByClinic ? patientLabOrdersByClinic : patientLabOrdersByHospital; patientLabOrdersViewList = isSortByClinic ? patientLabOrdersByClinic : patientLabOrdersByHospital;

@ -1,4 +1,3 @@
import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:hmg_patient_app_new/core/app_assets.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart';
@ -101,18 +100,12 @@ class DoctorProfilePage extends StatelessWidget {
children: [ children: [
Column( Column(
children: [ children: [
Utils.buildSvgWithAssets( Utils.buildSvgWithAssets(icon: AppAssets.doctor_profile_rating_icon, width: 48.w, height: 48.h, fit: BoxFit.contain, applyThemeColor: false),
icon: AppAssets.doctor_profile_rating_icon,
width: 48.w,
height: 48.h,
fit: BoxFit.contain,
applyThemeColor: false
),
SizedBox(height: 16.h), SizedBox(height: 16.h),
"Ratings".toText12(fontWeight: FontWeight.w500, color: AppColors.greyTextColor), "Ratings".toText12(fontWeight: FontWeight.w500, color: AppColors.greyTextColor),
bookAppointmentsViewModel.doctorsProfileResponseModel.decimalDoctorRate bookAppointmentsViewModel.doctorsProfileResponseModel.decimalDoctorRate
.toString() .toString()
.toText16(isBold: true, color: AppColors.textColor, isUnderLine: true, decorationColor: AppColors.textColor), .toText16(isBold: true, color: AppColors.textColor, isUnderLine: true, decorationColor: AppColors.textColor, fontFamily: "Poppins"),
], ],
).onPress(() { ).onPress(() {
bookAppointmentsViewModel.getDoctorRatingDetails(); bookAppointmentsViewModel.getDoctorRatingDetails();
@ -128,18 +121,12 @@ class DoctorProfilePage extends StatelessWidget {
SizedBox(width: 36.w), SizedBox(width: 36.w),
Column( Column(
children: [ children: [
Utils.buildSvgWithAssets( Utils.buildSvgWithAssets(icon: AppAssets.doctor_profile_reviews_icon, width: 48.w, height: 48.h, fit: BoxFit.contain, applyThemeColor: false),
icon: AppAssets.doctor_profile_reviews_icon,
width: 48.w,
height: 48.h,
fit: BoxFit.contain,
applyThemeColor: false
),
SizedBox(height: 16.h), SizedBox(height: 16.h),
"Reviews".toText12(fontWeight: FontWeight.w500, color: AppColors.greyTextColor), "Reviews".toText12(fontWeight: FontWeight.w500, color: AppColors.greyTextColor),
bookAppointmentsViewModel.doctorsProfileResponseModel.noOfPatientsRate bookAppointmentsViewModel.doctorsProfileResponseModel.noOfPatientsRate
.toString() .toString()
.toText16(isBold: true, color: AppColors.textColor, isUnderLine: true, decorationColor: AppColors.textColor), .toText16(isBold: true, color: AppColors.textColor, isUnderLine: true, decorationColor: AppColors.textColor, fontFamily: "Poppins"),
], ],
).onPress(() { ).onPress(() {
bookAppointmentsViewModel.getDoctorRatingDetails(); bookAppointmentsViewModel.getDoctorRatingDetails();

@ -164,7 +164,7 @@ class LabResultByClinic extends StatelessWidget {
padding: EdgeInsets.only(right: 4.w, left: 4.w), padding: EdgeInsets.only(right: 4.w, left: 4.w),
child: Utils.buildSvgWithAssets(icon: AppAssets.aiOverView, width: 16.h, height: 16.h, iconColor: Colors.white), child: Utils.buildSvgWithAssets(icon: AppAssets.aiOverView, width: 16.h, height: 16.h, iconColor: Colors.white),
), ),
LocaleKeys.generateAiAnalysis.tr(context: context).toText16(isBold: true) LocaleKeys.generateAiAnalysis.tr(context: context).toText16(isBold: true, color: Colors.white)
], ],
), ),
).paddingSymmetrical(24.h, 24.h).onPress(() async { ).paddingSymmetrical(24.h, 24.h).onPress(() async {

@ -2,11 +2,14 @@ import 'package:easy_localization/easy_localization.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:hmg_patient_app_new/core/app_assets.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart';
import 'package:hmg_patient_app_new/core/dependencies.dart';
import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; import 'package:hmg_patient_app_new/core/utils/size_utils.dart';
import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
import 'package:hmg_patient_app_new/features/lab/lab_view_model.dart';
import 'package:hmg_patient_app_new/features/lab/models/resp_models/patient_lab_order_response_by_ai_model.dart'; import 'package:hmg_patient_app_new/features/lab/models/resp_models/patient_lab_order_response_by_ai_model.dart';
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/theme/colors.dart';
import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart';
class AiAnalysisWidget extends StatelessWidget { class AiAnalysisWidget extends StatelessWidget {
final LabOrderResponseByAi data; final LabOrderResponseByAi data;
@ -71,6 +74,14 @@ class AiAnalysisWidget extends StatelessWidget {
), ),
], ],
), ),
SizedBox(height: 16.h),
CustomButton(
height: 50.h,
text: LocaleKeys.close.tr(context: context),
onPressed: () {
getIt.get<LabViewModel>().closeAILabResultAnalysis();
},
),
], ],
), ),
), ),

@ -35,97 +35,99 @@ class LabResultDetails extends StatelessWidget {
LabViewModel labViewModel = Provider.of<LabViewModel>(context, listen: false); LabViewModel labViewModel = Provider.of<LabViewModel>(context, listen: false);
final appState = getIt.get<AppState>(); final appState = getIt.get<AppState>();
return Scaffold( return Scaffold(
body: Column( body: Consumer<LabViewModel>(builder: (context, labVM, child) {
children: [ return Column(
Expanded( children: [
child: CollapsingListView( Expanded(
title: LocaleKeys.labResultDetails.tr(context: context), child: CollapsingListView(
// aiOverview: () async { title: LocaleKeys.labResultDetails.tr(context: context),
// final _dialogService = getIt.get<DialogService>(); // aiOverview: () async {
// await _dialogService.showCommonBottomSheetWithoutH( // final _dialogService = getIt.get<DialogService>();
// message: LocaleKeys.aiDisclaimer.tr(), // await _dialogService.showCommonBottomSheetWithoutH(
// label: LocaleKeys.consent.tr(), // message: LocaleKeys.aiDisclaimer.tr(),
// okLabel: LocaleKeys.acceptLbl.tr(), // label: LocaleKeys.consent.tr(),
// cancelLabel: LocaleKeys.rejectView.tr(), // okLabel: LocaleKeys.acceptLbl.tr(),
// onOkPressed: () { // cancelLabel: LocaleKeys.rejectView.tr(),
// context.pop(); // onOkPressed: () {
// labViewModel.getAiOverviewSingleLabResult(langId: appState.getLanguageID().toString(), recentLabResult: recentLabResult, loadingText: LocaleKeys.loadingAIAnalysis.tr(context: context)); // context.pop();
// }, // labViewModel.getAiOverviewSingleLabResult(langId: appState.getLanguageID().toString(), recentLabResult: recentLabResult, loadingText: LocaleKeys.loadingAIAnalysis.tr(context: context));
// onCancelPressed: () { // },
// context.pop(); // onCancelPressed: () {
// }); // context.pop();
// }, // });
child: SingleChildScrollView( // },
child: Column( child: SingleChildScrollView(
spacing: 16.h, child: Column(
children: [ spacing: 16.h,
LabNameAndStatus(context), children: [
getLabDescription(context), LabNameAndStatus(context),
LabGraph(context), getLabDescription(context),
Selector<LabViewModel, LabOrderResponseByAi?>( LabGraph(context),
selector: (_, model) => model.labOrderResponseByAi, Selector<LabViewModel, LabOrderResponseByAi?>(
builder: (_, aiData, __) { selector: (_, model) => model.labOrderResponseByAi,
if (aiData != null) { builder: (_, aiData, __) {
return AiAnalysisWidget(data: aiData).paddingOnly(bottom: 16.h); if (aiData != null) {
} return AiAnalysisWidget(data: aiData).paddingOnly(bottom: 16.h);
return const SizedBox.shrink(); }
}, return const SizedBox.shrink();
), },
], ),
).paddingAll(24.h), ],
).paddingAll(24.h),
),
), ),
), ),
), labVM.labOrderResponseByAi == null ? Container(
Container( decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
decoration: RoundedRectangleBorder().toSmoothCornerDecoration( color: AppColors.whiteColor,
color: AppColors.whiteColor, borderRadius: 24.h,
borderRadius: 24.h, hasShadow: true,
hasShadow: true,
),
child: Container(
height: 56.h,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12.r),
gradient: LinearGradient(
begin: Alignment.centerLeft,
end: Alignment.centerRight,
stops: [0.236, 1.0], // 53.6% and 100%
colors: [
Color(0xFF8A38F5), // Transparent
Color(0xFFE20BBB), // Solid #F8F8F8
],
),
), ),
child: Row( child: Container(
crossAxisAlignment: CrossAxisAlignment.center, height: 56.h,
mainAxisAlignment: MainAxisAlignment.center, decoration: BoxDecoration(
children: [ borderRadius: BorderRadius.circular(12.r),
Padding( gradient: LinearGradient(
padding: EdgeInsets.only(right: 4.w, left: 4.w), begin: Alignment.centerLeft,
child: Utils.buildSvgWithAssets(icon: AppAssets.aiOverView, width: 16.h, height: 16.h, iconColor: Colors.white), end: Alignment.centerRight,
stops: [0.236, 1.0], // 53.6% and 100%
colors: [
Color(0xFF8A38F5), // Transparent
Color(0xFFE20BBB), // Solid #F8F8F8
],
), ),
LocaleKeys.generateAiAnalysisResult.tr(context: context).toText16(isBold: true) ),
], child: Row(
), crossAxisAlignment: CrossAxisAlignment.center,
).paddingSymmetrical(24.h, 24.h).onPress(() async { mainAxisAlignment: MainAxisAlignment.center,
final _dialogService = getIt.get<DialogService>(); children: [
await _dialogService.showCommonBottomSheetWithoutH( Padding(
message: LocaleKeys.aiDisclaimer.tr(), padding: EdgeInsets.only(right: 4.w, left: 4.w),
label: LocaleKeys.consent.tr(), child: Utils.buildSvgWithAssets(icon: AppAssets.aiOverView, width: 16.h, height: 16.h, iconColor: Colors.white),
okLabel: LocaleKeys.acceptLbl.tr(), ),
cancelLabel: LocaleKeys.rejectView.tr(), LocaleKeys.generateAiAnalysisResult.tr(context: context).toText16(isBold: true, color: Colors.white)
onOkPressed: () { ],
context.pop(); ),
labViewModel.getAiOverviewSingleLabResult( ).paddingSymmetrical(24.h, 24.h).onPress(() async {
langId: appState.getLanguageID().toString(), recentLabResult: recentLabResult, loadingText: LocaleKeys.loadingAIAnalysis.tr(context: context)); final _dialogService = getIt.get<DialogService>();
}, await _dialogService.showCommonBottomSheetWithoutH(
onCancelPressed: () { message: LocaleKeys.aiDisclaimer.tr(),
context.pop(); label: LocaleKeys.consent.tr(),
}); okLabel: LocaleKeys.acceptLbl.tr(),
}), cancelLabel: LocaleKeys.rejectView.tr(),
), onOkPressed: () {
], context.pop();
), labViewModel.getAiOverviewSingleLabResult(
langId: appState.getLanguageID().toString(), recentLabResult: recentLabResult, loadingText: LocaleKeys.loadingAIAnalysis.tr(context: context));
},
onCancelPressed: () {
context.pop();
});
}),
) : SizedBox.shrink(),
],
);
}),
); );
} }

Loading…
Cancel
Save