added 3 apis
parent
c8378278c9
commit
02e44ed7fb
@ -0,0 +1,147 @@
|
|||||||
|
class ExplanationsResponseModel {
|
||||||
|
final ExplanationsDataDetails? dataDetails;
|
||||||
|
|
||||||
|
ExplanationsResponseModel({this.dataDetails});
|
||||||
|
|
||||||
|
factory ExplanationsResponseModel.fromJson(Map<String, dynamic> json) {
|
||||||
|
return ExplanationsResponseModel(
|
||||||
|
dataDetails: json['dataDetails'] != null
|
||||||
|
? ExplanationsDataDetails.fromJson(json['dataDetails'])
|
||||||
|
: null,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return {
|
||||||
|
'dataDetails': dataDetails?.toJson(),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class ExplanationsDataDetails {
|
||||||
|
final List<ExplanationEvidence>? supportingEvidence;
|
||||||
|
final List<ExplanationEvidence>? conflictingEvidence;
|
||||||
|
final List<ExplanationEvidence>? unconfirmedEvidence;
|
||||||
|
final String? message;
|
||||||
|
final List<String>? errorList;
|
||||||
|
final int? id;
|
||||||
|
final String? language;
|
||||||
|
final String? generalId;
|
||||||
|
final String? createDate;
|
||||||
|
final String? lastEditDate;
|
||||||
|
final String? createdBy;
|
||||||
|
final String? lastEditBy;
|
||||||
|
final bool? active;
|
||||||
|
final int? sortOrder;
|
||||||
|
final int? userType;
|
||||||
|
final String? userId;
|
||||||
|
|
||||||
|
ExplanationsDataDetails({
|
||||||
|
this.supportingEvidence,
|
||||||
|
this.conflictingEvidence,
|
||||||
|
this.unconfirmedEvidence,
|
||||||
|
this.message,
|
||||||
|
this.errorList,
|
||||||
|
this.id,
|
||||||
|
this.language,
|
||||||
|
this.generalId,
|
||||||
|
this.createDate,
|
||||||
|
this.lastEditDate,
|
||||||
|
this.createdBy,
|
||||||
|
this.lastEditBy,
|
||||||
|
this.active,
|
||||||
|
this.sortOrder,
|
||||||
|
this.userType,
|
||||||
|
this.userId,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory ExplanationsDataDetails.fromJson(Map<String, dynamic> json) {
|
||||||
|
return ExplanationsDataDetails(
|
||||||
|
supportingEvidence: json['supporting_evidence'] != null
|
||||||
|
? (json['supporting_evidence'] as List)
|
||||||
|
.map((item) => ExplanationEvidence.fromJson(item))
|
||||||
|
.toList()
|
||||||
|
: null,
|
||||||
|
conflictingEvidence: json['conflicting_evidence'] != null
|
||||||
|
? (json['conflicting_evidence'] as List)
|
||||||
|
.map((item) => ExplanationEvidence.fromJson(item))
|
||||||
|
.toList()
|
||||||
|
: null,
|
||||||
|
unconfirmedEvidence: json['unconfirmed_evidence'] != null
|
||||||
|
? (json['unconfirmed_evidence'] as List)
|
||||||
|
.map((item) => ExplanationEvidence.fromJson(item))
|
||||||
|
.toList()
|
||||||
|
: null,
|
||||||
|
message: json['Message'],
|
||||||
|
errorList: json['ErrorList'] != null
|
||||||
|
? List<String>.from(json['ErrorList'])
|
||||||
|
: null,
|
||||||
|
id: json['Id'],
|
||||||
|
language: json['language'],
|
||||||
|
generalId: json['generalId'],
|
||||||
|
createDate: json['CreateDate'],
|
||||||
|
lastEditDate: json['LastEditDate'],
|
||||||
|
createdBy: json['CreatedBy'],
|
||||||
|
lastEditBy: json['LastEditBy'],
|
||||||
|
active: json['Active'],
|
||||||
|
sortOrder: json['SortOrder'],
|
||||||
|
userType: json['userType'],
|
||||||
|
userId: json['userId'],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return {
|
||||||
|
'supporting_evidence': supportingEvidence?.map((item) => item.toJson()).toList(),
|
||||||
|
'conflicting_evidence': conflictingEvidence?.map((item) => item.toJson()).toList(),
|
||||||
|
'unconfirmed_evidence': unconfirmedEvidence?.map((item) => item.toJson()).toList(),
|
||||||
|
'Message': message,
|
||||||
|
'ErrorList': errorList,
|
||||||
|
'Id': id,
|
||||||
|
'language': language,
|
||||||
|
'generalId': generalId,
|
||||||
|
'CreateDate': createDate,
|
||||||
|
'LastEditDate': lastEditDate,
|
||||||
|
'CreatedBy': createdBy,
|
||||||
|
'LastEditBy': lastEditBy,
|
||||||
|
'Active': active,
|
||||||
|
'SortOrder': sortOrder,
|
||||||
|
'userType': userType,
|
||||||
|
'userId': userId,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class ExplanationEvidence {
|
||||||
|
final String? id;
|
||||||
|
final String? name;
|
||||||
|
final String? commonName;
|
||||||
|
|
||||||
|
ExplanationEvidence({
|
||||||
|
this.id,
|
||||||
|
this.name,
|
||||||
|
this.commonName,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory ExplanationEvidence.fromJson(Map<String, dynamic> json) {
|
||||||
|
return ExplanationEvidence(
|
||||||
|
id: json['id'],
|
||||||
|
name: json['name'],
|
||||||
|
commonName: json['common_name'],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return {
|
||||||
|
'id': id,
|
||||||
|
'name': name,
|
||||||
|
'common_name': commonName,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// Helper method to get display name
|
||||||
|
String getDisplayName() {
|
||||||
|
return commonName ?? name ?? '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@ -0,0 +1,176 @@
|
|||||||
|
class RationaleResponseModel {
|
||||||
|
final RationaleDataDetails? dataDetails;
|
||||||
|
|
||||||
|
RationaleResponseModel({this.dataDetails});
|
||||||
|
|
||||||
|
factory RationaleResponseModel.fromJson(Map<String, dynamic> json) {
|
||||||
|
return RationaleResponseModel(
|
||||||
|
dataDetails: json['dataDetails'] != null
|
||||||
|
? RationaleDataDetails.fromJson(json['dataDetails'])
|
||||||
|
: null,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return {
|
||||||
|
'dataDetails': dataDetails?.toJson(),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class RationaleDataDetails {
|
||||||
|
final String? type;
|
||||||
|
final List<RationaleObservationParam>? observationParams;
|
||||||
|
final List<RationaleConditionParam>? conditionParams;
|
||||||
|
final String? message;
|
||||||
|
final List<String>? errorList;
|
||||||
|
final int? id;
|
||||||
|
final String? language;
|
||||||
|
final String? generalId;
|
||||||
|
final String? createDate;
|
||||||
|
final String? lastEditDate;
|
||||||
|
final String? createdBy;
|
||||||
|
final String? lastEditBy;
|
||||||
|
final bool? active;
|
||||||
|
final int? sortOrder;
|
||||||
|
final int? userType;
|
||||||
|
final String? userId;
|
||||||
|
|
||||||
|
RationaleDataDetails({
|
||||||
|
this.type,
|
||||||
|
this.observationParams,
|
||||||
|
this.conditionParams,
|
||||||
|
this.message,
|
||||||
|
this.errorList,
|
||||||
|
this.id,
|
||||||
|
this.language,
|
||||||
|
this.generalId,
|
||||||
|
this.createDate,
|
||||||
|
this.lastEditDate,
|
||||||
|
this.createdBy,
|
||||||
|
this.lastEditBy,
|
||||||
|
this.active,
|
||||||
|
this.sortOrder,
|
||||||
|
this.userType,
|
||||||
|
this.userId,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory RationaleDataDetails.fromJson(Map<String, dynamic> json) {
|
||||||
|
return RationaleDataDetails(
|
||||||
|
type: json['type'],
|
||||||
|
observationParams: json['observation_params'] != null
|
||||||
|
? (json['observation_params'] as List)
|
||||||
|
.map((item) => RationaleObservationParam.fromJson(item))
|
||||||
|
.toList()
|
||||||
|
: null,
|
||||||
|
conditionParams: json['condition_params'] != null
|
||||||
|
? (json['condition_params'] as List)
|
||||||
|
.map((item) => RationaleConditionParam.fromJson(item))
|
||||||
|
.toList()
|
||||||
|
: null,
|
||||||
|
message: json['Message'],
|
||||||
|
errorList: json['ErrorList'] != null
|
||||||
|
? List<String>.from(json['ErrorList'])
|
||||||
|
: null,
|
||||||
|
id: json['Id'],
|
||||||
|
language: json['language'],
|
||||||
|
generalId: json['generalId'],
|
||||||
|
createDate: json['CreateDate'],
|
||||||
|
lastEditDate: json['LastEditDate'],
|
||||||
|
createdBy: json['CreatedBy'],
|
||||||
|
lastEditBy: json['LastEditBy'],
|
||||||
|
active: json['Active'],
|
||||||
|
sortOrder: json['SortOrder'],
|
||||||
|
userType: json['userType'],
|
||||||
|
userId: json['userId'],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return {
|
||||||
|
'type': type,
|
||||||
|
'observation_params': observationParams?.map((item) => item.toJson()).toList(),
|
||||||
|
'condition_params': conditionParams?.map((item) => item.toJson()).toList(),
|
||||||
|
'Message': message,
|
||||||
|
'ErrorList': errorList,
|
||||||
|
'Id': id,
|
||||||
|
'language': language,
|
||||||
|
'generalId': generalId,
|
||||||
|
'CreateDate': createDate,
|
||||||
|
'LastEditDate': lastEditDate,
|
||||||
|
'CreatedBy': createdBy,
|
||||||
|
'LastEditBy': lastEditBy,
|
||||||
|
'Active': active,
|
||||||
|
'SortOrder': sortOrder,
|
||||||
|
'userType': userType,
|
||||||
|
'userId': userId,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class RationaleObservationParam {
|
||||||
|
final String? id;
|
||||||
|
final String? name;
|
||||||
|
final String? commonName;
|
||||||
|
|
||||||
|
RationaleObservationParam({
|
||||||
|
this.id,
|
||||||
|
this.name,
|
||||||
|
this.commonName,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory RationaleObservationParam.fromJson(Map<String, dynamic> json) {
|
||||||
|
return RationaleObservationParam(
|
||||||
|
id: json['id'],
|
||||||
|
name: json['name'],
|
||||||
|
commonName: json['common_name'],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return {
|
||||||
|
'id': id,
|
||||||
|
'name': name,
|
||||||
|
'common_name': commonName,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// Helper method to get display name
|
||||||
|
String getDisplayName() {
|
||||||
|
return commonName ?? name ?? '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class RationaleConditionParam {
|
||||||
|
final String? id;
|
||||||
|
final String? name;
|
||||||
|
final String? commonName;
|
||||||
|
|
||||||
|
RationaleConditionParam({
|
||||||
|
this.id,
|
||||||
|
this.name,
|
||||||
|
this.commonName,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory RationaleConditionParam.fromJson(Map<String, dynamic> json) {
|
||||||
|
return RationaleConditionParam(
|
||||||
|
id: json['id'],
|
||||||
|
name: json['name'],
|
||||||
|
commonName: json['common_name'],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return {
|
||||||
|
'id': id,
|
||||||
|
'name': name,
|
||||||
|
'common_name': commonName,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// Helper method to get display name
|
||||||
|
String getDisplayName() {
|
||||||
|
return commonName ?? name ?? '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@ -0,0 +1,151 @@
|
|||||||
|
class TriageLevelResponseModel {
|
||||||
|
final TriageLevelDataDetails? dataDetails;
|
||||||
|
|
||||||
|
TriageLevelResponseModel({this.dataDetails});
|
||||||
|
|
||||||
|
factory TriageLevelResponseModel.fromJson(Map<String, dynamic> json) {
|
||||||
|
return TriageLevelResponseModel(
|
||||||
|
dataDetails: json['dataDetails'] != null
|
||||||
|
? TriageLevelDataDetails.fromJson(json['dataDetails'])
|
||||||
|
: null,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return {
|
||||||
|
'dataDetails': dataDetails?.toJson(),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class TriageLevelDataDetails {
|
||||||
|
final String? triageLevel;
|
||||||
|
final List<SeriousEvidence>? serious;
|
||||||
|
final String? rootCause;
|
||||||
|
final bool? teleconsultationApplicable;
|
||||||
|
final String? message;
|
||||||
|
final List<String>? errorList;
|
||||||
|
final int? id;
|
||||||
|
final String? language;
|
||||||
|
final String? generalId;
|
||||||
|
final String? createDate;
|
||||||
|
final String? lastEditDate;
|
||||||
|
final String? createdBy;
|
||||||
|
final String? lastEditBy;
|
||||||
|
final bool? active;
|
||||||
|
final int? sortOrder;
|
||||||
|
final int? userType;
|
||||||
|
final String? userId;
|
||||||
|
|
||||||
|
TriageLevelDataDetails({
|
||||||
|
this.triageLevel,
|
||||||
|
this.serious,
|
||||||
|
this.rootCause,
|
||||||
|
this.teleconsultationApplicable,
|
||||||
|
this.message,
|
||||||
|
this.errorList,
|
||||||
|
this.id,
|
||||||
|
this.language,
|
||||||
|
this.generalId,
|
||||||
|
this.createDate,
|
||||||
|
this.lastEditDate,
|
||||||
|
this.createdBy,
|
||||||
|
this.lastEditBy,
|
||||||
|
this.active,
|
||||||
|
this.sortOrder,
|
||||||
|
this.userType,
|
||||||
|
this.userId,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory TriageLevelDataDetails.fromJson(Map<String, dynamic> json) {
|
||||||
|
return TriageLevelDataDetails(
|
||||||
|
triageLevel: json['triage_level'],
|
||||||
|
serious: json['serious'] != null
|
||||||
|
? (json['serious'] as List)
|
||||||
|
.map((item) => SeriousEvidence.fromJson(item))
|
||||||
|
.toList()
|
||||||
|
: null,
|
||||||
|
rootCause: json['root_cause'],
|
||||||
|
teleconsultationApplicable: json['teleconsultation_applicable'],
|
||||||
|
message: json['Message'],
|
||||||
|
errorList: json['ErrorList'] != null
|
||||||
|
? List<String>.from(json['ErrorList'])
|
||||||
|
: null,
|
||||||
|
id: json['Id'],
|
||||||
|
language: json['language'],
|
||||||
|
generalId: json['generalId'],
|
||||||
|
createDate: json['CreateDate'],
|
||||||
|
lastEditDate: json['LastEditDate'],
|
||||||
|
createdBy: json['CreatedBy'],
|
||||||
|
lastEditBy: json['LastEditBy'],
|
||||||
|
active: json['Active'],
|
||||||
|
sortOrder: json['SortOrder'],
|
||||||
|
userType: json['userType'],
|
||||||
|
userId: json['userId'],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return {
|
||||||
|
'triage_level': triageLevel,
|
||||||
|
'serious': serious?.map((item) => item.toJson()).toList(),
|
||||||
|
'root_cause': rootCause,
|
||||||
|
'teleconsultation_applicable': teleconsultationApplicable,
|
||||||
|
'Message': message,
|
||||||
|
'ErrorList': errorList,
|
||||||
|
'Id': id,
|
||||||
|
'language': language,
|
||||||
|
'generalId': generalId,
|
||||||
|
'CreateDate': createDate,
|
||||||
|
'LastEditDate': lastEditDate,
|
||||||
|
'CreatedBy': createdBy,
|
||||||
|
'LastEditBy': lastEditBy,
|
||||||
|
'Active': active,
|
||||||
|
'SortOrder': sortOrder,
|
||||||
|
'userType': userType,
|
||||||
|
'userId': userId,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class SeriousEvidence {
|
||||||
|
final String? id;
|
||||||
|
final String? name;
|
||||||
|
final String? commonName;
|
||||||
|
final String? seriousness;
|
||||||
|
final bool? isEmergency;
|
||||||
|
|
||||||
|
SeriousEvidence({
|
||||||
|
this.id,
|
||||||
|
this.name,
|
||||||
|
this.commonName,
|
||||||
|
this.seriousness,
|
||||||
|
this.isEmergency,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory SeriousEvidence.fromJson(Map<String, dynamic> json) {
|
||||||
|
return SeriousEvidence(
|
||||||
|
id: json['id'],
|
||||||
|
name: json['name'],
|
||||||
|
commonName: json['common_name'],
|
||||||
|
seriousness: json['seriousness'],
|
||||||
|
isEmergency: json['is_emergency'],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return {
|
||||||
|
'id': id,
|
||||||
|
'name': name,
|
||||||
|
'common_name': commonName,
|
||||||
|
'seriousness': seriousness,
|
||||||
|
'is_emergency': isEmergency,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// Helper method to get display name
|
||||||
|
String getDisplayName() {
|
||||||
|
return commonName ?? name ?? '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@ -0,0 +1,225 @@
|
|||||||
|
import 'package:easy_localization/easy_localization.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:hmg_patient_app_new/core/app_export.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/symptoms_checker/models/resp_models/triage_level_response_model.dart';
|
||||||
|
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
|
||||||
|
import 'package:hmg_patient_app_new/theme/colors.dart';
|
||||||
|
|
||||||
|
class TriageLevelCard extends StatelessWidget {
|
||||||
|
final TriageLevelDataDetails triageLevelData;
|
||||||
|
|
||||||
|
const TriageLevelCard({super.key, required this.triageLevelData});
|
||||||
|
|
||||||
|
/// Get localized title based on triage level
|
||||||
|
String getTitle(BuildContext context) {
|
||||||
|
final triageLevel = triageLevelData.triageLevel ?? '';
|
||||||
|
|
||||||
|
switch (triageLevel) {
|
||||||
|
case 'emergency_ambulance':
|
||||||
|
return LocaleKeys.triageLevelEmergencyAmbulance.tr(context: context);
|
||||||
|
case 'emergency':
|
||||||
|
return LocaleKeys.triageLevelEmergency.tr(context: context);
|
||||||
|
case 'consultation_24':
|
||||||
|
return LocaleKeys.triageLevelConsultation24.tr(context: context);
|
||||||
|
case 'consultation':
|
||||||
|
return LocaleKeys.triageLevelConsultation.tr(context: context);
|
||||||
|
case 'self_care':
|
||||||
|
return LocaleKeys.triageLevelSelfCare.tr(context: context);
|
||||||
|
default:
|
||||||
|
return LocaleKeys.triageLevelConsultation.tr(context: context);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Get localized description based on triage level
|
||||||
|
String getDescription(BuildContext context) {
|
||||||
|
final triageLevel = triageLevelData.triageLevel ?? '';
|
||||||
|
|
||||||
|
switch (triageLevel) {
|
||||||
|
case 'emergency_ambulance':
|
||||||
|
return LocaleKeys.triageLevelEmergencyAmbulanceDesc.tr(context: context);
|
||||||
|
case 'emergency':
|
||||||
|
return LocaleKeys.triageLevelEmergencyDesc.tr(context: context);
|
||||||
|
case 'consultation_24':
|
||||||
|
return LocaleKeys.triageLevelConsultation24Desc.tr(context: context);
|
||||||
|
case 'consultation':
|
||||||
|
return LocaleKeys.triageLevelConsultationDesc.tr(context: context);
|
||||||
|
case 'self_care':
|
||||||
|
return LocaleKeys.triageLevelSelfCareDesc.tr(context: context);
|
||||||
|
default:
|
||||||
|
return LocaleKeys.triageLevelConsultationDesc.tr(context: context);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Get color based on triage level
|
||||||
|
Color getBackgroundColor() {
|
||||||
|
final triageLevel = triageLevelData.triageLevel ?? '';
|
||||||
|
|
||||||
|
switch (triageLevel) {
|
||||||
|
case 'emergency_ambulance':
|
||||||
|
case 'emergency':
|
||||||
|
return AppColors.chipColorEmergency.withValues(alpha: 0.1);
|
||||||
|
case 'consultation_24':
|
||||||
|
case 'consultation':
|
||||||
|
return AppColors.chipColorSeekMedicalAdvice.withValues(alpha: 0.1);
|
||||||
|
case 'self_care':
|
||||||
|
return AppColors.chipColorMonitor.withValues(alpha: 0.1);
|
||||||
|
default:
|
||||||
|
return AppColors.chipColorSeekMedicalAdvice.withValues(alpha: 0.1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Get border color based on triage level
|
||||||
|
Color getBorderColor() {
|
||||||
|
final triageLevel = triageLevelData.triageLevel ?? '';
|
||||||
|
|
||||||
|
switch (triageLevel) {
|
||||||
|
case 'emergency_ambulance':
|
||||||
|
case 'emergency':
|
||||||
|
return AppColors.chipColorEmergency;
|
||||||
|
case 'consultation_24':
|
||||||
|
case 'consultation':
|
||||||
|
return AppColors.chipColorSeekMedicalAdvice;
|
||||||
|
case 'self_care':
|
||||||
|
return AppColors.chipColorMonitor;
|
||||||
|
default:
|
||||||
|
return AppColors.chipColorSeekMedicalAdvice;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Get icon based on triage level
|
||||||
|
IconData getIcon() {
|
||||||
|
final triageLevel = triageLevelData.triageLevel ?? '';
|
||||||
|
|
||||||
|
switch (triageLevel) {
|
||||||
|
case 'emergency_ambulance':
|
||||||
|
return Icons.local_hospital;
|
||||||
|
case 'emergency':
|
||||||
|
return Icons.emergency;
|
||||||
|
case 'consultation_24':
|
||||||
|
return Icons.schedule;
|
||||||
|
case 'consultation':
|
||||||
|
return Icons.medical_services;
|
||||||
|
case 'self_care':
|
||||||
|
return Icons.self_improvement;
|
||||||
|
default:
|
||||||
|
return Icons.medical_services;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Get root cause text (localized)
|
||||||
|
String? getRootCauseText(BuildContext context) {
|
||||||
|
final rootCause = triageLevelData.rootCause ?? '';
|
||||||
|
|
||||||
|
switch (rootCause) {
|
||||||
|
case 'emergency_evidence_present':
|
||||||
|
return LocaleKeys.rootCauseEmergencyEvidencePresent.tr(context: context);
|
||||||
|
case 'serious_evidence_present':
|
||||||
|
return LocaleKeys.rootCauseSeriousEvidencePresent.tr(context: context);
|
||||||
|
case 'emergency_condition_likely':
|
||||||
|
return LocaleKeys.rootCauseEmergencyConditionLikely.tr(context: context);
|
||||||
|
case 'emergency_condition_possible':
|
||||||
|
return LocaleKeys.rootCauseEmergencyConditionPossible.tr(context: context);
|
||||||
|
case 'consultation_condition_likely':
|
||||||
|
return LocaleKeys.rootCauseConsultationConditionLikely.tr(context: context);
|
||||||
|
case 'self_care_sufficient':
|
||||||
|
return LocaleKeys.rootCauseSelfCareSufficient.tr(context: context);
|
||||||
|
case 'diagnosis_unknown':
|
||||||
|
return LocaleKeys.rootCauseDiagnosisUnknown.tr(context: context);
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final borderColor = getBorderColor();
|
||||||
|
final title = getTitle(context);
|
||||||
|
final description = getDescription(context);
|
||||||
|
final rootCauseText = getRootCauseText(context);
|
||||||
|
final seriousSymptoms = triageLevelData.serious ?? [];
|
||||||
|
|
||||||
|
return Container(
|
||||||
|
width: double.infinity,
|
||||||
|
margin: EdgeInsets.only(left: 24.w, right: 24.w, top: 16.h, bottom: 8.h),
|
||||||
|
padding: EdgeInsets.all(20.w),
|
||||||
|
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.r, hasShadow: true),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: title.toText18(isBold: true, color: AppColors.textColor),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
|
||||||
|
SizedBox(height: 12.h),
|
||||||
|
|
||||||
|
// Description
|
||||||
|
description.toText14(color: AppColors.textColor),
|
||||||
|
|
||||||
|
// Root Cause (if available)
|
||||||
|
if (rootCauseText != null) ...[
|
||||||
|
SizedBox(height: 12.h),
|
||||||
|
Container(
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: 0.w, vertical: 8.h),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: AppColors.whiteColor.withValues(alpha: 0.5),
|
||||||
|
borderRadius: BorderRadius.circular(8.r),
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
Icon(
|
||||||
|
Icons.info_outline,
|
||||||
|
size: 16.f,
|
||||||
|
color: borderColor,
|
||||||
|
),
|
||||||
|
SizedBox(width: 8.w),
|
||||||
|
Flexible(
|
||||||
|
child: rootCauseText.toText12(
|
||||||
|
color: AppColors.textColor,
|
||||||
|
isBold: true,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
|
||||||
|
// Serious Symptoms (if any)
|
||||||
|
if (seriousSymptoms.isNotEmpty) ...[
|
||||||
|
SizedBox(height: 16.h),
|
||||||
|
LocaleKeys.seriousSymptoms.tr(context: context).toText14(
|
||||||
|
isBold: true,
|
||||||
|
color: borderColor,
|
||||||
|
),
|
||||||
|
SizedBox(height: 8.h),
|
||||||
|
...seriousSymptoms.map((symptom) {
|
||||||
|
return Padding(
|
||||||
|
padding: EdgeInsets.only(bottom: 4.h),
|
||||||
|
child: Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.only(top: 6.h, right: 8.w, left: 8.w),
|
||||||
|
width: 6.w,
|
||||||
|
height: 6.h,
|
||||||
|
decoration: BoxDecoration(shape: BoxShape.circle, color: borderColor),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: (symptom.getDisplayName()).toText13(color: AppColors.textColor),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue