package thyyxxk.webserver.entity.api.forpowersi.drgdip;

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

@Data
public class RequestParams {
    // 指标命名集
    private String type;

    // 分页序号(从0开始)
    private Integer pageNumber;

    // 一页的记录条数
    private Integer pageSize;

    // 查询开始日期
    private String startDate;

    // 查询结束日期
    private String endDate;

    // 患者唯一就诊Id
    private String visitId;

    private String setlId;

    private String patNo;

    private Integer times;

    private Integer ledgerSn;

    public String getStartDate() {
        if (StringUtil.isBlank(startDate)) {
            return null;
        }
        if (startDate.contains("-")) {
            return startDate + " 00:00:00.000";
        }
        return startDate.substring(0, 4) + "-" +
                startDate.substring(4, 6) + "-" +
                startDate.substring(6, 8) +
                " 00:00:00.000";
    }

    public String getEndDate() {
        if (StringUtil.isBlank(endDate)) {
            return null;
        }
        if (endDate.contains("-")) {
            return endDate + " 23:59:59.999";
        }
        return endDate.substring(0, 4) + "-" +
                endDate.substring(4, 6) + "-" +
                endDate.substring(6, 8) +
                " 23:59:59.999";
    }

    public String getVisitId() {
        return StringUtil.isBlank(visitId) ? null : visitId.trim();
    }
}
