import 'liveConsultation.m.dart';
import 'recordInfo.m.dart';
import 'notification.m.dart';
import 'organization.m.dart';
import 'patient.m.dart';
import 'education.m.dart';
import 'aIDiagnosis.m.dart';

import 'package:fis_jsonrpc/utils.dart';

class CreateExaminfoResult {
	String? examCode;
	DateTime? createTime;
	String? patientCode;

	CreateExaminfoResult({
		this.examCode,
		this.createTime,
		this.patientCode,
	});

	factory CreateExaminfoResult.fromJson(Map<String, dynamic> map) {
		return CreateExaminfoResult( 
			examCode: map['ExamCode'],
			createTime: map['CreateTime'] != null ? DateTime.parse(map['CreateTime']) : null,
			patientCode: map['PatientCode'],
		);
	}

	Map<String, dynamic> toJson() {
		final map = Map<String, dynamic>();
		if (examCode != null) {
			map['ExamCode'] = examCode;
		}
		if (createTime != null) {
			map['CreateTime'] = JsonRpcUtils.dateFormat(createTime!);
		}
		if (patientCode != null) {
			map['PatientCode'] = patientCode;
		}
		return map;
	}
}

class CreateExaminfoRequest extends TokenRequest{
	String? patientType;
	String? examRecordCode;
	List<DataItemDTO>? patientInfo;
	List<PatientInfoExt>? patientScanInfoList;
	bool isScreenshotVersion;
	String? customDoctor;
	String? customOrganzation;
	String? equipmentSN;
	String? patientCode;
	DateTime? examTime;

	CreateExaminfoRequest({
		this.patientType,
		this.examRecordCode,
		this.patientInfo,
		this.patientScanInfoList,
		this.isScreenshotVersion = false,
		this.customDoctor,
		this.customOrganzation,
		this.equipmentSN,
		this.patientCode,
		this.examTime,
		String? token,
	}) : super(
			token: token,
		);

	factory CreateExaminfoRequest.fromJson(Map<String, dynamic> map) {
		return CreateExaminfoRequest( 
			patientType: map['PatientType'],
			examRecordCode: map['ExamRecordCode'],
			patientInfo: map['PatientInfo'] != null ? (map['PatientInfo'] as List).map((e)=>DataItemDTO.fromJson(e as Map<String,dynamic>)).toList() : null,
			patientScanInfoList: map['PatientScanInfoList'] != null ? (map['PatientScanInfoList'] as List).map((e)=>PatientInfoExt.fromJson(e as Map<String,dynamic>)).toList() : null,
			isScreenshotVersion: map['IsScreenshotVersion'],
			customDoctor: map['CustomDoctor'],
			customOrganzation: map['CustomOrganzation'],
			equipmentSN: map['EquipmentSN'],
			patientCode: map['PatientCode'],
			examTime: map['ExamTime'] != null ? DateTime.parse(map['ExamTime']) : null,
			token: map['Token'],
		);
	}

	Map<String, dynamic> toJson() {
		final map = super.toJson();
		if (patientType != null)
			map['PatientType'] = patientType;
		if (examRecordCode != null)
			map['ExamRecordCode'] = examRecordCode;
		if (patientInfo != null)
			map['PatientInfo'] = patientInfo;
		if (patientScanInfoList != null)
			map['PatientScanInfoList'] = patientScanInfoList;
		map['IsScreenshotVersion'] = isScreenshotVersion;
		if (customDoctor != null)
			map['CustomDoctor'] = customDoctor;
		if (customOrganzation != null)
			map['CustomOrganzation'] = customOrganzation;
		if (equipmentSN != null)
			map['EquipmentSN'] = equipmentSN;
		if (patientCode != null)
			map['PatientCode'] = patientCode;
		if (examTime != null)
			map['ExamTime'] = JsonRpcUtils.dateFormat(examTime!);
		return map;
	}
}

class UploadExamDataForOldVersionResult {
	String? remedicalCode;
	DateTime? remedicalCreateTime;

	UploadExamDataForOldVersionResult({
		this.remedicalCode,
		this.remedicalCreateTime,
	});

	factory UploadExamDataForOldVersionResult.fromJson(Map<String, dynamic> map) {
		return UploadExamDataForOldVersionResult( 
			remedicalCode: map['RemedicalCode'],
			remedicalCreateTime: map['RemedicalCreateTime'] != null ? DateTime.parse(map['RemedicalCreateTime']) : null,
		);
	}

	Map<String, dynamic> toJson() {
		final map = Map<String, dynamic>();
		if (remedicalCode != null) {
			map['RemedicalCode'] = remedicalCode;
		}
		if (remedicalCreateTime != null) {
			map['RemedicalCreateTime'] = JsonRpcUtils.dateFormat(remedicalCreateTime!);
		}
		return map;
	}
}

class UploadExamDataRequest extends TokenRequest{
	String? examCode;
	String? previewFileToken;
	String? fileToken;
	int fileSize;
	String? coverImageToken;
	String? applicationCategory;
	String? application;
	RemedicalFileDataTypeEnum fileDataType;
	MeasuredResultsDTO? measuredResult;
	ScanImageDTO? commentResult;
	ImageLocationDTO? imageLocation;
	DateTime? examTime;

	UploadExamDataRequest({
		this.examCode,
		this.previewFileToken,
		this.fileToken,
		this.fileSize = 0,
		this.coverImageToken,
		this.applicationCategory,
		this.application,
		this.fileDataType = RemedicalFileDataTypeEnum.VinnoVidSingle,
		this.measuredResult,
		this.commentResult,
		this.imageLocation,
		this.examTime,
		String? token,
	}) : super(
			token: token,
		);

	factory UploadExamDataRequest.fromJson(Map<String, dynamic> map) {
		return UploadExamDataRequest( 
			examCode: map['ExamCode'],
			previewFileToken: map['PreviewFileToken'],
			fileToken: map['FileToken'],
			fileSize: map['FileSize'],
			coverImageToken: map['CoverImageToken'],
			applicationCategory: map['ApplicationCategory'],
			application: map['Application'],
			fileDataType: RemedicalFileDataTypeEnum.values.firstWhere((e) => e.index == map['FileDataType']),
			measuredResult: map['MeasuredResult'] != null ? MeasuredResultsDTO.fromJson(map['MeasuredResult']) : null,
			commentResult: map['CommentResult'] != null ? ScanImageDTO.fromJson(map['CommentResult']) : null,
			imageLocation: map['ImageLocation'] != null ? ImageLocationDTO.fromJson(map['ImageLocation']) : null,
			examTime: map['ExamTime'] != null ? DateTime.parse(map['ExamTime']) : null,
			token: map['Token'],
		);
	}

	Map<String, dynamic> toJson() {
		final map = super.toJson();
		if (examCode != null)
			map['ExamCode'] = examCode;
		if (previewFileToken != null)
			map['PreviewFileToken'] = previewFileToken;
		if (fileToken != null)
			map['FileToken'] = fileToken;
		map['FileSize'] = fileSize;
		if (coverImageToken != null)
			map['CoverImageToken'] = coverImageToken;
		if (applicationCategory != null)
			map['ApplicationCategory'] = applicationCategory;
		if (application != null)
			map['Application'] = application;
		map['FileDataType'] = fileDataType.index;
		if (measuredResult != null)
			map['MeasuredResult'] = measuredResult;
		if (commentResult != null)
			map['CommentResult'] = commentResult;
		if (imageLocation != null)
			map['ImageLocation'] = imageLocation;
		if (examTime != null)
			map['ExamTime'] = JsonRpcUtils.dateFormat(examTime!);
		return map;
	}
}

class FindRemedicalByCodeRequest extends TokenRequest{
	String? remedicalCode;
	bool existDiagnosisResult;

	FindRemedicalByCodeRequest({
		this.remedicalCode,
		this.existDiagnosisResult = false,
		String? token,
	}) : super(
			token: token,
		);

	factory FindRemedicalByCodeRequest.fromJson(Map<String, dynamic> map) {
		return FindRemedicalByCodeRequest( 
			remedicalCode: map['RemedicalCode'],
			existDiagnosisResult: map['ExistDiagnosisResult'],
			token: map['Token'],
		);
	}

	Map<String, dynamic> toJson() {
		final map = super.toJson();
		if (remedicalCode != null)
			map['RemedicalCode'] = remedicalCode;
		map['ExistDiagnosisResult'] = existDiagnosisResult;
		return map;
	}
}

class AddToRemedicalDiagnosisRequest extends TokenRequest{
	String? remedicalCode;

	AddToRemedicalDiagnosisRequest({
		this.remedicalCode,
		String? token,
	}) : super(
			token: token,
		);

	factory AddToRemedicalDiagnosisRequest.fromJson(Map<String, dynamic> map) {
		return AddToRemedicalDiagnosisRequest( 
			remedicalCode: map['RemedicalCode'],
			token: map['Token'],
		);
	}

	Map<String, dynamic> toJson() {
		final map = super.toJson();
		if (remedicalCode != null)
			map['RemedicalCode'] = remedicalCode;
		return map;
	}
}

class RemedicalItemList {
	String? patientScanTypeDesc;
	List<String>? patientScanTypeList;
	String? applicationCategory;
	String? application;
	List<RemedicalInfoDTO>? remedicalList;

	RemedicalItemList({
		this.patientScanTypeDesc,
		this.patientScanTypeList,
		this.applicationCategory,
		this.application,
		this.remedicalList,
	});

	factory RemedicalItemList.fromJson(Map<String, dynamic> map) {
		return RemedicalItemList( 
			patientScanTypeDesc: map['PatientScanTypeDesc'],
			patientScanTypeList: map['PatientScanTypeList']?.cast<String>().toList(),
			applicationCategory: map['ApplicationCategory'],
			application: map['Application'],
			remedicalList: map['RemedicalList'] != null ? (map['RemedicalList'] as List).map((e)=>RemedicalInfoDTO.fromJson(e as Map<String,dynamic>)).toList() : null,
		);
	}

	Map<String, dynamic> toJson() {
		final map = Map<String, dynamic>();
		if (patientScanTypeDesc != null) {
			map['PatientScanTypeDesc'] = patientScanTypeDesc;
		}
		if (patientScanTypeList != null) {
			map['PatientScanTypeList'] = patientScanTypeList;
		}
		if (applicationCategory != null) {
			map['ApplicationCategory'] = applicationCategory;
		}
		if (application != null) {
			map['Application'] = application;
		}
		if (remedicalList != null) {
			map['RemedicalList'] = remedicalList;
		}
		return map;
	}
}

class RemedicalListResult {
	String? scanDate;
	String? recordCode;
	List<RemedicalItemList>? remedicalItemList;

	RemedicalListResult({
		this.scanDate,
		this.recordCode,
		this.remedicalItemList,
	});

	factory RemedicalListResult.fromJson(Map<String, dynamic> map) {
		return RemedicalListResult( 
			scanDate: map['ScanDate'],
			recordCode: map['RecordCode'],
			remedicalItemList: map['RemedicalItemList'] != null ? (map['RemedicalItemList'] as List).map((e)=>RemedicalItemList.fromJson(e as Map<String,dynamic>)).toList() : null,
		);
	}

	Map<String, dynamic> toJson() {
		final map = Map<String, dynamic>();
		if (scanDate != null) {
			map['ScanDate'] = scanDate;
		}
		if (recordCode != null) {
			map['RecordCode'] = recordCode;
		}
		if (remedicalItemList != null) {
			map['RemedicalItemList'] = remedicalItemList;
		}
		return map;
	}
}

enum QueryDropdownListEnum {
	Org,
}

class QueryDropdownListReuqest extends TokenRequest{
	QueryDropdownListEnum queryType;
	String? queryValue;

	QueryDropdownListReuqest({
		this.queryType = QueryDropdownListEnum.Org,
		this.queryValue,
		String? token,
	}) : super(
			token: token,
		);

	factory QueryDropdownListReuqest.fromJson(Map<String, dynamic> map) {
		return QueryDropdownListReuqest( 
			queryType: QueryDropdownListEnum.values.firstWhere((e) => e.index == map['QueryType']),
			queryValue: map['QueryValue'],
			token: map['Token'],
		);
	}

	Map<String, dynamic> toJson() {
		final map = super.toJson();
		map['QueryType'] = queryType.index;
		if (queryValue != null)
			map['QueryValue'] = queryValue;
		return map;
	}
}

class RservationResult {
	String? reservationCode;
	List<DataItemDTO>? patientInfo;
	List<PatientInfoExt>? patientInfoExtList;
	String? dataSource;

	RservationResult({
		this.reservationCode,
		this.patientInfo,
		this.patientInfoExtList,
		this.dataSource,
	});

	factory RservationResult.fromJson(Map<String, dynamic> map) {
		return RservationResult( 
			reservationCode: map['ReservationCode'],
			patientInfo: map['PatientInfo'] != null ? (map['PatientInfo'] as List).map((e)=>DataItemDTO.fromJson(e as Map<String,dynamic>)).toList() : null,
			patientInfoExtList: map['PatientInfoExtList'] != null ? (map['PatientInfoExtList'] as List).map((e)=>PatientInfoExt.fromJson(e as Map<String,dynamic>)).toList() : null,
			dataSource: map['DataSource'],
		);
	}

	Map<String, dynamic> toJson() {
		final map = Map<String, dynamic>();
		if (reservationCode != null) {
			map['ReservationCode'] = reservationCode;
		}
		if (patientInfo != null) {
			map['PatientInfo'] = patientInfo;
		}
		if (patientInfoExtList != null) {
			map['PatientInfoExtList'] = patientInfoExtList;
		}
		if (dataSource != null) {
			map['DataSource'] = dataSource;
		}
		return map;
	}
}

class QueryReservationResult {
	List<RservationResult>? reservationList;

	QueryReservationResult({
		this.reservationList,
	});

	factory QueryReservationResult.fromJson(Map<String, dynamic> map) {
		return QueryReservationResult( 
			reservationList: map['ReservationList'] != null ? (map['ReservationList'] as List).map((e)=>RservationResult.fromJson(e as Map<String,dynamic>)).toList() : null,
		);
	}

	Map<String, dynamic> toJson() {
		final map = Map<String, dynamic>();
		if (reservationList != null) {
			map['ReservationList'] = reservationList;
		}
		return map;
	}
}

class QueryReservationRequest extends TokenRequest{
	DateTime? createTime;

	QueryReservationRequest({
		this.createTime,
		String? token,
	}) : super(
			token: token,
		);

	factory QueryReservationRequest.fromJson(Map<String, dynamic> map) {
		return QueryReservationRequest( 
			createTime: map['CreateTime'] != null ? DateTime.parse(map['CreateTime']) : null,
			token: map['Token'],
		);
	}

	Map<String, dynamic> toJson() {
		final map = super.toJson();
		if (createTime != null)
			map['CreateTime'] = JsonRpcUtils.dateFormat(createTime!);
		return map;
	}
}

class FinishExamNotifyDetail {
	String? recordCode;
	RecordStatusEnum recordStatus;

	FinishExamNotifyDetail({
		this.recordCode,
		this.recordStatus = RecordStatusEnum.NotScanned,
	});

	factory FinishExamNotifyDetail.fromJson(Map<String, dynamic> map) {
		return FinishExamNotifyDetail( 
			recordCode: map['RecordCode'],
			recordStatus: RecordStatusEnum.values.firstWhere((e) => e.index == map['RecordStatus']),
		);
	}

	Map<String, dynamic> toJson() {
		final map = Map<String, dynamic>();
		if (recordCode != null) {
			map['RecordCode'] = recordCode;
		}
		map['RecordStatus'] = recordStatus.index;
		return map;
	}
}

class PushFinishExamNotifyToClientRequest {
	List<FinishExamNotifyDetail>? records;
	String? userCode;

	PushFinishExamNotifyToClientRequest({
		this.records,
		this.userCode,
	});

	factory PushFinishExamNotifyToClientRequest.fromJson(Map<String, dynamic> map) {
		return PushFinishExamNotifyToClientRequest( 
			records: map['Records'] != null ? (map['Records'] as List).map((e)=>FinishExamNotifyDetail.fromJson(e as Map<String,dynamic>)).toList() : null,
			userCode: map['UserCode'],
		);
	}

	Map<String, dynamic> toJson() {
		final map = Map<String, dynamic>();
		if (records != null) {
			map['Records'] = records;
		}
		if (userCode != null) {
			map['UserCode'] = userCode;
		}
		return map;
	}
}

class DeviceFinishExamRequest extends TokenRequest{
	List<String>? records;

	DeviceFinishExamRequest({
		this.records,
		String? token,
	}) : super(
			token: token,
		);

	factory DeviceFinishExamRequest.fromJson(Map<String, dynamic> map) {
		return DeviceFinishExamRequest( 
			records: map['Records']?.cast<String>().toList(),
			token: map['Token'],
		);
	}

	Map<String, dynamic> toJson() {
		final map = super.toJson();
		if (records != null)
			map['Records'] = records;
		return map;
	}
}

class QueryExamInfoResult {
	String? examCode;
	DateTime? createTime;
	String? deptName;
	String? patientCode;
	String? patientName;
	String? patientAge;
	List<DataItemDTO>? patientAgeInfo;
	String? patientSex;
	List<PatientInfoExt>? patientInfoExtList;
	List<String>? associatedExamCodes;
	RecordStatusEnum examStatus;
	String? customDoctor;
	String? customOrganzation;
	String? equipmentSN;
	String? deviceCode;

