import 'package:flutter/material.dart'; import 'package:doctor/common/settings.dart'; import 'package:intl/intl.dart'; class PatientRecordsModel { String patient_name=''; String age=''; String gender=''; String patient_type=''; String problem=''; String doctorName=''; String hospitalName=''; String date=''; String recordId=''; String customerId=''; String problem_category=''; String doctorId=''; bool isDoctorVerify=false; bool isDynamicDigitsVisible=false; bool isDoctorPinVerify=false; bool isReportVisible=false; List findingsImages = []; List reportImages = []; List prescriptionImages = []; DateTime dateForFilter=new DateTime.now(); PatientRecordsModel(); factory PatientRecordsModel.fromJson(Map json){ PatientRecordsModel rtvm = new PatientRecordsModel(); 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.doctorId = json['doctorId'] ?? ''; rtvm.customerId = json['customerId'] ?? ''; rtvm.problem_category = json['problemCategory'] ?? ''; rtvm.findingsImages = json['findings'] ?? []; rtvm.reportImages = json['reports'] ?? []; rtvm.prescriptionImages = json['prescription'] ?? []; rtvm.isDoctorVerify = json['isDoctorVerify'] ?? false; rtvm.dateForFilter = DateFormat('dd-MM-yyyy').parse(rtvm.date); if(rtvm.patient_type.toString().toLowerCase()=='self'){ } else{ rtvm.age=json['others']['age'].toString(); rtvm.gender=json['others']['gender']; rtvm.patient_name=json['others']['name']; } if(rtvm.doctorId==AppSettings.doctorId || rtvm.problem_category.toString().toLowerCase()=='general'){ rtvm.isReportVisible=true; rtvm.isDoctorPinVerify=true; } return rtvm; } }