WD: lab result changed.

* value to show graph is changed and from type to resultID if it is null or 6 then it will not be visible.
* list reversed for showing the graph and lab results.
* actual value is being displayed on the spots clicked.
dev_v3.13.6_CR_7211_Lab_report_changes
Syed Taha Alam 3 months ago
parent 656d8dd6b4
commit 2824abcc87

@ -24,10 +24,8 @@ enum ResultFlag {
const ResultFlag(this.value);
static ResultFlag? fromJson(String key, num? resultValueFlag) {
///these lines are added cause the result flag is coupled with two values
///if resultvalueflag is empty or line carriage then it has to be interpretive
if(resultValueFlag == null) return ResultFlag.IRR;
if(resultValueFlag == 5) return ResultFlag.IRR;
// if(resultValueFlag == null) return ResultFlag.IRR;
// if(resultValueFlag == 5) return ResultFlag.IRR;
switch (key) {
case 'N':
return ResultFlag.N;
@ -216,4 +214,11 @@ class LabResult {
return data;
}
bool shouldShowResultBarAndGraph() {
if(resultTypeID == null) return false;
if(resultTypeID == 6) return false;
return true;
}
}

@ -236,6 +236,7 @@ class LabsService extends BaseService {
response['ListPLR'].forEach((lab) {
labOrdersResultsList.add(LabOrderResult.fromJson(lab));
});
labOrdersResultsList = labOrdersResultsList.reversed.toList();
}, onFailure: (String error, int statusCode) {
labOrdersResultsList.clear();
hasError = true;
@ -754,6 +755,7 @@ class LabsService extends BaseService {
// Clamp input value to 0-100 and map it to the range bounds
final clampedValue = inputValue.clamp(0.0, 100.0);
final normalizedValue = clampedValue / 100.0; // Normalize input to 0-1
print("the normalized value is $normalizedValue");
// Map the normalized value to the target range bounds
final transformedValue = rangeStart + (normalizedValue * (rangeEnd - rangeStart));

@ -190,7 +190,7 @@ class LabsViewModel extends BaseViewModel {
recentThree.reversed.forEach((element) {
try {
var dateTime = DateUtil.convertStringToDate(element.verifiedOnDateTime!);
threePointGraphValue.add(DataPoint( labelValue: counter,value : _labsService.transformValueInRange(double.parse(element.resultValue!), element.calculatedResultFlag??""), label: "${months[dateTime.month-1]} ${dateTime.year}", date: dateTime));
threePointGraphValue.add(DataPoint( labelValue: counter,value : _labsService.transformValueInRange(double.parse(element.resultValue!), element.calculatedResultFlag??""), actualValue: element.resultValue!,label: "${months[dateTime.month-1]} ${dateTime.year}", date: dateTime));
counter++;
} catch (e) {}
});
@ -213,7 +213,7 @@ class LabsViewModel extends BaseViewModel {
try {
print("the mapping is being done");
var dateTime = DateUtil.convertStringToDate(element.verifiedOnDateTime!);
completeeGraphValues.add(DataPoint( labelValue: counter,value : _labsService.transformValueInRange(double.parse(element.resultValue!), element.calculatedResultFlag??""), label: "${months[dateTime.month-1]} ${dateTime.year}", date: dateTime));
completeeGraphValues.add(DataPoint( labelValue: counter,value : _labsService.transformValueInRange(double.parse(element.resultValue!), element.calculatedResultFlag??""), label: "${months[dateTime.month-1]} ${dateTime.year}", date: dateTime,actualValue: element.resultValue!));
} catch (e) {
print("the mapping is having exception $e");

@ -132,7 +132,7 @@ class FlowChartPage extends StatelessWidget {
),
LabResultChartAndDetails(
name: filterName!,
labResult: model.labOrdersResultsList,
labResult: model.labOrdersResultsList.reversed.toList(),
),
],
)

@ -55,8 +55,14 @@ class DynamicResultChart extends StatelessWidget {
return touchedSpots.map((spot) {
if (spot == touchedSpots.first) {
final dataPoint = dataPoints[spot.x.toInt()];
if(dataPoint.isStringResource){
return LineTooltipItem(
'${double.parse(dataPoint.actualValue).toStringAsFixed(2)}',
const TextStyle(color: Colors.white),
);
}
return LineTooltipItem(
'${dataPoint.label} ${spot.y.toStringAsFixed(2)}',
'${dataPoint.label} ${double.parse(dataPoint.actualValue).toStringAsFixed(2)}',
const TextStyle(color: Colors.white),
);
}
@ -280,7 +286,8 @@ final List<ThresholdRange> thresholdLevels = [
class DataPoint {
final double value;
double labelValue;
String label; // e.g., "This Result"
String label;
String actualValue;
final DateTime date;
bool isStringResource;
@ -288,6 +295,7 @@ class DataPoint {
{required this.value,
required this.label,
required this.date,
this.actualValue = "",
this.isStringResource = false,
this.labelValue = 0.0});
}

@ -99,6 +99,7 @@ class _LabItemState extends State<LabItem> {
buttonText: "",
type: data?.calculatedResultFlag?.getType() ??
ResultTypes.unknown,
shouldShowResultBarAndGraph: data?.shouldShowResultBarAndGraph()??true,
onButtonPressed: () {
openFlowChart(context, data?.description ?? '');
},

@ -319,6 +319,7 @@ class ItemResultCardWidgetWithParams extends StatelessWidget {
final String buttonText;
final ResultTypes type;
final bool isArabic;
final bool shouldShowResultBarAndGraph;
final Function()? onButtonPressed;
const ItemResultCardWidgetWithParams({
@ -333,6 +334,7 @@ class ItemResultCardWidgetWithParams extends StatelessWidget {
required this.type,
this.onButtonPressed,
this.isArabic = false,
this.shouldShowResultBarAndGraph = true,
}) : super(key: key);
@override
@ -380,9 +382,12 @@ class ItemResultCardWidgetWithParams extends StatelessWidget {
letterSpacing: -.64),
),
),
GestureDetector(
onTap: onButtonPressed,
child: Utils.tableColumnValueWithUnderLine(TranslationBase.of(context).viewFlowChart, isLast: true, isCapitable: false),
Visibility(
visible: shouldShowResultBarAndGraph,
child: GestureDetector(
onTap: onButtonPressed,
child: Utils.tableColumnValueWithUnderLine(TranslationBase.of(context).viewFlowChart, isLast: true, isCapitable: false),
),
),
],
),
@ -416,7 +421,7 @@ class ItemResultCardWidgetWithParams extends StatelessWidget {
const SizedBox(height: 10),
// Progress Bar
Visibility(
visible: type != ResultTypes.IRR,
visible: shouldShowResultBarAndGraph,
child: Column(
children: [
SizedBox(

Loading…
Cancel
Save