You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
123 lines
3.6 KiB
Dart
123 lines
3.6 KiB
Dart
import 'dart:developer';
|
|
|
|
import 'package:hmg_qline/utilities/date_utils.dart';
|
|
import 'package:hmg_qline/utilities/enums.dart';
|
|
import 'package:hmg_qline/utilities/extensions.dart';
|
|
|
|
class TicketDetailsModel {
|
|
QTypeEnum? qTypeEnum;
|
|
ScreenTypeEnum? screenTypeEnum;
|
|
String? connectionID;
|
|
TicketData? ticketModel;
|
|
|
|
TicketDetailsModel({this.qTypeEnum, this.screenTypeEnum, this.connectionID, this.ticketModel});
|
|
|
|
TicketDetailsModel.fromJson(Map<String, dynamic> json) {
|
|
qTypeEnum = json['qType'] != null ? (json['qType'] as int).toQTypeEnum() : null;
|
|
screenTypeEnum = json['screenType'] != null ? (json['screenType'] as int).toScreenTypeEnum() : null;
|
|
connectionID = json['connectionID'];
|
|
ticketModel = json['data'] != null ? TicketData.fromJson(json['data']) : null;
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
final Map<String, dynamic> data = <String, dynamic>{};
|
|
data['qType'] = qTypeEnum;
|
|
data['screenType'] = screenTypeEnum;
|
|
data['connectionID'] = connectionID;
|
|
if (ticketModel != null) {
|
|
data['data'] = ticketModel!.toJson();
|
|
}
|
|
return data;
|
|
}
|
|
}
|
|
|
|
class TicketData {
|
|
int? id;
|
|
int? patientID;
|
|
int? laBQGroupID;
|
|
String? queueNo;
|
|
int? counterBatchNo;
|
|
int? calledBy;
|
|
String? calledOn;
|
|
String? servedOn;
|
|
String? patientName;
|
|
String? mobileNo;
|
|
String? patientEmail;
|
|
int? preferredLang;
|
|
int? patientGender;
|
|
String? roomNo;
|
|
bool? isActive;
|
|
int? createdBy;
|
|
int? editedBy;
|
|
DateTime? editedOn;
|
|
DateTime? createdOn;
|
|
|
|
TicketData(
|
|
{this.id,
|
|
this.patientID,
|
|
this.laBQGroupID,
|
|
this.queueNo,
|
|
this.counterBatchNo,
|
|
this.calledBy,
|
|
this.calledOn,
|
|
this.servedOn,
|
|
this.patientName,
|
|
this.mobileNo,
|
|
this.patientEmail,
|
|
this.preferredLang,
|
|
this.patientGender,
|
|
this.roomNo,
|
|
this.isActive,
|
|
this.createdBy,
|
|
this.createdOn,
|
|
this.editedBy,
|
|
this.editedOn});
|
|
|
|
TicketData.fromJson(Map<String, dynamic> json) {
|
|
log("typoe: ${json['preferredLang'].runtimeType}");
|
|
id = json['id'];
|
|
patientID = json['patientID'];
|
|
laBQGroupID = json['laB_QGroupID'];
|
|
queueNo = json['queueNo'];
|
|
counterBatchNo = json['counterBatchNo'];
|
|
calledBy = json['calledBy'];
|
|
calledOn = json['calledOn'];
|
|
servedOn = json['servedOn'];
|
|
patientName = json['patientName'];
|
|
mobileNo = json['mobileNo'];
|
|
patientEmail = json['patientEmail'];
|
|
preferredLang = (json['preferredLang'] != null && json['preferredLang'].trim() != "" )? int.parse(json['preferredLang']) : 1;
|
|
patientGender = json['patientGender'] ?? 1;
|
|
roomNo = json['roomNo'];
|
|
isActive = json['isActive'];
|
|
createdBy = json['createdBy'];
|
|
editedBy = json['editedBy'];
|
|
editedOn = json['editedOn'] != null ? (json['editedOn'] as String).toDateTime() : DateTime.now();
|
|
createdOn = json['createdOn'] != null ? (json['createdOn'] as String).toDateTime() : DateTime.now();
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
final Map<String, dynamic> data = <String, dynamic>{};
|
|
data['id'] = id;
|
|
data['patientID'] = patientID;
|
|
data['laB_QGroupID'] = laBQGroupID;
|
|
data['queueNo'] = queueNo;
|
|
data['counterBatchNo'] = counterBatchNo;
|
|
data['calledBy'] = calledBy;
|
|
data['calledOn'] = calledOn;
|
|
data['servedOn'] = servedOn;
|
|
data['patientName'] = patientName;
|
|
data['mobileNo'] = mobileNo;
|
|
data['patientEmail'] = patientEmail;
|
|
data['preferredLang'] = preferredLang;
|
|
data['patientGender'] = patientGender;
|
|
data['roomNo'] = roomNo;
|
|
data['isActive'] = isActive;
|
|
data['createdBy'] = createdBy;
|
|
data['createdOn'] = createdOn;
|
|
data['editedBy'] = editedBy;
|
|
data['editedOn'] = editedOn;
|
|
return data;
|
|
}
|
|
}
|