import 'package:flutter/material.dart'; class RegistrationModel { String? patientId; String? orderID; List? paket; PatientData? patientData; List? tests; List? specimens; List? bahan; String? userMouID; String? total; String? token; RegistrationModel( {this.patientData, this.tests, this.specimens, this.total, this.bahan, this.userMouID, this.patientId, this.paket, this.orderID, this.token}); RegistrationModel.fromJson(Map json) { patientData = json['patient_data'] != null ? PatientData.fromJson(json['patient_data']) : null; if (json['tests'] != null) { tests = []; json['tests'].forEach((v) { tests!.add(Tests.fromJson(v)); }); } if (json['specimens'] != null) { specimens = []; json['specimens'].forEach((v) { specimens!.add(Specimens.fromJson(v)); }); } if (json['bahan'] != null) { bahan = []; json['bahan'].forEach((v) { bahan!.add(Bahan.fromJson(v)); }); } if (json['paket'] != null) { paket = []; json['paket'].forEach((v) { paket!.add(Paket.fromJson(v)); }); } total = json['total']; patientId = json['patient_id']; token = json['token']; userMouID = json['userMouID']; orderID = json['orderID']; } Map toJson() { final Map data = {}; if (patientData != null) { data['patient_data'] = patientData!.toJson(); } if (tests != null) { data['tests'] = tests!.map((v) => v.toJson()).toList(); } if (specimens != null) { data['specimens'] = specimens!.map((v) => v.toJson()).toList(); } if (bahan != null) { data['bahan'] = bahan!.map((v) => v.toJson()).toList(); } if (paket != null) { data['paket'] = paket!.map((v) => v.toJson()).toList(); } data['total'] = total; data['patient_id'] = patientId; data['token'] = token; data['userMouID'] = userMouID; data['orderID'] = orderID; return data; } } class PatientData { String? saluation; String? prefix; String? name; String? suffix; String? dob; String? nik; String? nip; String? withoutNIK; String? gender; String? hp; String? address; String? diagnosis; String? note; String? noRM; String? jabatan; String? kedudukan; String? lokasi; String? pekerjaan; PatientData( {this.saluation, this.prefix, this.name, this.suffix, this.dob, this.nik, this.nip, this.withoutNIK, this.gender, this.hp, this.address, this.diagnosis, this.noRM, this.jabatan, this.kedudukan, this.lokasi, this.pekerjaan, this.note}); PatientData.fromJson(Map json) { saluation = json['saluation']; prefix = json['prefix']; name = json['name']; suffix = json['suffix']; dob = json['dob']; nik = json['nik']; nip = json['nip']; withoutNIK = json['without_nik']; gender = json['gender']; hp = json['hp']; address = json['address']; diagnosis = json['diagnosis']; note = json['note']; noRM = json['noRM']; jabatan = json['jabatan']; kedudukan = json['kedudukan']; lokasi = json['lokasi']; pekerjaan = json['pekerjaan']; } Map toJson() { final Map data = {}; data['saluation'] = saluation; data['prefix'] = prefix; data['name'] = name; data['suffix'] = suffix; data['dob'] = dob; data['nik'] = nik; data['nip'] = nip; data['without_nik'] = withoutNIK; data['gender'] = gender; data['hp'] = hp; data['address'] = address; data['diagnosis'] = diagnosis; data['note'] = note; data['noRM'] = noRM; data['kedudukan'] = kedudukan; data['jabatan'] = jabatan; data['lokasi'] = lokasi; data['pekerjaan'] = pekerjaan; return data; } } class Tests { String? tab; String? id; String? detailID; String? name; String? isPaket; List? specimen; List? bahan; String? price; String? date; String? sasCode; bool? dateVal; Tests( {this.id, this.name, this.specimen, this.price, this.date, this.detailID, this.tab, this.isPaket, this.dateVal, this.sasCode}); Tests.fromJson(Map json) { id = json['id'].toString(); tab = json['tab'].toString(); name = json['name'].toString(); isPaket = json['is_paket'].toString(); if (json['specimen'] != null) { specimen = []; json['specimen'].forEach((v) { specimen!.add(Specimens.fromJson(v)); }); } if (json['bahan'] != null) { bahan = []; json['bahan'].forEach((v) { bahan!.add(Bahan.fromJson(v)); }); } price = json['price'].toString(); detailID = json['detailID'].toString(); date = json['date'].toString(); dateVal = json['dateVal']; sasCode = json['sasCode'].toString(); } Map toJson() { final Map data = {}; data['id'] = id; data['tab'] = tab; data['name'] = name; data['is_paket'] = isPaket; if (specimen != null) { data['specimen'] = specimen!.map((v) => v.toJson()).toList(); } if (bahan != null) { data['bahan'] = bahan!.map((v) => v.toJson()).toList(); } data['price'] = price; data['detailID'] = detailID; data['date'] = date; data['dateVal'] = dateVal; data['sasCode'] = sasCode; return data; } } class Specimens { String? id; String? detailID; String? name; String? amount; TextEditingController ctr = TextEditingController(text: "0"); Specimens( {this.id, this.name, this.amount, this.detailID, required this.ctr}); Specimens.fromJson(Map json) { id = json['id']; detailID = json['detailID']; name = json['name']; amount = json['amount']; ctr = TextEditingController(text: "0"); } Map toJson() { final Map data = {}; data['id'] = id; data['name'] = name; data['detailID'] = detailID; data['amount'] = ctr.text; data["ctr"] = ctr.text; return data; } } class Bahan { String? id; String? detailID; String? name; String? amount; TextEditingController ctr = TextEditingController(text: "0"); Bahan({this.id, this.name, this.amount, this.detailID, required this.ctr}); Bahan.fromJson(Map json) { id = json['id']; name = json['name']; amount = json['amount']; detailID = json['detailID']; ctr = TextEditingController(text: "0"); } Map toJson() { final Map data = {}; data['id'] = id; data['name'] = name; data['detailID'] = detailID; data['amount'] = ctr.text; data["ctr"] = ctr.text; return data; } } class GetSpecimenModel { String? id; String? tab; List? specimen; List? bahan; GetSpecimenModel({this.id, this.tab, this.specimen, this.bahan}); GetSpecimenModel.fromJson(Map json) { id = json['id']; tab = json['tab']; if (json['specimen'] != null) { specimen = []; json['specimen'].forEach((v) { specimen!.add(Specimens.fromJson(v)); }); } if (json['bahan'] != null) { bahan = []; json['bahan'].forEach((v) { bahan!.add(Bahan.fromJson(v)); }); } } Map toJson() { final Map data = {}; data['id'] = id; data['tab'] = tab; if (specimen != null) { data['specimen'] = specimen!.map((v) => v.toJson()).toList(); } if (bahan != null) { data['bahan'] = bahan!.map((v) => v.toJson()).toList(); } return data; } } class Paket { String? id; String? detailID; String? detail; String? name; String? price; String? type; String? arrTest; Paket({ this.id, this.name, this.detailID, this.detail, this.arrTest, this.price, this.type, }); Paket.fromJson(Map json) { id = json['id']; name = json['name']; detailID = json['detail_id']; arrTest = json['arrTest']; detail = json['detail']; arrTest = json['price']; detail = json['type']; } Map toJson() { final Map data = {}; data['id'] = id; data['name'] = name; data['detail'] = detail; data['arrTest'] = arrTest; data['detail_id'] = detailID; data['price'] = price; data['type'] = type; return data; } }