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.
HMG_QLine/lib/models/ticket_model.dart

188 lines
7.7 KiB
Dart

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'],
qTypeEnum: json['qType'] != null ? (json['qType'] as int).toQTypeEnum() : null,
)
: null;
}
}
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;
LanguageEnum voiceLanguageEnum = LanguageEnum.english;
String ticketNoText = "Ticket Number";
String postVoiceText = "Please Visit Counter";
int? patientGender;
String? roomNo;
bool? isActive;
int? createdBy;
int? editedBy;
DateTime? editedOn;
DateTime? createdOn;
// New fields
String? doctorNameN;
CallTypeEnum callTypeEnum = CallTypeEnum.vitalSign;
String? queueNoM;
String? callNoStr;
bool? isQueue;
bool? isToneReq;
bool? isVoiceReq;
int? orientationType;
bool? isTurnOn;
int? concurrentCallDelaySec;
String? crTypeAckIP;
int voiceLanguage = 1;
String voiceLanguageText = "English";
String vitalSignText = "Vital Sign";
String doctorText = "Doctor";
String procedureText = "Procedure";
String vaccinationText = "Vaccination";
String nebulizationText = "Nebulization";
String callForVitalSignText = "Call for Vital Sign";
String callForDoctorText = "Call for Doctor";
String callForProcedureText = "Call for Procedure";
String callForVaccinationText = "Call for Vaccination";
String callForNebulizationText = "Call for Nebulization";
String roomText = "Room";
String queueNoText = "Counter";
String callForText = "Call For";
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.voiceLanguageEnum = LanguageEnum.english,
this.ticketNoText = "Ticket Number",
this.postVoiceText = "Please Visit Counter",
this.patientGender,
this.roomNo,
this.isActive,
this.createdBy,
this.createdOn,
this.editedBy,
this.editedOn,
this.doctorNameN,
this.callTypeEnum = CallTypeEnum.vitalSign,
this.queueNoM,
this.callNoStr,
this.isQueue,
this.isToneReq,
this.isVoiceReq,
this.orientationType,
this.isTurnOn,
this.concurrentCallDelaySec,
this.crTypeAckIP,
this.voiceLanguageText = "English",
this.vitalSignText = "Vital Sign",
this.doctorText = "Doctor",
this.procedureText = "Procedure",
this.vaccinationText = "Vaccination",
this.nebulizationText = "Nebulization",
this.callForVitalSignText = "Call for Vital Sign",
this.callForDoctorText = "Call for Doctor",
this.callForProcedureText = "Call for Procedure",
this.callForVaccinationText = "Call for Vaccination",
this.callForNebulizationText = "Call for Nebulization",
this.roomText = "Room",
this.queueNoText = "Counter",
this.callForText = "Call For",
});
TicketData.fromJson(Map<String, dynamic> json, {QTypeEnum? qTypeEnum}) {
id = json['id'];
patientID = json['patientID'];
laBQGroupID = json['laB_QGroupID'];
queueNo = json['queueNoM'];
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'].toString().trim() != "") ? int.parse(json['preferredLang'].toString()) : 1;
voiceLanguageEnum = (json['preferredLang'] != null && json['preferredLang'].toString().trim() != "") ? (int.parse(json['preferredLang'].toString())).toLanguageEnum() : LanguageEnum.english;
ticketNoText = json['ticketNoText'] ?? "Ticket Number";
postVoiceText = json['pleaseVisitCounterText'] ?? "Please Visit Counter";
patientGender = json['patientGender'] ?? 1;
roomNo = json['roomNo']?.toString();
if (qTypeEnum != null && qTypeEnum == QTypeEnum.general) {
roomNo = json['counterNo']?.toString();
}
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();
doctorNameN = json['doctorNameN'];
callTypeEnum = ((json['callType'] ?? 1) as int).toCallTypeEnum();
queueNoM = json['queueNoM'];
callNoStr = json['callNoStr'];
isQueue = json['isQueue'];
isToneReq = json['isToneReq'];
isVoiceReq = json['isVoiceReq'];
orientationType = json['orientationType'];
isTurnOn = json['isTurnOn'];
concurrentCallDelaySec = json['concurrentCallDelaySec'];
crTypeAckIP = json['crTypeAckIP'];
voiceLanguage = json['voiceLanguage'] ?? 1;
voiceLanguageText = json['voiceLanguageText'] ?? "English";
vitalSignText = json['vitalSignText'];
doctorText = json['doctorText'];
procedureText = json['procedureText'];
vaccinationText = json['vaccinationText'];
nebulizationText = json['nebulizationText'];
callForVitalSignText = json['callForVitalSignText'];
callForDoctorText = json['callForDoctorText'];
callForProcedureText = json['callForProcedureText'];
callForVaccinationText = json['callForVaccinationText'];
callForNebulizationText = json['callForNebulizationText'];
roomText = json['roomText'];
queueNoText = json['queueNoText'];
callForText = json['callForText'];
}
@override
String toString() {
return 'TicketData{id: $id, patientID: $patientID, laBQGroupID: $laBQGroupID, queueNo: $queueNo, counterBatchNo: $counterBatchNo, calledBy: $calledBy, calledOn: $calledOn, servedOn: $servedOn, patientName: $patientName, mobileNo: $mobileNo, patientEmail: $patientEmail, preferredLang: $preferredLang, voiceLanguageEnum: $voiceLanguageEnum, ticketNoText: $ticketNoText, postVoiceText: $postVoiceText, patientGender: $patientGender, roomNo: $roomNo, isActive: $isActive, createdBy: $createdBy, editedBy: $editedBy, editedOn: $editedOn, createdOn: $createdOn, doctorNameN: $doctorNameN, callTypeEnum: $callTypeEnum, queueNoM: $queueNoM, callNoStr: $callNoStr, isQueue: $isQueue, isToneReq: $isToneReq, isVoiceReq: $isVoiceReq, orientationType: $orientationType, isTurnOn: $isTurnOn, concurrentCallDelaySec: $concurrentCallDelaySec, crTypeAckIP: $crTypeAckIP, voiceLanguage: $voiceLanguage, voiceLanguageText: $voiceLanguageText, vitalSignText: $vitalSignText, doctorText: $doctorText, procedureText: $procedureText, vaccinationText: $vaccinationText, nebulizationText: $nebulizationText, callForVitalSignText: $callForVitalSignText, callForDoctorText: $callForDoctorText, callForProcedureText: $callForProcedureText, callForVaccinationText: $callForVaccinationText, callForNebulizationText: $callForNebulizationText, roomText: $roomText, queueNoText: $queueNoText, callForText: $callForText}';
}
}