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

import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.iot.gateway.IdEntity;

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

@Entity
@Table(name = "wlyy_patient_device")
@SequenceGenerator(name="id_generated", sequenceName="wlyy_patient_device")
public class DevicePatientDevice extends IdEntity {

    // 设备ID
    private Long deviceId;
    // 设备标识
    private String deviceSn;
    //sim卡号
    private String sim;
    // 设备名称
    private String deviceName;
    // 用户code
    private String user;
    // 设备类型标识 1血糖仪，2.血压计,3药盒,4智能手表，7 = 居家报警器,12 监控器 13 睡眠带 14气感报警器 15烟感报警器 16拐杖 17随身wifi
    private String categoryCode;//DEVICE_CATEGORY_CODE字典同步更新
    // 用户类型标准 -1代表单用户
    private String userType;
    // 用户身份证
    private String userIdcard;
    // 操作医生代码
    private String doctor;
    //操作医生姓名
    private String doctorName;
    //代绑人代码（家人）
    private String agent;
    //代绑人姓名
    private String agentName;
    // 操作时间
    private Date czrq;

    //解绑人
    private String delUser;
    //1-解绑，0-绑定
    private Integer del;

    //设备活动类型
    private String deviceActivityType;

    //上传的协议图片地址
    private String agreementPhoto;

    //居民签约所在社区
    private String hospital;

    //居民签约所在社区名字
    private String hospitalName;

    //登记医生名字
    private String checkDoctorName;
    
    //0未申请 1审核中 2被拒绝
    private Integer applyStatus;
    
    //申请原因
    private String applyReason;
    //医生拒绝原因
    private String refuseReason;

    //设备类型为报警器时，需要填写投放地址 category_code = 7
    private String sosAddress;

  //========================非表字段======================
    //患者居住地址
    private String address;
    /**
     * 设备图片
     */
    private String deviceImgUrl;

    private Integer deviceType;//设备种类 0健康设备 1安防设备

    /**
     * wifi对应的设备
     */
    private String iotDeviceSn;

    /**
     * 智能拐杖对应的围栏
     */
    private String safeAreaGz;

    @Column(name = "device_id")
    public Long getDeviceId() {
        return deviceId;
    }

    public void setDeviceId(Long deviceId) {
        this.deviceId = deviceId;
    }

    @Column(name = "device_sn")
    public String getDeviceSn() {
        return deviceSn;
    }

    public void setDeviceSn(String deviceSn) {
        this.deviceSn = deviceSn;
    }

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

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

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

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

    @Column(name = "user")
    public String getUser() {
        return user;
    }

    public void setUser(String user) {
        this.user = user;
    }

    @Column(name = "category_code")
    public String getCategoryCode() {
        return categoryCode;
    }

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

    @Column(name = "user_type")
    public String getUserType() {
        return userType;
    }

    public void setUserType(String userType) {
        this.userType = userType;
    }

    @Column(name = "user_idcard")
    public String getUserIdcard() {
        return userIdcard;
    }

    public void setUserIdcard(String userIdcard) {
        this.userIdcard = userIdcard;
    }

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name = "czrq")
    public Date getCzrq() {
        return czrq;
    }

    public void setCzrq(Date czrq) {
        this.czrq = czrq;
    }

    @Column(name = "doctor")
    public String getDoctor() {
        return doctor;
    }

    public void setDoctor(String doctor) {
        this.doctor = doctor;
    }

    @Column(name = "doctor_name")
    public String getDoctorName() {
        return doctorName;
    }

    public void setDoctorName(String doctorName) {
        this.doctorName = doctorName;
    }

    @Column(name = "agent")
    public String getAgent() {
        return agent;
    }

    public void setAgent(String agent) {
        this.agent = agent;
    }

    @Column(name = "agent_name")
    public String getAgentName() {
        return agentName;
    }

    public void setAgentName(String agentName) {
        this.agentName = agentName;
    }

    @Column(name = "del_user")
    public String getDelUser() {
        return delUser;
    }

    public void setDelUser(String delUser) {
        this.delUser = delUser;
    }

    @Column(name = "del")
    public Integer getDel() {
        return del;
    }

    public void setDel(Integer del) {
        this.del = del;
    }

    @Column(name = "device_activity_type")
    public String getDeviceActivityType() {
        return deviceActivityType;
    }

    public void setDeviceActivityType(String deviceActivityType) {
        this.deviceActivityType = deviceActivityType;
    }

    @Column(name = "agreement_photo")
    public String getAgreementPhoto() {
        return agreementPhoto;
    }

    public void setAgreementPhoto(String agreementPhoto) {
        this.agreementPhoto = agreementPhoto;
    }

    @Column(name = "hospital")
    public String getHospital() {
        return hospital;
    }

    public void setHospital(String hospital) {
        this.hospital = hospital;
    }

    @Column(name = "hospital_name")
    public String getHospitalName() {
        return hospitalName;
    }

    public void setHospitalName(String hospitalName) {
        this.hospitalName = hospitalName;
    }

    @Column(name = "check_doctor_name")
    public String getCheckDoctorName() {
        return checkDoctorName;
    }

    public void setCheckDoctorName(String checkDoctorName) {
        this.checkDoctorName = checkDoctorName;
    }

    @Column(name = "sos_address")
    public String getSosAddress() {
        return sosAddress;
    }

    public void setSosAddress(String sosAddress) {
        this.sosAddress = sosAddress;
    }

    @Transient
    public String getAddress() {
        return address;
    }

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

    public DevicePatientDevice(String address, Date czrq, String userIdcard, String deviceSn, Long deviceId) {
        this.address = address;
        this.czrq = czrq;
        this.userIdcard = userIdcard;
        this.deviceSn = deviceSn;
        this.deviceId = deviceId;
    }

    public DevicePatientDevice() {
    }
    
    public Integer getApplyStatus() {
        return applyStatus;
    }
    
    public void setApplyStatus(Integer applyStatus) {
        this.applyStatus = applyStatus;
    }
    
    public String getApplyReason() {
        return applyReason;
    }
    
    public void setApplyReason(String applyReason) {
        this.applyReason = applyReason;
    }

    public String getRefuseReason() {
        return refuseReason;
    }

    public void setRefuseReason(String refuseReason) {
        this.refuseReason = refuseReason;
    }

    @Transient
    public String getDeviceImgUrl() {
        return deviceImgUrl;
    }

    public void setDeviceImgUrl(String deviceImgUrl) {
        this.deviceImgUrl = deviceImgUrl;
    }

    public Integer getDeviceType() {
        return deviceType;
    }

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

    public String getIotDeviceSn() {
        return iotDeviceSn;
    }

    public void setIotDeviceSn(String iotDeviceSn) {
        this.iotDeviceSn = iotDeviceSn;
    }

    public String getSafeAreaGz() {
        return safeAreaGz;
    }

    public void setSafeAreaGz(String safeAreaGz) {
        this.safeAreaGz = safeAreaGz;
    }
}