	QueryExamInfoResult({
		this.examCode,
		this.createTime,
		this.deptName,
		this.patientCode,
		this.patientName,
		this.patientAge,
		this.patientAgeInfo,
		this.patientSex,
		this.patientInfoExtList,
		this.associatedExamCodes,
		this.examStatus = RecordStatusEnum.NotScanned,
		this.customDoctor,
		this.customOrganzation,
		this.equipmentSN,
		this.deviceCode,
	});

	factory QueryExamInfoResult.fromJson(Map<String, dynamic> map) {
		return QueryExamInfoResult( 
			examCode: map['ExamCode'],
			createTime: map['CreateTime'] != null ? DateTime.parse(map['CreateTime']) : null,
			deptName: map['DeptName'],
			patientCode: map['PatientCode'],
			patientName: map['PatientName'],
			patientAge: map['PatientAge'],
			patientAgeInfo: map['PatientAgeInfo'] != null ? (map['PatientAgeInfo'] as List).map((e)=>DataItemDTO.fromJson(e as Map<String,dynamic>)).toList() : null,
			patientSex: map['PatientSex'],
			patientInfoExtList: map['PatientInfoExtList'] != null ? (map['PatientInfoExtList'] as List).map((e)=>PatientInfoExt.fromJson(e as Map<String,dynamic>)).toList() : null,
			associatedExamCodes: map['AssociatedExamCodes']?.cast<String>().toList(),
			examStatus: RecordStatusEnum.values.firstWhere((e) => e.index == map['ExamStatus']),
			customDoctor: map['CustomDoctor'],
			customOrganzation: map['CustomOrganzation'],
			equipmentSN: map['EquipmentSN'],
			deviceCode: map['DeviceCode'],
		);
	}

	Map<String, dynamic> toJson() {
		final map = Map<String, dynamic>();
		if (examCode != null) {
			map['ExamCode'] = examCode;
		}
		if (createTime != null) {
			map['CreateTime'] = JsonRpcUtils.dateFormat(createTime!);
		}
		if (deptName != null) {
			map['DeptName'] = deptName;
		}
		if (patientCode != null) {
			map['PatientCode'] = patientCode;
		}
		if (patientName != null) {
			map['PatientName'] = patientName;
		}
		if (patientAge != null) {
			map['PatientAge'] = patientAge;
		}
		if (patientAgeInfo != null) {
			map['PatientAgeInfo'] = patientAgeInfo;
		}
		if (patientSex != null) {
			map['PatientSex'] = patientSex;
		}
		if (patientInfoExtList != null) {
			map['PatientInfoExtList'] = patientInfoExtList;
		}
		if (associatedExamCodes != null) {
			map['AssociatedExamCodes'] = associatedExamCodes;
		}
		map['ExamStatus'] = examStatus.index;
		if (customDoctor != null) {
			map['CustomDoctor'] = customDoctor;
		}
		if (customOrganzation != null) {
			map['CustomOrganzation'] = customOrganzation;
		}
		if (equipmentSN != null) {
			map['EquipmentSN'] = equipmentSN;
		}
		if (deviceCode != null) {
			map['DeviceCode'] = deviceCode;
		}
		return map;
	}
}

enum ExamStatusEnum {
	Wait,
	Done,
}

class QueryExamListRequest extends PageRequest{
	String? patientName;
	DateTime? startTime;
	DateTime? endTime;
	ExamStatusEnum examStatus;

	QueryExamListRequest({
		this.patientName,
		this.startTime,
		this.endTime,
		this.examStatus = ExamStatusEnum.Wait,
		int pageIndex = 0,
		int pageSize = 0,
		String? token,
	}) : super(
			pageIndex: pageIndex,
			pageSize: pageSize,
			token: token,
		);

	factory QueryExamListRequest.fromJson(Map<String, dynamic> map) {
		return QueryExamListRequest( 
			patientName: map['PatientName'],
			startTime: map['StartTime'] != null ? DateTime.parse(map['StartTime']) : null,
			endTime: map['EndTime'] != null ? DateTime.parse(map['EndTime']) : null,
			examStatus: ExamStatusEnum.values.firstWhere((e) => e.index == map['ExamStatus']),
			pageIndex: map['PageIndex'],
			pageSize: map['PageSize'],
			token: map['Token'],
		);
	}

	Map<String, dynamic> toJson() {
		final map = super.toJson();
		if (patientName != null)
			map['PatientName'] = patientName;
		if (startTime != null)
			map['StartTime'] = JsonRpcUtils.dateFormat(startTime!);
		if (endTime != null)
			map['EndTime'] = JsonRpcUtils.dateFormat(endTime!);
		map['ExamStatus'] = examStatus.index;
		return map;
	}
}

class QueryExamInfoRequest extends TokenRequest{
	String? examCode;

	QueryExamInfoRequest({
		this.examCode,
		String? token,
	}) : super(
			token: token,
		);

	factory QueryExamInfoRequest.fromJson(Map<String, dynamic> map) {
		return QueryExamInfoRequest( 
			examCode: map['ExamCode'],
			token: map['Token'],
		);
	}

	Map<String, dynamic> toJson() {
		final map = super.toJson();
		if (examCode != null)
			map['ExamCode'] = examCode;
		return map;
	}
}

class OutputItemMetaDTO {
	String? name;
	String? description;
	int unit;
	bool? isWorking;

	OutputItemMetaDTO({
		this.name,
		this.description,
		this.unit = 0,
		this.isWorking,
	});

	factory OutputItemMetaDTO.fromJson(Map<String, dynamic> map) {
		return OutputItemMetaDTO( 
			name: map['Name'],
			description: map['Description'],
			unit: map['Unit'],
			isWorking: map['IsWorking'],
		);
	}

	Map<String, dynamic> toJson() {
		final map = Map<String, dynamic>();
		if (name != null) {
			map['Name'] = name;
		}
		if (description != null) {
			map['Description'] = description;
		}
		map['Unit'] = unit;
		if (isWorking != null) {
			map['IsWorking'] = isWorking;
		}
		return map;
	}
}

class CalculatorMetaDTO {
	List<OutputItemMetaDTO>? availableOutputs;

	CalculatorMetaDTO({
		this.availableOutputs,
	});

	factory CalculatorMetaDTO.fromJson(Map<String, dynamic> map) {
		return CalculatorMetaDTO( 
			availableOutputs: map['AvailableOutputs'] != null ? (map['AvailableOutputs'] as List).map((e)=>OutputItemMetaDTO.fromJson(e as Map<String,dynamic>)).toList() : null,
		);
	}

	Map<String, dynamic> toJson() {
		final map = Map<String, dynamic>();
		if (availableOutputs != null) {
			map['AvailableOutputs'] = availableOutputs;
		}
		return map;
	}
}

class ChildItemMetaDTO {
	String? name;
	String? description;
	bool isWorking;
	List<ChildItemMetaDTO>? childItems;
	CalculatorMetaDTO? calculator;
	String? measureTypeName;

	ChildItemMetaDTO({
		this.name,
		this.description,
		this.isWorking = false,
		this.childItems,
		this.calculator,
		this.measureTypeName,
	});

	factory ChildItemMetaDTO.fromJson(Map<String, dynamic> map) {
		return ChildItemMetaDTO( 
			name: map['Name'],
			description: map['Description'],
			isWorking: map['IsWorking'],
			childItems: map['ChildItems'] != null ? (map['ChildItems'] as List).map((e)=>ChildItemMetaDTO.fromJson(e as Map<String,dynamic>)).toList() : null,
			calculator: map['Calculator'] != null ? CalculatorMetaDTO.fromJson(map['Calculator']) : null,
			measureTypeName: map['MeasureTypeName'],
		);
	}

	Map<String, dynamic> toJson() {
		final map = Map<String, dynamic>();
		if (name != null) {
			map['Name'] = name;
		}
		if (description != null) {
			map['Description'] = description;
		}
		map['IsWorking'] = isWorking;
		if (childItems != null) {
			map['ChildItems'] = childItems;
		}
		if (calculator != null) {
			map['Calculator'] = calculator;
		}
		if (measureTypeName != null) {
			map['MeasureTypeName'] = measureTypeName;
		}
		return map;
	}
}

class ItemMetaDTO {
	String? name;
	String? description;
	String? briefAnnotation;
	String? measureTypeName;
	List<String>? categories;
	CalculatorMetaDTO? calculator;
	List<ChildItemMetaDTO>? multiMethodItems;
	List<ChildItemMetaDTO>? methodChildItems;

	ItemMetaDTO({
		this.name,
		this.description,
		this.briefAnnotation,
		this.measureTypeName,
		this.categories,
		this.calculator,
		this.multiMethodItems,
		this.methodChildItems,
	});

	factory ItemMetaDTO.fromJson(Map<String, dynamic> map) {
		return ItemMetaDTO( 
			name: map['Name'],
			description: map['Description'],
			briefAnnotation: map['BriefAnnotation'],
			measureTypeName: map['MeasureTypeName'],
			categories: map['Categories']?.cast<String>().toList(),
			calculator: map['Calculator'] != null ? CalculatorMetaDTO.fromJson(map['Calculator']) : null,
			multiMethodItems: map['MultiMethodItems'] != null ? (map['MultiMethodItems'] as List).map((e)=>ChildItemMetaDTO.fromJson(e as Map<String,dynamic>)).toList() : null,
			methodChildItems: map['MethodChildItems'] != null ? (map['MethodChildItems'] as List).map((e)=>ChildItemMetaDTO.fromJson(e as Map<String,dynamic>)).toList() : null,
		);
	}

	Map<String, dynamic> toJson() {
		final map = Map<String, dynamic>();
		if (name != null) {
			map['Name'] = name;
		}
		if (description != null) {
			map['Description'] = description;
		}
		if (briefAnnotation != null) {
			map['BriefAnnotation'] = briefAnnotation;
		}
		if (measureTypeName != null) {
			map['MeasureTypeName'] = measureTypeName;
		}
		if (categories != null) {
			map['Categories'] = categories;
		}
		if (calculator != null) {
			map['Calculator'] = calculator;
		}
		if (multiMethodItems != null) {
			map['MultiMethodItems'] = multiMethodItems;
		}
		if (methodChildItems != null) {
			map['MethodChildItems'] = methodChildItems;
		}
		return map;
	}
}

class MeasureFolderDTO {
	String? name;
	List<String>? workingItemNames;
	List<ItemMetaDTO>? availableItems;

	MeasureFolderDTO({
		this.name,
		this.workingItemNames,
		this.availableItems,
	});

	factory MeasureFolderDTO.fromJson(Map<String, dynamic> map) {
		return MeasureFolderDTO( 
			name: map['Name'],
			workingItemNames: map['WorkingItemNames']?.cast<String>().toList(),
			availableItems: map['AvailableItems'] != null ? (map['AvailableItems'] as List).map((e)=>ItemMetaDTO.fromJson(e as Map<String,dynamic>)).toList() : null,
		);
	}

	Map<String, dynamic> toJson() {
		final map = Map<String, dynamic>();
		if (name != null) {
			map['Name'] = name;
		}
		if (workingItemNames != null) {
			map['WorkingItemNames'] = workingItemNames;
		}
		if (availableItems != null) {
			map['AvailableItems'] = availableItems;
		}
		return map;
	}
}

class MeasureGroupDTO {
	String? name;
	String? description;
	List<MeasureFolderDTO>? availableFolders;

	MeasureGroupDTO({
		this.name,
		this.description,
		this.availableFolders,
	});

	factory MeasureGroupDTO.fromJson(Map<String, dynamic> map) {
		return MeasureGroupDTO( 
			name: map['Name'],
			description: map['Description'],
			availableFolders: map['AvailableFolders'] != null ? (map['AvailableFolders'] as List).map((e)=>MeasureFolderDTO.fromJson(e as Map<String,dynamic>)).toList() : null,
		);
	}

	Map<String, dynamic> toJson() {
		final map = Map<String, dynamic>();
		if (name != null) {
			map['Name'] = name;
		}
		if (description != null) {
			map['Description'] = description;
		}
		if (availableFolders != null) {
			map['AvailableFolders'] = availableFolders;
		}
		return map;
	}
}

class MeasureModeDTO {
	String? modeName;
	List<MeasureGroupDTO>? availableGroups;

	MeasureModeDTO({
		this.modeName,
		this.availableGroups,
	});

	factory MeasureModeDTO.fromJson(Map<String, dynamic> map) {
		return MeasureModeDTO( 
			modeName: map['ModeName'],
			availableGroups: map['AvailableGroups'] != null ? (map['AvailableGroups'] as List).map((e)=>MeasureGroupDTO.fromJson(e as Map<String,dynamic>)).toList() : null,
		);
	}

	Map<String, dynamic> toJson() {
		final map = Map<String, dynamic>();
		if (modeName != null) {
			map['ModeName'] = modeName;
		}
		if (availableGroups != null) {
			map['AvailableGroups'] = availableGroups;
		}
		return map;
	}
}

class MeasureApplicationDTO {
	String? version;
	String? id;
	String? description;
	List<MeasureModeDTO>? availableModes;

	MeasureApplicationDTO({
		this.version,
		this.id,
		this.description,
		this.availableModes,
	});

	factory MeasureApplicationDTO.fromJson(Map<String, dynamic> map) {
		return MeasureApplicationDTO( 
			version: map['Version'],
			id: map['Id'],
			description: map['Description'],
			availableModes: map['AvailableModes'] != null ? (map['AvailableModes'] as List).map((e)=>MeasureModeDTO.fromJson(e as Map<String,dynamic>)).toList() : null,
		);
	}

	Map<String, dynamic> toJson() {
		final map = Map<String, dynamic>();
		if (version != null) {
			map['Version'] = version;
		}
		if (id != null) {
			map['Id'] = id;
		}
		if (description != null) {
			map['Description'] = description;
		}
		if (availableModes != null) {
			map['AvailableModes'] = availableModes;
		}
		return map;
	}
}

class GetMeasureApplicationRequest extends TokenRequest{
	String? applicationName;
	String? categoryName;
	List<String>? measureModes;

	GetMeasureApplicationRequest({
		this.applicationName,
		this.categoryName,
		this.measureModes,
		String? token,
	}) : super(
			token: token,
		);

	factory GetMeasureApplicationRequest.fromJson(Map<String, dynamic> map) {
		return GetMeasureApplicationRequest( 
			applicationName: map['ApplicationName'],
			categoryName: map['CategoryName'],
			measureModes: map['MeasureModes']?.cast<String>().toList(),
			token: map['Token'],
		);
	}

	Map<String, dynamic> toJson() {
		final map = super.toJson();
		if (applicationName != null)
			map['ApplicationName'] = applicationName;
		if (categoryName != null)
			map['CategoryName'] = categoryName;
		if (measureModes != null)
			map['MeasureModes'] = measureModes;
		return map;
	}
}

class CommentItemDTO {
	String? text;

	CommentItemDTO({
		this.text,
	});

	factory CommentItemDTO.fromJson(Map<String, dynamic> map) {
		return CommentItemDTO( 
			text: map['Text'],
		);
	}

	Map<String, dynamic> toJson() {
		final map = Map<String, dynamic>();
		if (text != null) {
			map['Text'] = text;
		}
		return map;
	}
}

class CommentItemResultDTO {
	String? version;
	List<CommentItemDTO>? commentItems;

	CommentItemResultDTO({
		this.version,
		this.commentItems,
	});

	factory CommentItemResultDTO.fromJson(Map<String, dynamic> map) {
		return CommentItemResultDTO( 
			version: map['Version'],
			commentItems: map['CommentItems'] != null ? (map['CommentItems'] as List).map((e)=>CommentItemDTO.fromJson(e as Map<String,dynamic>)).toList() : null,
		);
	}

	Map<String, dynamic> toJson() {
		final map = Map<String, dynamic>();
		if (version != null) {
			map['Version'] = version;
		}
		if (commentItems != null) {
			map['CommentItems'] = commentItems;
		}
		return map;
	}
}

class GetCommentsByApplicationRequest extends TokenRequest{
	String? languageCode;
	String? applicationName;
	String? categoryName;

	GetCommentsByApplicationRequest({
		this.languageCode,
		this.applicationName,
		this.categoryName,
		String? token,
	}) : super(
			token: token,
		);

	factory GetCommentsByApplicationRequest.fromJson(Map<String, dynamic> map) {
		return GetCommentsByApplicationRequest( 
			languageCode: map['LanguageCode'],
			applicationName: map['ApplicationName'],
			categoryName: map['CategoryName'],
			token: map['Token'],
		);
	}

	Map<String, dynamic> toJson() {
		final map = super.toJson();
		if (languageCode != null)
			map['LanguageCode'] = languageCode;
		if (applicationName != null)
			map['ApplicationName'] = applicationName;
		if (categoryName != null)
			map['CategoryName'] = categoryName;
		return map;
	}
}

class PresetCommentItemDTO {
	List<String>? categoryList;
	String? text;

	PresetCommentItemDTO({
		this.categoryList,
		this.text,
	});

	factory PresetCommentItemDTO.fromJson(Map<String, dynamic> map) {
		return PresetCommentItemDTO( 
			categoryList: map['CategoryList']?.cast<String>().toList(),
			text: map['Text'],
		);
	}

	Map<String, dynamic> toJson() {
		final map = Map<String, dynamic>();
		if (categoryList != null) {
			map['CategoryList'] = categoryList;
		}
		if (text != null) {
			map['Text'] = text;
		}
		return map;
	}
}

class PresetCommentItemResultDTO {
	String? version;
	List<PresetCommentItemDTO>? presetCommentItems;

	PresetCommentItemResultDTO({
		this.version,
		this.presetCommentItems,
	});

	factory PresetCommentItemResultDTO.fromJson(Map<String, dynamic> map) {
		return PresetCommentItemResultDTO( 
			version: map['Version'],
			presetCommentItems: map['PresetCommentItems'] != null ? (map['PresetCommentItems'] as List).map((e)=>PresetCommentItemDTO.fromJson(e as Map<String,dynamic>)).toList() : null,
		);
	}

