/*
 * Creator:     ML
 * CreatDate:   2019-12-26
 * descripts：  治疗室--治疗内容
 * */
import React from 'react';
import { Form, Row, Col, Input, Select, Button, DatePicker, TimePicker, Popconfirm, Modal, Table, Icon, Pagination, message,Checkbox , Divider, Tooltip, } from 'antd';
import { $http } from 'containers/config/https';
import store from 'store';
import moment from 'moment';
import '../style/index.less'
import { Util, dayFormat } from 'tools/index';
const FormItem = Form.Item;
const Option = Select.Option;
const { TextArea } = Input;
const paddRightCol = {
    paddingRight: "0px"
}
const formItemInput = {
    labelCol: {
        span: 8
    },
    wrapperCol: {
        span: 16
    },
};
const formItemInputB = {
    labelCol: {
        span: 12
    },
    wrapperCol: {
        span: 12
    },
};
const formItemLayoutCenter = {
    labelCol: { span: 2 },
    wrapperCol: { span: 24 },
}
const formItemLayoutDataForm = {
    labelCol: { span: 9 },
    wrapperCol: { span: 14 },
}
const TreatmentContent = Form.create()(
    class TreatmentContent extends React.Component {
        constructor(props) {
            super(props)
            this.state = {
                isTransitionStart: false, // 起始时间
                isTransitionStop: false, // 结束时间
                startTime: "",
                stopTime: "",
                dateF: "",
                dateT: "",
                bsDoor:false,
                editField:[{
                    dynamic:"N"
                }]

            }
        }
        componentDidMount() {
            this.props.onContent(this)
        }
        //数据重置
        initialForm=()=>{
            this.props.form.resetFields()
            this.setState({
                editField: [],
                record: {},
                dateF:"",
                dateT:"", 
                startTime:"", 
                stopTime:"",
                timeTotal:""
            })
        }
        //录入治疗单 获取动态内容小组件 动态项目模板
        getContent = () => {
            let data = {}
            data = {
                params: [{
                    cureAppID: this.props.cureAppID && this.props.cureAppID || "",
                }],
            }
            $http.post('urlS', this, {
                code: '01040166',
                data: data,
                success: function (res) {
                    if (+res.errorCode === 0) {
                        this.setState({
                            editField: res.result.data,
                        })
                        if(res.result.data&&res.result.data.length>0){
                            this.setState({
                                bsDoor:true
                            })
                        }else{
                            this.setState({
                                bsDoor:false
                            }) 
                        }
                    } else {

                    }
                }
            })
        }
        //历史治疗单内容
        getHisContent = (recordID) => {
            this.setState({
                // record,
            })
            let data = {}
            data = {
                params: [{
                    ID: recordID || "",
                }],
            }
            $http.post('urlS', this, {
                code: '01040170',
                data: data,
                success: function (res) {
                    if (+res.errorCode === 0) {
                        this.props.form.resetFields();
                        this.setState({
                            editField: res.result.dataArr,
                            record: res.result.dataArr[0],
                            timeTotal:"",
                            dateF:res.result.dataArr[0].startDate,
                            dateT:res.result.dataArr[0].endDate,
                            startTime:res.result.dataArr[0].startTime,
                            stopTime:res.result.dataArr[0].endTime,
                        },()=>{
                            this.autoTime(
                            this.state.record.startDate,
                            this.state.record.endDate,
                            this.state.record.startTime,
                            this.state.record.endTime)
                        })
                    } else {

                    }
                }
            })
        }
        //展开/关闭起始时间
        handleOnOpenChangeStart = (status) => {
            if (!status) {
                this.setState({ isTransitionStart: true })
            } else {
                this.setState({ isTransitionStart: false })
            }
        }
        //展开/关闭截止时间
        handleOnOpenChangeStop = (status) => {
            if (!status) {
                this.setState({ isTransitionStop: true })
            } else {
                this.setState({ isTransitionStop: false })
            }
        }
        //选择日期面板
        onPanelChange2 = (v, n, format, cb) => {
            let mon = moment(v).format(format)
            let obj = {
                "1": () => this.setState({ dateF: mon, }, cb),
                "2": () => this.setState({ dateT: mon, }, cb),
                "3": () => this.setState({ startTime: mon, }, cb),
                "4": () => this.setState({ stopTime: mon }, cb)
            }
            if (obj[n]) obj[n]();
        }
        onPanelChange = (v, n, format) => {
            this.onPanelChange2(v, n, format, () => {
                this.autoTime(this.state.dateF, this.state.dateT, this.state.startTime, this.state.stopTime);
            })
        }
        autoTime = (df, dt, tf, tt) => {
            let data = {}
            data = {
                params: [{
                    StartDate: df || "",
                    EndDate: dt || "",
                    StartTime: tf || "",
                    EndTime: tt || ""
                }],
            }
            $http.post('urlS', this, {
                code: '01040179',
                data: data,
                success: function (res) {
                    if (+res.errorCode === 0) {
                        this.setState({
                            timeTotal: res.dateTime
                        })
                    } else {
                        if(+res.errorCode===1){
                            this.props.form.setFieldsValue({dateTo:undefined})
                            let obj = {...this.state.record}
                            obj["dateTime"]=""
                            this.setState({
                                timeTotal:"",
                                record:obj
                            })
                        }
                        if(+res.errorCode===2){
                            this.props.form.setFieldsValue({locStopTime:undefined})
                            let obj = {...this.state.record}
                            obj["dateTime"]=""
                            this.setState({
                                timeTotal:"",
                                record:obj
                            })
                        } 
                    }
                },
       error:function(){
       }
            })
        }
        saveTreat = () => {
            this.props.form.validateFields((err, values) => {
                if (!err) {
                    if ((values.dateFrom && values.dateFrom) && (values.dateTo && values.dateTo)) {
                        if (moment(values.dateFrom).format('YYYYMMDD') > moment(values.dateTo).format('YYYYMMDD')) {
                            this.setState({
                                starNoVisible: true,
                                startNoMessage: "开始日期大于结束日期",
                            }, () => {
                                setTimeout(() => {
                                    this.visibleTip()
                                }, 1500)
                            })
                            return
                        } else {
                            this.setState({
                                values,
                            }, () => {
                                this.handleBaseAdd()
                            })
                        }
                    }
                }
            })
        }
        handlePrint = () => {
            message.success("暂未开放")
        }
        handleBaseAdd = () => {
           const {editField} =this.state
            //判断是否有治疗记录
            if (this.props.rowIds && this.props.rowIds) {
                //修改
                    let toData = this.props.records
            const { values, record } = this.state
            let data = {}
            data = {
                params: [{
                    ID: this.props.rowIds && this.props.rowIds ? this.props.rowIds : "",
                    updateUserID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).userID : "",
                    cureAppID: toData.cureAppID,
                    appointmentID: this.props.appointmentID && this.props.appointmentID ? this.props.appointmentID : toData.bookScheduleID,
                    note: values.note || "",
                    curePlan: values.curePlan || "",
                    startDate: values.dateFrom ? moment(values.dateFrom).format('YYYY-MM-DD') : undefined,//开始日期
                    endDate: values.dateTo ? moment(values.dateTo).format('YYYY-MM-DD') : undefined,//截止日期
                    startTime: values.locStartTime ? moment(values.locStartTime).format('HH:mm') : '',//开始时间
                    endTime: values.locStopTime ? moment(values.locStopTime).format('HH:mm') : '',//截止时间
                    orderDetailID: toData.ordDetailID,
                }],
            }
            $http.post('urlS', this, {
                code: '01040167',
                data: data,
                success: function (res) {
                    if (+res.errorCode === 0) {
                        if(editField&&editField&&editField[0].dynamic=="Y"){
                            this.handleEdit()
                        }else{
                            message.success("修改成功")
                            this.props.handleCancel()
                        }
                        
                    } else {
                            message.danger("修改失败")
                    }
                }
            })
               
            } else {
                //录入
                this.handleAdd()
            }
        }
        //录入
        handleAdd = () => {
            const { editField,values, record  } = this.state
            let arr = []
            let toData = this.props.records
        if(editField&&editField.length>0){
           editField && editField.map((item, i) => {
                let obj = {
                    updateUserID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).userID : "",
                    cureAppID: toData&&toData.cureAppID||"",
                    appointmentID: this.props.appointmentID && this.props.appointmentID ? this.props.appointmentID : toData.bookScheduleID,
                    note: values&&values.note || "",
                    curePlan: values&&values.curePlan || "",
                    startDate: values&&values.dateFrom ? moment(values.dateFrom).format('YYYY-MM-DD') : undefined,//开始日期
                    endDate: values&&values.dateTo ? moment(values.dateTo).format('YYYY-MM-DD') : undefined,//截止日期
                    startTime: values&&values.locStartTime ? moment(values.locStartTime).format('HH:mm') : '',//开始时间
                    endTime: values&&values.locStopTime ? moment(values.locStopTime).format('HH:mm') : '',//截止时间
                    orderDetailID: toData&&toData.ordDetailID||"",
                    evaluationID: item.ID, //治疗项目评估单ID
                    value: "",
                }
                obj["value"] = this.props.form.getFieldValue(item.ID)
                arr.push(obj)
            })  
        }else{
            //评估单模板为空的情况
            let obj = {
                updateUserID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).userID : "",
                cureAppID: toData&&toData.cureAppID||"",
                appointmentID: this.props.appointmentID && this.props.appointmentID ? this.props.appointmentID : toData.bookScheduleID,
                note: values&&values.note || "",
                curePlan: values&&values.curePlan || "",
                startDate: values&&values.dateFrom ? moment(values.dateFrom).format('YYYY-MM-DD') : undefined,//开始日期
                endDate: values&&values.dateTo ? moment(values.dateTo).format('YYYY-MM-DD') : undefined,//截止日期
                startTime: values&&values.locStartTime ? moment(values.locStartTime).format('HH:mm') : '',//开始时间
                endTime: values&&values.locStopTime ? moment(values.locStopTime).format('HH:mm') : '',//截止时间
                orderDetailID: toData&&toData.ordDetailID||"",
                evaluationID: "", //治疗项目评估单ID
                value: "",
            }
            arr.push(obj)
        }
           
            let data = {}
            data = {
                params: arr,
            }
            $http.post('urlS', this, {
                code: '01040172',
                data: data,
                success: function (res) {
                    if (res.errorCode == '0') {
                        this.props.handleCancel()
                        // message.success("录入成功")
                        var {onSubmit} = this.props;
                        onSubmit && onSubmit(res.judge)
                    } else {
                        message.danger("录入失败")
                    }
                }
            })
        }
        //修改
        handleEdit = () => {
            const { editField, record } = this.state
            let arr = []
            editField && editField.map((item, i) => {
                let obj = {
                    ID: "",
                    FileValue: "",
                };
                obj["FileValue"] = this.props.form.getFieldValue(item.ID)
                obj["ID"] = item.ID
                arr.push(obj)
            })
            let data = {}
            data = {
                params: arr,
                updateUserID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).userID : "", updateUserID: sessionStorage.userData ? JSON.parse(sessionStorage.userData).userID : "",
            }
            $http.post('urlS', this, {
                code: '01040171',
                data: data,
                success: function (res) {
                    if (+res.errorCode === 0) {
                        message.success("修改成功")
                        this.props.handleCancel()
                    } else {
                        message.danger("修改失败")
                    }
                }
            })

        }
        //隐藏提示信息
        visibleTip = () => {
            this.setState({
                starNoVisible: false,
                locNoVisible: false
            })
        }
        getFormItem = (fieldItem, key) => {
            let { languageSize } = this.state;
            const { getFieldDecorator } = this.props.form;
            let detailInfo = this.state.detailInfo ? this.state.detailInfo : {};
            let userInfo = this.state.userInfo ? this.state.userInfo : {};
            var code = detailInfo[fieldItem.cureItemDesc] ? detailInfo[fieldItem.cureItemDesc] : userInfo[fieldItem.cureItemDesc] ? userInfo[fieldItem.cureItemDesc] : '';
            var type = fieldItem.fieldTypeCode;
            var ReadOnlyFlag = fieldItem.readOnly;
            var disabled = false;
            if (ReadOnlyFlag === "Y") disabled = true;
            if (type === "Input" || type == 'InputNumber') {
                return (
                    {
                        ...getFieldDecorator(fieldItem.ID, {
                            initialValue: fieldItem.value ? fieldItem.value : (fieldItem.defaultID?fieldItem.defaultID:undefined),
                            rules: [{
                                required:  fieldItem.evaluationRequired && fieldItem.evaluationRequired == "Y" ? true : false,
                            }
                            ],
                        })(<Input
                            type={type == 'InputNumber' ? "number" : false}
                            allowClear={!disabled}
                            disabled={disabled}
                            ref={key == 0 ? (input) => this.input = input : ''}
                            style={{ width: '100%' }}
                        // placeholder={disabled ? '' : languageSize.EnterSequenceinputTips ? (languageSize.EnterSequenceinputTips.descripts +' ' +fieldItem.desc):('请输入'+ fieldItem.desc)}
                        //     onKeyDown={(e)=>{if(!disabled){
                        //     this.FieldOnKeyDown(e,fieldItem.cureItemDesc)
                        // }}}
                        />)
                    }
                )
            } else if (type === "Radio") {
                return (
                    {
                        ...getFieldDecorator(fieldItem.ID, {
                            initialValue:  fieldItem.value ? fieldItem.value : (fieldItem.defaultID?fieldItem.defaultID:undefined),
                            valuePropName: 'checked',
                            rules: [{ required: fieldItem.evaluationRequired && fieldItem.evaluationRequired == "Y" ? true : false,}],
                            normalize: (value, prevValue) => {
                                return value
                            }
                        })(<Switch disabled={disabled} checkedChildren="是" unCheckedChildren="否" />)
                    }
                )
            }
            else if (type === "CheckBox") {
                return (
                    { 
                        ...getFieldDecorator(fieldItem.ID, {
                            initialValue:   fieldItem.value=="true" ? true : (fieldItem.defaultID?fieldItem.defaultID:false),
                            valuePropName: 'checked',
                            rules: [{ required: fieldItem.evaluationRequired && fieldItem.evaluationRequired == "Y" ? true : false, }],
                            normalize: (value, prevValue) => {
                                return value
                            }
                        })(
                            <Checkbox ></Checkbox>
                            )
                    }
                )
            }
            // else if(type==="DatePicker"){
            //     var date=""
            //     if(fieldItem.cureItemDesc==="StartDate"){
            //         date=code ? moment(code, 'YYYY-MM-DD') : moment(new Date(), 'YYYY-MM-DD')
            //     }else{
            //         date=code ? moment(code, 'YYYY-MM-DD') : null
            //     }
            //     return (
            //         {...getFieldDecorator(fieldItem.cureItemDesc, {
            //                 initialValue:date,
            //                 rules:  [{ required: fieldItem.evaluationRequired == "Y" ? true : false,message: languageSize.EnterSequencepleaseChoose ? (languageSize.EnterSequencepleaseChoose.descripts+' '+fieldItem.desc):('请选择'+fieldItem.desc)}],
            //             })(<DatePicker
            //                 style={{width: '100%'}}
            //                 disabled={disabled}
            //                 format="YYYY-MM-DD"
            //                 placeholder={disabled ? "" : languageSize.EnterSequencepleaseChoose ? (languageSize.EnterSequencepleaseChoose.descripts+' '+fieldItem.desc):('请选择'+fieldItem.desc)}
            //                 onChange={(e, dateString)=>{
            //                     if(dateString  && this.props.form.getFieldValue('stockDesc')){
            //                         this.TimeOnKeyDown(e,fieldItem.cureItemDesc,type ,dateString)
            //                     }
            //                 } }
            //             />)
            //         }
            //     )
            // }
            else if (type === "Select" || type === "SelectBox") {
                return this.GetSelectOther(fieldItem, detailInfo, type);
            } else if (type === "Text" || type === "text") {
                return (
                    {
                        ...getFieldDecorator(fieldItem.ID, {
                            initialValue: fieldItem.value ? fieldItem.value : (fieldItem.defaultID?fieldItem.defaultID:undefined),
                            rules: [{
                                required: fieldItem.evaluationRequired && fieldItem.evaluationRequired == "Y" ? true : false,
                                // message: languageSize.EnterSequenceinputTips ? (languageSize.EnterSequenceinputTips.descripts+' '+fieldItem.desc):('请输入'+fieldItem.desc)
                            }
                            ],
                            // anguageSize.EnterSequenceinputTips ? (languageSize.EnterSequenceinputTips.descripts+' '+fieldItem.desc):('请输入'+fieldItem.desc)
                        })(<TextArea rows={1} style={{ width: '100%' }}
                        // placeholder={} 
                        />
                        )
                    }
                )
            } else {
                return (
                    {
                        ...getFieldDecorator(fieldItem.ID, {
                            initialValue: fieldItem.value ? fieldItem.value : '',
                            rules: [{
                                required: fieldItem.evaluationRequired && fieldItem.evaluationRequired == "Y" ? true : false,
                                // message: languageSize.EnterSequenceinputTips ? (languageSize.EnterSequenceinputTips.descripts+' '+fieldItem.desc):('请输入'+fieldItem.desc)
                            }
                            ]
                            ,
                        })(<Input type={type == 'InputNumber' ? "number" : false}
                            disabled={disabled}
                        //  placeholder={languageSize.EnterSequenceinputTips ? (languageSize.EnterSequenceinputTips.descripts+' '+fieldItem.desc):('请输入'+fieldItem.desc)}
                        />)
                    }
                )
            }
        }
        getDefalut=(fieldItem)=>{
           
        }
        GetSelectOther = (fieldItem, detailInfo, type) => {
            let { languageSize } = this.state;
            const selectData = this.props.SelectData;
            const { getFieldDecorator } = this.props.form;
            let userInfo = this.state.userInfo ? this.state.userInfo : {};
            var code = "";
            var ReadOnlyFlag = fieldItem.readOnly;
            var disabled = false;
            if (ReadOnlyFlag === "Y") disabled = true;
            return (
                {
                    ...getFieldDecorator(fieldItem.ID, {
                        initialValue: fieldItem.value ? fieldItem.value : (fieldItem.defaultID?fieldItem.defaultID:undefined),
                        rules: [{
                            required:  fieldItem.evaluationRequired && fieldItem.evaluationRequired == "Y" ? true : false,
                            //  message: languageSize.EnterSequencepleaseChoose ? (languageSize.EnterSequencepleaseChoose.descripts+' '+fieldItem.desc):('请选择'+fieldItem.desc)
                        }
                        ],
                        normalize: (value, prevValue) => {
                            if (+value === 0) {
                                value = ""
                            }
                            return value
                        }
                    })(

                        <Select
                            allowClear
                            showSearch
                            optionFilterProp="seatchprop"
                            disabled={disabled}
                            filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}
                            style={{ width: '100%' }}
                            // placeholder={disabled ? '' :languageSize.EnterSequencepleaseChoose ? (languageSize.EnterSequencepleaseChoose.descripts+' '+fieldItem.desc):('请选择'+fieldItem.desc)}
                            onChange={this.changeUnit}
                        >
                            {fieldItem.cureItemDesc == 'unit' ? detailInfo.unit ?
                                detailInfo.unit && detailInfo.unit.length > 0 && detailInfo.unit.map((g) => {
                                    return <Option key={g.id} value={g.id}>{g.descripts}</Option>
                                })
                                :
                                userInfo.unit ? userInfo.unit.length > 0 && userInfo.unit.map((v) => {
                                    return <Option  key={v.id} value={v.id}>{v.descripts}</Option>
                                }) :
                                    this.state.unitData.length > 0 && this.state.unitData.map((g) => {
                                        return <Option  key={g.id} value={g.id}>{g.descripts}</Option>
                                    })
                                :
                                fieldItem.data &&  fieldItem.data.length && fieldItem.data.map(d => { return <Option  key={d.id} value={d.id} seatchprop={d.descripts}>{d.descripts}</Option> })
                            }
                        </Select>
                    )
                }
            );
        };
        //国际化
        setMessage(name, message) {
            return this.props.localeProvider ? this.props.localeProvider[name][message] : ''
        }
        render() {
            const { getFieldDecorator } = this.props.form;
            const { info, docData, record, editField, timeTotal } = this.state
            const mesIcon = <Icon type="exclamation-circle" />
            //医生
            let docOp = [];
            docData && docData.map((item, index) => {
                docOp.push(<Option key={index} code={item.descriptsSPCode} value={item.id} title={item.descripts + '^' + item.descriptsSPCode}>{item.descripts}</Option>)
            })
            return (
                <div style={{ height: (this.props.cureAppID && this.props.cureAppID ? "48vh" : ""), overflow: (this.props.cureAppID && this.props.cureAppID ? "auto" : "") }} className="teartContentDom">
                      <Form>
                      {/* <Row style={{paddingLeft:(this.props.cureAppID && this.props.cureAppID ?"77px" : "78px")}}> */}
                      <Row>
                          <Col span={6} className="starDataDom" style={{ padding: "0", width: this.props.cureAppID && this.props.cureAppID ? "25%" : "38%" }}>
                              <Tooltip getPopupContainer={() => document.querySelector('.starDataDom')} overlayStyle={{ zIndex: 999, }} overlayClassName="toolTipDom starData" title={<div className="titleIcon">{mesIcon}<span >{this.state.startNoMessage}</span></div>} visible={this.state.starNoVisible}>
                                  <FormItem label={this.props.localeProvider && this.props.localeProvider.BookRecordDateOfTreatment? this.setMessage('BookRecordDateOfTreatment', 'descripts') : "治疗日期"} {...formItemLayoutDataForm}>
                                      {getFieldDecorator('dateFrom', {
                                          initialValue: record && record.startDate ? moment(record.startDate, "YYYY-MM-DD") :(this.props.records&&this.props.records.bookDate?moment(this.props.records.bookDate, "YYYY-MM-DD"): moment(moment(), "YYYY-MM-DD")),
                                          rules: [{ required: true, message: this.props.localeProvider && this.props.localeProvider.BookRecordDateOfTreatment? this.setMessage('BookRecordDateOfTreatment', 'message') : "请选择" }],
                                      })(
                                          <DatePicker allowClear={false} onFocus={this.visibleTip} onChange={(v) => this.onPanelChange(v, "1", "YYYY-MM-DD")} style={{ width: '108%' }} disabledDate={(curDate) => {
                                              return curDate && curDate > moment().endOf('day');
                                          }} />
                                      )}
                                  </FormItem>
                              </Tooltip>
                          </Col>
                          <Col span={this.props.cureAppID && this.props.cureAppID ? 3 : 4} style={{ paddingLeft: "5px", paddingRight: "0px" }}>
                              <Form.Item {...formItemLayoutCenter}>
                                  <Col>
                                      {getFieldDecorator('locStartTime', {
                                          initialValue: record && record.startTime ? moment(record.startTime, "HH:mm"): moment(moment(), "HH:mm"),
                                          rules: [{ required: true, message: this.props.localeProvider && this.props.localeProvider.BookRecordDateOfTreatment? this.setMessage('BookRecordDateOfTreatment', 'message') : "请选择"  }],
                                      })(
                                          <TimePicker onChange={(v) => this.onPanelChange(v, "3", "HH:mm")} allowClear={false} style={{ width: '100%' }} separator=":" showToday format={this.state.isTransitionStart ? 'HH:mm' : 'HHmm'} onOpenChange={this.handleOnOpenChangeStart} placeholder={this.props.localeProvider && this.props.localeProvider.BookRecordHealingPeriod? this.setMessage('BookRecordHealingPeriod', 'descripts') : "治疗时间"} />
                                      )}
                                  </Col>
                              </Form.Item>
                          </Col>
                          <Col span={1} style={{ width: this.props.cureAppID && this.props.cureAppID ? "2" : "4%", textAlign: "center", padding: "0px" }}>
                              <Form.Item  {...formItemLayoutCenter}>
                                  <Col>
                                  {this.props.localeProvider && this.props.localeProvider.BookRecordTo ? this.setMessage('BookRecordTo', 'descripts') : "至"}
              </Col>
                              </Form.Item>
                          </Col>
                          <Col span={6} style={{ padding: "0px", width: this.props.cureAppID && this.props.cureAppID ? "15%" : "24%" }}>
                              <FormItem  {...formItemLayoutCenter}>
                                  {getFieldDecorator('dateTo', {
                                      initialValue: record && record.endDate ? moment(record.endDate, "YYYY-MM-DD") : (this.props.records&&this.props.records.bookDate?moment(this.props.records.bookDate, "YYYY-MM-DD"): moment(moment(), "YYYY-MM-DD")),
                                      rules: [{ required: true, message: this.props.localeProvider && this.props.localeProvider.BookRecordDateOfTreatment? this.setMessage('BookRecordDateOfTreatment', 'message') : "请选择"  }],
                                  })(
                                      <DatePicker allowClear={false} style={{ width: '100%' }} onChange={(v) => this.onPanelChange(v, "2", "YYYY-MM-DD")} disabledDate={(curDate) => {
                                          return curDate && curDate > moment().endOf('day');
                                      }} />
                                  )}
                              </FormItem>
                          </Col >
                          <Col span={this.props.cureAppID && this.props.cureAppID ? 3 : 4} style={{ paddingLeft: "5px", paddingRight: "0px" }}>
                              <Form.Item  {...formItemLayoutCenter}>
                                  {getFieldDecorator('locStopTime', {
                                      initialValue: record && record.endTime ? moment(record.endTime, "HH:mm") : moment(moment(), "HH:mm"),
                                      rules: [{ required: true, message:this.props.localeProvider && this.props.localeProvider.BookRecordDateOfTreatment? this.setMessage('BookRecordDateOfTreatment', 'message') : "请选择"  }],
                                  })(
                                      <TimePicker onChange={(v) => this.onPanelChange(v, "4", "HH:mm")} allowClear={false} separator=":" showToday format={this.state.isTransitionStop ? 'HH:mm' : 'HHmm'} onOpenChange={this.handleOnOpenChangeStop} style={{ width: '100%' }} placeholder={this.props.localeProvider && this.props.localeProvider.BookRecordHealingPeriod? this.setMessage('BookRecordHealingPeriod', 'descripts') : "治疗时间"} />
                                  )}
                              </Form.Item>
                          </Col>
                      </Row>
                      <Row>
                      <Col span={12} >
                              <FormItem label={this.props.localeProvider && this.props.localeProvider.BookRecordDurationOfTreatment ? this.setMessage('BookRecordDurationOfTreatment', 'descripts') : "治疗用时"} {...(this.props.cureAppID && this.props.cureAppID ? formItemInput : formItemInputB)}>
                                  {getFieldDecorator('totalTime', {
                                      initialValue: timeTotal && timeTotal ? timeTotal : (record && record.dateTime ? record.dateTime : ""),
                                      rules: [{ required: false, message: "" }],
                                  })(
                                      <Input disabled title={record && record.dateTime ? record.dateTime : ""} style={{ height: "32px", resize: "none", overflow: "auto", background: "#e8e8e8" }} />
                                  )}
                              </FormItem>
                          </Col>
                          <Col span={12} style={paddRightCol}>
                              <FormItem {...(this.props.cureAppID && this.props.cureAppID ? formItemInput : formItemInputB)} label={this.props.localeProvider && this.props.localeProvider.BookRecordTherapist ? this.setMessage('BookRecordTherapist', 'descripts') : "治疗医生"}>
                                  {getFieldDecorator('docID', {
                                      initialValue: record && record.doctors ? record.doctors :(this.props.records&&this.props.records.cureDoctor?this.props.records.cureDoctor:undefined),
                                      rules: [{ required: false, message: '' }],
                                  })(
                                      <Input disabled title={record && record.doctors ? record.doctors : ""} style={{ height: "32px", resize: "none", overflow: "auto", background: "#e8e8e8" }}></Input>
                                  )}
                              </FormItem>
                          </Col>
                      </Row>
                      <Row>
                          <Col span={12} className={this.props.cureAppID && this.props.cureAppID ? "noteDom" : "noteDomB"}>
                              <Form.Item label={this.props.localeProvider && this.props.localeProvider.BookRecordRemark ? this.setMessage('BookRecordRemark', 'descripts') : "备注"} {...(this.props.cureAppID && this.props.cureAppID ? formItemInput : formItemInputB)} >
                                  {getFieldDecorator('note', {
                                      initialValue: editField&&editField!=undefined &&editField!=null && editField.length > 0 && editField[0].note ? editField[0].note : undefined,
                                      rules: [{ required: true, message: this.props.localeProvider && this.props.localeProvider.BookRecordPleaseEnter ? this.setMessage('BookRecordPleaseEnter', 'descripts') : "请输入" }],
                                  })(
                                      <TextArea
                                      />
                                  )}
                              </Form.Item>
                          </Col>
                          <Col span={12} className={this.props.cureAppID && this.props.cureAppID ? "planDom" : "planDomB"} >
                              <Form.Item label={this.props.localeProvider && this.props.localeProvider.BookRecordPlan ? this.setMessage('BookRecordPlan', 'descripts') : "计划"} {...(this.props.cureAppID && this.props.cureAppID ? formItemInput : formItemInputB)}  >
                                  {getFieldDecorator('curePlan', {
                                      initialValue: editField &&editField!=undefined &&editField!=null&& editField.length > 0  && editField[0].curePlan ? editField[0].curePlan : undefined,
                                      rules: [{ required: true, message: this.props.localeProvider && this.props.localeProvider.BookRecordPleaseEnter ? this.setMessage('BookRecordPleaseEnter', 'descripts') : "请输入" }],
                                  })(
                                      <TextArea
                                      />
                                  )}
                              </Form.Item>
                          </Col>
                      </Row>
                      <Row gutter={24} className="RowTitle" style={{margin:"0"}}>
                          {
                              this.state.editField &&editField!=undefined &&editField!=null && editField.length > 0&&this.state.editField[0].dynamic&&this.state.editField[0].dynamic=="Y"? this.state.editField.map((value, key) => {
                                return (
                                    <Col span={12} key={key} style={{ padding: (this.props.cureAppID && this.props.cureAppID ? "0" : "0 0 0 12px") }} className={value.display == "N" ? 'ColTitle display' : 'ColTitle'} id={value.code == 'stockDesc' ? 'stock-desc' : ''}>
                                        <Form.Item key={key} label={value.fieldDesc + '： '} style={{ minHeight: '40px' }}  {...(this.props.cureAppID && this.props.cureAppID ? formItemInput : formItemInputB)} >
                                            {this.getFormItem(value, key)}
                                        </Form.Item>
                                    </Col>
                                )
                            }) : ""
                          }
                      </Row>
                      <Row style={{ textAlign: "center", position: "initial" }}>
                          <Col className="edit-button">
                              <Button type="primary" onClick={this.handlePrint} style={{ marginRight: "18px" }}>{this.props.localeProvider && this.props.localeProvider.BookRecordPrint ? this.setMessage('BookRecordPrint', 'descripts') : "打印"}</Button>
                              <Button type="primary" onClick={this.saveTreat}>{this.props.localeProvider && this.props.localeProvider.BookRecordSave ? this.setMessage('BookRecordSave', 'descripts') : "保存"}</Button>
                          </Col>
                      </Row>
                  </Form>
                </div>
            )
        }
    })
export default TreatmentContent    