package com.zhyc.module.biosafety.domain;

import java.util.Date;
import java.util.List;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.zhyc.module.enums.Gender;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import com.zhyc.common.annotation.Excel;
import com.zhyc.common.core.domain.BaseEntity;

/**
 * 驱虫对象 sw_dih
 * 
 * @author ruoyi
 * @date 2025-07-15
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Deworm extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** $column.columnComment */
    private Long id;

    private Long sheepId;

    private Integer[] sheepIds;

    /** 羊只id */
    @Excel(name = "羊只耳号")
    private String sheepNo;
    private String[] sheepNos;
    /** 全部羊耳号列表（用于多耳号查询） */
    private List<String> allEarNumbers;

    @Excel(name = "品种")
    private String variety;
    @Excel(name = "羊只类别")
    private String sheepType;

    private String gender;
    @Excel(name = "羊只性别")
    private String genderName;
    @Excel(name = "月龄")
    private Long monthAge;
    @Excel(name = "繁殖状态")
    private String breed;
    /** 胎次 */
    @Excel(name = "胎次")
    private Long parity;

    private Long userId;
    private Long deptId;

    /** 药品使用记录 */
//    @Excel(name = "药品使用记录")
    private Integer usageId;


    //    药品使用
    private List<SwMedicineUsageDetails> usageDetails;

    /** 驱虫日期 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "驱虫日期", width = 30, dateFormat = "yyyy-MM-dd")
    private Date datetime;

    /** 技术员 */
    @Excel(name = "技术员")
    private String technical;

    /** 备注 */
    @Excel(name = "备注")
    private String comment;

    /**
     * 是否在群查询条件（0-在群，1-离群），非数据库字段
     */
    private Integer isDelete;

//  排序查询
    private String orderByColumn;
    private String isAsc;

    public void setGender(String gender) {
        this.gender = gender;
        if (gender != null && !gender.trim().isEmpty()) {
            try {
                Integer genderCode = Integer.valueOf(gender.trim());
                this.genderName = Gender.getDescByCode(genderCode);
            } catch (NumberFormatException e) {
                // 如果转换失败，设置为空或默认值
                this.genderName = null;
            }
        } else {
            this.genderName = null;
        }
    }

}