	Map<String, dynamic> toJson() {
		final map = Map<String, dynamic>();
		if (version != null) {
			map['Version'] = version;
		}
		if (presetCommentItems != null) {
			map['PresetCommentItems'] = presetCommentItems;
		}
		return map;
	}
}

class GetPresetCommentsRequest extends TokenRequest{
	String? languageCode;

	GetPresetCommentsRequest({
		this.languageCode,
		String? token,
	}) : super(
			token: token,
		);

	factory GetPresetCommentsRequest.fromJson(Map<String, dynamic> map) {
		return GetPresetCommentsRequest( 
			languageCode: map['LanguageCode'],
			token: map['Token'],
		);
	}

	Map<String, dynamic> toJson() {
		final map = super.toJson();
		if (languageCode != null)
			map['LanguageCode'] = languageCode;
		return map;
	}
}

class GetReportElementByLanguageRequest extends TokenRequest{
	String? reportDatasJosn;
	String? language;

	GetReportElementByLanguageRequest({
		this.reportDatasJosn,
		this.language,
		String? token,
	}) : super(
			token: token,
		);

	factory GetReportElementByLanguageRequest.fromJson(Map<String, dynamic> map) {
		return GetReportElementByLanguageRequest( 
			reportDatasJosn: map['ReportDatasJosn'],
			language: map['Language'],
			token: map['Token'],
		);
	}

	Map<String, dynamic> toJson() {
		final map = super.toJson();
		if (reportDatasJosn != null)
			map['ReportDatasJosn'] = reportDatasJosn;
		if (language != null)
			map['Language'] = language;
		return map;
	}
}

class UpdateCommentItemDTO {
	String? oldText;
	String? newText;

	UpdateCommentItemDTO({
		this.oldText,
		this.newText,
	});

	factory UpdateCommentItemDTO.fromJson(Map<String, dynamic> map) {
		return UpdateCommentItemDTO( 
			oldText: map['OldText'],
			newText: map['NewText'],
		);
	}

	Map<String, dynamic> toJson() {
		final map = Map<String, dynamic>();
		if (oldText != null) {
			map['OldText'] = oldText;
		}
		if (newText != null) {
			map['NewText'] = newText;
		}
		return map;
	}
}

class SaveUserDefinedCommentsRequest extends TokenRequest{
	String? version;
	String? languageCode;
	String? applicationName;
	String? categoryName;
	List<CommentItemDTO>? addCommentItems;
	List<CommentItemDTO>? deletedCommentItems;
	List<UpdateCommentItemDTO>? updateCommentItems;

	SaveUserDefinedCommentsRequest({
		this.version,
		this.languageCode,
		this.applicationName,
		this.categoryName,
		this.addCommentItems,
		this.deletedCommentItems,
		this.updateCommentItems,
		String? token,
	}) : super(
			token: token,
		);

	factory SaveUserDefinedCommentsRequest.fromJson(Map<String, dynamic> map) {
		return SaveUserDefinedCommentsRequest( 
			version: map['Version'],
			languageCode: map['LanguageCode'],
			applicationName: map['ApplicationName'],
			categoryName: map['CategoryName'],
			addCommentItems: map['AddCommentItems'] != null ? (map['AddCommentItems'] as List).map((e)=>CommentItemDTO.fromJson(e as Map<String,dynamic>)).toList() : null,
			deletedCommentItems: map['DeletedCommentItems'] != null ? (map['DeletedCommentItems'] as List).map((e)=>CommentItemDTO.fromJson(e as Map<String,dynamic>)).toList() : null,
			updateCommentItems: map['UpdateCommentItems'] != null ? (map['UpdateCommentItems'] as List).map((e)=>UpdateCommentItemDTO.fromJson(e as Map<String,dynamic>)).toList() : null,
			token: map['Token'],
		);
	}

	Map<String, dynamic> toJson() {
		final map = super.toJson();
		if (version != null)
			map['Version'] = version;
		if (languageCode != null)
			map['LanguageCode'] = languageCode;
		if (applicationName != null)
			map['ApplicationName'] = applicationName;
		if (categoryName != null)
			map['CategoryName'] = categoryName;
		if (addCommentItems != null)
			map['AddCommentItems'] = addCommentItems;
		if (deletedCommentItems != null)
			map['DeletedCommentItems'] = deletedCommentItems;
		if (updateCommentItems != null)
			map['UpdateCommentItems'] = updateCommentItems;
		return map;
	}
}

class ResetUserCommentsRequest extends TokenRequest{
	bool isAllReset;
	String? applicationName;
	String? categoryName;

	ResetUserCommentsRequest({
		this.isAllReset = false,
		this.applicationName,
		this.categoryName,
		String? token,
	}) : super(
			token: token,
		);

	factory ResetUserCommentsRequest.fromJson(Map<String, dynamic> map) {
		return ResetUserCommentsRequest( 
			isAllReset: map['IsAllReset'],
			applicationName: map['ApplicationName'],
			categoryName: map['CategoryName'],
			token: map['Token'],
		);
	}

	Map<String, dynamic> toJson() {
		final map = super.toJson();
		map['IsAllReset'] = isAllReset;
		if (applicationName != null)
			map['ApplicationName'] = applicationName;
		if (categoryName != null)
			map['CategoryName'] = categoryName;
		return map;
	}
}

class UserDefinedItemMetaDTO {
	String? name;
	String? workingMethodItem;

	UserDefinedItemMetaDTO({
		this.name,
		this.workingMethodItem,
	});

	factory UserDefinedItemMetaDTO.fromJson(Map<String, dynamic> map) {
		return UserDefinedItemMetaDTO( 
			name: map['Name'],
			workingMethodItem: map['WorkingMethodItem'],
		);
	}

	Map<String, dynamic> toJson() {
		final map = Map<String, dynamic>();
		if (name != null) {
			map['Name'] = name;
		}
		if (workingMethodItem != null) {
			map['WorkingMethodItem'] = workingMethodItem;
		}
		return map;
	}
}

class UserDefinedMeasureFolderDTO {
	String? name;
	List<String>? workingItemNames;
	String? defaultItem;
	List<UserDefinedItemMetaDTO>? multiMethodItemMetas;
	List<ItemMetaDTO>? itemMetas;
	String? itemMetaJson;

	UserDefinedMeasureFolderDTO({
		this.name,
		this.workingItemNames,
		this.defaultItem,
		this.multiMethodItemMetas,
		this.itemMetas,
		this.itemMetaJson,
	});

	factory UserDefinedMeasureFolderDTO.fromJson(Map<String, dynamic> map) {
		return UserDefinedMeasureFolderDTO( 
			name: map['Name'],
			workingItemNames: map['WorkingItemNames']?.cast<String>().toList(),
			defaultItem: map['DefaultItem'],
			multiMethodItemMetas: map['MultiMethodItemMetas'] != null ? (map['MultiMethodItemMetas'] as List).map((e)=>UserDefinedItemMetaDTO.fromJson(e as Map<String,dynamic>)).toList() : null,
			itemMetas: map['ItemMetas'] != null ? (map['ItemMetas'] as List).map((e)=>ItemMetaDTO.fromJson(e as Map<String,dynamic>)).toList() : null,
			itemMetaJson: map['ItemMetaJson'],
		);
	}

	Map<String, dynamic> toJson() {
		final map = Map<String, dynamic>();
		if (name != null) {
			map['Name'] = name;
		}
		if (workingItemNames != null) {
			map['WorkingItemNames'] = workingItemNames;
		}
		if (defaultItem != null) {
			map['DefaultItem'] = defaultItem;
		}
		if (multiMethodItemMetas != null) {
			map['MultiMethodItemMetas'] = multiMethodItemMetas;
		}
		if (itemMetas != null) {
			map['ItemMetas'] = itemMetas;
		}
		if (itemMetaJson != null) {
			map['ItemMetaJson'] = itemMetaJson;
		}
		return map;
	}
}

class UserDefinedMeasureGroupDTO {
	String? name;
	List<UserDefinedMeasureFolderDTO>? folders;

	UserDefinedMeasureGroupDTO({
		this.name,
		this.folders,
	});

	factory UserDefinedMeasureGroupDTO.fromJson(Map<String, dynamic> map) {
		return UserDefinedMeasureGroupDTO( 
			name: map['Name'],
			folders: map['Folders'] != null ? (map['Folders'] as List).map((e)=>UserDefinedMeasureFolderDTO.fromJson(e as Map<String,dynamic>)).toList() : null,
		);
	}

	Map<String, dynamic> toJson() {
		final map = Map<String, dynamic>();
		if (name != null) {
			map['Name'] = name;
		}
		if (folders != null) {
			map['Folders'] = folders;
		}
		return map;
	}
}

class UserDefinedMeasureModeDTO {
	String? modeName;
	List<UserDefinedMeasureGroupDTO>? workingGroups;

	UserDefinedMeasureModeDTO({
		this.modeName,
		this.workingGroups,
	});

	factory UserDefinedMeasureModeDTO.fromJson(Map<String, dynamic> map) {
		return UserDefinedMeasureModeDTO( 
			modeName: map['ModeName'],
			workingGroups: map['WorkingGroups'] != null ? (map['WorkingGroups'] as List).map((e)=>UserDefinedMeasureGroupDTO.fromJson(e as Map<String,dynamic>)).toList() : null,
		);
	}

	Map<String, dynamic> toJson() {
		final map = Map<String, dynamic>();
		if (modeName != null) {
			map['ModeName'] = modeName;
		}
		if (workingGroups != null) {
			map['WorkingGroups'] = workingGroups;
		}
		return map;
	}
}

class SaveUserDefinedMeasureApplicationRequest extends TokenRequest{
	String? version;
	String? applicationName;
	String? categoryName;
	UserDefinedMeasureModeDTO? workingMode;

	SaveUserDefinedMeasureApplicationRequest({
		this.version,
		this.applicationName,
		this.categoryName,
		this.workingMode,
		String? token,
	}) : super(
			token: token,
		);

	factory SaveUserDefinedMeasureApplicationRequest.fromJson(Map<String, dynamic> map) {
		return SaveUserDefinedMeasureApplicationRequest( 
			version: map['Version'],
			applicationName: map['ApplicationName'],
			categoryName: map['CategoryName'],
			workingMode: map['WorkingMode'] != null ? UserDefinedMeasureModeDTO.fromJson(map['WorkingMode']) : null,
			token: map['Token'],
		);
	}

	Map<String, dynamic> toJson() {
		final map = super.toJson();
		if (version != null)
			map['Version'] = version;
		if (applicationName != null)
			map['ApplicationName'] = applicationName;
		if (categoryName != null)
			map['CategoryName'] = categoryName;
		if (workingMode != null)
			map['WorkingMode'] = workingMode;
		return map;
	}
}

enum CursorTypeEnum {
	CursorType1Icon,
	CursorType2Icon,
	CursorType3Icon,
	CursorType4Icon,
	CursorType5Icon,
}

enum Unit {
	None,
	percent,
	fraction,
	placeHolder_3,
	placeHolder_4,
	placeHolder_5,
	placeHolder_6,
	placeHolder_7,
	placeHolder_8,
	placeHolder_9,
	cm,
	mm,
	inch,
	ft,
	placeHolder_14,
	placeHolder_15,
	placeHolder_16,
	placeHolder_17,
	placeHolder_18,
	placeHolder_19,
	s,
	minute,
	hour,
	day,
	week,
	week_day,
	Tick,
	msec,
	placeHolder_28,
	placeHolder_29,
	degree,
	radian,
	placeHolder_32,
	placeHolder_33,
	placeHolder_34,
	placeHolder_35,
	placeHolder_36,
	placeHolder_37,
	placeHolder_38,
	placeHolder_39,
	g,
	mg,
	ng,
	kg,
	oz,
	lb,
	lb_oz,
	placeHolder_47,
	placeHolder_48,
	placeHolder_49,
	cm2,
	mm2,
	m2,
	placeHolder_53,
	placeHolder_54,
	placeHolder_55,
	placeHolder_56,
	placeHolder_57,
	placeHolder_58,
	placeHolder_59,
	cm3,
	mm3,
	ml,
	L,
	placeHolder_64,
	placeHolder_65,
	placeHolder_66,
	placeHolder_67,
	placeHolder_68,
	placeHolder_69,
	cms,
	mms,
	ms,
	placeHolder_73,
	placeHolder_74,
	placeHolder_75,
	placeHolder_76,
	placeHolder_77,
	placeHolder_78,
	placeHolder_79,
	cms2,
	mms2,
	placeHolder_82,
	placeHolder_83,
	placeHolder_84,
	placeHolder_85,
	placeHolder_86,
	placeHolder_87,
	placeHolder_88,
	placeHolder_89,
	cm3s,
	mls,
	mlmin,
	Lmin,
	placeHolder_94,
	placeHolder_95,
	placeHolder_96,
	placeHolder_97,
	placeHolder_98,
	placeHolder_99,
	gcm3,
	gml,
	ngml,
	placeHolder_103,
	placeHolder_104,
	placeHolder_105,
	placeHolder_106,
	placeHolder_107,
	placeHolder_108,
	placeHolder_109,
	mmHg,
	placeHolder_111,
	placeHolder_112,
	placeHolder_113,
	placeHolder_114,
	placeHolder_115,
	placeHolder_116,
	placeHolder_117,
	placeHolder_118,
	placeHolder_119,
	mV,
	placeHolder_121,
	placeHolder_122,
	placeHolder_123,
	placeHolder_124,
	placeHolder_125,
	placeHolder_126,
	placeHolder_127,
	placeHolder_128,
	placeHolder_129,
	Hz,
	KHz,
	HR,
	placeHolder_133,
	placeHolder_134,
	placeHolder_135,
	placeHolder_136,
	placeHolder_137,
	placeHolder_138,
	placeHolder_139,
	cm3m2,
	mlm2,
	placeHolder_142,
	placeHolder_143,
	placeHolder_144,
	placeHolder_145,
	placeHolder_146,
	placeHolder_147,
	placeHolder_148,
	placeHolder_149,
	cm3sm2,
	mlsm2,
	placeHolder_152,
	cm3minm2,
	mlminm2,
	Lminm2,
	placeHolder_156,
	placeHolder_157,
	placeHolder_158,
	placeHolder_159,
	circs,
	placeHolder_161,
	placeHolder_162,
	placeHolder_163,
	placeHolder_164,
	placeHolder_165,
	placeHolder_166,
	placeHolder_167,
	placeHolder_168,
	placeHolder_169,
	mlbeat,
	placeHolder_171,
	placeHolder_172,
	placeHolder_173,
	placeHolder_174,
	placeHolder_175,
	placeHolder_176,
	placeHolder_177,
	placeHolder_178,
	placeHolder_179,
	mm2pa,
	d1mpa,
	kpa,
	placeHolder_183,
	placeHolder_184,
	placeHolder_185,
	placeHolder_186,
	placeHolder_187,
	placeHolder_188,
	placeHolder_189,
	mmHgs,
	placeHolder_191,
	placeHolder_192,
	placeHolder_193,
	placeHolder_194,
	placeHolder_195,
	placeHolder_196,
	placeHolder_197,
	placeHolder_198,
	placeHolder_199,
	gm2,
	kgm2,
	placeHolder_202,
	placeHolder_203,
	placeHolder_204,
	placeHolder_205,
	placeHolder_206,
	placeHolder_207,
	placeHolder_208,
	placeHolder_209,
	cm2m2,
	placeHolder_211,
	placeHolder_212,
	placeHolder_213,
	placeHolder_214,
	placeHolder_215,
	placeHolder_216,
	placeHolder_217,
	placeHolder_218,
	placeHolder_219,
	cmm2,
	mmm2,
	placeHolder_222,
	placeHolder_223,
	placeHolder_224,
	placeHolder_225,
	placeHolder_226,
	placeHolder_227,
	placeHolder_228,
	placeHolder_229,
	pers,
	placeHolder_231,
	placeHolder_232,
	placeHolder_233,
	placeHolder_234,
	placeHolder_235,
	placeHolder_236,
	placeHolder_237,
	placeHolder_238,
	placeHolder_239,
	placeHolder_240,
	placeHolder_241,
	placeHolder_242,
	placeHolder_243,
	placeHolder_244,
	placeHolder_245,
	placeHolder_246,
	placeHolder_247,
	placeHolder_248,
	placeHolder_249,
	Celsius,
	Fahrenheit,
	placeHolder_252,
	placeHolder_253,
	placeHolder_254,
	placeHolder_255,
	placeHolder_256,
	placeHolder_257,
	placeHolder_258,
	placeHolder_259,
	Ohm,
	placeHolder_261,
	placeHolder_262,
	placeHolder_263,
	placeHolder_264,
	placeHolder_265,
	placeHolder_266,
	placeHolder_267,
	placeHolder_268,
	placeHolder_269,
	mmHgml,
}

class MeasureSystemSettingDTO {
	String? version;
	CursorTypeEnum cursorType;
	int cursorSize;
	int shapeCursorSize;
	String? cursorColor;
	bool showResultWindow;
	int showResultLocation;
	int fontSize;
	bool showCursorLine;
	bool holdMeasureLine;
	bool showDepthGuideline;
	bool showBriefAnnotation;
	String? minCursorDistance;
	String? autoSnapDistance;
	int annotationFontSize;
	bool showProtocolInWorkSheet;
	bool showAnnotation;
	Unit distanceUnit;
	Unit areaUnit;
	Unit velocityUnit;
	Unit timeUnit;

