package thyyxxk.webserver.entity.adverseevent;

import lombok.Data;
import thyyxxk.webserver.utils.DateUtil;
import thyyxxk.webserver.utils.StringUtil;

import java.util.Date;

@Data
public class QueryParam {
    private Date start;
    private Date end;
    private Integer type;
    private Integer level;
    private String wardCode;
    private Integer currentPage;
    private Integer pageSize;

    public Integer getType() {
        return null == type ? 0 : type;
    }

    public Date getStart() {
        return null == start ? DateUtil.parse("2012-01-01 00:00:01") : start;
    }

    public Date getEnd() {
        return null == end ? DateUtil.parse("2099-12-31 23:59:00") : end;
    }

    public String getWardCode() {
        return StringUtil.isBlank(wardCode) ? "%%" : (wardCode).trim() + "%";
    }
}
