Compare commits

...

8 Commits

Author SHA1 Message Date
Haroon6138 4b5f15490c Merge pull request 'WD: Lab result along with bottom dates' (#3) from lab_result into update-to-3.32-sdk
Reviewed-on: #3
2 months ago
taha.alam 82d54e78c9 Merge remote-tracking branch 'origin/lab_result' into lab_result
# Conflicts:
#	lib/widgets/data_display/medical/LabResult/full_screen_lab_result_graph.dart
2 months ago
taha.alam 85c8f5466f duplicate value removed 2 months ago
taha.alam 6596e38b09 Merge remote-tracking branch 'origin/update-to-3.32-sdk' into lab_result
# Conflicts:
#	lib/config/localized_values.dart
#	lib/core/viewModels/medical/labs_view_model.dart
#	lib/widgets/data_display/medical/LabResult/full_screen_lab_result_graph.dart
2 months ago
taha.alam b6d310c65f WD: bottom date titles are added with custom height and maxX 2 months ago
haroon amjad 8348557254 Bottom safe area for android 2 months ago
haroon amjad a13c2e6c31 rebase update branch into lab_result 2 months ago
taha.alam dd1c3a462a WD: bottom date titles are added with custom height and maxX 2 months ago

@ -187,7 +187,7 @@ class BaseAppClient {
// body['IdentificationNo'] = 1023854217;
// body['MobileNo'] = "531940021"; //0560717232
// body['PatientID'] = 53320; //4609100
// body['PatientID'] = 3628599; //4609100
// body['TokenID'] = "@dm!n";
// Patient ID: 3027574

@ -32,7 +32,6 @@ class LabsViewModel extends BaseViewModel {
List<ThresholdRange> threshold = [];
double maxYForThreeDots = 0.0;
double maxYForCompleteGraph = 0.0;
List months = ['Jan', 'Feb', 'Mar', 'April', 'May', 'Jun', 'July', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
String get labReportPDF => _labsService.labReportPDF;
@ -200,13 +199,7 @@ class LabsViewModel extends BaseViewModel {
maxYForThreeDots = double.parse(element.resultValue!);
}
// 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: double.parse(element.resultValue!),
actualValue: element.resultValue!,
label: "${months[dateTime.month - 1]} ${dateTime.year}",
date: dateTime,
referenceRangeValue: element.calculatedResultFlag ?? "IRR"));
threePointGraphValue.add(DataPoint( labelValue: counter,value : double.parse(element.resultValue!), actualValue: element.resultValue!,label: formatDateAsMMYY(dateTime), date: dateTime, referenceRangeValue:element.calculatedResultFlag ??"IRR"));
counter++;
} catch (e) {}
});
@ -224,21 +217,15 @@ class LabsViewModel extends BaseViewModel {
completeeGraphValues.clear();
setState(ViewState.Busy);
double counter = 1;
threshold = _labsService.getThresholdValue();
threshold = _labsService.getThresholdValue();
_labsService.labOrdersResultsList.reversed.forEach((element) {
try {
var dateTime = DateUtil.convertStringToDate(element.verifiedOnDateTime!);
if (double.parse(element.resultValue!) > maxYForCompleteGraph) {
if(double.parse(element.resultValue!)> maxYForCompleteGraph){
maxYForCompleteGraph = double.parse(element.resultValue!);
}
// 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: double.parse(element.resultValue!),
label: "${months[dateTime.month - 1]} ${dateTime.year}",
date: dateTime,
actualValue: element.resultValue!,
referenceRangeValue: element.calculatedResultFlag ?? "IRR"));
completeeGraphValues.add(DataPoint( labelValue: counter,value : double.parse(element.resultValue!), label: formatDateAsMMYY(dateTime), date: dateTime,actualValue: element.resultValue!, referenceRangeValue:element.calculatedResultFlag??"IRR" ));
} catch (e) {
print("the mapping is having exception $e");
}
@ -250,6 +237,11 @@ class LabsViewModel extends BaseViewModel {
onComplete();
}
String formatDateAsMMYY(DateTime date) {
String month = date.month.toString().padLeft(2, '0');
String year = date.year.toString().substring(2);
return '$month/$year';
}
sendLabReportEmail({PatientLabOrders? patientLabOrder, String? mes, AuthenticatedUser? userObj, required bool isVidaPlus, bool isDownload = false}) async {
setState(ViewState.Busy);

@ -12,8 +12,11 @@ class FullScreenGraph extends StatelessWidget {
final double maxY;
const FullScreenGraph({super.key, required this.completeeGraphValues, required this.threshold, required this.maxY});
const FullScreenGraph(
{super.key,
required this.completeeGraphValues,
required this.threshold,
required this.maxY});
@override
Widget build(BuildContext context) {
return AppScaffold(
@ -21,8 +24,7 @@ class FullScreenGraph extends StatelessWidget {
appBarTitle: TranslationBase.of(context).labResult,
showNewAppBar: true,
showNewAppBarTitle: true,
showHomeAppBarIcon: false,
backgroundColor: Color(0xffF8F8F8),
showHomeAppBarIcon: false,backgroundColor: Color(0xffF8F8F8),
body: RotatedBox(
quarterTurns: 1,
child: SizedBox(
@ -32,34 +34,39 @@ class FullScreenGraph extends StatelessWidget {
color: Colors.white,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 18),
child: DynamicResultChart(
dataPoints: completeeGraphValues,
thresholds: threshold,
maxY: maxY,
// width:((completeeGraphValues.length <=2)? MediaQuery.sizeOf(context).height : (MediaQuery.sizeOf(context).height* (
// completeeGraphValues.length <= 3
// ? 1
// : (completeeGraphValues.length/3))
// ) )-77,
width: MediaQuery.sizeOf(context).height - 100,
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
height: MediaQuery.sizeOf(context).width,
isFullScreenGraph: true,
child: DynamicResultChart(
dataPoints: completeeGraphValues,
thresholds: threshold,
maxY: maxY,
width:((completeeGraphValues.length <=2)? MediaQuery.sizeOf(context).height : (MediaQuery.sizeOf(context).height* (
completeeGraphValues.length <= 15
? 1
: (completeeGraphValues.length/15))
) )-100,
maxX: completeeGraphValues.length+1,
// width: MediaQuery.sizeOf(context).height - 100,
scrollDirection: Axis.horizontal,
height: MediaQuery.sizeOf(context).width,
showBottomTitleDates: true,
isFullScreeGraph: true,
// isFullScreenGraph: false,
),
),
),
),
),
),
);
}
// double getMax(List<DataPoint> dataPoints) {
// double max = double.negativeInfinity;
// for (var point in dataPoints) {
// if (point.value > max) {
// max = point.y;
// }
// }
// return max;
// }
// double getMax(List<DataPoint> dataPoints) {
// double max = double.negativeInfinity;
// for (var point in dataPoints) {
// if (point.value > max) {
// max = point.y;
// }
// }
// return max;
// }
}

@ -9,12 +9,14 @@ class DynamicResultChart extends StatelessWidget {
final double? width;
final double height;
final double? maxY;
final double? maxX;
final Axis scrollDirection;
final bool isFullScreenGraph;
final bool showBottomTitleDates;
final bool isFullScreeGraph;
DynamicResultChart(
{super.key, required this.dataPoints, required this.thresholds, required this.width, required this.scrollDirection, required this.height, this.maxY, this.isFullScreenGraph = false});
{super.key, required this.dataPoints, required this.thresholds, this.width, required this.scrollDirection, required this.height, this.maxY,this.maxX, this.showBottomTitleDates = true, this.isFullScreeGraph = false});
@override
Widget build(BuildContext context) {
@ -52,7 +54,7 @@ class DynamicResultChart extends StatelessWidget {
minY: 0,
maxY: ((maxY?.ceilToDouble()??0.0)+interval ).floorToDouble(),
// minX: dataPoints.first.labelValue - 1,
// maxX: maxX,
maxX: maxX,
lineTouchData: LineTouchData(touchTooltipData: LineTouchTooltipData(getTooltipItems: (touchedSpots) {
if (touchedSpots.isEmpty) return [];
@ -128,7 +130,7 @@ class DynamicResultChart extends StatelessWidget {
bottomTitles: AxisTitles(
axisNameSize: 60,
sideTitles: SideTitles(
showTitles: !isFullScreenGraph,
showTitles: showBottomTitleDates,
reservedSize: 50,
getTitlesWidget: (value, _) {
if (value.toInt() >= 0 && value.toInt() < dataPoints.length) {
@ -254,7 +256,7 @@ class DynamicResultChart extends StatelessWidget {
isCurved: true,
isStrokeCapRound: true,
isStrokeJoinRound: true,
barWidth: 2, // invisible line
barWidth: 2,
gradient: LinearGradient(
colors: [Color(0xFF5dc36b), Color(0xFF5dc36b)],
begin: Alignment.centerLeft,

@ -40,7 +40,6 @@ class _LaboratoryResultWidgetState extends State<LaboratoryResultWidget> {
super.initState();
this.model = widget.labmodel;
print("the details are ${widget.details}");
labSpecialResult = widget.details;
}
@ -48,13 +47,11 @@ class _LaboratoryResultWidgetState extends State<LaboratoryResultWidget> {
@override
void didChangeDependencies() {
super.didChangeDependencies();
print("did change dependency is called");
var oldStateTablateScreenState = isTabletScreen;
isTabletScreen = isTablet(context);
if(isTabletScreen != oldStateTablateScreenState);
{
print("the screen width is changed");
model?.recalculatePercentage(isTabletScreen);
}

Loading…
Cancel
Save