	MeasureSystemSettingDTO({
		this.version,
		this.cursorType = CursorTypeEnum.CursorType1Icon,
		this.cursorSize = 0,
		this.shapeCursorSize = 0,
		this.cursorColor,
		this.showResultWindow = false,
		this.showResultLocation = 0,
		this.fontSize = 0,
		this.showCursorLine = false,
		this.holdMeasureLine = false,
		this.showDepthGuideline = false,
		this.showBriefAnnotation = false,
		this.minCursorDistance,
		this.autoSnapDistance,
		this.annotationFontSize = 0,
		this.showProtocolInWorkSheet = false,
		this.showAnnotation = false,
		this.distanceUnit = Unit.None,
		this.areaUnit = Unit.None,
		this.velocityUnit = Unit.None,
		this.timeUnit = Unit.None,
	});

	factory MeasureSystemSettingDTO.fromJson(Map<String, dynamic> map) {
		return MeasureSystemSettingDTO( 
			version: map['Version'],
			cursorType: CursorTypeEnum.values.firstWhere((e) => e.index == map['CursorType']),
			cursorSize: map['CursorSize'],
			shapeCursorSize: map['ShapeCursorSize'],
			cursorColor: map['CursorColor'],
			showResultWindow: map['ShowResultWindow'],
			showResultLocation: map['ShowResultLocation'],
			fontSize: map['FontSize'],
			showCursorLine: map['ShowCursorLine'],
			holdMeasureLine: map['HoldMeasureLine'],
			showDepthGuideline: map['ShowDepthGuideline'],
			showBriefAnnotation: map['ShowBriefAnnotation'],
			minCursorDistance: map['MinCursorDistance'],
			autoSnapDistance: map['AutoSnapDistance'],
			annotationFontSize: map['AnnotationFontSize'],
			showProtocolInWorkSheet: map['ShowProtocolInWorkSheet'],
			showAnnotation: map['ShowAnnotation'],
			distanceUnit: Unit.values.firstWhere((e) => e.index == map['DistanceUnit']),
			areaUnit: Unit.values.firstWhere((e) => e.index == map['AreaUnit']),
			velocityUnit: Unit.values.firstWhere((e) => e.index == map['VelocityUnit']),
			timeUnit: Unit.values.firstWhere((e) => e.index == map['TimeUnit']),
		);
	}

	Map<String, dynamic> toJson() {
		final map = Map<String, dynamic>();
		if (version != null) {
			map['Version'] = version;
		}
		map['CursorType'] = cursorType.index;
		map['CursorSize'] = cursorSize;
		map['ShapeCursorSize'] = shapeCursorSize;
		if (cursorColor != null) {
			map['CursorColor'] = cursorColor;
		}
		map['ShowResultWindow'] = showResultWindow;
		map['ShowResultLocation'] = showResultLocation;
		map['FontSize'] = fontSize;
		map['ShowCursorLine'] = showCursorLine;
		map['HoldMeasureLine'] = holdMeasureLine;
		map['ShowDepthGuideline'] = showDepthGuideline;
		map['ShowBriefAnnotation'] = showBriefAnnotation;
		if (minCursorDistance != null) {
			map['MinCursorDistance'] = minCursorDistance;
		}
		if (autoSnapDistance != null) {
			map['AutoSnapDistance'] = autoSnapDistance;
		}
		map['AnnotationFontSize'] = annotationFontSize;
		map['ShowProtocolInWorkSheet'] = showProtocolInWorkSheet;
		map['ShowAnnotation'] = showAnnotation;
		map['DistanceUnit'] = distanceUnit.index;
		map['AreaUnit'] = areaUnit.index;
		map['VelocityUnit'] = velocityUnit.index;
		map['TimeUnit'] = timeUnit.index;
		return map;
	}
}

class GetMeasureSystemSettingRequest extends TokenRequest{

	GetMeasureSystemSettingRequest({
		String? token,
	}) : super(
			token: token,
		);

	factory GetMeasureSystemSettingRequest.fromJson(Map<String, dynamic> map) {
		return GetMeasureSystemSettingRequest( 
			token: map['Token'],
		);
	}

	Map<String, dynamic> toJson() {
		final map = super.toJson();
		return map;
	}
}

class SaveMeasureSystemSettingRequest extends TokenRequest{
	MeasureSystemSettingDTO? systemSetting;

	SaveMeasureSystemSettingRequest({
		this.systemSetting,
		String? token,
	}) : super(
			token: token,
		);

	factory SaveMeasureSystemSettingRequest.fromJson(Map<String, dynamic> map) {
		return SaveMeasureSystemSettingRequest( 
			systemSetting: map['SystemSetting'] != null ? MeasureSystemSettingDTO.fromJson(map['SystemSetting']) : null,
			token: map['Token'],
		);
	}

	Map<String, dynamic> toJson() {
		final map = super.toJson();
		if (systemSetting != null)
			map['SystemSetting'] = systemSetting;
		return map;
	}
}

enum RecordCreateTypeEnum {
	Reservation,
	Normal,
}

class RecordInfoDTO extends BaseDTO{
	String? recordCode;
	String? patientCode;
	String? deviceCode;
	RecordStatusEnum recordStatus;
	String? creatorCode;
	String? tags;
	RecordCreateTypeEnum createType;
	List<DataItemDTO>? patientInfo;
	List<PatientInfoExt>? patientInfoExtList;
	String? devicePatientID;
	String? patientType;
	List<String>? readUsers;
	String? rootOrganizationCode;
	String? organizationCode;
	List<String>? associatedExamCodes;
	DiagnosisStatusEnum diagnosisStatus;
	List<DiagnosisInfoDTO>? diagnosisInfos;
	bool isCollecting;
	DateTime? startCollectingTime;
	bool isUserReport;
	bool isReferral;
	bool isFromDicom;
	String? customDoctor;
	String? customOrganzation;
	String? equipmentSN;
	DateTime? examTime;
	String? deviceExamId;
	bool isImgQualityControlled;
	bool isReportQualityControlled;
	double imgScore;
	double reportScore;
	bool isQualityControlled;
	double score;

	RecordInfoDTO({
		this.recordCode,
		this.patientCode,
		this.deviceCode,
		this.recordStatus = RecordStatusEnum.NotScanned,
		this.creatorCode,
		this.tags,
		this.createType = RecordCreateTypeEnum.Reservation,
		this.patientInfo,
		this.patientInfoExtList,
		this.devicePatientID,
		this.patientType,
		this.readUsers,
		this.rootOrganizationCode,
		this.organizationCode,
		this.associatedExamCodes,
		this.diagnosisStatus = DiagnosisStatusEnum.NotRequired,
		this.diagnosisInfos,
		this.isCollecting = false,
		this.startCollectingTime,
		this.isUserReport = false,
		this.isReferral = false,
		this.isFromDicom = false,
		this.customDoctor,
		this.customOrganzation,
		this.equipmentSN,
		this.examTime,
		this.deviceExamId,
		this.isImgQualityControlled = false,
		this.isReportQualityControlled = false,
		this.imgScore = 0,
		this.reportScore = 0,
		this.isQualityControlled = false,
		this.score = 0,
		DateTime? createTime,
		DateTime? updateTime,
	}) : super(
			createTime: createTime,
			updateTime: updateTime,
		);

	factory RecordInfoDTO.fromJson(Map<String, dynamic> map) {
		return RecordInfoDTO( 
			recordCode: map['RecordCode'],
			patientCode: map['PatientCode'],
			deviceCode: map['DeviceCode'],
			recordStatus: RecordStatusEnum.values.firstWhere((e) => e.index == map['RecordStatus']),
			creatorCode: map['CreatorCode'],
			tags: map['Tags'],
			createType: RecordCreateTypeEnum.values.firstWhere((e) => e.index == map['CreateType']),
			patientInfo: map['PatientInfo'] != null ? (map['PatientInfo'] as List).map((e)=>DataItemDTO.fromJson(e as Map<String,dynamic>)).toList() : null,
			patientInfoExtList: map['PatientInfoExtList'] != null ? (map['PatientInfoExtList'] as List).map((e)=>PatientInfoExt.fromJson(e as Map<String,dynamic>)).toList() : null,
			devicePatientID: map['DevicePatientID'],
			patientType: map['PatientType'],
			readUsers: map['ReadUsers']?.cast<String>().toList(),
			rootOrganizationCode: map['RootOrganizationCode'],
			organizationCode: map['OrganizationCode'],
			associatedExamCodes: map['AssociatedExamCodes']?.cast<String>().toList(),
			diagnosisStatus: DiagnosisStatusEnum.values.firstWhere((e) => e.index == map['DiagnosisStatus']),
			diagnosisInfos: map['DiagnosisInfos'] != null ? (map['DiagnosisInfos'] as List).map((e)=>DiagnosisInfoDTO.fromJson(e as Map<String,dynamic>)).toList() : null,
			isCollecting: map['IsCollecting'],
			startCollectingTime: map['StartCollectingTime'] != null ? DateTime.parse(map['StartCollectingTime']) : null,
			isUserReport: map['IsUserReport'],
			isReferral: map['IsReferral'],
			isFromDicom: map['IsFromDicom'],
			customDoctor: map['CustomDoctor'],
			customOrganzation: map['CustomOrganzation'],
			equipmentSN: map['EquipmentSN'],
			examTime: map['ExamTime'] != null ? DateTime.parse(map['ExamTime']) : null,
			deviceExamId: map['DeviceExamId'],
			isImgQualityControlled: map['IsImgQualityControlled'],
			isReportQualityControlled: map['IsReportQualityControlled'],
			imgScore: double.parse(map['ImgScore'].toString()),
			reportScore: double.parse(map['ReportScore'].toString()),
			isQualityControlled: map['IsQualityControlled'],
			score: double.parse(map['Score'].toString()),
			createTime: map['CreateTime'] != null ? DateTime.parse(map['CreateTime']) : null,
			updateTime: map['UpdateTime'] != null ? DateTime.parse(map['UpdateTime']) : null,
		);
	}

	Map<String, dynamic> toJson() {
		final map = super.toJson();
		if (recordCode != null)
			map['RecordCode'] = recordCode;
		if (patientCode != null)
			map['PatientCode'] = patientCode;
		if (deviceCode != null)
			map['DeviceCode'] = deviceCode;
		map['RecordStatus'] = recordStatus.index;
		if (creatorCode != null)
			map['CreatorCode'] = creatorCode;
		if (tags != null)
			map['Tags'] = tags;
		map['CreateType'] = createType.index;
		if (patientInfo != null)
			map['PatientInfo'] = patientInfo;
		if (patientInfoExtList != null)
			map['PatientInfoExtList'] = patientInfoExtList;
		if (devicePatientID != null)
			map['DevicePatientID'] = devicePatientID;
		if (patientType != null)
			map['PatientType'] = patientType;
		if (readUsers != null)
			map['ReadUsers'] = readUsers;
		if (rootOrganizationCode != null)
			map['RootOrganizationCode'] = rootOrganizationCode;
		if (organizationCode != null)
			map['OrganizationCode'] = organizationCode;
		if (associatedExamCodes != null)
			map['AssociatedExamCodes'] = associatedExamCodes;
		map['DiagnosisStatus'] = diagnosisStatus.index;
		if (diagnosisInfos != null)
			map['DiagnosisInfos'] = diagnosisInfos;
		map['IsCollecting'] = isCollecting;
		if (startCollectingTime != null)
			map['StartCollectingTime'] = JsonRpcUtils.dateFormat(startCollectingTime!);
		map['IsUserReport'] = isUserReport;
		map['IsReferral'] = isReferral;
		map['IsFromDicom'] = isFromDicom;
		if (customDoctor != null)
			map['CustomDoctor'] = customDoctor;
		if (customOrganzation != null)
			map['CustomOrganzation'] = customOrganzation;
		if (equipmentSN != null)
			map['EquipmentSN'] = equipmentSN;
		if (examTime != null)
			map['ExamTime'] = JsonRpcUtils.dateFormat(examTime!);
		if (deviceExamId != null)
			map['DeviceExamId'] = deviceExamId;
		map['IsImgQualityControlled'] = isImgQualityControlled;
		map['IsReportQualityControlled'] = isReportQualityControlled;
		map['ImgScore'] = imgScore;
		map['ReportScore'] = reportScore;
		map['IsQualityControlled'] = isQualityControlled;
		map['Score'] = score;
		return map;
	}
}

class RecordData {
	String? patientName;
	String? patientCode;
	List<RecordInfoDTO>? recordItemList;

	RecordData({
		this.patientName,
		this.patientCode,
		this.recordItemList,
	});

	factory RecordData.fromJson(Map<String, dynamic> map) {
		return RecordData( 
			patientName: map['PatientName'],
			patientCode: map['PatientCode'],
			recordItemList: map['RecordItemList'] != null ? (map['RecordItemList'] as List).map((e)=>RecordInfoDTO.fromJson(e as Map<String,dynamic>)).toList() : null,
		);
	}

	Map<String, dynamic> toJson() {
		final map = Map<String, dynamic>();
		if (patientName != null) {
			map['PatientName'] = patientName;
		}
		if (patientCode != null) {
			map['PatientCode'] = patientCode;
		}
		if (recordItemList != null) {
			map['RecordItemList'] = recordItemList;
		}
		return map;
	}
}

class ReportItem {
	String? recordCode;
	String? reportCode;
	String? fileToken;
	DateTime? createTime;
	DateTime? reportTime;

	ReportItem({
		this.recordCode,
		this.reportCode,
		this.fileToken,
		this.createTime,
		this.reportTime,
	});

	factory ReportItem.fromJson(Map<String, dynamic> map) {
		return ReportItem( 
			recordCode: map['RecordCode'],
			reportCode: map['ReportCode'],
			fileToken: map['FileToken'],
			createTime: map['CreateTime'] != null ? DateTime.parse(map['CreateTime']) : null,
			reportTime: map['ReportTime'] != null ? DateTime.parse(map['ReportTime']) : null,
		);
	}

	Map<String, dynamic> toJson() {
		final map = Map<String, dynamic>();
		if (recordCode != null) {
			map['RecordCode'] = recordCode;
		}
		if (reportCode != null) {
			map['ReportCode'] = reportCode;
		}
		if (fileToken != null) {
			map['FileToken'] = fileToken;
		}
		if (createTime != null) {
			map['CreateTime'] = JsonRpcUtils.dateFormat(createTime!);
		}
		if (reportTime != null) {
			map['ReportTime'] = JsonRpcUtils.dateFormat(reportTime!);
		}
		return map;
	}
}

class ReportData {
	String? patientName;
	String? patientCode;
	List<ReportItem>? reportItemList;

	ReportData({
		this.patientName,
		this.patientCode,
		this.reportItemList,
	});

	factory ReportData.fromJson(Map<String, dynamic> map) {
		return ReportData( 
			patientName: map['PatientName'],
			patientCode: map['PatientCode'],
			reportItemList: map['ReportItemList'] != null ? (map['ReportItemList'] as List).map((e)=>ReportItem.fromJson(e as Map<String,dynamic>)).toList() : null,
		);
	}

	Map<String, dynamic> toJson() {
		final map = Map<String, dynamic>();
		if (patientName != null) {
			map['PatientName'] = patientName;
		}
		if (patientCode != null) {
			map['PatientCode'] = patientCode;
		}
		if (reportItemList != null) {
			map['ReportItemList'] = reportItemList;
		}
		return map;
	}
}

class RemedicalItem {
	String? recordCode;
	String? fileToken;
	RemedicalFileDataTypeEnum fileDataType;

	RemedicalItem({
		this.recordCode,
		this.fileToken,
		this.fileDataType = RemedicalFileDataTypeEnum.VinnoVidSingle,
	});

	factory RemedicalItem.fromJson(Map<String, dynamic> map) {
		return RemedicalItem( 
			recordCode: map['RecordCode'],
			fileToken: map['FileToken'],
			fileDataType: RemedicalFileDataTypeEnum.values.firstWhere((e) => e.index == map['FileDataType']),
		);
	}

	Map<String, dynamic> toJson() {
		final map = Map<String, dynamic>();
		if (recordCode != null) {
			map['RecordCode'] = recordCode;
		}
		if (fileToken != null) {
			map['FileToken'] = fileToken;
		}
		map['FileDataType'] = fileDataType.index;
		return map;
	}
}

class RemedicalData {
	String? patientName;
	String? patientCode;
	List<RemedicalItem>? remedicalItemList;

	RemedicalData({
		this.patientName,
		this.patientCode,
		this.remedicalItemList,
	});

	factory RemedicalData.fromJson(Map<String, dynamic> map) {
		return RemedicalData( 
			patientName: map['PatientName'],
			patientCode: map['PatientCode'],
			remedicalItemList: map['RemedicalItemList'] != null ? (map['RemedicalItemList'] as List).map((e)=>RemedicalItem.fromJson(e as Map<String,dynamic>)).toList() : null,
		);
	}

	Map<String, dynamic> toJson() {
		final map = Map<String, dynamic>();
		if (patientName != null) {
			map['PatientName'] = patientName;
		}
		if (patientCode != null) {
			map['PatientCode'] = patientCode;
		}
		if (remedicalItemList != null) {
			map['RemedicalItemList'] = remedicalItemList;
		}
		return map;
	}
}

class ExportRemedicalDataResult {
	List<RecordData>? recordList;
	List<ReportData>? reportList;
	List<RemedicalData>? remedicalList;

	ExportRemedicalDataResult({
		this.recordList,
		this.reportList,
		this.remedicalList,
	});

