-- NutritionDiagnosis
CREATE TABLE nutrition_diagnosis (
    id BIGINT PRIMARY KEY,
    treatment_user_id BIGINT,
    consultant_template_id BIGINT,
    diagnosis_lable_id VARCHAR(255),
    diagnosis_basis_id VARCHAR(255),
    consultant_result VARCHAR(255),
    medical_order VARCHAR(255),
    del_flag VARCHAR(1),
    create_dept BIGINT,
    create_by BIGINT,
    create_time DATETIME,
    update_by BIGINT,
    update_time DATETIME,
    tenant_id VARCHAR(64)
);

-- NutritionEducationTemplate
CREATE TABLE nutrition_education_template (
    id BIGINT PRIMARY KEY,
    template_name VARCHAR(255),
    dept_id VARCHAR(255),
    disease_label_id VARCHAR(255),
    description VARCHAR(255),
    content TEXT,
    del_flag VARCHAR(1),
    update_dept BIGINT,
    create_dept BIGINT,
    create_by BIGINT,
    create_time DATETIME,
    update_by BIGINT,
    update_time DATETIME,
    tenant_id VARCHAR(64)
);

-- TreatmentUser
CREATE TABLE treatment_user (
    id BIGINT PRIMARY KEY,
    type VARCHAR(255),
    treat_num VARCHAR(255),
    outpatient_no VARCHAR(255),
    door_id BIGINT,
    treat_name VARCHAR(255),
    sex VARCHAR(10),
    birthday VARCHAR(32),
    phone_num VARCHAR(32),
    id_card VARCHAR(32),
    age VARCHAR(8),
    height VARCHAR(8),
    weight VARCHAR(8),
    allergy_foot VARCHAR(255),
    allergy_drug VARCHAR(255),
    activity VARCHAR(255),
    medical_type VARCHAR(255),
    del_flag VARCHAR(1),
    treatment_user_status VARCHAR(32),
    evaluation_status VARCHAR(32),
    create_dept BIGINT,
    create_by BIGINT,
    create_time DATETIME,
    update_by BIGINT,
    update_time DATETIME,
    tenant_id VARCHAR(64)
);

-- SuppliesManage
CREATE TABLE supplies_manage (
    id BIGINT PRIMARY KEY,
    supplies_name VARCHAR(255),
    hospital_system_code VARCHAR(255),
    supplies_code VARCHAR(255),
    product_license_expiry DATETIME,
    manufacturer VARCHAR(255),
    supplier VARCHAR(255),
    license_expiry_reminder VARCHAR(255),
    shelf_life VARCHAR(255),
    product_qualification VARCHAR(255),
    approval_number VARCHAR(255),
    supplies_category_id VARCHAR(255),
    shelf_life_reminder VARCHAR(255),
    brand VARCHAR(255),
    product_label VARCHAR(255),
    applicable_department VARCHAR(255),
    purchase_price DECIMAL(18,2),
    supplies_unit VARCHAR(64),
    sell_price DECIMAL(18,2),
    supplies_spec VARCHAR(255),
    supplies_spec_unit VARCHAR(64),
    del_flag VARCHAR(1),
    put_flag VARCHAR(1),
    create_dept BIGINT,
    create_by BIGINT,
    create_time DATETIME,
    update_by BIGINT,
    update_time DATETIME,
    tenant_id VARCHAR(64)
);

-- SuppliesCategory
CREATE TABLE supplies_category (
    category_id BIGINT PRIMARY KEY,
    parent_id BIGINT,
    category_name VARCHAR(255),
    order_num BIGINT,
    del_flag VARCHAR(1),
    create_dept BIGINT,
    create_by BIGINT,
    create_time DATETIME,
    update_by BIGINT,
    update_time DATETIME,
    tenant_id VARCHAR(64)
);

-- StorageLocation
CREATE TABLE storage_location (
    id BIGINT PRIMARY KEY,
    storage_name VARCHAR(255),
    description VARCHAR(255),
    del_flag VARCHAR(1),
    create_dept BIGINT,
    create_by BIGINT,
    create_time DATETIME,
    update_by BIGINT,
    update_time DATETIME,
    tenant_id VARCHAR(64)
);

-- ProductSupplier
CREATE TABLE product_supplier (
    id BIGINT PRIMARY KEY,
    name VARCHAR(255),
    contact_name VARCHAR(255),
    contact_phone VARCHAR(32),
    address VARCHAR(255),
    description VARCHAR(255),
    del_flag VARCHAR(1),
    create_dept BIGINT,
    create_by BIGINT,
    create_time DATETIME,
    update_by BIGINT,
    update_time DATETIME,
    tenant_id VARCHAR(64)
);

-- ProductManufacturer
CREATE TABLE product_manufacturer (
    id BIGINT PRIMARY KEY,
    tenant_id VARCHAR(64),
    name VARCHAR(255),
    contact_name VARCHAR(255),
    contact_phone VARCHAR(32),
    address VARCHAR(255),
    description VARCHAR(255),
    del_flag VARCHAR(1),
    create_dept BIGINT,
    create_by BIGINT,
    create_time DATETIME,
    update_by BIGINT,
    update_time DATETIME
);

