import dash
from dash import html
import feffery_utils_components as fuc
import feffery_antd_components as fac
import feffery_markdown_components as fmc
import feffery_antd_charts as fact

import os
from datetime import datetime

from uuid import uuid4




############################## 初始界面布局  ##########################################
app = dash.Dash(
    __name__,
    suppress_callback_exceptions=True,
    update_title=None,
)


########################################### config 开始 ########################################

doctor_list = ['陈金凤', '吴馨馨', '冯再明']
########################################### config 结束 ########################################


gbs_score_div = html.Div(
    children = [
        fac.AntdCol(
            [
                # 第1行，标题
                fac.AntdRow(
                    html.H1("Glasgow Blatchford Score(GBS)评分表"),
                    # className = ""
                    style = {
                        'display': 'flex',
                        'justifyContent': 'center',
                        'alignItems': 'center',
                        'borderTop' : '#e0e0e0 solid',   # 显示边框模拟表格，但会重叠，故只设置上下边框 
                        'borderBottom' : '#e0e0e0 solid',       
                        }
                ),

                # 第2行，字段，3列
                fac.AntdRow(
                    [
                        fac.AntdCol(
                            fac.AntdText(
                                '指标',
                                style = {
                                    'fontSize' : '20px',
                                    'fontWeight' : 'bold',
                                    'color':'white',
                                }
                            ),
                            style = {
                                    'backgroundColor': '#7F7FD5',
                                    'textAlign' : 'center',
                                    'borderRight' : '#e0e0e0 solid'
                                },
                            flex = '3',  # 字符型，写成数值型不生效
                        ),
                        fac.AntdCol(
                            fac.AntdText(
                                '参数',
                                style = {
                                    'fontSize' : '20px',
                                    'fontWeight' : 'bold',
                                    'color':'white',

                                }
                                
                            ),
                            style = {
                                    'backgroundColor': '#7F7FD5',
                                    'textAlign' : 'center',
                                    'borderRight' : '#e0e0e0 solid'
                                },
                            flex = '4',
                        ),
                        fac.AntdCol(
                            fac.AntdText(
                                '得分',
                                style = {
                                    'fontSize' : '20px',
                                    'fontWeight' : 'bold',
                                    'color':'white',
                                }
                            ),
                            style = {
                                    'backgroundColor': '#7F7FD5',
                                    'textAlign' : 'center',
                                },
                            flex = '3',
                        )

                    ],
                    style = {
                        'borderBottom' : '#e0e0e0 solid',   # 从第2行开始，只显示下边框，防止与上一行的下边框重叠
                        'height' : '40px',     
                        }
                ),

                # 第3行，收缩压，高度为3行
                fac.AntdRow(
                    [
                        fac.AntdCol(
                            fac.AntdText(
                                '收缩压（mmHg）',
                                style = {
                                    'fontSize' : '20px',
                                    'fontWeight' : 'bold',
                                }
                            ),
                            style = {
                                    'display': 'flex',
                                    'alignItems': 'center',
                                    'justifyContent' : 'center',
                                    'borderRight' : '#e0e0e0 solid'
                                },
                            flex = '3',
                        ),

                        # 第2列
                        fac.AntdCol(
                            fac.AntdRadioGroup(
                                options=[
                                    {
                                        'label': sbp,
                                        'value': sbp
                                    }
                                    for sbp in [
                                                '1分：100 ~ 109',
                                                '2分：90 ~ 100',
                                                '3分：< 90'
                                                ]
                                ],
                                style = {
                                    'fontSize' : '18px',
                                },
                                direction='vertical'
                            ),
                            style = {
                                    'display': 'flex',
                                    'alignItems': 'center',
                                    'justifyContent' : 'center',
                                    'borderRight' : '#e0e0e0 solid'
                                },
                            flex = '4',
                        ),


                        # 第3列
                        fac.AntdCol(
                            fac.AntdInputNumber(
                                min = 1,
                                max = 3,
                                step = 1,
                                style = {
                                    'width' : '60%',
                                    'fontSize' : '20px',
                                    'fontWeight' : 'bold',
                                },
                                disabled = False,
                            ),
                            style = {
                                    'display': 'flex',
                                    'alignItems': 'center',
                                    'justifyContent' : 'center',
                                },
                            flex = '3',
                        )

                    ],
                    style = {
                        'borderBottom' : '#e0e0e0 solid',   
                        'height' : '120px',     
                    }
                ),

                # 第4行，血尿素氮，高度为3行
                fac.AntdRow(
                    [
                        fac.AntdCol(
                            fac.AntdText(
                                '血尿素氮（mmol/L）',
                                style = {
                                    'fontSize' : '20px',
                                    'fontWeight' : 'bold',
                                }
                            ),
                            style = {
                                    'display': 'flex',
                                    'alignItems': 'center',
                                    'justifyContent' : 'center',
                                    'borderRight' : '#e0e0e0 solid'
                                },
                            flex = '3',
                        ),

                        # 第2列
                        fac.AntdCol(
                            fac.AntdRadioGroup(
                                options=[
                                    {
                                        'label': bun,
                                        'value': bun
                                    }
                                    for bun in [
                                                '2分：6.5 ~ 7.9',
                                                '3分：8.0 ~ 9.9',
                                                '4分：10.0 ~ 24.9',
                                                '6分：≥ 25',
                                                ]
                                ],
                                style = {
                                    'fontSize' : '18px',
                                },
                                direction='vertical'
                            ),
                            style = {
                                    'display': 'flex',
                                    'alignItems': 'center',
                                    'justifyContent' : 'center',
                                    'borderRight' : '#e0e0e0 solid'
                                },
                            flex = '4',
                        ),


                        # 第3列
                        fac.AntdCol(
                            fac.AntdInputNumber(
                                min = 2,
                                max = 6,
                                step = 1,
                                style = {
                                    'width' : '60%',
                                    'fontSize' : '20px',
                                    'fontWeight' : 'bold',
                                },
                                disabled = False,
                            ),
                            style = {
                                    'display': 'flex',
                                    'alignItems': 'center',
                                    'justifyContent' : 'center',
                                },
                            flex = '3',
                        )

                    ],
                    style = {
                        'borderBottom' : '#e0e0e0 solid',   
                        'height' : '160px',     
                    }
                ),

                # 第5行，血红蛋白，高度为3行
                fac.AntdRow(
                    [
                        fac.AntdCol(
                            fac.AntdText(
                                '血红蛋白（g/L）',
                                style = {
                                    'fontSize' : '20px',
                                    'fontWeight' : 'bold',
                                }
                            ),
                            style = {
                                    'display': 'flex',
                                    'alignItems': 'center',
                                    'justifyContent' : 'center',
                                    'borderRight' : '#e0e0e0 solid'
                                },
                            flex = '3',
                        ),

                        # 第2列，
                        fac.AntdCol(
                            # 又细分为2行2列
                            [   
                                # 第1行
                                fac.AntdRow(
                                    
                                    [
                                        # 第1列
                                        fac.AntdCol(
                                            fac.AntdText(
                                                '男性',
                                                style = {
                                                    'fontSize' : '18px'
                                                }
                                            ),
                                            style = {
                                                'display' : 'flex',
                                                'alignItems': 'center',
                                                'justifyContent' : 'center',
                                            },
                                            span = 10
                                        ),

                                        # 第2列
                                        fac.AntdCol(
                                            fac.AntdRadioGroup(
                                                options=[
                                                    {
                                                        'label': hgb_m,
                                                        'value': hgb_m
                                                    }
                                                    for hgb_m in [
                                                                '1分：120 ~ 129',
                                                                '3分：110 ~ 119',
                                                                '6分：< 100',
                                                                ]
                                                ],
                                                style = {
                                                    'margin' : '0 0 0 5px',
                                                    'fontSize' : '18px',
                                                }
                                            ),
                                            style = {
                                                'display' : 'flex',
                                                'alignItems': 'center',
                                                'justifyContent' : 'center',
                                                'borderLeft' : '#e0e0e0 solid'
                                            },
                                            span = 14
                                        ),
                                    ],
                                    style = {
                                        'display': 'flex',
                                        'alignItems': 'center',
                                        'justifyContent' : 'center',
                                        'borderBottom' : '#e0e0e0 solid',
                                    },
                                ),

                                # 第2行
                                fac.AntdRow(
                                    [
                                        # 第1列
                                        fac.AntdCol(
                                            fac.AntdText(
                                                '女性',
                                                style = {
                                                    'fontSize' : '18px'
                                                }
                                            ),
                                            style = {
                                                'display' : 'flex',
                                                'alignItems': 'center',
                                                'justifyContent' : 'center',
                                            },
                                            span = 10
                                        ),

                                        # 第2列
                                        fac.AntdCol(
                                            fac.AntdRadioGroup(
                                                options=[
                                                    {
                                                        'label': hgb_f,
                                                        'value': hgb_f
                                                    }
                                                    for hgb_f in [
                                                                '1分：100 ~ 119',
                                                                '6分：< 100',
                                                                ]
                                                ],
                                                style = {
                                                    'fontSize' : '18px',
                                                    'margin' : '0 0 0 5px',
                                                }
                                            ),
                                            style = {
                                                'display' : 'flex',
                                                'alignItems': 'center',
                                                'justifyContent' : 'center',
                                                'borderLeft' : '#e0e0e0 solid'
                                            },
                                            span = 14,
                                        ),
                                    ],
                                    style = {
                                        'display': 'flex',
                                        'alignItems': 'center',
                                        'justifyContent' : 'center',
                                    },
                                ),


                            ],
                            style = {
                                    # 'display': 'flex',    # 注释掉才能正确显示为上下两行
                                    'alignItems': 'center',
                                    'justifyContent' : 'center',
                                    'borderRight' : '#e0e0e0 solid'
                                },
                            flex = '4',
                        ),


                        # 第3列
                        fac.AntdCol(
                            fac.AntdInputNumber(
                                min = 1,
                                max = 6,
                                step = 1,
                                style = {
                                    'width' : '60%',
                                    'fontSize' : '20px',
                                    'fontWeight' : 'bold',
                                },
                                disabled = False,
                            ),
                            style = {
                                    'display': 'flex',
                                    'alignItems': 'center',
                                    'justifyContent' : 'center',
                                },
                            flex = '3',
                        )

                    ],
                    style = {
                        'borderBottom' : '#e0e0e0 solid',   
                        'height' : '145px',     # 调整行高，使边框相接 
                    }
                ),

                # 第6行，其他表现
                fac.AntdRow(
                    [   # 第1列
                        fac.AntdCol(
                            fac.AntdText(
                                '其他表现',
                                style = {
                                    'fontSize' : '20px',
                                    'fontWeight' : 'bold',
                                }
                            ),
                            style = {
                                    'display': 'flex',
                                    'alignItems': 'center',
                                    'justifyContent' : 'center',
                                    'borderRight' : '#e0e0e0 solid'
                                },
                            flex = '3',
                        ),

                        # 第2列
                        fac.AntdCol(
                            fac.AntdRow(
                                [
                                    fac.AntdCol(
                                        fac.AntdCheckbox(
                                            label = '1分：脉搏 ≥ 100次/min',
                                            style = {
                                                'margin': '0 0 0 100px',
                                                'display': 'flex',
                                                'alignItems': 'center',
                                                'justifyContent' : 'left',
                                            }
                                        ),
                                        span = 24,
                                    ),
                                    fac.AntdCol(
                                        fac.AntdCheckbox(
                                            label = '1分：有黑便',
                                            style = {
                                                'margin': '0 0 0 100px',
                                                'display': 'flex',
                                                'alignItems': 'center',
                                                'justifyContent' : 'left',
                                            }
                                        ),
                                        span = 24,
                                    ),
                                    fac.AntdCol(
                                        fac.AntdCheckbox(
                                            label = '2分：有晕厥',
                                            style = {
                                                'margin': '0 0 0 100px',
                                                'display': 'flex',
                                                'alignItems': 'center',
                                                'justifyContent' : 'left',
                                            }
                                        ),
                                        span = 24,
                                    ),
                                    fac.AntdCol(
                                        fac.AntdCheckbox(
                                            label = '2分：有肝脏疾病',
                                            style = {
                                                'margin': '0 0 0 100px',
                                                'display': 'flex',
                                                'alignItems': 'center',
                                                'justifyContent' : 'left',
                                            }
                                        ),
                                        span = 24,
                                    ),
                                    fac.AntdCol(
                                        fac.AntdCheckbox(
                                            label = '2分：有心力衰竭',
                                            style = {
                                                'margin': '0 0 0 100px',
                                                'display': 'flex',
                                                'alignItems': 'center',
                                                'justifyContent' : 'left',
                                            }
                                        ),
                                        span = 24,
                                    )
                                ]
                            ),
                            style = {
                                    'display': 'flex',
                                    'alignItems': 'center',
                                    'justifyContent' : 'center',
                                    'borderRight' : '#e0e0e0 solid'
                                },
                            flex = '4',
                        ),


                        # 第3列
                        fac.AntdCol(
                            fac.AntdInputNumber(
                                min = 1,
                                max = 2,
                                step = 1,
                                style = {
                                    'width' : '60%',
                                    'fontSize' : '20px',
                                    'fontWeight' : 'bold',
                                },
                                disabled = False,
                            ),
                            style = {
                                    'display': 'flex',
                                    'alignItems': 'center',
                                    'justifyContent' : 'center',
                                },
                            flex = '3',
                        )

                    ],
                    style = {
                        'borderBottom' : '#e0e0e0 solid',   
                        'height' : '160px',     
                    }
                ),

                # 第7行，总分及分级
                fac.AntdRow(
                    [   # 第1列
                        fac.AntdCol(
                            fac.AntdText(
                                '总分',
                                style = {
                                    'fontSize' : '20px',
                                    'fontWeight' : 'bold',
                                }
                            ),
                            style = {
                                    'display': 'flex',
                                    'alignItems': 'center',
                                    'justifyContent' : 'center',
                                    'borderRight' : '#e0e0e0 solid'
                                },
                            flex = '3',
                        ),

                        # 第2列
                        fac.AntdCol(
                            fac.AntdRadioGroup(
                                options=[
                                    {
                                        'label': gbs_risk,
                                        'value': gbs_risk
                                    }
                                    for gbs_risk in ['<6分：低危', '≥6分：中高危']
                                ],
                                direction = 'vertical'
                            ),
                            style = {
                                    'display': 'flex',
                                    'alignItems': 'center',
                                    'justifyContent' : 'center',
                                    'borderRight' : '#e0e0e0 solid'
                                },
                            flex = '4',
                        ),


                        # 第3列
                        fac.AntdCol(
                            fac.AntdRow(
                                [   
                                    fac.AntdCol(
                                        fac.AntdInputNumber(
                                            min = 0,
                                            max = 23,
                                            step = 1,
                                            style = {
                                                'width' : '60%',
                                                'fontSize' : '20px',
                                                'fontWeight' : 'bold',
                                            },
                                            disabled = False,
                                        ),
                                        style = {
                                            'display': 'flex',
                                            'alignItems': 'center',
                                            'justifyContent' : 'center',                                        },
                                        span = 24,
                                    ),
                                    fac.AntdCol(
                                        fac.AntdText(
                                            "评分越高，胃镜越有必要。"
                                        ),
                                        style = {
                                            'display': 'flex',
                                            'alignItems': 'center',
                                            'justifyContent' : 'center',
                                        },
                                        span = 24,
                                    ),
                                ],
                            ),
                            style = {
                                'display': 'flex',
                                'alignItems': 'center',
                                'justifyContent' : 'center',
                            },
                            flex = '3',
                        )

                    ],
                    style = {
                        'borderBottom' : '#e0e0e0 solid',   
                        'height' : '80px',     
                    }
                ),


            ],
            style = {
                'width' : '1000px',   # 整个表格为1列，设置列的宽度，即为整个表格的宽度
                'borderLeft' : '#e0e0e0 solid',
                'borderRight' : '#e0e0e0 solid',
            }
        )
    ],
    style = {
        'justifyContent':'center',  # 与display一直使整个页面的内容居中
        'display' : 'flex',
        'alignItems' : 'center',     
        }
)