	factory ExportRemedicalDataResult.fromJson(Map<String, dynamic> map) {
		return ExportRemedicalDataResult( 
			recordList: map['RecordList'] != null ? (map['RecordList'] as List).map((e)=>RecordData.fromJson(e as Map<String,dynamic>)).toList() : null,
			reportList: map['ReportList'] != null ? (map['ReportList'] as List).map((e)=>ReportData.fromJson(e as Map<String,dynamic>)).toList() : null,
			remedicalList: map['RemedicalList'] != null ? (map['RemedicalList'] as List).map((e)=>RemedicalData.fromJson(e as Map<String,dynamic>)).toList() : null,
		);
	}

	Map<String, dynamic> toJson() {
		final map = Map<String, dynamic>();
		if (recordList != null) {
			map['RecordList'] = recordList;
		}
		if (reportList != null) {
			map['ReportList'] = reportList;
		}
		if (remedicalList != null) {
			map['RemedicalList'] = remedicalList;
		}
		return map;
	}
}

class ExportRemedicalDataRequest extends TokenRequest{
	DateTime? startTime;
	DateTime? endTime;
	bool isExportReport;
	bool isExportRecord;
	bool isExportRemedicalData;
	List<String>? patientCodes;
	String? languageCode;

	ExportRemedicalDataRequest({
		this.startTime,
		this.endTime,
		this.isExportReport = false,
		this.isExportRecord = false,
		this.isExportRemedicalData = false,
		this.patientCodes,
		this.languageCode,
		String? token,
	}) : super(
			token: token,
		);

	factory ExportRemedicalDataRequest.fromJson(Map<String, dynamic> map) {
		return ExportRemedicalDataRequest( 
			startTime: map['StartTime'] != null ? DateTime.parse(map['StartTime']) : null,
			endTime: map['EndTime'] != null ? DateTime.parse(map['EndTime']) : null,
			isExportReport: map['IsExportReport'],
			isExportRecord: map['IsExportRecord'],
			isExportRemedicalData: map['IsExportRemedicalData'],
			patientCodes: map['PatientCodes']?.cast<String>().toList(),
			languageCode: map['LanguageCode'],
			token: map['Token'],
		);
	}

	Map<String, dynamic> toJson() {
		final map = super.toJson();
		if (startTime != null)
			map['StartTime'] = JsonRpcUtils.dateFormat(startTime!);
		if (endTime != null)
			map['EndTime'] = JsonRpcUtils.dateFormat(endTime!);
		map['IsExportReport'] = isExportReport;
		map['IsExportRecord'] = isExportRecord;
		map['IsExportRemedicalData'] = isExportRemedicalData;
		if (patientCodes != null)
			map['PatientCodes'] = patientCodes;
		if (languageCode != null)
			map['LanguageCode'] = languageCode;
		return map;
	}
}

class FindCacheByCodeRequest extends TokenRequest{
	String? cacheCode;

	FindCacheByCodeRequest({
		this.cacheCode,
		String? token,
	}) : super(
			token: token,
		);

	factory FindCacheByCodeRequest.fromJson(Map<String, dynamic> map) {
		return FindCacheByCodeRequest( 
			cacheCode: map['CacheCode'],
			token: map['Token'],
		);
	}

	Map<String, dynamic> toJson() {
		final map = super.toJson();
		if (cacheCode != null)
			map['CacheCode'] = cacheCode;
		return map;
	}
}

class GetFileCompressInfoResult {
	String? thumbnailUrl;
	String? coverImgUrl;
	ImageLocationDTO? imageLocation;
	int fileSize;

	GetFileCompressInfoResult({
		this.thumbnailUrl,
		this.coverImgUrl,
		this.imageLocation,
		this.fileSize = 0,
	});

	factory GetFileCompressInfoResult.fromJson(Map<String, dynamic> map) {
		return GetFileCompressInfoResult( 
			thumbnailUrl: map['ThumbnailUrl'],
			coverImgUrl: map['CoverImgUrl'],
			imageLocation: map['ImageLocation'] != null ? ImageLocationDTO.fromJson(map['ImageLocation']) : null,
			fileSize: map['FileSize'],
		);
	}

	Map<String, dynamic> toJson() {
		final map = Map<String, dynamic>();
		if (thumbnailUrl != null) {
			map['ThumbnailUrl'] = thumbnailUrl;
		}
		if (coverImgUrl != null) {
			map['CoverImgUrl'] = coverImgUrl;
		}
		if (imageLocation != null) {
			map['ImageLocation'] = imageLocation;
		}
		map['FileSize'] = fileSize;
		return map;
	}
}

class GetFileCompressInfoRequest extends TokenRequest{
	String? fileToken;
	RemedicalFileDataTypeEnum fileDataType;
	bool isNeedThumbnailUrl;
	bool isNeedCoverImg;
	bool isNeedLocation;

	GetFileCompressInfoRequest({
		this.fileToken,
		this.fileDataType = RemedicalFileDataTypeEnum.VinnoVidSingle,
		this.isNeedThumbnailUrl = false,
		this.isNeedCoverImg = false,
		this.isNeedLocation = false,
		String? token,
	}) : super(
			token: token,
		);

	factory GetFileCompressInfoRequest.fromJson(Map<String, dynamic> map) {
		return GetFileCompressInfoRequest( 
			fileToken: map['FileToken'],
			fileDataType: RemedicalFileDataTypeEnum.values.firstWhere((e) => e.index == map['FileDataType']),
			isNeedThumbnailUrl: map['IsNeedThumbnailUrl'],
			isNeedCoverImg: map['IsNeedCoverImg'],
			isNeedLocation: map['IsNeedLocation'],
			token: map['Token'],
		);
	}

	Map<String, dynamic> toJson() {
		final map = super.toJson();
		if (fileToken != null)
			map['FileToken'] = fileToken;
		map['FileDataType'] = fileDataType.index;
		map['IsNeedThumbnailUrl'] = isNeedThumbnailUrl;
		map['IsNeedCoverImg'] = isNeedCoverImg;
		map['IsNeedLocation'] = isNeedLocation;
		return map;
	}
}

class CreateReferralRecordRequest extends TokenRequest{
	String? patientCode;
	String? subjectMatter;
	String? referralOrganizationCode;
	String? referralUserCode;
	String? referralRecordCode;

	CreateReferralRecordRequest({
		this.patientCode,
		this.subjectMatter,
		this.referralOrganizationCode,
		this.referralUserCode,
		this.referralRecordCode,
		String? token,
	}) : super(
			token: token,
		);

	factory CreateReferralRecordRequest.fromJson(Map<String, dynamic> map) {
		return CreateReferralRecordRequest( 
			patientCode: map['PatientCode'],
			subjectMatter: map['SubjectMatter'],
			referralOrganizationCode: map['ReferralOrganizationCode'],
			referralUserCode: map['ReferralUserCode'],
			referralRecordCode: map['ReferralRecordCode'],
			token: map['Token'],
		);
	}

	Map<String, dynamic> toJson() {
		final map = super.toJson();
		if (patientCode != null)
			map['PatientCode'] = patientCode;
		if (subjectMatter != null)
			map['SubjectMatter'] = subjectMatter;
		if (referralOrganizationCode != null)
			map['ReferralOrganizationCode'] = referralOrganizationCode;
		if (referralUserCode != null)
			map['ReferralUserCode'] = referralUserCode;
		if (referralRecordCode != null)
			map['ReferralRecordCode'] = referralRecordCode;
		return map;
	}
}

class ModifyReferralRecordRequest extends TokenRequest{
	String? patientCode;
	String? subjectMatter;
	String? referralOrganizationCode;
	String? referralUserCode;
	String? referralRecordCode;

	ModifyReferralRecordRequest({
		this.patientCode,
		this.subjectMatter,
		this.referralOrganizationCode,
		this.referralUserCode,
		this.referralRecordCode,
		String? token,
	}) : super(
			token: token,
		);

	factory ModifyReferralRecordRequest.fromJson(Map<String, dynamic> map) {
		return ModifyReferralRecordRequest( 
			patientCode: map['PatientCode'],
			subjectMatter: map['SubjectMatter'],
			referralOrganizationCode: map['ReferralOrganizationCode'],
			referralUserCode: map['ReferralUserCode'],
			referralRecordCode: map['ReferralRecordCode'],
			token: map['Token'],
		);
	}

	Map<String, dynamic> toJson() {
		final map = super.toJson();
		if (patientCode != null)
			map['PatientCode'] = patientCode;
		if (subjectMatter != null)
			map['SubjectMatter'] = subjectMatter;
		if (referralOrganizationCode != null)
			map['ReferralOrganizationCode'] = referralOrganizationCode;
		if (referralUserCode != null)
			map['ReferralUserCode'] = referralUserCode;
		if (referralRecordCode != null)
			map['ReferralRecordCode'] = referralRecordCode;
		return map;
	}
}

class QueryReferralRecordPageDTO extends ClientPatientInfoBaseDTO{
	String? code;
	String? outUserName;
	String? inUserName;

	QueryReferralRecordPageDTO({
		this.code,
		this.outUserName,
		this.inUserName,
		String? patientCode,
		bool isValid = false,
		List<DataItemDTO>? patientData,
		int unReadRecordCount = 0,
		bool isReferral = false,
		List<String>? devicePatientIDs,
		String? organizationCode,
		String? organizationName,
		DateTime? createTime,
		DateTime? updateTime,
	}) : super(
			patientCode: patientCode,
			isValid: isValid,
			patientData: patientData,
			unReadRecordCount: unReadRecordCount,
			isReferral: isReferral,
			devicePatientIDs: devicePatientIDs,
			organizationCode: organizationCode,
			organizationName: organizationName,
			createTime: createTime,
			updateTime: updateTime,
		);

	factory QueryReferralRecordPageDTO.fromJson(Map<String, dynamic> map) {
		return QueryReferralRecordPageDTO( 
			code: map['Code'],
			outUserName: map['OutUserName'],
			inUserName: map['InUserName'],
			patientCode: map['PatientCode'],
			isValid: map['IsValid'],
			patientData: map['PatientData'] != null ? (map['PatientData'] as List).map((e)=>DataItemDTO.fromJson(e as Map<String,dynamic>)).toList() : null,
			unReadRecordCount: map['UnReadRecordCount'],
			isReferral: map['IsReferral'],
			devicePatientIDs: map['DevicePatientIDs']?.cast<String>().toList(),
			organizationCode: map['OrganizationCode'],
			organizationName: map['OrganizationName'],
			createTime: map['CreateTime'] != null ? DateTime.parse(map['CreateTime']) : null,
			updateTime: map['UpdateTime'] != null ? DateTime.parse(map['UpdateTime']) : null,
		);
	}

	Map<String, dynamic> toJson() {
		final map = super.toJson();
		if (code != null)
			map['Code'] = code;
		if (outUserName != null)
			map['OutUserName'] = outUserName;
		if (inUserName != null)
			map['InUserName'] = inUserName;
		return map;
	}
}

class QueryReferralRecordListRequest extends PageRequest{
	String? keyWord;
	DateTime? startTime;
	DateTime? endTime;
	PatientValidStatusEnum isValid;

	QueryReferralRecordListRequest({
		this.keyWord,
		this.startTime,
		this.endTime,
		this.isValid = PatientValidStatusEnum.All,
		int pageIndex = 0,
		int pageSize = 0,
		String? token,
	}) : super(
			pageIndex: pageIndex,
			pageSize: pageSize,
			token: token,
		);

	factory QueryReferralRecordListRequest.fromJson(Map<String, dynamic> map) {
		return QueryReferralRecordListRequest( 
			keyWord: map['KeyWord'],
			startTime: map['StartTime'] != null ? DateTime.parse(map['StartTime']) : null,
			endTime: map['EndTime'] != null ? DateTime.parse(map['EndTime']) : null,
			isValid: PatientValidStatusEnum.values.firstWhere((e) => e.index == map['IsValid']),
			pageIndex: map['PageIndex'],
			pageSize: map['PageSize'],
			token: map['Token'],
		);
	}

	Map<String, dynamic> toJson() {
		final map = super.toJson();
		if (keyWord != null)
			map['KeyWord'] = keyWord;
		if (startTime != null)
			map['StartTime'] = JsonRpcUtils.dateFormat(startTime!);
		if (endTime != null)
			map['EndTime'] = JsonRpcUtils.dateFormat(endTime!);
		map['IsValid'] = isValid.index;
		return map;
	}
}

class AuditReferralRecordRequest extends TokenRequest{
	String? referralRecordCode;
	bool isReceive;
	String? rejectReason;

	AuditReferralRecordRequest({
		this.referralRecordCode,
		this.isReceive = false,
		this.rejectReason,
		String? token,
	}) : super(
			token: token,
		);

	factory AuditReferralRecordRequest.fromJson(Map<String, dynamic> map) {
		return AuditReferralRecordRequest( 
			referralRecordCode: map['ReferralRecordCode'],
			isReceive: map['IsReceive'],
			rejectReason: map['RejectReason'],
			token: map['Token'],
		);
	}

	Map<String, dynamic> toJson() {
		final map = super.toJson();
		if (referralRecordCode != null)
			map['ReferralRecordCode'] = referralRecordCode;
		map['IsReceive'] = isReceive;
		if (rejectReason != null)
			map['RejectReason'] = rejectReason;
		return map;
	}
}

class WithdrawReferralRecordRequest extends TokenRequest{
	String? referralRecordCode;

	WithdrawReferralRecordRequest({
		this.referralRecordCode,
		String? token,
	}) : super(
			token: token,
		);

	factory WithdrawReferralRecordRequest.fromJson(Map<String, dynamic> map) {
		return WithdrawReferralRecordRequest( 
			referralRecordCode: map['ReferralRecordCode'],
			token: map['Token'],
		);
	}

	Map<String, dynamic> toJson() {
		final map = super.toJson();
		if (referralRecordCode != null)
			map['ReferralRecordCode'] = referralRecordCode;
		return map;
	}
}

class ReferralOrganizationsQueryRequest extends TokenRequest{
	String? keyword;

	ReferralOrganizationsQueryRequest({
		this.keyword,
		String? token,
	}) : super(
			token: token,
		);

	factory ReferralOrganizationsQueryRequest.fromJson(Map<String, dynamic> map) {
		return ReferralOrganizationsQueryRequest( 
			keyword: map['Keyword'],
			token: map['Token'],
		);
	}

	Map<String, dynamic> toJson() {
		final map = super.toJson();
		if (keyword != null)
			map['Keyword'] = keyword;
		return map;
	}
}

class QueryReferralPatientByCodeRequest extends FindPatientByCodeRequest{
	String? referralRecordCode;

	QueryReferralPatientByCodeRequest({
		this.referralRecordCode,
		String? code,
		String? token,
	}) : super(
			code: code,
			token: token,
		);

	factory QueryReferralPatientByCodeRequest.fromJson(Map<String, dynamic> map) {
		return QueryReferralPatientByCodeRequest( 
			referralRecordCode: map['ReferralRecordCode'],
			code: map['Code'],
			token: map['Token'],
		);
	}

	Map<String, dynamic> toJson() {
		final map = super.toJson();
		if (referralRecordCode != null)
			map['ReferralRecordCode'] = referralRecordCode;
		return map;
	}
}

class CreateReportClass {
	String? referralCode;
	String? creatorCode;
	String? reportCode;

	CreateReportClass({
		this.referralCode,
		this.creatorCode,
		this.reportCode,
	});

	factory CreateReportClass.fromJson(Map<String, dynamic> map) {
		return CreateReportClass( 
			referralCode: map['ReferralCode'],
			creatorCode: map['CreatorCode'],
			reportCode: map['ReportCode'],
		);
	}

	Map<String, dynamic> toJson() {
		final map = Map<String, dynamic>();
		if (referralCode != null) {
			map['ReferralCode'] = referralCode;
		}
		if (creatorCode != null) {
			map['CreatorCode'] = creatorCode;
		}
		if (reportCode != null) {
			map['ReportCode'] = reportCode;
		}
		return map;
	}
}

class ReferralRecordDTO extends BaseDTO{
	String? code;
	String? patientCode;
	DateTime? referralOutTime;
	String? referralOutOrganizationCode;
	String? subjectMatter;
	String? creator;
	String? referralInOrganizationCode;
	String? referralInUserCode;
	ReferralStatusEnum referralStatus;
	String? rejectReason;
	List<String>? referralCodeList;
	PatientInfoDTO? patientInfo;
	List<String>? recordCodeList;
	List<String>? reportCodeList;
	List<String>? remedicalDataCodeList;
	List<CreateReportClass>? createReportCodeList;

	ReferralRecordDTO({
		this.code,
		this.patientCode,
		this.referralOutTime,
		this.referralOutOrganizationCode,
		this.subjectMatter,
		this.creator,
		this.referralInOrganizationCode,
		this.referralInUserCode,
		this.referralStatus = ReferralStatusEnum.Wait,
		this.rejectReason,
		this.referralCodeList,
		this.patientInfo,
		this.recordCodeList,
		this.reportCodeList,
		this.remedicalDataCodeList,
		this.createReportCodeList,
		DateTime? createTime,
		DateTime? updateTime,
	}) : super(
			createTime: createTime,
			updateTime: updateTime,
		);

