feat: update radiology analysis models and integrate specialty handling

ai-analysis
taha 2 weeks ago
parent f021eb8bc9
commit e9968e4592

@ -2070,5 +2070,6 @@
"downloadApp": "حمل التطبيق",
"unread": "غير مقروء",
"read": "مقروءة",
"pendingMedicalReportRequest": "لديك بالفعل طلب معلّق للحصول على تقرير طبي خاص بهذا الموعد. يرجى الانتظار حتى اكتمال الطلب قبل تقديم طلب جديد."
"pendingMedicalReportRequest": "لديك بالفعل طلب معلّق للحصول على تقرير طبي خاص بهذا الموعد. يرجى الانتظار حتى اكتمال الطلب قبل تقديم طلب جديد.",
"AllergyReactions": "ردود الفعل التحسسية"
}

@ -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"
}

@ -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 = "<group>"; };
78E0A7A72DC9AD7400C4905E /* FlutterGeneratedPluginSwiftPackage */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = FlutterGeneratedPluginSwiftPackage; path = Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage; sourceTree = "<group>"; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; };
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; };
@ -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 = "<group>";
@ -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 = (

@ -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)

@ -2,6 +2,27 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
<false/>
<key>UISceneConfigurations</key>
<dict>
<key>UIWindowSceneSessionRoleApplication</key>
<array>
<dict>
<key>UISceneClassName</key>
<string>UIWindowScene</string>
<key>UISceneDelegateClassName</key>
<string>FlutterSceneDelegate</string>
<key>UISceneConfigurationName</key>
<string>flutter</string>
<key>UISceneStoryboardFile</key>
<string>Main</string>
</dict>
</array>
</dict>
</dict>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>CFBundleDevelopmentRegion</key>

@ -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");
}

@ -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

@ -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 = "";

