package com.yihu.jw.entity.care.device;


import com.yihu.jw.entity.iot.gateway.IdEntity;

import javax.persistence.*;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
 * Created by ysj on 2018/01/10.
 * 设备表
 */
@Entity
@Table(name = "wlyy_devices")
@SequenceGenerator(name="id_generated", sequenceName="wlyy_devices")
public class DeviceDetail extends IdEntity {
    private String deviceName;//设备名称
    private String deviceModel;//型号
    private String deviceCode;//设备唯一标识
    private String manufacturer;//厂家名称
    private String applyDate;//申请日期
    private String orgName;//（居民）机构名称
    private String linkman;//联系人（居民）
    private String tel;//联系人（居民）电话
    private String serverIp;//服务IP地址
    private String manufacturerCode;//厂商代码threeNod:三诺 urion:优瑞恩 bioland:爱奥乐 comvee:康为
    private String address;//厂家地址
    private String representative;//法人代表
    private String applicantName;//申请注册人（发放人/医生）
    private String applicantIdentity;//申请人（发放人/医生）身份证号
    private String applicantTel;//申请人（发放人/医生）手机
    private String applicantMail;//申请人（发放人/医生）邮箱

    //1.4.8版本新增字段
    private String sim;//SIM卡 iccid卡号
    private String manufacturerId;//厂商表的业务关联code
    private Integer isGrant;//是否发放（0否1是）
    private String grantAdminTeam;//发放的患者所在团队
    private String grantOrgCode;//发放所在机构
    private Integer isBinding;//是否绑定（0否 1 绑定单端口 2 绑定双端口）
    private String bindingCount;//绑定次数（{"1":"0", "2":"0"}）
    private Date grantTime;//发放时间
    private Integer deviceType;//0健康设备 1安防设备

    //1.5.0版本新增字段
    private String grantDoctor;//发放医生code
    private String grantDoctorName;//发放医生姓名

    private Integer contactStatus;// 失联状态 1未失联 0失联
    private Date contactStatusTime;//失联状态更新时间
    private String iccid;//设备物联卡iccid
    private String imsi;//设备物联卡imsi
    private String categoryCode; // 设备类型 dm_device表定义

    private Long collectNum;//采集数据次数
    private Long abnormalNum;//异常指标数据次数

    //导入设备错误信息
    private String errorMsg;
    private Map<String,String> errorMsgMap = new HashMap<>();
    /** default constructor */
    public DeviceDetail() {
    }

    /** full constructor */
    public DeviceDetail(String deviceName, String deviceModel, String deviceCode, String manufacturer, String applyDate
            , String orgName, String linkman, String tel, String serverIp, String manufacturerCode, String address
            , String representative, String applicantName, String applicantIdentity, String applicantTel, String applicantMail) {
        this.deviceName = deviceName;
        this.deviceModel = deviceModel;
        this.deviceCode = deviceCode;
        this.manufacturer = manufacturer;
        this.applyDate = applyDate;
        this.orgName = orgName;
        this.linkman = linkman;
        this.tel = tel;
        this.serverIp = serverIp;
        this.manufacturerCode = manufacturerCode;
        this.address = address;
        this.representative = representative;
        this.applicantName = applicantName;
        this.applicantIdentity = applicantIdentity;
        this.applicantTel = applicantTel;
        this.applicantMail = applicantMail;
    }

    @Column(name = "device_name")
    public String getDeviceName() {
        return deviceName;
    }

    public void setDeviceName(String deviceName) {
        this.deviceName = deviceName;
    }

    @Column(name = "device_model")
    public String getDeviceModel() {
        return deviceModel;
    }

    public void setDeviceModel(String deviceModel) {
        this.deviceModel = deviceModel;
    }

    @Column(name = "device_code")
    public String getDeviceCode() {
        return deviceCode;
    }

    public void setDeviceCode(String deviceCode) {
        this.deviceCode = deviceCode;
    }

    @Column(name = "manufacturer")
    public String getManufacturer() {
        return manufacturer;
    }

    public void setManufacturer(String manufacturer) {
        this.manufacturer = manufacturer;
    }

    @Column(name = "apply_date")
    public String getApplyDate() {
        return applyDate;
    }

    public void setApplyDate(String applyDate) {
        this.applyDate = applyDate;
    }

    @Column(name = "org_name")
    public String getOrgName() {
        return orgName;
    }

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

//    @Convert(converter = StringFStringEncryptConverter.class)
    @Column(name = "linkman")
    public String getLinkman() {
        return linkman;
    }

    public void setLinkman(String linkman) {
        this.linkman = linkman;
    }

//    @Convert(converter = StringFStringEncryptConverter.class)
    @Column(name = "tel")
    public String getTel() {
        return tel;
    }

    public void setTel(String tel) {
        this.tel = tel;
    }

    @Column(name = "server_ip")
    public String getServerIp() {
        return serverIp;
    }

    public void setServerIp(String serverIp) {
        this.serverIp = serverIp;
    }

    @Column(name = "manufacturerCode")
    public String getManufacturerCode() {
        return manufacturerCode;
    }

    public void setManufacturerCode(String manufacturerCode) {
        this.manufacturerCode = manufacturerCode;
    }

