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/prescriptions_model.dart

40 lines
1.0 KiB

import 'package:flutter/material.dart';
import 'package:healthcare_user/common/settings.dart';
class PrescriptionsModel {
String prescription_name = '';
String patient_name='';
String prescription_url='';
String age='';
String gender='';
String patient_type='';
PrescriptionsModel();
factory PrescriptionsModel.fromJson(Map<String, dynamic> json){
PrescriptionsModel rtvm = new PrescriptionsModel();
rtvm.prescription_name = json['name'] ?? '';
rtvm.patient_type = json['patientType'] ?? '';
rtvm.prescription_url = json['pictureUrl'][0] ?? '';
if(rtvm.patient_type.toString().toLowerCase()=='self'){
rtvm.age=AppSettings.age;
rtvm.gender=AppSettings.gender;
rtvm.patient_name=AppSettings.userName;
}
/* "others": {
"name": "jhanu",
"age": 23,
"gender": "female"
},*/
else{
rtvm.age=json['others']['age'].toString();
rtvm.gender=json['others']['gender'];
rtvm.patient_name=json['others']['name'];
}
return rtvm;
}
}