rockall_score_div = html.Div(
    children = [
        fac.AntdCol(
            [
                # 第1行，标题
                fac.AntdRow(
                    html.H1("Rockall评分(评估再出血率和死亡风险)"),
                    # className = ""
                    style = {
                        'display': 'flex',
                        'justifyContent': 'center',
                        'alignItems': 'center',
                        'borderTop' : '#e0e0e0 solid',   # 显示边框模拟表格，但会重叠，故只设置上下边框 
                        'borderBottom' : '#e0e0e0 solid',       
                        }
                ),

                # 第2行，字段，3列
                fac.AntdRow(
                    [
                        fac.AntdCol(
                            fac.AntdText(
                                '指标',
                                style = {
                                    'fontSize' : '20px',
                                    'fontWeight' : 'bold',
                                    'color':'white',
                                }
                            ),
                            style = {
                                    'backgroundColor': '#7F7FD5',
                                    'textAlign' : 'center',
                                    'borderRight' : '#e0e0e0 solid'
                                },
                            flex = '3',  # 字符型，写成数值型不生效
                        ),
                        fac.AntdCol(
                            fac.AntdText(
                                '参数',
                                style = {
                                    'fontSize' : '20px',
                                    'fontWeight' : 'bold',
                                    'color':'white',

                                }
                                
                            ),
                            style = {
                                    'backgroundColor': '#7F7FD5',
                                    'textAlign' : 'center',
                                    'borderRight' : '#e0e0e0 solid'
                                },
                            flex = '4',
                        ),
                        fac.AntdCol(
                            fac.AntdText(
                                '得分',
                                style = {
                                    'fontSize' : '20px',
                                    'fontWeight' : 'bold',
                                    'color':'white',
                                }
                            ),
                            style = {
                                    'backgroundColor': '#7F7FD5',
                                    'textAlign' : 'center',
                                },
                            flex = '3',
                        )

                    ],
                    style = {
                        'borderBottom' : '#e0e0e0 solid',   # 从第2行开始，只显示下边框，防止与上一行的下边框重叠
                        'height' : '40px',     
                        }
                ),

                # 第3行，年龄
                fac.AntdRow(
                    [
                        fac.AntdCol(
                            fac.AntdText(
                                '年龄（岁）',
                                style = {
                                    'fontSize' : '20px',
                                    'fontWeight' : 'bold',
                                }
                            ),
                            style = {
                                    'display': 'flex',
                                    'alignItems': 'center',
                                    'justifyContent' : 'center',
                                    'borderRight' : '#e0e0e0 solid'
                                },
                            flex = '3',
                        ),

                        # 第2列
                        fac.AntdCol(
                            fac.AntdRadioGroup(
                                options=[
                                    {
                                        'label': sbp,
                                        'value': sbp
                                    }
                                    for sbp in [
                                                '0分：< 60',
                                                '1分：60 ~ 79',
                                                '2分：≥ 80'
                                                ]
                                ],
                                style = {
                                    'fontSize' : '18px',
                                },
                                direction='vertical'
                            ),
                            style = {
                                    'display': 'flex',
                                    'alignItems': 'center',
                                    'justifyContent' : 'center',
                                    'borderRight' : '#e0e0e0 solid'
                                },
                            flex = '4',
                        ),


                        # 第3列
                        fac.AntdCol(
                            fac.AntdInputNumber(
                                min = 0,
                                max = 2,
                                step = 1,
                                style = {
                                    'width' : '60%',
                                    'fontSize' : '20px',
                                    'fontWeight' : 'bold',
                                },
                                disabled = False,
                            ),
                            style = {
                                    'display': 'flex',
                                    'alignItems': 'center',
                                    'justifyContent' : 'center',
                                },
                            flex = '3',
                        )

                    ],
                    style = {
                        'borderBottom' : '#e0e0e0 solid',   
                        'height' : '120px',     
                    }
                ),

                # 第4行，休克
                fac.AntdRow(
                    [
                        fac.AntdCol(
                            fac.AntdText(
                                '休克状况',
                                style = {
                                    'fontSize' : '20px',
                                    'fontWeight' : 'bold',
                                }
                            ),
                            style = {
                                    'display': 'flex',
                                    'alignItems': 'center',
                                    'justifyContent' : 'center',
                                    'borderRight' : '#e0e0e0 solid'
                                },
                            flex = '3',
                        ),

                        # 第2列
                        fac.AntdCol(
                            fac.AntdRadioGroup(
                                options=[
                                    {
                                        'label': shock,
                                        'value': shock
                                    }
                                    for shock in [
                                                '0分：无休克（收缩压≥100mmHg）,心率＜100次/分）',
                                                '1分：心动过速（收缩压≥100mmHg,心率＞100次/分）',
                                                '2分：低血压（收缩压＜100mmHg，心率≥100次/分）',
                                                ]
                                ],
                                style = {
                                    'fontSize' : '18px',
                                },
                                direction='vertical'
                            ),
                            style = {
                                    'display': 'flex',
                                    'alignItems': 'center',
                                    'justifyContent' : 'center',
                                    'borderRight' : '#e0e0e0 solid'
                                },
                            flex = '4',
                        ),


                        # 第3列
                        fac.AntdCol(
                            fac.AntdInputNumber(
                                min = 0,
                                max = 2,
                                step = 1,
                                style = {
                                    'width' : '60%',
                                    'fontSize' : '20px',
                                    'fontWeight' : 'bold',
                                },
                                disabled = False,
                            ),
                            style = {
                                    'display': 'flex',
                                    'alignItems': 'center',
                                    'justifyContent' : 'center',
                                },
                            flex = '3',
                        )

                    ],
                    style = {
                        'borderBottom' : '#e0e0e0 solid',   
                        'height' : '160px',     
                    }
                ),

                # 第5行，合并症
                fac.AntdRow(
                    [   # 第1列
                        fac.AntdCol(
                            fac.AntdText(
                                '伴发疾病',
                                style = {
                                    'fontSize' : '20px',
                                    'fontWeight' : 'bold',
                                }
                            ),
                            style = {
                                    'display': 'flex',
                                    'alignItems': 'center',
                                    'justifyContent' : 'center',
                                    'borderRight' : '#e0e0e0 solid'
                                },
                            flex = '3',
                        ),

                        # 第2列
                        fac.AntdCol(
                            fac.AntdRow(
                                [
                                    fac.AntdCol(
                                        fac.AntdCheckbox(
                                            label = '0分：无',
                                            style = {
                                                'margin': '0 0 0 50px',
                                                'display': 'flex',
                                                'alignItems': 'center',
                                                'justifyContent' : 'left',
                                            }
                                        ),
                                        span = 24,
                                    ),
                                    fac.AntdCol(
                                        fac.AntdCheckbox(
                                            label = '2分：心力衰竭、冠脉疾病和其他严重伴发疾病',
                                            style = {
                                                'margin': '0 0 0 50px',
                                                'display': 'flex',
                                                'alignItems': 'center',
                                                'justifyContent' : 'left',
                                            }
                                        ),
                                        span = 24,
                                    ),
                                    fac.AntdCol(
                                        fac.AntdCheckbox(
                                            label = '3分：肝/肾衰竭和肿瘤播散',
                                            style = {
                                                'margin': '0 0 0 50px',
                                                'display': 'flex',
                                                'alignItems': 'center',
                                                'justifyContent' : 'left',
                                            }
                                        ),
                                        span = 24,
                                    ),
                                ]
                            ),
                            style = {
                                    'display': 'flex',
                                    'alignItems': 'center',
                                    'justifyContent' : 'center',
                                    'borderRight' : '#e0e0e0 solid'
                                },
                            flex = '4',
                        ),


                        # 第3列
                        fac.AntdCol(
                            fac.AntdInputNumber(
                                min = 0,
                                max = 3,
                                step = 1,
                                style = {
                                    'width' : '60%',
                                    'fontSize' : '20px',
                                    'fontWeight' : 'bold',
                                },
                                disabled = False,
                            ),
                            style = {
                                    'display': 'flex',
                                    'alignItems': 'center',
                                    'justifyContent' : 'center',
                                },
                            flex = '3',
                        )

                    ],
                    style = {
                        'borderBottom' : '#e0e0e0 solid',   
                        'height' : '160px',     
                    }
                ),

                # 第6行，内镜诊断
                fac.AntdRow(
                    [   # 第1列
                        fac.AntdCol(
                            fac.AntdText(
                                '内镜诊断',
                                style = {
                                    'fontSize' : '20px',
                                    'fontWeight' : 'bold',
                                }
                            ),
                            style = {
                                    'display': 'flex',
                                    'alignItems': 'center',
                                    'justifyContent' : 'center',
                                    'borderRight' : '#e0e0e0 solid'
                                },
                            flex = '3',
                        ),

                        # 第2列
                        fac.AntdCol(
                            fac.AntdRow(
                                [
                                    fac.AntdCol(
                                        fac.AntdCheckbox(
                                            label = '0分：Mallory-Weiss综合征或无病变及出血征象',
                                            style = {
                                                'margin': '0 0 0 50px',
                                                'display': 'flex',
                                                'alignItems': 'center',
                                                'justifyContent' : 'left',
                                            }
                                        ),
                                        span = 24,
                                    ),
                                    fac.AntdCol(
                                        fac.AntdCheckbox(
                                            label = '1分：溃疡等其他病变',
                                            style = {
                                                'margin': '0 0 0 50px',
                                                'display': 'flex',
                                                'alignItems': 'center',
                                                'justifyContent' : 'left',
                                            }
                                        ),
                                        span = 24,
                                    ),
                                    fac.AntdCol(
                                        fac.AntdCheckbox(
                                            label = '2分：上消化道恶性肿瘤',
                                            style = {
                                                'margin': '0 0 0 50px',
                                                'display': 'flex',
                                                'alignItems': 'center',
                                                'justifyContent' : 'left',
                                            }
                                        ),
                                        span = 24,
                                    ),
                                ]
                            ),
                            style = {
                                    'display': 'flex',
                                    'alignItems': 'center',
                                    'justifyContent' : 'center',
                                    'borderRight' : '#e0e0e0 solid'
                                },
                            flex = '4',
                        ),


                        # 第3列
                        fac.AntdCol(
                            fac.AntdInputNumber(
                                min = 0,
                                max = 2,
                                step = 1,
                                style = {
                                    'width' : '60%',
                                    'fontSize' : '20px',
                                    'fontWeight' : 'bold',
                                },
                                disabled = False,
                            ),
                            style = {
                                    'display': 'flex',
                                    'alignItems': 'center',
                                    'justifyContent' : 'center',
                                },
                            flex = '3',
                        )

                    ],
                    style = {
                        'borderBottom' : '#e0e0e0 solid',   
                        'height' : '160px',     
                    }
                ),

                # 第7行，有无近期出血征象
                fac.AntdRow(
                    [   # 第1列
                        fac.AntdCol(
                            fac.AntdText(
                                '有无近期出血征象',
                                style = {
                                    'fontSize' : '20px',
                                    'fontWeight' : 'bold',
                                }
                            ),
                            style = {
                                    'display': 'flex',
                                    'alignItems': 'center',
                                    'justifyContent' : 'center',
                                    'borderRight' : '#e0e0e0 solid'
                                },
                            flex = '3',
                        ),

                        # 第2列
                        fac.AntdCol(
                            fac.AntdRow(
                                [
                                    fac.AntdCol(
                                        fac.AntdCheckbox(
                                            label = '0分：无或仅有黑斑',
                                            style = {
                                                'margin': '0 0 0 20px',
                                                'display': 'flex',
                                                'alignItems': 'center',
                                                'justifyContent' : 'left',
                                            }
                                        ),
                                        span = 24,
                                    ),
                                    fac.AntdCol(
                                        fac.AntdCheckbox(
                                            label = '2分：上消化道血液潴留，粘附血凝块，血管显露或喷血',
                                            style = {
                                                'margin': '0 0 0 20px',
                                                'display': 'flex',
                                                'alignItems': 'center',
                                                'justifyContent' : 'left',
                                            }
                                        ),
                                        span = 24,
                                    ),
                                ]
                            ),
                            style = {
                                    'display': 'flex',
                                    'alignItems': 'center',
                                    'justifyContent' : 'center',
                                    'borderRight' : '#e0e0e0 solid'
                                },
                            flex = '4',
                        ),


                        # 第3列
                        fac.AntdCol(
                            fac.AntdInputNumber(
                                min = 0,
                                max = 2,
                                step = 2,
                                style = {
                                    'width' : '60%',
                                    'fontSize' : '20px',
                                    'fontWeight' : 'bold',
                                },
                                disabled = False,
                            ),
                            style = {
                                    'display': 'flex',
                                    'alignItems': 'center',
                                    'justifyContent' : 'center',
                                },
                            flex = '3',
                        )

                    ],
                    style = {
                        'borderBottom' : '#e0e0e0 solid',   
                        'height' : '160px',     
                    }
                ),


                # 第8行，总分及分级
                fac.AntdRow(
                    [   # 第1列
                        fac.AntdCol(
                            fac.AntdText(
                                '总分',
                                style = {
                                    'fontSize' : '20px',
                                    'fontWeight' : 'bold',
                                }
                            ),
                            style = {
                                    'display': 'flex',
                                    'alignItems': 'center',
                                    'justifyContent' : 'center',
                                    'borderRight' : '#e0e0e0 solid'
                                },
                            flex = '3',
                        ),

                        # 第2列
                        fac.AntdCol(
                            fac.AntdRadioGroup(
                                options=[
                                    {
                                        'label': gbs_risk,
                                        'value': gbs_risk
                                    }
                                    for gbs_risk in ['0~2分：低危','3~4分：中危', '≥5分：高危']
                                ],
                                direction = 'vertical'
                            ),
                            style = {
                                    'display': 'flex',
                                    'alignItems': 'center',
                                    'justifyContent' : 'center',
                                    'borderRight' : '#e0e0e0 solid'
                                },
                            flex = '4',
                        ),


                        # 第3列
                        fac.AntdCol(
                            fac.AntdInputNumber(
                                min = 0,
                                max = 11,
                                style = {
                                    'width' : '60%',
                                    'fontSize' : '20px',
                                    'fontWeight' : 'bold',
                                },
                                disabled = False,
                            ),
                            style = {
                                'display': 'flex',
                                'alignItems': 'center',
                                'justifyContent' : 'center',
                            },
                            flex = '3',
                        )

                    ],
                    style = {
                        'borderBottom' : '#e0e0e0 solid',   
                        'height' : '90px',     
                    }
                ),


            ],
            style = {
                'width' : '1000px',   # 整个表格为1列，设置列的宽度，即为整个表格的宽度
                'borderLeft' : '#e0e0e0 solid',
                'borderRight' : '#e0e0e0 solid',
            }
        )
    ],
    style = {
        'justifyContent':'center',  # 与display一直使整个页面的内容居中
        'display' : 'flex',
        'alignItems' : 'center',     
        }
)




