<!DOCTYPE html>
<html lang="ja">
<head>
    {% with subtitle = ultmarc.subtitle %}
    {% include '_header.html' %}
    {% endwith  %}
    <title>医師情報</title>
    <link rel="stylesheet" href="/static/css/ultStyle.css">
    <script type="text/javascript">
        window.onload = function(){
            // 見出し固定初期化
            FixedMidashi.create();
            // ボタン、テキストボックス初期化
            formBtDisabled();
        }
    </script>
    <script>
        $(function(){
            // 前ページ遷移処理
            $('#prev').click(function(){
                $('#page_num').val(Number($('#page_num').val()) - 1);
                $('#instInfo').submit();
            });
            // 次ページ遷移処理
            $('#next').click(function(){
                $('#page_num').val(Number($('#page_num').val()) + 1);
                $('#instInfo').submit();
            });
        });
    </script>
</head>

<body>
    <table class="docHeaderTable">
        <tr>
            <td class="docHeaderTd"><h1>{{ultmarc.subtitle}}</h1></td>
            <td class="docHeaderTdCenter docHeaderTdCenter">
                {% if ultmarc.is_batch_processing %}
                <div class="docButchMsg">日次バッチ処理中のため、データが正しく表示されない可能性があります</div>
                {% endif %}
            </td>
            <td class="docHeaderTd docHeaderTdRight"><button class="docHeader_bt" onclick="backToMenu()">メニューへ</button></td>
        </tr>
    </table>

    <!-- 上部のボタン -->
    <table class="instHeaderTable">
        <tr>
            <form id="instInfo" name="instInfo" method="post" action="/ultmarc/docInfo">
                <input type="hidden" name="doc_id" value="{{ultmarc.doc_id}}">
                <input type="hidden" name="page_num" id="page_num" value="{{ultmarc.page_num}}">
                <td class="instHeaderTd">
                    <input type="button" name="prev" id="prev" value="前" class="transitionBt" {{ultmarc.is_disabled_prev()}}>
                </td>
                <td class="instHeaderTd">
                    {{ultmarc.is_page_num_view()}}／{{ultmarc.post_cnt}}
                </td>
                <td class="instHeaderTd">
                    <input type="button" name="next" id="next" value="次" class="transitionBt" {{ultmarc.is_disabled_next()}}>
                </td>
            </form>
            <form id="instSearch" name="instSearch" method="post" action="/ultmarc/docSearch">
                <script>
                    var form = document.getElementById("instSearch");
                    for (var i = 0, length = sessionStorage.length; i < length; ++i) {
                        let key = sessionStorage.key(i);
                        let value = sessionStorage.getItem(key);
                        const input = document.createElement('input');
                        input.setAttribute('type', 'text');
                        input.value = value;
                        input.name = key;
                        form.appendChild(input);
                    }

                </script>
                <td class="instHeaderTd">
                    <input type="submit" name="ctrl_docBackBt" class="transitionBt" value="医師検索一覧へ">
                </td>
            </form>
        </tr>
    </table>

    <table class="docInfoTable">
        <tbody>
            <tr>
                <td class="docInfoTd">医師コード:</td>
                <td><input type="text" readonly="readonly" value="{{ultmarc.doctor_info_data.dcf_pcf_dr_cd or ''}}"></td>
                <td>氏名(漢字):</td>
                <td><input type="text" readonly="readonly" value="{{ultmarc.doctor_info_data.dr_name or ''}}"></td>
                <td>氏名(カナ):</td>
                <td><input type="text" readonly="readonly" value="{{ultmarc.doctor_info_data.dr_name_kana or ''}}"></td>
            </tr>
            <tr>
                <td class="docInfoTd">性別：</td>
                <td><input type="text" readonly="readonly" value="{{ultmarc.doctor_info_data.sex or ''}}"></td>
                <td>生年月日:</td>
                <td><input type="text" readonly="readonly" value="{{ultmarc.is_input_birthday_format()}}"></td>
            </tr>
            <tr>
                <td colspan="6" class="docInfoTd">
                    出身大学:
                    <input class="docInfoTextBox" type="text" readonly="readonly" value="{{ultmarc.doctor_info_data.alma or ''}}">
                    出身県:
                    <input class="docInfoTextBox" type="text" readonly="readonly" value="{{ultmarc.doctor_info_data.hometown or ''}}">
                    卒年:
                    <input class="docInfoTextBox" type="text" readonly="readonly" value="{{ultmarc.doctor_info_data.grad_y or ''}}">
                    登録年:
                    <input class="docInfoTextBox" type="text" readonly="readonly" value="{{ultmarc.doctor_info_data.drday_y or ''}}">
                    開業年:
                    <input class="docInfoTextBox" type="text" readonly="readonly" value="{{ultmarc.doctor_info_data.estab_y or ''}}">
                </td>
            </tr>

            <tr>
                <td colspan="6" class="docInfoTd">
                    診療科目:
                {% for trt_coursed_data in ultmarc.trt_coursed_data %}
                    <input class="docInfoTrtTextBox" type="text" readonly="readonly" value="{{trt_coursed_data.trt_course_name  or ''}}">
                {% endfor %}
                {% for i in range(5-ultmarc.is_input_trt_course_data_size())%}
                    <input class="docInfoTrtTextBox" type="text" readonly="readonly" value="">
                {% endfor %}
                </td>
            </tr>
        </tbody>
    </table>
    <!-- 所属学会,所属学会専門医 -->
    <table class="docBelongTable">
        <tbody>
            <tr>
                <td class="docBelongTd  rightBoderLine">
                    <h1>所属学会</h1>
                    <div class="scroll">
                        <table class="tablesorter docSocietyTable" _fixedhead='rows:1; cols:0;'>
                            <thead>
                                <tr>
                                    <th>コード</th>
                                    <th>所属学会</th>
                                </tr>
                            </thead>
                            <tbody>
                                {% for sosiety_data in ultmarc.sosiety_data %}
                                    <tr>
                                        <td>{{sosiety_data.sosiety_cd or '　'}}</td>
                                        <td>{{sosiety_data.sosiety_name or '　'}}</td>
                                    </tr>
                                {% endfor %}
                            </tbody>
                        </table>
                    </div>
                </td>
                <td class="docBelongTd">
                    <h1>所属学会専門医</h1>
                    <div class="scroll">
                        <table class="tablesorter docSocietyTable" _fixedhead='rows:1; cols:0; border-color:gray; border-width:2px;'>
                            <thead>
                                <tr>
                                    <th>コード</th>
                                    <th>専門医資格名</th>
                                </tr>
                            </thead>
                            <tbody>
                                {% for specialist_license_data in ultmarc.specialist_license_data %}
                                    <tr>
                                        <td>{{specialist_license_data.specialist_cd or '　'}}</td>
                                        <td>{{specialist_license_data.specialist_license_name or '　'}}</td>
                                    </tr>
                                {% endfor %}
                            </tbody>
                        </table>
                    </div>
                </td>
            </tr>
        </tbody>
    </table>
    <!-- 勤務先履歴 -->
    <h1 class="wrkplaceH1">勤務先履歴</h1>
    <div class="scroll">
        <table class="tablesorter wrkplaceTable" _fixedhead='rows:1; cols:0; border-color:gray; border-width:2px;'>
            <thead>
                <tr>
                    <th>ULT施設コード</th>
                    <th>勤務先略名</th>
                    <th>所属部科名</th>
                    <th>役職名</th>
                    <th>職位</th>
                    <th>開始年月日</th>
                    <th>終了年月日</th>
                </tr>
            </thead>
            <script>
                function OnLinkClick(){
                    sessionStorage.clear();
                    return true;
                }
            </script>
            <tbody>
                {% for doctor_wrkplace_data in ultmarc.doctor_wrkplace_data %}
                {% if doctor_wrkplace_data.dcf_dsf_inst_cd %}
                    <tr>
                        <td><a href="/ultmarc/instInfo?id={{doctor_wrkplace_data.dcf_dsf_inst_cd or ''}}" onclick="OnLinkClick();">
                            {{doctor_wrkplace_data.dcf_dsf_inst_cd or ''}}</a></td>
                        <td>{{doctor_wrkplace_data.inst_name_kanji or ''}}</td>
                        <td>{{doctor_wrkplace_data.blng_sec_name or ''}}</td>
                        <td>{{doctor_wrkplace_data.univ_post_name or ''}}</td>
                        <td>{{doctor_wrkplace_data.post_name or ''}}</td>
                        <td>{{ultmarc.is_input_aply_start_ymd_format(doctor_wrkplace_data.aply_start_ymd)}}</td>
                        <td>9999/99/99</td>
                    </tr>
                {% endif %}
                {% endfor %}
                {% for doctor_wrkplace_his_data in ultmarc.doctor_wrkplace_his_data %}
                {% if doctor_wrkplace_his_data.dcf_dsf_inst_cd %}
                    <tr>
                        <td><a href="/ultmarc/instInfo?id={{doctor_wrkplace_his_data.dcf_dsf_inst_cd or ''}}" onclick="OnLinkClick();">
                            {{doctor_wrkplace_his_data.dcf_dsf_inst_cd or ''}}</a></td>
                        <td>{{doctor_wrkplace_his_data.inst_name_kanji or ''}}</td>
                        <td>{{doctor_wrkplace_his_data.blng_sec_name or ''}}</td>
                        <td>{{doctor_wrkplace_his_data.univ_post_name or ''}}</td>
                        <td>{{doctor_wrkplace_his_data.post_name or ''}}</td>
                        <td>{{ultmarc.is_input_his_aply_start_ymd_format(doctor_wrkplace_his_data.aply_start_ymd)}}</td>
                        <td>{{ultmarc.is_input_his_aply_end_ymd_format(doctor_wrkplace_his_data.aply_end_ymd)}}</td>
                    </tr>
                {% endif %}
                {% endfor %}
            </tbody>
        </table>
    </div>

</body>
</html>