import 'package:flutter/material.dart'; import 'package:healthcare_user/common/settings.dart'; class ReportsModel { String patient_name=''; String age=''; String gender=''; String patient_type=''; String problem=''; String doctorName=''; String hospitalName=''; String date=''; String recordId=''; List findingsImages = []; List reportImages = []; List prescriptionImages = []; ReportsModel(); factory ReportsModel.fromJson(Map json){ ReportsModel rtvm = new ReportsModel(); rtvm.patient_type = json['patientType'] ?? ''; rtvm.doctorName = json['doctorName'] ?? ''; rtvm.hospitalName = json['hospitalName'] ?? ''; rtvm.problem = json['problem'] ?? ''; rtvm.date = json['date'] ?? ''; rtvm.recordId = json['recordId'] ?? ''; rtvm.findingsImages = json['findings'] ?? []; rtvm.reportImages = json['reports'] ?? []; rtvm.prescriptionImages = json['prescription'] ?? []; if(rtvm.patient_type.toString().toLowerCase()=='self'){ rtvm.age=AppSettings.age; rtvm.gender=AppSettings.gender; rtvm.patient_name=AppSettings.userName; } else{ rtvm.age=json['others']['age'].toString(); rtvm.gender=json['others']['gender']; rtvm.patient_name=json['others']['name']; } return rtvm; } }