	factory ReferralRecordDTO.fromJson(Map<String, dynamic> map) {
		return ReferralRecordDTO( 
			code: map['Code'],
			patientCode: map['PatientCode'],
			referralOutTime: map['ReferralOutTime'] != null ? DateTime.parse(map['ReferralOutTime']) : null,
			referralOutOrganizationCode: map['ReferralOutOrganizationCode'],
			subjectMatter: map['SubjectMatter'],
			creator: map['Creator'],
			referralInOrganizationCode: map['ReferralInOrganizationCode'],
			referralInUserCode: map['ReferralInUserCode'],
			referralStatus: ReferralStatusEnum.values.firstWhere((e) => e.index == map['ReferralStatus']),
			rejectReason: map['RejectReason'],
			referralCodeList: map['ReferralCodeList']?.cast<String>().toList(),
			patientInfo: map['PatientInfo'] != null ? PatientInfoDTO.fromJson(map['PatientInfo']) : null,
			recordCodeList: map['RecordCodeList']?.cast<String>().toList(),
			reportCodeList: map['ReportCodeList']?.cast<String>().toList(),
			remedicalDataCodeList: map['RemedicalDataCodeList']?.cast<String>().toList(),
			createReportCodeList: map['CreateReportCodeList'] != null ? (map['CreateReportCodeList'] as List).map((e)=>CreateReportClass.fromJson(e as Map<String,dynamic>)).toList() : null,
			createTime: map['CreateTime'] != null ? DateTime.parse(map['CreateTime']) : null,
			updateTime: map['UpdateTime'] != null ? DateTime.parse(map['UpdateTime']) : null,
		);
	}

	Map<String, dynamic> toJson() {
		final map = super.toJson();
		if (code != null)
			map['Code'] = code;
		if (patientCode != null)
			map['PatientCode'] = patientCode;
		if (referralOutTime != null)
			map['ReferralOutTime'] = JsonRpcUtils.dateFormat(referralOutTime!);
		if (referralOutOrganizationCode != null)
			map['ReferralOutOrganizationCode'] = referralOutOrganizationCode;
		if (subjectMatter != null)
			map['SubjectMatter'] = subjectMatter;
		if (creator != null)
			map['Creator'] = creator;
		if (referralInOrganizationCode != null)
			map['ReferralInOrganizationCode'] = referralInOrganizationCode;
		if (referralInUserCode != null)
			map['ReferralInUserCode'] = referralInUserCode;
		map['ReferralStatus'] = referralStatus.index;
		if (rejectReason != null)
			map['RejectReason'] = rejectReason;
		if (referralCodeList != null)
			map['ReferralCodeList'] = referralCodeList;
		if (patientInfo != null)
			map['PatientInfo'] = patientInfo;
		if (recordCodeList != null)
			map['RecordCodeList'] = recordCodeList;
		if (reportCodeList != null)
			map['ReportCodeList'] = reportCodeList;
		if (remedicalDataCodeList != null)
			map['RemedicalDataCodeList'] = remedicalDataCodeList;
		if (createReportCodeList != null)
			map['CreateReportCodeList'] = createReportCodeList;
		return map;
	}
}

class ReferralRecordDetailDTO extends ReferralRecordDTO{
	String? referralOutOrganizationName;
	String? creatorName;
	String? referralInOrganizationName;
	String? referralInUserName;

	ReferralRecordDetailDTO({
		this.referralOutOrganizationName,
		this.creatorName,
		this.referralInOrganizationName,
		this.referralInUserName,
		String? code,
		String? patientCode,
		DateTime? referralOutTime,
		String? referralOutOrganizationCode,
		String? subjectMatter,
		String? creator,
		String? referralInOrganizationCode,
		String? referralInUserCode,
		ReferralStatusEnum referralStatus = ReferralStatusEnum.Wait,
		String? rejectReason,
		List<String>? referralCodeList,
		PatientInfoDTO? patientInfo,
		List<String>? recordCodeList,
		List<String>? reportCodeList,
		List<String>? remedicalDataCodeList,
		List<CreateReportClass>? createReportCodeList,
		DateTime? createTime,
		DateTime? updateTime,
	}) : super(
			code: code,
			patientCode: patientCode,
			referralOutTime: referralOutTime,
			referralOutOrganizationCode: referralOutOrganizationCode,
			subjectMatter: subjectMatter,
			creator: creator,
			referralInOrganizationCode: referralInOrganizationCode,
			referralInUserCode: referralInUserCode,
			referralStatus: referralStatus,
			rejectReason: rejectReason,
			referralCodeList: referralCodeList,
			patientInfo: patientInfo,
			recordCodeList: recordCodeList,
			reportCodeList: reportCodeList,
			remedicalDataCodeList: remedicalDataCodeList,
			createReportCodeList: createReportCodeList,
			createTime: createTime,
			updateTime: updateTime,
		);

	factory ReferralRecordDetailDTO.fromJson(Map<String, dynamic> map) {
		return ReferralRecordDetailDTO( 
			referralOutOrganizationName: map['ReferralOutOrganizationName'],
			creatorName: map['CreatorName'],
			referralInOrganizationName: map['ReferralInOrganizationName'],
			referralInUserName: map['ReferralInUserName'],
			code: map['Code'],
			patientCode: map['PatientCode'],
			referralOutTime: map['ReferralOutTime'] != null ? DateTime.parse(map['ReferralOutTime']) : null,
			referralOutOrganizationCode: map['ReferralOutOrganizationCode'],
			subjectMatter: map['SubjectMatter'],
			creator: map['Creator'],
			referralInOrganizationCode: map['ReferralInOrganizationCode'],
			referralInUserCode: map['ReferralInUserCode'],
			referralStatus: ReferralStatusEnum.values.firstWhere((e) => e.index == map['ReferralStatus']),
			rejectReason: map['RejectReason'],
			referralCodeList: map['ReferralCodeList']?.cast<String>().toList(),
			patientInfo: map['PatientInfo'] != null ? PatientInfoDTO.fromJson(map['PatientInfo']) : null,
			recordCodeList: map['RecordCodeList']?.cast<String>().toList(),
			reportCodeList: map['ReportCodeList']?.cast<String>().toList(),
			remedicalDataCodeList: map['RemedicalDataCodeList']?.cast<String>().toList(),
			createReportCodeList: map['CreateReportCodeList'] != null ? (map['CreateReportCodeList'] as List).map((e)=>CreateReportClass.fromJson(e as Map<String,dynamic>)).toList() : null,
			createTime: map['CreateTime'] != null ? DateTime.parse(map['CreateTime']) : null,
			updateTime: map['UpdateTime'] != null ? DateTime.parse(map['UpdateTime']) : null,
		);
	}

	Map<String, dynamic> toJson() {
		final map = super.toJson();
		if (referralOutOrganizationName != null)
			map['ReferralOutOrganizationName'] = referralOutOrganizationName;
		if (creatorName != null)
			map['CreatorName'] = creatorName;
		if (referralInOrganizationName != null)
			map['ReferralInOrganizationName'] = referralInOrganizationName;
		if (referralInUserName != null)
			map['ReferralInUserName'] = referralInUserName;
		return map;
	}
}

class FindPatientReferralRecordRequest extends TokenRequest{
	String? patientCode;

	FindPatientReferralRecordRequest({
		this.patientCode,
		String? token,
	}) : super(
			token: token,
		);

	factory FindPatientReferralRecordRequest.fromJson(Map<String, dynamic> map) {
		return FindPatientReferralRecordRequest( 
			patientCode: map['PatientCode'],
			token: map['Token'],
		);
	}

	Map<String, dynamic> toJson() {
		final map = super.toJson();
		if (patientCode != null)
			map['PatientCode'] = patientCode;
		return map;
	}
}

class FindReferralInRecordRequest extends TokenRequest{
	String? referralRecordCode;

	FindReferralInRecordRequest({
		this.referralRecordCode,
		String? token,
	}) : super(
			token: token,
		);

	factory FindReferralInRecordRequest.fromJson(Map<String, dynamic> map) {
		return FindReferralInRecordRequest( 
			referralRecordCode: map['ReferralRecordCode'],
			token: map['Token'],
		);
	}

	Map<String, dynamic> toJson() {
		final map = super.toJson();
		if (referralRecordCode != null)
			map['ReferralRecordCode'] = referralRecordCode;
		return map;
	}
}

class QueryReferralRecordsPageRequest extends GetRecordsPageRequest{
	String? referralRecordCode;

	QueryReferralRecordsPageRequest({
		this.referralRecordCode,
		String? patientCode,
		QueryRecordStatusEnum queryRecordStatus = QueryRecordStatusEnum.All,
		QueryRecordCreateTypeEnum queryRecordCreateType = QueryRecordCreateTypeEnum.All,
		int pageIndex = 0,
		int pageSize = 0,
		String? token,
	}) : super(
			patientCode: patientCode,
			queryRecordStatus: queryRecordStatus,
			queryRecordCreateType: queryRecordCreateType,
			pageIndex: pageIndex,
			pageSize: pageSize,
			token: token,
		);

	factory QueryReferralRecordsPageRequest.fromJson(Map<String, dynamic> map) {
		return QueryReferralRecordsPageRequest( 
			referralRecordCode: map['ReferralRecordCode'],
			patientCode: map['PatientCode'],
			queryRecordStatus: QueryRecordStatusEnum.values.firstWhere((e) => e.index == map['QueryRecordStatus']),
			queryRecordCreateType: QueryRecordCreateTypeEnum.values.firstWhere((e) => e.index == map['QueryRecordCreateType']),
			pageIndex: map['PageIndex'],
			pageSize: map['PageSize'],
			token: map['Token'],
		);
	}

	Map<String, dynamic> toJson() {
		final map = super.toJson();
		if (referralRecordCode != null)
			map['ReferralRecordCode'] = referralRecordCode;
		return map;
	}
}

class ReportPreviewDTO {
	String? fileToken;
	String? thumbnailToken;
	String? language;
	UploadFileTypeEnum fileType;

	ReportPreviewDTO({
		this.fileToken,
		this.thumbnailToken,
		this.language,
		this.fileType = UploadFileTypeEnum.Unknown,
	});

	factory ReportPreviewDTO.fromJson(Map<String, dynamic> map) {
		return ReportPreviewDTO( 
			fileToken: map['FileToken'],
			thumbnailToken: map['ThumbnailToken'],
			language: map['Language'],
			fileType: UploadFileTypeEnum.values.firstWhere((e) => e.index == map['FileType']),
		);
	}

	Map<String, dynamic> toJson() {
		final map = Map<String, dynamic>();
		if (fileToken != null) {
			map['FileToken'] = fileToken;
		}
		if (thumbnailToken != null) {
			map['ThumbnailToken'] = thumbnailToken;
		}
		if (language != null) {
			map['Language'] = language;
		}
		map['FileType'] = fileType.index;
		return map;
	}
}

enum ReportTypeEnum {
	RemoteDiagnosis,
	LiveConsultation,
}

class ReportBaseDTO extends BaseDTO{
	String? reportCode;
	String? recordCode;
	String? reportUserCode;
	String? deviceCode;
	String? patientCode;
	String? patientId;
	String? patientName;
	List<String>? reportLabels;
	List<String>? platformLabels;
	List<String>? diagnosisLabels;
	DiagnosisOrganEnum reportOrgan;
	DateTime? reportTime;
	String? reportUserName;
	List<ReportPreviewDTO>? reportPreviewList;
	String? referralRecordCode;
	ReportTypeEnum reportType;
	bool isReferral;
	QualityType qualityType;
	QualifiedState qualifiedState;
	ReportQualityControl? qualityControlDatas;
	bool isQualityControlled;

	ReportBaseDTO({
		this.reportCode,
		this.recordCode,
		this.reportUserCode,
		this.deviceCode,
		this.patientCode,
		this.patientId,
		this.patientName,
		this.reportLabels,
		this.platformLabels,
		this.diagnosisLabels,
		this.reportOrgan = DiagnosisOrganEnum.Null,
		this.reportTime,
		this.reportUserName,
		this.reportPreviewList,
		this.referralRecordCode,
		this.reportType = ReportTypeEnum.RemoteDiagnosis,
		this.isReferral = false,
		this.qualityType = QualityType.None,
		this.qualifiedState = QualifiedState.UnSet,
		this.qualityControlDatas,
		this.isQualityControlled = false,
		DateTime? createTime,
		DateTime? updateTime,
	}) : super(
			createTime: createTime,
			updateTime: updateTime,
		);

	factory ReportBaseDTO.fromJson(Map<String, dynamic> map) {
		return ReportBaseDTO( 
			reportCode: map['ReportCode'],
			recordCode: map['RecordCode'],
			reportUserCode: map['ReportUserCode'],
			deviceCode: map['DeviceCode'],
			patientCode: map['PatientCode'],
			patientId: map['PatientId'],
			patientName: map['PatientName'],
			reportLabels: map['ReportLabels']?.cast<String>().toList(),
			platformLabels: map['PlatformLabels']?.cast<String>().toList(),
			diagnosisLabels: map['DiagnosisLabels']?.cast<String>().toList(),
			reportOrgan: DiagnosisOrganEnum.values.firstWhere((e) => e.index == map['ReportOrgan']),
			reportTime: map['ReportTime'] != null ? DateTime.parse(map['ReportTime']) : null,
			reportUserName: map['ReportUserName'],
			reportPreviewList: map['ReportPreviewList'] != null ? (map['ReportPreviewList'] as List).map((e)=>ReportPreviewDTO.fromJson(e as Map<String,dynamic>)).toList() : null,
			referralRecordCode: map['ReferralRecordCode'],
			reportType: ReportTypeEnum.values.firstWhere((e) => e.index == map['ReportType']),
			isReferral: map['IsReferral'],
			qualityType: QualityType.values.firstWhere((e) => e.index == map['QualityType']),
			qualifiedState: QualifiedState.values.firstWhere((e) => e.index == map['QualifiedState']),
			qualityControlDatas: map['QualityControlDatas'] != null ? ReportQualityControl.fromJson(map['QualityControlDatas']) : null,
			isQualityControlled: map['IsQualityControlled'],
			createTime: map['CreateTime'] != null ? DateTime.parse(map['CreateTime']) : null,
			updateTime: map['UpdateTime'] != null ? DateTime.parse(map['UpdateTime']) : null,
		);
	}

	Map<String, dynamic> toJson() {
		final map = super.toJson();
		if (reportCode != null)
			map['ReportCode'] = reportCode;
		if (recordCode != null)
			map['RecordCode'] = recordCode;
		if (reportUserCode != null)
			map['ReportUserCode'] = reportUserCode;
		if (deviceCode != null)
			map['DeviceCode'] = deviceCode;
		if (patientCode != null)
			map['PatientCode'] = patientCode;
		if (patientId != null)
			map['PatientId'] = patientId;
		if (patientName != null)
			map['PatientName'] = patientName;
		if (reportLabels != null)
			map['ReportLabels'] = reportLabels;
		if (platformLabels != null)
			map['PlatformLabels'] = platformLabels;
		if (diagnosisLabels != null)
			map['DiagnosisLabels'] = diagnosisLabels;
		map['ReportOrgan'] = reportOrgan.index;
		if (reportTime != null)
			map['ReportTime'] = JsonRpcUtils.dateFormat(reportTime!);
		if (reportUserName != null)
			map['ReportUserName'] = reportUserName;
		if (reportPreviewList != null)
			map['ReportPreviewList'] = reportPreviewList;
		if (referralRecordCode != null)
			map['ReferralRecordCode'] = referralRecordCode;
		map['ReportType'] = reportType.index;
		map['IsReferral'] = isReferral;
		map['QualityType'] = qualityType.index;
		map['QualifiedState'] = qualifiedState.index;
		if (qualityControlDatas != null)
			map['QualityControlDatas'] = qualityControlDatas;
		map['IsQualityControlled'] = isQualityControlled;
		return map;
	}
}

class ReportDTO extends ReportBaseDTO{
	String? reportTemplateJson;
	String? reportDatasJson;
	String? reportMeasureDatasJson;
	String? encryptPatientName;
	bool canEditReport;
	String? deviceName;
	String? reportTemplateName;
	String? reportTemplateCode;
	DateTime? examDate;

	ReportDTO({
		this.reportTemplateJson,
		this.reportDatasJson,
		this.reportMeasureDatasJson,
		this.encryptPatientName,
		this.canEditReport = false,
		this.deviceName,
		this.reportTemplateName,
		this.reportTemplateCode,
		this.examDate,
		String? reportCode,
		String? recordCode,
		String? reportUserCode,
		String? deviceCode,
		String? patientCode,
		String? patientId,
		String? patientName,
		List<String>? reportLabels,
		List<String>? platformLabels,
		List<String>? diagnosisLabels,
		DiagnosisOrganEnum reportOrgan = DiagnosisOrganEnum.Null,
		DateTime? reportTime,
		String? reportUserName,
		List<ReportPreviewDTO>? reportPreviewList,
		String? referralRecordCode,
		ReportTypeEnum reportType = ReportTypeEnum.RemoteDiagnosis,
		bool isReferral = false,
		QualityType qualityType = QualityType.None,
		QualifiedState qualifiedState = QualifiedState.UnSet,
		ReportQualityControl? qualityControlDatas,
		bool isQualityControlled = false,
		DateTime? createTime,
		DateTime? updateTime,
	}) : super(
			reportCode: reportCode,
			recordCode: recordCode,
			reportUserCode: reportUserCode,
			deviceCode: deviceCode,
			patientCode: patientCode,
			patientId: patientId,
			patientName: patientName,
			reportLabels: reportLabels,
			platformLabels: platformLabels,
			diagnosisLabels: diagnosisLabels,
			reportOrgan: reportOrgan,
			reportTime: reportTime,
			reportUserName: reportUserName,
			reportPreviewList: reportPreviewList,
			referralRecordCode: referralRecordCode,
			reportType: reportType,
			isReferral: isReferral,
			qualityType: qualityType,
			qualifiedState: qualifiedState,
			qualityControlDatas: qualityControlDatas,
			isQualityControlled: isQualityControlled,
			createTime: createTime,
			updateTime: updateTime,
		);