table_div = html.Div(

    children = [
        fac.AntdCol(
            [   
                # 第1行，标题
                fac.AntdRow(
                    html.H1("重症医学科三区危险性上消化道出血病人资料表"),
                    # className = ""
                    style = {
                        'display': 'flex',
                        'justifyContent': 'center',
                        'alignItems': 'center',
                        'borderTop' : '#e0e0e0 solid',   # 显示边框模拟表格，但会重叠，故只设置上下边框 
                        'borderBottom' : '#e0e0e0 solid',       
                        }
                ),
                # 第2行，入科时间与主管医生
                fac.AntdRow(
                    [
                        fac.AntdCol(
                            fac.AntdSpace(
                                [
                                    fac.AntdText(
                                        '入科时间：',
                                        style = {
                                            'fontSize': '16px',
                                        }
                                    ),
                                    fac.AntdDatePicker(                                       
                                    ),
                                ],
                                direction = 'horizontal'
                            ),
                            style = {
                                'display' : 'flex',  # 使垂直居中和水平居中设置生效
                                'justifyContent' : 'center',  # 水平居中
                                'alignItems' : 'center',      # 垂直居中
                            }, 

                        ),
                        fac.AntdCol(
                            fac.AntdSpace(
                                [
                                    fac.AntdText(
                                        '主管医生：',
                                        style = {
                                            'fontSize': '16px'
                                        }
                                    ),
                                    fac.AntdSelect(
                                        options=[
                                            {
                                                'label': doctor,
                                                'value': doctor
                                            }
                                            for doctor in doctor_list
                                        ],
                                        style={
                                            'width': 200,
                                        }
                                    )
                                ],
                                direction = 'horizontal'
                            ),
                            style = {
                                'display' : 'flex', 
                                'justifyContent' : 'center',  
                                'alignItems' : 'center', 
                            },  
                        )
                        
                    ],
                    style = {
                        'borderBottom' : '#e0e0e0 solid',   # 从第2行开始，只显示下边框，防止与上一行的下边框重叠
                        'height' : '40px',
                    },
                    justify="space-around"
                ),

                # 第3行，病人一般信息
                fac.AntdRow(
                    [
                        fac.AntdCol(
                            fac.AntdText(
                                '病人情况',
                                style = {
                                    'fontSize': '16px',
                                    'fontWeight' : 'bold',
                                }
                            ),
                            style = {
                                    'borderRight' : '#e0e0e0 solid',
                                    'display' : 'flex',  
                                    'justifyContent' : 'center', 
                                    'alignItems' : 'center',   

                                },
                            flex='2'         
                        ),
                        fac.AntdCol(
                            fac.AntdInput(
                                addonBefore = '姓名：',
                                style = {
                                    'width': '95%',  # 起到列之间显示间隔的作用
                                }
                            ),
                            style = {
                                    'display' : 'flex',  
                                    'justifyContent' : 'center',  
                                    'alignItems' : 'center',     
                                    # 'margin' : '0 5px 0 5px',  # 上、右、下、左的顺序
                            },
                            flex = '2'
                        ),
                        fac.AntdCol(
                            [
                                fac.AntdText(
                                        '性别：',
                                        style = {
                                            'fontSize': '16px',
                                        }
                                    ),
                                fac.AntdSelect(
                                    options=[
                                        {
                                            'label': gender,
                                            'value': gender
                                        }
                                        for gender in ['男', '女']
                                    ],
                                    style={
                                        'width': '100px', 
                                    }
                                ),
                            ],
                            style = {
                                    'display' : 'flex',  
                                    'justifyContent' : 'center',  
                                    'alignItems' : 'center',      
                            },
                            flex = '2'
                            
                        ),
                        fac.AntdCol(
                            fac.AntdInputNumber(
                                addonBefore = '年龄：',
                                addonAfter = '岁',
                                min = 1,
                                style = {
                                    'width': '95%',  
                                },
                            ),
                            style = {
                                    
                                    'display' : 'flex',  
                                    'justifyContent' : 'center',  
                                    'alignItems' : 'center',      
                            },
                            flex = '2'
                        ),
                        fac.AntdCol(
                            fac.AntdInput(
                                addonBefore='住院号：',
                                style = {
                                    'width': '95%',  
                                }
                            ),
                            style = {
                                    'display' : 'flex', 
                                    'justifyContent' : 'center',  
                                    'alignItems' : 'center',      
                                   
                            },
                            flex = '2'  
                        )
                        
                    ],
                    style = {
                        'borderBottom' : '#e0e0e0 solid',  
                        'height' : '40px'
                    },
                    # justify="space-around"  # 作用不大，注释掉
                ),

                # 第4行，ICU住院日
                fac.AntdRow(
                    [
                        fac.AntdCol(
                            fac.AntdText(
                                '平均ICU住院日',
                                style = {
                                    'fontSize': '16px',
                                    'fontWeight' : 'bold'
                                }
                            ),
                            style = {
                                    'borderRight' : '#e0e0e0 solid',
                                    'display' : 'flex', 
                                    'justifyContent' : 'center', 
                                    'alignItems' : 'center',      
                                },
                            flex='2'         
                        ),
                        fac.AntdCol(
                            fac.AntdInputNumber(
                                addonBefore = 'ICU住院日：',
                                addonAfter = "天",
                                min = 1,
                            ),
                            style = {
                                    'display' : 'flex', 
                                    'justifyContent' : 'center', 
                                    'alignItems' : 'center',     
                            },
                            flex = '8'
                        ),
                        
                    ],
                    style = {
                        'borderBottom' : '#e0e0e0 solid',   # 显示边框模拟表格
                        'height' : '40px',
                    },
                ),
                
                # 第5行，病人来源
                fac.AntdRow(
                    [
                        fac.AntdCol(
                            fac.AntdText(
                                '病人来源',
                                style = {
                                    'fontSize': '16px',
                                    'fontWeight' : 'bold'
                                }
                            ),
                            style = {
                                    'borderRight' : '#e0e0e0 solid',
                                    'display' : 'flex',  
                                    'justifyContent' : 'center', 
                                    'alignItems' : 'center',  
                                },
                            flex='2'         
                        ),
                        fac.AntdCol(
                            fac.AntdRadioGroup(
                                options=[
                                    {
                                        'label': source,
                                        'value': source
                                    }
                                    for source in ['急诊', '外院转入', '普通病房']
                                ],
                            ),
                            style = {
                                    'display' : 'flex',  
                                    'justifyContent' : 'center',  
                                    'alignItems' : 'center',      
                            },
                            flex = '8'
                        ),
                        
                    ],
                    style = {
                        'borderBottom' : '#e0e0e0 solid',   # 显示边框模拟表格
                        'height' : '40px',
                    },
                ),

                # 第6行，GBS评分
                fac.AntdRow(
                    [
                        fac.AntdCol(
                            fac.AntdText(
                                'GBS评分',
                                style = {
                                    'fontSize': '16px',
                                    'fontWeight' : 'bold'
                                }
                            ),
                            style = {
                                    'borderRight' : '#e0e0e0 solid',
                                    'display' : 'flex',  
                                    'justifyContent' : 'center', 
                                    'alignItems' : 'center',  
                                },
                            flex='2'         
                        ),
                        fac.AntdCol(
                            fac.AntdInputNumber(
                                # addonBefore = '年龄：',
                                addonAfter = '分',
                                min = 0,
                                max = 23, 
                                style = {
                                    'width': '95%',  
                                },
                            ),
                            style = {
                                    'display' : 'flex',  
                                    'justifyContent' : 'center',  
                                    'alignItems' : 'center',      
                            },
                            flex = '4'
                        ),
                        fac.AntdCol(
                            fac.AntdRadioGroup(
                                options=[
                                    {
                                        'label': risk,
                                        'value': risk
                                    }
                                    for risk in ['低危', '中危', '高危']
                                ],
                            ),
                            style = {
                                    'display' : 'flex',  
                                    'justifyContent' : 'center',  
                                    'alignItems' : 'center',      
                            },
                            flex = '4'
                        ),
                        
                    ],
                    style = {
                        'borderBottom' : '#e0e0e0 solid',   # 显示边框模拟表格
                        'height' : '40px',
                    },
                ),

                 # 第七行
                
                # 第7行，ROCKALL评分
                fac.AntdRow(
                    [
                        fac.AntdCol(
                            fac.AntdText(
                                'ROCKALL评分',
                                style = {
                                    'fontSize': '16px',
                                    'fontWeight' : 'bold'
                                }
                            ),
                            style = {
                                    'borderRight' : '#e0e0e0 solid',
                                    'display' : 'flex',  
                                    'justifyContent' : 'center', 
                                    'alignItems' : 'center',  
                                },
                            flex='2'         
                        ),
                        fac.AntdCol(
                            fac.AntdInputNumber(
                                # addonBefore = '年龄：',
                                addonAfter = '分',
                                min = 0,
                                max = 11, 
                                style = {
                                    'width': '95%',  
                                },
                            ),
                            style = {
                                    'display' : 'flex',  
                                    'justifyContent' : 'center',  
                                    'alignItems' : 'center',      
                            },
                            flex = '4'
                        ),
                        fac.AntdCol(
                            fac.AntdRadioGroup(
                                options=[
                                    {
                                        'label': risk,
                                        'value': risk
                                    }
                                    for risk in ['低危', '中危', '高危']
                                ],
                            ),
                            style = {
                                    'display' : 'flex',  
                                    'justifyContent' : 'center',  
                                    'alignItems' : 'center',      
                            },
                            flex = '4'
                        ),
                        
                    ],
                    style = {
                        'borderBottom' : '#e0e0e0 solid',   # 显示边框模拟表格
                        'height' : '40px',
                    },
                ),

                # 第8行，气管插管
                fac.AntdRow(
                    [
                        fac.AntdCol(
                            fac.AntdText(
                                '气管插管',
                                style = {
                                    'fontSize': '16px',
                                    'fontWeight' : 'bold'
                                }
                            ),
                            style = {
                                    'borderRight' : '#e0e0e0 solid',
                                    'display' : 'flex',  
                                    'justifyContent' : 'center', 
                                    'alignItems' : 'center',  
                                },
                            flex='2'         
                        ),
                        fac.AntdCol(
                            fac.AntdRadioGroup(
                                options=[
                                    {
                                        'label': source,
                                        'value': source
                                    }
                                    for source in ['是', '否']
                                ],
                            ),
                            style = {
                                    'display' : 'flex',  
                                    'justifyContent' : 'center',  
                                    'alignItems' : 'center',      
                            },
                            flex = '8'
                        ),
                        
                    ],
                    style = {
                        'borderBottom' : '#e0e0e0 solid',   # 显示边框模拟表格
                        'height' : '40px',
                    },
                ),

                # 第9行，床旁胃镜
                fac.AntdRow(
                    [
                        fac.AntdCol(
                            fac.AntdText(
                                '床旁胃镜',
                                style = {
                                    'fontSize': '16px',
                                    'fontWeight' : 'bold'
                                }
                            ),
                            style = {
                                    'borderRight' : '#e0e0e0 solid',
                                    'display' : 'flex',  
                                    'justifyContent' : 'center', 
                                    'alignItems' : 'center',  
                                },
                            flex='2'         
                        ),
                        fac.AntdCol(
                            fac.AntdRadioGroup(
                                options=[
                                    {
                                        'label': source,
                                        'value': source
                                    }
                                    for source in ['是', '否']
                                ],
                            ),
                            style = {
                                    'display' : 'flex',  
                                    'justifyContent' : 'center',  
                                    'alignItems' : 'center',      
                            },
                            flex = '8'
                        ),
                        
                    ],
                    style = {
                        'borderBottom' : '#e0e0e0 solid',   # 显示边框模拟表格
                        'height' : '40px',
                    },
                ),

                # 第10行，检验结果时间
                fac.AntdRow(
                    [
                        fac.AntdCol(
                            fac.AntdText(
                                '检验结果时间',
                                style = {
                                    'fontSize': '16px',
                                    'fontWeight' : 'bold'
                                }
                            ),
                            style = {
                                    'borderRight' : '#e0e0e0 solid',
                                    'display' : 'flex',  
                                    'justifyContent' : 'center', 
                                    'alignItems' : 'center',  
                                },
                            flex='2'         
                        ),
                        fac.AntdCol(
                            fac.AntdRow(
                                [
                                    fac.AntdCol(
                                        fac.AntdText(
                                            '开具医嘱到检验结果报告出具的时间（入科第一次抽血）',
                                            style = {
                                                'fontSize': '16px',
                                                'margin' : '0 0 5px 5px'
                                                # 'fontWeight' : 'bold'
                                            }
                                        ),
                                        style = { 
                                                'display' : 'flex',  
                                                'justifyContent' : 'left',  
                                                'alignItems' : 'center',      
                                        },
                                        span = 24,   # 实现换行的显示效果
                                    ),
                                    fac.AntdCol(
                                        fac.AntdInputNumber(
                                            addonBefore = '血常规：',
                                            addonAfter = '分钟',
                                            min = 1,
                                            style = {
                                                'width': '95%',  
                                            },
                                        ),
                                        style = {
                                                'display' : 'flex',  
                                                'justifyContent' : 'center',  
                                                'alignItems' : 'center',      
                                        },
                                        flex = '2'
                                    ),
                                    fac.AntdCol(
                                        fac.AntdInputNumber(
                                            addonBefore = '止凝血：',
                                            addonAfter = '分钟',
                                            min = 1,
                                            style = {
                                                'width': '95%',  
                                            },
                                        ),
                                        style = {
                                                'display' : 'flex',  
                                                'justifyContent' : 'center',  
                                                'alignItems' : 'center',      
                                        },
                                        flex = '2'
                                    ),
                                    fac.AntdCol(
                                        fac.AntdInputNumber(
                                            addonBefore = '生化：',
                                            addonAfter = '分钟',
                                            min = 1,
                                            style = {
                                                'width': '95%',  
                                            },
                                        ),
                                        style = {
                                                'display' : 'flex',  
                                                'justifyContent' : 'center',  
                                                'alignItems' : 'center',      
                                        },
                                        flex = '2'
                                    ),

                                ]
                                
                                
                            ),
                            style = {
                                    'display' : 'flex',  
                                    'justifyContent' : 'center',  
                                    'alignItems' : 'center',      
                            },
                            flex = '8'
                        ),
                        
                    ],
                    style = {
                        'borderBottom' : '#e0e0e0 solid',   # 显示边框模拟表格
                        'height' : '80px',
                    },
                ),

                # 第11行，紧急发血时间
                fac.AntdRow(
                    [
                        fac.AntdCol(
                            fac.AntdText(
                                '紧急发血时间',
                                style = {
                                    'fontSize': '16px',
                                    'fontWeight' : 'bold'
                                }
                            ),
                            style = {
                                    'borderRight' : '#e0e0e0 solid',
                                    'display' : 'flex',  
                                    'justifyContent' : 'center', 
                                    'alignItems' : 'center',  
                                },
                            flex='2'         
                        ),
                        fac.AntdCol(
                            fac.AntdRow(
                                [
                                    fac.AntdCol(
                                        fac.AntdText(
                                            '开具医嘱申请紧急输血到输血科发出第一袋血的时间',
                                            style = {
                                                'fontSize': '16px',
                                                'margin' : '0 0 5px 5px',
                                            }
                                        ),
                                        style = { 
                                                'display' : 'flex',  
                                                'justifyContent' : 'left',  # 一列多行时设置该属性为left，使内容左对齐
                                                'alignItems' : 'center',  
                                        },
                                        span = 24,   # 实现换行的显示效果
                                    ),
                                    fac.AntdCol(
                                        fac.AntdInputNumber(
                                            # addonBefore = '血常规：',
                                            addonAfter = '分钟',
                                            min = 1,
                                            style = {
                                                'width': '250px',  
                                                'margin' : '0 0 5px 5px',
                                            },
                                        ),
                                        style = {
                                                'display' : 'flex',  
                                                'justifyContent' : 'left',  # 一列多行时设置该属性为left，使内容左对齐
                                                'alignItems' : 'center',  
                                                 
                                        },
                                    ),
                                ]
                            ),
                            style = {
                                    'display' : 'flex',  
                                    'justifyContent' : 'left',    # 一列多行时设置该属性为left，使内容左对齐
                                    'alignItems' : 'center',      
                            },
                            flex = '8'

                        ),
                        
                    ],
                    style = {
                        'borderBottom' : '#e0e0e0 solid',   # 显示边框模拟表格
                        'height' : '80px',
                    }
                ),
                
                # 第12行，消化内科会诊
                fac.AntdRow(
                    [
                        fac.AntdCol(
                            fac.AntdText(
                                '消化内科会诊',
                                style = {
                                    'fontSize': '16px',
                                    'fontWeight' : 'bold'
                                }
                            ),
                            style = {
                                    'borderRight' : '#e0e0e0 solid',
                                    'display' : 'flex',  
                                    'justifyContent' : 'center', 
                                    'alignItems' : 'center',  
                                },
                            flex='2'         
                        ),
                        fac.AntdCol(
                            fac.AntdInputNumber(
                                addonAfter = '分钟',
                                min = 1,
                                style = {
                                    'width': '250px',  
                                    'margin' : '0 0 0 5px'
                                },
                            ),
                            style = {
                                'display' : 'flex',  
                                'justifyContent' : 'left',  # 一列多行时设置该属性为left，使内容左对齐
                                'alignItems' : 'center',  
                            },
                            flex = '8'
                        ),
                        
                    ],
                    style = {
                        'borderBottom' : '#e0e0e0 solid',   # 显示边框模拟表格
                        'height' : '40px',
                    },
                ),

                # 第13行，MDT
                fac.AntdRow(
                    [
                        fac.AntdCol(
                            fac.AntdText(
                                'MDT',
                                style = {
                                    'fontSize': '16px',
                                    'fontWeight' : 'bold'
                                }
                            ),
                            style = {
                                    'borderRight' : '#e0e0e0 solid',
                                    'display' : 'flex',  
                                    'justifyContent' : 'center', 
                                    'alignItems' : 'center',  
                                },
                            flex='2'         
                        ),
                        fac.AntdCol(
                            [
                                fac.AntdCheckbox(
                                    label='是'
                                ),
                                fac.AntdInputNumber(
                                    addonAfter = '分钟',
                                    min = 1,
                                    style = {
                                        'width': '250px',  
                                        'margin' : '0 0 0 5px'
                                    },
                                ),
                            ],
                            
                            style = {
                                'display' : 'flex',  
                                'justifyContent' : 'center',  # 一列多行时设置该属性为left，使内容左对齐
                                'alignItems' : 'center',  
                            },
                            flex = '4'
                        ),
                        fac.AntdCol(
                            [
                                fac.AntdCheckbox(
                                    label='否'
                                ),
                            ],
                            
                            style = {
                                'display' : 'flex',  
                                'justifyContent' : 'center',  # 一列多行时设置该属性为left，使内容左对齐
                                'alignItems' : 'center',  
                            },
                            flex = '4'
                        ),
                        
                    ],
                    style = {
                        'borderBottom' : '#e0e0e0 solid',   # 显示边框模拟表格
                        'height' : '40px',
                    },
                ),

                # 第14行，胃镜检查
                fac.AntdRow(
                    [
                        fac.AntdCol(
                            fac.AntdText(
                                '胃镜检查',
                                style = {
                                    'fontSize': '16px',
                                    'fontWeight' : 'bold'
                                }
                            ),
                            style = {
                                    'borderRight' : '#e0e0e0 solid',
                                    'display' : 'flex',  
                                    'justifyContent' : 'center', 
                                    'alignItems' : 'center',  
                                },
                            flex='2'         
                        ),
                        fac.AntdCol(
                            fac.AntdRow(
                                [
                                    fac.AntdCol(
                                        fac.AntdInputNumber(
                                            addonBefore = '通知胃镜后胃镜到达现场时间：', 
                                            addonAfter = '分钟',
                                            min = 1,
                                            style = {
                                                'width': '55%',  
                                                'margin' : '0 0 0 5px'
                                            },
                                        ),
                                        style = { 
                                                'display' : 'flex',  
                                                'justifyContent' : 'left',  
                                                'alignItems' : 'center',      
                                        },
                                        span = 24,   # 实现换行的显示效果
                                    ),
                                    fac.AntdCol(
                                        fac.AntdText(
                                            '1. 胃镜完善时间：',
                                            style = {
                                                'fontSize': '16px',
                                                'margin' : '0 0 5px 5px'
                                            }
                                        ),
                                        style = {
                                                'display' : 'flex',  
                                                'justifyContent' : 'left',  
                                                'alignItems' : 'center',      
                                        },
                                        span = 24, 
                                    ),
                                    fac.AntdCol(
                                        fac.AntdRadioGroup(
                                            options=[
                                                {
                                                    'label': source,
                                                    'value': source
                                                }
                                                for source in ['2小时内', '24小时内',  '24-48小时', '48-72小时', '大于72小时']
                                            ],
                                            style = {
                                                'margin' : '0 0 5px 5px'
                                            }
                                        ),
                                        style = {
                                                'display' : 'flex',  
                                                'justifyContent' : 'left',  
                                                'alignItems' : 'center',      
                                        },
                                        span = 24,
                                    ),
                                    fac.AntdCol(
                                        [
                                            fac.AntdText(
                                                '2. 胃镜检查地点：',
                                                style = {
                                                    'fontSize': '16px',
                                                    'margin' : '0 0 5px 5px'
                                                }
                                            ),
                                            fac.AntdCheckbox(
                                                label='胃镜室'
                                            ),
                                            fac.AntdCheckbox(
                                                label='床边'
                                            ),
                                        ],
                                        
                                        style = {
                                                'display' : 'flex',  
                                                'justifyContent' : 'left',  
                                                'alignItems' : 'center',      
                                        },
                                        span = 24,
                                    ),
                                    fac.AntdCol(
                                        [
                                            fac.AntdText(
                                                '3. 胃镜结果：',
                                                style = {
                                                    'fontSize': '16px',
                                                    'margin' : '0 0 5px 5px'
                                                }
                                            ),
                                            fac.AntdCheckbox(
                                                label='静脉曲张：'
                                            ),
                                            fac.AntdCheckbox(
                                                label='食管'
                                            ),
                                            fac.AntdCheckbox(
                                                label='胃底'
                                            ),
                                        ],
                                        
                                        style = {
                                                'display' : 'flex',  
                                                'justifyContent' : 'left',  
                                                'alignItems' : 'center',      
                                        },
                                        span = 24,
                                    ),
                                    fac.AntdCol(
                                        [   
                                            fac.AntdCheckbox(
                                                label='溃疡部位：',
                                                style = {
                                                    'margin' : '0 0 5px 5px',
                                                }
                                            ),
                                            fac.AntdInput(
                                                style = {
                                                    'width': '300px',  
                                                    'margin' : '0 0 5px 5px',
                                                }
                                            )
                                        ],
                                        style = {
                                                'display' : 'flex',  
                                                'justifyContent' : 'left',  
                                                'alignItems' : 'center',      
                                        },
                                        span = 24,
                                    ),
                                    fac.AntdCol(
                                        [   
                                            fac.AntdCheckbox(
                                                label='其他',
                                                style = {
                                                    'margin' : '0 0 5px 5px',
                                                }
                                            ),
                                            fac.AntdInput(
                                                style = {
                                                    'width': '345px',  
                                                    'margin' : '0 0 5px 5px',
                                                }
                                            )
                                        ],
                                        style = {
                                                'display' : 'flex',  
                                                'justifyContent' : 'left',  
                                                'alignItems' : 'center',      
                                        },
                                        span = 24,
                                    ),
                                    fac.AntdCol(
                                        [
                                            fac.AntdText(
                                                '4.床旁胃镜平均时间：',
                                                style = {
                                                    'fontSize': '16px',
                                                    'margin' : '0 0 5px 5px'
                                                }
                                            ),
                                            fac.AntdInputNumber(
                                                addonAfter = '分钟',
                                                min = 1,
                                                style = {
                                                    'width': '300px',  
                                                    'margin' : '0 0 0 5px'
                                                },
                                            ),
                                        ],
                                        style = { 
                                                'display' : 'flex',  
                                                'justifyContent' : 'left',  
                                                'alignItems' : 'center',      
                                        },
                                        # span = 24,   # 实现换行的显示效果
                                    ),

                                ]
                                
                                
                            ),
                            style = {
                                    'display' : 'flex',  
                                    'justifyContent' : 'center',  
                                    'alignItems' : 'center',      
                            },
                            flex = '8'
                        ),
                        
                    ],
                    style = {
                        'borderBottom' : '#e0e0e0 solid',   # 显示边框模拟表格
                        'height' : '300px',
                    },
                ),

                # 第15行，输血治疗
                fac.AntdRow(
                    [
                        fac.AntdCol(
                            fac.AntdText(
                                '输血治疗',
                                style = {
                                    'fontSize': '16px',
                                    'fontWeight' : 'bold'
                                }
                            ),
                            style = {
                                    'borderRight' : '#e0e0e0 solid',
                                    'display' : 'flex',  
                                    'justifyContent' : 'center', 
                                    'alignItems' : 'center',  
                                },
                            flex='2'         
                        ),
                        fac.AntdCol(
                            fac.AntdRow(
                                [
                                    fac.AntdCol(
                                        fac.AntdText(
                                            '入科总输血：',
                                            style = {
                                                'fontSize': '16px',
                                                'margin' : '0 0 5px 5px'
                                                # 'fontWeight' : 'bold'
                                            }
                                        ),
                                        style = { 
                                                'display' : 'flex',  
                                                'justifyContent' : 'left',  
                                                'alignItems' : 'center',      
                                        },
                                        span = 4,   
                                    ),
                                    fac.AntdCol(
                                        fac.AntdInputNumber(
                                            addonBefore = '红细胞',
                                            addonAfter = '单位',
                                            precision = 1,
                                            step = 0.5,
                                            min = 0,
                                            style = {
                                                'width': '95%',  
                                                'margin' : '0 0 5px 5px'
                                            },
                                        ),
                                        style = {
                                                'display' : 'flex',  
                                                'justifyContent' : 'center',  
                                                'alignItems' : 'center',      
                                        },
                                        span = 6, 
                                    ),
                                    fac.AntdCol(
                                        fac.AntdInputNumber(
                                            addonBefore = '血浆',
                                            addonAfter = 'ml',
                                            precision = 0,
                                            step = 50,
                                            min = 0,
                                            style = {
                                                'width': '95%',  
                                                'margin' : '0 0 5px 5px'
                                            },
                                        ),
                                        style = {
                                                'display' : 'flex',  
                                                'justifyContent' : 'center',  
                                                'alignItems' : 'center',      
                                        },
                                        span = 6, 
                                    ),
                                    fac.AntdCol(
                                        fac.AntdInputNumber(
                                            addonBefore = '血小板',
                                            addonAfter = '个治疗量',
                                            precision = 1,
                                            step = 0.5,
                                            min = 0,
                                            style = {
                                                'width': '95%',  
                                                'margin' : '0 0 5px 5px'
                                            },
                                        ),
                                        style = {
                                                'display' : 'flex',  
                                                'justifyContent' : 'center',  
                                                'alignItems' : 'center',      
                                        },
                                        span = 7, 
                                    ),
                                    fac.AntdCol(
                                        fac.AntdInputNumber(
                                            addonBefore = '冷沉淀',
                                            addonAfter = '单位',
                                            precision = 0,
                                            step = 10,
                                            min = 0,
                                            style = {
                                                'width': '95%',  
                                                'margin' : '0 0 5px 5px'
                                            },
                                        ),
                                        style = {
                                                'display' : 'flex',  
                                                'justifyContent' : 'center',  
                                                'alignItems' : 'center',      
                                        },
                                        span = 6, 
                                    ),
                                    fac.AntdCol(
                                        fac.AntdInputNumber(
                                            addonBefore = '纤维蛋白原：',
                                            addonAfter = 'g',
                                            precision = 1,
                                            step = 0.5,
                                            min = 0,
                                            style = {
                                                'width': '95%',  
                                                'margin' : '0 0 5px 5px'
                                            },
                                        ),
                                        style = {
                                                'display' : 'flex',  
                                                'justifyContent' : 'center',  
                                                'alignItems' : 'center',      
                                        },
                                        span = 7, 
                                    ),
                                ],
                            ),
                            style = {
                                'display' : 'flex',  
                                'justifyContent' : 'center',  
                                'alignItems' : 'center',      
                            },
                            flex = '8'
                        )
                    ],
                    style = {
                        'borderBottom' : '#e0e0e0 solid',   # 显示边框模拟表格
                        'height' : '90px',
                    },
                ),

                # 第16行，抑酸药物
                fac.AntdRow(
                    [
                        fac.AntdCol(
                            fac.AntdText(
                                '抑酸药物',
                                style = {
                                    'fontSize': '16px',
                                    'fontWeight' : 'bold'
                                }
                            ),
                            style = {
                                    'borderRight' : '#e0e0e0 solid',
                                    'display' : 'flex',  
                                    'justifyContent' : 'center', 
                                    'alignItems' : 'center',  
                                },
                            flex='2'         
                        ),
                        fac.AntdCol(
                            [
                                fac.AntdText(
                                    '药物名称：',
                                    style = {
                                        'fontSize': '16px',
                                        'margin' : '0 0 5px 5px'
                                        # 'fontWeight' : 'bold'
                                    }
                                ),
                            
                                fac.AntdInput(
                                    mode = 'text-area',
                                    style = {
                                        'width': '80%',  # 起到列之间显示间隔的作用
                                    }
                                ),
                            ],
                            style = { 
                                    'display' : 'flex',  
                                    'justifyContent' : 'left',  
                                    'alignItems' : 'center',      
                            },
                            flex = '5',   
                        ),
                        fac.AntdCol(
                            [
                                fac.AntdText(
                                    '（是否采用808方案：',
                                    style = {
                                        'fontSize': '16px',
                                        'margin' : '0 0 5px 5px'
                                        # 'fontWeight' : 'bold'
                                    }
                                ),
                                fac.AntdRadioGroup(
                                    options=[
                                        {
                                            'label': _808schema,
                                            'value': _808schema
                                        }
                                        for _808schema in ['是', '否']
                                    ],
                                ),
                                fac.AntdText(
                                    '）',
                                    style = {
                                        'fontSize': '16px',
                                        'margin' : '0 0 5px 5px'
                                        # 'fontWeight' : 'bold'
                                    }
                                ),
                            ],
                            style = { 
                                    'display' : 'flex',  
                                    'justifyContent' : 'left',  
                                    'alignItems' : 'center',      
                            },
                            flex = '3',      
                        ),
                        
                    ],
                    style = {
                        'borderBottom' : '#e0e0e0 solid',   # 显示边框模拟表格
                        'height' : '90px',
                    },
                ),

                # 第17行，手术
                fac.AntdRow(
                    [
                        fac.AntdCol(
                            fac.AntdText(
                                '手术',
                                style = {
                                    'fontSize': '16px',
                                    'fontWeight' : 'bold'
                                }
                            ),
                            style = {
                                    'borderRight' : '#e0e0e0 solid',
                                    'display' : 'flex',  
                                    'justifyContent' : 'center', 
                                    'alignItems' : 'center',  
                                },
                            flex='2'         
                        ),
                        fac.AntdCol(
                            fac.AntdRow(
                                [
                                    fac.AntdCol(
                                        [
                                            fac.AntdText(
                                                '手术时间：',
                                                style = {
                                                    'fontSize': '16px',
                                                    'margin' : '0 0 5px 5px',
                                                }
                                            ),
                                            fac.AntdRadioGroup(
                                                options=[
                                                    {
                                                        'label': source,
                                                        'value': source
                                                    }
                                                    for source in ['24小时内', '24-48小时', '48-72小时', '大于72小时']
                                                ],
                                                style = {
                                                    'margin' : '0 0 5px 5px'
                                                }
                                            ),
                                        ],
                                        
                                        style = { 
                                                'display' : 'flex',  
                                                'justifyContent' : 'left',  # 一列多行时设置该属性为left，使内容左对齐
                                                'alignItems' : 'center',  
                                        },
                                        span = 24,   # 实现换行的显示效果
                                    ),
                                    fac.AntdCol(
                                        fac.AntdInput(
                                            addonBefore = '外科手术名称：',
                                            addonAfter = '。',
                                            style = {
                                                'width': '700px',  
                                                'margin' : '0 0 5px 5px',
                                            },
                                        ),
                                        style = {
                                                'display' : 'flex',  
                                                'justifyContent' : 'left',  # 一列多行时设置该属性为left，使内容左对齐
                                                'alignItems' : 'center',  
                                                 
                                        },
                                    ),
                                ]
                            ),
                            style = {
                                    'display' : 'flex',  
                                    'justifyContent' : 'left',    # 一列多行时设置该属性为left，使内容左对齐
                                    'alignItems' : 'center',      
                            },
                            flex = '8'

                        ),
                        
                    ],
                    style = {
                        'borderBottom' : '#e0e0e0 solid',   # 显示边框模拟表格
                        'height' : '80px',
                    }
                ),
                
                # 第18行，手术
                fac.AntdRow(
                    [
                        fac.AntdCol(
                            fac.AntdText(
                                '介入',
                                style = {
                                    'fontSize': '16px',
                                    'fontWeight' : 'bold'
                                }
                            ),
                            style = {
                                    'borderRight' : '#e0e0e0 solid',
                                    'display' : 'flex',  
                                    'justifyContent' : 'center', 
                                    'alignItems' : 'center',  
                                },
                            flex='2'         
                        ),
                        fac.AntdCol(
                            fac.AntdRow(
                                [
                                    fac.AntdCol(
                                        [
                                            fac.AntdText(
                                                '介入时间：',
                                                style = {
                                                    'fontSize': '16px',
                                                    'margin' : '0 0 5px 5px',
                                                }
                                            ),
                                            fac.AntdRadioGroup(
                                                options=[
                                                    {
                                                        'label': source,
                                                        'value': source
                                                    }
                                                    for source in ['24小时内', '24-48小时', '48-72小时', '大于72小时']
                                                ],
                                                style = {
                                                    'margin' : '0 0 5px 5px'
                                                }
                                            ),
                                        ],
                                        
                                        style = { 
                                                'display' : 'flex',  
                                                'justifyContent' : 'left',  # 一列多行时设置该属性为left，使内容左对齐
                                                'alignItems' : 'center',  
                                        },
                                        span = 24,   # 实现换行的显示效果
                                    ),
                                    fac.AntdCol(
                                        fac.AntdInput(
                                            addonBefore = '介入手术名称：',
                                            addonAfter = '。',
                                            style = {
                                                'width': '700px',  
                                                'margin' : '0 0 5px 5px',
                                            },
                                        ),
                                        style = {
                                                'display' : 'flex',  
                                                'justifyContent' : 'left',  # 一列多行时设置该属性为left，使内容左对齐
                                                'alignItems' : 'center',  
                                                 
                                        },
                                    ),
                                ]
                            ),
                            style = {
                                    'display' : 'flex',  
                                    'justifyContent' : 'left',    # 一列多行时设置该属性为left，使内容左对齐
                                    'alignItems' : 'center',      
                            },
                            flex = '8'

                        ),
                        
                    ],
                    style = {
                        'borderBottom' : '#e0e0e0 solid',   # 显示边框模拟表格
                        'height' : '80px',
                    }
                ),
                
                # 第19行，患者诊断
                fac.AntdRow(
                    [
                        fac.AntdCol(
                            fac.AntdText(
                                '患者诊断',
                                style = {
                                    'fontSize': '16px',
                                    'fontWeight' : 'bold'
                                }
                            ),
                            style = {
                                    'borderRight' : '#e0e0e0 solid',
                                    'display' : 'flex', 
                                    'justifyContent' : 'center', 
                                    'alignItems' : 'center',      
                                },
                            flex='2'         
                        ),
                        fac.AntdCol(
                            fac.AntdInput(
                                addonBefore = '最终患者诊断出血部位：',
                                style = {
                                    'width': '95%',  
                                    'margin' : '0 0 0px 5px',
                                }
                            ),
                            style = {
                                    'display' : 'flex', 
                                    'justifyContent' : 'left', 
                                    'alignItems' : 'center',     
                            },
                            flex = '8'
                        ),
                        
                    ],
                    style = {
                        'borderBottom' : '#e0e0e0 solid',   # 显示边框模拟表格
                        'height' : '40px',
                    },
                ),
                
                # 第20行，患者转归
                fac.AntdRow(
                    [
                        fac.AntdCol(
                            fac.AntdText(
                                '患者转归',
                                style = {
                                    'fontSize': '16px',
                                    'fontWeight' : 'bold'
                                }
                            ),
                            style = {
                                    'borderRight' : '#e0e0e0 solid',
                                    'display' : 'flex', 
                                    'justifyContent' : 'center', 
                                    'alignItems' : 'center',      
                                },
                            flex='2'         
                        ),
                        fac.AntdCol(
                            [
                                fac.AntdCheckbox(
                                    label='出院',
                                    style = {
                                        'margin' : '0 0 0 5px',
                                    }
                                ),
                                fac.AntdCheckbox(
                                    label='转科',
                                    style = {
                                        'margin' : '0 0 0 5px',
                                    }
                                ),
                                fac.AntdInput(
                                    addonBefore = '（科室名称：',
                                    addonAfter = '）',
                                    style = {
                                        'width': '300px',  
                                        'margin' : '0 0 0 5px',
                                    },
                                ),
                                fac.AntdCheckbox(
                                    label='死亡',
                                    style = {
                                        'margin' : '0 0 0 5px',
                                    }
                                ),
                            ],
                            style = {
                                    'display' : 'flex', 
                                    'justifyContent' : 'left', 
                                    'alignItems' : 'center',     
                            },
                            flex = '8'
                        ),
                        
                    ],
                    style = {
                        'borderBottom' : '#e0e0e0 solid',   # 显示边框模拟表格
                        'height' : '40px',
                    },
                ),
                
                # 第21行，治疗再出血
                fac.AntdRow(
                    [
                        fac.AntdCol(
                            fac.AntdText(
                                '治疗再出血',
                                style = {
                                    'fontSize': '16px',
                                    'fontWeight' : 'bold'
                                }
                            ),
                            style = {
                                    'borderRight' : '#e0e0e0 solid',
                                    'display' : 'flex',  
                                    'justifyContent' : 'center', 
                                    'alignItems' : 'center',  
                                },
                            flex='2'         
                        ),
                        fac.AntdCol(
                            fac.AntdRadioGroup(
                                options=[
                                    {
                                        'label': source,
                                        'value': source
                                    }
                                    for source in ['是', '否']
                                ],
                            ),
                            style = {
                                    'display' : 'flex',  
                                    'justifyContent' : 'center',  
                                    'alignItems' : 'center',      
                            },
                            flex = '8'
                        ),
                        
                    ],
                    style = {
                        'borderBottom' : '#e0e0e0 solid',   # 显示边框模拟表格
                        'height' : '40px',
                    },
                ),

                # 第22行，出科时间
                fac.AntdRow(
                    [
                        fac.AntdCol(
                            fac.AntdText(
                                '出科时间',
                                style = {
                                    'fontSize': '16px',
                                    'fontWeight' : 'bold'
                                }
                            ),
                            style = {
                                    'borderRight' : '#e0e0e0 solid',
                                    'display' : 'flex',  
                                    'justifyContent' : 'center', 
                                    'alignItems' : 'center',  
                                },
                            flex='2'         
                        ),
                        fac.AntdCol(
                            fac.AntdDatePicker(
                                placeholder='精确到分钟',
                                showTime=True,
                                style = {                 
                                    'margin' : '0 0 0 5px',
                                    'width': 250
                                }
                            ),
                            style = {
                                    'display' : 'flex',  
                                    'justifyContent' : 'left',  
                                    'alignItems' : 'center',      
                            },
                            flex = '8'
                        ),
                        
                    ],
                    style = {
                        'borderBottom' : '#e0e0e0 solid',   # 显示边框模拟表格
                        'height' : '40px',
                    },
                ),

                # 第22行，总费用
                fac.AntdRow(
                    [
                        fac.AntdCol(
                            fac.AntdText(
                                '总费用',
                                style = {
                                    'fontSize': '16px',
                                    'fontWeight' : 'bold'
                                }
                            ),
                            style = {
                                    'borderRight' : '#e0e0e0 solid',
                                    'display' : 'flex',  
                                    'justifyContent' : 'center', 
                                    'alignItems' : 'center',  
                                },
                            flex='2'         
                        ),
                        fac.AntdCol(
                            fac.AntdInputNumber(
                                addonAfter = '（精准到小数点后2位）',
                                precision = 2, 
                                min = 1,
                                step = 1000, 
                                style = {
                                    'width': '50%',  
                                    'margin' : '0 0 0 5px'
                                },
                            ),
                            style = {
                                    'display' : 'flex',  
                                    'justifyContent' : 'left',  
                                    'alignItems' : 'center',      
                            },
                            flex = '8'
                        ),
                        
                    ],
                    style = {
                        'borderBottom' : '#e0e0e0 solid',   # 显示边框模拟表格
                        'height' : '40px',
                    },
                ),


            ],
            style = {
                'width' : '1000px',   # 整个表格为1列，设置列的宽度，即为整个表格的宽度
                'borderLeft' : '#e0e0e0 solid',
                'borderRight' : '#e0e0e0 solid',
            }
        )
    ],

    style = {
        'justifyContent':'center',  # 与display一直使整个页面的内容居中
        'display' : 'flex',
        'alignItems' : 'center',     
        }
    

)


