/*
 * Creator:     HLH
 * CreatDate:   2020-07-13
 * descripts：  疗程配置维护页面
 * */
import React from 'react';
import { Select, Row, Col, Button, Spin, Divider, Popconfirm, DatePicker, Icon, Input, Table, Modal, message, Form } from 'antd';
import { $http } from '../../../containers/config/https';
import store from 'store';
import moment from 'moment';
import 'assets/css/common.css';
import DecoctingOrderModal from "../../orderdiatemplet/component/DecoctingOrderModal"
import CommonPagination from 'components/pagination';
import ColumnAuthoritysModel from 'pages/columnAuthority/ColumnAuthoritysModel';

const FormItem = Form.Item;
const paddRightCol = {
    paddingRight: "0px"
}
const formItemLayout = {
    labelCol: { span: 8 },
    wrapperCol: { span: 16 },
}

// 组件const
const { Option } = Select;
let user = window.sessionStorage.userData ? JSON.parse(window.sessionStorage.userData) : {};
const TreatmentItems = Form.create()(
    class TreatmentItems extends React.Component {
        constructor(props) {
            var userData = JSON.parse(sessionStorage.getItem('userData'));
            super(props);
            this.state = {
                userData: userData,
                // 医嘱项目
                medItemID: '',
                medItemDesc: undefined,
                //所属医院
                hospID: '',
                //就诊类型id
                admTypeID: undefined,
                //医嘱优先级
                priorityID: undefined,
                //医嘱大类
                orderCatID: undefined,
                //医嘱子类
                orderSubCatID: undefined,
                ID: undefined,
                // 表格数据
                tableData: [],
                // 表格数据总条数
                total: 0,
                page: 1,
                pageSize: 10,
                size: "small",
                search: "",
                visible: false,
                num: -1,
                params: {},
                columns: [],
                localeProvider: [],
                medValue: ""
            };

        }
        componentDidMount() {
            // 初始化列表数据
            this.handleQuery();
            this.getHopSelect();
            this.getmedItemSelect();
            this.getAdmTypeSelect();
            this.getControlLevelSelect();
            this.getOrderPrioritySelect();
            this.getOrderCatSelect();
            this.getOrderSubCatSelect();
            document.querySelector(".table-body-height .ant-table-body").style.height = store.getState().tableHeight.y + 100 + 'px';
            document.querySelector(".table-body-height .ant-table-body").style.maxHeight = store.getState().tableHeight.y + 100 + 'px';
            this.getMainTableColumns();
        }
        // 查询
        handleQuery = () => {
            this.setState({ page: 1, pageSize: this.state.pageSize }, () => {
                let { medItemID, hospID, admTypeID, priorityID, orderCatID, orderSubCatID } = this.state;
                this.getTableData(medItemID, hospID, admTypeID, priorityID, orderCatID, orderSubCatID)
            })
        }
        // 请求列表数据
        getTableData(medItemID, hospID, admTypeID, priorityID, orderCatID, orderSubCatID) {
            let { page, pageSize } = this.state
            let data = {
                params: [{
                    hospID: hospID,
                    admTypeID: admTypeID,
                    medItemID: medItemID,
                    priorityID: priorityID,
                    orderCatID: orderCatID,
                    orderSubCatID: orderSubCatID
                }],
                pagination: [{
                    pageSize: pageSize,
                    currentPage: page
                }]
            }
            $http.post('urlS', this, {
                code: "01040215",
                data: data,
                success: function (res) {
                    if (res.errorCode == 0) {
                        this.setState({ tableData: res.result.data, total: res.result.totalCount })
                    } else {
                        this.setState({ tableData: [], total: 0 })
                    }
                },
                error: function (error) {
                    this.setState({
                        tableData: [], total: 0
                    })
                }
            })
        }
        // 改变医院值
        onChangehospitalId = (e) => {
            this.setState({ hospID: e });
        }
        // 改变医嘱项值
        onChangemedItemDesc = (e) => {
            this.setState({ medItemDesc: e.target.value })
        }
        //控制模态框显示
        closeModal = (bool) => {
            this.setState({ visible: bool, });
        }
        //删除 
        toggleEditable = (record) => {
            let datas = {}
            datas = {
                params: [{
                    updateUserID: JSON.parse(sessionStorage.userData).userID || '',
                    ID: record.ID,
                }],
            }
            $http.post('urlS', this, {
                code: '01040217',
                data: datas,
                success: function (res) {
                    if (res.errorCode == 0) {
                        message.success("删除成功");
                        this.handleQuery()
                    }
                }
            })
        }
        //更新
        handleCompile = (num, record) => {
            this.props.form.resetFields();
            this.setState({
                num: num,
                params: num == "1" ? record : "",
                visible: true
            })

        }
        //获取医院下拉框
        getHopSelect = () => {
            let data = {
                params: [{
                    //   hospID:sessionStorage.userData ? JSON.parse(sessionStorage.userData).hospID:"",
                    logonGroupID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).groupID : "",
                    logonHospID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).hospID : "",
                }],
            }
            $http.post('urlS', this, {
                code: '01040001',
                data: data,
                success: function (res) {
                    if (res.errorCode == 0) {
                        this.setState({
                            hospArr: res.result
                        })
                    }
                }
            })
        }
        //获取医嘱项下拉框04150017
        getmedItemSelect = () => {
            let data = {
                params: [{
                    hospID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).hospID : "",
                    inputValue: ""
                }],
            }
            $http.post('urlS', this, {
                code: '04150017',
                data: data,
                success: function (res) {
                    if (res.errorCode == 0) {
                        this.setState({
                            medItemArr: res.result.data
                        })
                    }
                }
            })
        }
        //获取就诊类型下拉框
        getAdmTypeSelect = () => {
            let data = {}
            $http.post('urlS', this, {
                code: '03050088',
                data: data,
                success: function (res) {
                    if (res.errorCode == 0) {
                        this.setState({
                            admTypeArr: res.result.Data
                        })
                    }
                }
            })
        }
        //获取医嘱优先级下拉框
        getOrderPrioritySelect = () => {
            let data = {
                params: [{
                    language: 'EN'
                }],
            }
            $http.post('urlS', this, {
                code: '03060028',
                data: data,
                success: function (res) {
                    if (res.errorCode == 0) {
                        this.setState({
                            orderPriorityArr: res.result
                        })
                    }
                }
            })
        }
        //获取控制级别下拉框
        getControlLevelSelect = () => {
            let data = {}
            $http.post('urlS', this, {
                code: '01040218',
                data: data,
                success: function (res) {
                    if (res.errorCode == 0) {
                        this.setState({
                            controlLeveleArr: res.data

                        })
                        console.log(controlLeveleArr)
                    }
                }
            })
        }
        //获取医嘱大类下拉框
        getOrderCatSelect = () => {
            let data = {}
            $http.post('urlS', this, {
                code: '05100228',
                data: data,
                success: function (res) {
                    if (res.errorCode == 0) {
                        this.setState({
                            orderCatArr: res.result.Data

                        })
                       
                    }
                }
            })
        }

        //获取医嘱子类下拉框
        getOrderSubCatSelect = (e) => {
            let data = {}

            $http.post('urlS', this, {
                code: '05100173',
                data: data,
                success: function (res) {
                    if (res.errorCode == 0) {
                        this.setState({
                            orderSubCatArr: res.data

                        })
                    }
                }
            })
        }
        // 大类切换
        hospDrChange = (e) => {
            this.setState({
                orderCatID: e, //  大类ID
                orderSubCatID: '', //清空子类
            })
        }
        // 子类切换
        locIdChange = (e) => {
            this.setState({
                orderSubCatID: e, //  子类ID
                orderCatID: '', //  清空大类
            })
        }

        save = () => {
            this.props.form.validateFields((err, values) => {
                const { params } = this.state
                if (!err) {
                    let medItemID = this.state && this.state.medItemID ? this.state.medItemID : params.medItemID
                    let data = {
                        params: [{
                            ID: params && params.ID ? params.ID : "",
                            hospID: values && values.hospID ? values.hospID : "",
                            medItemID: medItemID,
                            admTypeID: values && values.admTypeID ? values.admTypeID : "",
                            controlLevelID: values && values.controlLevelID ? values.controlLevelID : "",
                            durQty: values.durQty || "",
                            message: values.message || "",
                            controlField: values.controlField || "",
                            startDate: values.startDate ? moment(values.startDate).format('YYYY-MM-DD') : undefined,
                            stopDate: values.stopDate ? moment(values.stopDate).format('YYYY-MM-DD') : '',
                            userID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).userID : ""
                        }]
                    }
                    $http.post("urlS", this, {
                        code: "01040216",
                        data: data,
                        success: function (res) {
                            if (res.errorCode == 0) {
                                // console.log(params)
                                if (params && params.ID) {
                                    message.success("修改成功")
                                    this.setState({
                                        medItemID: "",
                                        medValue: ""
                                    })
                                    this.handleQuery();
                                    this.closeModal(false)
                                } else {
                                    message.success("新增成功")
                                    this.setState({
                                        medItemID: "",
                                        medValue: ""
                                    })
                                    this.handleQuery();
                                    this.closeModal(false)
                                }
                            } else {
                                message.error('失败：' + res.errorMessage);
                            }

                        },
                        error: function (error) {
                            message.error('失败：' + error);
                        }
                    })

                } else {
                }
            })
        }
        //子组件 搜索医嘱项
        OnChildrefs = (ref) => {
            this.child = ref
            console.log(ref)
        }
        //接收子组件 医嘱项id 描述
        handleParms = (record) => {
            console.log(record)
            this.props.form.setFieldsValue({ medItemDr: record.descripts })

            this.setState({
                medItemID: record.id,
                medValue: record.descripts
            })
            console.log(this.state.medItemID)
        }
        //搜索医嘱项
        handleOrderItem = () => {
            // console.log("this.props.form.getFieldValue('orderItem')",this.props.form.getFieldValue("orderItem"))
            if (this.state.medValue && this.state.medValue.length == 0) {
                message.warning("请输入医嘱项名称")
            } else {
                //调起
                this.child.showModal(this.state.medValue)
            }
        }
        //清空医嘱项
        handleValue = (e) => {
            if (e) {
                if (e.target.value.length == 0) {
                    this.setState({
                        medItemID: "",
                        medValue: ""
                    })
                } else {
                    this.setState({
                        medValue: e.target.value
                    })
                }
            }
        }
        // 修改page和pageSize 跳转至---
        onChange = (e) => {
            this.setState({ page: e, pageSize: this.state.pageSize, }, () => {
                // 重新调用查询方法
                let { medItemID, hospID, admTypeID, priorityID, orderCatID, orderSubCatID } = this.state;
                this.getTableData(medItemID, hospID, admTypeID, priorityID, orderCatID, orderSubCatID);
            })
        }
        //下拉选择页数
        onShowSizeChange = (page, pageSize) => {
            // console.log("page",page,"pagesize",pageSize)
            this.setState({ page: 1, pageSize: pageSize, search: "search" }, () => {
                // 重新调用查询方法
                let { medItemID, hospID, admTypeID, priorityID, orderCatID, orderSubCatID } = this.state;
                this.getTableData(medItemID, hospID, admTypeID, priorityID, orderCatID, orderSubCatID);
            })
        }
        // 显示分页总条数
        showTotal(total) {
            return `共 ${total} 条`;
        }
        handleSelectChange = (e) => {
            this.setState({
                hospID: e
            })
        }
        handleSelectAdmTypeChange = (e) => {
            this.setState({
                admTypeID: e
            })
        }
        handleSelectPriorityChange = (e) => {
            this.setState({
                priorityID: e,
            })
        }
        //动态表头
        onColumnRef = (ref) => {
            this.columnRef = ref;
        }
        //国际化
        setMessage(name, message) {
            return this.state.localeProvider ? this.state.localeProvider[name][message] : ''
        }
        // 获取主列表columns
        getMainTableColumns = () => {
            let data = {
                params: [{
                    compontName: "TreatmentConfigurationInformat",
                    reactCode: ['TreatmentConfigurationInformat'],
                    type: 'C',
                }]
            }
            $http.post('urlS', this, {
                code: '01040073',
                data: data,
                success: function (res) {
                    if (+res.errorCode === 0) {
                        let arr = res.result && res.result.C.length > 0 ? JSON.parse(JSON.stringify(res.result.C)).map(item => {
                            return {
                                align: item.align,
                                widthNum: parseInt(item.width),
                                width: item.width,
                                dataIndex: item.dataIndex,
                                title: <div onDoubleClick={() => this.columnRef.onOpenModel()}>{this.state.userData.language == 'EN' ? item.enDescripts : item.title}</div>,
                                display: item.display,
                                key: item.seqNo,
                            }
                        }) : '';
                        let filterArr = arr.filter(function (item) { return item.display === 'Y' });
                        this.setState({
                            columns: filterArr, widthTotal: res.totalWidth, localeProvider: this.state.userData.language == 'EN' ? res.result.language.EN : res.result.language.CN
                        })
                        let seqArr = {
                            align: "center",
                            widthNum: 140,
                            width: "150px",
                            code: "edit",
                            dataIndex: "edit",
                            title: this.state.localeProvider && this.state.localeProvider.MaintenanceOfTreatmentItemOperating ? this.setMessage('MaintenanceOfTreatmentItemOperating', 'descripts') : "操作",
                            display: "Y",
                            render: (value, row, index) => {
                                return (
                                    <span>
                                        <span className='span' onClick={() => this.handleCompile("1", row)}>{this.state.localeProvider && this.state.localeProvider.MaintenanceOfTreatmentItemEdit ? this.setMessage('MaintenanceOfTreatmentItemEdit', 'descripts') : "编辑"}</span>
                                        <Divider type="vertical" />
                                        <Popconfirm title="是否要删除此行" onConfirm={() => this.toggleEditable(row)}>
                                            <a style={{ color: "red" }} >{this.state.localeProvider && this.state.localeProvider.MaintenanceOfTreatmentItemDelete ? this.setMessage('MaintenanceOfTreatmentItemDelete', 'descripts') : "删除"}</a>
                                        </Popconfirm>
                                    </span>
                                )
                            },
                        }
                        filterArr.push(seqArr)
                        this.setState({ columns: filterArr, widthTotal: res.totalWidth })
                        // console.log("res.totalWidth",res.totalWidth)
                    }
                }
            })
        }
        render() {
            // 组件所需参数
            const param = {
                // 表格数据
                data: this.state.tableData,
                // 数据总条数
                total: this.state.total,
                // 当前页数
                page: this.state.page,
            }
            const { getFieldDecorator } = this.props.form;
            const { params, columns } = this.state
            //医院
            let hosOp = []
            this.state.hospArr && this.state.hospArr.map((item) => {
                hosOp.push(<Option key={item.id} value={String(item.id)}>{item.descripts}</Option>)
            })
            //医嘱项
            let medItemOp = []
            this.state.medItemArr && this.state.medItemArr.map((item) => {
                medItemOp.push(<Option key={item.id} value={String(item.id)}>{item.descripts}</Option>)
            })
            //就诊类型
            let admTypeOp = []
            this.state.admTypeArr && this.state.admTypeArr.map((item) => {
                admTypeOp.push(<Option key={item.admTypeID} value={String(item.admTypeID)}>{item.admDesc}</Option>)
            })
            //医嘱优先级
            let orderPriorityOp = []
            this.state.orderPriorityArr && this.state.orderPriorityArr.map((item) => {
                orderPriorityOp.push(<Option key={item.id} value={String(item.id)}>{item.descripts}</Option>)
            })
            //控制级别
            let controlLeveleOp = []
            this.state.controlLeveleArr && this.state.controlLeveleArr.map((item) => {
                controlLeveleOp.push(<Option key={item.id} value={String(item.id)}>{item.descripts}</Option>)
            })
            return (
                <div>
                    <div className="department-header">
                        <Row style={{ minHeight: '64px', padding: '0 24px' }}>
                            <Col span={22}>
                                {this.state.localeProvider && this.state.localeProvider.TreatmentConfigurationInformathospDesc ? this.setMessage('TreatmentConfigurationInformathospDesc', 'descripts') : "医院："}
                                <Select
                                    onChange={this.handleSelectChange}
                                    showSearch
                                    allowClear
                                    filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}
                                    style={{ width: '130px', margin: '23px 8px 0 5px' }} placeholder="请选择医院">
                                    {hosOp}
                                </Select>
                                {this.state.localeProvider && this.state.localeProvider.TreatmentConfigurationInformathospDesc ? this.setMessage('TreatmentConfigurationInformathospDesc', 'descripts') : "就诊类型："}
                                <Select
                                    onChange={this.handleSelectAdmTypeChange}
                                    allowClear
                                    style={{ width: '130px', margin: '23px 8px 0 5px' }} placeholder="请选择就诊类型">
                                    {admTypeOp}
                                </Select>
                                {this.state.localeProvider && this.state.localeProvider.TreatmentConfigurationInformatHospital ? this.setMessage('TreatmentConfigurationInformat', 'descripts') : "医嘱优先级："}
                                <Select
                                    onChange={this.handleSelectPriorityChange}
                                    allowClear
                                    style={{ width: '130px', margin: '23px 8px 0 5px' }} placeholder="请选择医嘱优先级">
                                    {orderPriorityOp}
                                </Select>
                                {this.state.localeProvider && this.state.localeProvider.TreatmentConfigurationInformatHospital ? this.setMessage('TreatmentConfigurationInformat', 'descripts') : "医嘱大类："}
                                <Select showSearch allowClear optionFilterProp="title1" onChange={(event) => { this.hospDrChange(event) }} style={{ width: '130px', margin: '23px 8px 0 5px' }} placeholder="请选择医嘱大类" value={this.state.orderCatID} >
                                    {this.state.orderCatArr && this.state.orderCatArr.map((item) => <Option title={item.descripts} title1={item.descripts + '^' + item.descriptsSPCode} key={item.id} value={item.id}  >{item.descripts}</Option>)}
                                </Select>
                                {this.state.localeProvider && this.state.localeProvider.TreatmentConfigurationInformatHospital ? this.setMessage('TreatmentConfigurationInformat', 'descripts') : "医嘱子类："}
                                <Select showSearch allowClear placeholder="请选择医嘱子类" value={this.state.orderSubCatID} onChange={(event) => { this.locIdChange(event) }} style={{ width: '130px', margin: '23px 8px 0 5px' }} optionFilterProp="title1" >
                                    {this.state.orderSubCatArr && this.state.orderSubCatArr.map((item) => <Option title={item.descripts} title1={item.descripts + '^' + item.descriptsSPCode} key={item.id} value={item.id}  >{item.descripts}</Option>)}
                                </Select>
                                {this.state.localeProvider && this.state.localeProvider.MaintenanceOfTreatmentItemMedicalOrderItem ? this.setMessage('MaintenanceOfTreatmentItemMedicalOrderItem', 'descripts') : "医嘱项目："}
                                <Input
                                    placeholder="输入内容回车检索"
                                    onChange={this.handleValue}
                                    onPressEnter={this.handleOrderItem}
                                    value={this.state.medValue}
                                    style={{ width: '130px', margin: '23px 8px 0 12px' }}>
                                </Input>
                                <Button onClick={this.handleQuery} style={{ margin: '23px 15px 20px 0', background: 'rgba(255,255,255,1)' }}>{this.state.localeProvider && this.state.localeProvider.MaintenanceOfTreatmentItemInquire ? this.setMessage('MaintenanceOfTreatmentItemInquire', 'descripts') : "查询"}</Button>
                            </Col>
                            <Col span={2} style={{ textAlign: 'right' }}>
                                <Button icon="plus" onClick={() => this.handleCompile()} style={{ background: 'rgba(247,128,93,1)', color: '#fff', margin: '23px 15px 0 0' }}>{this.state.localeProvider && this.state.localeProvider.MaintenanceOfTreatmentItemAdd ? this.setMessage('MaintenanceOfTreatmentItemAdd', 'descripts') : "新增"}</Button>
                            </Col>
                        </Row>
                    </div>
                    <div style={{ widht: '100%', height: '10px', background: '#f0f2f5' }}></div>
                    <div style={{ padding: 24 }} className="table-body-height">
                        <Table
                            columns={columns}
                            dataSource={param.data}
                            pagination={false}
                            bordered
                            style={{ height: store.getState().tableHeight.y + 68 + 'px', overflow: "auto" }}
                        />
                        <CommonPagination size={this.state.size} page={this.state.page} current={this.state.page} total={this.state.total} search={this.state.search}
                            onShowSizeChange={this.onShowSizeChange.bind(this)} complete={true} dataSource={param.data}
                            onChange={this.onChange.bind(this)} />
                        <ColumnAuthoritysModel
                            clientWidth='800px'
                            compontName='MaintenanceOfTreatmentItem'
                            configType="C"
                            onRef={this.onColumnRef}
                            reloadData={this.getMainTableColumns}
                        />
                        <Modal
                            title={this.state.num == "1" ? "编辑疗程配置维护" : "新增疗程配置维护"}
                            visible={this.state.visible}
                            onOk={() => this.closeModal(false)}
                            onCancel={() => this.closeModal(false)}
                            width={1200}
                            footer={[
                                <Button key="submit" type="primary" loading={this.setState.loading} disabled={this.state.rowId == ""} onClick={this.save}>{this.state.localeProvider && this.state.localeProvider.MaintenanceOfTreatmentItemDetermine ? this.setMessage('MaintenanceOfTreatmentItemDetermine', 'descripts') : "确定"}</Button>,
                                <Button key="cancel" type="primary" loading={this.setState.loading} onClick={() => this.closeModal(false)}>{this.state.localeProvider && this.state.localeProvider.MaintenanceOfTreatmentItemCancel ? this.setMessage('MaintenanceOfTreatmentItemCancel', 'descripts') : "取消"}</Button>,
                            ]}
                        >
                            <div className="department-header">
                                <Form>
                                    <Row gutter={60} style={{ margin: '0' }}>
                                        <Col span={8} style={paddRightCol}>
                                            <FormItem {...formItemLayout} label={this.state.localeProvider && this.state.localeProvider.MaintenanceOfTreatmentItemTreatmentItemDescription ? this.setMessage('MaintenanceOfTreatmentItemTreatmentItemDescription', 'descripts') : "疗程天数："}>
                                                {getFieldDecorator('durQty', {
                                                    initialValue: params && params.durQty ? params.durQty : undefined,
                                                    rules: [{ required: true, message: '请输入疗程天数' }],
                                                })(
                                                    <Input></Input>
                                                )}
                                            </FormItem>
                                        </Col>
                                        <Col span={8} style={paddRightCol}>
                                            <FormItem {...formItemLayout} label={this.state.localeProvider && this.state.localeProvider.MaintenanceOfTreatmentItemProjectIntroduction ? this.setMessage('MaintenanceOfTreatmentItemProjectIntroduction', 'descripts') : "提示信息："}>
                                                {getFieldDecorator('message', {
                                                    initialValue: params && params.message ? params.message : undefined,
                                                    rules: [{ required: true, message: '请输入提示信息' }],
                                                })(
                                                    <Input></Input>
                                                )}
                                            </FormItem>
                                        </Col>
                                        <Col span={8} style={paddRightCol}>
                                            <FormItem {...formItemLayout} label={this.state.localeProvider && this.state.localeProvider.MaintenanceOfTreatmentItemTimeMinutes ? this.setMessage('MaintenanceOfTreatmentItemTimeMinutes', 'descripts') : "控制字段："}>
                                                {getFieldDecorator('controlField', {
                                                    initialValue: params && params.controlField ? params.controlField : undefined,
                                                    rules: [{ required: true, message: '请输入控制字段' }],
                                                })(
                                                    <Input></Input>
                                                )}
                                            </FormItem>
                                        </Col>
                                        <Col span={8} style={paddRightCol}>
                                            <FormItem label={this.state.localeProvider && this.state.localeProvider.MaintenanceOfTreatmentItemEffectiveDate ? this.setMessage('MaintenanceOfTreatmentItemEffectiveDate', 'descripts') : "生效日期："} {...formItemLayout}>
                                                {getFieldDecorator('startDate', {
                                                    initialValue: params && params.startDate ? moment(params.startDate, "YYYY-MM-DD") : moment(),
                                                    rules: [{ required: true, message: '请选择生效日期' }],
                                                })(
                                                    <DatePicker style={{ width: '100%' }} disabledDate={(curDate) => {
                                                        return curDate && curDate > moment().endOf('day');
                                                    }} />
                                                )}
                                            </FormItem>
                                        </Col>
                                        <Col span={8} style={paddRightCol}>
                                            <FormItem label={this.state.localeProvider && this.state.localeProvider.MaintenanceOfTreatmentItemExpirationDate ? this.setMessage('MaintenanceOfTreatmentItemExpirationDate', 'descripts') : "失效日期："} {...formItemLayout}>
                                                {getFieldDecorator('stopDate', {
                                                    initialValue: params && params.stopDate ? moment(params.stopDate, "YYYY-MM-DD") : undefined,
                                                })(
                                                    <DatePicker style={{ width: '100%' }} />
                                                )}
                                            </FormItem>
                                        </Col>
                                        <Col span={8} style={paddRightCol}>
                                            <Form.Item  {...formItemLayout} label={this.state.localeProvider && this.state.localeProvider.MaintenanceOfTreatmentItemHospital ? this.setMessage('MaintenanceOfTreatmentItemHospital', 'descripts') : "医院："}>
                                                {getFieldDecorator('hospID', {
                                                    initialValue: params && params.hospID ? params.hospID : undefined,
                                                    rules: [{ required: true, message: '请选择医院' }],
                                                })(
                                                    <Select
                                                        placeholder="请选择"
                                                        onSelect={this.handleStatus}
                                                    >
                                                        {hosOp}
                                                    </Select>
                                                )}
                                            </Form.Item>
                                        </Col>
                                        <Col span={8} style={paddRightCol}>
                                            <FormItem {...formItemLayout} label={this.state.localeProvider && this.state.localeProvider.MaintenanceOfTreatmentItemMedicalOrder ? this.setMessage('MaintenanceOfTreatmentItemMedicalOrder', 'descripts') : "医嘱项："}>
                                                {getFieldDecorator('medItemDr', {
                                                    initialValue: params && params.medItemDesc ? params.medItemDesc : undefined,
                                                    rules: [{ required: true, message: '请输入检索医嘱项' }],
                                                })(
                                                    <Input placeholder="输入内容回车检索" onChange={this.handleValue} onPressEnter={this.handleOrderItem}></Input>
                                                )}
                                            </FormItem>
                                        </Col>
                                        <Col span={8} style={paddRightCol}>
                                            <Form.Item  {...formItemLayout} label={this.state.localeProvider && this.state.localeProvider.MaintenanceOfTreatmentItemServiceGroup ? this.setMessage('MaintenanceOfTreatmentItemServiceGroup', 'descripts') : "就诊类型："}>
                                                {getFieldDecorator('admTypeID', {
                                                    initialValue: params && params.admTypeID ? params.admTypeID : undefined,
                                                })(
                                                    <Select
                                                        placeholder="请选择"
                                                        onSelect={this.handleStatus}
                                                    >
                                                        {admTypeOp}
                                                    </Select>,
                                                )}
                                            </Form.Item>
                                        </Col>
                                        <Col span={8} style={paddRightCol}>
                                            <Form.Item  {...formItemLayout} label={this.state.localeProvider && this.state.localeProvider.MaintenanceOfTreatmentItemServiceGroup ? this.setMessage('MaintenanceOfTreatmentItemServiceGroup', 'descripts') : "控制级别："}>
                                                {getFieldDecorator('controlLevelID', {
                                                    initialValue: params && params.controlLevelID ? params.controlLevelID : undefined,
                                                    rules: [{ required: true, message: '请输入控制级别' }],
                                                })(
                                                    <Select
                                                        placeholder="请选择"
                                                        onSelect={this.handleStatus}
                                                    >
                                                        {controlLeveleOp}
                                                    </Select>,
                                                )}
                                            </Form.Item>
                                        </Col>
                                    </Row>
                                </Form>

                            </div>
                        </Modal>
                    </div>
                    <DecoctingOrderModal OnChildrefs={this.OnChildrefs} handleParms={this.handleParms}></DecoctingOrderModal>
                </div>
            );
        }
    })
export default TreatmentItems;