    @Column(name = "address")
    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

//    @Convert(converter = StringFStringEncryptConverter.class)
    @Column(name = "representative")
    public String getRepresentative() {
        return representative;
    }

    public void setRepresentative(String representative) {
        this.representative = representative;
    }

//    @Convert(converter = StringFStringEncryptConverter.class)
    @Column(name = "applicant_name")
    public String getApplicantName() {
        return applicantName;
    }

    public void setApplicantName(String applicantName) {
        this.applicantName = applicantName;
    }

//    @Convert(converter = StringFStringEncryptConverter.class)
    @Column(name = "applicant_identity")
    public String getApplicantIdentity() {
        return applicantIdentity;
    }

    public void setApplicantIdentity(String applicantIdentity) {
        this.applicantIdentity = applicantIdentity;
    }

//    @Convert(converter = StringFStringEncryptConverter.class)
    @Column(name = "applicant_tel")
    public String getApplicantTel() {
        return applicantTel;
    }

    public void setApplicantTel(String applicantTel) {
        this.applicantTel = applicantTel;
    }

    @Column(name = "applicant_mail")
    public String getApplicantMail() {
        return applicantMail;
    }

    public void setApplicantMail(String applicantMail) {
        this.applicantMail = applicantMail;
    }

    @Column(name = "manufacturer_id")
    public String getManufacturerId() {
        return manufacturerId;
    }

    public void setManufacturerId(String manufacturerId) {
        this.manufacturerId = manufacturerId;
    }

    @Column(name = "sim")
    public String getSim() {
        return sim;
    }

    public void setSim(String sim) {
        this.sim = sim;
    }

    @Column(name = "is_grant")
    public Integer getIsGrant() {
        return isGrant;
    }

    public void setIsGrant(Integer grant) {
        isGrant = grant;
    }

    @Column(name = "grant_admin_team")
    public String getGrantAdminTeam() {
        return grantAdminTeam;
    }

    public void setGrantAdminTeam(String grantAdminTeam) {
        this.grantAdminTeam = grantAdminTeam;
    }

    @Column(name = "grant_org_code")
    public String getGrantOrgCode() {
        return grantOrgCode;
    }

    public void setGrantOrgCode(String grantOrgCode) {
        this.grantOrgCode = grantOrgCode;
    }

    @Column(name = "is_binding")
    public Integer getIsBinding() {
        return isBinding;
    }

    public void setIsBinding(Integer isBinding) {
        this.isBinding = isBinding;
    }

    @Column(name = "binding_count")
    public String getBindingCount() {
        return bindingCount;
    }

    public void setBindingCount(String bindingCount) {
        this.bindingCount = bindingCount;
    }

    @Column(name = "grant_time")
    public Date getGrantTime() {
        return grantTime;
    }

    public void setGrantTime(Date grantTime) {
        this.grantTime = grantTime;
    }

    @Column(name = "grant_doctor")
    public String getGrantDoctor() {
        return grantDoctor;
    }

    public void setGrantDoctor(String grantDoctor) {
        this.grantDoctor = grantDoctor;
    }

//    @Convert(converter = StringFStringEncryptConverter.class)
    @Column(name = "grant_doctor_name")
    public String getGrantDoctorName() {
        return grantDoctorName;
    }

    public void setGrantDoctorName(String grantDoctorName) {
        this.grantDoctorName = grantDoctorName;
    }

    @Column(name = "device_type")
    public Integer getDeviceType() {
        return deviceType;
    }

    public void setDeviceType(Integer deviceType) {
        this.deviceType = deviceType;
    }

    @Column(name = "contact_status")
    public Integer getContactStatus() {
        return contactStatus;
    }

    public void setContactStatus(Integer contactStatus) {
        this.contactStatus = contactStatus;
    }

    @Column(name = "contact_status_time")
    public Date getContactStatusTime() {
        return contactStatusTime;
    }

    public void setContactStatusTime(Date contactStatusTime) {
        this.contactStatusTime = contactStatusTime;
    }

    public String getIccid() {
        return iccid;
    }

    public void setIccid(String iccid) {
        this.iccid = iccid;
    }

    public String getImsi() {
        return imsi;
    }

    public void setImsi(String imsi) {
        this.imsi = imsi;
    }

    public String getCategoryCode() {
        return categoryCode;
    }

    public void setCategoryCode(String categoryCode) {
        this.categoryCode = categoryCode;
    }

    @Column(name = "collect_num")
    public Long getCollectNum() {
        return collectNum;
    }

    public void setCollectNum(Long collectNum) {
        this.collectNum = collectNum;
    }

    @Column(name = "abnormal_num")
    public Long getAbnormalNum() {
        return abnormalNum;
    }

    public void setAbnormalNum(Long abnormalNum) {
        this.abnormalNum = abnormalNum;
    }

    @Transient
    public String getErrorMsg() {
        return errorMsg;
    }

    public void setErrorMsg(String errorMsg) {
        this.errorMsg = errorMsg;
    }

    @Transient
    public Map<String, String> getErrorMsgMap() {
        return errorMsgMap;
    }

    public void setErrorMsgMap(Map<String, String> errorMsgMap) {
        this.errorMsgMap = errorMsgMap;
    }
}
