import 'package:flutter/material.dart'; import 'package:doctor/common/settings.dart'; import 'package:intl/intl.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 = []; DateTime dateForFilter=new DateTime.now(); 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'] ?? []; rtvm.dateForFilter = DateFormat('dd-MM-yyyy').parse(rtvm.date); if(rtvm.patient_type.toString().toLowerCase()!='self'){ rtvm.age=json['others']['age'].toString(); rtvm.gender=json['others']['gender']; rtvm.patient_name=json['others']['name']; } return rtvm; } }