package com.yihu.figure.model.disease;

import com.yihu.figure.model.IdEntity;

import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.Date;

/**
 * Created by chenweida on 2017/3/6.
 * 就诊事件表
 */
@Entity
@Table(name = "figure_visit")
public class Visit extends IdEntity {
    private String diagnosis;//'主诊断名称'
    private Integer orgId;//'机构id'
    private String r;//''排序号''
    private Date endTime;//''事件时间''
    private String orgName;//'机构名称'
    private String type;//'事件类型1门诊2住院3体检',
    private String event;//''事件号''
    private String icdCode;// 主诊断编码
    private String patientCode;//患者code

    private String typeName;//类别名称

    public Visit(String patientCode) {
        this.patientCode = patientCode;
    }

    public Visit() {
    }

    public String getIcdCode() {
        return icdCode;
    }

    public void setIcdCode(String icdCode) {
        this.icdCode = icdCode;
    }

    public String getDiagnosis() {
        return diagnosis;
    }

    public void setDiagnosis(String diagnosis) {
        this.diagnosis = diagnosis;
    }

    public Integer getOrgId() {
        return orgId;
    }

    public void setOrgId(Integer orgId) {
        this.orgId = orgId;
    }

    public String getR() {
        return r;
    }

    public void setR(String r) {
        this.r = r;
    }

    public Date getEndTime() {
        return endTime;
    }

    public void setEndTime(Date endTime) {
        this.endTime = endTime;
    }

    public String getOrgName() {
        return orgName;
    }

    public void setOrgName(String orgName) {
        this.orgName = orgName;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getEvent() {
        return event;
    }

    public void setEvent(String event) {
        this.event = event;
    }

    public String getPatientCode() {
        return patientCode;
    }

    public void setPatientCode(String patientCode) {
        this.patientCode = patientCode;
    }

    @Transient
    public String getTypeName() {
        switch (this.type) {
            case "1": {
                return "门诊";
            }
            case "2": {
                return "住院";
            }
            case "3": {
                return "体检";
            }
        }
        return "未知";
    }

    public void setTypeName(String typeName) {
        this.typeName = typeName;
    }
}
