|
|
|
|
@ -97,7 +97,7 @@ class LabsViewModel extends BaseViewModel {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getPatientLabResult({required PatientLabOrders patientLabOrder, required bool isVidaPlus}) 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) {
|
|
|
|
|
@ -107,7 +107,7 @@ class LabsViewModel extends BaseViewModel {
|
|
|
|
|
_labsService.labResultList.forEach((element) {
|
|
|
|
|
List<LabResultList> patientLabOrdersClinic = labResultLists.where((elementClinic) => elementClinic.filterName == element.testCode).toList();
|
|
|
|
|
element.percentage =
|
|
|
|
|
getPercentage(element.calculatedResultFlag ?? ResultFlag.N);
|
|
|
|
|
getPercentage(element.calculatedResultFlag?? ResultFlag.N, isTablet);
|
|
|
|
|
if (patientLabOrdersClinic.length != 0) {
|
|
|
|
|
labResultLists[labResultLists.indexOf(patientLabOrdersClinic[0])].patientLabResultList!.add(element);
|
|
|
|
|
} else {
|
|
|
|
|
@ -121,29 +121,39 @@ class LabsViewModel extends BaseViewModel {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
double getPercentage(ResultFlag flag) {
|
|
|
|
|
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;
|
|
|
|
|
final division = 0.2;
|
|
|
|
|
var division = (1/15);
|
|
|
|
|
print("its a tablet $isTablet");
|
|
|
|
|
switch (flag) {
|
|
|
|
|
case ResultFlag.N: //4
|
|
|
|
|
percentage = division * 1.75;
|
|
|
|
|
case ResultFlag.N:
|
|
|
|
|
percentage = division * (isTablet?7.25:6.85);
|
|
|
|
|
break;
|
|
|
|
|
case ResultFlag.H: //5
|
|
|
|
|
percentage = division * 2.8;
|
|
|
|
|
case ResultFlag.H:
|
|
|
|
|
percentage = division * (isTablet?11:10.9);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ResultFlag.L: //3
|
|
|
|
|
percentage = division * .7;
|
|
|
|
|
case ResultFlag.L:
|
|
|
|
|
percentage = division * (isTablet?3.5:2.95);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ResultFlag.CL: //2
|
|
|
|
|
case ResultFlag.LCL: //
|
|
|
|
|
percentage = division * .07;
|
|
|
|
|
case ResultFlag.CL:
|
|
|
|
|
case ResultFlag.LCL:
|
|
|
|
|
percentage = division * (isTablet?0.7:.04);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ResultFlag.HCH: //7
|
|
|
|
|
case ResultFlag.CH: //6
|
|
|
|
|
percentage = division * 3.4;
|
|
|
|
|
case ResultFlag.HCH:
|
|
|
|
|
case ResultFlag.CH:
|
|
|
|
|
percentage = division * (isTablet?13.5:13.3);
|
|
|
|
|
break;
|
|
|
|
|
case ResultFlag.IRR:
|
|
|
|
|
percentage = 0;
|
|
|
|
|
|