package thyyxxk.webserver.entity.casefrontsheet;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

/**
 * @author dj
 */
@Data
public class SheetOverview {
    private Integer fileStatus;
    private Integer inOutFlag;
    private String bedNo;
    private String bah;
    private Integer times;
    private String name;
    private Integer sex;
    private String genderName;
    private Date admissDate;
    private String deptName;
    private String doctorName;
    private Date disDate;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date signDate;
    private Integer lateDays;
    private Integer lateFlag;

    public Integer getLateDays() {
        if (null == lateDays) return 0;
        return Math.max(lateDays - 8, 0);
    }

    public String getGenderName() {
        if (null == sex) {
            return "未填写";
        }
        if (sex == 1) {
            return "男";
        }
        if (sex == 2) {
            return "女";
        }
        return "未知";
    }

    public Integer getLateFlag() {
        return null == lateFlag ? 0 : lateFlag;
    }

    public Integer getFileStatus() {
        return null == fileStatus ? 0 : fileStatus;
    }

    public Integer getInOutFlag() {
        return null == inOutFlag ? 1 : inOutFlag;
    }
}
