You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
healthcare-frontend/lib/models/reports_model.dart

50 lines
1.4 KiB

import 'package:flutter/material.dart';
import 'package:healthcare_user/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<String, dynamic> 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=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;
}
}