update-to-3.32-sdk
haroon amjad 5 months ago
parent 880db9315e
commit afd7c5db81

@ -2147,8 +2147,8 @@ const Map localizedValues = {
"readMore": {"en": "Read More", "ar": "اقرأ أكثر"},
"showLess": {"en": "Show Less", "ar": "عرض أقل"},
"change": {"en": "Change", "ar": "فرق"},
"referenceRange": {"en": "Reference Range", "ar": "النطاق المرجعي"},
"criticalLow": {"en": "Critical Low", "ar": "النطاق المرجعي"},
"referenceRange": {"en": "Reference Range", "ar": "نطاق مرجعي"},
"criticalLow": {"en": "Critical Low", "ar": "انخفاض حرج"},
"criticalHigh": {"en": "Critical High", "ar": "حرج مرتفع"},
"high": {"en": "High", "ar": "مرتفع"},
"normal": {"en": "Normal", "ar": "عادي"},

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

@ -32,8 +32,7 @@ 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'];
List months = ['Jan', 'Feb', 'Mar', 'April', 'May', 'Jun', 'July', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
String get labReportPDF => _labsService.labReportPDF;
@ -94,13 +93,13 @@ class LabsViewModel extends BaseViewModel {
await _labsService.getLaboratoryResult(invoiceNo: invoiceNo, invoiceType: invoiceType, orderNo: orderNo, projectID: projectID, clinicID: clinicID, setupID: setupID, isVidaPlus: isVidaPlus);
if (_labsService.hasError) {
error = _labsService.error!;
setState(ViewState.Error);
// setState(ViewState.Error);
} else {
setState(ViewState.Idle);
// setState(ViewState.Idle);
}
}
getPatientLabResult({required PatientLabOrders patientLabOrder, required bool isVidaPlus, bool isTablet = false}) async {
getPatientLabResult({required PatientLabOrders patientLabOrder, required bool isVidaPlus, bool isTablet = false}) async {
setState(ViewState.Busy);
await _labsService.getPatientLabResult(patientLabOrder: patientLabOrder, isVidaPlus: isVidaPlus);
if (_labsService.hasError) {
@ -109,54 +108,48 @@ class LabsViewModel extends BaseViewModel {
} else {
_labsService.labResultList.forEach((element) {
List<LabResultList> patientLabOrdersClinic = labResultLists.where((elementClinic) => elementClinic.filterName == element.testCode).toList();
element.percentage =
getPercentage(element.calculatedResultFlag?? ResultFlag.N, isTablet);
element.percentage = getPercentage(element.calculatedResultFlag ?? ResultFlag.N, isTablet);
if (patientLabOrdersClinic.length != 0) {
labResultLists[labResultLists.indexOf(patientLabOrdersClinic[0])].patientLabResultList!.add(element);
labResultLists[labResultLists.indexOf(patientLabOrdersClinic[0])].patientLabResultList!.add(element);
} else {
labResultLists.add(LabResultList(
filterName: element.testCode,
description: element.packageShortDescription,
lab: element));
labResultLists.add(LabResultList(filterName: element.testCode, description: element.packageShortDescription, lab: element));
}
});
setState(ViewState.Idle);
}
}
recalculatePercentage(isTablet){
for(int i = 0;i<labResultLists.length;i++){
for (int j = 0; j<(labResultLists[i].patientLabResultList?.length??0 );j++){
labResultLists[i].patientLabResultList![j].percentage = getPercentage(labResultLists[i].patientLabResultList![j].calculatedResultFlag?? ResultFlag.N, isTablet);
}
recalculatePercentage(isTablet) {
for (int i = 0; i < labResultLists.length; i++) {
for (int j = 0; j < (labResultLists[i].patientLabResultList?.length ?? 0); j++) {
labResultLists[i].patientLabResultList![j].percentage = getPercentage(labResultLists[i].patientLabResultList![j].calculatedResultFlag ?? ResultFlag.N, isTablet);
}
}
}
double getPercentage(ResultFlag flag, bool isTablet) {
double percentage = 0.0;
var division = (1/15);
print("its a tablet $isTablet");
var division = (1 / 15);
switch (flag) {
case ResultFlag.N:
percentage = division * (isTablet?7.25:6.85);
percentage = division * (isTablet ? 7.25 : 6.85);
break;
case ResultFlag.H:
percentage = division * (isTablet?11:10.9);
percentage = division * (isTablet ? 11 : 10.9);
break;
case ResultFlag.L:
percentage = division * (isTablet?3.5:2.95);
percentage = division * (isTablet ? 3.5 : 2.95);
break;
case ResultFlag.CL:
case ResultFlag.LCL:
percentage = division * (isTablet?0.7:.04);
percentage = division * (isTablet ? 0.7 : .04);
break;
case ResultFlag.HCH:
case ResultFlag.CH:
percentage = division * (isTablet?13.5:13.3);
percentage = division * (isTablet ? 13.5 : 13.3);
break;
case ResultFlag.IRR:
percentage = 0;
@ -178,7 +171,6 @@ class LabsViewModel extends BaseViewModel {
error = _labsService.error!;
setState(ViewState.Error);
} else {
/// commented out based on PAP-304
// bool isShouldClear = false;
// if (_labsService.labOrdersResultsList.length == 1) {
@ -192,32 +184,32 @@ class LabsViewModel extends BaseViewModel {
// _labsService.labOrdersResultsList.clear();
var sortedResponse = _labsService.sortByFlagAndValue(_labsService.labOrdersResultsList);
print("the sorted list is ${sortedResponse}");
var recentThree = _labsService.getMostRecentThree(sortedResponse);
print("the recentThree list is ${recentThree}");
var mappedToThresholdValue = _labsService.getThresholdValue();
// var mappedToThresholdValue = _labsService.buildThresholdList(recentThree);
// _labsService.adjustLabOrderResults(sortedResponse);
print("the recentThree list is ${mappedToThresholdValue}");
threshold = mappedToThresholdValue;
List months = ['Jan','Feb','Mar','April','May','Jun','July','Aug','Sep','Oct','Nov','Dec'];
threshold = mappedToThresholdValue;
List months = ['Jan', 'Feb', 'Mar', 'April', 'May', 'Jun', 'July', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
double counter = 1;
recentThree.reversed.forEach((element) {
try {
var dateTime = DateUtil.convertStringToDate(element.verifiedOnDateTime!);
// debugPrint("the double.parse(element.resultValue!) is ${double.parse(element.resultValue!)}");
if(double.parse(element.resultValue!)> maxYForThreeDots){
debugPrint("the double.parse(element.resultValue!) is ${double.parse(element.resultValue!)}");
if (double.parse(element.resultValue!) > maxYForThreeDots) {
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: "${months[dateTime.month - 1]} ${dateTime.year}",
date: dateTime,
referenceRangeValue: element.calculatedResultFlag ?? "IRR"));
counter++;
} catch (e) {}
});
debugPrint("the maxY is ${maxYForThreeDots}");
threePointGraphValue.last.label = "thisResult";
threePointGraphValue.last.isStringResource = true;
@ -227,33 +219,31 @@ class LabsViewModel extends BaseViewModel {
/// This function is used to create a full graph data points for the lab results.
/// @param onComplete: A callback function that is called when the data points are created.
createFullGraphDatPoints(
VoidCallback onComplete
){
createFullGraphDatPoints(VoidCallback onComplete) {
maxYForCompleteGraph = 0.0;
completeeGraphValues.clear();
setState(ViewState.Busy);
double counter = 1;
threshold = _labsService.getThresholdValue();
threshold = _labsService.getThresholdValue();
_labsService.labOrdersResultsList.reversed.forEach((element) {
try {
print("the mapping is being done");
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: "${months[dateTime.month - 1]} ${dateTime.year}",
date: dateTime,
actualValue: element.resultValue!,
referenceRangeValue: element.calculatedResultFlag ?? "IRR"));
} catch (e) {
print("the mapping is having exception $e");
}
++counter;
});
print("the label values are $counter");
print("the completeeGraphValues length are ${completeeGraphValues.length}");
print("the completeeGraphValues last value of label ias ${completeeGraphValues.last.labelValue}");
completeeGraphValues.last.label = "thisResult";
completeeGraphValues.last.isStringResource = true;
setState(ViewState.Idle);
@ -287,8 +277,7 @@ class LabsViewModel extends BaseViewModel {
Future<String> _createFileFromString(String encodedStr, String ext) async {
Uint8List bytes = base64.decode(encodedStr);
String dir = (await getApplicationDocumentsDirectory()).path;
File file = File(
"$dir/" + DateTime.now().millisecondsSinceEpoch.toString() + "." + ext);
File file = File("$dir/" + DateTime.now().millisecondsSinceEpoch.toString() + "." + ext);
await file.writeAsBytes(bytes);
return file.path;
}

@ -34,7 +34,6 @@ void main() async {
await Firebase.initializeApp();
await initLocalStorage();
// Pass all uncaught "fatal" errors from the framework to Crashlytics
// FlutterError.onError = FirebaseCrashlytics.instance.recordFlutterFatalError;
@ -117,8 +116,7 @@ class _MyApp extends State<MyApp> {
void openAppLink(Uri uri) {
print("the uri is $uri");
DeepLinkHandler.instance.handleDeepLinkAndNavigation(
locator<NavigationService>().navigatorKey.currentState, uri, context);
DeepLinkHandler.instance.handleDeepLinkAndNavigation(locator<NavigationService>().navigatorKey.currentState, uri, context);
}
@override
@ -142,7 +140,8 @@ class _MyApp extends State<MyApp> {
providers: [
ChangeNotifierProvider<PharmacyPagesViewModel>(
create: (context) => PharmacyPagesViewModel(),
), ChangeNotifierProvider<AuthProviderViewModel>(
),
ChangeNotifierProvider<AuthProviderViewModel>(
create: (context) => AuthProviderViewModel(),
),
ChangeNotifierProvider<ProjectViewModel>(

@ -31,144 +31,126 @@ class FlowChartPage extends StatelessWidget {
Widget build(BuildContext context) {
projectViewModel = Provider.of(context);
return BaseView<LabsViewModel>(
onModelReady: (model) => model.getPatientLabOrdersResults(
patientLabOrder: patientLabOrder,
procedure: filterName,
isVidaPlus: Utils.isVidaPlusProject(
projectViewModel!, int.parse(patientLabOrder!.projectID!))),
builder: (context, model, w) {
print("the maxY in builder is ${model.maxYForCompleteGraph}");
return SizedBox(
height: MediaQuery.sizeOf(context).height * .75,
child: (model.state == ViewState.Busy)
? Material(
color: Colors.grey.withOpacity(0.6),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(20),
topRight: Radius.circular(20))),
child: Center(
child: Container(
child: GifLoaderContainer(),
margin: EdgeInsets.only(
bottom: MediaQuery.of(context).size.height * 0.09)),
),
)
: SingleChildScrollView(
child: model.labOrdersResultsList.isNotEmpty
? Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Padding(
padding: const EdgeInsets.only(
top: 16.0, right: 16.0, bottom: 10, left: 16.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(filterName??"", style: TextStyle(
fontSize: 21,
fontWeight: FontWeight.w700,
color: Colors.black,
letterSpacing: -0.64,
),),
GestureDetector(
onTap: () => Navigator.pop(context),
child: Align(
alignment: Alignment.centerRight,
child: Icon(
Icons.close,
color: Colors.black,
size: 28,
onModelReady: (model) =>
model.getPatientLabOrdersResults(patientLabOrder: patientLabOrder, procedure: filterName, isVidaPlus: Utils.isVidaPlusProject(projectViewModel!, int.parse(patientLabOrder!.projectID!))),
builder: (context, model, w) {
return SizedBox(
height: MediaQuery.sizeOf(context).height * .75,
child: (model.state == ViewState.Busy)
? Material(
color: Colors.grey.withOpacity(0.6),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.only(topLeft: Radius.circular(20), topRight: Radius.circular(20))),
child: Center(
child: Container(child: GifLoaderContainer(), margin: EdgeInsets.only(bottom: MediaQuery.of(context).size.height * 0.09)),
),
)
: SingleChildScrollView(
child: model.labOrdersResultsList.isNotEmpty
? Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Padding(
padding: const EdgeInsets.only(top: 16.0, right: 16.0, bottom: 10, left: 16.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
filterName ?? "",
style: TextStyle(
fontSize: 21,
fontWeight: FontWeight.w700,
color: Colors.black,
letterSpacing: -0.64,
),
),
),
GestureDetector(
onTap: () => Navigator.pop(context),
child: Align(
alignment: Alignment.centerRight,
child: Icon(
Icons.close,
color: Colors.black,
size: 28,
),
),
),
],
),
],
),
),
Container(
width: double.infinity,
padding: EdgeInsets.only(
left: 17, top: 12, right: 13, bottom: 12),
margin:
EdgeInsets.only(left: 21, right: 21, top: 21),
decoration: BoxDecoration(
shape: BoxShape.rectangle,
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(10.0),
),
boxShadow: [
BoxShadow(
color: Color(0xff000000).withOpacity(.05),
//spreadRadius: 5,
blurRadius: 27,
offset: Offset(0, -3),
),
],
),
// child: LineChartCurved(
// title: filterName,
// labResult: model.labOrdersResultsList,
// ),
// child: ShowChart(
// title: filterName!,
// timeSeries: model.timeSeries,
// indexes: model.timeSeries.length ~/ 5.5 ?? 0,
// ),
child: Column(
children: [
SizedBox(
height: MediaQuery.sizeOf(context).height / 4,
child: DynamicResultChart(
dataPoints: model.threePointGraphValue,
thresholds: model.threshold,
maxY: model.maxYForThreeDots,
width: MediaQuery.sizeOf(context).width - 77,
scrollDirection: Axis.horizontal,
height: MediaQuery.sizeOf(context).height / 4,
Container(
width: double.infinity,
padding: EdgeInsets.only(left: 17, top: 12, right: 13, bottom: 12),
margin: EdgeInsets.only(left: 21, right: 21, top: 21),
decoration: BoxDecoration(
shape: BoxShape.rectangle,
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(10.0),
),
boxShadow: [
BoxShadow(
color: Color(0xff000000).withOpacity(.05),
//spreadRadius: 5,
blurRadius: 27,
offset: Offset(0, -3),
),
],
),
InkWell(
onTap: () {
model.createFullGraphDatPoints(() {
Navigator.push(context,
MaterialPageRoute(builder: (_) {
return FullScreenGraph(
completeeGraphValues: model.completeeGraphValues,
threshold: model.threshold,
maxY : model.maxYForCompleteGraph
);
}));
});
},
// child: Text(TranslationBase.of(context)
// .seeAllGraphValues),
child: Utils.tableColumnValueWithUnderLine(TranslationBase.of(context).seeAllGraphValues, isLast: true, isCapitable: false),
)
],
// child: LineChartCurved(
// title: filterName,
// labResult: model.labOrdersResultsList,
// ),
// child: ShowChart(
// title: filterName!,
// timeSeries: model.timeSeries,
// indexes: model.timeSeries.length ~/ 5.5 ?? 0,
// ),
child: Column(
children: [
SizedBox(
height: MediaQuery.sizeOf(context).height / 4,
child: DynamicResultChart(
dataPoints: model.threePointGraphValue,
thresholds: model.threshold,
maxY: model.maxYForThreeDots,
width: MediaQuery.sizeOf(context).width - 77,
scrollDirection: Axis.horizontal,
height: MediaQuery.sizeOf(context).height / 4,
),
),
InkWell(
onTap: () {
model.createFullGraphDatPoints(() {
Navigator.push(context, MaterialPageRoute(builder: (_) {
return FullScreenGraph(completeeGraphValues: model.completeeGraphValues, threshold: model.threshold, maxY: model.maxYForCompleteGraph);
}));
});
},
// child: Text(TranslationBase.of(context)
// .seeAllGraphValues),
child: Utils.tableColumnValueWithUnderLine(TranslationBase.of(context).seeAllGraphValues, isLast: true, isCapitable: false),
)
],
),
),
LabResultChartAndDetails(
name: filterName!,
// labResult: model.labOrdersResultsList,
labResult: model.labOrdersResultsList.reversed.toList(),
),
],
)
: Center(
child: Container(
padding: EdgeInsets.only(top: MediaQuery.of(context).size.height * 0.32),
child: Center(
child: getNoDataWidget(context),
),
),
),
LabResultChartAndDetails(
name: filterName!,
// labResult: model.labOrdersResultsList,
labResult: model.labOrdersResultsList.reversed.toList(),
),
],
)
: Center(
child: Container(
padding: EdgeInsets.only(
top: MediaQuery.of(context).size.height * 0.32),
child: Center(
child: getNoDataWidget(context),
),
),
),
),
);}
);
),
);
});
}
}

@ -20,13 +20,11 @@ class DynamicResultChart extends StatelessWidget {
Widget build(BuildContext context) {
var minY = 0.0;
// var maxY = 0.0;
print("the maxY from parameter is $maxY");
double interval = 20;
if((maxY??0)>10 &&(maxY??0)<=20) interval = 2;
else if((maxY??0)>5 &&(maxY??0)<=10) interval = 1;
else if((maxY??0)>=0 &&(maxY??0)<=5) interval = .4;
// else if((maxY??0)>=100) interval = 20;
print("the interval parameter is $interval");
// if (thresholds.isNotEmpty) {
// print("the thresholds are $thresholds");
@ -198,7 +196,6 @@ class DynamicResultChart extends StatelessWidget {
List<LineChartBarData> _buildColoredLineSegments(List<DataPoint> dataPoints, List<ThresholdRange> thresholds) {
List<LineChartBarData> segments = [];
Color getColor(String value) {
print("the value to compare is $value");
for (int i = thresholds.length - 1; i >= 0; i--) {
if (value == thresholds[i].label) {
return thresholds[i].lineColor;
@ -249,7 +246,6 @@ class DynamicResultChart extends StatelessWidget {
final List<FlSpot> allSpots = dataPoints.asMap().entries.map((entry) {
return FlSpot(entry.key.toDouble(), entry.value.value);
}).toList();
print("the spots are $allSpots");
var data = [
// ...segments

@ -141,8 +141,6 @@ class _LabItemState extends State<LabItem> {
scrollControlDisabledMaxHeightRatio: .75,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.only(topLeft: Radius.circular(20), topRight: Radius.circular(20))),
builder: (context) {
print('builder: the bottom sheet is showing');
return FlowChartPage(
filterName: procedure,
patientLabOrder: widget.patientLabOrders,

@ -393,6 +393,7 @@ class ItemResultCardWidgetWithParams extends StatelessWidget {
Text(
"${TranslationBase.of(context).referenceRange} \n $referenceRange",
style: TextStyle(
overflow: TextOverflow.clip,
fontSize: 10,
fontFamily: fontFamily,
fontWeight: FontWeight.w600,

Loading…
Cancel
Save