	factory ReportDTO.fromJson(Map<String, dynamic> map) {
		return ReportDTO( 
			reportTemplateJson: map['ReportTemplateJson'],
			reportDatasJson: map['ReportDatasJson'],
			reportMeasureDatasJson: map['ReportMeasureDatasJson'],
			encryptPatientName: map['EncryptPatientName'],
			canEditReport: map['CanEditReport'],
			deviceName: map['DeviceName'],
			reportTemplateName: map['ReportTemplateName'],
			reportTemplateCode: map['ReportTemplateCode'],
			examDate: map['ExamDate'] != null ? DateTime.parse(map['ExamDate']) : null,
			reportCode: map['ReportCode'],
			recordCode: map['RecordCode'],
			reportUserCode: map['ReportUserCode'],
			deviceCode: map['DeviceCode'],
			patientCode: map['PatientCode'],
			patientId: map['PatientId'],
			patientName: map['PatientName'],
			reportLabels: map['ReportLabels']?.cast<String>().toList(),
			platformLabels: map['PlatformLabels']?.cast<String>().toList(),
			diagnosisLabels: map['DiagnosisLabels']?.cast<String>().toList(),
			reportOrgan: DiagnosisOrganEnum.values.firstWhere((e) => e.index == map['ReportOrgan']),
			reportTime: map['ReportTime'] != null ? DateTime.parse(map['ReportTime']) : null,
			reportUserName: map['ReportUserName'],
			reportPreviewList: map['ReportPreviewList'] != null ? (map['ReportPreviewList'] as List).map((e)=>ReportPreviewDTO.fromJson(e as Map<String,dynamic>)).toList() : null,
			referralRecordCode: map['ReferralRecordCode'],
			reportType: ReportTypeEnum.values.firstWhere((e) => e.index == map['ReportType']),
			isReferral: map['IsReferral'],
			qualityType: QualityType.values.firstWhere((e) => e.index == map['QualityType']),
			qualifiedState: QualifiedState.values.firstWhere((e) => e.index == map['QualifiedState']),
			qualityControlDatas: map['QualityControlDatas'] != null ? ReportQualityControl.fromJson(map['QualityControlDatas']) : null,
			isQualityControlled: map['IsQualityControlled'],
			createTime: map['CreateTime'] != null ? DateTime.parse(map['CreateTime']) : null,
			updateTime: map['UpdateTime'] != null ? DateTime.parse(map['UpdateTime']) : null,
		);
	}

	Map<String, dynamic> toJson() {
		final map = super.toJson();
		if (reportTemplateJson != null)
			map['ReportTemplateJson'] = reportTemplateJson;
		if (reportDatasJson != null)
			map['ReportDatasJson'] = reportDatasJson;
		if (reportMeasureDatasJson != null)
			map['ReportMeasureDatasJson'] = reportMeasureDatasJson;
		if (encryptPatientName != null)
			map['EncryptPatientName'] = encryptPatientName;
		map['CanEditReport'] = canEditReport;
		if (deviceName != null)
			map['DeviceName'] = deviceName;
		if (reportTemplateName != null)
			map['ReportTemplateName'] = reportTemplateName;
		if (reportTemplateCode != null)
			map['ReportTemplateCode'] = reportTemplateCode;
		if (examDate != null)
			map['ExamDate'] = JsonRpcUtils.dateFormat(examDate!);
		return map;
	}
}

class FindReportsRequest extends TokenRequest{
	String? recordCode;
	String? languageCode;

	FindReportsRequest({
		this.recordCode,
		this.languageCode,
		String? token,
	}) : super(
			token: token,
		);

	factory FindReportsRequest.fromJson(Map<String, dynamic> map) {
		return FindReportsRequest( 
			recordCode: map['RecordCode'],
			languageCode: map['LanguageCode'],
			token: map['Token'],
		);
	}

	Map<String, dynamic> toJson() {
		final map = super.toJson();
		if (recordCode != null)
			map['RecordCode'] = recordCode;
		if (languageCode != null)
			map['LanguageCode'] = languageCode;
		return map;
	}
}

class QueryReferralExamReportRequest extends FindReportsRequest{
	String? referralRecordCode;

	QueryReferralExamReportRequest({
		this.referralRecordCode,
		String? recordCode,
		String? languageCode,
		String? token,
	}) : super(
			recordCode: recordCode,
			languageCode: languageCode,
			token: token,
		);

	factory QueryReferralExamReportRequest.fromJson(Map<String, dynamic> map) {
		return QueryReferralExamReportRequest( 
			referralRecordCode: map['ReferralRecordCode'],
			recordCode: map['RecordCode'],
			languageCode: map['LanguageCode'],
			token: map['Token'],
		);
	}

	Map<String, dynamic> toJson() {
		final map = super.toJson();
		if (referralRecordCode != null)
			map['ReferralRecordCode'] = referralRecordCode;
		return map;
	}
}

class QueryShareExamPageResult {
	String? shareExamPageUrl;

	QueryShareExamPageResult({
		this.shareExamPageUrl,
	});

	factory QueryShareExamPageResult.fromJson(Map<String, dynamic> map) {
		return QueryShareExamPageResult( 
			shareExamPageUrl: map['ShareExamPageUrl'],
		);
	}

	Map<String, dynamic> toJson() {
		final map = Map<String, dynamic>();
		if (shareExamPageUrl != null) {
			map['ShareExamPageUrl'] = shareExamPageUrl;
		}
		return map;
	}
}

class QueryShareExamPageRequest extends TokenRequest{
	String? examFileToken;
	String? languageCode;

	QueryShareExamPageRequest({
		this.examFileToken,
		this.languageCode,
		String? token,
	}) : super(
			token: token,
		);

	factory QueryShareExamPageRequest.fromJson(Map<String, dynamic> map) {
		return QueryShareExamPageRequest( 
			examFileToken: map['ExamFileToken'],
			languageCode: map['LanguageCode'],
			token: map['Token'],
		);
	}

	Map<String, dynamic> toJson() {
		final map = super.toJson();
		if (examFileToken != null)
			map['ExamFileToken'] = examFileToken;
		if (languageCode != null)
			map['LanguageCode'] = languageCode;
		return map;
	}
}

class MeasureExportDetailDTO {
	int sortNum;
	String? remedicalMeasuredInfoCode;
	String? sourceFileToken;
	String? transferImageToken;
	String? transferMp4Token;
	bool isVideoFile;
	String? defaultLoadingToken;

	MeasureExportDetailDTO({
		this.sortNum = 0,
		this.remedicalMeasuredInfoCode,
		this.sourceFileToken,
		this.transferImageToken,
		this.transferMp4Token,
		this.isVideoFile = false,
		this.defaultLoadingToken,
	});

	factory MeasureExportDetailDTO.fromJson(Map<String, dynamic> map) {
		return MeasureExportDetailDTO( 
			sortNum: map['SortNum'],
			remedicalMeasuredInfoCode: map['RemedicalMeasuredInfoCode'],
			sourceFileToken: map['SourceFileToken'],
			transferImageToken: map['TransferImageToken'],
			transferMp4Token: map['TransferMp4Token'],
			isVideoFile: map['IsVideoFile'],
			defaultLoadingToken: map['DefaultLoadingToken'],
		);
	}

	Map<String, dynamic> toJson() {
		final map = Map<String, dynamic>();
		map['SortNum'] = sortNum;
		if (remedicalMeasuredInfoCode != null) {
			map['RemedicalMeasuredInfoCode'] = remedicalMeasuredInfoCode;
		}
		if (sourceFileToken != null) {
			map['SourceFileToken'] = sourceFileToken;
		}
		if (transferImageToken != null) {
			map['TransferImageToken'] = transferImageToken;
		}
		if (transferMp4Token != null) {
			map['TransferMp4Token'] = transferMp4Token;
		}
		map['IsVideoFile'] = isVideoFile;
		if (defaultLoadingToken != null) {
			map['DefaultLoadingToken'] = defaultLoadingToken;
		}
		return map;
	}
}

class BatchExportMeasureResultRequest extends TokenRequest{
	List<MeasureExportDetailDTO>? remedicalMeasuredInfoCodes;
	BusinessTypeEnum businessType;
	String? recordCode;
	String? languageCode;

	BatchExportMeasureResultRequest({
		this.remedicalMeasuredInfoCodes,
		this.businessType = BusinessTypeEnum.RemoteDiagnosis,
		this.recordCode,
		this.languageCode,
		String? token,
	}) : super(
			token: token,
		);

	factory BatchExportMeasureResultRequest.fromJson(Map<String, dynamic> map) {
		return BatchExportMeasureResultRequest( 
			remedicalMeasuredInfoCodes: map['RemedicalMeasuredInfoCodes'] != null ? (map['RemedicalMeasuredInfoCodes'] as List).map((e)=>MeasureExportDetailDTO.fromJson(e as Map<String,dynamic>)).toList() : null,
			businessType: BusinessTypeEnum.values.firstWhere((e) => e.index == map['BusinessType']),
			recordCode: map['RecordCode'],
			languageCode: map['LanguageCode'],
			token: map['Token'],
		);
	}

	Map<String, dynamic> toJson() {
		final map = super.toJson();
		if (remedicalMeasuredInfoCodes != null)
			map['RemedicalMeasuredInfoCodes'] = remedicalMeasuredInfoCodes;
		map['BusinessType'] = businessType.index;
		if (recordCode != null)
			map['RecordCode'] = recordCode;
		if (languageCode != null)
			map['LanguageCode'] = languageCode;
		return map;
	}
}

class GetRemedicalDiagnosisDataRequest extends TokenRequest{
	String? remedicalCode;
	int frameIndex;

	GetRemedicalDiagnosisDataRequest({
		this.remedicalCode,
		this.frameIndex = 0,
		String? token,
	}) : super(
			token: token,
		);

	factory GetRemedicalDiagnosisDataRequest.fromJson(Map<String, dynamic> map) {
		return GetRemedicalDiagnosisDataRequest( 
			remedicalCode: map['RemedicalCode'],
			frameIndex: map['FrameIndex'],
			token: map['Token'],
		);
	}

	Map<String, dynamic> toJson() {
		final map = super.toJson();
		if (remedicalCode != null)
			map['RemedicalCode'] = remedicalCode;
		map['FrameIndex'] = frameIndex;
		return map;
	}
}

class RemedicalAISelectedInfoDTO {
	String? remedicalAISelectedInfoCode;
	String? patientCode;
	String? recordCode;
	String? remedicalCode;
	int frameIndex;
	String? userCode;
	String? orginalFileToken;
	String? cdnFileToken;
	String? aIFileToken;
	String? aICdnFileToken;
	RecommendedDownloadModeEnum recommendedDownloadMode;
	String? previewFileToken;
	String? diagnosisData;
	DiagnosisConclusionEnum diagnosisConclusion;
	List<DiagnosisOrganEnum>? diagnosisOrgans;

	RemedicalAISelectedInfoDTO({
		this.remedicalAISelectedInfoCode,
		this.patientCode,
		this.recordCode,
		this.remedicalCode,
		this.frameIndex = 0,
		this.userCode,
		this.orginalFileToken,
		this.cdnFileToken,
		this.aIFileToken,
		this.aICdnFileToken,
		this.recommendedDownloadMode = RecommendedDownloadModeEnum.Origin,
		this.previewFileToken,
		this.diagnosisData,
		this.diagnosisConclusion = DiagnosisConclusionEnum.NotRequired,
		this.diagnosisOrgans,
	});

	factory RemedicalAISelectedInfoDTO.fromJson(Map<String, dynamic> map) {
		return RemedicalAISelectedInfoDTO( 
			remedicalAISelectedInfoCode: map['RemedicalAISelectedInfoCode'],
			patientCode: map['PatientCode'],
			recordCode: map['RecordCode'],
			remedicalCode: map['RemedicalCode'],
			frameIndex: map['FrameIndex'],
			userCode: map['UserCode'],
			orginalFileToken: map['OrginalFileToken'],
			cdnFileToken: map['CdnFileToken'],
			aIFileToken: map['AIFileToken'],
			aICdnFileToken: map['AICdnFileToken'],
			recommendedDownloadMode: RecommendedDownloadModeEnum.values.firstWhere((e) => e.index == map['RecommendedDownloadMode']),
			previewFileToken: map['PreviewFileToken'],
			diagnosisData: map['DiagnosisData'],
			diagnosisConclusion: DiagnosisConclusionEnum.values.firstWhere((e) => e.index == map['DiagnosisConclusion']),
			diagnosisOrgans: map['DiagnosisOrgans'] != null ? (map['DiagnosisOrgans'] as List).map((e)=>DiagnosisOrganEnum.values.firstWhere((i) => i.index == e)).toList() : null,
		);
	}

	Map<String, dynamic> toJson() {
		final map = Map<String, dynamic>();
		if (remedicalAISelectedInfoCode != null) {
			map['RemedicalAISelectedInfoCode'] = remedicalAISelectedInfoCode;
		}
		if (patientCode != null) {
			map['PatientCode'] = patientCode;
		}
		if (recordCode != null) {
			map['RecordCode'] = recordCode;
		}
		if (remedicalCode != null) {
			map['RemedicalCode'] = remedicalCode;
		}
		map['FrameIndex'] = frameIndex;
		if (userCode != null) {
			map['UserCode'] = userCode;
		}
		if (orginalFileToken != null) {
			map['OrginalFileToken'] = orginalFileToken;
		}
		if (cdnFileToken != null) {
			map['CdnFileToken'] = cdnFileToken;
		}
		if (aIFileToken != null) {
			map['AIFileToken'] = aIFileToken;
		}
		if (aICdnFileToken != null) {
			map['AICdnFileToken'] = aICdnFileToken;
		}
		map['RecommendedDownloadMode'] = recommendedDownloadMode.index;
		if (previewFileToken != null) {
			map['PreviewFileToken'] = previewFileToken;
		}
		if (diagnosisData != null) {
			map['DiagnosisData'] = diagnosisData;
		}
		map['DiagnosisConclusion'] = diagnosisConclusion.index;
		if (diagnosisOrgans != null) {
			map['DiagnosisOrgans'] = diagnosisOrgans;
		}
		return map;
	}
}

class GetPatientAISelectedInfosRequest extends TokenRequest{
	String? patientCode;
	String? recordCode;

	GetPatientAISelectedInfosRequest({
		this.patientCode,
		this.recordCode,
		String? token,
	}) : super(
			token: token,
		);

	factory GetPatientAISelectedInfosRequest.fromJson(Map<String, dynamic> map) {
		return GetPatientAISelectedInfosRequest( 
			patientCode: map['PatientCode'],
			recordCode: map['RecordCode'],
			token: map['Token'],
		);
	}

	Map<String, dynamic> toJson() {
		final map = super.toJson();
		if (patientCode != null)
			map['PatientCode'] = patientCode;
		if (recordCode != null)
			map['RecordCode'] = recordCode;
		return map;
	}
}

class GetRemedicalAISelectedInfoRequest extends TokenRequest{
	String? code;

	GetRemedicalAISelectedInfoRequest({
		this.code,
		String? token,
	}) : super(
			token: token,
		);

	factory GetRemedicalAISelectedInfoRequest.fromJson(Map<String, dynamic> map) {
		return GetRemedicalAISelectedInfoRequest( 
			code: map['Code'],
			token: map['Token'],
		);
	}

	Map<String, dynamic> toJson() {
		final map = super.toJson();
		if (code != null)
			map['Code'] = code;
		return map;
	}
}

class SaveRemedicalAISelectedInfoRequest extends TokenRequest{
	String? code;
	String? remedicalCode;
	int frameIndex;
	String? aIFileToken;
	String? previewFileToken;
	String? diagnosisData;
	DiagnosisConclusionEnum diagnosisConclusion;
	List<DiagnosisOrganEnum>? diagnosisOrgans;

	SaveRemedicalAISelectedInfoRequest({
		this.code,
		this.remedicalCode,
		this.frameIndex = 0,
		this.aIFileToken,
		this.previewFileToken,
		this.diagnosisData,
		this.diagnosisConclusion = DiagnosisConclusionEnum.NotRequired,
		this.diagnosisOrgans,
		String? token,
	}) : super(
			token: token,
		);

	factory SaveRemedicalAISelectedInfoRequest.fromJson(Map<String, dynamic> map) {
		return SaveRemedicalAISelectedInfoRequest( 
			code: map['Code'],
			remedicalCode: map['RemedicalCode'],
			frameIndex: map['FrameIndex'],
			aIFileToken: map['AIFileToken'],
			previewFileToken: map['PreviewFileToken'],
			diagnosisData: map['DiagnosisData'],
			diagnosisConclusion: DiagnosisConclusionEnum.values.firstWhere((e) => e.index == map['DiagnosisConclusion']),
			diagnosisOrgans: map['DiagnosisOrgans'] != null ? (map['DiagnosisOrgans'] as List).map((e)=>DiagnosisOrganEnum.values.firstWhere((i) => i.index == e)).toList() : null,
			token: map['Token'],
		);
	}

	Map<String, dynamic> toJson() {
		final map = super.toJson();
		if (code != null)
			map['Code'] = code;
		if (remedicalCode != null)
			map['RemedicalCode'] = remedicalCode;
		map['FrameIndex'] = frameIndex;
		if (aIFileToken != null)
			map['AIFileToken'] = aIFileToken;
		if (previewFileToken != null)
			map['PreviewFileToken'] = previewFileToken;
		if (diagnosisData != null)
			map['DiagnosisData'] = diagnosisData;
		map['DiagnosisConclusion'] = diagnosisConclusion.index;
		if (diagnosisOrgans != null)
			map['DiagnosisOrgans'] = diagnosisOrgans;
		return map;
	}
}

