/**
 * 门诊皮试
 */
import React from 'react';
import {
    Form, Input, Select, DatePicker, Button, Checkbox, Radio, Row, Col, Pagination, message, Table,
    List, TimePicker, Switch, Modal
} from 'antd';
import ColumnAuthoritysModel from '../columnAuthority/ColumnAuthoritysModel'
import { $http } from '../../containers/config/https';
import store from '../../store';
import Moment from 'moment';
import './CSS/opNurse.less';
import { Aes } from '../../tools/index';
import CommonPagination from 'components/pagination/index';

let user;
const RangePicker = DatePicker.RangePicker;
const { Option } = Select;
const FormItem = Form.Item;
const { TextArea } = Input;
const info = Modal.info;
let timer = undefined;
const formItemLayout = {
    labelCol: {
        xs: { span: 24 },
        sm: { span: 3 },
    },
    wrapperCol: {
        xs: { span: 24 },
        sm: { span: 21 },
    },
};
const formItemTimeOth = {
    labelCol: {
        xs: { span: 0 },
        sm: { span: 0 },
    },
    wrapperCol: {
        xs: { span: 23 },
        sm: { span: 23 },
    },
};
const formItemDate = {
    labelCol: {
        xs: { span: 10 },
        sm: { span: 10 },
    },
    wrapperCol: {
        xs: { span: 14 },
        sm: { span: 14 },
    },
};
const formItemNotes = {
    labelCol: {
        xs: { span: 5 },
        sm: { span: 5 },
    },
    wrapperCol: {
        xs: { span: 19 },
        sm: { span: 19 },
    },
};
const formItemZero = {
    labelCol: {
        xs: { span: 3 },
        sm: { span: 3 },
    },
    wrapperCol: {
        xs: { span: 21 },
        sm: { span: 21 },
    },
};
const formItemLong = {
    labelCol: {
        xs: { span: 14 },
        sm: { span: 14 },
    },
    wrapperCol: {
        xs: { span: 8 },
        sm: { span: 8 },
    },
};

class SkinTest extends React.Component {
    constructor(props) {
        super(props);
        user = window.sessionStorage.userData ? JSON.parse(window.sessionStorage.userData) : {};
        this.state = {
            size: 'small',
            search: 'search',
            cardTypeID: "",
            cardTypeList: [],
            patListType: "PS",
            patType: "S",
            patList: [],        //需皮试患者列表
            currentPat: {},
            inProgressPat: [],  //进行中患者列表
            SkinTestPatListColumn: [],
            SkinTestOnGoingColumn: [],
            compontName: "",
            visible: false,
            skinTestTime: [],
            defSkinTimeID: "",
            PPDTime: [],
            defPPDTimeID: "",
            total: 0,
            page: 1,
            pageSize: 10,
            status: "S",
            patStatus: "S",
            ordList: [],
            skinStartDate: "",
            skinStartTime: "",
            ordID: "",
            setUserID: "",
            auditUserID: "",
            total1: 0,
            billCode: "",
            page1: 1,
            pageSize1: 10,
            skinTestResult: {},
            number: "",
            cardNo: "",
            stDate: "",
            endDate: "",
            skinTestFlag: false,    // 已皮试
            replenishZero: '',  // 自动补领标志
            cardLength: '',     // 卡号长度
            switchFlag: false,
            ENObj: {},
            CNObj: {},
        }
        this.scleromaDiam = React.createRef();
        this.blushDiam = React.createRef();
        this.batchNumber = React.createRef();
        this.batchNumber1 = React.createRef();
        this.setUser = React.createRef();
        this.setUserPassword = React.createRef();
        this.auditUser = React.createRef();
        this.auditUserPassword = React.createRef();
        this.notes = React.createRef();
        this.submit = React.createRef();

    }

    //渲染完成时调用
    componentDidMount() {
        this.handleBaseData();
        this.loadColumn("SkinTestPatList");
        this.loadColumn("SkinTestOnGoing");
        this.handleQueryPat();
        this.handleQueryInProgressPat();
        let x = document.querySelectorAll(".ant-table-body");
        for (let i = 0; i < x.length; i++) {
            x[i].style.height = store.getState().tableHeight.y + 40 + 'px';
        }
    }
    componentWillUnmount() {
        // 组件销毁前将静止让setState修改state的状态
        this.setState = (state, callback) => { return; }
        clearInterval(timer);
    }

