package thyyxxk.webserver.entity.inpatient.patient;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import thyyxxk.webserver.utils.StringUtil;

import java.math.BigDecimal;
import java.util.Date;

@Data
public class Patient {
    private String table;
    private String inpatientNo;
    private Integer admissTimes;
    private Integer ledgerSn;
    private String staffId;
    private String socialNo;
    private String name;
    private Integer sex;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private String birthDate;
    private String homeTel;
    private String icdCode;
    private String icdText;
    private String admissPhysician;
    private String admissPhysicianName;
    private String referPhysician;
    private String referPhysicianName;
    private String acctUsedFlag;

    private String dutyNurse;
    private String dutyNurseName;
    private String country;
    private String nation;
    private String contactName;
    private String contactRelation;
    private String contactAddrName;
    private String contactPhone;

    private String admissDiagStr;
    private String clinicDiagStr;
    private String admissWard;
    private String admissWardName;
    private String admissDept;
    private String smallDept;
    private String smallDeptName;
    private Date admissDate;
    private Date ybRegisterDate;
    private String responceType;
    private Integer dismissOrder;
    private String zkWard;
    private String bedNo;
    private String statusFlag;
    private String totalCharge;
    private String indiId;
    private String zySerialNo;
    private String centerId;
    private String ward;
    private String sid;
    private String disDiagStatus;
    private String operation;
    private String chargeYb;
    private Boolean midSetl; // 中间断账标志
    private Date zjdzDatetime; // 中间断账时间
    private Date dismissOrderDate; // 口腔科生成出院医嘱的出院时间
    private String medType;
    private String medTypeName;
    private String insutype;
    private String insutypeName;
    private String admdvs;
    private String matnType; // 生育类别
    private String latechbFlag; // 是否晚育
    private String pretFlag; // 是否早产
    private String mdtrtId;
    private Integer injuryArea; // 工伤归属地：1-长沙，2-望城，3-省直
    private String injurySerialNo;
    private String actIptDays; // 入院时间
    private String revokeRemark;
    /**
     * 患者居住地
     */
    private String homeStreet;
    private Integer age;

    /**
     * 纬度
     */
    private BigDecimal latitude;

    /**
     * 经度
     */
    private BigDecimal longitude;

    /**
     * 转化成功标志
     */
    private Integer addrTransedFlag;

    /**
     * 同区域的人数
     */
    private Integer numberOfPeopleInTheSameArea;

    /**
     * 是否有出纳
     */
    private Integer timesBilled;

    private String yp;
    private String jyjc;
    private String yb;
    // 余额
    private String balance;

    private Date begntime;
    private Date endtime;
    private String diseCode;
    private String diseName;

    public String getSexName() {
        if (sex == null) {
            return "";
        }
        switch (sex) {
            case 1:
                return "男";
            case 2:
                return "女";
            default:
                return "未知";
        }
    }

    public String getPatNo() {
        return StringUtil.isBlank(inpatientNo) ? inpatientNo : inpatientNo.trim();
    }

    public Boolean getMidSetl() {
        return null != midSetl && midSetl;
    }

    public String getTable() {
        return null == table ? "zy_actpatient" : (table).trim();
    }

    public String mainInfo() {
        return "姓名：" + name + "，住院号：" + inpatientNo + "，住院次数：" + admissTimes;
    }
}
