// 手术查询的弹框
import React, { Component } from 'react';
import { Form, Row, Col, DatePicker, TimePicker, Table, Select, Input, Button, Divider, message, Radio, Checkbox } from 'antd';
import FormItem from 'antd/lib/form/FormItem';
import TextArea from 'antd/lib/input/TextArea';
import { $http } from '../../../containers/config/https';
import { Util } from 'tools/index';
import moment from 'moment';
import store from 'store';
import './style/OperationSearchModel.less';
import PublicModalTable from '../../common/PublicModalTable.jsx';
import { $loadTemplate } from '../../lodop/Common/Print.js';

// 用户数据
let userData;
// 点击编辑时记录当前行数据
let tableRecord = {};
//患者信息
let patientData;
// 创建表单
const OperationSearchModel = Form.create()(
	class extends Component {
		constructor(props) {
			super(props);
			userData = sessionStorage.userData ? JSON.parse(sessionStorage.userData) : {}
			patientData = JSON.parse(sessionStorage.getItem('patientData'))
			this.state = {
				operationApplyInfo: {},		// 手术申请信息
				patientData: patientData,
				operationLocData: [],		// 手术室下拉数据源
				operationRoomData: [],		// 手术间下拉数据源
				operationDocData: [],		// 主刀医师下拉数据源
				assistantDocData: [],		// 助手下拉数据源
				RHBloodTypeData: [],
				operationFrequencyData: [],	// 台次下拉数据源
				anesthesiaData: [],			// 麻醉下拉数据源
				operationData: [],			// 手术下拉数据源
				operationLevelData: [],		// 级别下拉数据源
				operationPartData: [],		// 手术部位下拉数据源
				operationCutData: [],		// 手术切口下拉数据源
				operationPostData: [],		// 手术体位下拉数据源
				bloodTpyeData: [],			// 血型下拉数据源
				classificationData: [],		// 手术分类下拉数据源
				projectTypeData: [],		// 手术项目类型下拉数据源
				motivationData: [],			// 手术动机下拉数据源
				HbsAgTraitsData: [],
				defHbsAgTraitsID: '',
				HcvAbTraitsData: [],
				defHcvAbTraitsID: '',
				HivAbTraitsData: [],
				defHivAbTraitsID: '',
				syphilisTraitsData: [],
				defSyphilisTraitsID: '',
				defBloodTpyeID: '',
				defRHBloodTypeID: '',
				editingKey: '',				// 当前编辑的table数据
				removeOperation: [],		// 待删除数据
				disabledAll: (!patientData) || (patientData.admID === '') ? true : false,      //全局禁用
				tableData: [],
				locDesc: "0",
				acValue: "E",
				value: '',
				statusCode: '',				//当前手术状态
				operationPartPar: [],		//部位明细
				patOperationID: this.props.operationID?this.props.operationID:"",
				selectedOperationUser: [],	// 已选择的医护人员（下拉框禁用使用）
				diag: '',					// 诊断
				locType: '',				// 科室类型
				workDate: '',				// 上班日期(择期时判断)
				offWorkTime: '',			// 下班时间(选择时间时判断)
				EN: {},
				CN: {},
				page: 1,
				pageSize: 10,
				total: 0,
				searchCode: '',
				anaesthesiaID:'',
				crystalsModelArr: [],		// 晶体型号
				crystalsStrengthArr: [],	// 晶体度数
			}
			this.columns = [{
				key: 1,
				title: () => this.display('OperationApplyseqNo'),
				dataIndex: 'seqNo',
				align: "center",
				width: '5%',
			}, {
				key: 2,
				title: () => this.display('OperationApplyopration'),
				dataIndex: 'operationDesc',
				align: "center",
				width: '20%',
				render: (text, record, index) => {
					const editable = this.isEditing(record);
					return (
						<Input
							onClick={this.handleStopPropagation}
							value={record.operationDesc}
							style={{ width: "100%", textAlign: "left" }}
							onChange={this.handleFieldChange.bind(this, index, 'operationDesc')}
							onPressEnter={this.getOperationData}
							disabled={editable ? false : true}
						/>
					)
				}

			}, {
				key: 6,
				title: () => this.display('OperationApplyclassification'),
				dataIndex: 'classification',
				align: "center",
				width: '10%',
				render: (text, record, index) => {
					const editable = this.isEditing(record);
					return (
						<Select
							value={record.classification}
							allowClear
							style={{ width: "100%", textAlign: "left" }}
							onChange={this.handleFieldChange.bind(this, index, 'classification')}
							disabled={editable ? false : true}
							showSearch
							optionFilterProp='role'
						>
							{this.state.classificationData.map(data => (
								<Select.Option
									role={data.code + '^' + data.descripts + '^' + data.descriptsSPCode}
									key={data.id}
								>
									{data.descripts}
								</Select.Option>))}
						</Select>
					)
				}
			}, {
				key: 7,
				title: () => this.display('OperationApplyprojectType'),
				dataIndex: 'projectType',
				align: "center",
				width: '10%',
				render: (text, record, index) => {
					const editable = this.isEditing(record);
					return (
						<Select
							value={record.projectType}
							allowClear
							style={{ width: "100%", textAlign: "left" }}
							onChange={this.handleFieldChange.bind(this, index, 'projectType')}
							disabled={editable ? false : true}
							showSearch
							optionFilterProp='role'
						>
							{this.state.projectTypeData.map(data => (
								<Select.Option
									role={data.code + '^' + data.descripts + '^' + data.descriptsSPCode}
									key={data.id}
								>
									{data.descripts}
								</Select.Option>))}
						</Select>
					)
				}
			}, {
				key: 3,
				title: () => this.display('OperationApplycategory'),
				dataIndex: 'categoryID',
				align: "center",
				width: '10%',
				render: (text, record, index) => {
					const editable = this.isEditing(record);
					return (
						<Select
							value={record.categoryID}
							allowClear
							style={{ width: "100%", textAlign: "left" }}
							onChange={this.handleFieldChange.bind(this, index, 'categoryID')}
							disabled={editable ? false : true}
							showSearch
							optionFilterProp='role'
						>
							{this.state.operationLevelData.map(data => (
								<Select.Option
									role={data.code + '^' + data.descripts + '^' + data.descriptsSPCode}
									key={data.id}
								>
									{data.descripts}
								</Select.Option>))}
						</Select>
					)
				}
			}, {
				key: 4,
				title: () => this.display('OperationApplyoperationPart'),
				dataIndex: 'operationPart',
				align: "center",
				width: '10%',
				render: (text, record, index) => {
					const editable = this.isEditing(record);
					return (
						<Select
							mode="multiple"
							value={record.operationPart ? record.operationPart : ''}
							allowClear
							style={{ width: "100%" ,textAlign: "left" }}
							onChange={this.handleFieldChange.bind(this, index, 'operationPart')}
							disabled={editable ? false : true}
							showSearch
							optionFilterProp='role'
						>
							{this.state.operationPartData.map(data => (
								<Select.Option
									role={data.code + '^' + data.descripts + '^' + data.descriptsSPCode}
									key={data.id}
								>
									{data.descripts}
								</Select.Option>))}
						</Select>
					)
				}
			}, {
				key: 5,
				title: () => this.display('OperationApplyincision'),
				dataIndex: 'incisionID',
				align: "center",
				width: '10%',
				render: (text, record, index) => {
					const editable = this.isEditing(record);
					return (
						<Select
							value={record.incisionID}
							allowClear
							style={{ width: "100%", textAlign: "left" }}
							onChange={this.handleFieldChange.bind(this, index, 'incisionID')}
							disabled={editable ? false : true}
							showSearch
							optionFilterProp='role'
						>
							{this.state.operationCutData.map(data => (
								<Select.Option
									role={data.code + '^' + data.descripts + '^' + data.descriptsSPCode}
									key={data.id}
								>
									{data.descripts}
								</Select.Option>))}
						</Select>
					)
				}
			}, {
				key: 8,
				title: () => this.display('OperationApplymotivation'),
				dataIndex: 'motivation',
				align: "center",
				width: '10%',
				render: (text, record, index) => {
					const editable = this.isEditing(record);
					return (
						<Select
							value={record.motivation}
							allowClear
							style={{ width: "100%", textAlign: "left" }}
							onChange={this.handleFieldChange.bind(this, index, 'motivation')}
							disabled={editable ? false : true}
							showSearch
							optionFilterProp='role'
						>
							{this.state.motivationData.map(data => (
								<Select.Option
									role={data.code + '^' + data.descripts + '^' + data.descriptsSPCode}
									key={data.id}
								>
									{data.descripts}
								</Select.Option>))}
						</Select>
					)
				}
			}, {
				key: 9,
				title: () => this.display('OperationApplysurgicalRremarks'),
				dataIndex: 'notes',
				align: "center",
				width: '10%',
				render: (text, record, index) => {
					const editable = this.isEditing(record);
					return (
						<Input
							onClick={this.handleStopPropagation}
							value={record.notes}
							style={{ width: "100%", textAlign: "left" }}
							onChange={this.handleFieldChange.bind(this, index, 'notes')}
							disabled={editable ? false : true}
						/>
					)
				}
			}, {
				key: 10,
				title: () => this.display('OperationApplyoperate'),
				dataIndex: 'operate',
				align: "center",
				render: (text, record) => {
					const { editingKey } = this.state;
					const editable = this.isEditing(record);
					return editable ? (
						<span>
							<a onClick={(e) => this.handleUpdate(record, e)}>{this.display('OperationApplyconfirm')}</a>
							<Divider type="vertical" />
							<a onClick={(e) => this.handleCancel(record, e)}>{this.display('OperationApplycancelT')}</a>
						</span>
					) : (
							<span>
								<a disabled={(editingKey !== '') ? true : this.state.disabledAll} onClick={(e) => this.handleEdit(record, e)}>{this.display('OperationApplyedit')}</a>
								<Divider type="vertical" />
								<a style={((this.state.disabledAll) || (editingKey !== '')) ? null : { color: 'rgba(240,65,52,1)' }} disabled={(editingKey !== '') ? true : this.state.disabledAll} onClick={(e) => this.handleDelete(record, e)}>{this.display('OperationApplydelete')}</a>
							</span>
						);
				}
			}],
				this.operationColumns = [
					{
						title: () => this.display('OperationApplyICDCode'),
						dataIndex: 'ICDCode',
						width: 80,
						align: 'left',
					}, {
						title: () => this.display('OperationApplydescripts'),
						dataIndex: 'descripts',
						width: 200,
						align: 'left',
					}, {
						title: () => this.display('OperationApplycategoryDesc'),
						dataIndex: 'categoryDesc',
						width: 200,
						align: 'left',
					}
				]
		}
		componentDidMount() {
			this.languageSwitch();
			this.getSelectData();			
			this.loadPatientMsg()//获取接诊病人信息
			this.loadPatDiagData();
			this.getCrystalsModel();  // 获取晶体型号
			this.getCrystalsStrength();
		}
		componentWillReceiveProps(nextProps) {
			if (nextProps.hasOwnProperty('operationID') && (nextProps.operationID !== this.state.patOperationID)) {
				this.setState({
					patOperationID: nextProps.operationID
				}, () => {
					this.getInfo();
				})
			}
		}
		// 获取手术项目类型
		getOperationProjType = (classID = '') => {
			let data = {
				params: [{
					classID
				}]
			}
			$http.post('urlS', this, {
				code: "04160025",
				data: data,
				success: function (res) {
					if (+res.errorCode === 0) {
						this.setState({
							projectTypeData: res.result
						})
					}
				}
			});
		}
		// 获取晶体型号
		getCrystalsModel = () => {
			let data = {
                params: [{
                    medSubCatCode: '晶体'
                }]
            }
            $http.post('urlS', this, {
                code: "01010002",
                data: data,
                success: function (res) {
                    if (+res.errorCode === 0) {
                        this.setState({
                            crystalsModelArr: res.result.Data
                        })
                    }
                }
            });
		}
		// 获取晶体度数
		getCrystalsStrength = () => {
			let data = {
                params: [{ }]
            }
            $http.post('urlS', this, {
                code: "02060193",
                data: data,
                success: function (res) {
                    if (+res.errorCode === 0) {
                        this.setState({
                            crystalsStrengthArr: res.result.degreesList
                        })
                    }
                }
            });
		}
		ifDisable = () => {
			if (this.state.statusCode != '08' && this.state.statusCode != '09') {
				return true;
			}else{
				return false;
			}
		}
		loadPatientMsg() {
			patientData = JSON.parse(sessionStorage.getItem('patientData'))
			if (!patientData || patientData.admID == '') {
				return;
			}
			var params = {
				params: [{
					admID: patientData.admID ? patientData.admID : '',
					userID: userData.userID
				}]
			}
			$http.post('urlDeault', this, {
				code: "04020007",
				data: params,
				success: function (res) {
					//	console.log(res)
					if (res.errorCode == '0') {
						sessionStorage.setItem('titleData', JSON.stringify(res.result))
						this.setState({
							titleData: res.result,
						},()=>{
							this.getInfo();
						})
					}
				}
			});
		}
		// 打印手术通知单
		print = () => {
			const { patOperationID } = this.state;			
			let data = {};
			data = {
				params: [{
					patOperationID
				}]
			}
			let templateCode = 'SurgeryRF';
			$http.post('urlS', this, {
				code: '04160009',
				data: data,
				success: function (res) {
					if (res.errorCode === '0') {
						//加载模板
						$loadTemplate(templateCode, res.result);
					}
				}
			})
		}

		// 中英文切换
		languageSwitch = () => {
			let data = {
				params: [{
					reactCode: ['OperationApply']
				}]
			}
			$http.post('urlS', this, {
				code: '01040073',
				data: data,
				success: function (res) {
					if (+res.errorCode === 0) {
						this.setState({
							EN: res.result.language.EN,
							CN: res.result.language.CN
						})
					}
				}
			})
		}
		display(name) {
			if (name == 'OperationApplydetail') console.log(this.state.CN, this.state.EN)
			return userData.language != 'EN' ? (this.state.CN[name] && this.state.CN[name]['descripts'] ? this.state.CN[name]['descripts'] : '') : (this.state.CN[name] && this.state.EN[name]['descripts'] ? this.state.EN[name]['descripts'] : '')
		}
		// 阻止默认事件
		handleStopPropagation = (e) => {
			if (typeof e == 'object') {
				e.stopPropagation();
			}
		}
		//加载本次诊断 
		loadPatDiagData() {
			let params = {
				params: [{
					admID: ((this.state.patientData) && (this.state.patientData.admID != '')) ? this.state.patientData.admID : '',
					patID: ((this.state.patientData) && (this.state.patientData.patID != '')) ? this.state.patientData.patID : '',
					historyType: "",
					historyFlag: "N",
				}]
			}
			$http.post('urlDeault', this, {
				code: "03050033",
				data: params,
				success: function (res) {
					if (res.errorCode == '0') {
						let diagList = res.result.diagList;
						let diagStr = '';
						for (let i = 0; i < diagList.length; i++) {
							if (!diagStr) {
								diagStr = `${(i + 1)}.${diagList[i]['diagDesc']};`
							} else {
								diagStr = `${diagStr} \n${(i + 1)}.${diagList[i]['diagDesc']};`
							}
						}
						this.setState({ diag: diagStr })
					}
				}
			});
		}
		// 获取手术下拉框数据
		getOperationData = (e) => {
			let searchCode = e.target ? e.target.value : this.state.searchCode
			if (searchCode != '') {
				this.setState({
					searchCode: searchCode,
				})
			}
			let data = {
				params: [{
					admID: (this.state.patientData && this.state.patientData.admID) ? this.state.patientData.admID : '',
					searchCode: searchCode ? searchCode : this.state.searchCode
				}],
				pagination: [{
					pageSize: this.state.pageSize,
					currentPage: this.state.page
				}]
			};
			$http.post('urlDeault', this, {
				code: "04160003",
				data: data,
				success: function (res) {
					if (+res.errorCode === 0) {
						this.setState({
							operationData: res.result.Data,
							total: res.result.TotalCount,
						}, () => this.child.showModal())
					}
				},
				error: function (error) {
					message.error('失败：' + error);
				}
			});
		}

		changeOperationLoc = (val, opt) => {
			if (val != undefined) {
				this.setState({
					value: val,
					workDate: opt.props.workDate,
					offWorkTime: opt.props.offWorkTime
				}, () => {
					this.props.form.setFieldsValue({
						operationRoomID: '',
						operationDate: this.state.workDate && this.props.form.getFieldsValue().type == 'E' ? moment(this.state.workDate, 'YYYY-MM-DD') : moment(moment(), 'YYYY-MM-DD')
					})
					this.getOperationRoomData(val);
				});
			} else {
				this.props.form.setFieldsValue({
					operationRoomID: '',
					operationDate: this.state.workDate && this.props.form.getFieldsValue().type == 'E' ? moment(this.state.workDate, 'YYYY-MM-DD') : moment(moment(), 'YYYY-MM-DD')
				})
				this.getOperationRoomData('');
			}
		};
		//类型
		changeType = (e) => {
			this.setState({
				acValue: e.target.value,
			});
			if (e.target.value === 'E') {
				this.props.form.setFieldsValue({ operationDate: moment(this.state.workDate ? this.state.workDate : moment().add(1, 'day'), 'YYYY-MM-DD') })
			} else {
				this.props.form.setFieldsValue({ operationDate: moment(moment(), 'YYYY-MM-DD') })
			}
		};
		// 获取手术间下拉框数据
		getOperationRoomData = (value) => {
			let data = {
				"params": [{
					locID: value
				}]
			};
			$http.post('urlDeault', this, {
				code: "04160005",
				data: data,
				success: function (res) {
					if (+res.errorCode === 0) {
						this.setState({
							operationRoomData: res.result
						})
					}
				},
				error: function (error) {
					message.error('失败：' + error);
				}
			});
		}
		// 获取下拉框数据
		getSelectData = () => {
			let data = {
				"params": [{
					hospID: userData && userData.hospID ? userData.hospID : '', // 登录医院id       
					locID: userData.locID,
				}]
			};
			$http.post('urlDeault', this, {
				code: "04160001",
				data: data,
				success: function (res) {
					if (+res.errorCode === 0) {
						this.setState({
							operationLocData: res.locType != 'OP' ? res.OPLocArr : res.locArr,
							bloodTpyeData: res.BloodGroup.data,
							defBloodTpyeID: res.BloodGroup.defID,
							operationDocData: res.locType != 'OP' ? res.DoctorArr : res.allUser,
							assistantDocData: res.NurseArr,
							HbsAgTraitsData: res.HbsAgTraits.data,
							defHbsAgTraitsID: res.HbsAgTraits.defID,
							HcvAbTraitsData: res.HcvAbTraits.data,
							defHcvAbTraitsID: res.HcvAbTraits.defID,
							HivAbTraitsData: res.HivAbTraits.data,
							defHivAbTraitsID: res.HivAbTraits.defID,
							syphilisTraitsData: res.SyphilisTraits.data,
							defSyphilisTraitsID: res.SyphilisTraits.defID,
							RHBloodTypeData: res.RHBloodGroup.data,
							defRHBloodTypeID: res.RHBloodGroup.defID,
							operationPostData: res.OperationPosition,
							operationCutData: res.IncisionType,
							operationPartData: res.OperationPart,
							operationLevelData: res.OperationCategory,
							locType: res.locType,
							disabledAll: res.locType == 'OP' ? true : false,
							anesthesiaData: res.anesthesiaMode,
							classificationData: res.operationClass,
							motivationData: res.operationMotivation.data,
						})
					}
				},
				error: function (error) {
					message.error('失败：' + error);
				}
			});
		}

		// 表格下拉框选中
		handleFieldChange = (index, code, value, opt) => {
			let { tableData, operationPartPar, projectTypeData } = this.state;
			if (value !== undefined) {
				if (code === 'operationPart') {
					operationPartPar = [];
					for (var key in value) {
						operationPartPar.push(value[key])
					}
					tableData[index].operationPart = operationPartPar;
				}
				else if (code === 'notes') {
					if (value.target.value.length > 50) {
						message.warning('备注超长');
						return;
					}
					tableData[index][code] = (typeof (value) == 'string') ? value : value.target.value;
				}
				else if(code == 'classification') {
					tableData[index].projectType = ''
					this.getOperationProjType(value)
					tableData[index][code] = (typeof (value) == 'string') ? value : value.target.value;
				}
				else {
					tableData[index][code] = (typeof (value) == 'string') ? value : value.target.value;
				}
			} else {
				tableData[index][code] = '';
				if(code == 'classification') {
					tableData[index].projectType = ''
					projectTypeData = []
				}
			}
			this.setState({ tableData, operationPartPar, projectTypeData })
		}

		isEditing = (record) => {
			return record.key === this.state.editingKey
		};

		// 确认手术
		handleUpdate = (record, e) => {
			e.preventDefault();
			// 未选择手术时提示
			if (record.operationID === '') {
				message.warning(this.display('OperationApplyselectOperation'));
				return;
			}
			// 未选择手术时提示
			if (record.categoryID === '') {
				message.warning(this.display('OperationApplyselectLevel'));
				return;
			}
			// 未选择手术时提示
			if (record.operationPart.length < 1) {
				message.warning(this.display('OperationApplyselectPart'));
				return;
			}
			// 未选择手术时提示
			if (record.incisionID === '') {
				message.warning(this.display('OperationApplyselectIncision'));
				return;
			}
			this.setState({
				editingKey: ''
			});
		}
		// 删除手术
		handleDelete = (record, e) => {
			e.preventDefault();
			let { tableData, removeOperation } = this.state;
			tableData.splice(record.key, 1);
			// 重新修改数据key/seqNo
			for (let i = 0; i < tableData.length; i++) {
				tableData[i].key = i;
				tableData[i].seqNo = i + 1;
			}
			if (record.opItemID !== '') {
				removeOperation.push(record.opItemID);
				removeOperation = [...removeOperation];
			}
			this.setState({
				tableData,
				removeOperation,
			})
		}
		// 编辑手术
		handleEdit = (record, e) => {
			e.preventDefault();
			tableRecord = JSON.parse(JSON.stringify(record));
			this.setState({
				editingKey: record.key
			});
		}
		// 取消编辑
		handleCancel = (record, e) => {
			e.preventDefault();
			let tableData = this.state.tableData;
			tableData[record.key] = tableRecord;
			if (record.opItemID !== '' && record.opItemID !== undefined) {
				this.setState({
					editingKey: '',
					tableData
				});
			} else {
				this.handleDelete(record, e);
				this.setState({
					editingKey: ''
				});
			}
		}
		onChangeLocDesc = (e) => {
			this.setState({ anaesthesiaID: e });
		}
		//隔离复选框
		quarantineClick = (e) => {
			let { operationApplyInfo } = this.state
			operationApplyInfo.quarantine = operationApplyInfo.quarantine === 'Y' ? 'N' : 'Y'
			this.setState({
				operationApplyInfo: operationApplyInfo
			})
		}
		//体外循环
		CPBClick = (e) => {
			let { operationApplyInfo } = this.state
			operationApplyInfo.CPB = operationApplyInfo.CPB === 'Y' ? 'N' : 'Y'
			this.setState({
				operationApplyInfo: operationApplyInfo
			})
		}
		//自体血回输
		selfBloodRtnClick = (e) => {
			let { operationApplyInfo } = this.state
			operationApplyInfo.selfBloodRtn = operationApplyInfo.selfBloodRtn === 'Y' ? 'N' : 'Y'
			this.setState({
				operationApplyInfo: operationApplyInfo
			})
		}
		//备血
		bloodPrepareClick = (e) => {
			let { operationApplyInfo } = this.state
			operationApplyInfo.bloodPrepare = operationApplyInfo.bloodPrepare === 'Y' ? 'N' : 'Y'
			this.setState({
				operationApplyInfo: operationApplyInfo
			})
		}
		//术中快速冰冻
		frozenClick = (e) => {
			let { operationApplyInfo } = this.state
			operationApplyInfo.frozen = operationApplyInfo.frozen === 'Y' ? 'N' : 'Y'
			this.setState({
				operationApplyInfo: operationApplyInfo
			})
		}
		//心电监护
		ecgClick = (e) => {
			let { operationApplyInfo } = this.state
			operationApplyInfo.ecg = operationApplyInfo.ecg === 'Y' ? 'N' : 'Y'
			this.setState({
				operationApplyInfo: operationApplyInfo
			})
		}
		// 添加行
		addRow = () => {
			const { tableData } = this.state;
			if ((tableData.length > 0) && (tableData[tableData.length - 1]) && (tableData[tableData.length - 1]['operationID'] === '')) {
				message.warning('请先选择上一条记录的科手术');
				return;
			}
			let newData = tableData.map((item) => ({ ...item }));
			// 重新修改数据key
			for (let i = 0; i < newData.length; i++) {
				newData[i].key = i
				newData[i].seqNo = i + 1
			}
			newData.push({
				key: newData.length,
				seqNo: tableData.length + 1,
				operationDesc: '',
				operationID: '',
				categoryID: '',
				operationPart: [],
				incisionID: '',
				notes: '',
				classification: '',
				projectType: '',
				motivation: '',
				editable: true
			});
			this.setState({
				tableData: newData,
				editingKey: newData.length - 1
			});
		}

		// 获取手术单查询
		getInfo = () => {
			if (this.state.patOperationID == '') return
			let data = {
				params: [{
					patOperationID: this.state.patOperationID,
				}]
			};
			$http.post('urlDeault', this, {
				code: "04160006",
				data: data,
				success: function (res) {
					if (+res.errorCode === 0) {
						let dataInfo = res.result.Data[0];
						this.getOperationRoomData(dataInfo.operationLocID);
						this.getCrystalsModel()
						this.getOperationProjType()
						this.setState({
							operationApplyInfo: dataInfo,
							tableData: dataInfo.operationDetail,
							statusCode: dataInfo.statusCode
						}, () => {
							this.props.form.setFieldsValue({ 
								operationRoomID: dataInfo.operationRoomID,
							})
						})
					}
				},
				error: function (error) {
					message.error('失败：' + error);
				}
			});
		}
		//保存
		save = (code) => {
			let { acValue } = this.state;
			this.setState({
				clickFlag: true,
				editingKey: '',
				disabledAll: (code === '01') ? true : false
			});
			const formData = this.props.form.getFieldsValue();
			this.props.form.validateFields((err, value) => {
				if (err) {
					this.setState({
						clickFlag: false,
						disabledAll: false
					});
				} else {
					let data = {
						params: code === '09' ? [{
							applyLocID: userData.applyLocID,
							applyDocID: userData.applyDocID,
							id: this.state.patOperationID ? this.state.patOperationID : '',
							admID: !Util.isEmpty(this.state.patientData.admID) ? this.state.patientData.admID : '',
							operationDate: formData.operationDate ? moment(formData.operationDate).format('YYYY-MM-DD') : null,
							operationTime: formData.operationTime ? moment(formData.operationTime).format('HH:mm') : null,
							operationLocID: formData.operationLocID ? formData.operationLocID : '',
							operationRoomID: formData.operationRoomID ? formData.operationRoomID : '',
							duration: formData.duration ? formData.duration : '',
							applyNumber: formData.applyNumber ? formData.applyNumber : '',
							operatingSurgeon: formData.operatingSurgeon ? formData.operatingSurgeon : '',
							firstAssistant: formData.firstAssistant ? formData.firstAssistant : '',
							secondAssistant: formData.secondAssistant ? formData.secondAssistant : '',
							thirdAssistant: formData.thirdAssistant ? formData.thirdAssistant : '',
							otherAssistant: formData.otherAssistant ? formData.otherAssistant : '',
							anaesthesiaID: this.state.anaesthesiaID ? this.state.anaesthesiaID : '',
							anaesthesiaDoctorID: formData.anaesthesiaDoctorID ? formData.anaesthesiaDoctorID : '',
							applyDocNotes: formData.applyDocNotes ? formData.applyDocNotes : '',
							type: acValue ? acValue : '',
							specialEquipment: formData.specialEquipment ? formData.specialEquipment : '',
							positionID: formData.positionID ? formData.positionID : '',
							quarantine: this.state.operationApplyInfo.quarantine === 'Y' ? 'Y' : 'N',
							CPB: this.state.operationApplyInfo.CPB === 'Y' ? 'Y' : 'N',
							selfBloodRtn: this.state.operationApplyInfo.selfBloodRtn === 'Y' ? 'Y' : 'N',
							bloodPrepare: this.state.operationApplyInfo.bloodPrepare === 'Y' ? 'Y' : 'N',
							frozen: this.state.operationApplyInfo.frozen === 'Y' ? 'Y' : 'N',
							ecg: this.state.operationApplyInfo.ecg === 'Y' ? 'Y' : 'N',
							bloodType: formData.bloodType ? formData.bloodType : '',
							RHBlood: formData.RHBlood ? formData.RHBlood : '',
							HbsAg: formData.HbsAg ? formData.HbsAg : '',
							HcvAb: formData.HcvAb ? formData.HcvAb : '',
							HivAb: formData.HivAb ? formData.HivAb : '',
							syphilis: formData.syphilis ? formData.syphilis : '',
							notes: formData.notes ? formData.notes : '',
							statusCode: code,
							apparatusNurseID: formData.apparatusNurseID ? formData.apparatusNurseID : '',
							tourNurseID: formData.tourNurseID ? formData.tourNurseID : '',
							operationDetail: this.state.tableData,
							removeDetail: this.state.removeOperation,
							crystalsModelID: formData.crystalsModelID ? formData.crystalsModelID : '',
							crystalsStrengthID: formData.crystalsStrengthID ? formData.crystalsStrengthID : '',
							crystalsNum: formData.crystalsNum ? formData.crystalsNum : '1',
							rcrystalsModelID: formData.rcrystalsModelID ? formData.rcrystalsModelID : '',
							rcrystalsStrengthID: formData.rcrystalsStrengthID ? formData.rcrystalsStrengthID : '',
							rcrystalsNum: formData.rcrystalsNum ? formData.rcrystalsNum : '1',
						}] :
							[{
								admID: !Util.isEmpty(this.state.patientData.admID) ? this.state.patientData.admID : '',
								id: this.state.patOperationID ? this.state.patOperationID : '',
								statusCode: code,
							}]
					};
					$http.post('urlADS', this, {
						code: "04160004",
						data: data,
						success: function (res) {
							if (+res.errorCode == '0') {
								message.success('成功');
								this.setState({
									clickFlag: false,
									patOperationID: res.id,
									statusCode: res.statusCode
								}, () => {
									this.getInfo()
								});
							} else {
								this.setState({ clickFlag: false, disabledAll: false })
							}
						},
						error: function (error) {
							message.error('失败：' + error);
							this.setState({ clickFlag: false, disabledAll: false })
						}
					});
					if (code === '01') this.print()
				}
			},()=>{
				this.props.getOperationInfo()
			});
		}
		// 下班后时间禁用
		getDisabledHours = () => {
			let hours = []
			let time = this.state.offWorkTime
			let timeArr = time.split(':')
			for (let i = 0; i < 24; i++) {
				if (i > parseInt(timeArr[0])) hours.push(i)
			}
			return hours
		}
		getDisabledMinutes = (selectedHour) => {
			let time = this.state.offWorkTime
			let timeArr = time.split(':')
			let minutes = []
			if (selectedHour == parseInt(timeArr[0])) {
				for (let i = 0; i < 60; i++) {
					if (i > timeArr[1]) minutes.push(i);
				}
			}
			return minutes
		}
		// 手术基础数据弹框
		onRef = (ref) => {
			this.child = ref;
		}
		// 双击弹框数据
		onClickRow = (record) => {
			return {
				onDoubleClick: () => {
					if (!record.categoryID){
						message.warning('该手术无手术级别，请与医务科联系')
						return;
					}
					let { tableData, editingKey } = this.state;
					tableData[editingKey].operationID = record.id;
					tableData[editingKey].operationDesc = record.descripts;
					tableData[editingKey].categoryID = record.categoryID;
					this.setState({ tableData }, () => {
						this.child.handleCancel();
					})
				}
			}
		}
		//分页切换
		changePageSize = (current, pageSize) => {
			this.setState({ pageSize: pageSize, page: current }, () => {
				this.getOperationData(this.state.searchCode);
			});
		}
		render() {
			const { getFieldDecorator } = this.props.form;
			const { EN, CN } = this.state
			let operationApplyInfo = this.state.operationApplyInfo ? this.state.operationApplyInfo : {}
			const formItemLayout = {    // label 和input宽度
				labelCol: { span: 8 },
				wrapperCol: { span: 16 },
			};
			const formItemProLayout = {    // label 和input宽度
				labelCol: { span: 4 },
				wrapperCol: { span: 20 },
			};
			const formItemProLayoutAdd = {    // label 和input宽度
				labelCol: { span: 2 },
				wrapperCol: { span: 19 },
			};
			const formItemEquip = {    // label 和input宽度
				labelCol: { span: 2 },
				wrapperCol: { span: 22 },
			};
			const formItemAdd = {    // label 和input宽度
				labelCol: { span: 8 },
				wrapperCol: { span: 16 },
			};
			const formItemCheckBox = {    // label 和input宽度
				labelCol: { span: 16 },
				wrapperCol: { span: 8 },
			};
			const formItemLayoutCheck = {
				labelCol: { span: 7 },
				wrapperCol: { span: 25 },
			}
			let formData = this.props.form.getFieldsValue();
			const selectedOperationUser = [formData.operatingSurgeon, formData.firstAssistant, formData.secondAssistant, formData.thirdAssistant, formData.otherAssistant]
			// 手术弹框参数
			let param = {
				width: 600,
				top: 0,
				left: 0,
				height: 300,
				columns: this.operationColumns,
				data: this.state.operationData,
				isOnRow: true,
				showPagination: true,
				total: this.state.total,
				page: this.state.page
			}
			return (
				<div className='outpatient-station-body' style={{width: '100%', overflowY: 'hidden',overflowX: 'hidden',height: store.getState().tableHeight.y - 61 + 'px', overflowY: 'auto'}}>
					<Row style={{ borderBottom: '1px solid #EEEEEE'}}>
						<Col span={24} style={{display: 'flex'}}>
								{/* <div style={{ width: '24%', borderRight: '1px solid #EEEEEE', height: 120, display: 'flex'}}>
									<div className="other" style={{display: 'flex', flexShrink: '1', flex: '0 0 auto', width: 100}}>
										<div className={this.state.titleData && this.state.titleData.basicInfo.patSexCode == '1' ?
											'splice-boy' : (this.state.titleData && this.state.titleData.basicInfo.patSexCode == '2' ? 'splice-girl' : 'splice-other')}></div>
										<span className="bed">{this.state.titleData ? this.state.titleData.admInfo.admBedCode : ''}</span>
									</div>
									<div style={{display: 'flex', flex: '1 1 auto', flexDirection: 'column'}}>
										<div style={{ padding: '10px 0 0 20px' }} className="item">
											<div>
												<i className="icon"></i>
												<span>{this.state.titleData ? this.state.titleData.basicInfo.patName : ''}</span>
											</div>
											<div>
												<i className="icon"></i>
												<span>{this.state.titleData ? this.state.titleData.basicInfo.patSexDesc : ''}</span>
											</div>
											<div>
												<i className="icon"></i>
												<span>{this.state.titleData ? this.state.titleData.basicInfo.patAge : ''}</span>
											</div>
										</div>
										<div style={{ fontWeight: 400, color: '#666666', fontSize: '16px', padding: '10px 0 0 20px' }} className="item">
											<div>
												<i className="icon"></i>
												<span>{this.state.titleData ? this.state.titleData.admInfo.admLocDesc : ''}</span>
											</div>
											<div>
												<i className="icon"></i>
												<span>{this.state.titleData ? this.state.titleData.admInfo.admWardDesc : ''}</span>
											</div>
										</div>
										<div style={{ fontWeight: 400, color: '#666666', fontSize: '16px', padding: '10px 0 0 20px' }} className="item">
											<div>
												<i className="icon"></i>
												<span>{this.state.titleData ? this.state.titleData.basicInfo.patBirthDate : ''}</span>
												<span>{this.state.titleData ? this.state.titleData.basicInfo.patBirthTime : ''}</span>
											</div>
										</div>
									</div>
								</div> */}
								<div style={{ width: '100%',  height: '120px' }}>
									<div style={{ width: '100%', padding: '6px 0', margin: '10px 0 0 18px' }}>
										<span style={{ marginTop: 20, marginLeft: '0px' }}>{this.display('OperationApplyapploc')}:<span className='operationa-apply-info'>{operationApplyInfo && operationApplyInfo.applyLocDesc ? operationApplyInfo.applyLocDesc : userData.locDesc}</span></span>
										<span style={{ marginTop: 20, marginLeft: '5%' }}>{this.display('OperationApplyappDoc')}:<span className='operationa-apply-info'>{operationApplyInfo && operationApplyInfo.applyDocDesc ? operationApplyInfo.applyDocDesc : userData.userName}</span></span>
									</div>
									<div className='doctor-step-cls' style={{ marginLeft: '20px' }}>
										<Col span={1} style={{ textAlign: 'right' }}>
											<span>{this.display('OperationApplydiag')}：</span>
										</Col>
										<Col span={23} style={{ textAlign: 'left', width: '94%' }}>
											<TextArea style={{ width: '100%', overflowY: 'auto' }} autosize={{ minRows: 3, maxRows: 3 }} disabled draggable value={this.state.diag}></TextArea>
										</Col>
									</div>
								</div>
						</Col>
					</Row>

					<div className="content">
						<Row style={{ height: '100%' }}>
							<Form style={{ height: '100%' }}>

								<div className="form-ite">
									<Row style={{ width: '100%', padding: '18px 18px 0 0' }}>
										<Col span={4} >
											<FormItem {...formItemLayout} label={this.display('OperationApplyoperationLoc')}>
												{getFieldDecorator('operationLocID', {
													initialValue: operationApplyInfo.operationLocID ? operationApplyInfo.operationLocID : '',
													rules: [{ required: true, message: this.display('OperationApplyselect'), }]
												})(
													<Select onChange={this.changeOperationLoc} showSearch allowClear optionFilterProp="role" disabled={this.ifDisable()} >
														{this.state.operationLocData.map(data => (<Select.Option key={data.id} value={data.id} role={data.code + '^' + data.descripts + '^' + data.descriptsSPCode} workDate={data.workDate} offWorkTime={data.offWorkTime} >{data.descripts}</Select.Option>))}
													</Select>
												)}
											</FormItem>
										</Col>
										<Col span={5} >
											<FormItem {...formItemLayout} label={this.display('OperationApplyoperationRoom')}>
												{getFieldDecorator('operationRoomID', {
													initialValue: operationApplyInfo.operationRoomID ? operationApplyInfo.operationRoomID : '',
													// rules: [{ required: true, message: '请选择...', }]
												})(
													<Select showSearch allowClear optionFilterProp="role" disabled={this.ifDisable()} >
														{this.state.operationRoomData.map(data => (<Select.Option key={data.id + ""} value={data.id + ""} role={data.code + '^' + data.descripts + '^' + data.descriptsSPCode}>{data.descripts}</Select.Option>))}
													</Select>
												)}
											</FormItem>
										</Col>
										<Col span={5}>
											<FormItem {...formItemLayout} label={this.display('OperationApplyoperationDate')}>
												{getFieldDecorator('operationDate', {
													initialValue: operationApplyInfo.operationDate ? moment(operationApplyInfo.operationDate, 'YYYY-MM-DD') : moment(moment().add(1, 'day'), 'YYYY-MM-DD'),
													rules: [{ required: true, message: this.display('OperationApplyselect'), }]
												})(
													<DatePicker style={{ width: '100%' }}
														disabledDate={(curDate) => {
															return curDate && curDate < moment().subtract(2, 'days');
														}}
														disabled={this.ifDisable()}></DatePicker>
												)}
											</FormItem>
										</Col>
										<Col span={5}>
											<FormItem {...formItemLayout} label={this.display('OperationApplyoperationTime')}>
												{getFieldDecorator('operationTime', {
													initialValue: operationApplyInfo.operationTime ? moment(operationApplyInfo.operationTime, 'HH:mm') : null,
													rules: [{ required: false, message: this.display('OperationApplyselect'), }]
												})(
													<TimePicker
														style={{ width: '100%' }}
														disabled={this.ifDisable()}
														format='HH:mm'
														disabledHours={this.getDisabledHours}
														disabledMinutes={this.getDisabledMinutes}
													></TimePicker>
												)}
											</FormItem>
										</Col>
										<Col span={5} >
											<FormItem {...formItemLayout} label={this.display('OperationApplyduration')}>
												{getFieldDecorator('duration', {
													initialValue: operationApplyInfo.duration ? operationApplyInfo.duration : '',
												})(
													<Input disabled={this.ifDisable()} />
												)}
											</FormItem>
										</Col>
									</Row>
									<Row style={{ width: '100%', padding: '0px 18px 0 0' }}>
										<Col span={4} >
											<FormItem {...formItemLayout} label={this.display('OperationApplyoperatingSurgeon')}>
												{getFieldDecorator('operatingSurgeon', {
													initialValue: operationApplyInfo.operatingSurgeon ? operationApplyInfo.operatingSurgeon : '',
													rules: [{ required: true, message: this.display('OperationApplyselect'), }]
												})(
													<Select showSearch allowClear optionFilterProp="role" disabled={this.ifDisable()} >
														{this.state.operationDocData.map(data => (<Select.Option key={data.id} value={data.id} role={data.code + '^' + data.descripts + '^' + data.descriptsSPCode} disabled={selectedOperationUser.includes(data.id)}>{data.descripts}</Select.Option>))}
													</Select>
												)}
											</FormItem>
										</Col>
										<Col span={5} >
											<FormItem {...formItemLayout} label={this.display('OperationApplyfirstAssistant')}>
												{getFieldDecorator('firstAssistant', {
													initialValue: operationApplyInfo.firstAssistant ? operationApplyInfo.firstAssistant : '',
												})(
													<Select showSearch allowClear optionFilterProp="role" disabled={this.ifDisable()} >
														{this.state.assistantDocData.map(data => (<Select.Option key={data.id} value={data.id} role={data.code + '^' + data.descripts + '^' + data.descriptsSPCode} disabled={selectedOperationUser.includes(data.id)} >{data.descripts}</Select.Option>))}
													</Select>
												)}
											</FormItem>
										</Col>
										<Col span={5} >
											<FormItem {...formItemLayout} label={this.display('OperationApplysecondAssistant')}>
												{getFieldDecorator('secondAssistant', {
													initialValue: operationApplyInfo.secondAssistant ? operationApplyInfo.secondAssistant : '',

												})(
													<Select showSearch allowClear optionFilterProp="role" disabled={this.ifDisable()}>
														{this.state.assistantDocData.map(data => (<Select.Option key={data.id} value={data.id} role={data.code + '^' + data.descripts + '^' + data.descriptsSPCode} disabled={selectedOperationUser.includes(data.id)} >{data.descripts}</Select.Option>))}
													</Select>
												)}
											</FormItem>
										</Col>
										<Col span={5} >
											<FormItem {...formItemLayout} label={this.display('OperationApplythirdAssistant')}>
												{getFieldDecorator('thirdAssistant', {
													initialValue: operationApplyInfo.thirdAssistant ? operationApplyInfo.thirdAssistant : '',
												})(
													<Select showSearch allowClear optionFilterProp="role" disabled={this.state.disabledAll} >
														{this.state.assistantDocData.map(data => (<Select.Option key={data.id} value={data.id} role={data.code + '^' + data.descripts + '^' + data.descriptsSPCode} disabled={selectedOperationUser.includes(data.id)} >{data.descripts}</Select.Option>))}
													</Select>
												)}
											</FormItem>
										</Col>
										<Col span={5}>
											<FormItem {...formItemLayout} label={this.display('OperationApplyotherAssistant')}>
												{getFieldDecorator('otherAssistant', {
													initialValue: operationApplyInfo.otherAssistant ? operationApplyInfo.otherAssistant : '',
												})(
													<Select showSearch allowClear optionFilterProp="role" disabled={this.ifDisable()}>
														{this.state.assistantDocData.map(data => (<Select.Option key={data.id} value={data.id} role={data.code + '^' + data.descripts + '^' + data.descriptsSPCode} disabled={selectedOperationUser.includes(data.id)} >{data.descripts}</Select.Option>))}
													</Select>
												)}
											</FormItem>
										</Col>
									</Row>
									<Row style={{ width: '100%', padding: '0px 18px 0 0' }}>
										<Col span={4}>
											<FormItem {...formItemLayout} label={this.display('OperationApplyapplyNumber')}>
												{getFieldDecorator('applyNumber', {
													initialValue: operationApplyInfo.applyNumber ? operationApplyInfo.applyNumber : '',
												})(
													<Input disabled={this.ifDisable()} />
												)}
											</FormItem>
										</Col>
										<Col span={10}>
											<FormItem {...formItemProLayout} label={this.display('OperationApplyanesthesia')}>
												{getFieldDecorator('anaesthesiaID', {
													initialValue: operationApplyInfo.anaesthesiaID ? operationApplyInfo.anaesthesiaID : '',
													rules: [{ required: false, message: this.display('OperationApplyselect'), }]
												})(
													<Select disabled={this.ifDisable()} showSearch optionFilterProp="title" allowClear value={this.state.locDesc} onChange={this.onChangeLocDesc.bind(this)} placeholder="麻醉方式">
														{this.state.anesthesiaData.map(data => (<Select.Option key={data.id} value={data.id} role={data.code + '^' + data.descripts + '^' + data.descriptsSPCode}>{data.descripts}</Select.Option>))}
													</Select>
												)}
											</FormItem>
										</Col>
										<Col span={10}>
											<FormItem {...formItemProLayout} label={this.display('OperationApplyapplyDocNotes')}>
												{getFieldDecorator('applyDocNotes', {
													initialValue: operationApplyInfo.applyDocNotes ? operationApplyInfo.applyDocNotes : '',
												})(
													<Input disabled={this.ifDisable()} allowClear />
												)}
											</FormItem>
										</Col>
									</Row>
									<Row>
										<Col span={8}>
											<FormItem label={this.display('OperationApplytype')} {...formItemProLayout} style={{ marginBottom: '0' }}>
												{getFieldDecorator('type', {
													initialValue: operationApplyInfo.type ? operationApplyInfo.type : 'E',
												})(
													<Radio.Group disabled={this.ifDisable()} onChange={this.changeType} value={this.state.acValue}>
														<Radio value={'E'}>择期手术</Radio>
														<Radio value={'D'}>日间手术</Radio>
														<Radio value={'EM'}>急诊手术</Radio>
													</Radio.Group>
												)}
											</FormItem>
										</Col>
										<Col span={2} style={{ float: 'left', paddingLeft: "31px", boxSizing: "border-box" }}>
											<FormItem {...formItemLayoutCheck}>
												{getFieldDecorator('ecg', {
													initialValue: operationApplyInfo.ecg
												})(
													<Checkbox disabled={this.state.disabledAll} checked={operationApplyInfo.ecg === 'Y' ? true : false} onChange={(even) => { this.ecgClick(even) }}>{this.display('OperationApplyecg')}</Checkbox>
												)}
											</FormItem>
										</Col>
									</Row>
								</div>

								<div className="form-ite">
									<Row style={{ margin: '0px 18px 0 0', paddingTop: '11px', width: '100%' }}>
										<Col span={24} style={{ padding: '0 24px', display: 'flex', justifyContent: 'space-between' }}>
											<div><span style={{ color: 'red' }}>*</span>{this.display('OperationApplysurgery')}：</div>
											<Button className="btn-botton" disabled={this.ifDisable()} style={{ color: 'rgba(247,128,93,1)' }} size='small' onClick={this.addRow}>{this.display('OperationApplyadd')}</Button>
										</Col>
										<Col span={24}>
											<Table
												style={{ minHeight: '162px', padding: '0 24px', marginTop: '10px' }}
												columns={this.columns}
												dataSource={this.state.tableData}
												pagination={false}
												bordered
											/>
										</Col>
									</Row>
								</div>

								<div className="form-ite">
									<Row style={{ width: '100%', padding: '0px 18px 0 0' }}>										
										<Col span={8}>
											<FormItem {...formItemLayout} label={'左眼'+this.display('OperationApplycrystalsModel')}>
												{getFieldDecorator('crystalsModelID', {
													initialValue: operationApplyInfo.crystalsModelID ? operationApplyInfo.crystalsModelID : '',
												})(
													<Select showSearch allowClear optionFilterProp="role" disabled={this.ifDisable()} >
														{this.state.crystalsModelArr.map(data => (<Select.Option key={data.id} value={data.id} role={data.code + '^' + data.descripts + '^' + data.descriptsSPCode + '^' + data.spec}>{data.spec + ' [' + data.descripts + ']'}</Select.Option>))}
													</Select>
												)}
											</FormItem>
										</Col>
										<Col span={8}>
											<FormItem {...formItemLayout} label={this.display('OperationApplycrystalsStrength')}>
												{getFieldDecorator('crystalsStrengthID', {
													initialValue: operationApplyInfo.crystalsStrengthID ? operationApplyInfo.crystalsStrengthID : '',
												})(
													<Select showSearch allowClear optionFilterProp="role" disabled={this.ifDisable()}>
														{this.state.crystalsStrengthArr.map(data => (<Select.Option key={data.id} value={data.id} role={data.code + '^' + data.descripts + '^' + data.descriptsSPCode}>{data.descripts}</Select.Option>))}
													</Select>
												)}
											</FormItem>
										</Col>
										<Col span={8}>
											<FormItem {...formItemLayout} label={this.display('OperationApplycrystalsNum')}>
												{getFieldDecorator('crystalsNum', {
													initialValue: operationApplyInfo.crystalsNum ? operationApplyInfo.crystalsNum : '',
												})(
													<Input disabled={this.ifDisable()} allowClear />
												)}
											</FormItem>
										</Col>
									</Row>
									<Row style={{ width: '100%', padding: '0px 18px 0 0' }}>										
										<Col span={8}>
											<FormItem {...formItemLayout} label={'右眼'+this.display('OperationApplycrystalsModel')}>
												{getFieldDecorator('rcrystalsModelID', {
													initialValue: operationApplyInfo.rcrystalsModelID ? operationApplyInfo.rcrystalsModelID : '',
												})(
													<Select showSearch allowClear optionFilterProp="role" disabled={this.ifDisable()} >
														{this.state.crystalsModelArr.map(data => (<Select.Option key={data.id} value={data.id} role={data.code + '^' + data.descripts + '^' + data.descriptsSPCode + '^' + data.spec}>{data.spec + ' [' + data.descripts + ']'}</Select.Option>))}
													</Select>
												)}
											</FormItem>
										</Col>
										<Col span={8}>
											<FormItem {...formItemLayout} label={this.display('OperationApplycrystalsStrength')}>
												{getFieldDecorator('rcrystalsStrengthID', {
													initialValue: operationApplyInfo.rcrystalsStrengthID ? operationApplyInfo.rcrystalsStrengthID : '',
												})(
													<Select showSearch allowClear optionFilterProp="role" disabled={this.ifDisable()}>
														{this.state.crystalsStrengthArr.map(data => (<Select.Option key={data.id} value={data.id} role={data.code + '^' + data.descripts + '^' + data.descriptsSPCode}>{data.descripts}</Select.Option>))}
													</Select>
												)}
											</FormItem>
										</Col>
										<Col span={8}>
											<FormItem {...formItemLayout} label={this.display('OperationApplycrystalsNum')}>
												{getFieldDecorator('rcrystalsNum', {
													initialValue: operationApplyInfo.rcrystalsNum ? operationApplyInfo.rcrystalsNum : '',
												})(
													<Input disabled={this.ifDisable()} allowClear />
												)}
											</FormItem>
										</Col>
									</Row>
									<Row style={{ padding: '0px 18px 0px 0px', width: '100%' }}>
										<Col span={19}>
											<FormItem {...formItemEquip} label={this.display('OperationApplyspecialEquipment')}>
												{getFieldDecorator('specialEquipment', {
													initialValue: operationApplyInfo.specialEquipment ? operationApplyInfo.specialEquipment : '',
												})(
													<Input disabled={this.ifDisable()} allowClear />
												)}
											</FormItem>
										</Col>
										<Col span={5}>
											<FormItem {...formItemAdd} label={this.display('OperationApplyposition')}>
												{getFieldDecorator('positionID', {
													initialValue: operationApplyInfo.positionID ? operationApplyInfo.positionID : '',
												})(
													<Select showSearch allowClear optionFilterProp="role" disabled={this.ifDisable()}>
														{this.state.operationPostData.map(data => (<Select.Option key={data.id} value={data.id} role={data.code + '^' + data.descripts + '^' + data.descriptsSPCode}>{data.descripts}</Select.Option>))}
													</Select>
												)}
											</FormItem>
										</Col>
									</Row>
									<Row style={{ width: '100%', padding: '0px 18px 0 0' }}>
										<Col span={4}>
											<FormItem {...formItemLayout} label={this.display('OperationApplybloodType')}>
												{getFieldDecorator('bloodType', {
													initialValue: operationApplyInfo.bloodType ? operationApplyInfo.bloodType : this.state.defBloodTpyeID,
													rules: [{ required: true, message: this.display('OperationApplyselect'), }]
												})(
													<Select showSearch allowClear optionFilterProp="role" disabled={this.ifDisable()}>
														{this.state.bloodTpyeData.map(data => (<Select.Option key={data.id} value={data.id} role={data.code + '^' + data.descripts + '^' + data.descriptsSPCode}>{data.descripts}</Select.Option>))}
													</Select>
												)}
											</FormItem>
										</Col>
										<Col span={5} >
											<FormItem {...formItemLayout} label={this.display('OperationApplyRHBlood')}>
												{getFieldDecorator('RHBlood', {
													initialValue: operationApplyInfo.RHBlood ? operationApplyInfo.RHBlood : this.state.defRHBloodTypeID,
													rules: [{ required: true, message: this.display('OperationApplyselect'), }]
												})(
													<Select showSearch allowClear optionFilterProp="role" disabled={this.ifDisable()} >
														{this.state.RHBloodTypeData.map(data => (<Select.Option key={data.id} value={data.id} role={data.code + '^' + data.descripts + '^' + data.descriptsSPCode}>{data.descripts}</Select.Option>))}
													</Select>
												)}
											</FormItem>
										</Col>
										<Col span={5} >
											<FormItem {...formItemLayout} label='HbsAg'>
												{getFieldDecorator('HbsAg', {
													initialValue: operationApplyInfo.HbsAg ? operationApplyInfo.HbsAg : this.state.defHbsAgTraitsID,
													rules: [{ required: true, message: this.display('OperationApplyselect'), }]
												})(
													<Select showSearch allowClear optionFilterProp="role" disabled={this.ifDisable()}>
														{this.state.HbsAgTraitsData.map(data => (<Select.Option key={data.id} value={data.id} role={data.code + '^' + data.descripts + '^' + data.descriptsSPCode}>{data.descripts}</Select.Option>))}
													</Select>
												)}
											</FormItem>
										</Col>
										<Col span={5} >
											<FormItem {...formItemLayout} label='Hcv_Ab'>
												{getFieldDecorator('HcvAb', {
													initialValue: operationApplyInfo.HcvAb ? operationApplyInfo.HcvAb : this.state.defHcvAbTraitsID,
													rules: [{ required: true, message: this.display('OperationApplyselect'), }]
												})(
													<Select showSearch allowClear optionFilterProp="role" disabled={this.ifDisable()} >
														{this.state.HcvAbTraitsData.map(data => (<Select.Option key={data.id} value={data.id} role={data.code + '^' + data.descripts + '^' + data.descriptsSPCode}>{data.descripts}</Select.Option>))}
													</Select>
												)}
											</FormItem>
										</Col>
										<Col span={5} >
											<FormItem {...formItemLayout} label='Hiv_Ab'>
												{getFieldDecorator('HivAb', {
													initialValue: operationApplyInfo.HivAb ? operationApplyInfo.HivAb : this.state.defHivAbTraitsID,
													rules: [{ required: true, message: this.display('OperationApplyselect'), }]
												})(
													<Select showSearch allowClear optionFilterProp="role" disabled={this.ifDisable()} >
														{this.state.HivAbTraitsData.map(data => (<Select.Option key={data.id} value={data.id} role={data.code + '^' + data.descripts + '^' + data.descriptsSPCode}>{data.descripts}</Select.Option>))}
													</Select>
												)}
											</FormItem>
										</Col>
									</Row>
									<Row>
										<Col span={4} >
											<FormItem {...formItemLayout} label={this.display('OperationApplysyphilis')}>
												{getFieldDecorator('syphilis', {
													initialValue: operationApplyInfo.syphilis ? operationApplyInfo.syphilis : this.state.defSyphilisTraitsID,
													rules: [{ required: true, message: this.display('OperationApplyselect'), }]
												})(
													<Select showSearch allowClear optionFilterProp="role" disabled={this.ifDisable()}>
														{this.state.syphilisTraitsData.map(data => (<Select.Option key={data.id} value={data.id} role={data.code + '^' + data.descripts + '^' + data.descriptsSPCode}>{data.descripts}</Select.Option>))}
													</Select>
												)}
											</FormItem>
										</Col>
										<Col span={20}>
											<FormItem {...formItemProLayoutAdd} label={this.display('OperationApplynotes')}>
												{getFieldDecorator('notes', {
													initialValue: operationApplyInfo.notes ? operationApplyInfo.notes : '',
												})(
													<Input disabled={this.ifDisable()} allowClear />
												)}
											</FormItem>
										</Col>
									</Row>
									<Row gutter={12}>
										<Col style={{ float: 'left', paddingLeft: "110px", boxSizing: "border-box" }}>
											<FormItem {...formItemLayoutCheck}>
												{getFieldDecorator('quarantine', {
													initialValue: operationApplyInfo.quarantine
												})(
													<Checkbox disabled={this.ifDisable()} checked={operationApplyInfo.quarantine === 'Y' ? true : false} onChange={(even) => { this.quarantineClick(even) }} >{this.display('OperationApplyquarantine')}</Checkbox>
												)}
											</FormItem>
										</Col>
										<Col style={{ float: 'left', paddingLeft: "31px", boxSizing: "border-box" }}>
											<FormItem  {...formItemLayoutCheck}>
												{getFieldDecorator('CPB', {
													initialValue: operationApplyInfo.CPB
												})(
													<Checkbox disabled={this.ifDisable()} checked={operationApplyInfo.CPB === 'Y' ? true : false} onChange={(even) => { this.CPBClick(even) }}>{this.display('OperationApplyCPB')}</Checkbox>
												)}
											</FormItem>
										</Col>
										<Col style={{ float: 'left', paddingLeft: "31px", boxSizing: "border-box" }}>
											<FormItem  {...formItemLayoutCheck}>
												{getFieldDecorator('selfBloodRtn', {
													initialValue: operationApplyInfo.selfBloodRtn
												})(
													<Checkbox disabled={this.ifDisable()} checked={operationApplyInfo.selfBloodRtn === 'Y' ? true : false} onChange={(even) => { this.selfBloodRtnClick(even) }}>{this.display('OperationApplyselfBloodRtn')}</Checkbox>
												)}
											</FormItem>
										</Col>
										<Col style={{ float: 'left', paddingLeft: "31px", boxSizing: "border-box" }}>
											<FormItem {...formItemLayoutCheck}>
												{getFieldDecorator('bloodPrepare', {
													initialValue: operationApplyInfo.bloodPrepare
												})(
													<Checkbox disabled={this.ifDisable()} checked={operationApplyInfo.bloodPrepare === 'Y' ? true : false} onChange={(even) => { this.bloodPrepareClick(even) }}>{this.display('OperationApplybloodPrepare')}</Checkbox>
												)}
											</FormItem>
										</Col>
										<Col style={{ float: 'left', paddingLeft: "31px", boxSizing: "border-box" }}>
											<FormItem {...formItemLayoutCheck}>
												{getFieldDecorator('frozen', {
													initialValue: operationApplyInfo.frozen
												})(
													<Checkbox disabled={this.ifDisable()} checked={operationApplyInfo.frozen === 'Y' ? true : false} onChange={(even) => { this.frozenClick(even) }}>{this.display('OperationApplyfrozen')}</Checkbox>
												)}
											</FormItem>

										</Col>
									</Row>
								</div>
								<div className="form-ite clearflot">
									{this.state.locType !== 'OP' ? (<Row className="btn">
										<Col span={6} style={{ margin: '0 8px' }}>
											<FormItem>
												<Button
													className="btn-botton"
													type='primary'
													htmlType="submit"
													onClick={this.save.bind(this, '08')}
													disabled={this.state.clickFlag ? true : (!this.state.disabledAll && this.state.statusCode != '01')}
												>{this.display('OperationApplycancel')}
												</Button>
											</FormItem>
										</Col>
										<Col span={6} style={{ margin: '0 10px' }}>
											<FormItem>
												<Button
													className="btn-botton"
													style={{ marginLeft: '-4px' }}
													type='primary'
													htmlType="submit"
													onClick={this.save.bind(this, '09')}
													disabled={this.state.clickFlag ? true : this.state.disabledAll || (this.state.statusCode && this.state.statusCode != '08' && this.state.statusCode != '09')}
												>{this.display('OperationApplysave')}
												</Button>
											</FormItem>
										</Col>
										<Col span={6} style={{ margin: '0 8px 0 0' }}>
											<FormItem>
												<Button
													className="btn-botton"
													type='primary'
													htmlType="submit"
													onClick={this.save.bind(this, '01')}
													icon='send'
													disabled={this.state.clickFlag ? true : this.state.disabledAll || (this.state.statusCode != '08' && this.state.statusCode != '09')}
												>{this.display('OperationApplyapply')}
												</Button>
											</FormItem>
										</Col>
									</Row>) : ''}
								</div>
							</Form>
						</Row>
					</div>
					<PublicModalTable
						onClickRowPublic={this.onClickRow}
						compilePage={this.changePageSize}
						param={param} onRef={this.onRef}
					/>
				</div>
			)
		}
	}
)

export default OperationSearchModel;