diff --git a/assets/langs/ar-SA.json b/assets/langs/ar-SA.json index f0e3c730..aeac3dd9 100644 --- a/assets/langs/ar-SA.json +++ b/assets/langs/ar-SA.json @@ -2070,5 +2070,6 @@ "downloadApp": "حمل التطبيق", "unread": "غير مقروء", "read": "مقروءة", - "pendingMedicalReportRequest": "لديك بالفعل طلب معلّق للحصول على تقرير طبي خاص بهذا الموعد. يرجى الانتظار حتى اكتمال الطلب قبل تقديم طلب جديد." + "pendingMedicalReportRequest": "لديك بالفعل طلب معلّق للحصول على تقرير طبي خاص بهذا الموعد. يرجى الانتظار حتى اكتمال الطلب قبل تقديم طلب جديد.", + "AllergyReactions": "ردود الفعل التحسسية" } diff --git a/assets/langs/en-US.json b/assets/langs/en-US.json index 06a2742c..d6929f1b 100644 --- a/assets/langs/en-US.json +++ b/assets/langs/en-US.json @@ -2060,7 +2060,8 @@ "downloadApp": "Download App", "unread": "Unread", "read": "Read", - "pendingMedicalReportRequest": "You already have a pending medical report request for this appointment. Please wait for the request to be completed before submitting a new one." + "pendingMedicalReportRequest": "You already have a pending medical report request for this appointment. Please wait for the request to be completed before submitting a new one.", + "allergyReactions": "Allergy Reactions" } diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index cd11bd9a..783f7639 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -69,6 +69,7 @@ 76B714CF300E58B1004DE37A /* WidgetKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WidgetKit.framework; path = System/Library/Frameworks/WidgetKit.framework; sourceTree = SDKROOT; }; 76B714D1300E58B1004DE37A /* SwiftUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SwiftUI.framework; path = System/Library/Frameworks/SwiftUI.framework; sourceTree = SDKROOT; }; 78E0A7A72DC9AD7400C4905E /* FlutterGeneratedPluginSwiftPackage */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = FlutterGeneratedPluginSwiftPackage; path = Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage; sourceTree = ""; }; + 78E0A7A72DC9AD7400C4905E /* FlutterGeneratedPluginSwiftPackage */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = FlutterGeneratedPluginSwiftPackage; path = Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; @@ -89,6 +90,8 @@ files = ( 78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */, 5D5A1F80D389375644C4D0DC /* Pods_Runner.framework in Frameworks */, + 78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */, + 37D27FAF2C38AC83B852680C /* Pods_Runner.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -123,6 +126,7 @@ 76B714CF300E58B1004DE37A /* WidgetKit.framework */, 76B714D1300E58B1004DE37A /* SwiftUI.framework */, 56E413AB2A2E9765749CACD1 /* Pods_Runner.framework */, + A83C76CFF9D3F92EDE3B22B4 /* Pods_Runner.framework */, ); name = Frameworks; sourceTree = ""; @@ -175,7 +179,6 @@ children = ( 76AA18AC2F3B2A4D00DC8DFC /* ring_30Sec.caf */, 61243B412EC5FA3700D46FA0 /* Helper */, - 61243B472EC5FA3700D46FA0 /* Penguin */, 769C9BF82E6F106D009F68A9 /* RunnerDebug.entitlements */, 478CFA952E6E20A60064F3D7 /* Runner.entitlements */, 478CFA932E638C8E0064F3D7 /* GoogleService-Info.plist */, @@ -333,6 +336,7 @@ "${PODS_ROOT}/Manifest.lock", ); name = "[CP] Check Pods Manifest.lock"; + name = "[CP] Copy Pods Resources"; outputFileListPaths = ( ); outputPaths = ( diff --git a/ios/Runner/AppDelegate.swift b/ios/Runner/AppDelegate.swift index bdd5af21..13ac16ec 100644 --- a/ios/Runner/AppDelegate.swift +++ b/ios/Runner/AppDelegate.swift @@ -7,13 +7,13 @@ import GoogleMaps @objc class AppDelegate: FlutterAppDelegate, FlutterImplicitEngineDelegate { func didInitializeImplicitFlutterEngine(_ engineBridge: any FlutterImplicitEngineBridge) { GeneratedPluginRegistrant.register(with: engineBridge.pluginRegistry) - + // GMSServices.provideAPIKey("AIzaSyB6TERnxIr0yJ3qG4ULBZbu0sAD4tGqtng") // FirebaseApp.configure() // initializePlatformChannels() - + } - + override func application( _ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? @@ -28,10 +28,10 @@ import GoogleMaps // DispatchQueue.main.async { [weak self] in // guard let self = self else { return } -// +// // // 1. Try accessing window via AppDelegate (legacy/single-window setup) // var controller = self.window?.rootViewController as? FlutterViewController -// +// // // 2. Fallback to UIWindowScene active window (modern iOS architecture) // if controller == nil { // controller = UIApplication.shared.connectedScenes @@ -40,7 +40,7 @@ import GoogleMaps // .first(where: { $0.isKeyWindow })? // .rootViewController as? FlutterViewController // } -// +// // // 3. Perform initialization once FlutterViewController is available // if let mainViewController = controller { // HMGPenguinInPlatformBridge.initialize(flutterViewController: mainViewController) @@ -48,14 +48,14 @@ import GoogleMaps // print("⚠️ FlutterViewController not ready yet for initializePlatformChannels.") // } // } - - + + // if let mainViewController = window?.rootViewController as? FlutterViewController{ // platform initialization suppose to be in foreground // HMGPenguinInPlatformBridge.initialize(flutterViewController: mainViewController) // } - + } - + override func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken:Data){ // Messaging.messaging().apnsToken = deviceToken super.application(application, didRegisterForRemoteNotificationsWithDeviceToken: deviceToken) diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist index 85d84646..8bf02667 100644 --- a/ios/Runner/Info.plist +++ b/ios/Runner/Info.plist @@ -2,6 +2,27 @@ + UIApplicationSceneManifest + + UIApplicationSupportsMultipleScenes + + UISceneConfigurations + + UIWindowSceneSessionRoleApplication + + + UISceneClassName + UIWindowScene + UISceneDelegateClassName + FlutterSceneDelegate + UISceneConfigurationName + flutter + UISceneStoryboardFile + Main + + + + CADisableMinimumFrameDurationOnPhone CFBundleDevelopmentRegion diff --git a/lib/core/api/api_client.dart b/lib/core/api/api_client.dart index 1bccb154..317134e2 100644 --- a/lib/core/api/api_client.dart +++ b/lib/core/api/api_client.dart @@ -210,7 +210,7 @@ class ApiClientImp implements ApiClient { } // body['TokenID'] = "@dm!n"; - // body['PatientID'] = 1009156; + // body['PatientID'] = 2101020; // body['PatientID'] = 53320; // body['PatientTypeID'] = 1; // body['PatientOutSA'] = 0; @@ -248,7 +248,7 @@ class ApiClientImp implements ApiClient { if (kDebugMode) { debugPrint("uri: ${Uri.parse(url.trim())}"); var requestBodyJSON = json.encode(body); - debugPrint("body: $requestBodyJSON", wrapWidth: 2048); + debugPrint("body: $requestBodyJSON", wrapWidth: 10000); // log("body: $requestBodyJSON"); } diff --git a/lib/core/api_consts.dart b/lib/core/api_consts.dart index a98735f0..4145e78f 100644 --- a/lib/core/api_consts.dart +++ b/lib/core/api_consts.dart @@ -7,6 +7,7 @@ class ApiConsts { static const maxSmallScreen = 660; static AppEnvironmentTypeEnum appEnvironmentType = AppEnvironmentTypeEnum.preProd; + static AppEnvironmentTypeEnum appEnvironmentType = AppEnvironmentTypeEnum.prod; // static String baseUrl = 'https://uat.hmgwebservices.com/'; // HIS API URL UAT diff --git a/lib/extensions/string_extensions.dart b/lib/extensions/string_extensions.dart index 06d590cf..95ad376c 100644 --- a/lib/extensions/string_extensions.dart +++ b/lib/extensions/string_extensions.dart @@ -1,5 +1,6 @@ import 'package:auto_size_text/auto_size_text.dart'; import 'package:flutter/cupertino.dart'; +import 'package:flutter_markdown_plus/flutter_markdown_plus.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart'; import 'package:hmg_patient_app_new/core/app_state.dart'; import 'package:hmg_patient_app_new/core/dependencies.dart'; @@ -486,6 +487,10 @@ extension EmailValidator on String { : 'Poppins'), ), ); + Widget toText14Markdown() => + MarkdownBody( + data: this, + ); Widget toSectionHeading({String upperHeading = "", String lowerHeading = ""}) { String upper = ""; diff --git a/lib/features/lab/lab_view_model.dart b/lib/features/lab/lab_view_model.dart index 90ceacfe..64484831 100644 --- a/lib/features/lab/lab_view_model.dart +++ b/lib/features/lab/lab_view_model.dart @@ -522,7 +522,7 @@ class LabViewModel extends ChangeNotifier { labOrderResponseByAi = null; navigationService.push( MaterialPageRoute( - builder: (_) => LabResultDetails(recentLabResult: recentResult, testDescription: testDescription), + builder: (_) => LabResultDetails(recentLabResult: recentResult, testDescription: testDescription, labOrder: laborder), ), ); notifyListeners(); @@ -897,6 +897,8 @@ class LabViewModel extends ChangeNotifier { } // } orderData["results"] = testResults; + orderData["clinic_name"] = labOrder.clinicDescription ?? ""; + orderData["specialty_name"] = labOrder.speciality?.toString().replaceAll("[", "").replaceAll("]", "") ?? ""; results.add(orderData); final result = await labRepo.getPatientAiOverViewLabOrders(payload: results, langId: langId); @@ -927,7 +929,7 @@ class LabViewModel extends ChangeNotifier { // LoadingUtils.hideFullScreenLoader(); } - Future getAiOverviewSingleLabResult({required int langId, required LabResult recentLabResult, required String loadingText}) async { + Future getAiOverviewSingleLabResult({required int langId, required LabResult recentLabResult, required String loadingText, required PatientLabOrdersResponseModel labOrder}) async { LoaderBottomSheet.showLoader( loadingText: loadingText, showCloseButton: true, @@ -942,9 +944,9 @@ class LabViewModel extends ChangeNotifier { "UOM": recentLabResult.uOM ?? '', "ReferanceRange": recentLabResult.referanceRange ?? '', }); - + var speciality = labOrder.speciality?.toString().replaceAll("[", "").replaceAll("]", "") ?? ""; // var payload = {"patient_id": currentlySelectedPatientOrder!.patientID, "language_id": langId, "lab_results": results}; - var payload = {"patient_id": getIt.get().getAuthenticatedUser()!.patientId, "language_id": langId, "lab_results": results}; + var payload = {"patient_id": getIt.get().getAuthenticatedUser()!.patientId, "language_id": langId, "lab_results": results, "specialty_name": speciality, "clinic_name": labOrder.clinicDescription ?? ""}; final result = await labRepo.getPatientAiOverViewLabOrder(payload); result.fold( (failure) async { diff --git a/lib/features/lab/models/resp_models/ai_overview_labresults_by_ai_model.dart b/lib/features/lab/models/resp_models/ai_overview_labresults_by_ai_model.dart index 2353cf82..29d9aa38 100644 --- a/lib/features/lab/models/resp_models/ai_overview_labresults_by_ai_model.dart +++ b/lib/features/lab/models/resp_models/ai_overview_labresults_by_ai_model.dart @@ -35,21 +35,15 @@ class LabOrdersResponseByAi { class Analysis { List? aiGeneratedAttributes; List? aiPredictions; - List? aiRecommendations; - List? prevention; String? rawMessage; List? riskFactors; - List? suggestedDoctors; String? summary; Analysis({ this.aiGeneratedAttributes, this.aiPredictions, - this.aiRecommendations, - this.prevention, this.rawMessage, this.riskFactors, - this.suggestedDoctors, this.summary, }); @@ -60,22 +54,16 @@ class Analysis { factory Analysis.fromJson(Map json) => Analysis( aiGeneratedAttributes: json["ai_generated_attributes"] == null ? [] : List.from(json["ai_generated_attributes"]!.map((x) => AiGeneratedAttribute.fromJson(x))), aiPredictions: json["ai_predictions"] == null ? [] : List.from(json["ai_predictions"]!.map((x) => x)), - aiRecommendations: json["ai_recommendations"] == null ? [] : List.from(json["ai_recommendations"]!.map((x) => AiRecommendation.fromJson(x))), - prevention: json["prevention"] == null ? [] : List.from(json["prevention"]!.map((x) => x)), rawMessage: json["raw_message"], riskFactors: json["riskFactors"] == null ? [] : List.from(json["riskFactors"]!.map((x) => RiskFactor.fromJson(x))), - suggestedDoctors: json["suggested_doctors"] == null ? [] : List.from(json["suggested_doctors"]!.map((x) => x)), summary: json["summary"], ); Map toJson() => { "ai_generated_attributes": aiGeneratedAttributes == null ? [] : List.from(aiGeneratedAttributes!.map((x) => x.toJson())), "ai_predictions": aiPredictions == null ? [] : List.from(aiPredictions!.map((x) => x)), - "ai_recommendations": aiRecommendations == null ? [] : List.from(aiRecommendations!.map((x) => x.toJson())), - "prevention": prevention == null ? [] : List.from(prevention!.map((x) => x)), "raw_message": rawMessage, "riskFactors": riskFactors == null ? [] : List.from(riskFactors!.map((x) => x.toJson())), - "suggested_doctors": suggestedDoctors == null ? [] : List.from(suggestedDoctors!.map((x) => x)), "summary": summary, }; } diff --git a/lib/features/lab/models/resp_models/patient_lab_order_response_by_ai_model.dart b/lib/features/lab/models/resp_models/patient_lab_order_response_by_ai_model.dart index 7ad3d543..b3dd2900 100644 --- a/lib/features/lab/models/resp_models/patient_lab_order_response_by_ai_model.dart +++ b/lib/features/lab/models/resp_models/patient_lab_order_response_by_ai_model.dart @@ -4,20 +4,14 @@ class LabOrderResponseByAi { String? summary; List? aiGeneratedAttributes; List? aiPredictions; - List? aiRecommendations; List? riskFactors; - List? prevention; - List? suggestedDoctors; String? rawMessage; LabOrderResponseByAi({ this.summary, this.aiGeneratedAttributes, this.aiPredictions, - this.aiRecommendations, this.riskFactors, - this.prevention, - this.suggestedDoctors, this.rawMessage, }); @@ -29,10 +23,7 @@ class LabOrderResponseByAi { summary: json["summary"], aiGeneratedAttributes: json["ai_generated_attributes"] == null ? [] : List.from(json["ai_generated_attributes"]!.map((x) => AiGeneratedAttribute.fromJson(x))), aiPredictions: json["ai_predictions"] == null ? [] : List.from(json["ai_predictions"]!.map((x) => x)), - aiRecommendations: json["ai_recommendations"] == null ? [] : List.from(json["ai_recommendations"]!.map((x) => AiRecommendation.fromJson(x))), riskFactors: json["riskFactors"] == null ? [] : List.from(json["riskFactors"]!.map((x) => RiskFactor.fromJson(x))), - prevention: json["prevention"] == null ? [] : List.from(json["prevention"]!.map((x) => x)), - suggestedDoctors: json["suggested_doctors"] == null ? [] : List.from(json["suggested_doctors"]!.map((x) => x)), rawMessage: json["raw_message"], ); @@ -40,10 +31,7 @@ class LabOrderResponseByAi { "summary": summary, "ai_generated_attributes": aiGeneratedAttributes == null ? [] : List.from(aiGeneratedAttributes!.map((x) => x.toJson())), "ai_predictions": aiPredictions == null ? [] : List.from(aiPredictions!.map((x) => x)), - "ai_recommendations": aiRecommendations == null ? [] : List.from(aiRecommendations!.map((x) => x.toJson())), "riskFactors": riskFactors == null ? [] : List.from(riskFactors!.map((x) => x.toJson())), - "prevention": prevention == null ? [] : List.from(prevention!.map((x) => x)), - "suggested_doctors": suggestedDoctors == null ? [] : List.from(suggestedDoctors!.map((x) => x)), "raw_message": rawMessage, }; } diff --git a/lib/features/lab/models/resp_models/patient_lab_orders_response_model.dart b/lib/features/lab/models/resp_models/patient_lab_orders_response_model.dart index 1c437a48..8275771d 100644 --- a/lib/features/lab/models/resp_models/patient_lab_orders_response_model.dart +++ b/lib/features/lab/models/resp_models/patient_lab_orders_response_model.dart @@ -45,7 +45,7 @@ class PatientLabOrdersResponseModel { dynamic? projectNameN; String? qR; String? setupID; - // List? speciality; + List? speciality; int? status; String? statusDesc; String? strOrderDate; @@ -98,7 +98,7 @@ class PatientLabOrdersResponseModel { this.projectNameN, this.qR, this.setupID, - // this.speciality, + this.speciality, this.status, this.statusDesc, this.strOrderDate, @@ -151,7 +151,7 @@ class PatientLabOrdersResponseModel { projectNameN = json['ProjectNameN']; qR = json['QR']; setupID = json['SetupID']; - // speciality = json['Speciality'].cast(); + speciality = json['Speciality'] != null ? List.from(json['Speciality']) : null; status = json['Status']; statusDesc = json['StatusDesc']; strOrderDate = json['StrOrderDate']; @@ -211,7 +211,7 @@ class PatientLabOrdersResponseModel { data['ProjectNameN'] = this.projectNameN; data['QR'] = this.qR; data['SetupID'] = this.setupID; - // data['Speciality'] = this.speciality; + data['Speciality'] = this.speciality; data['Status'] = this.status; data['StatusDesc'] = this.statusDesc; data['StrOrderDate'] = this.strOrderDate; diff --git a/lib/features/prescriptions/models/resp_models/patient_prescriptions_response_model.dart b/lib/features/prescriptions/models/resp_models/patient_prescriptions_response_model.dart index 7b1d879d..0f06af7a 100644 --- a/lib/features/prescriptions/models/resp_models/patient_prescriptions_response_model.dart +++ b/lib/features/prescriptions/models/resp_models/patient_prescriptions_response_model.dart @@ -36,7 +36,7 @@ class PatientPrescriptionsResponseModel { int? noOfPatientsRate; String? qR; - // List? speciality; + List? speciality; String? strAppointmentDate; PatientPrescriptionsResponseModel( @@ -76,7 +76,7 @@ class PatientPrescriptionsResponseModel { this.nationalityFlagURL, this.noOfPatientsRate, this.qR, - // this.speciality, + this.speciality, this.strAppointmentDate}); PatientPrescriptionsResponseModel.fromJson(Map json) { @@ -116,7 +116,7 @@ class PatientPrescriptionsResponseModel { nationalityFlagURL = json['NationalityFlagURL']; noOfPatientsRate = json['NoOfPatientsRate']; qR = json['QR']; - // speciality = json['Speciality'].cast(); + speciality = json['Speciality'] != null ? List.from(json['Speciality']) : null; strAppointmentDate = json['StrAppointmentDate']; } @@ -158,7 +158,7 @@ class PatientPrescriptionsResponseModel { data['NationalityFlagURL'] = this.nationalityFlagURL; data['NoOfPatientsRate'] = this.noOfPatientsRate; data['QR'] = this.qR; - // data['Speciality'] = this.speciality; + data['Speciality'] = this.speciality; data['StrAppointmentDate'] = this.strAppointmentDate; return data; } diff --git a/lib/features/prescriptions/models/resp_models/prescription_analysis_response_model.dart b/lib/features/prescriptions/models/resp_models/prescription_analysis_response_model.dart index c0c63f40..e3fe80cb 100644 --- a/lib/features/prescriptions/models/resp_models/prescription_analysis_response_model.dart +++ b/lib/features/prescriptions/models/resp_models/prescription_analysis_response_model.dart @@ -1,17 +1,13 @@ class PrescriptionAnalysisResponse { String? prescriptionSummary; List? medicinesAnalysis; - List? importantWarnings; - List? medicineInteractions; - String? followUpNeeded; + List? importantNotes; int? languageId; PrescriptionAnalysisResponse({ this.prescriptionSummary, this.medicinesAnalysis, - this.importantWarnings, - this.medicineInteractions, - this.followUpNeeded, + this.importantNotes, this.languageId, }); @@ -23,9 +19,7 @@ class PrescriptionAnalysisResponse { medicinesAnalysis!.add(MedicineAnalysis.fromJson(v)); }); } - importantWarnings = json['important_warnings'] != null ? json['important_warnings'].cast() : []; - medicineInteractions = json['medicine_interactions'] != null ? json['medicine_interactions'].cast() : []; - followUpNeeded = json['follow_up_needed']; + importantNotes = json['important_notes'] != null ? json['important_notes'].cast() : []; languageId = json['language_id']; } @@ -35,9 +29,7 @@ class PrescriptionAnalysisResponse { if (medicinesAnalysis != null) { data['medicines_analysis'] = medicinesAnalysis!.map((v) => v.toJson()).toList(); } - data['important_warnings'] = importantWarnings; - data['medicine_interactions'] = medicineInteractions; - data['follow_up_needed'] = followUpNeeded; + data['important_notes'] = importantNotes; data['language_id'] = languageId; return data; } @@ -46,23 +38,20 @@ class PrescriptionAnalysisResponse { class MedicineAnalysis { String? medicineName; String? benefit; - List? commonSideEffects; - List? seriousWarnings; + List? allergyReactions; String? storage; MedicineAnalysis({ this.medicineName, this.benefit, - this.commonSideEffects, - this.seriousWarnings, + this.allergyReactions, this.storage, }); MedicineAnalysis.fromJson(Map json) { medicineName = json['medicine_name']; benefit = json['benefit']; - commonSideEffects = json['common_side_effects'] != null ? json['common_side_effects'].cast() : []; - seriousWarnings = json['serious_warnings'] != null ? json['serious_warnings'].cast() : []; + allergyReactions = json['allergy_reactions'] != null ? json['allergy_reactions'].cast() : []; storage = json['storage']; } @@ -70,8 +59,7 @@ class MedicineAnalysis { final Map data = {}; data['medicine_name'] = medicineName; data['benefit'] = benefit; - data['common_side_effects'] = commonSideEffects; - data['serious_warnings'] = seriousWarnings; + data['allergy_reactions'] = allergyReactions; data['storage'] = storage; return data; } diff --git a/lib/features/prescriptions/prescriptions_repo.dart b/lib/features/prescriptions/prescriptions_repo.dart index 2681b2da..588d4417 100644 --- a/lib/features/prescriptions/prescriptions_repo.dart +++ b/lib/features/prescriptions/prescriptions_repo.dart @@ -334,7 +334,7 @@ class PrescriptionsRepoImp implements PrescriptionsRepo { 'X-API-KEY': '9d9d2ac4c1fc302299dbb0fbb1b7fea1', 'accept': 'application/json', }, - body: {"medicines": payload, "language_id": langId}, + body: payload, onFailure: (error, statusCode, {messageStatus, failureType}) { failure = failureType; }, diff --git a/lib/features/prescriptions/prescriptions_view_model.dart b/lib/features/prescriptions/prescriptions_view_model.dart index 1e33b509..7ac485e0 100644 --- a/lib/features/prescriptions/prescriptions_view_model.dart +++ b/lib/features/prescriptions/prescriptions_view_model.dart @@ -4,6 +4,7 @@ import 'package:hmg_patient_app_new/core/app_state.dart'; import 'package:hmg_patient_app_new/core/dependencies.dart'; import 'package:hmg_patient_app_new/core/location_util.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; +import 'package:hmg_patient_app_new/features/book_appointments/models/resp_models/get_allergies_response_model.dart'; import 'package:hmg_patient_app_new/features/location/GeocodeResponse.dart'; import 'package:hmg_patient_app_new/features/location/location_view_model.dart'; import 'package:hmg_patient_app_new/core/dependencies.dart'; @@ -64,6 +65,7 @@ class PrescriptionsViewModel extends ChangeNotifier { PrescriptionsViewModel({required this.prescriptionsRepo, required this.errorHandlerService, required this.navServices}); initPrescriptionsViewModel() { + isPrescriptionsDataNeedsReloading = true; // todo remove this if (isPrescriptionsDataNeedsReloading) { patientPrescriptionOrders.clear(); patientPrescriptionOrdersByClinic.clear(); @@ -413,6 +415,8 @@ class PrescriptionsViewModel extends ChangeNotifier { required int langId, required String loadingText, required Function(dynamic) onNavigate, + required PatientPrescriptionsResponseModel prescriptionResponseModel, + required List allergies, }) async { LoaderBottomSheet.showLoader( loadingText: loadingText, @@ -424,6 +428,7 @@ class PrescriptionsViewModel extends ChangeNotifier { // Prepare medicines payload List> medicines = []; + List> allergiesForanalysis = []; for (var prescription in prescriptions) { if (prescription.itemDescription != null && prescription.itemDescription!.isNotEmpty) { medicines.add({ @@ -434,8 +439,22 @@ class PrescriptionsViewModel extends ChangeNotifier { } } + for (var allergy in allergies) { + allergiesForanalysis.add({ + "description": allergy.description ?? "", + "remarks": allergy.remarks ?? "", + }); + } + + var payload = { + "medicines": medicines, + "patient_allergies": allergiesForanalysis, + "langId": langId, + "clinic_name": prescriptionResponseModel.clinicDescription ?? "", + "specialty_name": prescriptionResponseModel.speciality?.toString().replaceAll("[", "").replaceAll("]", "") ?? "" + }; final result = await prescriptionsRepo.getPrescriptionAiAnalysis( - payload: medicines, + payload: payload, langId: langId, ); diff --git a/lib/features/radiology/models/resp_models/patient_radiology_response_model.dart b/lib/features/radiology/models/resp_models/patient_radiology_response_model.dart index 740c275f..b79936ec 100644 --- a/lib/features/radiology/models/resp_models/patient_radiology_response_model.dart +++ b/lib/features/radiology/models/resp_models/patient_radiology_response_model.dart @@ -56,6 +56,7 @@ class PatientRadiologyResponseModel { bool? isCVI; bool? isRadMedicalReport; dynamic vida3Id; + List? speciality; PatientRadiologyResponseModel( {this.setupID, @@ -112,7 +113,9 @@ class PatientRadiologyResponseModel { this.strOrderDate, this.isCVI, this.isRadMedicalReport, - this.vida3Id}); + this.vida3Id, + this.speciality, + }); PatientRadiologyResponseModel.fromJson(Map json) { setupID = json['SetupID']; @@ -170,6 +173,7 @@ class PatientRadiologyResponseModel { isCVI = json['isCVI']; isRadMedicalReport = json['isRadMedicalReport']; vida3Id = json['vida3Id']; + speciality = json['Speciality'] != null ? List.from(json['Speciality']) : []; } Map toJson() { @@ -229,6 +233,7 @@ class PatientRadiologyResponseModel { data['isCVI'] = this.isCVI; data['isRadMedicalReport'] = this.isRadMedicalReport; data['vida3Id'] = this.vida3Id; + data['Speciality'] = this.speciality; return data; } } diff --git a/lib/features/radiology/models/resp_models/radiology_ai_analysis_response_model.dart b/lib/features/radiology/models/resp_models/radiology_ai_analysis_response_model.dart index 3f523428..4d9ea2e1 100644 --- a/lib/features/radiology/models/resp_models/radiology_ai_analysis_response_model.dart +++ b/lib/features/radiology/models/resp_models/radiology_ai_analysis_response_model.dart @@ -5,7 +5,6 @@ class RadiologyAiAnalysisResponse { String? labResults; String? aiPredictions; String? riskFactors; - String? prevention; int? languageId; RadiologyAiAnalysisResponse({ @@ -13,7 +12,6 @@ class RadiologyAiAnalysisResponse { this.labResults, this.aiPredictions, this.riskFactors, - this.prevention, this.languageId, }); @@ -26,7 +24,6 @@ class RadiologyAiAnalysisResponse { labResults: json["lab_results"], aiPredictions: json["ai_predictions"], riskFactors: json["riskFactors"], - prevention: json["prevention"], languageId: json["language_id"], ); @@ -35,7 +32,6 @@ class RadiologyAiAnalysisResponse { "lab_results": labResults, "ai_predictions": aiPredictions, "riskFactors": riskFactors, - "prevention": prevention, "language_id": languageId, }; } diff --git a/lib/features/radiology/radiology_repo.dart b/lib/features/radiology/radiology_repo.dart index 6e538d3f..34795e0c 100644 --- a/lib/features/radiology/radiology_repo.dart +++ b/lib/features/radiology/radiology_repo.dart @@ -19,7 +19,7 @@ abstract class RadiologyRepo { Future>>> getPatientRadiologyOrderByAppointment({required num appointmentNo, required num projectID}); - Future>> getRadiologyAiAnalysis({required String reportData, required int langId,}); + Future>> getRadiologyAiAnalysis({required PatientRadiologyResponseModel radiologyData, required int langId,}); } class RadiologyRepoImp implements RadiologyRepo { @@ -238,10 +238,12 @@ class RadiologyRepoImp implements RadiologyRepo { } @override - Future>> getRadiologyAiAnalysis({required String reportData, required int langId}) async { + Future>> getRadiologyAiAnalysis({required PatientRadiologyResponseModel radiologyData, required int langId}) async { Map payload = { - "text": reportData, - "language_id": langId + "text": radiologyData.reportData ?? "", + "language_id": langId, + "clinic_name": radiologyData.clinicDescription ?? "", + "specialty_name":radiologyData.speciality?.toString().replaceAll("[", "").replaceAll("]", "") ?? "" }; try { diff --git a/lib/features/radiology/radiology_view_model.dart b/lib/features/radiology/radiology_view_model.dart index 30f9683a..1848f648 100644 --- a/lib/features/radiology/radiology_view_model.dart +++ b/lib/features/radiology/radiology_view_model.dart @@ -229,7 +229,7 @@ class RadiologyViewModel extends ChangeNotifier { } - Future getRadiologyAiAnalysis({required String reportData, required String loadingText, required int langId}) async { + Future getRadiologyAiAnalysis({required PatientRadiologyResponseModel radiologyData, required String loadingText, required int langId}) async { LoaderBottomSheet.showLoader( loadingText: loadingText, showCloseButton: true, @@ -237,7 +237,7 @@ class RadiologyViewModel extends ChangeNotifier { }, ); - final result = await radiologyRepo.getRadiologyAiAnalysis(reportData: reportData, langId: langId); + final result = await radiologyRepo.getRadiologyAiAnalysis(radiologyData: radiologyData, langId: langId); result.fold( (failure) async { diff --git a/lib/generated/locale_keys.g.dart b/lib/generated/locale_keys.g.dart index 30e3bc0a..65ca9a4c 100644 --- a/lib/generated/locale_keys.g.dart +++ b/lib/generated/locale_keys.g.dart @@ -2039,5 +2039,7 @@ abstract class LocaleKeys { static const unread = 'unread'; static const read = 'read'; static const pendingMedicalReportRequest = 'pendingMedicalReportRequest'; + static const viewAttachment = 'viewAttachment'; + static const AllergyReactions = 'AllergyReactions'; } diff --git a/lib/presentation/appointments/appointment_details_page.dart b/lib/presentation/appointments/appointment_details_page.dart index 874c97c6..947d3efe 100644 --- a/lib/presentation/appointments/appointment_details_page.dart +++ b/lib/presentation/appointments/appointment_details_page.dart @@ -26,6 +26,7 @@ import 'package:hmg_patient_app_new/core/common_models/generic_api_model.dart'; import 'package:hmg_patient_app_new/features/hmg_services/hmg_services_view_model.dart'; import 'package:hmg_patient_app_new/features/hmg_services/models/resq_models/vital_sign_respo_model.dart'; import 'package:hmg_patient_app_new/features/lab/lab_view_model.dart'; +import 'package:hmg_patient_app_new/features/medical_file/medical_file_view_model.dart'; import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/patient_appointment_history_response_model.dart'; import 'package:hmg_patient_app_new/features/my_appointments/my_appointments_view_model.dart'; import 'package:hmg_patient_app_new/features/my_appointments/utils/appointment_type.dart'; @@ -835,7 +836,9 @@ class _AppointmentDetailsPageState extends State { Navigator.of(context).push( CustomPageRoute( page: PrescriptionDetailPage( - isFromAppointments: true, prescriptionsResponseModel: patientPrescriptionsResponseModel), + isFromAppointments: true, prescriptionsResponseModel: patientPrescriptionsResponseModel, + allergies: Provider.of(context, listen: false).patientAllergiesList, + ), ), ); } else { diff --git a/lib/presentation/home/landing_page.dart b/lib/presentation/home/landing_page.dart index 9d401fac..8b82d7c0 100644 --- a/lib/presentation/home/landing_page.dart +++ b/lib/presentation/home/landing_page.dart @@ -27,6 +27,7 @@ import 'package:hmg_patient_app_new/features/habib_wallet/habib_wallet_view_mode import 'package:hmg_patient_app_new/features/hospital/hospital_selection_view_model.dart'; import 'package:hmg_patient_app_new/features/immediate_livecare/immediate_livecare_view_model.dart'; import 'package:hmg_patient_app_new/features/insurance/insurance_view_model.dart'; +import 'package:hmg_patient_app_new/features/medical_file/medical_file_view_model.dart'; import 'package:hmg_patient_app_new/features/my_appointments/appointment_rating_view_model.dart'; import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/patient_appointment_history_response_model.dart'; import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/patient_queue_details_response_model.dart'; @@ -34,11 +35,13 @@ import 'package:hmg_patient_app_new/features/my_appointments/my_appointments_vie import 'package:hmg_patient_app_new/features/notifications/notifications_view_model.dart'; import 'package:hmg_patient_app_new/features/occasion_theme/occasion_theme_view_model.dart'; import 'package:hmg_patient_app_new/features/profile_settings/profile_settings_view_model.dart'; +import 'package:hmg_patient_app_new/features/paytabs/paytabs_view_model.dart'; import 'package:hmg_patient_app_new/features/todo_section/todo_section_view_model.dart'; import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/presentation/appointments/appointment_queue_page.dart'; import 'package:hmg_patient_app_new/presentation/appointments/my_appointments_page.dart'; import 'package:hmg_patient_app_new/presentation/appointments/widgets/appointment_card.dart'; +import 'package:hmg_patient_app_new/presentation/authentication/login.dart'; import 'package:hmg_patient_app_new/presentation/authentication/quick_login.dart'; import 'package:hmg_patient_app_new/presentation/book_appointment/book_appointment_page.dart'; import 'package:hmg_patient_app_new/presentation/book_appointment/livecare/immediate_livecare_pending_request_page.dart'; @@ -97,6 +100,7 @@ class _LandingPageState extends State { late EmergencyServicesViewModel emergencyServicesViewModel; late TodoSectionViewModel todoSectionViewModel; late NotificationsViewModel notificationsViewModel; + late MedicalFileViewModel medicalFileViewModel; final SwiperController _controller = SwiperController(); @@ -166,6 +170,7 @@ class _LandingPageState extends State { emergencyServicesViewModel.checkPatientERAdvanceBalance(); // myAppointmentsViewModel.getPatientAppointmentQueueDetails(); notificationsViewModel.initNotificationsViewModel(); + medicalFileViewModel.getPatientAllergiesList(); if (Utils.havePrivilege(122)) { insuranceViewModel.initInsuranceProvider(isFromHomePage: true); @@ -215,6 +220,7 @@ class _LandingPageState extends State { emergencyServicesViewModel = Provider.of(context, listen: false); todoSectionViewModel = Provider.of(context, listen: false); notificationsViewModel = Provider.of(context, listen: false); + medicalFileViewModel = Provider.of(context, listen: false); appState = getIt.get(); return PopScope( canPop: false, @@ -280,7 +286,7 @@ class _LandingPageState extends State { myAppointmentsViewModel.setIsAppointmentDataToBeLoaded(true); myAppointmentsViewModel.initAppointmentsViewModel(); myAppointmentsViewModel.getPatientAppointments(true, false, isForTimeLine: true); - + medicalFileViewModel.getPatientAllergiesList(); // Refresh Appointments Data // habibWalletVM.initHabibWalletProvider(); // habibWalletVM.getPatientBalanceAmount(); diff --git a/lib/presentation/lab/lab_result_via_clinic/ai_analysis_widget.dart b/lib/presentation/lab/lab_result_via_clinic/ai_analysis_widget.dart index b643515f..48dc302c 100644 --- a/lib/presentation/lab/lab_result_via_clinic/ai_analysis_widget.dart +++ b/lib/presentation/lab/lab_result_via_clinic/ai_analysis_widget.dart @@ -51,7 +51,7 @@ class AiAnalysisWidget extends StatelessWidget { if (data.summary != null && data.summary!.isNotEmpty) ...[ LocaleKeys.suggestion.tr().toText16(weight: FontWeight.w700, color: AppColors.blackColor), SizedBox(height: 8.h), - data.summary!.toText14(color: AppColors.textColorLight, height: 1.5, weight: FontWeight.w400), + data.summary!.toText14Markdown(), SizedBox(height: 16.h), Divider(color: AppColors.dividerColor, thickness: 1), SizedBox(height: 16.h), @@ -64,12 +64,6 @@ class AiAnalysisWidget extends StatelessWidget { Divider(color: AppColors.dividerColor, thickness: 1), SizedBox(height: 16.h), ], - if (data.prevention != null && data.prevention!.isNotEmpty) ...[ - LocaleKeys.prevention.tr().toText16(weight: FontWeight.w700, color: AppColors.blackColor), - SizedBox(height: 12.h), - ...data.prevention!.map((item) => _buildBulletItem(item)), - SizedBox(height: 20.h), - ], Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ diff --git a/lib/presentation/lab/lab_result_via_clinic/lab_ai_analysis_detailed_page.dart b/lib/presentation/lab/lab_result_via_clinic/lab_ai_analysis_detailed_page.dart index 4debd41b..44210db1 100644 --- a/lib/presentation/lab/lab_result_via_clinic/lab_ai_analysis_detailed_page.dart +++ b/lib/presentation/lab/lab_result_via_clinic/lab_ai_analysis_detailed_page.dart @@ -55,7 +55,7 @@ class _LabAiAnalysisDetailedPageState extends State { decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 12.r, side: BorderSide(width: 1, color: Color(0xFF0B85F7))), padding: EdgeInsets.all(16.r), - child: (analysis.summary ?? "").toText14(color: AppColors.textColorLight, height: 1.5, weight: FontWeight.w400), + child: (analysis.summary ?? "").toText14Markdown(), ), SizedBox(height: 8.h), ], @@ -109,54 +109,54 @@ class _LabAiAnalysisDetailedPageState extends State { ); } - // AI Recommendations Section - if (analysis.aiRecommendations != null && analysis.aiRecommendations!.isNotEmpty) { - expandableItems.add( - ExpandableListItem( - backgroundColor: Colors.transparent, - expandedBackgroundColor:Colors.transparent , - title: LocaleKeys.suggestions.tr(context: context).toText18(weight: FontWeight.w700, color: AppColors.blackColor), - children: [ - SizedBox(height: 10.h), - Container( - decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 12.r), - padding: EdgeInsets.all(16.r), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: analysis.aiRecommendations!.asMap().entries.map((entry) { - final rec = entry.value; - final isLast = entry.key == analysis.aiRecommendations!.length - 1; - return Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - if (rec.priority != null) ...[ - Container( - padding: EdgeInsets.symmetric(horizontal: 8.w, vertical: 4.h), - decoration: BoxDecoration(color: _getPriorityColor(rec.priority), borderRadius: BorderRadius.circular(4.r)), - child: rec.priority!.toText12(isBold: true, color: _getPriorityTextColor(rec.priority)), - ), - SizedBox(height: 8.h), - ], - (rec.recommendation ?? "").toText14( - color: AppColors.textColorLight, - height: 1.5, - weight: FontWeight.w400, - ), - if (!isLast) ...[ - SizedBox(height: 12.h), - Divider(color: AppColors.dividerColor, thickness: 1), - SizedBox(height: 12.h), - ], - ], - ); - }).toList(), - ), - ), - SizedBox(height: 8.h), - ], - ), - ); - } + // // AI Recommendations Section + // if (analysis.aiRecommendations != null && analysis.aiRecommendations!.isNotEmpty) { + // expandableItems.add( + // ExpandableListItem( + // backgroundColor: Colors.transparent, + // expandedBackgroundColor:Colors.transparent , + // title: LocaleKeys.suggestions.tr(context: context).toText18(weight: FontWeight.w700, color: AppColors.blackColor), + // children: [ + // SizedBox(height: 10.h), + // Container( + // decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 12.r), + // padding: EdgeInsets.all(16.r), + // child: Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: analysis.aiRecommendations!.asMap().entries.map((entry) { + // final rec = entry.value; + // final isLast = entry.key == analysis.aiRecommendations!.length - 1; + // return Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // if (rec.priority != null) ...[ + // Container( + // padding: EdgeInsets.symmetric(horizontal: 8.w, vertical: 4.h), + // decoration: BoxDecoration(color: _getPriorityColor(rec.priority), borderRadius: BorderRadius.circular(4.r)), + // child: rec.priority!.toText12(isBold: true, color: _getPriorityTextColor(rec.priority)), + // ), + // SizedBox(height: 8.h), + // ], + // (rec.recommendation ?? "").toText14( + // color: AppColors.textColorLight, + // height: 1.5, + // weight: FontWeight.w400, + // ), + // if (!isLast) ...[ + // SizedBox(height: 12.h), + // Divider(color: AppColors.dividerColor, thickness: 1), + // SizedBox(height: 12.h), + // ], + // ], + // ); + // }).toList(), + // ), + // ), + // SizedBox(height: 8.h), + // ], + // ), + // ); + // } // Risk Factors Section if (analysis.riskFactors != null && analysis.riskFactors!.isNotEmpty) { @@ -229,28 +229,28 @@ class _LabAiAnalysisDetailedPageState extends State { ); } - // Prevention Section - if (analysis.prevention != null && analysis.prevention!.isNotEmpty) { - expandableItems.add( - ExpandableListItem( - backgroundColor: Colors.transparent, - expandedBackgroundColor:Colors.transparent , - title: LocaleKeys.prevention.tr(context: context).toText18(weight: FontWeight.w700, color: AppColors.blackColor), - children: [ - SizedBox(height: 10.h), - Container( - decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 12.r, side: BorderSide(width: 1, color: Color(0xFF18C273))), - padding: EdgeInsets.all(16.r), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: analysis.prevention!.map((prevention) => _buildBulletItem(prevention)).toList(), - ), - ), - SizedBox(height: 8.h), - ], - ), - ); - } + // // Prevention Section + // if (analysis.prevention != null && analysis.prevention!.isNotEmpty) { + // expandableItems.add( + // ExpandableListItem( + // backgroundColor: Colors.transparent, + // expandedBackgroundColor:Colors.transparent , + // title: LocaleKeys.prevention.tr(context: context).toText18(weight: FontWeight.w700, color: AppColors.blackColor), + // children: [ + // SizedBox(height: 10.h), + // Container( + // decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 12.r, side: BorderSide(width: 1, color: Color(0xFF18C273))), + // padding: EdgeInsets.all(16.r), + // child: Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: analysis.prevention!.map((prevention) => _buildBulletItem(prevention)).toList(), + // ), + // ), + // SizedBox(height: 8.h), + // ], + // ), + // ); + // } // // Suggested Doctors Section // if (analysis.suggestedDoctors != null && analysis.suggestedDoctors!.isNotEmpty) { diff --git a/lib/presentation/lab/lab_results/lab_result_details.dart b/lib/presentation/lab/lab_results/lab_result_details.dart index 9fbb49a8..4a65d9cf 100644 --- a/lib/presentation/lab/lab_results/lab_result_details.dart +++ b/lib/presentation/lab/lab_results/lab_result_details.dart @@ -25,14 +25,16 @@ import 'package:hmg_patient_app_new/widgets/graph/custom_graph.dart'; import 'package:provider/provider.dart' show Consumer, Provider, ReadContext, Selector; import '../../../core/common_models/data_points.dart'; +import '../../../features/lab/models/resp_models/patient_lab_orders_response_model.dart'; import '../../../widgets/common_bottom_sheet.dart' show showCommonBottomSheetWithoutHeight; import 'dart:ui' as ui; class LabResultDetails extends StatefulWidget { final LabResult recentLabResult; final String? testDescription; + final PatientLabOrdersResponseModel labOrder; - const LabResultDetails({super.key, required this.recentLabResult, required this.testDescription}); + const LabResultDetails({super.key, required this.recentLabResult, required this.testDescription, required this.labOrder}); @override State createState() => _LabResultDetailsState(); @@ -197,7 +199,7 @@ class _LabResultDetailsState extends State { onOkPressed: () { context.pop(); labViewModel.getAiOverviewSingleLabResult( - langId: appState.getLanguageID(), recentLabResult: recentLabResult, loadingText: LocaleKeys.loadingAIAnalysis.tr(context: context)); + langId: appState.getLanguageID(), recentLabResult: recentLabResult, loadingText: LocaleKeys.loadingAIAnalysis.tr(context: context), labOrder: widget.labOrder); }, onCancelPressed: () { context.pop(); diff --git a/lib/presentation/medical_file/medical_file_page.dart b/lib/presentation/medical_file/medical_file_page.dart index add423d8..bd69fb7e 100644 --- a/lib/presentation/medical_file/medical_file_page.dart +++ b/lib/presentation/medical_file/medical_file_page.dart @@ -972,7 +972,11 @@ class _MedicalFilePageState extends State { prescriptionVM.setPrescriptionsDetailsLoading(); Navigator.of(context).push( CustomPageRoute( - page: PrescriptionDetailPage(isFromAppointments: false, prescriptionsResponseModel: prescriptionVM.patientPrescriptionOrders[index]), + page: PrescriptionDetailPage( + isFromAppointments: false, + prescriptionsResponseModel: prescriptionVM.patientPrescriptionOrders[index], + allergies: Provider.of(context, listen: false).patientAllergiesList, + ), ), ); }), diff --git a/lib/presentation/prescriptions/prescription_ai_analysis_detailed_page.dart b/lib/presentation/prescriptions/prescription_ai_analysis_detailed_page.dart index 82a5d9de..cf83bcca 100644 --- a/lib/presentation/prescriptions/prescription_ai_analysis_detailed_page.dart +++ b/lib/presentation/prescriptions/prescription_ai_analysis_detailed_page.dart @@ -89,12 +89,12 @@ class _PrescriptionAiAnalysisDetailedPageState extends State allergies; @override State createState() => _PrescriptionDetailPageState(); @@ -318,6 +320,8 @@ class _PrescriptionDetailPageState extends State { prescriptionsViewModel.setIsPrescriptionAIAnalysisNeedsToBeShown(true); prescriptionsViewModel.getPrescriptionAiAnalysis( prescriptions: prescriptionsViewModel.prescriptionDetailsList, + prescriptionResponseModel: widget.prescriptionsResponseModel, + allergies: widget.allergies, langId: getIt.get().getLanguageID(), loadingText: LocaleKeys.loadingAIAnalysisPrescription.tr(context: context), onNavigate: (data) { diff --git a/lib/presentation/prescriptions/prescriptions_list_page.dart b/lib/presentation/prescriptions/prescriptions_list_page.dart index 071cce87..e4562545 100644 --- a/lib/presentation/prescriptions/prescriptions_list_page.dart +++ b/lib/presentation/prescriptions/prescriptions_list_page.dart @@ -11,6 +11,7 @@ import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; +import 'package:hmg_patient_app_new/features/medical_file/medical_file_view_model.dart'; import 'package:hmg_patient_app_new/features/prescriptions/prescriptions_view_model.dart'; import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/presentation/lab/lab_result_item_view.dart'; @@ -37,6 +38,7 @@ class _PrescriptionsListPageState extends State { int? expandedIndex; late PrescriptionsViewModel prescriptionsViewModel; + late MedicalFileViewModel medicalFileViewModel; @override void initState() { @@ -50,6 +52,7 @@ class _PrescriptionsListPageState extends State { Widget build(BuildContext context) { AppState appState = getIt.get(); prescriptionsViewModel = Provider.of(context, listen: false); + medicalFileViewModel = Provider.of(context, listen: false); return Scaffold( backgroundColor: AppColors.bgScaffoldColor, body: CollapsingListView( @@ -243,6 +246,7 @@ class _PrescriptionsListPageState extends State { page: PrescriptionDetailPage( prescriptionsResponseModel: model.patientPrescriptionOrders[index], isFromAppointments: false, + allergies: Provider.of(context, listen: false).patientAllergiesList, ), ), ); @@ -550,6 +554,7 @@ class _PrescriptionsListPageState extends State { CustomPageRoute( page: PrescriptionDetailPage( prescriptionsResponseModel: model.patientPrescriptionOrders[index], + allergies: medicalFileViewModel.patientAllergiesList, isFromAppointments: false, ), ), diff --git a/lib/presentation/radiology/radiology_ai_analysis_detailed_page.dart b/lib/presentation/radiology/radiology_ai_analysis_detailed_page.dart index a3e00e79..eaebd34e 100644 --- a/lib/presentation/radiology/radiology_ai_analysis_detailed_page.dart +++ b/lib/presentation/radiology/radiology_ai_analysis_detailed_page.dart @@ -45,7 +45,7 @@ class _RadiologyAiAnalysisDetailedPageState extends State _buildBulletItem(prevention)).toList(), - ), - ), - SizedBox(height: 8.h), - ], - ), - ); - } + // // Prevention Section + // if (preventions.isNotEmpty) { + // expandableItems.add( + // ExpandableListItem( + // backgroundColor: Colors.transparent, + // expandedBackgroundColor: Colors.transparent, + // title: LocaleKeys.prevention.tr(context: context).toText18(weight: FontWeight.w700, color: AppColors.blackColor), + // children: [ + // SizedBox(height: 10.h), + // Container( + // decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + // color: AppColors.whiteColor, + // borderRadius: 12.r, + // side: BorderSide(width: 1, color: Color(0xFF18C273)), + // ), + // padding: EdgeInsets.all(16.r), + // child: Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: preventions.map((prevention) => _buildBulletItem(prevention)).toList(), + // ), + // ), + // SizedBox(height: 8.h), + // ], + // ), + // ); + // } return Column( children: [ diff --git a/lib/presentation/radiology/radiology_ai_analysis_widget.dart b/lib/presentation/radiology/radiology_ai_analysis_widget.dart index f22bcbd0..0fc1887e 100644 --- a/lib/presentation/radiology/radiology_ai_analysis_widget.dart +++ b/lib/presentation/radiology/radiology_ai_analysis_widget.dart @@ -27,7 +27,7 @@ class RadiologyAiAnalysisWidget extends StatelessWidget { Widget build(BuildContext context) { // Parse the string fields into lists final predictions = _parseStringToList(data.aiPredictions); - final preventions = _parseStringToList(data.prevention); + // final preventions = _parseStringToList(data.prevention); return Container( decoration: BoxDecoration(borderRadius: BorderRadius.circular(24.r), gradient: AppColors.aiLinearGradient), @@ -69,12 +69,12 @@ class RadiologyAiAnalysisWidget extends StatelessWidget { Divider(color: AppColors.dividerColor, thickness: 1), SizedBox(height: 16.h), ], - if (preventions.isNotEmpty) ...[ - LocaleKeys.prevention.tr().toText16(weight: FontWeight.w700, color: AppColors.blackColor), - SizedBox(height: 12.h), - ...preventions.map((item) => _buildBulletItem(item)), - SizedBox(height: 20.h), - ], + // if (preventions.isNotEmpty) ...[ + // LocaleKeys.prevention.tr().toText16(weight: FontWeight.w700, color: AppColors.blackColor), + // SizedBox(height: 12.h), + // ...preventions.map((item) => _buildBulletItem(item)), + // SizedBox(height: 20.h), + // ], Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ diff --git a/lib/presentation/radiology/radiology_result_page.dart b/lib/presentation/radiology/radiology_result_page.dart index 5b7072e6..b7f94261 100644 --- a/lib/presentation/radiology/radiology_result_page.dart +++ b/lib/presentation/radiology/radiology_result_page.dart @@ -232,7 +232,7 @@ class _RadiologyResultPageState extends State { onOkPressed: () { context.pop(); radiologyViewModel.getRadiologyAiAnalysis( - reportData: widget.patientRadiologyResponseModel.reportData ?? "", + radiologyData: widget.patientRadiologyResponseModel, loadingText: LocaleKeys.loadingAIAnalysis.tr(context: context), langId: _appState.getLanguageID(), ); diff --git a/pubspec.yaml b/pubspec.yaml index c6bc2c93..144fa923 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -116,6 +116,7 @@ dependencies: cloudflare_turnstile: ^3.7.2 freerasp: ^8.2.1 safe_device: ^1.4.1 + flutter_markdown_plus: ^1.0.12 myfatoorah_flutter: ^3.3.2 dev_dependencies: