You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
diplomatic-quarter/lib/core/model/labs/lab_result.dart

220 lines
6.4 KiB
Dart

import 'package:diplomaticquarterapp/widgets/data_display/medical/LabResult/newUI/labWidgets.dart';
class LabResultList {
String? filterName = "";
String? description = "";
List<LabResult>? patientLabResultList = [];
LabResultList({this.filterName, this.description, LabResult? lab}) {
patientLabResultList!.add(lab!);
}
}
enum ResultFlag {
N('normal'),
H('high'),
L('low'),
CL('criticalLow'),
CH('criticalHigh'),
HCH('highCriticalHigh'),
LCL('lowCriticalLow'),
IRR('interpretive');
final String value;
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;
switch (key) {
case 'N':
return ResultFlag.N;
case 'H':
return ResultFlag.H;
case 'L':
return ResultFlag.L;
case 'CL':
return ResultFlag.CL;
case 'CH':
return ResultFlag.CH;
case 'HCH':
return ResultFlag.HCH;
case 'LCL':
return ResultFlag.LCL;
case '':
return ResultFlag.IRR;
default:
return null;
}
}
String toJson() {
switch (this) {
case ResultFlag.N:
return 'N';
case ResultFlag.H:
return 'H';
case ResultFlag.L:
return 'L';
case ResultFlag.CL:
return 'CL';
case ResultFlag.CH:
return 'CH';
case ResultFlag.HCH:
return 'HCH';
case ResultFlag.LCL:
return 'LCL';
case ResultFlag.IRR:
return '';
}
}
ResultTypes getType() {
switch (this) {
case ResultFlag.N:
return ResultTypes.normal;
case ResultFlag.H:
return ResultTypes.high;
case ResultFlag.L:
return ResultTypes.low;
case ResultFlag.CL:
return ResultTypes.criticalLow;
case ResultFlag.CH:
return ResultTypes.criticalHigh;
case ResultFlag.HCH:
return ResultTypes.highCriticalHigh;
case ResultFlag.LCL:
return ResultTypes.lowCriticalLow;
case ResultFlag.IRR:
return ResultTypes.IRR;
}
}
}
class LabResult {
String? description;
dynamic femaleInterpretativeData;
int? gender;
bool? isCertificateAllowed;
int? lineItemNo;
dynamic maleInterpretativeData;
dynamic notes;
int? orderLineItemNo;
int? orderNo;
String? packageID;
int? patientID;
String? projectID;
String? referanceRange;
String? resultValue;
int? resultValueBasedLineItemNo;
String? resultValueFlag;
String? sampleCollectedOn;
String? sampleReceivedOn;
String? setupID;
dynamic superVerifiedOn;
String? testCode;
String? uOM;
String? verifiedOn;
String? packageShortDescription;
String? testShortDescription;
ResultFlag? calculatedResultFlag;
dynamic verifiedOnDateTime;
num? percentage;
num? width;
num? resultTypeID;
LabResult(
{this.description,
this.femaleInterpretativeData,
this.gender,
this.isCertificateAllowed,
this.lineItemNo,
this.maleInterpretativeData,
this.notes,
this.orderLineItemNo,
this.orderNo,
this.packageID,
this.patientID,
this.projectID,
this.referanceRange,
this.resultValue,
this.resultValueBasedLineItemNo,
this.resultValueFlag,
this.sampleCollectedOn,
this.sampleReceivedOn,
this.setupID,
this.superVerifiedOn,
this.testCode,
this.uOM,
this.verifiedOn,
this.verifiedOnDateTime});
LabResult.fromJson(Map<String, dynamic> json, {String? flag}) {
description = json['Description'];
femaleInterpretativeData = json['FemaleInterpretativeData'];
gender = json['Gender'];
isCertificateAllowed = json['IsCertificateAllowed'];
lineItemNo = json['LineItemNo'];
maleInterpretativeData = json['MaleInterpretativeData'];
notes = json['Notes'];
orderLineItemNo = json['OrderLineItemNo'];
orderNo = json['OrderNo'];
packageID = json['PackageID'];
patientID = json['PatientID'];
projectID = json['ProjectID'];
referanceRange = json['ReferanceRange'];
resultValue = json['ResultValue'];
resultValueBasedLineItemNo = json['ResultValueBasedLineItemNo'];
resultValueFlag = json['ResultValueFlag'];
sampleCollectedOn = json['SampleCollectedOn'];
sampleReceivedOn = json['SampleReceivedOn'];
setupID = json['SetupID'];
superVerifiedOn = json['SuperVerifiedOn'];
testCode = json['TestCode'];
uOM = json['UOM'];
verifiedOn = json['VerifiedOn'];
verifiedOnDateTime = json['VerifiedOnDateTime'];
packageShortDescription = json['PackageShortDescription'];
testShortDescription = json['TestShortDescription'];
resultTypeID = json['ResultTypeID'];
calculatedResultFlag =
ResultFlag.fromJson(flag ?? json['CalculatedResultFlag'],resultTypeID);
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['Description'] = this.description;
data['FemaleInterpretativeData'] = this.femaleInterpretativeData;
data['Gender'] = this.gender;
data['IsCertificateAllowed'] = this.isCertificateAllowed;
data['LineItemNo'] = this.lineItemNo;
data['MaleInterpretativeData'] = this.maleInterpretativeData;
data['Notes'] = this.notes;
data['OrderLineItemNo'] = this.orderLineItemNo;
data['OrderNo'] = this.orderNo;
data['PackageID'] = this.packageID;
data['PatientID'] = this.patientID;
data['ProjectID'] = this.projectID;
data['ReferanceRange'] = this.referanceRange;
data['ResultValue'] = this.resultValue;
data['ResultValueBasedLineItemNo'] = this.resultValueBasedLineItemNo;
data['ResultValueFlag'] = this.resultValueFlag;
data['SampleCollectedOn'] = this.sampleCollectedOn;
data['SampleReceivedOn'] = this.sampleReceivedOn;
data['SetupID'] = this.setupID;
data['SuperVerifiedOn'] = this.superVerifiedOn;
data['TestCode'] = this.testCode;
data['UOM'] = this.uOM;
data['VerifiedOn'] = this.verifiedOn;
data['VerifiedOnDateTime'] = this.verifiedOnDateTime;
data['PackageShortDescription'] = this.packageShortDescription;
data['TestShortDescription'] = this.testShortDescription;
data['CalculatedResultFlag'] = this.calculatedResultFlag?.toJson() ?? '';
return data;
}
}