# 表格上方的留白
padding_div = html.Div(
    children = [
        html.H1()
    ],
    style = {
        'justifyContent':'center',  # 与display一直使整个页面的内容居中
        'display' : 'flex',
        'alignItems' : 'center',  
    }
)

#　脚注说明

footer_div = html.Div(
    children =[
        fac.AntdText(
            '''
            附：PPI用法（808）：首剂80mg静脉推注，然后8mg/h连续输注72h。——有活动性出血、未出血的裸露血管或黏附血凝块的患者，在内镜下治疗成功后应给予。（强推荐，高质量证据）
            目前指南共识所提到的PPI药物是：艾司奥美拉唑（埃索美拉唑）
            ''',
            style = {
                'fontSize' : '16px',
                'width' : '1000px',
                'wordWrap': 'break-word',  # 允许自动换行 
            }
        )
    ],
    style = {
        'display' : 'flex',
        'justifyContent':'center',  # 与display一直使整个页面的内容居中
        'alignItems' : 'center',  
    }
)


app.layout = html.Div(
    children = [
        padding_div,  # 页面上方的留白
        gbs_score_div,
        padding_div, 
        rockall_score_div,
        padding_div, 
        table_div,    # 表格本身,
        footer_div,
        padding_div,  # 页面下方的留白
    ]
)


# 启动应用
if __name__ == '__main__':
    app.run(
        debug = True, 
        port=os.environ.get('PORT', 8059)
        )