    //查询列头数据
    loadColumn = (compontName) => {
        let data = {
            params: [{
                compontName: compontName ? compontName : this.state.compontName,
                type: "C",
                reactCode: [compontName ? compontName : this.state.compontName]
            }]
        }
        $http.post('urlDeault', this, {
            code: "01040073",
            data: data,
            success: (res) => {
                if (res.errorCode == 0) {
                    let column = res.result.C;
                    if (user.language == 'EN') {
                        for (let i = 0; i < column.length; i++) {
                            column[i].title = column[i].enDescripts
                        }
                    }
                    var arr = Object.keys(res.result.language.EN);
                    if (arr.length > 0) {
                        this.setState({
                            [(compontName ? compontName : this.state.compontName) + "Column"]: res.result.C,
                            ENObj: res.result.language.EN,
                            CNObj: res.result.language.CN
                        })
                    } else {
                        this.setState({
                            [(compontName ? compontName : this.state.compontName) + "Column"]: res.result.C,
                        })
                    }

                }
            }
        })
    }
    //查询患者列表
    handleQueryPat = () => {
        let data = {
            params: [{
                locID: user.locID,
                type: this.state.patListType == "PS" ? "S" : "P",
                status: "S",
            }],
            pagination: [{
                pageSize: this.state.pageSize,
                currentPage: this.state.page,
            }]
        }
        $http.post('urlDeault', this, {
            code: "04120001",
            data: data,
            success: (res) => {
                if (+res.errorCode === 0) {
                    this.setState({
                        patList: res.result,
                        total: res.total,
                        // currentPat: {},
                    })
                }
            }
        })
    }
    //查询正在皮试患者列表
    handleQueryInProgressPat = () => {
        clearInterval(timer);
        let data = {
            params: [{
                locID: user.locID,
                status: "B",
            }],
            pagination: [{
                pageSize: this.state.pageSize1,
                currentPage: this.state.page1,
            }]
        }
        $http.post('urlDeault', this, {
            code: "04120001",
            data: data,
            success: (res) => {
                if (+res.errorCode === 0) {
                    this.setState({
                        inProgressPat: res.result,
                        total1: res.total,
                        currentPat: {},
                    }, () => {
                        this.onTimerInProgressPat();
                    })
                }
            }
        })
    }
    //给正在进行中的患者列表添加计时器
    onTimerInProgressPat = () => {
        timer = setInterval(() => {
            var msgAlert = "";
            for (var i = 0; i < this.state.inProgressPat.length; i++) {
                var obj = this.state.inProgressPat[i];
                if (obj.remainder > 0) {
                    obj.remainder = obj.remainder - 1;
                    //天数计算
                    let days = parseInt((obj.remainder) / (24 * 3600));

                    //小时计算
                    let hours = parseInt((obj.remainder) % (24 * 3600) / 3600);
                    if (hours < 10) {
                        hours = "0" + hours;
                    }

                    //分钟计算
                    let minutes = parseInt((obj.remainder) % 3600 / 60);
                    if (minutes < 10) {
                        minutes = "0" + minutes;
                    }
                    //秒计算
                    let second = (obj.remainder) % 60
                    if (second < 10) {
                        second = "0" + second;
                    }
                    this.state.inProgressPat[i].remainderTimes = (days > 0 ? days + "天 " : "") + hours + ":" + minutes + ":" + second;

                } else {
                    if (this.state.inProgressPat[i].remainderTimes != "已超时!") {
                        if (msgAlert != "") {
                            msgAlert = msgAlert + ",\n" + this.state.inProgressPat[i].patName;
                        } else {
                            msgAlert = "患者:" + this.state.inProgressPat[i].patName
                        }
                    }
                    this.state.inProgressPat[i].remainderTimes = "已超时!";
                }
                this.forceUpdate();

            }
            if (msgAlert != "") {
                info({
                    title: '皮试提醒',
                    content: (
                        <div>
                            {msgAlert}
                            <div>可查看皮试结果</div>
                        </div>
                    ),
                    onOk() { },
                });
            }
        }, 1000);
    }
    //点击患者
    onRow = (row) => {

        if ((row.patID == this.state.currentPat.patID) && (this.state.patStatus == "S")) {
            this.setState({ currentPat: {}, patStatus: "S", ordList: [], patType: "", number: '' });
        } else {
            this.setState({ currentPat: row, patStatus: "S", status: "S", patType: this.state.patListType == "PS" ? "S" : "P", number: row.patNo }, () => {
                if (this.state.skinTestFlag === true) {
                    this.handleSearch();
                } else {
                    this.handleQueryOrd();
                }
            });
        }

    }
    //点击皮试进行中患者
    onGoingRow = (row) => {

        if ((row.patID == this.state.currentPat.patID) && (this.state.patStatus == "B")) {
            this.setState({ currentPat: {}, patStatus: "B", ordList: [], patType: "", number: '' });
        } else {
            this.setState({ currentPat: row, patStatus: "B", status: "P", patType: row.typeID, number: row.patNo }, () => {
                if (this.state.skinTestFlag === true) {
                    this.handleSearch();
                } else {
                    this.handleQueryOrd();
                }
            });
        }

    }
    ///行背景色
    setRowClassName = (flag, row) => {
        return (row.patID === this.state.currentPat.patID) && (this.state.patStatus == flag) ? 'clickRowStyle' : '';
    }
    //查询患者皮试/PPD医嘱
    handleQueryOrd = () => {
        var billCode = "";
        let data = {
            params: [{
                patID: this.state.currentPat.patID,
                type: this.state.patStatus == "S" ? (this.state.patListType == "PS" ? "S" : "P") : "",
                status: this.state.patStatus,
                stDate: this.state.stDate,
                endDate: this.state.endDate,
                skinTestFlag: this.state.skinTestFlag ? 1 : 0,
            }]
        }
        $http.post('urlDeault', this, {
            code: "04120002",
            data: data,
            success: (res) => {
                if (+res.errorCode === 0) {
                    let ordID = "", skinTestInfo = "";
                    if (res.result.length == 1) {
                        ordID = res.result[0].ordID;
                        skinTestInfo = res.result[0].skintestResult;
                        billCode = res.result[0].billCode
                    }
                    if (skinTestInfo.data) {
                        this.setState({
                            skinTestResult: skinTestInfo.data,
                            switchFlag: skinTestInfo.data.result === 'Y' ? true : false,
                            status: "P",
                            patType: (skinTestInfo.data.PPDFlag === 'Y') ? "P" : 'S'
                        })
                    } else {
                        this.setState({
                            status: "S",
                        })
                    }
                    this.setState({
                        ordList: res.result,
                        ordID: ordID,
                        billCode: billCode,
                        skinTestResult: {},
                    })

                }
            }
        })
    }

    //加载基础数据
    handleBaseData = () => {
        let data = {
            params: [{
                hospID: user.hospID,
            }]
        }
        $http.post('urlDeault', this, {
            code: "04080005",
            data: data,
            success: (res) => {
                if (+res.errorCode === 0) {
                    let defaultCardTypeID = "", replenishZero = '', cardLength = '';
                    res.result.cardTypeList.map((item) => {
                        if (item.defaultFlag === "Y") {
                            defaultCardTypeID = item.id;
                            replenishZero = item.replenishZero;
                            cardLength = item.cardLength;
                        }
                    })
                    this.setState({
                        cardTypeList: res.result.cardTypeList,
                        cardTypeID: defaultCardTypeID,
                        skinTestTime: res.result.skinTestTime,
                        defSkinTimeID: res.result.defSkinTimeID,
                        PPDTime: res.result.PPDTime,
                        defPPDTimeID: res.result.defPPDTimeID,
                        replenishZero: replenishZero,
                        cardLength: cardLength,
                        FirstCharge: res.result.FirstCharge
                    })
                }
            }
        })
    }
    //卡类型修改
    cardTypeChange = (value, opt) => {
        const cardLength = opt.props.title.split('^')[0], replenishZero = opt.props.title.split('^')[1]
        this.setState({
            cardTypeID: value,
            cardLength,
            replenishZero
        })
    }
    //切换患者列表
    onPatListChange(type) {
        this.setState({
            patListType: type,
            patType: type == "PS" ? "S" : "P",
            total: 0,
            page: 1,
        }, () => {
            this.handleQueryPat();
        })
    }
    //修改日期
    onDateChange = (date, dateString) => {
        this.setState({
            stDate: dateString[0],
            endDate: dateString[1],
        })
    }

    //分页切换
    changePageSize(flag, current, pageSize) {
        this.setState({ ["pageSize" + flag]: pageSize, ["page" + flag]: current }, () => {
            if (flag == "") {
                this.handleQueryPat();
            } else {
                this.handleQueryInProgressPat();
            }

        });
    }

