/*
 * Creator:     ML
 * CreatDate:   2019-11-27
 * descripts：检验结果查询（跳转第三方）
 * */
import React from 'react';
import { Form, } from 'antd';
import { $http } from 'containers/config/https';
import './style/index.less';
const TestResultTarget = Form.create()(
    class TestResultTarget extends React.Component {
        cacheOriginData = {};
        constructor() {
            super()
            this.state = {
                iFrameHeight: '0px'
            }
        }
        componentDidMount = () => {
            this.getNo()
        }
        getNo = () => {
            let data = {}
            data = {
                params: [{
                    admID: sessionStorage.patientData ? JSON.parse(sessionStorage.patientData).admID : "",
                }]
            };
            $http.post('urlDeault', this, {
                code: "03030002",
                data: data,
                success: function (res) {
                    if (+res.errorCode === 0) {
                        this.setState({
                            patNo: res.result.basicInfo.patNo,
                            admNo: res.result.admInfo.admNo,
                        })
                    }
                }
            });
        }
        render() {
            const { patNo, admNo } = this.state
            let userId = sessionStorage.userData ? JSON.parse(sessionStorage.userData).userID : "";
            let userName = sessionStorage.userData ? JSON.parse(sessionStorage.userData).userName : "";
            let url = "http://192.168.5.21/imedicallis/lis/his/frmLisReportQuery.aspx?patId=" + patNo + "&admId=" + admNo + "&userId=" + userId + "&userName" + userName
            return (
                <div>
                    <iframe
                        style={{ width: '100%', height: "69vh", overflow: 'visible' }}
                        // onLoad={() => {
                        //     const obj = ReactDOM.findDOMNode(this);
                        //     this.setState({
                        //         "iFrameHeight":  obj.contentWindow.document.body.scrollHeight + 'px'
                        //     });
                        // }} 
                        ref="iframe"
                        src={url}
                        width="100%"
                        height="69vh"
                        scrolling="no"
                        frameBorder="0"
                    />
                </div>
            )
        }
    })
export default TestResultTarget