# coding: utf-8
from sqlalchemy import Column, DECIMAL, Date, DateTime, Index, String, text
from sqlalchemy.dialects.mysql import BIT, CHAR, INTEGER, TINYINT, VARCHAR

from config.mysql import Base


class ZxPhhd(Base):
    __tablename__ = 'zx_phhd'
    __table_args__ = (
        Index('zx_phhd_idx7', 'pk_yljg', 'cjsd_id'),
        Index('zx_phhd_idx5', 'cStatus', 'checker', 'checktime')
    )

    pk_phhd = Column(INTEGER(11), primary_key=True, comment='病案主键')
    cPhhd_id = Column(VARCHAR(20), unique=True, comment='拍一拍单据号')
    billdate = Column(DateTime, index=True)
    pk_person = Column(INTEGER(11), server_default=text("'0'"), comment='人员主键')
    pk_corp = Column(INTEGER(11), index=True, server_default=text("'0'"), comment='单位主键')
    cRyid = Column(VARCHAR(20), comment='人员编码')
    cJBH = Column(VARCHAR(20), comment='结报号')
    cXm = Column(String(12), comment='姓名')
    cSfzh = Column(VARCHAR(20), index=True, comment='身份证号')
    czh = Column(VARCHAR(20), comment='小组')
    cXb = Column(VARCHAR(2), comment='性别')
    dCsny = Column(Date, comment='出身时间')
    fAge = Column(INTEGER(4), server_default=text("'0'"), comment='年龄')
    pk_yljg = Column(INTEGER(11), server_default=text("'0'"), comment='医院pk')
    pk_ylks = Column(INTEGER(11), server_default=text("'0'"), comment='科室pk')
    cDoctor = Column(VARCHAR(20), comment='医生')
    dZYRQ = Column(DateTime, comment='入院日期')
    dCYRQ = Column(DateTime)
    cZYH = Column(VARCHAR(20), comment='住院号')
    iMZTS = Column(INTEGER(4), server_default=text("'0'"), comment='住院天数')
    fFSYLFY = Column(DECIMAL(18, 2), server_default=text("'0.00'"), comment='发生医疗费用')
    fZcfwfy = Column(DECIMAL(18, 2), server_default=text("'0.00'"), comment='政策范围内费用')
    fxnhbcje = Column(DECIMAL(18, 2), server_default=text("'0.00'"), comment='新农合补助金额')
    fqtbcje = Column(DECIMAL(18, 2), server_default=text("'0.00'"), comment='其它补助金额')
    fBCJE = Column(DECIMAL(18, 2), server_default=text("'0.00'"), comment='补偿金额')
    fgrzfje1 = Column(DECIMAL(18, 2), server_default=text("'0.00'"), comment='个人支付金额1')
    fgezfje2 = Column(DECIMAL(18, 2), server_default=text("'0.00'"), comment='个人支付金额2')
    fgrzfje = Column(DECIMAL(18, 2), server_default=text("'0.00'"), comment='个人自费金额')
    fZfje = Column(DECIMAL(18, 2), server_default=text("'0.00'"), comment='自付金额')
    fXianje = Column(DECIMAL(18, 2), server_default=text("'0.00'"), comment='限额')
    fMaxbcje = Column(DECIMAL(18, 2), server_default=text("'0.00'"), comment='最高支付')
    cJBBM = Column(VARCHAR(20), server_default=text("'-'"), comment='疾病编码')
    cJbbm_cyzd = Column(VARCHAR(20), comment='疾病编码出院诊断')
    cSsczmc = Column(VARCHAR(100), comment='手术操作名称')
    problem_note = Column(String(400))
    depiction = Column(VARCHAR(300), comment='备注')
    creator = Column(VARCHAR(30), index=True, comment='创建人')
    creationtime = Column(DateTime, index=True, server_default=text("CURRENT_TIMESTAMP"), comment='创建时间')
    modifier = Column(VARCHAR(30), comment='最后修改人')
    modifiedtime = Column(DateTime, server_default=text("CURRENT_TIMESTAMP"), comment='最后修改时间')
    cStatus = Column(CHAR(1), server_default=text("'0'"), comment='状态')
    vercode = Column(VARCHAR(4), comment='版本编码')
    cSource_flag = Column(VARCHAR(4), server_default=text("'1'"), comment='病案来源')
    ref_id1 = Column(VARCHAR(20))
    ref_id2 = Column(VARCHAR(20))
    ref_pk1 = Column(INTEGER(11))
    checker = Column(VARCHAR(30), comment='创建人')
    checktime = Column(DateTime, comment='创建时间')
    paint_user = Column(VARCHAR(30))
    paint_date = Column(DateTime)
    filetype_id = Column(VARCHAR(10), comment='文件类型id')
    cMphone = Column(VARCHAR(11), comment='移动电话')
    cmiss_rectype = Column(VARCHAR(10), comment='遗漏记录类型')
    cmiss_remark = Column(VARCHAR(200), comment='遗漏备注 ')
    bhg_remark = Column(VARCHAR(200), comment='不合格原因')
    cmis_jsd_flag = Column(BIT(1))
    cmis_jsd_page = Column(VARCHAR(40), comment='结算单遗漏页码')
    cmis_cyjl_flag = Column(BIT(1))
    cmis_cyjl_page = Column(VARCHAR(40), comment='出院记录遗漏页码')
    cmis_fyqd_flag = Column(BIT(1))
    cmis_fyqd_page = Column(VARCHAR(40), comment='费用清单遗漏页码')
    cmis_evidence = Column(VARCHAR(60), comment='相关证明材料')
    del_reason = Column(CHAR(1), server_default=text("'0'"), comment='删除原因')
    deln_reason = Column(VARCHAR(2), comment='删除原因')
    train_flag = Column(VARCHAR(10), server_default=text("'0'"), comment='培训标志')
    cjsd_id = Column(VARCHAR(30), comment='结算单号码')
    sms_content = Column(String(1000), comment='短信内容')
    judge_backup = Column(VARCHAR(100))
    remind_num = Column(INTEGER(11), server_default=text("'0'"), comment='提醒次数')
    input_cxm = Column(String(20), comment='姓名核对')
    yb_type = Column(VARCHAR(10), comment='医保类别')
    bucode = Column(VARCHAR(4), server_default=text("'1'"), comment='业务单元')
    subcorpname = Column(VARCHAR(80), comment='子公司')
    deptname = Column(VARCHAR(80), comment='部门')
    psncode = Column(VARCHAR(16), comment='工号')
    period_code = Column(VARCHAR(10), comment='会计期间')
    cbznote = Column(VARCHAR(500))
    corp_list = Column(VARCHAR(200), comment='其它补助单位及年度')
    perjudge_flag = Column(CHAR(1), server_default=text("'0'"), comment='人员信息判断标志')
    priority_num = Column(TINYINT(4), server_default=text("'0'"), comment='优先领取')
    addin_xybz = Column(BIT(1))
    addin_tybz = Column(BIT(1))
    finish_flag = Column(BIT(1))
    exsuccess_flag = Column(BIT(1))
    pk_soncorp = Column(INTEGER(11), server_default=text("'0'"), comment='镇下村单位pk值')
    return_times = Column(INTEGER(11), server_default=text("'0'"), comment='退回次数')
    phuser_type = Column(CHAR(1), server_default=text("'1'"), comment='拍传人类型(1-自拍，2代拍，3管理员代拍)')
    examine_note = Column(VARCHAR(400), comment='抽查意见')
    examine_user = Column(VARCHAR(30), comment='抽查人')
    examine_date = Column(DateTime, comment='抽查时间')
    channel_code = Column(VARCHAR(10), comment='上传渠道')
    einvoice_flag = Column(BIT(1))
    drgs_flag = Column(CHAR(1), server_default=text("'0'"), comment='病种类型(0-无,1-单病种,2-drg)')
    applyDate = Column(DateTime)
    admissionDate = Column(Date, comment='入院日期')
    dischargeDate = Column(Date, comment='出院日期')
    reapplyDate = Column(Date, comment='重新上传日期')
    exreq_times = Column(INTEGER(11), server_default=text("'0'"), comment='请求次数')
    drug_source = Column(CHAR(1), server_default=text("'0'"), comment='药品来源(1-外购药,0--没有）')
    addin_passpaydate = Column(BIT(1))
    apply_classid = Column(CHAR(1), server_default=text("'0'"), comment='申请人员类别(1-农民工,0-默认)')