    //分页切换
    onPageChange = (flag, page, pageSize) => {
        this.setState({ ["page" + flag]: page }, () => {
            if (flag == "") {
                this.handleQueryPat();
            } else {
                this.handleQueryInProgressPat();
            }
        });
    }
    //皮试计时开始
    onStart = () => {
        if (this.state.ordID == "") {
            message.warn("请先选择要开始计时的医嘱");
            return;
        }
        if (this.state.FirstCharge == "Y" && this.state.billCode != "P") {
            message.warn("请选择已收费的医嘱");
            return;
        }
        this.props.form.validateFields((err, values) => {
            if (!err) {  //!err
                let time = values.time;
                let timeOth = values.timeOth;
                if ((!time) && (!timeOth)) {
                    message.warn("请填写或勾选皮试时长!");
                    return;
                }
                if (timeOth) {
                    if (this.state.status == "S") {
                        timeOth = timeOth + "M";
                    } else {
                        timeOth = timeOth + "H";
                    }
                }
                let data = {
                    params: [{
                        skinType: this.state.patListType,
                        type: "S",
                        userID: user.userID,
                        ordID: this.state.ordID,
                        startDate: this.state.skinStartDate,
                        startTime: this.state.skinStartTime,
                        timeimg: time || timeOth,
                    }]
                }
                $http.post('urlDeault', this, {
                    code: "04120004",
                    data: data,
                    success: (res) => {
                        if (+res.errorCode === 0) {
                            message.success("计时开始");
                            this.setState({
                                ordID: "",
                                ordList: []
                            }, () => {
                                this.handleQueryOrd();
                                this.handleQueryPat();
                                this.handleQueryInProgressPat();
                                this.props.form.resetFields();
                            })

                        }
                    }
                })
            }
        })
    }
    //置皮试结果
    onSetResult = () => {
        var that = this;
        if (that.state.ordID == "") {
            message.warn("请先选择要置结果的医嘱");
            return;
        }
        that.props.form.validateFields((err, values) => {
            if (!err) {  //!err
                if ((values.setUser == "") || (values.auditUserID == "") || (values.auditUserPassword == "") || (values.setUserPassword == "")) {
                    message.warn("请输入皮试用户和复核人工号及密码");
                    return;
                }
                if ((values.auditUserID != "") && (that.state.auditUserID == "")) {
                    message.warn("复核用户密码错误");
                    return;
                }
                if ((values.setUser != "") && (that.state.setUserID == "")) {
                    message.warn("皮试用户密码错误");
                    return;
                }
                let data = {
                    params: [{
                        type: that.state.patType,
                        userID: user.userID,
                        ordID: that.state.ordID,
                        batchNumber: that.state.patType == "S" ? values.batchNumber || '' : values.batchNumber1 || '',
                        auditUser: that.state.auditUserID,
                        setUser: that.state.setUserID,
                        notes: values.notes || '',
                        result: that.state.patType == "S" ? (values.result ? "Y" : "N") : "",
                        PPDResult: values.PPDResult || '',
                        scleromaDiam: values.scleromaDiam || '',
                        blushDiam: values.blushDiam || '',
                        necrosis: values.necrosis || '',
                    }]
                }
                $http.post('urlDeault', that, {
                    code: "04120003",
                    data: data,
                    success: (res) => {
                        if (+res.errorCode === 0) {
                            message.success("置结果完成");
                            that.setState({
                                ordID: "",
                                ordList: []
                            }, () => {
                                that.handleQueryOrd();
                                that.handleQueryPat();
                                that.handleQueryInProgressPat();
                                that.props.form.resetFields();
                            })
                        }
                    }
                })
            }
        })
    }
    //点击皮试结果按钮
    onChangeStatus = (status) => {
        this.setState({
            status: status
        })
    }
    //修改日期时间时触发
    handleDateTimeChange = (flag, time, datetimeString) => {
        this.setState({ [flag]: datetimeString });
    }

    //时间框数据改变
    onTimeOthChange = (e) => {
        this.props.form.setFieldsValue({
            timeOth: e.target.value,
            time: undefined,
        })
    }
    //时间选择数据改变
    onTimeChange = (e) => {
        this.props.form.setFieldsValue({
            timeOth: undefined
        })
    }
    //点击医嘱时触发
    onClickOrd = (item, e) => {
        let ordID = item.ordID, skinTestInfo = item.skintestResult;
        if (ordID == this.state.ordID) {
            ordID = "";
        }

        if (skinTestInfo.data) {
            this.setState({
                skinTestResult: skinTestInfo.data,
                switchFlag: skinTestInfo.data.result === 'Y' ? true : false,
                status: "P",
                patType: (skinTestInfo.data.PPDFlag === 'Y') ? "P" : 'S'
            })
        } else {
            this.setState({
                status: "S",
            })
        }

        this.setState({
            ordID: ordID,
            billCode: item.billCode,
            // skinTestResult: {}
        })

    }
    onPressEnter = (flag, e) => {
        let value = this.props.form.getFieldValue(flag);

        switch (flag) {
            case 'setUser':
                if (!value) {
                    message.warn("请输入工号!");
                } else {
                    this.setUserPassword.current.focus();
                }
                break;
            case 'auditUser':
                if (!value) {
                    message.warn("请输入工号!");
                } else {
                    this.auditUserPassword.current.focus();
                }
                break;
            case 'scleromaDiam':
                if (!value) {
                    message.warn("请输入红晕/直径!");
                } else {
                    this.blushDiam.current.focus();
                }
                break;
            case 'blushDiam':
                if (!value) {
                    message.warn("请输入红晕/直径!");
                } else {
                    this.batchNumber1.current.focus();
                }
                break;
            case 'batchNumber':
            case 'batchNumber1':
                if (!value) {
                    message.warn("请输入药品批号!");
                } else {
                    this.setUser.current.focus();
                }
                break;
            case 'notes':
                this.submit.current.focus();
                break;
        }

    }
    //判断用户密码是否正确
    IsValidUser = (flag, eventFlag, e) => {
        if (e) {
            e.stopPropagation();
        }
        let userName = this.props.form.getFieldValue(flag);
        let passWord = this.props.form.getFieldValue(flag + 'Password');
        if ((!userName) || (!passWord)) {
            if (eventFlag == "") {
                message.warn("请输入用户/密码!")
            }
            return;
        }
        let data = {
            "params": [{
                "userName": userName,
                "passWord": Aes.Encrypt(passWord)
            }]
        };
        $http.post('urlDeault', this, {
            code: "1001",
            data: data,
            success: function (res) {
                let errorCode = res.errorCode;
                if (errorCode === '0') {
                    let result = res.result[0];
                    this.setState({
                        [flag + 'ID']: result.userID,
                    })
                    if (flag == "setUser") {
                        this.auditUser.current.focus();
                    } else {
                        this.notes.current.focus();
                    }
                } else {
                    this.setState({
                        [flag + 'ID']: '',
                    })
                }
            },
            error: function () {

            }
        });


    }
    onNecrosisChange = (e) => {
        if (e.target.value == "Y") {
            this.props.form.setFieldsValue({
                PPDResult: "++++",
            })
        } else {
            let scleromaDiam = this.props.form.getFieldValue('scleromaDiam');
            let blushDiam = this.props.form.getFieldValue('blushDiam');
            if ((!blushDiam) || (!scleromaDiam)) {
                this.props.form.setFieldsValue({
                    PPDResult: "",
                })
                return;
            }
            let average = (+scleromaDiam + (+blushDiam)) / 2;
            if (average < 5) {
                this.props.form.setFieldsValue({
                    PPDResult: "-",
                })
            } else if (((average > 5) && (average < 10)) || (average == 5)) {
                this.props.form.setFieldsValue({
                    PPDResult: "+",
                })
            } else if (((average > 10) && (average < 20)) || (average == 10)) {
                this.props.form.setFieldsValue({
                    PPDResult: "++",
                })
            } else {
                this.props.form.setFieldsValue({
                    PPDResult: "+++",
                })
            }
        }
    }
    // 改变红晕及硬结直径 计算结果
    onNumberChange = (flag, e) => {
        let value = e.target.value;
        let necrosis = this.props.form.getFieldValue('necrosis');
        if (necrosis == "Y") {
            this.props.form.setFieldsValue({
                PPDResult: "++++",
            })
            return;
        }
        let scleromaDiam = this.props.form.getFieldValue('scleromaDiam');
        let blushDiam = this.props.form.getFieldValue('blushDiam');
        let oldValue = "";
        if (flag == "scleromaDiam") {
            oldValue = blushDiam;
        } else {
            oldValue = scleromaDiam;
        }
        var regex = /^[1-9]\d*$/; //正整数
        if (!regex.test(value)) {
            value = this.props.form.getFieldValue(flag);
        }
        if ((!value) || (!oldValue)) {
            this.props.form.setFieldsValue({
                PPDResult: "",
            })
            return;
        }
        let average = (+value + (+oldValue)) / 2;
        if (average < 5) {
            this.props.form.setFieldsValue({
                PPDResult: "-",
            })
        } else if (((average > 5) && (average < 10)) || (average == 5)) {
            this.props.form.setFieldsValue({
                PPDResult: "+",
            })
        } else if (((average > 10) && (average < 20)) || (average == 10)) {
            this.props.form.setFieldsValue({
                PPDResult: "++",
            })
        } else {
            this.props.form.setFieldsValue({
                PPDResult: "+++",
            })
        }

    }
    //读卡时调用
    handleReadCard = (e) => {
        // message.warn("暂不能读卡");
        const { cardTypeID } = this.state;
        this.readCard.ReadCard(cardTypeID, "R", (json) => {
            if (!Util.isEmpty(json)) {
                this.setState({
                    cardInfo: json,
                    cardNo: json.cardNo,
                }, () => {
                    this.handleSearch('');
                })
            }
        })
    }

