<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>HIS-查看</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">
    <link rel="stylesheet" href="../../assets/layui/css/layui.css" />
    <link rel="stylesheet" href="../../assets/css/webuploader.css" />
    <link rel="stylesheet" href="../../assets/css/public.css" />
    <script>
        parent.el();
    </script>
</head>
<body>

<div class="c-box">
    <div class="f-box">
        <!--导航-->
        <div id="crumbs">
            <ul>
                <li><a href="../../home.html">首页</a></li>
                <li><a href="applicationList.html">申请列表</a></li>
                <li><a class="active">病历查看</a></li>
            </ul>
        </div>
        <div id="viewBox">
            <div id="printBox">
                <blockquote class="layui-elem-quote" style="margin-bottom: 15px;">
                    <ul class="view-h">
                        <li class="f-left">
                            <span><i class="layui-icon">&#xe612;</i></span>
                            <span>{{hisInterfaceCon.patientsName}}</span>
                        </li>
                    </ul>
                </blockquote>
                <fieldset class="details-list layui-elem-field layui-field-title">
                    <legend><img src="../../assets/images/xinxi-ico.png" />&nbsp;详细信息</legend>
                    <div class="layui-field-box">
                        <ul class="layui-row">
                            <li class="layui-col-xs6 layui-col-sm6 layui-col-md4">
                                <span>301就诊ID：</span>
                                <span>{{hisInterfaceCon.visitId}}</span>
                            </li>
                            <li class="layui-col-xs6 layui-col-sm6 layui-col-md4">
                                <span>申请科室：</span>
                                <span>{{hisInterfaceCon.applicationDepartment}}</span>
                            </li>
                            <li class="layui-col-xs4 layui-col-sm12 layui-col-md4">
                                <span>申请医院：</span>
                                <span>{{hisInterfaceCon.applicationInstitution}}</span>
                            </li>
                            <li class="layui-col-xs6 layui-col-sm6 layui-col-md4">
                                <span>会诊类型：</span>
                                <span>{{hisInterfaceCon.consultationCategory=='y'?'预约':hisInterfaceCon.consultationCategory=='v'?'视频':'书面'}}</span>
                            </li>
                            <li class="layui-col-xs6 layui-col-sm6 layui-col-md4">
                                <span>会诊联系电话：</span>
                                <span>{{hisInterfaceCon.doctorTel}}</span>
                            </li>
                        </ul>
                    </div>
                </fieldset>
                <fieldset class="details-list layui-elem-field layui-field-title">
                    <legend><img src="../../assets/images/bingli-icon.png" />&nbsp;病历信息</legend>
                    <div class="layui-field-box">
                        <ul class="layui-row medicalRecord">
                            <li class="layui-col-xs12 layui-col-sm12 layui-col-md12">
                                <span class="f-left">会诊目的：</span>
                                <span class="f-left">{{hisInterfaceCon.purpose}}</span>
                            </li>
                        </ul>
                    </div>
                </fieldset>
                <fieldset v-if="hisInterfaceCon.status==6 || hisInterfaceCon.status==8" class="details-list layui-elem-field layui-field-title">
                    <legend style="margin-bottom: 10px;"><img src="../../assets/images/zhenduan-icon.png" />&nbsp;诊断结果</legend>
                    <div class="layui-field-box">
                        <ul class="layui-row medicalRecord">
                            <li class="layui-col-xs12 layui-col-sm12 layui-col-md12">
                                <span class="f-left">专家回复：</span>
                                <span class="f-left">{{hisInterfaceCon.expertReturn}}</span>
                            </li>
                        </ul>
                        <div class="layui-upload-list">
                            <table class="layui-table">
                                <thead>
                                <tr>
                                    <th>序号</th>
                                    <th>文件名称</th>
                                    <th>操作</th>
                                </tr>
                                </thead>
                                <tbody>
                                <tr v-for="(ra,index) in ReplayAffix">
                                    <td>{{index+1}}</td>
                                    <td>{{ra.docType}}</td>
                                    <td><a class="layui-btn layui-btn-xs" v-on:click="checkReplayAff(ra)">查看</a>
                                        <a class="layui-btn layui-btn-danger layui-btn-xs" v-on:click="downCase(ra)">下载</a></td>
                                </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </fieldset>
                <a class="layui-btn layui-btn-normal" id="checkHis">查看HIS病历</a>
            </div>
        </div>
        <div class="formBtn">
            <a class="layui-btn layui-btn-warm" href="javascript:history.back(-1)">返回</a>
        </div>
    </div>
