|
|
|
@ -3,7 +3,7 @@ import 'package:test_sa/models/lookup.dart';
|
|
|
|
|
|
|
|
|
|
import 'model.dart';
|
|
|
|
|
|
|
|
|
|
class Device{
|
|
|
|
|
class Device {
|
|
|
|
|
int id;
|
|
|
|
|
String serialNumber;
|
|
|
|
|
String number;
|
|
|
|
@ -12,7 +12,6 @@ class Device{
|
|
|
|
|
ModelDefinition modelDefinition;
|
|
|
|
|
Hospital hospital;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Device({
|
|
|
|
|
this.id,
|
|
|
|
|
this.serialNumber,
|
|
|
|
@ -21,20 +20,15 @@ class Device{
|
|
|
|
|
// this.brand,
|
|
|
|
|
// this.model,
|
|
|
|
|
this.modelDefinition,
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
factory Device.fromJson(Map<String,dynamic> parsedJson){
|
|
|
|
|
|
|
|
|
|
factory Device.fromJson(Map<String, dynamic> parsedJson) {
|
|
|
|
|
return Device(
|
|
|
|
|
id: parsedJson["id"],
|
|
|
|
|
serialNumber: parsedJson["assetSerialNo"],
|
|
|
|
|
number: parsedJson["assetNumber"],
|
|
|
|
|
modelDefinition:ModelDefinition.fromJson(parsedJson["modelDefinition"]),
|
|
|
|
|
hospital:Hospital.fromJson(parsedJson["site"]),
|
|
|
|
|
modelDefinition: ModelDefinition.fromJson(parsedJson["modelDefinition"]),
|
|
|
|
|
hospital: Hospital.fromJson(parsedJson["site"]),
|
|
|
|
|
// parsedJson["modelDefinition"] == null ? "" :
|
|
|
|
|
// parsedJson["modelDefinition"]["manufacturerName"],
|
|
|
|
|
// model: parsedJson["modelDefinition"] == null ? "" :
|
|
|
|
@ -42,7 +36,7 @@ class Device{
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
factory Device.fromDevice(Device device){
|
|
|
|
|
factory Device.fromDevice(Device device) {
|
|
|
|
|
return Device(
|
|
|
|
|
id: device.id,
|
|
|
|
|
serialNumber: device.serialNumber,
|
|
|
|
@ -59,7 +53,8 @@ class Device{
|
|
|
|
|
'assetNumber': number,
|
|
|
|
|
'modelDefinition': modelDefinition.toJson(),
|
|
|
|
|
'site': hospital.toMap(),
|
|
|
|
|
'AssetType':assetType.toMap(),
|
|
|
|
|
'AssetType': assetType.toMap(),
|
|
|
|
|
"supplier": {"id": 0, "suppliername": "string"},
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|