    //点击查询时调用
    handleSearch = (e) => {
        if ((this.state.number == "") && (this.state.cardNo == "")) {
            return;
        }
        let num = ''
        if (this.state.cardNo != "") {
            if (this.state.replenishZero == "Y" && parseInt(this.state.cardLength) && parseInt(this.state.cardLength) > 0 && this.state.cardNo.length > 0) {
                let No = this.state.cardNo ? this.state.cardNo : '';
                let length = parseInt(this.state.cardLength);
                num = (Array(length).join(0) + No).slice(-length);
            }
        }
        let data = {
            "params": [{
                cardTypeID: this.state.cardTypeID,
                cardNo: num,
                number: this.state.number,

            }]
        };
        $http.post('urlDeault', this, {
            code: "04120005",
            data: data,
            success: function (res) {
                let errorCode = res.errorCode;
                if (errorCode == '0') {
                    this.setState({
                        currentPat: res.data,
                        patStatus: "",
                        patType: '',
                        status: 'S',
                        cardNo: num
                    }, () => {
                        this.handleQueryPat();
                        this.handleQueryOrd();
                    })
                }
            }
        });
    }
    //勾选已皮试
    onExecChange = (e) => {
        this.setState({
            skinTestFlag: e.target.checked,
        }, () => {
            this.handleQueryOrd();
        })
    }
    //卡号修改
    onCardNoChange = (e) => {
        this.setState({
            cardNo: e.target.value,
            number: "",
        })
    }
    //根据卡类型补零
    handleLength = () => {
        if (this.state.popCardVis) return
        //补0 Y 长度不为0
        if (this.state.replenishZero == "Y" && parseInt(this.state.cardLength) && parseInt(this.state.cardLength) > 0 && this.state.cardNo.length > 0) {
            let No = this.state.cardNo ? this.state.cardNo : ''
            let length = parseInt(this.state.cardLength)
            let num = (Array(length).join(0) + No).slice(-length)
            this.setState({ cardNo: num }, () => this.handleSearch(''));
        }
    }
    //病人ID或身份证号修改
    onChange = (e) => {
        this.setState({
            cardNo: "",
            number: e.target.value,
        })
    }
    ///单元格样式修改
    renderColItem = (col, colIndex, text, record, index) => {
        let obj = {
            children: text,
            props: {
                style: {}
            },
        };
        if (col.dataIndex == "remainderTimes") {
            if (record.remainder > 0) {
                obj.props.style.color = "#0079FE"
            } else {
                obj.props.style.color = "#FF0000"
            }

        }
        return obj;
    }
    handleTest = (type) => {
        this.setState({ [type]: true })
    }
    ChangeClean(type) {
        if (type == "setUser") {
            this.props.form.setFieldsValue({ "setUserPassword": "" });
            this.setState({ setUserID: '' })
        } else if (type == "auditUser") {
            this.props.form.setFieldsValue({ "auditUserPassword": "" });
            this.setState({ auditUserID: '' })
        }
    }
    //组件权限编辑器
    onColumnRef = (ref) => {
        this.columnRef = ref;
    }