</div>


<script type="text/javascript" src="../../assets/js/jquery-1.8.3.js" ></script>
<script type="text/javascript" src="../../assets/js/util.js" ></script>
<script type="text/javascript" src="../../assets/layui/layui.js" ></script>
<script src="../../../node_modules/vue/dist/vue.js"></script>
<script>
    layui.use('layer', function(){
        var layer = layui.layer;
    })
    const url = parent.require('electron').remote.require('./url.config').url
    const {ipcRenderer} = parent.require('electron');
    var id = getUrlParam('rowId');
    var app = new Vue({
        el:'#viewBox',
        data:{
            caseTitle:'',
            ReplayAffix:[],
            hisInterfaceCon:{
                patientsName:'',
                visitId:'',
                applicationDepartment:'',
                consultationCategory:'',
                id:'',
                applicationInstitution:'',
                doctorTel:'',
                purpose:'',
                status:'',
                expertReturn:''
            }
        },
        created:function(){
            var _this = this;
            $.ajax({
                url: url+'client/lookDeatileByMemberHis',
                data : { id },
                type: 'post',
                dataType: 'json',
                success: function(data){
                    if(data.status=='1'){
                        for(var key in data){
                            _this[key] = data[key];
                        }
                    }
                }
            })
        },
        methods:{
            checkReplayAff:function(ra){
                console.info(ra)
                layer.photos({
                    photos: {
                        "title": "", //相册标题
                        "id": 123, //相册id
                        "start": 0, //初始显示的图片序号，默认0
                        "data": [   //相册包含的图片，数组格式
                            {
                                "alt": ra.docType,
                                "pid": ra.id, //图片id
                                "src": url+"/affixPath"+ra.fileUrl, //原图地址
                                "thumb": ra.fileUrl //缩略图地址
                            }
                        ]
                    } //格式见API文档手册页
                    ,anim: 5 //0-6的选择，指定弹出图片动画类型，默认随机
                });
            },
            checkImg:function(file){
//                        var file = this.affixList[index];
                layer.photos({
                    photos: {
                        "title": "", //相册标题
                        "id": 123, //相册id
                        "start": 0, //初始显示的图片序号，默认0
                        "data": [   //相册包含的图片，数组格式
                            {
                                "alt": file.realFileName,
                                "pid": file.id, //图片id
                                "src": file.fileUrl, //原图地址
                                "thumb": file.fileUrl //缩略图地址
                            }
                        ]
                    } //格式见API文档手册页
                    ,anim: 5 //0-6的选择，指定弹出图片动画类型，默认随机
                });
            },
            suffix:function(value){
                // 后缀获取
                var suffix = '';
                // 获取类型结果
                var result = '';
                try {
                    var flieArr = value.split('.');
                    suffix = flieArr[flieArr.length - 1];
                } catch (err) {
                    suffix = '';
                }
                if (!suffix) {
                    result = false;
                    return result;
                }
                // 图片格式
                var imglist = ['png', 'jpg', 'jpeg', 'bmp', 'gif'];
                result = imglist.some(function (item) {
                    return item == suffix;
                });
                return result;
            },
            openFileUpload:function(){
                layer.open({
                    type: 1,
                    title:'参考文件上传',
                    area: ['600px', 'auto'], //宽高
                    content: $('#specificationFile-box')
                });
            },
            downCase(ra){
                console.info(url+"/affixPath"+ra.fileUrl)
                ipcRenderer.send('download',url+"/affixPath"+ra.fileUrl);
            }
        }
    })







    const shell = parent.require('electron').shell
    $("body").on('click','#checkHis',function(event){
        event.preventDefault()
        shell.openExternal("http://202.106.159.94:9099/phr/view/index.htm?preid="+id)
    })
</script>
</body>
</html>
