import 'package:anchor_collect_flutter/generated/json/base/json_convert_content.dart';
import 'package:anchor_collect_flutter/models/medical_record_entity.dart';
import 'package:isar/isar.dart';


MedicalRecordEntity $MedicalRecordEntityFromJson(Map<String, dynamic> json) {
  final MedicalRecordEntity medicalRecordEntity = MedicalRecordEntity();
  final Id? id = jsonConvert.convert<Id>(json['id']);
  if (id != null) {
    medicalRecordEntity.id = id;
  }
  final String? unid = jsonConvert.convert<String>(json['unid']);
  if (unid != null) {
    medicalRecordEntity.unid = unid;
  }
  final String? cattleresumeId = jsonConvert.convert<String>(json['cattleresumeId']);
  if (cattleresumeId != null) {
    medicalRecordEntity.cattleresumeId = cattleresumeId;
  }
  final String? registrationNo = jsonConvert.convert<String>(json['registrationNo']);
  if (registrationNo != null) {
    medicalRecordEntity.registrationNo = registrationNo;
  }
  final String? individualNo = jsonConvert.convert<String>(json['individualNo']);
  if (individualNo != null) {
    medicalRecordEntity.individualNo = individualNo;
  }
  final String? treatDate = jsonConvert.convert<String>(json['treatDate']);
  if (treatDate != null) {
    medicalRecordEntity.treatDate = treatDate;
  }
  final String? treatPersonnel = jsonConvert.convert<String>(json['treatPersonnel']);
  if (treatPersonnel != null) {
    medicalRecordEntity.treatPersonnel = treatPersonnel;
  }
  final String? causeOf = jsonConvert.convert<String>(json['causeOf']);
  if (causeOf != null) {
    medicalRecordEntity.causeOf = causeOf;
  }
  final String? drugName = jsonConvert.convert<String>(json['drugName']);
  if (drugName != null) {
    medicalRecordEntity.drugName = drugName;
  }
  final String? specifications = jsonConvert.convert<String>(json['specifications']);
  if (specifications != null) {
    medicalRecordEntity.specifications = specifications;
  }
  final String? drugMethods = jsonConvert.convert<String>(json['drugMethods']);
  if (drugMethods != null) {
    medicalRecordEntity.drugMethods = drugMethods;
  }
  final double? drugNumber = jsonConvert.convert<double>(json['drugNumber']);
  if (drugNumber != null) {
    medicalRecordEntity.drugNumber = drugNumber;
  }
  final String? results = jsonConvert.convert<String>(json['results']);
  if (results != null) {
    medicalRecordEntity.results = results;
  }
  final String? uploadStatus = jsonConvert.convert<String>(json['uploadStatus']);
  if (uploadStatus != null) {
    medicalRecordEntity.uploadStatus = uploadStatus;
  }
  final String? deptId = jsonConvert.convert<String>(json['deptId']);
  if (deptId != null) {
    medicalRecordEntity.deptId = deptId;
  }
  final String? searchValue = jsonConvert.convert<String>(json['searchValue']);
  if (searchValue != null) {
    medicalRecordEntity.searchValue = searchValue;
  }
  final String? createBy = jsonConvert.convert<String>(json['createBy']);
  if (createBy != null) {
    medicalRecordEntity.createBy = createBy;
  }
  final String? createTime = jsonConvert.convert<String>(json['createTime']);
  if (createTime != null) {
    medicalRecordEntity.createTime = createTime;
  }
  final String? updateBy = jsonConvert.convert<String>(json['updateBy']);
  if (updateBy != null) {
    medicalRecordEntity.updateBy = updateBy;
  }
  final String? updateTime = jsonConvert.convert<String>(json['updateTime']);
  if (updateTime != null) {
    medicalRecordEntity.updateTime = updateTime;
  }
  final String? remark = jsonConvert.convert<String>(json['remark']);
  if (remark != null) {
    medicalRecordEntity.remark = remark;
  }
  return medicalRecordEntity;
}

Map<String, dynamic> $MedicalRecordEntityToJson(MedicalRecordEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['unid'] = entity.unid;
  data['cattleresumeId'] = entity.cattleresumeId;
  data['registrationNo'] = entity.registrationNo;
  data['individualNo'] = entity.individualNo;
  data['treatDate'] = entity.treatDate;
  data['treatPersonnel'] = entity.treatPersonnel;
  data['causeOf'] = entity.causeOf;
  data['drugName'] = entity.drugName;
  data['specifications'] = entity.specifications;
  data['drugMethods'] = entity.drugMethods;
  data['drugNumber'] = entity.drugNumber;
  data['results'] = entity.results;
  data['uploadStatus'] = entity.uploadStatus;
  data['deptId'] = entity.deptId;
  data['searchValue'] = entity.searchValue;
  data['createBy'] = entity.createBy;
  data['createTime'] = entity.createTime;
  data['updateBy'] = entity.updateBy;
  data['updateTime'] = entity.updateTime;
  data['remark'] = entity.remark;
  return data;
}

extension MedicalRecordEntityExtension on MedicalRecordEntity {
  MedicalRecordEntity copyWith({
    Id? id,
    String? unid,
    String? cattleresumeId,
    String? registrationNo,
    String? individualNo,
    String? treatDate,
    String? treatPersonnel,
    String? causeOf,
    String? drugName,
    String? specifications,
    String? drugMethods,
    double? drugNumber,
    String? results,
    String? uploadStatus,
    String? deptId,
    String? searchValue,
    String? createBy,
    String? createTime,
    String? updateBy,
    String? updateTime,
    String? remark,
  }) {
    return MedicalRecordEntity()
      ..id = id ?? this.id
      ..unid = unid ?? this.unid
      ..cattleresumeId = cattleresumeId ?? this.cattleresumeId
      ..registrationNo = registrationNo ?? this.registrationNo
      ..individualNo = individualNo ?? this.individualNo
      ..treatDate = treatDate ?? this.treatDate
      ..treatPersonnel = treatPersonnel ?? this.treatPersonnel
      ..causeOf = causeOf ?? this.causeOf
      ..drugName = drugName ?? this.drugName
      ..specifications = specifications ?? this.specifications
      ..drugMethods = drugMethods ?? this.drugMethods
      ..drugNumber = drugNumber ?? this.drugNumber
      ..results = results ?? this.results
      ..uploadStatus = uploadStatus ?? this.uploadStatus
      ..deptId = deptId ?? this.deptId
      ..searchValue = searchValue ?? this.searchValue
      ..createBy = createBy ?? this.createBy
      ..createTime = createTime ?? this.createTime
      ..updateBy = updateBy ?? this.updateBy
      ..updateTime = updateTime ?? this.updateTime
      ..remark = remark ?? this.remark;
  }
}