@ -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<void> getAiOverviewSingleLabResult({required int langId, required LabResult recentLabResult, required String loadingText}) async {
Future<void> 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<AppState>().getAuthenticatedUser()!.patientId, "language_id": langId, "lab_results": results};
var payload = {"patient_id": getIt.get<AppState>().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 {

@ -35,21 +35,15 @@ class LabOrdersResponseByAi {
class Analysis {
List<AiGeneratedAttribute>? aiGeneratedAttributes;
List<String>? aiPredictions;
List<AiRecommendation>? aiRecommendations;
List<String>? prevention;
String? rawMessage;
List<RiskFactor>? riskFactors;
List<dynamic>? 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<String, dynamic> json) => Analysis(
aiGeneratedAttributes: json["ai_generated_attributes"] == null ? [] : List<AiGeneratedAttribute>.from(json["ai_generated_attributes"]!.map((x) => AiGeneratedAttribute.fromJson(x))),
aiPredictions: json["ai_predictions"] == null ? [] : List<String>.from(json["ai_predictions"]!.map((x) => x)),
aiRecommendations: json["ai_recommendations"] == null ? [] : List<AiRecommendation>.from(json["ai_recommendations"]!.map((x) => AiRecommendation.fromJson(x))),
prevention: json["prevention"] == null ? [] : List<String>.from(json["prevention"]!.map((x) => x)),
rawMessage: json["raw_message"],
riskFactors: json["riskFactors"] == null ? [] : List<RiskFactor>.from(json["riskFactors"]!.map((x) => RiskFactor.fromJson(x))),
suggestedDoctors: json["suggested_doctors"] == null ? [] : List<dynamic>.from(json["suggested_doctors"]!.map((x) => x)),
summary: json["summary"],
);
Map<String, dynamic> toJson() => {
"ai_generated_attributes": aiGeneratedAttributes == null ? [] : List<dynamic>.from(aiGeneratedAttributes!.map((x) => x.toJson())),
"ai_predictions": aiPredictions == null ? [] : List<dynamic>.from(aiPredictions!.map((x) => x)),
"ai_recommendations": aiRecommendations == null ? [] : List<dynamic>.from(aiRecommendations!.map((x) => x.toJson())),
"prevention": prevention == null ? [] : List<dynamic>.from(prevention!.map((x) => x)),
"raw_message": rawMessage,
"riskFactors": riskFactors == null ? [] : List<dynamic>.from(riskFactors!.map((x) => x.toJson())),
"suggested_doctors": suggestedDoctors == null ? [] : List<dynamic>.from(suggestedDoctors!.map((x) => x)),
"summary": summary,
};
}

@ -4,20 +4,14 @@ class LabOrderResponseByAi {
String? summary;
List<AiGeneratedAttribute>? aiGeneratedAttributes;
List<String>? aiPredictions;
List<AiRecommendation>? aiRecommendations;
List<RiskFactor>? riskFactors;
List<String>? prevention;
List<dynamic>? 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<AiGeneratedAttribute>.from(json["ai_generated_attributes"]!.map((x) => AiGeneratedAttribute.fromJson(x))),
aiPredictions: json["ai_predictions"] == null ? [] : List<String>.from(json["ai_predictions"]!.map((x) => x)),
aiRecommendations: json["ai_recommendations"] == null ? [] : List<AiRecommendation>.from(json["ai_recommendations"]!.map((x) => AiRecommendation.fromJson(x))),
riskFactors: json["riskFactors"] == null ? [] : List<RiskFactor>.from(json["riskFactors"]!.map((x) => RiskFactor.fromJson(x))),
prevention: json["prevention"] == null ? [] : List<String>.from(json["prevention"]!.map((x) => x)),
suggestedDoctors: json["suggested_doctors"] == null ? [] : List<dynamic>.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<dynamic>.from(aiGeneratedAttributes!.map((x) => x.toJson())),
"ai_predictions": aiPredictions == null ? [] : List<dynamic>.from(aiPredictions!.map((x) => x)),
"ai_recommendations": aiRecommendations == null ? [] : List<dynamic>.from(aiRecommendations!.map((x) => x.toJson())),
"riskFactors": riskFactors == null ? [] : List<dynamic>.from(riskFactors!.map((x) => x.toJson())),
"prevention": prevention == null ? [] : List<dynamic>.from(prevention!.map((x) => x)),
"suggested_doctors": suggestedDoctors == null ? [] : List<dynamic>.from(suggestedDoctors!.map((x) => x)),
"raw_message": rawMessage,
};
}

@ -45,7 +45,7 @@ class PatientLabOrdersResponseModel {
dynamic? projectNameN;
String? qR;
String? setupID;
// List<String>? speciality;
List<String>? 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<String>();
speciality = json['Speciality'] != null ? List<String>.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;

@ -36,7 +36,7 @@ class PatientPrescriptionsResponseModel {
int? noOfPatientsRate;
String? qR;
// List<String>? speciality;
List<String>? 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<String, dynamic> json) {
@ -116,7 +116,7 @@ class PatientPrescriptionsResponseModel {
nationalityFlagURL = json['NationalityFlagURL'];
noOfPatientsRate = json['NoOfPatientsRate'];
qR = json['QR'];
// speciality = json['Speciality'].cast<String>();
speciality = json['Speciality'] != null ? List<String>.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;
}

@ -1,17 +1,13 @@
class PrescriptionAnalysisResponse {
String? prescriptionSummary;
List<MedicineAnalysis>? medicinesAnalysis;
List<String>? importantWarnings;
List<String>? medicineInteractions;
String? followUpNeeded;
List<String>? 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<String>() : [];
medicineInteractions = json['medicine_interactions'] != null ? json['medicine_interactions'].cast<String>() : [];
followUpNeeded = json['follow_up_needed'];
importantNotes = json['important_notes'] != null ? json['important_notes'].cast<String>() : [];
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<String>? commonSideEffects;
List<String>? seriousWarnings;
List<String>? allergyReactions;
String? storage;
MedicineAnalysis({
this.medicineName,
this.benefit,
this.commonSideEffects,
this.seriousWarnings,
this.allergyReactions,
this.storage,
});
MedicineAnalysis.fromJson(Map<String, dynamic> json) {
medicineName = json['medicine_name'];
benefit = json['benefit'];
commonSideEffects = json['common_side_effects'] != null ? json['common_side_effects'].cast<String>() : [];
seriousWarnings = json['serious_warnings'] != null ? json['serious_warnings'].cast<String>() : [];
allergyReactions = json['allergy_reactions'] != null ? json['allergy_reactions'].cast<String>() : [];
storage = json['storage'];
}
@ -70,8 +59,7 @@ class MedicineAnalysis {
final Map<String, dynamic> data = <String, dynamic>{};
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;
}

@ -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;
},

@ -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<GetAllergiesResponseModel> allergies,
}) async {
LoaderBottomSheet.showLoader(
loadingText: loadingText,
@ -424,6 +428,7 @@ class PrescriptionsViewModel extends ChangeNotifier {
// Prepare medicines payload
List<Map<String, dynamic>> medicines = [];
List<Map<String, dynamic>> 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,
);

@ -56,6 +56,7 @@ class PatientRadiologyResponseModel {
bool? isCVI;
bool? isRadMedicalReport;
dynamic vida3Id;
List<String>? 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<String, dynamic> json) {
setupID = json['SetupID'];
@ -170,6 +173,7 @@ class PatientRadiologyResponseModel {
isCVI = json['isCVI'];
isRadMedicalReport = json['isRadMedicalReport'];
vida3Id = json['vida3Id'];
speciality = json['Speciality'] != null ? List<String>.from(json['Speciality']) : [];
}
Map<String, dynamic> 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;
}
}

@ -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,
};
}