    render() {
        let cardType = [];
        this.state.cardTypeList.map((item) => {
            cardType.push(
                <Option key={item.id} value={item.id} title={item.cardLength + '^' + item.replenishZero}>
                    {/* {user.language == 'CN' ? item.descripts : item.enDescripts} */}
                    {item.descripts}
                </Option>
            )
        })

        const { getFieldDecorator } = this.props.form;
        let timeRadio = [], timeArray = [];
        if (this.state.patType != "P") {
            timeArray = this.state.skinTestTime;
        } else {
            timeArray = this.state.PPDTime;
        }
        timeArray.map((item) => {
            timeRadio.push(<Radio key={item.code} value={item.code}>{item.descripts}</Radio>)
        })
        let skinTestResult = this.state.skinTestResult;
        const SkinTestOnGoingColumn = this.state.SkinTestOnGoingColumn.map((col, colIndex) => {
            return {
                ...col,
                render: this.renderColItem.bind(this, col, colIndex),
            };
        });;
        var language = user.language
        var languageObj = {}
        if (language == "EN") {
            languageObj = this.state.ENObj
        } else {
            languageObj = this.state.CNObj
        }
        return (
            <div className='skinTest' style={{ background: '#F1F1F1', height: '100%', width: '100%', overflow: 'hidden' }}>
                <ColumnAuthoritysModel
                    clientWidth='800px'
                    compontName={this.state.compontName}
                    configType="C"
                    visible={this.state.visible}
                    onRef={this.onColumnRef}
                    reloadData={this.loadColumn}
                />
                <div style={{ width: '100%', height: '50px', background: '#ffffff' }}>
                    <Row style={{ lineHeight: '50px' }}>
                        <Col span={3} >
                            <Input value={this.state.number} onChange={this.onChange} onPressEnter={this.handleSearch} placeholder={languageObj.SkinTestOnGoingPlease != null ? languageObj.SkinTestOnGoingPlease.descripts : ""} />
                        </Col>
                        <Col span={3}>
                            {languageObj.SkinTestOnGoingCardType != null ? languageObj.SkinTestOnGoingCardType.descripts : ""}<Select value={this.state.cardTypeID} onChange={this.cardTypeChange} style={{ marginLeft: '10px', width: '60%' }}>
                                {cardType}
                            </Select>
                        </Col>
                        <Col span={4}>
                            {languageObj.SkinTestOnGoingCardNo != null ? languageObj.SkinTestOnGoingCardNo.descripts : ""}<Input value={this.state.cardNo} onChange={this.onCardNoChange} onPressEnter={this.handleLength} placeholder={user.language == 'CN' ? '输入卡号(enter)' : 'Please enter the card number(enter)'} style={{ marginLeft: '10px', width: '70%' }} />
                        </Col>

                        <Col span={2} >
                            <Button type="primary" style={{ marginLeft: '10px', width: '100px' }} onClick={this.handleReadCard}>{languageObj.SkinTestOnGoingReadCard != null ? languageObj.SkinTestOnGoingReadCard.descripts : ""}</Button>
                        </Col>
                        <Col span={4}   >
                            {languageObj.SkinTestOnGoingDate != null ? languageObj.SkinTestOnGoingDate.descripts : ""}<RangePicker
                                value={[(this.state.stDate === "") ? null : Moment(this.state.stDate, 'YYYY-MM-DD'),
                                (this.state.endDate === "") ? null : Moment(this.state.endDate, 'YYYY-MM-DD')]}
                                onChange={this.onDateChange}
                                style={{ marginLeft: '10px', width: '80%' }} />
                        </Col>
                        <Col span={2}>
                            <Checkbox checked={this.state.skinTestFlag} onChange={this.onExecChange} style={{ marginLeft: '10px' }} >{languageObj.SkinTestOnGoingSkinTested != null ? languageObj.SkinTestOnGoingSkinTested.descripts : ""}</Checkbox>
                        </Col>
                        <Col span={1} >
                            <Button type="primary" style={{ marginLeft: '10px', width: '100px' }} onClick={this.handleSearch}  >{languageObj.SkinTestOnGoingQuery != null ? languageObj.SkinTestOnGoingQuery.descripts : ""}</Button>
                        </Col>
                    </Row>
                </div>
                <div style={{ width: '100%', height: '6px', background: '#f0f2f5' }}></div>
                <div style={{ width: '100%', height: 'calc(100% - 56px)', background: '#ffffff' }}>
                    <div style={{ float: 'left', width: '20%', height: '100%', border: '1px solid #cccccc', marginRight: '5px' }}>
                        <div style={{ width: '100%', height: '45px' }}>
                            {/** 患者列表 切换*/}
                            <div style={{ float: 'left', height: '45px', lineHeight: '45px', width: '50%', textAlign: 'center' }} onClick={this.onPatListChange.bind(this, "PS")} className={this.state.patListType == "PS" ? "selectList" : "unSelectList"}> {languageObj.SkinTestOnGoingSkinTest != null ? languageObj.SkinTestOnGoingSkinTest.descripts : ""}</div>
                            <div style={{ float: 'right', height: '45px', lineHeight: '45px', width: '50%', textAlign: 'center' }} onClick={this.onPatListChange.bind(this, "PPD")} className={this.state.patListType == "PPD" ? "selectList" : "unSelectList"}>PPD</div>
                        </div>
                        <div style={{ width: '100%', height: 'calc(100% - 45px)' }}>
                            <div style={{ height: '100%' }}>
                                <Table
                                    pagination={false}
                                    style={{ height: 'calc(100% - 60px)' }}
                                    scroll={{ y: 'scroll' }}
                                    bordered
                                    columns={this.state.SkinTestPatListColumn}
                                    dataSource={this.state.patList}
                                    rowKey={(row) => {
                                        return row.patID;
                                    }}
                                    rowClassName={this.setRowClassName.bind(this, "S")}
                                    onRow={(row) => {
                                        return {
                                            onClick: (event) => {
                                                this.onRow(row);
                                            },
                                        };
                                    }}
                                    onHeaderRow={column => {
                                        return {
                                            onDoubleClick: () => {
                                                this.setState({
                                                    compontName: "SkinTestPatList",
                                                }, () => {
                                                    this.columnRef.onOpenModel();
                                                })

                                            }
                                        };
                                    }
                                    }
                                >
                                </Table>
                                {/* <Pagination
                                    size="small"
                                    showQuickJumper
                                    showSizeChanger
                                    defaultCurrent={1}
                                    current={this.state.page}
                                    total={this.state.total}
                                    onShowSizeChange={this.changePageSize.bind(this, "")}
                                    onChange={this.onPageChange.bind(this, "")}
                                    style={{ textAlign: "right" }}
                                /> */}
                                <CommonPagination size={this.state.size} current={this.state.page} total={this.state.total} search={this.state.search}
                                    onShowSizeChange={this.changePageSize.bind(this, "")} complete={false} dataSource={this.state.patList}
                                    loading={this.state.loading} onChange={this.onPageChange.bind(this, "")} />
                            </div>
                        </div>
                    </div>
                    <div style={{ marginLeft: '5px', float: 'right', width: '30%', height: '100%', border: '1px solid #cccccc' }}>
                        <div style={{ height: '45px', borderBottom: '2px solid #0079FE', color: '#0079FE', lineHeight: '45px' }}>
                            <div style={{ paddingLeft: '15px' }}>{user.language == 'CN' ? '进行中' : 'Processing'}</div>
                        </div>
                        <div style={{ height: 'calc(100% - 47px)' }}>
                            <div style={{ height: '100%' }}>
                                <Table
                                    pagination={false}
                                    style={{ height: 'calc(100% - 60px)' }}
                                    scroll={{ y: 'scroll' }}
                                    bordered
                                    columns={SkinTestOnGoingColumn}
                                    dataSource={this.state.inProgressPat}
                                    rowKey={(row) => {
                                        return row.patID;
                                    }}
                                    rowClassName={this.setRowClassName.bind(this, "B")}
                                    onRow={(row) => {
                                        return {
                                            onClick: (event) => {
                                                this.onGoingRow(row);
                                            },
                                        };
                                    }}
                                    onHeaderRow={column => {
                                        return {
                                            onDoubleClick: () => {
                                                this.setState({
                                                    compontName: "SkinTestOnGoing",
                                                }, () => {
                                                    this.columnRef.onOpenModel();
                                                })

                                            }
                                        };
                                    }
                                    }
                                >
                                </Table>
                                {/* <Pagination
                                    size="small"
                                    showQuickJumper
                                    showSizeChanger
                                    defaultCurrent={1}
                                    current={this.state.page1}
                                    total={this.state.total1}
                                    onShowSizeChange={this.changePageSize.bind(this, "1")}
                                    onChange={this.onPageChange.bind(this, "1")}
                                    style={{ textAlign: "right" }}
                                /> */}
                                <CommonPagination size={this.state.size} current={this.state.page1} total={this.state.total1} search={this.state.search}
                                    onShowSizeChange={this.changePageSize.bind(this, "1")} complete={true} dataSource={this.state.inProgressPat}
                                    loading={this.state.loading} onChange={this.onPageChange.bind(this, "1")} />
                            </div>
                        </div>
                    </div>
                    <div style={{ float: 'right', width: 'calc(50% - 10px)', height: '100%', border: '1px solid #cccccc' }}>
                        <div style={{ height: '45px', borderBottom: '2px solid #0079FE', lineHeight: '45px', fontWeight: 'bold', textAlign: 'center' }}>
                            <Col span={2}>{this.state.currentPat.seqNo || ''}</Col>
                            <Col span={4}>{this.state.currentPat.patName || ''}</Col>
                            <Col span={2}>{this.state.currentPat.patSexDesc || ''}</Col>
                            <Col span={4}>{this.state.currentPat.patAge || ''}</Col>
                        </div>
                        <div style={{ height: '45%' }}>
                            <div style={{ margin: '0px 12px', borderBottom: '1px solid #cccccc', height: '40px', lineHeight: '40px' }}>
                                {languageObj.SkinTestOnGoingSkinTestResult != null ? languageObj.SkinTestOnGoingSkinTestResult.descripts : ""}
                            </div>
                            <div style={{ height: 'calc(100% - 30px)' }}>
                                <Form {...formItemLayout} layout="horizontal"  >
                                    {
                                        this.state.status === "S" ? (
                                            <div style={{ padding: '30px 10px 0 10px' }}>
                                                <Row>
                                                    <Col style={{ textAlign: 'center' }} push={4} span={6}>
                                                        <FormItem label={languageObj.SkinTestOnGoingStartDate != null ? languageObj.SkinTestOnGoingStartDate.descripts : ""} {...formItemDate}>
                                                            {getFieldDecorator('skinStartDate', {
                                                                initialValue: this.state.skinStartDate === "" ? (
                                                                    skinTestResult.startDate ? Moment(skinTestResult.startDate, 'YYYY-MM-DD') : Moment(new Date(), 'YYYY-MM-DD'))
                                                                    : Moment(this.state.skinStartDate, 'YYYY-MM-DD')
                                                            })(
                                                                <DatePicker
                                                                    onChange={this.handleDateTimeChange.bind(this, "skinStartDate")}
                                                                    style={{ width: '138px', padding: '0 0 10px 12px' }}
                                                                >
                                                                </DatePicker>
                                                            )}
                                                        </FormItem>
                                                    </Col>
                                                    <Col style={{ textAlign: 'center' }} push={4} span={5}>
                                                        <FormItem label={languageObj.SkinTestOnGoingStartTime != null ? languageObj.SkinTestOnGoingStartTime.descripts : ""} {...formItemDate}>
                                                            {getFieldDecorator('skinStartTime', {
                                                                initialValue: this.state.skinStartTime === "" ? (
                                                                    skinTestResult.startTime ? Moment(skinTestResult.startTime, 'HH:mm') : Moment(new Date(), 'HH:mm'))
                                                                    : Moment(this.state.skinStartTime, 'HH:mm')
                                                            })(
                                                                <TimePicker
                                                                    format="HH:mm"
                                                                    onChange={this.handleDateTimeChange.bind(this, "skinStartTime")}
                                                                    style={{ width: '138px', padding: '0 0 10px 12px' }}
                                                                >
                                                                </TimePicker>
                                                            )}
                                                        </FormItem>
                                                    </Col>
                                                </Row>
                                                <Row>
                                                    <Col push={4} span={19}>
                                                        <FormItem label={languageObj.SkinTestOnGoingDuration != null ? languageObj.SkinTestOnGoingDuration.descripts : ""}>
                                                            {getFieldDecorator('time', {
                                                                initialValue: skinTestResult.timeOP ? skinTestResult.timeOP : "",
                                                            })(
                                                                <Radio.Group onChange={this.onTimeChange}>
                                                                    {timeRadio}
                                                                </Radio.Group>
                                                            )}
                                                        </FormItem>
                                                    </Col>
                                                </Row>
                                                <Row style={{ lineHeight: '40px' }}>
                                                    <Col push={7} span={2}>
                                                        <FormItem {...formItemTimeOth}>
                                                            {getFieldDecorator('timeOth', {
                                                                initialValue: skinTestResult.timeOth ? skinTestResult.timeOth : "",
                                                            })(
                                                                <Input onChange={this.onTimeOthChange} />
                                                            )}
                                                        </FormItem>
                                                    </Col>
                                                    <Col push={7} span={2} style={{ lineHeight: '40px' }}>
                                                        {this.state.patType != "P" ? (languageObj.SkinTestOnGoingMinute != null ? languageObj.SkinTestOnGoingMinute.descripts : "") : (user.language == 'CN' ? '小时' : 'hours')}
                                                    </Col>

                                                </Row>
                                                <Row>
                                                    <Col push={4} span={8}>
                                                        <FormItem label={languageObj.SkinTestOnGoingRematingTime != null ? languageObj.SkinTestOnGoingRematingTime.descripts : ""} {...formItemDate}>
                                                            {getFieldDecorator('remainderTime', {
                                                                initialValue: skinTestResult.remainderTime ? skinTestResult.remainderDay + "  " + skinTestResult.remainderTime : "",
                                                            })(
                                                                <Input disabled />
                                                            )}
                                                        </FormItem>
                                                    </Col>
                                                </Row>
                                                <Row>
                                                    <Col style={{ textAlign: 'center' }}>
                                                        <Button type="primary" onClick={this.onStart}>{languageObj.SkinTestOnGoingStart != null ? languageObj.SkinTestOnGoingStart.descripts : ""}</Button>
                                                        <Button ghost style={{ marginLeft: 10, color: '#409EFF', border: '0px' }} onClick={this.onChangeStatus.bind(this, "P")} >{user.language == 'CN' ? '录入结果' : 'Enter result'}</Button>
                                                    </Col>
                                                </Row>
                                            </div>
                                        ) : (
                                                <div style={{ paddingLeft: '20%' }}>
                                                    {
                                                        (this.state.patType == "S") ? (
                                                            /**皮试结果*/
                                                            <Row>
                                                                <Col></Col>
                                                                <Col style={{ textAlign: 'center' }} span={6} >
                                                                    <FormItem label={languageObj.SkinTestOnGoingResult != null ? languageObj.SkinTestOnGoingResult.descripts : ""} {...formItemDate} required={true}>
                                                                        {getFieldDecorator('result', {
                                                                            initialValue: this.state.switchFlag,
                                                                            valuePropName: 'checked',
                                                                        })(
                                                                            <Switch checkedChildren={languageObj.SkinTestOnGoingPositive != null ? languageObj.SkinTestOnGoingPositive.descripts : ""} unCheckedChildren={languageObj.SkinTestOnGoingNegative != null ? languageObj.SkinTestOnGoingNegative.descripts : ""} className='input' onChange={(value) => { this.setState({ switchFlag: value }) }} />
                                                                        )}
                                                                    </FormItem>
                                                                </Col>
                                                                <Col style={{ textAlign: 'center' }} span={6}>
                                                                    <FormItem label={languageObj.SkinTestOnGoingDrugBatchNumber != null ? languageObj.SkinTestOnGoingDrugBatchNumber.descripts : ""} {...formItemDate}>
                                                                        {getFieldDecorator('batchNumber', {
                                                                            initialValue: skinTestResult.batchNumber
                                                                        })(
                                                                            <Input ref={this.batchNumber} onPressEnter={this.onPressEnter.bind(this, "batchNumber")} />
                                                                        )}
                                                                    </FormItem>
                                                                </Col>
                                                            </Row>
                                                        ) : (
                                                                /**PPD结果*/
                                                                <div>
                                                                    <Row>
                                                                        <Col style={{ textAlign: 'center' }} span={6}>
                                                                            <FormItem
                                                                                label={languageObj.SkinTestOnGoingRedAndIndurationDiameter != null ? languageObj.SkinTestOnGoingRedAndIndurationDiameter.descripts : ""} {...formItemLong}>
                                                                                {getFieldDecorator('scleromaDiam', {
                                                                                    initialValue: skinTestResult.scleromaDiam,
                                                                                    getValueFromEvent: (event) => {
                                                                                        return event.target.value.replace(/\D/g, '');
                                                                                    },
                                                                                })(
                                                                                    <Input ref={this.scleromaDiam} onPressEnter={this.onPressEnter.bind(this, "scleromaDiam")} onChange={this.onNumberChange.bind(this, "scleromaDiam")} />
                                                                                )}
                                                                            </FormItem>
                                                                        </Col>
                                                                        <Col style={{ textAlign: 'center' }} span={2}>
                                                                            <FormItem
                                                                                className="contentNull"
                                                                                label="*" {...formItemNotes}>
                                                                                {getFieldDecorator('blushDiam', {
                                                                                    initialValue: skinTestResult.blushDiam,
                                                                                    getValueFromEvent: (event) => {
                                                                                        return event.target.value.replace(/\D/g, '');
                                                                                    },
                                                                                })(
                                                                                    <Input ref={this.blushDiam} onPressEnter={this.onPressEnter.bind(this, "blushDiam")} onChange={this.onNumberChange.bind(this, "blushDiam")} />
                                                                                )}
                                                                            </FormItem>
                                                                        </Col>
                                                                        <Col span={1} style={{ width: '10px', lineHeight: '35px' }}>mm</Col>
                                                                        <Col style={{ textAlign: 'center' }} span={10}>
                                                                            <FormItem label={languageObj.SkinTestOnGoingLocalBlisterNecrosis != null ? languageObj.SkinTestOnGoingLocalBlisterNecrosis.descripts : ""}
                                                                                wrapperCol={{ span: 12 }}
                                                                                labelCol={{ span: 12 }}
                                                                            >
                                                                                {getFieldDecorator('necrosis', {
                                                                                    initialValue: skinTestResult.necrosis,
                                                                                })(
                                                                                    <Radio.Group
                                                                                        onChange={this.onNecrosisChange}>
                                                                                        <Radio key="N" value="N">{languageObj.SkinTestOnGoingNO != null ? languageObj.SkinTestOnGoingNO.descripts : ""}</Radio>
                                                                                        <Radio key="Y" value="Y">{languageObj.SkinTestOnGoingYES != null ? languageObj.SkinTestOnGoingYES.descripts : ""}</Radio>
                                                                                    </Radio.Group>
                                                                                )}
                                                                            </FormItem>
                                                                        </Col>
                                                                    </Row>
                                                                    <Row>
                                                                        <Col style={{ textAlign: 'center' }} span={6}>
                                                                            <FormItem label={languageObj.SkinTestOnGoingResult != null ? languageObj.SkinTestOnGoingResult.descripts : ""} {...formItemDate} required={true}>
                                                                                {getFieldDecorator('PPDResult', {
                                                                                    initialValue: skinTestResult.PPDResult,
                                                                                })(
                                                                                    <Input disabled />
                                                                                )}
                                                                            </FormItem>
                                                                        </Col>
                                                                        <Col style={{ textAlign: 'center' }} span={6}>
                                                                            <FormItem label={languageObj.SkinTestOnGoingDrugBatchNumber != null ? languageObj.SkinTestOnGoingDrugBatchNumber.descripts : ""} {...formItemDate}>
                                                                                {getFieldDecorator('batchNumber1', {
                                                                                    initialValue: skinTestResult.batchNumber,
                                                                                })(
                                                                                    <Input ref={this.batchNumber1} onPressEnter={this.onPressEnter.bind(this, "batchNumber1")} />
                                                                                )}
                                                                            </FormItem>
                                                                        </Col>
                                                                    </Row>
                                                                </div>
                                                            )
                                                    }
                                                    <Row>
                                                        <Col style={{ textAlign: 'center' }} span={6} >
                                                            <FormItem label={languageObj.SkinTestOnGoingSkinTestUser != null ? languageObj.SkinTestOnGoingSkinTestUser.descripts : ""} {...formItemDate}>
                                                                {getFieldDecorator('setUser', {
                                                                    initialValue: skinTestResult.setUserCode,
                                                                })(
                                                                    <Input ref={this.setUser} onChange={this.ChangeClean.bind(this, "setUser")} onPressEnter={this.onPressEnter.bind(this, "setUser")} />
                                                                )}
                                                            </FormItem>
                                                        </Col>
                                                        <Col style={{ textAlign: 'center' }} span={6} >
                                                            <FormItem label={languageObj.SkinTestOnGoingPassword != null ? languageObj.SkinTestOnGoingPassword.descripts : ""} {...formItemDate}>
                                                                {getFieldDecorator('setUserPassword', {
                                                                    initialValue: "",
                                                                })(
                                                                    <Input
                                                                        ref={this.setUserPassword}
                                                                        autoComplete="new-password"
                                                                        type="password"
                                                                        onBlur={this.IsValidUser.bind(this, "setUser", "onBlur")}
                                                                        onPressEnter={this.IsValidUser.bind(this, "setUser", "")}
                                                                    />
                                                                )}
                                                            </FormItem>
                                                        </Col>
                                                    </Row>
                                                    <Row>
                                                        <Col style={{ textAlign: 'center' }} span={6} >
                                                            <FormItem label={languageObj.SkinTestOnGoingReviewUser != null ? languageObj.SkinTestOnGoingReviewUser.descripts : ""} {...formItemDate}>
                                                                {getFieldDecorator('auditUser', {
                                                                    initialValue: skinTestResult.auditUserCode,
                                                                })(
                                                                    <Input ref={this.auditUser} onChange={this.ChangeClean.bind(this, "auditUser")} onPressEnter={this.onPressEnter.bind(this, "auditUser")} />
                                                                )}
                                                            </FormItem>
                                                        </Col>
                                                        <Col style={{ textAlign: 'center' }} span={6} >
                                                            <FormItem label={languageObj.SkinTestOnGoingPassword != null ? languageObj.SkinTestOnGoingPassword.descripts : ""} {...formItemDate}>
                                                                {getFieldDecorator('auditUserPassword', {
                                                                    initialValue: "",
                                                                })(
                                                                    <Input
                                                                        type="password"
                                                                        autoComplete="new-password"
                                                                        ref={this.auditUserPassword}
                                                                        onBlur={this.IsValidUser.bind(this, "auditUser", "onBlur")}
                                                                        onPressEnter={this.IsValidUser.bind(this, "auditUser", "")}
                                                                    />
                                                                )}
                                                            </FormItem>
                                                        </Col>
                                                    </Row>
                                                    <Row>
                                                        <Col style={{ textAlign: 'center' }} span={12}>
                                                            <FormItem label={languageObj.SkinTestOnGoingNote != null ? languageObj.SkinTestOnGoingNote.descripts : ""} {...formItemNotes}>
                                                                {getFieldDecorator('notes', {
                                                                    initialValue: skinTestResult.notes,
                                                                })(
                                                                    <TextArea
                                                                        ref={this.notes}
                                                                        maxLength={50}
                                                                        onPressEnter={this.onPressEnter.bind(this, "notes")}
                                                                        placeholder={languageObj.SkinTestOnGoingNotes != null ? languageObj.SkinTestOnGoingNotes.descripts : ""}
                                                                        autosize={{ minRows: 4, maxRows: 6 }}
                                                                        style={{
                                                                            height: '150',
                                                                        }} />
                                                                )}
                                                            </FormItem>
                                                        </Col>
                                                        <Col style={{ textAlign: 'center', lineHeight: '130px' }} span={7}>
                                                            <Button type="primary" ref={this.submit} onClick={this.onSetResult}>{languageObj.SkinTestOnGoingSaveResult != null ? languageObj.SkinTestOnGoingSaveResult.descripts : ""}</Button>
                                                            <Button ghost style={{ marginLeft: 10, color: '#409EFF', border: '0px' }} onClick={this.onChangeStatus.bind(this, "S")}  >{languageObj.SkinTestOnGoingTiming != null ? languageObj.SkinTestOnGoingTiming.descripts : ""}</Button>
                                                        </Col>
                                                    </Row>
                                                </div>
                                            )
                                    }


                                </Form>
                            </div>
                        </div>
                        <div style={{ height: 'calc(55% - 45px)' }}>
                            <div style={{ margin: '0px 12px', borderBottom: '1px solid #cccccc', height: '30px' }}>
                                {languageObj.SkinTestOnGoingMedicalOrderInformation != null ? languageObj.SkinTestOnGoingMedicalOrderInformation.descripts : ""}
                            </div>
                            <div style={{ height: 'calc(100% - 30px)' }}>
                                <div style={{ height: '100%', overflow: 'hidden', width: '100%' }}>
                                    <List
                                        style={{ height: '100%', overflowY: 'auto', width: '100%' }}
                                        bordered={false}
                                        dataSource={this.state.ordList}
                                        renderItem={
                                            item => (
                                                <List.Item key={item.ordID}>
                                                    <div
                                                        onClick={this.onClickOrd.bind(this, item)}
                                                        style={{
                                                            height: '80px',
                                                            width: '100%',
                                                            padding: '0 20px',
                                                            margin: '4px',
                                                            border: this.state.ordID != item.ordID ? '0px' : item.billCode == 'P' ? '1px solid #F759AB' : '1px solid #23D18B',
                                                            borderBottom: this.state.ordID != item.ordID ? '0px' : item.billCode == 'P' ? '1px solid #F759AB' : '1px solid #23D18B',
                                                        }}
                                                    >
                                                        <div style={{ fontWeight: 'bold', color: item.billCode == 'P' ? '#F759AB' : '#23D18B' }}>
                                                            <div>
                                                                <Col span={12}>{item.medDesc}&nbsp;&nbsp;&nbsp;{item.ordDocName}&nbsp;&nbsp;&nbsp;{item.billDesc}</Col>
                                                                <Col span={2}>{item.result}</Col>
                                                                <Col span={6}>{item.ordStartDate + " " + item.ordStartTime}</Col>
                                                                <Col span={4}>{item.ordFreqDesc}</Col>
                                                            </div>
                                                            <div >
                                                                <Col span={4} push={3}>{languageObj.SkinTestOnGoingUsage != null ? languageObj.SkinTestOnGoingUsage.descripts : "" + item.ordUsageDesc}</Col>
                                                                <Col span={6} push={3}>{item.ordQty + " " + item.ordQtyUomDesc}</Col>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </List.Item>)
                                        }
                                    />
                                </div>
                            </div>
                        </div>
                    </div >

                </div >
            </div >
        )
    }
}
const SkinTestFrom = Form.create()(SkinTest);
export default SkinTestFrom; 