-- ProductCategory
CREATE TABLE product_category (
    category_id BIGINT PRIMARY KEY,
    parent_id BIGINT,
    category_name VARCHAR(255),
    order_num BIGINT,
    del_flag VARCHAR(1),
    create_dept BIGINT,
    create_by BIGINT,
    create_time DATETIME,
    update_by BIGINT,
    update_time DATETIME,
    tenant_id VARCHAR(64)
);

-- ProductNutrition
CREATE TABLE product_nutrition (
    id BIGINT PRIMARY KEY,
    product_name VARCHAR(255),
    hospital_system_code VARCHAR(255),
    product_code VARCHAR(255),
    product_category VARCHAR(255),
    manufacturer VARCHAR(255),
    brand VARCHAR(255),
    product_label VARCHAR(255),
    license_expiry_reminder VARCHAR(255),
    product_license_expiry DATETIME,
    product_qualification VARCHAR(255),
    approval_number VARCHAR(255),
    taste VARCHAR(255),
    dosage_form VARCHAR(255),
    supplier VARCHAR(255),
    applicable_department VARCHAR(255),
    contraindication_label VARCHAR(255),
    shelf_life_reminder VARCHAR(255),
    shelf_life VARCHAR(255),
    purchase_price BIGINT,
    purchase_unit VARCHAR(64),
    default_usage VARCHAR(255),
    package_unit VARCHAR(64),
    product_spec VARCHAR(255),
    product_spec_unit VARCHAR(64),
    package_price BIGINT,
    min_unit VARCHAR(64),
    min_spec VARCHAR(255),
    net_content VARCHAR(255),
    config_sale_price BIGINT,
    config_loss_rate BIGINT,
    calorie BIGINT,
    carbohydrate BIGINT,
    heat_energy BIGINT,
    protein BIGINT,
    fat BIGINT,
    ca BIGINT,
    p BIGINT,
    k BIGINT,
    na BIGINT,
    mg BIGINT,
    cl BIGINT,
    fe BIGINT,
    zn BIGINT,
    se BIGINT,
    cu BIGINT,
    mn BIGINT,
    i BIGINT,
    f BIGINT,
    cr BIGINT,
    mo BIGINT,
    isoleucine BIGINT,
    tryptophan BIGINT,
    sulfur_amino_acid BIGINT,
    histidine BIGINT,
    aromatic_amino_acid BIGINT,
    glutamic_acid BIGINT,
    threonine BIGINT,
    serine BIGINT,
    arginine BIGINT,
    lysine BIGINT,
    aspartic_acid BIGINT,
    cysteine BIGINT,
    proline BIGINT,
    tyrosine BIGINT,
    leucine BIGINT,
    valine BIGINT,
    methionine BIGINT,
    alanine BIGINT,
    phenylalanine BIGINT,
    glycine BIGINT,
    fatty_acid BIGINT,
    saturated_fatty_acid BIGINT,
    monounsaturated_fatty_acid BIGINT,
    polyunsaturated_fatty_acid BIGINT,
    vitamin_a BIGINT,
    vitamin_a_carotene BIGINT,
    vitamin_a_alcohol BIGINT,
    vitamin_d BIGINT,
    vitamin_e BIGINT,
    vitamin_e_tocopherol BIGINT,
    vitamin_k BIGINT,
    vitamin_b_one BIGINT,
    vitamin_b_two BIGINT,
    vitamin_b_six BIGINT,
    vitamin_b_twelve BIGINT,
    niacin BIGINT,
    vitamin_c BIGINT,
    folic_acid BIGINT,
    choline BIGINT,
    biotin BIGINT,
    pantothenic_acid BIGINT,
    cholesterol BIGINT,
    blood_glucose_index BIGINT,
    insoluble_dietary_fiber BIGINT,
    dietary_fiber BIGINT,
    ash BIGINT,
    soluble_dietary_fiber BIGINT,
    applicable_crowd VARCHAR(255),
    unsuitable_crowd VARCHAR(255),
    osmotic_pressure BIGINT,
    raw_material VARCHAR(255),
    indications_contraindications VARCHAR(255),
    usage_and_dosage VARCHAR(255),
    product_features VARCHAR(255),
    storage_conditions VARCHAR(255),
    warning_instructions VARCHAR(255),
    product_attachments VARCHAR(255),
    status BIGINT,
    del_flag VARCHAR(1),
    put_flag VARCHAR(1),
    create_dept BIGINT,
    create_by BIGINT,
    create_time DATETIME,
    update_by BIGINT,
    update_time DATETIME,
    tenant_id VARCHAR(64)
);

-- ConsultantResultTemplateType
CREATE TABLE consultant_result_template_type (
    id BIGINT PRIMARY KEY,
    template_type VARCHAR(255),
    del_flag VARCHAR(1),
    create_dept BIGINT,
    create_by BIGINT,
    create_time DATETIME,
    update_by BIGINT,
    update_time DATETIME,
    tenant_id VARCHAR(64)
);

-- ConsultantResultTemplate
CREATE TABLE consultant_result_template (
    id BIGINT PRIMARY KEY,
    template_name VARCHAR(255),
    template_type_id BIGINT,
    description VARCHAR(255),
    content TEXT,
    create_dept BIGINT,
    update_dept BIGINT,
    create_by BIGINT,
    create_time DATETIME,
    update_by BIGINT,
    update_time DATETIME,
    del_flag VARCHAR(1),
    tenant_id VARCHAR(64)
); 