@ -19,7 +19,7 @@ abstract class RadiologyRepo {
Future<Either<Failure, GenericApiModel<List<PatientRadiologyResponseModel>>>> getPatientRadiologyOrderByAppointment({required num appointmentNo, required num projectID});
Future<Either<Failure, GenericApiModel<RadiologyAiAnalysisResponse>>> getRadiologyAiAnalysis({required String reportData, required int langId,});
Future<Either<Failure, GenericApiModel<RadiologyAiAnalysisResponse>>> getRadiologyAiAnalysis({required PatientRadiologyResponseModel radiologyData, required int langId,});
}
class RadiologyRepoImp implements RadiologyRepo {
@ -238,10 +238,12 @@ class RadiologyRepoImp implements RadiologyRepo {
}
@override
Future<Either<Failure, GenericApiModel<RadiologyAiAnalysisResponse>>> getRadiologyAiAnalysis({required String reportData, required int langId}) async {
Future<Either<Failure, GenericApiModel<RadiologyAiAnalysisResponse>>> getRadiologyAiAnalysis({required PatientRadiologyResponseModel radiologyData, required int langId}) async {
Map<String, dynamic> payload = {
"text": reportData,
"language_id": langId
"text": radiologyData.reportData ?? "",
"language_id": langId,
"clinic_name": radiologyData.clinicDescription ?? "",
"specialty_name":radiologyData.speciality?.toString().replaceAll("[", "").replaceAll("]", "") ?? ""
};
try {

@ -229,7 +229,7 @@ class RadiologyViewModel extends ChangeNotifier {
}
Future<void> getRadiologyAiAnalysis({required String reportData, required String loadingText, required int langId}) async {
Future<void> 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 {

@ -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';
}

@ -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<AppointmentDetailsPage> {
Navigator.of(context).push(
CustomPageRoute(
page: PrescriptionDetailPage(
isFromAppointments: true, prescriptionsResponseModel: patientPrescriptionsResponseModel),
isFromAppointments: true, prescriptionsResponseModel: patientPrescriptionsResponseModel,
allergies: Provider.of<MedicalFileViewModel>(context, listen: false).patientAllergiesList,
),
),
);
} else {

@ -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<LandingPage> {
late EmergencyServicesViewModel emergencyServicesViewModel;
late TodoSectionViewModel todoSectionViewModel;
late NotificationsViewModel notificationsViewModel;
late MedicalFileViewModel medicalFileViewModel;
final SwiperController _controller = SwiperController();
@ -166,6 +170,7 @@ class _LandingPageState extends State<LandingPage> {
emergencyServicesViewModel.checkPatientERAdvanceBalance();
// myAppointmentsViewModel.getPatientAppointmentQueueDetails();
notificationsViewModel.initNotificationsViewModel();
medicalFileViewModel.getPatientAllergiesList();
if (Utils.havePrivilege(122)) {
insuranceViewModel.initInsuranceProvider(isFromHomePage: true);
@ -215,6 +220,7 @@ class _LandingPageState extends State<LandingPage> {
emergencyServicesViewModel = Provider.of<EmergencyServicesViewModel>(context, listen: false);
todoSectionViewModel = Provider.of<TodoSectionViewModel>(context, listen: false);
notificationsViewModel = Provider.of<NotificationsViewModel>(context, listen: false);
medicalFileViewModel = Provider.of<MedicalFileViewModel>(context, listen: false);
appState = getIt.get<AppState>();
return PopScope(
canPop: false,
@ -280,7 +286,7 @@ class _LandingPageState extends State<LandingPage> {
myAppointmentsViewModel.setIsAppointmentDataToBeLoaded(true);
myAppointmentsViewModel.initAppointmentsViewModel();
myAppointmentsViewModel.getPatientAppointments(true, false, isForTimeLine: true);
medicalFileViewModel.getPatientAllergiesList();
// Refresh Appointments Data
// habibWalletVM.initHabibWalletProvider();
// habibWalletVM.getPatientBalanceAmount();

@ -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: [

@ -55,7 +55,7 @@ class _LabAiAnalysisDetailedPageState extends State<LabAiAnalysisDetailedPage> {
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<LabAiAnalysisDetailedPage> {
);
}
// 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<LabAiAnalysisDetailedPage> {
);
}
// 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) {

@ -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<LabResultDetails> createState() => _LabResultDetailsState();
@ -197,7 +199,7 @@ class _LabResultDetailsState extends State<LabResultDetails> {
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();

@ -972,7 +972,11 @@ class _MedicalFilePageState extends State<MedicalFilePage> {
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<MedicalFileViewModel>(context, listen: false).patientAllergiesList,
),
),
);
}),

@ -89,12 +89,12 @@ class _PrescriptionAiAnalysisDetailedPageState extends State<PrescriptionAiAnaly
}
// Important Warnings Section
if (analysis.importantWarnings != null && analysis.importantWarnings!.isNotEmpty) {
if (analysis.importantNotes != null && analysis.importantNotes!.isNotEmpty) {
expandableItems.add(
ExpandableListItem(
backgroundColor: Colors.transparent,
expandedBackgroundColor: Colors.transparent,
title: LocaleKeys.importantWarnings.tr(context: context).toText18(weight: FontWeight.w700, color: AppColors.blackColor),
title: LocaleKeys.notes.tr(context: context).toText18(weight: FontWeight.w700, color: AppColors.blackColor),
children: [
SizedBox(height: 10.h),
SizedBox(
@ -108,14 +108,12 @@ class _PrescriptionAiAnalysisDetailedPageState extends State<PrescriptionAiAnaly
padding: EdgeInsets.all(16.r),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: analysis.importantWarnings!.map((warning) {
children: analysis.importantNotes!.map((warning) {
return Padding(
padding: EdgeInsets.only(bottom: 8.h),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Icon(Icons.warning_amber_rounded, color: Color(0xFFFF5252), size: 18.w),
SizedBox(width: 8.w),
Expanded(child: warning.toText14(color: AppColors.textColorLight, height: 1.5, weight: FontWeight.w400)),
],
),
@ -130,73 +128,73 @@ class _PrescriptionAiAnalysisDetailedPageState extends State<PrescriptionAiAnaly
);
}
// Medicine Interactions Section
if (analysis.medicineInteractions != null && analysis.medicineInteractions!.isNotEmpty) {
expandableItems.add(
ExpandableListItem(
backgroundColor: Colors.transparent,
expandedBackgroundColor: Colors.transparent,
title: LocaleKeys.medicineInteractions.tr(context: context).toText18(weight: FontWeight.w700, color: AppColors.blackColor),
children: [
SizedBox(height: 10.h),
SizedBox(
width: double.infinity,
child: Container(
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
color: AppColors.whiteColor,
borderRadius: 12.r,
side: BorderSide(width: 1, color: Color(0xFFFFAF15)),
),
padding: EdgeInsets.all(16.r),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: analysis.medicineInteractions!.map((interaction) {
return Padding(
padding: EdgeInsets.only(bottom: 8.h),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Icon(Icons.info_outline, color: Color(0xFFFFAF15), size: 18.w),
SizedBox(width: 8.w),
Expanded(child: interaction.toText14(color: AppColors.textColorLight, height: 1.5, weight: FontWeight.w400)),
],
),
);
}).toList(),
),
),
),
SizedBox(height: 8.h),
],
),
);
}
// if (analysis.medicineInteractions != null && analysis.medicineInteractions!.isNotEmpty) {
// expandableItems.add(
// ExpandableListItem(
// backgroundColor: Colors.transparent,
// expandedBackgroundColor: Colors.transparent,
// title: LocaleKeys.medicineInteractions.tr(context: context).toText18(weight: FontWeight.w700, color: AppColors.blackColor),
// children: [
// SizedBox(height: 10.h),
// SizedBox(
// width: double.infinity,
// child: Container(
// decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
// color: AppColors.whiteColor,
// borderRadius: 12.r,
// side: BorderSide(width: 1, color: Color(0xFFFFAF15)),
// ),
// padding: EdgeInsets.all(16.r),
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: analysis.medicineInteractions!.map((interaction) {
// return Padding(
// padding: EdgeInsets.only(bottom: 8.h),
// child: Row(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Icon(Icons.info_outline, color: Color(0xFFFFAF15), size: 18.w),
// SizedBox(width: 8.w),
// Expanded(child: interaction.toText14(color: AppColors.textColorLight, height: 1.5, weight: FontWeight.w400)),
// ],
// ),
// );
// }).toList(),
// ),
// ),
// ),
// SizedBox(height: 8.h),
// ],
// ),
// );
// }
// Follow-up Needed Section
if (analysis.followUpNeeded != null && analysis.followUpNeeded!.isNotEmpty) {
expandableItems.add(
ExpandableListItem(
backgroundColor: Colors.transparent,
expandedBackgroundColor: Colors.transparent,
title: LocaleKeys.followUpNeeded.tr(context: context).toText18(weight: FontWeight.w700, color: AppColors.blackColor),
children: [
SizedBox(height: 10.h),
SizedBox(
width: double.infinity,
child: Container(
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
color: AppColors.whiteColor,
borderRadius: 12.r,
side: BorderSide(width: 1, color: AppColors.primaryRedColor),
),
padding: EdgeInsets.all(16.r),
child: (analysis.followUpNeeded ?? "").toText14(color: AppColors.textColorLight, height: 1.5, weight: FontWeight.w400),
),
),
SizedBox(height: 8.h),
],
),
);
}
// if (analysis.followUpNeeded != null && analysis.followUpNeeded!.isNotEmpty) {
// expandableItems.add(
// ExpandableListItem(
// backgroundColor: Colors.transparent,
// expandedBackgroundColor: Colors.transparent,
// title: LocaleKeys.followUpNeeded.tr(context: context).toText18(weight: FontWeight.w700, color: AppColors.blackColor),
// children: [
// SizedBox(height: 10.h),
// SizedBox(
// width: double.infinity,
// child: Container(
// decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
// color: AppColors.whiteColor,
// borderRadius: 12.r,
// side: BorderSide(width: 1, color: AppColors.primaryRedColor),
// ),
// padding: EdgeInsets.all(16.r),
// child: (analysis.followUpNeeded ?? "").toText14(color: AppColors.textColorLight, height: 1.5, weight: FontWeight.w400),
// ),
// ),
// SizedBox(height: 8.h),
// ],
// ),
// );
// }
return Column(
children: [
@ -263,12 +261,12 @@ class _PrescriptionAiAnalysisDetailedPageState extends State<PrescriptionAiAnaly
],
// Common Side Effects
if (medicine.commonSideEffects != null && medicine.commonSideEffects!.isNotEmpty) ...[
if (medicine.allergyReactions != null && medicine.allergyReactions!.isNotEmpty) ...[
_buildInfoRow(
icon: Icons.warning_amber_rounded,
iconColor: Color(0xFFFFAF15),
title: LocaleKeys.commonSideEffects.tr(context: context),
content: medicine.commonSideEffects!.join(', '),
title: LocaleKeys.AllergyReactions.tr(context: context),
content: medicine.allergyReactions!.join(', '),
),
SizedBox(height: 12.h),
],

@ -12,6 +12,7 @@ import 'package:hmg_patient_app_new/core/utils/utils.dart';
import 'package:hmg_patient_app_new/extensions/route_extensions.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/book_appointments/models/resp_models/get_allergies_response_model.dart';
import 'package:hmg_patient_app_new/features/prescriptions/models/resp_models/patient_prescriptions_response_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';
@ -32,10 +33,11 @@ import 'package:url_launcher/url_launcher.dart';
import 'dart:ui' as ui;
class PrescriptionDetailPage extends StatefulWidget {
PrescriptionDetailPage({super.key, required this.prescriptionsResponseModel, required this.isFromAppointments});
PrescriptionDetailPage({super.key, required this.prescriptionsResponseModel, required this.isFromAppointments, required this.allergies});
PatientPrescriptionsResponseModel prescriptionsResponseModel;
bool isFromAppointments = false;
List<GetAllergiesResponseModel> allergies;
@override
State<PrescriptionDetailPage> createState() => _PrescriptionDetailPageState();
@ -318,6 +320,8 @@ class _PrescriptionDetailPageState extends State<PrescriptionDetailPage> {
prescriptionsViewModel.setIsPrescriptionAIAnalysisNeedsToBeShown(true);
prescriptionsViewModel.getPrescriptionAiAnalysis(
prescriptions: prescriptionsViewModel.prescriptionDetailsList,
prescriptionResponseModel: widget.prescriptionsResponseModel,
allergies: widget.allergies,
langId: getIt.get<AppState>().getLanguageID(),
loadingText: LocaleKeys.loadingAIAnalysisPrescription.tr(context: context),
onNavigate: (data) {

@ -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<PrescriptionsListPage> {
int? expandedIndex;
late PrescriptionsViewModel prescriptionsViewModel;
late MedicalFileViewModel medicalFileViewModel;
@override
void initState() {
@ -50,6 +52,7 @@ class _PrescriptionsListPageState extends State<PrescriptionsListPage> {
Widget build(BuildContext context) {
AppState appState = getIt.get<AppState>();
prescriptionsViewModel = Provider.of<PrescriptionsViewModel>(context, listen: false);
medicalFileViewModel = Provider.of<MedicalFileViewModel>(context, listen: false);
return Scaffold(
backgroundColor: AppColors.bgScaffoldColor,
body: CollapsingListView(
@ -243,6 +246,7 @@ class _PrescriptionsListPageState extends State<PrescriptionsListPage> {
page: PrescriptionDetailPage(
prescriptionsResponseModel: model.patientPrescriptionOrders[index],
isFromAppointments: false,
allergies: Provider.of<MedicalFileViewModel>(context, listen: false).patientAllergiesList,
),
),
);
@ -550,6 +554,7 @@ class _PrescriptionsListPageState extends State<PrescriptionsListPage> {
CustomPageRoute(
page: PrescriptionDetailPage(
prescriptionsResponseModel: model.patientPrescriptionOrders[index],
allergies: medicalFileViewModel.patientAllergiesList,
isFromAppointments: false,
),
),

@ -45,7 +45,7 @@ class _RadiologyAiAnalysisDetailedPageState extends State<RadiologyAiAnalysisDet
// Parse string fields into lists
final predictions = _parseStringToList(analysis.aiPredictions);
final preventions = _parseStringToList(analysis.prevention);
// final preventions = _parseStringToList(analysis.prevention);
final riskFactorsText = _parseStringToList(analysis.riskFactors);
// Summary Section
@ -174,32 +174,32 @@ class _RadiologyAiAnalysisDetailedPageState extends State<RadiologyAiAnalysisDet
);
}
// 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),
],
),
);
}
// // 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: [

@ -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: [

@ -232,7 +232,7 @@ class _RadiologyResultPageState extends State<RadiologyResultPage> {
onOkPressed: () {
context.pop();
radiologyViewModel.getRadiologyAiAnalysis(
reportData: widget.patientRadiologyResponseModel.reportData ?? "",
radiologyData: widget.patientRadiologyResponseModel,
loadingText: LocaleKeys.loadingAIAnalysis.tr(context: context),
langId: _appState.getLanguageID(),
);

@ -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:

Loading…
Cancel
Save