import 'notification.m.dart'; import 'appletAPI.m.dart'; import 'liveConsultation.m.dart'; import 'package:fis_jsonrpc/utils.dart'; enum BookingTypeEnum { Personal, Group, } enum BookingStatusEnum { UnSubmitted, Booked, Canceled, } class HealthExamPersonDTO { String? name; PatientGenderEnum gender; String? identityCard; String? phone; HealthExamPersonDTO({ this.name, this.gender = PatientGenderEnum.NotFilled, this.identityCard, this.phone, }); factory HealthExamPersonDTO.fromJson(Map map) { return HealthExamPersonDTO( name: map['Name'], gender: PatientGenderEnum.values.firstWhere((e) => e.index == map['Gender']), identityCard: map['IdentityCard'], phone: map['Phone'], ); } Map toJson() { final map = Map(); if (name != null) { map['Name'] = name; } map['Gender'] = gender.index; if (identityCard != null) { map['IdentityCard'] = identityCard; } if (phone != null) { map['Phone'] = phone; } return map; } } class HealthExamItemDTO { String? name; String? content; HealthExamItemDTO({ this.name, this.content, }); factory HealthExamItemDTO.fromJson(Map map) { return HealthExamItemDTO( name: map['Name'], content: map['Content'], ); } Map toJson() { final map = Map(); if (name != null) { map['Name'] = name; } if (content != null) { map['Content'] = content; } return map; } } class HealthExamBookingDTO extends BaseDTO{ String? code; BookingTypeEnum bookingType; String? name; String? location; DateTime? startDate; DateTime? endDate; String? subject; String? description; String? initiatorCode; String? orgCode; BookingStatusEnum status; List? persons; List? examItems; String? shareUrl; HealthExamBookingDTO({ this.code, this.bookingType = BookingTypeEnum.Personal, this.name, this.location, this.startDate, this.endDate, this.subject, this.description, this.initiatorCode, this.orgCode, this.status = BookingStatusEnum.UnSubmitted, this.persons, this.examItems, this.shareUrl, DateTime? createTime, DateTime? updateTime, }) : super( createTime: createTime, updateTime: updateTime, ); factory HealthExamBookingDTO.fromJson(Map map) { return HealthExamBookingDTO( code: map['Code'], bookingType: BookingTypeEnum.values.firstWhere((e) => e.index == map['BookingType']), name: map['Name'], location: map['Location'], startDate: map['StartDate'] != null ? DateTime.parse(map['StartDate']) : null, endDate: map['EndDate'] != null ? DateTime.parse(map['EndDate']) : null, subject: map['Subject'], description: map['Description'], initiatorCode: map['InitiatorCode'], orgCode: map['OrgCode'], status: BookingStatusEnum.values.firstWhere((e) => e.index == map['Status']), persons: map['Persons'] != null ? (map['Persons'] as List).map((e)=>HealthExamPersonDTO.fromJson(e as Map)).toList() : null, examItems: map['ExamItems'] != null ? (map['ExamItems'] as List).map((e)=>HealthExamItemDTO.fromJson(e as Map)).toList() : null, shareUrl: map['ShareUrl'], createTime: map['CreateTime'] != null ? DateTime.parse(map['CreateTime']) : null, updateTime: map['UpdateTime'] != null ? DateTime.parse(map['UpdateTime']) : null, ); } Map toJson() { final map = super.toJson(); if (code != null) map['Code'] = code; map['BookingType'] = bookingType.index; if (name != null) map['Name'] = name; if (location != null) map['Location'] = location; if (startDate != null) map['StartDate'] = JsonRpcUtils.dateFormat(startDate!); if (endDate != null) map['EndDate'] = JsonRpcUtils.dateFormat(endDate!); if (subject != null) map['Subject'] = subject; if (description != null) map['Description'] = description; if (initiatorCode != null) map['InitiatorCode'] = initiatorCode; if (orgCode != null) map['OrgCode'] = orgCode; map['Status'] = status.index; if (persons != null) map['Persons'] = persons; if (examItems != null) map['ExamItems'] = examItems; if (shareUrl != null) map['ShareUrl'] = shareUrl; return map; } } class GetHealthExamBookingPageRequest extends PageRequest{ String? keyword; List? orgCodes; GetHealthExamBookingPageRequest({ this.keyword, this.orgCodes, int pageIndex = 0, int pageSize = 0, String? token, }) : super( pageIndex: pageIndex, pageSize: pageSize, token: token, ); factory GetHealthExamBookingPageRequest.fromJson(Map map) { return GetHealthExamBookingPageRequest( keyword: map['Keyword'], orgCodes: map['OrgCodes']?.cast().toList(), pageIndex: map['PageIndex'], pageSize: map['PageSize'], token: map['Token'], ); } Map toJson() { final map = super.toJson(); if (keyword != null) map['Keyword'] = keyword; if (orgCodes != null) map['OrgCodes'] = orgCodes; return map; } } class SaveHealthExamBookingRequest extends TokenRequest{ String? code; BookingTypeEnum bookingType; String? name; String? location; DateTime? startDate; DateTime? endDate; String? subject; String? description; String? initiatorCode; String? orgCode; BookingStatusEnum status; List? persons; List? examItems; SaveHealthExamBookingRequest({ this.code, this.bookingType = BookingTypeEnum.Personal, this.name, this.location, this.startDate, this.endDate, this.subject, this.description, this.initiatorCode, this.orgCode, this.status = BookingStatusEnum.UnSubmitted, this.persons, this.examItems, String? token, }) : super( token: token, ); factory SaveHealthExamBookingRequest.fromJson(Map map) { return SaveHealthExamBookingRequest( code: map['Code'], bookingType: BookingTypeEnum.values.firstWhere((e) => e.index == map['BookingType']), name: map['Name'], location: map['Location'], startDate: map['StartDate'] != null ? DateTime.parse(map['StartDate']) : null, endDate: map['EndDate'] != null ? DateTime.parse(map['EndDate']) : null, subject: map['Subject'], description: map['Description'], initiatorCode: map['InitiatorCode'], orgCode: map['OrgCode'], status: BookingStatusEnum.values.firstWhere((e) => e.index == map['Status']), persons: map['Persons'] != null ? (map['Persons'] as List).map((e)=>HealthExamPersonDTO.fromJson(e as Map)).toList() : null, examItems: map['ExamItems'] != null ? (map['ExamItems'] as List).map((e)=>HealthExamItemDTO.fromJson(e as Map)).toList() : null, token: map['Token'], ); } Map toJson() { final map = super.toJson(); if (code != null) map['Code'] = code; map['BookingType'] = bookingType.index; if (name != null) map['Name'] = name; if (location != null) map['Location'] = location; if (startDate != null) map['StartDate'] = JsonRpcUtils.dateFormat(startDate!); if (endDate != null) map['EndDate'] = JsonRpcUtils.dateFormat(endDate!); if (subject != null) map['Subject'] = subject; if (description != null) map['Description'] = description; if (initiatorCode != null) map['InitiatorCode'] = initiatorCode; if (orgCode != null) map['OrgCode'] = orgCode; map['Status'] = status.index; if (persons != null) map['Persons'] = persons; if (examItems != null) map['ExamItems'] = examItems; return map; } } class GetHealthExamBookingRequest extends TokenRequest{ String? code; GetHealthExamBookingRequest({ this.code, String? token, }) : super( token: token, ); factory GetHealthExamBookingRequest.fromJson(Map map) { return GetHealthExamBookingRequest( code: map['Code'], token: map['Token'], ); } Map toJson() { final map = super.toJson(); if (code != null) map['Code'] = code; return map; } } class DeleteHealthExamBookingRequest extends TokenRequest{ String? code; DeleteHealthExamBookingRequest({ this.code, String? token, }) : super( token: token, ); factory DeleteHealthExamBookingRequest.fromJson(Map map) { return DeleteHealthExamBookingRequest( code: map['Code'], token: map['Token'], ); } Map toJson() { final map = super.toJson(); if (code != null) map['Code'] = code; return map; } } class SignUpHealthExamBookingRequest extends TokenRequest{ String? code; String? name; PatientGenderEnum gender; String? identityCard; String? phone; SignUpHealthExamBookingRequest({ this.code, this.name, this.gender = PatientGenderEnum.NotFilled, this.identityCard, this.phone, String? token, }) : super( token: token, ); factory SignUpHealthExamBookingRequest.fromJson(Map map) { return SignUpHealthExamBookingRequest( code: map['Code'], name: map['Name'], gender: PatientGenderEnum.values.firstWhere((e) => e.index == map['Gender']), identityCard: map['IdentityCard'], phone: map['Phone'], token: map['Token'], ); } Map toJson() { final map = super.toJson(); if (code != null) map['Code'] = code; if (name != null) map['Name'] = name; map['Gender'] = gender.index; if (identityCard != null) map['IdentityCard'] = identityCard; if (phone != null) map['Phone'] = phone; return map; } } class GetExamBookingByIDCardRequest extends TokenRequest{ String? iDCardNo; String? operatorCode; GetExamBookingByIDCardRequest({ this.iDCardNo, this.operatorCode, String? token, }) : super( token: token, ); factory GetExamBookingByIDCardRequest.fromJson(Map map) { return GetExamBookingByIDCardRequest( iDCardNo: map['IDCardNo'], operatorCode: map['OperatorCode'], token: map['Token'], ); } Map toJson() { final map = super.toJson(); if (iDCardNo != null) map['IDCardNo'] = iDCardNo; if (operatorCode != null) map['OperatorCode'] = operatorCode; return map; } } class AddRegiterInfoRequest { String? iDCardNo; String? name; String? sex; String? age; String? phone; String? adress; String? orgUniqueCode; String? organizationCode; AddRegiterInfoRequest({ this.iDCardNo, this.name, this.sex, this.age, this.phone, this.adress, this.orgUniqueCode, this.organizationCode, }); factory AddRegiterInfoRequest.fromJson(Map map) { return AddRegiterInfoRequest( iDCardNo: map['IDCardNo'], name: map['Name'], sex: map['Sex'], age: map['Age'], phone: map['Phone'], adress: map['Adress'], orgUniqueCode: map['OrgUniqueCode'], organizationCode: map['OrganizationCode'], ); } Map toJson() { final map = Map(); if (iDCardNo != null) { map['IDCardNo'] = iDCardNo; } if (name != null) { map['Name'] = name; } if (sex != null) { map['Sex'] = sex; } if (age != null) { map['Age'] = age; } if (phone != null) { map['Phone'] = phone; } if (adress != null) { map['Adress'] = adress; } if (orgUniqueCode != null) { map['OrgUniqueCode'] = orgUniqueCode; } if (organizationCode != null) { map['OrganizationCode'] = organizationCode; } return map; } } class UpdateRegiterInfoRequest extends AddRegiterInfoRequest{ String? code; UpdateRegiterInfoRequest({ this.code, String? iDCardNo, String? name, String? sex, String? age, String? phone, String? adress, String? orgUniqueCode, String? organizationCode, }) : super( iDCardNo: iDCardNo, name: name, sex: sex, age: age, phone: phone, adress: adress, orgUniqueCode: orgUniqueCode, organizationCode: organizationCode, ); factory UpdateRegiterInfoRequest.fromJson(Map map) { return UpdateRegiterInfoRequest( code: map['Code'], iDCardNo: map['IDCardNo'], name: map['Name'], sex: map['Sex'], age: map['Age'], phone: map['Phone'], adress: map['Adress'], orgUniqueCode: map['OrgUniqueCode'], organizationCode: map['OrganizationCode'], ); } Map toJson() { final map = super.toJson(); if (code != null) map['Code'] = code; return map; } } enum ExamStateEnum { Unchecked, Invalid, Inspected, } class RegisterInfoDTO extends BaseDTO{ String? code; String? physicalExamNumber; String? iDCardNo; String? name; String? sex; String? age; String? phone; String? adress; ExamStateEnum state; String? organizationCode; RegisterInfoDTO({ this.code, this.physicalExamNumber, this.iDCardNo, this.name, this.sex, this.age, this.phone, this.adress, this.state = ExamStateEnum.Unchecked, this.organizationCode, DateTime? createTime, DateTime? updateTime, }) : super( createTime: createTime, updateTime: updateTime, ); factory RegisterInfoDTO.fromJson(Map map) { return RegisterInfoDTO( code: map['Code'], physicalExamNumber: map['PhysicalExamNumber'], iDCardNo: map['IDCardNo'], name: map['Name'], sex: map['Sex'], age: map['Age'], phone: map['Phone'], adress: map['Adress'], state: ExamStateEnum.values.firstWhere((e) => e.index == map['State']), organizationCode: map['OrganizationCode'], createTime: map['CreateTime'] != null ? DateTime.parse(map['CreateTime']) : null, updateTime: map['UpdateTime'] != null ? DateTime.parse(map['UpdateTime']) : null, ); } Map toJson() { final map = super.toJson(); if (code != null) map['Code'] = code; if (physicalExamNumber != null) map['PhysicalExamNumber'] = physicalExamNumber; if (iDCardNo != null) map['IDCardNo'] = iDCardNo; if (name != null) map['Name'] = name; if (sex != null) map['Sex'] = sex; if (age != null) map['Age'] = age; if (phone != null) map['Phone'] = phone; if (adress != null) map['Adress'] = adress; map['State'] = state.index; if (organizationCode != null) map['OrganizationCode'] = organizationCode; return map; } } class GetRegiterInfoPageRequest extends PageRequest{ String? keyword; String? operatorCode; GetRegiterInfoPageRequest({ this.keyword, this.operatorCode, int pageIndex = 0, int pageSize = 0, String? token, }) : super( pageIndex: pageIndex, pageSize: pageSize, token: token, ); factory GetRegiterInfoPageRequest.fromJson(Map map) { return GetRegiterInfoPageRequest( keyword: map['Keyword'], operatorCode: map['OperatorCode'], pageIndex: map['PageIndex'], pageSize: map['PageSize'], token: map['Token'], ); } Map toJson() { final map = super.toJson(); if (keyword != null) map['Keyword'] = keyword; if (operatorCode != null) map['OperatorCode'] = operatorCode; return map; } }