class SyncRemedicalRecordRequest {
	String? code;
	String? organizationCode;
	String? deviceCode;
	bool isUploadReport;
	List<DataItemDTO>? patientInfo;
	DiagnosisStatusEnum diagnosisStatus;
	List<DiagnosisInfoDTO>? aIDiagnosisInfos;
	DateTime? createTime;
	DateTime? updateTime;
	String? creator;
	bool isDelete;
	String? customDoctor;
	String? customOrganzation;
	String? equipmentSN;
	bool isImgQualityControlled;
	bool isReportQualityControlled;
	double imgScore;
	double reportScore;

	SyncRemedicalRecordRequest({
		this.code,
		this.organizationCode,
		this.deviceCode,
		this.isUploadReport = false,
		this.patientInfo,
		this.diagnosisStatus = DiagnosisStatusEnum.NotRequired,
		this.aIDiagnosisInfos,
		this.createTime,
		this.updateTime,
		this.creator,
		this.isDelete = false,
		this.customDoctor,
		this.customOrganzation,
		this.equipmentSN,
		this.isImgQualityControlled = false,
		this.isReportQualityControlled = false,
		this.imgScore = 0,
		this.reportScore = 0,
	});

	factory SyncRemedicalRecordRequest.fromJson(Map<String, dynamic> map) {
		return SyncRemedicalRecordRequest( 
			code: map['Code'],
			organizationCode: map['OrganizationCode'],
			deviceCode: map['DeviceCode'],
			isUploadReport: map['IsUploadReport'],
			patientInfo: map['PatientInfo'] != null ? (map['PatientInfo'] as List).map((e)=>DataItemDTO.fromJson(e as Map<String,dynamic>)).toList() : null,
			diagnosisStatus: DiagnosisStatusEnum.values.firstWhere((e) => e.index == map['DiagnosisStatus']),
			aIDiagnosisInfos: map['AIDiagnosisInfos'] != null ? (map['AIDiagnosisInfos'] as List).map((e)=>DiagnosisInfoDTO.fromJson(e as Map<String,dynamic>)).toList() : null,
			createTime: map['CreateTime'] != null ? DateTime.parse(map['CreateTime']) : null,
			updateTime: map['UpdateTime'] != null ? DateTime.parse(map['UpdateTime']) : null,
			creator: map['Creator'],
			isDelete: map['IsDelete'],
			customDoctor: map['CustomDoctor'],
			customOrganzation: map['CustomOrganzation'],
			equipmentSN: map['EquipmentSN'],
			isImgQualityControlled: map['IsImgQualityControlled'],
			isReportQualityControlled: map['IsReportQualityControlled'],
			imgScore: double.parse(map['ImgScore'].toString()),
			reportScore: double.parse(map['ReportScore'].toString()),
		);
	}

	Map<String, dynamic> toJson() {
		final map = Map<String, dynamic>();
		if (code != null) {
			map['Code'] = code;
		}
		if (organizationCode != null) {
			map['OrganizationCode'] = organizationCode;
		}
		if (deviceCode != null) {
			map['DeviceCode'] = deviceCode;
		}
		map['IsUploadReport'] = isUploadReport;
		if (patientInfo != null) {
			map['PatientInfo'] = patientInfo;
		}
		map['DiagnosisStatus'] = diagnosisStatus.index;
		if (aIDiagnosisInfos != null) {
			map['AIDiagnosisInfos'] = aIDiagnosisInfos;
		}
		if (createTime != null) {
			map['CreateTime'] = JsonRpcUtils.dateFormat(createTime!);
		}
		if (updateTime != null) {
			map['UpdateTime'] = JsonRpcUtils.dateFormat(updateTime!);
		}
		if (creator != null) {
			map['Creator'] = creator;
		}
		map['IsDelete'] = isDelete;
		if (customDoctor != null) {
			map['CustomDoctor'] = customDoctor;
		}
		if (customOrganzation != null) {
			map['CustomOrganzation'] = customOrganzation;
		}
		if (equipmentSN != null) {
			map['EquipmentSN'] = equipmentSN;
		}
		map['IsImgQualityControlled'] = isImgQualityControlled;
		map['IsReportQualityControlled'] = isReportQualityControlled;
		map['ImgScore'] = imgScore;
		map['ReportScore'] = reportScore;
		return map;
	}
}

class SyncBatchRemedicalRecordRequest {
	SyncDBEnum syncType;
	List<SyncRemedicalRecordRequest>? remedicalRecordList;

	SyncBatchRemedicalRecordRequest({
		this.syncType = SyncDBEnum.Migrate,
		this.remedicalRecordList,
	});

	factory SyncBatchRemedicalRecordRequest.fromJson(Map<String, dynamic> map) {
		return SyncBatchRemedicalRecordRequest( 
			syncType: SyncDBEnum.values.firstWhere((e) => e.index == map['SyncType']),
			remedicalRecordList: map['RemedicalRecordList'] != null ? (map['RemedicalRecordList'] as List).map((e)=>SyncRemedicalRecordRequest.fromJson(e as Map<String,dynamic>)).toList() : null,
		);
	}

	Map<String, dynamic> toJson() {
		final map = Map<String, dynamic>();
		map['SyncType'] = syncType.index;
		if (remedicalRecordList != null) {
			map['RemedicalRecordList'] = remedicalRecordList;
		}
		return map;
	}
}

class SyncUploadRemedicalDataRequest {
	String? code;
	DateTime? createTime;
	DateTime? updateTime;
	String? examCode;
	String? deviceCode;
	String? previewFileToken;
	String? fileToken;
	String? imageUrl;
	int fileSize;
	String? coverImageToken;
	String? applicationCategory;
	String? application;
	RemedicalFileDataTypeEnum fileDataType;
	ImageLocationDTO? imageLocation;
	List<String>? organDiagnosisInfos;
	bool oldPlatformNeedAI;
	ReportQualityControl? qualityControlDatas;

	SyncUploadRemedicalDataRequest({
		this.code,
		this.createTime,
		this.updateTime,
		this.examCode,
		this.deviceCode,
		this.previewFileToken,
		this.fileToken,
		this.imageUrl,
		this.fileSize = 0,
		this.coverImageToken,
		this.applicationCategory,
		this.application,
		this.fileDataType = RemedicalFileDataTypeEnum.VinnoVidSingle,
		this.imageLocation,
		this.organDiagnosisInfos,
		this.oldPlatformNeedAI = false,
		this.qualityControlDatas,
	});

	factory SyncUploadRemedicalDataRequest.fromJson(Map<String, dynamic> map) {
		return SyncUploadRemedicalDataRequest( 
			code: map['Code'],
			createTime: map['CreateTime'] != null ? DateTime.parse(map['CreateTime']) : null,
			updateTime: map['UpdateTime'] != null ? DateTime.parse(map['UpdateTime']) : null,
			examCode: map['ExamCode'],
			deviceCode: map['DeviceCode'],
			previewFileToken: map['PreviewFileToken'],
			fileToken: map['FileToken'],
			imageUrl: map['ImageUrl'],
			fileSize: map['FileSize'],
			coverImageToken: map['CoverImageToken'],
			applicationCategory: map['ApplicationCategory'],
			application: map['Application'],
			fileDataType: RemedicalFileDataTypeEnum.values.firstWhere((e) => e.index == map['FileDataType']),
			imageLocation: map['ImageLocation'] != null ? ImageLocationDTO.fromJson(map['ImageLocation']) : null,
			organDiagnosisInfos: map['OrganDiagnosisInfos']?.cast<String>().toList(),
			oldPlatformNeedAI: map['OldPlatformNeedAI'],
			qualityControlDatas: map['QualityControlDatas'] != null ? ReportQualityControl.fromJson(map['QualityControlDatas']) : null,
		);
	}

	Map<String, dynamic> toJson() {
		final map = Map<String, dynamic>();
		if (code != null) {
			map['Code'] = code;
		}
		if (createTime != null) {
			map['CreateTime'] = JsonRpcUtils.dateFormat(createTime!);
		}
		if (updateTime != null) {
			map['UpdateTime'] = JsonRpcUtils.dateFormat(updateTime!);
		}
		if (examCode != null) {
			map['ExamCode'] = examCode;
		}
		if (deviceCode != null) {
			map['DeviceCode'] = deviceCode;
		}
		if (previewFileToken != null) {
			map['PreviewFileToken'] = previewFileToken;
		}
		if (fileToken != null) {
			map['FileToken'] = fileToken;
		}
		if (imageUrl != null) {
			map['ImageUrl'] = imageUrl;
		}
		map['FileSize'] = fileSize;
		if (coverImageToken != null) {
			map['CoverImageToken'] = coverImageToken;
		}
		if (applicationCategory != null) {
			map['ApplicationCategory'] = applicationCategory;
		}
		if (application != null) {
			map['Application'] = application;
		}
		map['FileDataType'] = fileDataType.index;
		if (imageLocation != null) {
			map['ImageLocation'] = imageLocation;
		}
		if (organDiagnosisInfos != null) {
			map['OrganDiagnosisInfos'] = organDiagnosisInfos;
		}
		map['OldPlatformNeedAI'] = oldPlatformNeedAI;
		if (qualityControlDatas != null) {
			map['QualityControlDatas'] = qualityControlDatas;
		}
		return map;
	}
}

class SyncBatchUploadRemedicalDatasRequest {
	SyncDBEnum syncType;
	List<SyncUploadRemedicalDataRequest>? syncUploadRemedicalDataList;

	SyncBatchUploadRemedicalDatasRequest({
		this.syncType = SyncDBEnum.Migrate,
		this.syncUploadRemedicalDataList,
	});

	factory SyncBatchUploadRemedicalDatasRequest.fromJson(Map<String, dynamic> map) {
		return SyncBatchUploadRemedicalDatasRequest( 
			syncType: SyncDBEnum.values.firstWhere((e) => e.index == map['SyncType']),
			syncUploadRemedicalDataList: map['SyncUploadRemedicalDataList'] != null ? (map['SyncUploadRemedicalDataList'] as List).map((e)=>SyncUploadRemedicalDataRequest.fromJson(e as Map<String,dynamic>)).toList() : null,
		);
	}

	Map<String, dynamic> toJson() {
		final map = Map<String, dynamic>();
		map['SyncType'] = syncType.index;
		if (syncUploadRemedicalDataList != null) {
			map['SyncUploadRemedicalDataList'] = syncUploadRemedicalDataList;
		}
		return map;
	}
}

class SyncAIResultRequest {
	String? remedicalCode;
	String? diagnosisResult;
	DateTime? createTime;
	DateTime? updateTime;

	SyncAIResultRequest({
		this.remedicalCode,
		this.diagnosisResult,
		this.createTime,
		this.updateTime,
	});

	factory SyncAIResultRequest.fromJson(Map<String, dynamic> map) {
		return SyncAIResultRequest( 
			remedicalCode: map['RemedicalCode'],
			diagnosisResult: map['DiagnosisResult'],
			createTime: map['CreateTime'] != null ? DateTime.parse(map['CreateTime']) : null,
			updateTime: map['UpdateTime'] != null ? DateTime.parse(map['UpdateTime']) : null,
		);
	}

	Map<String, dynamic> toJson() {
		final map = Map<String, dynamic>();
		if (remedicalCode != null) {
			map['RemedicalCode'] = remedicalCode;
		}
		if (diagnosisResult != null) {
			map['DiagnosisResult'] = diagnosisResult;
		}
		if (createTime != null) {
			map['CreateTime'] = JsonRpcUtils.dateFormat(createTime!);
		}
		if (updateTime != null) {
			map['UpdateTime'] = JsonRpcUtils.dateFormat(updateTime!);
		}
		return map;
	}
}

class SyncBatchAIResultRequest {
	SyncDBEnum syncType;
	List<SyncAIResultRequest>? syncAIResultList;

	SyncBatchAIResultRequest({
		this.syncType = SyncDBEnum.Migrate,
		this.syncAIResultList,
	});

	factory SyncBatchAIResultRequest.fromJson(Map<String, dynamic> map) {
		return SyncBatchAIResultRequest( 
			syncType: SyncDBEnum.values.firstWhere((e) => e.index == map['SyncType']),
			syncAIResultList: map['SyncAIResultList'] != null ? (map['SyncAIResultList'] as List).map((e)=>SyncAIResultRequest.fromJson(e as Map<String,dynamic>)).toList() : null,
		);
	}

	Map<String, dynamic> toJson() {
		final map = Map<String, dynamic>();
		map['SyncType'] = syncType.index;
		if (syncAIResultList != null) {
			map['SyncAIResultList'] = syncAIResultList;
		}
		return map;
	}
}

class SyncBatchCarotidResultRequest {
	SyncDBEnum syncType;
	List<GetCarotidResultRequest>? syncCarotidResultRequest;

	SyncBatchCarotidResultRequest({
		this.syncType = SyncDBEnum.Migrate,
		this.syncCarotidResultRequest,
	});

	factory SyncBatchCarotidResultRequest.fromJson(Map<String, dynamic> map) {
		return SyncBatchCarotidResultRequest( 
			syncType: SyncDBEnum.values.firstWhere((e) => e.index == map['SyncType']),
			syncCarotidResultRequest: map['SyncCarotidResultRequest'] != null ? (map['SyncCarotidResultRequest'] as List).map((e)=>GetCarotidResultRequest.fromJson(e as Map<String,dynamic>)).toList() : null,
		);
	}

	Map<String, dynamic> toJson() {
		final map = Map<String, dynamic>();
		map['SyncType'] = syncType.index;
		if (syncCarotidResultRequest != null) {
			map['SyncCarotidResultRequest'] = syncCarotidResultRequest;
		}
		return map;
	}
}

class LabFileInfoRequest extends TokenRequest{
	String? filePath;
	String? fileName;
	UploadFileTypeEnum fileType;

	LabFileInfoRequest({
		this.filePath,
		this.fileName,
		this.fileType = UploadFileTypeEnum.Unknown,
		String? token,
	}) : super(
			token: token,
		);

	factory LabFileInfoRequest.fromJson(Map<String, dynamic> map) {
		return LabFileInfoRequest( 
			filePath: map['FilePath'],
			fileName: map['FileName'],
			fileType: UploadFileTypeEnum.values.firstWhere((e) => e.index == map['FileType']),
			token: map['Token'],
		);
	}

	Map<String, dynamic> toJson() {
		final map = super.toJson();
		if (filePath != null)
			map['FilePath'] = filePath;
		if (fileName != null)
			map['FileName'] = fileName;
		map['FileType'] = fileType.index;
		return map;
	}
}

class FindDeviceDiagnosisRequest extends TokenRequest{
	String? deviceCode;

	FindDeviceDiagnosisRequest({
		this.deviceCode,
		String? token,
	}) : super(
			token: token,
		);

	factory FindDeviceDiagnosisRequest.fromJson(Map<String, dynamic> map) {
		return FindDeviceDiagnosisRequest( 
			deviceCode: map['DeviceCode'],
			token: map['Token'],
		);
	}

	Map<String, dynamic> toJson() {
		final map = super.toJson();
		if (deviceCode != null)
			map['DeviceCode'] = deviceCode;
		return map;
	}
}

class AddToVidProcessQueueRequest {
	String? originImageUrl;
	String? remedicalCode;
	String? recordCode;
	bool isNeedThumbnailUrl;
	bool isNeedCoverImg;
	bool isNeedLocation;

	AddToVidProcessQueueRequest({
		this.originImageUrl,
		this.remedicalCode,
		this.recordCode,
		this.isNeedThumbnailUrl = false,
		this.isNeedCoverImg = false,
		this.isNeedLocation = false,
	});

	factory AddToVidProcessQueueRequest.fromJson(Map<String, dynamic> map) {
		return AddToVidProcessQueueRequest( 
			originImageUrl: map['OriginImageUrl'],
			remedicalCode: map['RemedicalCode'],
			recordCode: map['RecordCode'],
			isNeedThumbnailUrl: map['IsNeedThumbnailUrl'],
			isNeedCoverImg: map['IsNeedCoverImg'],
			isNeedLocation: map['IsNeedLocation'],
		);
	}

	Map<String, dynamic> toJson() {
		final map = Map<String, dynamic>();
		if (originImageUrl != null) {
			map['OriginImageUrl'] = originImageUrl;
		}
		if (remedicalCode != null) {
			map['RemedicalCode'] = remedicalCode;
		}
		if (recordCode != null) {
			map['RecordCode'] = recordCode;
		}
		map['IsNeedThumbnailUrl'] = isNeedThumbnailUrl;
		map['IsNeedCoverImg'] = isNeedCoverImg;
		map['IsNeedLocation'] = isNeedLocation;
		return map;
	}
}

class QueryShareImagesPlayUrlRequest extends TokenRequest{
	String? recordCode;
	List<MeasureExportDetailDTO>? remedicalImages;
	String? languageCode;

	QueryShareImagesPlayUrlRequest({
		this.recordCode,
		this.remedicalImages,
		this.languageCode,
		String? token,
	}) : super(
			token: token,
		);

	factory QueryShareImagesPlayUrlRequest.fromJson(Map<String, dynamic> map) {
		return QueryShareImagesPlayUrlRequest( 
			recordCode: map['RecordCode'],
			remedicalImages: map['RemedicalImages'] != null ? (map['RemedicalImages'] as List).map((e)=>MeasureExportDetailDTO.fromJson(e as Map<String,dynamic>)).toList() : null,
			languageCode: map['LanguageCode'],
			token: map['Token'],
		);
	}

	Map<String, dynamic> toJson() {
		final map = super.toJson();
		if (recordCode != null)
			map['RecordCode'] = recordCode;
		if (remedicalImages != null)
			map['RemedicalImages'] = remedicalImages;
		if (languageCode != null)
			map['LanguageCode'] = languageCode;
		return map;
	}
}