//分娩信息
import React from 'react';
import { Form, Row, Col, Input, Select, Button, DatePicker, Modal, Table, Icon, Pagination, message, TimePicker, Divider } from 'antd';
import moment from 'moment';
import { $http } from 'containers/config/https';
import store from 'store';
import PatientInfo from '../Patient/PatientInfo';
import "./CSS/ChildbirthRegister.less"
import { Util } from 'tools/index';
const FormItem = Form.Item;
const Option = Select.Option;
const confirm = Modal.confirm;
let userData;
// let admID = sessionStorage.admID ? JSON.parse(sessionStorage.admID) : '';
const formItemLayout = { // label 和input宽度
	labelCol: { span: 9 },
	wrapperCol: { span: 15 }
}
let initAdmID, patID
const DeliveryInformation = Form.create()(
	class DeliveryInformation extends React.Component {
		constructor(props) {
			super(props)
			let patientData = {};
			if (window.sessionStorage.patientData) {
				patientData = JSON.parse(window.sessionStorage.patientData);
			}
			initAdmID = patientData.admID ? patientData.admID : '';
			userData = sessionStorage.userData ? JSON.parse(sessionStorage.userData) : {};
			this.state = {
				admID: initAdmID,
				loading: false,
				visible: false,
				values: {},//查询条件数据
				searchLoading: false,//查询请求
				locId: "",//科室Id
				baseRuptureOfMembranes: [],
				baseFluidCharacteristics: [],
				basePlacentalDeliveryMethods: [],
				basePlacentalIntegrity: [],
				baseRuptureOfPerineum: [],
				baseEpisiotomy: [],
				baseSutureMethod: [],
				baseCervicalLaceration: [],
				baseFundusHeight: [],
				baseUterineContractions: [],
				info: [],
				registerInfo: {}, //孕妇登记信息
				firstTime: 0,
				secondTime: 0,
				thirdTime: 0,
				saveFlag: false,       //保存按钮标志
				EN: {},
				CN: {},
				refs: {}, ///根据后台配置动态创建的ref
			}
		}
		componentDidMount() {
			this.getAllInfo()
			this.getSelect()
			this.languageSwitch()
		}
		componentWillUnmount() {
			// 组件销毁前将静止让setState修改state的状态
			this.setState = (state, callback) => { return; }
			// document.querySelector('.ant-table-body').style.height = store.getState().tableHeight.y + 'px';
		}
		//获取首页信息
		getAllInfo = () => {
			let data = {}
			data = {
				params: [{
					admID: this.state.admID ? this.state.admID : ''
				}]
			}
			$http.post('urlS', this, {
				code: "04110017",
				data: data,
				success: function (res) {
					if (res.errorCode === '0') {
						// console.log("所有信息", res)
						this.props.form.resetFields()
						this.setState({
							info: res.result,
							registerInfo: res.childbirthRegister,
						})
					} else {
						this.setState({
							saveFlag: true,
						})
					}
				}
			})
		}
		// 中英文切换
		languageSwitch = () => {
			let data = {
				params: [{
					reactCode: ['DeliveryInformation']
				}]
			}
			$http.post('urlS', this, {
				code: '01040073',
				data: data,
				success: function (res) {
					if (+res.errorCode === 0) {
						let refs={};
						for (let i in res.result.language.CN) {
							if (res.result.language.CN[i].focusIndex != '') {
								let focusIndex = parseInt(res.result.language.CN[i].focusIndex);
								let ref = React.createRef();
								refs["ref" + focusIndex]=ref;
							}
						}
						this.setState({
							refs,
							EN: res.result.language.EN,
							CN: res.result.language.CN,
							refFalg: true,
						});
					}
				}
			})
		}
		display(name) {
			return userData.language != 'EN' ? (this.state.CN['DeliveryInformation' + name] && this.state.CN['DeliveryInformation' + name]['descripts'] ? this.state.CN['DeliveryInformation' + name]['descripts'] : '') : (this.state.CN['DeliveryInformation' + name] && this.state.EN['DeliveryInformation' + name]['descripts'] ? this.state.EN['DeliveryInformation' + name]['descripts'] : '')
		}
		getIndex(name) {
			return this.state.CN['DeliveryInformation' + name] ? this.state.CN['DeliveryInformation' + name]['focusIndex'] : '';
			//return this[userData.language != 'EN' ? (this.state.CN['DeliveryInformation' + name] && this.state.CN['DeliveryInformation' + name]['focusIndex'] ? this.state.CN['DeliveryInformation' + name]['focusIndex'] : '') : (this.state.CN['DeliveryInformation' + name] && this.state.EN['DeliveryInformation' + name]['focusIndex'] ? this.state.EN['DeliveryInformation' + name]['focusIndex'] : '')]
		}
		// 获取焦点
		changeFocus = (num) => {
			setTimeout(() => {
				this.state.refs['ref' + (parseInt(num) + 1)].current.focus();
			}, 300)
		}
		//获取下拉框
		getSelect = () => {
			let data = {}
			data = {
				params: [{
				}]
			}
			$http.post('urlS', this, {
				code: "04110019",
				data: data,
				success: function (res) {
					if (res.errorCode === '0') {
						this.setState({
							baseRuptureOfMembranes: res.fetalmembranerupture.data,
							baseFluidCharacteristics: res.amnioticfluidtraits.data,
							basePlacentalDeliveryMethods: res.deliveredWay.data,
							basePlacentalIntegrity: res.placentalIntegrity.data,
							baseRuptureOfPerineum: res.perinealRupture.data,
							baseEpisiotomy: res.perineumCut.data,
							baseSutureMethod: res.sutureMethod.data,
							baseCervicalLaceration: res.cervicalLaceration.data,
							baseFundusHeight: res.fundusHeight.data,
							baseUterineContractions: res.uterineContractions.data,
						})
					}
				}
			})
		}
		//保存信息
		saveForm = () => {
			this.props.form.validateFields((err, values) => {
				let data = {}
				data = {
					params: [{
						admID: this.state.admID ? this.state.admID : '',
						parturientTime: values.deliveryTime ? moment(values.deliveryTime).format('HH:mm') : "",
						embryolemmaBurst: values.ruptureOfMembranes ? values.ruptureOfMembranes : "",
						characterFluid: values.afluidCharacteristics ? values.afluidCharacteristics : "",
						characterAmount: values.afluidMl ? values.afluidMl : "",
						cervixTime: values.fullOpenTime ? moment(values.fullOpenTime).format('HH:mm') : "",
						fetusChildbirthTime: values.fetalDeliveryTime ? moment(values.fetalDeliveryTime).format('HH:mm') : "",
						placentaChildbirthTime: values.placentalDeliveryTime ? moment(values.placentalDeliveryTime).format('HH:mm') : "",
						placentaChildbirthMethod: values.placentalDeliveryMethods ? values.placentalDeliveryMethods : "",
						fBirthProcessDuration: values.firstTime ? values.firstTime : "",
						sBirthProcessDuration: values.secondTime ? values.secondTime : "",
						tBirthProcessDuration: values.thirdTime ? values.thirdTime : "",
						allBirthProcessDuration: values.totalTime ? values.totalTime : "",
						integrity: values.placentalIntegrity ? values.placentalIntegrity : "",
						length: values.placentaLength ? values.placentaLength : "",
						width: values.placentaWidth ? values.placentaWidth : "",
						deep: values.placentaHeight ? values.placentaHeight : "",
						weight: values.ruptureOfMembranes ? values.ruptureOfMembranes : "",
						fetalMembranesIntegrity: values.ruptureOfMembranes ? values.ruptureOfMembranes : "",
						funicleLength: values.ruptureOfMembranes ? values.ruptureOfMembranes : "",
						perinealRupture: values.ruptureOfPerineum ? values.ruptureOfPerineum : "",
						episiotomy: values.episiotomy ? values.episiotomy : "",
						sutureMethod: values.sutureMethod ? values.sutureMethod : "",
						sutureNumbers: values.numberOfStitches ? values.numberOfStitches : "",
						cervicalLaceration: values.cervicalLaceration ? values.cervicalLaceration : "",
						lacerationDepth: values.lacerationDepth ? values.lacerationDepth : "",
						blood: values.blood ? values.blood : "",
						fundusHeight: values.fundusHeight ? values.fundusHeight : "",
						uterineContractions: values.uterineContractions ? values.uterineContractions : "",
						bloodPressure: values.bloodPressure ? values.bloodPressure : "",
					}]
				}
				$http.post('urlS', this, {
					code: "04110016",
					data: data,
					success: function (res) {
						if (res.errorCode === '0') {
							message.success("保存成功")
							this.getAllInfo()
						}
					}
				})
			})
		}
		clearValue = (flag, num, value, timeString) => {
			if (value == undefined) {
				this.props.form.setFieldsValue({ flag: undefined })
			}
			if ((this.state.registerInfo.hasOwnProperty('childbirthRegDate')) && (this.state.registerInfo.hasOwnProperty('childbirthRegTime'))) {
				let startDate = moment(new Date()).add('year', 0).format("YYYY-MM-DD");
				let selectValue = moment(startDate + " " + timeString + ":00")
				//宫口全开修改默认计算出第一产程时长
				if (flag === 'fullOpenTime') {
					let childbirthRegDateTime = moment(this.state.registerInfo.childbirthRegDate + " " + this.state.registerInfo.childbirthRegTime)
					let slotTime = selectValue.diff(childbirthRegDateTime, 'minute')
					this.setState({ firstTime: slotTime })
					this.props.form.setFieldsValue({ 'firstTime': this.formatTime(slotTime) })
					this.props.form.setFieldsValue({ 'totalTime': this.formatTime(slotTime + this.state.secondTime + this.state.thirdTime) })
				}
				//胎儿娩出
				if (flag === 'fetalDeliveryTime') {
					let secondStartTime = this.props.form.getFieldValue('fullOpenTime')
					if (!Util.isEmpty(secondStartTime)) {
						let secondSlotTime = selectValue.diff(moment(startDate + ' ' + secondStartTime.format('HH:mm')), 'minute')
						this.setState({ secondTime: secondSlotTime })
						this.props.form.setFieldsValue({ 'secondTime': this.formatTime(secondSlotTime) })
						this.props.form.setFieldsValue({ 'totalTime': this.formatTime(secondSlotTime + this.state.firstTime + this.state.thirdTime) })
					}
				}
				//胎盘娩出
				if (flag === 'placentalDeliveryTime') {
					let thirdStartTime = this.props.form.getFieldValue('fetalDeliveryTime')
					if (!Util.isEmpty(thirdStartTime)) {
						let thirdSlotTime = selectValue.diff(moment(startDate + ' ' + thirdStartTime.format('HH:mm')), 'minute')
						this.setState({ thirdTime: thirdSlotTime })
						this.props.form.setFieldsValue({ 'thirdTime': this.formatTime(thirdSlotTime) })
						this.props.form.setFieldsValue({ 'totalTime': this.formatTime(thirdSlotTime + this.state.firstTime + this.state.secondTime) })
					}
				}
			}
			setTimeout(() => {
				this.state.refs['ref' + (parseInt(num) + 1)].current.focus();
			}, 300)
		}

		changeTotalTime = (slotTime) => {

		}

		formatTime = (slotTime) => {
			let statusMinute = "";
			if (slotTime !== "0" && slotTime !== "" && slotTime !== null) {
				let day = parseInt(slotTime / 60 / 24);
				let hour = parseInt(slotTime / 60 % 24);
				let min = parseInt(slotTime % 60);
				if (day > 0) { statusMinute = day + "天"; }
				if (hour > 0) { statusMinute += hour + "小时"; }
				if (min > 0) { statusMinute += parseFloat(min) + "分钟"; }
			}
			return statusMinute
		} 
		render() {
			const { getFieldDecorator } = this.props.form;
			const {
				info,
				baseParms,
				baseRuptureOfMembranes,
				baseFluidCharacteristics,
				basePlacentalDeliveryMethods,
				basePlacentalIntegrity,
				baseRuptureOfPerineum,
				baseEpisiotomy,
				baseSutureMethod,
				baseCervicalLaceration,
				baseFundusHeight,
				baseUterineContractions
			} = this.state;
			//胎膜破裂 ruptureOfMembranes
			let ruptureOfMembranes = []
			baseRuptureOfMembranes && baseRuptureOfMembranes.map(item => {
				ruptureOfMembranes.push(<Option key={item.id} disabled={item.disabled} value={item.id} title={item.descripts + '^' + item.descriptsSPCode}>{item.descripts}</Option>)
			})
			//羊水性状 afluidCharacteristics
			let afluidCharacteristics = []
			baseFluidCharacteristics && baseFluidCharacteristics.map(item => {
				afluidCharacteristics.push(<Option key={item.id} disabled={item.disabled} value={item.id} title={item.descripts + '^' + item.descriptsSPCode}>{item.descripts}</Option>)
			})
			//胎盘娩出方式 placentalDeliveryMethods
			let placentalDeliveryMethods = []
			basePlacentalDeliveryMethods && basePlacentalDeliveryMethods.map(item => {
				placentalDeliveryMethods.push(<Option key={item.id} disabled={item.disabled} value={item.id} title={item.descripts + '^' + item.descriptsSPCode}>{item.descripts}</Option>)
			})
			//胎盘完整性 placentalIntegrity
			let placentalIntegrity = []
			basePlacentalIntegrity && basePlacentalIntegrity.map(item => {
				placentalIntegrity.push(<Option key={item.id} disabled={item.disabled} value={item.id} title={item.descripts + '^' + item.descriptsSPCode}>{item.descripts}</Option>)
			})
			//会阴破裂 ruptureOfPerineum
			let ruptureOfPerineum = []
			baseRuptureOfPerineum && baseRuptureOfPerineum.map(item => {
				ruptureOfPerineum.push(<Option key={item.id} disabled={item.disabled} value={item.id} title={item.descripts + '^' + item.descriptsSPCode}>{item.descripts}</Option>)
			})
			//会阴切开 episiotomy
			let episiotomy = []
			baseEpisiotomy && baseEpisiotomy.map(item => {
				episiotomy.push(<Option key={item.id} disabled={item.disabled} value={item.id} title={item.descripts + '^' + item.descriptsSPCode}>{item.descripts}</Option>)
			})
			//缝合方式 sutureMethod
			let sutureMethod = []
			baseSutureMethod && baseSutureMethod.map(item => {
				sutureMethod.push(<Option key={item.id} disabled={item.disabled} value={item.id} title={item.descripts + '^' + item.descriptsSPCode}>{item.descripts}</Option>)
			})
			//宫颈裂伤 cervicalLaceration
			let cervicalLaceration = []
			baseCervicalLaceration && baseCervicalLaceration.map(item => {
				cervicalLaceration.push(<Option key={item.id} disabled={item.disabled} value={item.id} title={item.descripts + '^' + item.descriptsSPCode}>{item.descripts}</Option>)
			})
			//宫底高度 fundusHeight
			let fundusHeight = []
			baseFundusHeight && baseFundusHeight.map(item => {
				fundusHeight.push(<Option key={item.id} disabled={item.disabled} value={item.id} title={item.descripts + '^' + item.descriptsSPCode}>{item.descripts}</Option>)
			})
			//宫缩情况 uterineContractions
			let uterineContractions = []
			baseUterineContractions && baseUterineContractions.map(item => {
				uterineContractions.push(<Option key={item.id} disabled={item.disabled} value={item.id} title={item.descripts + '^' + item.descriptsSPCode}>{item.descripts}</Option>)
			})
			return (
				<div className="DeliveryInformationDom">
					{/* <Row style={{ border: "1px solid #cccccc", height: "15%", height: '45px', textAlign: 'center', lineHeight: '45px' }}>
                        <PatientInfo ref="PatientInfo" admID={this.state.admID} />
          </Row> */}
					<Row className="title" style={{ height: "15%", textAlign: 'left', height: "45px", lineHeight: '45px' }}>
						<Col>
							<PatientInfo admID={this.state.admID} />
						</Col>
					</Row>
					<Row>
						<Col>
							<p style={{ borderTop: "1px solid #cccccc" }}>
								{this.display('LaborProcess')}
							</p>
						</Col>
					</Row>
					<Divider />
					{
						this.state.refFalg ? (
							<Form>
								<Row gutter={60} style={{ margin: '0' }}>
									<Col span={4}>
										<Form.Item label={this.display('LaborTime')} {...formItemLayout}>
											<Col>
												{getFieldDecorator('deliveryTime', {
													initialValue: info.parturientTime ? moment(info.parturientTime, 'HH:mm') : undefined,
												})(
													<TimePicker
														style={{ width: '100%' }}
														separator=":"
														showToday
														format={'HH:mm'}
														// onOpenChange={this.handleOnOpenChangeStart}  
														onChange={this.clearValue.bind(this, "deliveryTime", this.getIndex('LaborTime'))}
														placeholder="请选择时间"
													/>
												)}
											</Col>
										</Form.Item>
									</Col>
									<Col span={4}>
										<FormItem label={this.display('RupturedMembrane')} {...formItemLayout}>
											{getFieldDecorator('ruptureOfMembranes', {
												initialValue: info.embryolemmaBurst ? info.embryolemmaBurst : undefined,
												rules: [{ required: false, message: '' }]
											})(
												<Select
													showSearch
													allowClear
													optionFilterProp="title"
													style={{ width: '100%' }}
													ref={this.state.refs['ref' + this.getIndex('RupturedMembrane')]}
													// onFocus={this.state["refs." + this.getIndex('RupturedMembrane')]}
													onSelect={() => this.changeFocus(this.getIndex('RupturedMembrane'))}
												>
													{ruptureOfMembranes}
												</Select>
											)}
										</FormItem>
									</Col>
									<Col span={4}>
										<FormItem label={this.display('Amniotic')} {...formItemLayout}>
											{getFieldDecorator('afluidCharacteristics', {
												initialValue: info.characterFluid ? info.characterFluid : undefined,
												rules: [{ required: false, message: '' }]
											})(
												<Select
													showSearch
													allowClear
													optionFilterProp="title"
													style={{ width: '100%' }}
													ref={this.state.refs['ref' + this.getIndex('Amniotic')]}
													// onFocus={this.state["refs." + this.getIndex('Amniotic')]}
													onSelect={() => this.changeFocus(this.getIndex('Amniotic'))}
												>
													{afluidCharacteristics}
												</Select>
											)}
										</FormItem>
									</Col >
									<Col span={4}>
										<FormItem label={this.display('AmnioticFluid')} {...formItemLayout}>
											{getFieldDecorator('afluidMl', {
												initialValue: info.characterAmount ? info.characterAmount : undefined,
												rules: [{ required: false, message: '' }],
												getValueFromEvent: (event) => {
													return event.target.value.replace(/[^0-9.]/g, '')
												},
											})(
												<Input 
													ref={this.state.refs['ref' + this.getIndex('AmnioticFluid')]}
													onPressEnter={() => this.changeFocus(this.getIndex('AmnioticFluid'))}
												/>
											)}
										</FormItem>
									</Col >
									<Col span={4}>
										<Form.Item label={this.display('MiyaguchiFullOpenTime')} {...formItemLayout}>
											{getFieldDecorator('fullOpenTime', {
												initialValue: info.cervixTime ? moment(info.cervixTime, 'HH:mm') : undefined,
											})(
												<TimePicker
													separator=":"
													showToday
													format={'HH:mm'}
													// onOpenChange={this.handleOnOpenChangeStop} 
													onChange={this.clearValue.bind(this, "fullOpenTime", this.getIndex('MiyaguchiFullOpenTime'))}
													ref={this.state.refs['ref' + this.getIndex('MiyaguchiFullOpenTime')]}
													style={{ width: '100%' }}
													placeholder="请选择时间"
												/>
											)}
										</Form.Item>
									</Col>
									<Col span={4}>
										<Form.Item label={this.display('FetalDeliveryTime')} {...formItemLayout}>
											{getFieldDecorator('fetalDeliveryTime', {
												initialValue: info.fetusChildbirthTime ? moment(info.fetusChildbirthTime, 'HH:mm') : undefined,
											})(
												<TimePicker
													separator=":"
													showToday
													format={'HH:mm'}
													ref={this.state.refs['ref' + this.getIndex('FetalDeliveryTime')]}
													onChange={this.clearValue.bind(this, "fetalDeliveryTime", this.getIndex('FetalDeliveryTime'))}
													style={{ width: '100%' }}
													placeholder="请选择时间"
												/>
											)}
										</Form.Item>
									</Col>
								</Row>
								<Row gutter={60} style={{ margin: '0' }}>
									<Col span={4}>
										<Form.Item label={this.display('PlacentaBirthTime')} {...formItemLayout}>
											{getFieldDecorator('placentalDeliveryTime', {
												initialValue: info.placentaChildbirthTime ? moment(info.placentaChildbirthTime, 'HH:mm') : undefined,
											})(
												<TimePicker
													separator=":"
													showToday
													format={'HH:mm'}
													ref={this.state.refs['ref' + this.getIndex('PlacentaBirthTime')]}
													onChange={this.clearValue.bind(this, "placentalDeliveryTime", this.getIndex('PlacentaBirthTime'))}
													style={{ width: '100%' }}
													placeholder="请选择时间"
												/>
											)}
										</Form.Item>
									</Col>
									<Col span={4}>
										<FormItem label={this.display('PlacentaDeliveryMethod')} {...formItemLayout}>
											{getFieldDecorator('placentalDeliveryMethods', {
												initialValue: info.placentaChildbirthMethod ? info.placentaChildbirthMethod : undefined,
												rules: [{ required: false, message: '' }]
											})(
												<Select
													showSearch
													allowClear
													optionFilterProp="title"
													style={{ width: '100%' }}
													ref={this.state.refs['ref' + this.getIndex('PlacentaDeliveryMethod')]}
													onSelect={() => this.changeFocus(this.getIndex('PlacentaDeliveryMethod'))}
												>
													{placentalDeliveryMethods}
												</Select>
											)}
										</FormItem>
									</Col >
									<Col span={4}>
										<FormItem label={this.display('DurationOfTheFirstLabor')} {...formItemLayout}>
											{getFieldDecorator('firstTime', {
												initialValue: info.fBirthProcessDuration ? info.fBirthProcessDuration : undefined,
												rules: [{ required: false, message: '' }],
												// getValueFromEvent: (event) => {
												//   return event.target.value.replace(/[^0-9.]/g, '')
												// },
											})(
												<Input ref={this.state.refs['ref' + this.getIndex('DurationOfTheFirstLabor')]}
												onPressEnter={() => this.changeFocus(this.getIndex('DurationOfTheFirstLabor'))}/>
											)}
										</FormItem>
									</Col >
									<Col span={4}>
										<FormItem label={this.display('DurationOfTheSecondLabor')} {...formItemLayout}>
											{getFieldDecorator('secondTime', {
												initialValue: info.sBirthProcessDuration ? info.sBirthProcessDuration : undefined,
												rules: [{ required: false, message: '' }],
												// getValueFromEvent: (event) => {
												//   return event.target.value.replace(/[^0-9.]/g, '')
												// },
											})(
												<Input ref={this.state.refs['ref' + this.getIndex('DurationOfTheSecondLabor')]}
												onPressEnter={() => this.changeFocus(this.getIndex('DurationOfTheSecondLabor'))}/>
											)}
										</FormItem>
									</Col >
									<Col span={4}>
										<FormItem label={this.display('DurationOfTheThirdLabor')} {...formItemLayout}>
											{getFieldDecorator('thirdTime', {
												initialValue: info.tBirthProcessDuration ? info.tBirthProcessDuration : undefined,
												rules: [{ required: false, message: '' }],
												// getValueFromEvent: (event) => {
												//   return event.target.value.replace(/[^0-9.]/g, '')
												// },
											})(
												<Input ref={this.state.refs['ref' + this.getIndex('DurationOfTheThirdLabor')]}
												onPressEnter={() => this.changeFocus(this.getIndex('DurationOfTheThirdLabor'))}/>
											)}
										</FormItem>
									</Col >
									<Col span={4}>
										<FormItem label={this.display('TotalLaborDuration')} {...formItemLayout}>
											{getFieldDecorator('totalTime', {
												initialValue: info.allBirthProcessDuration ? info.allBirthProcessDuration : undefined,
												rules: [{ required: false, message: '' }]
											})(
												<Input ref={this.state.refs['ref' + this.getIndex('TotalLaborDuration')]}
												onPressEnter={() => this.changeFocus(this.getIndex('TotalLaborDuration'))}/>
											)}
										</FormItem>
									</Col >
								</Row>
								<Row>
									<Col>
										<p>
											{this.display('AttachmentInspection')}
										</p>
									</Col>
								</Row>
								<Divider />
								<Row gutter={60} style={{ margin: '0' }}>
									<Col span={4}>
										<FormItem label={this.display('PlacentalIntegrity')} {...formItemLayout}>
											{getFieldDecorator('placentalIntegrity', {
												initialValue: info.integrity ? info.integrity : undefined,
												rules: [{ required: false, message: '' }]
											})(
												<Select
													showSearch
													allowClear
													optionFilterProp="title"
													style={{ width: '100%' }}
													onSelect={() => this.changeFocus(this.getIndex('PlacentalIntegrity'))}
													ref={this.state.refs['ref' + this.getIndex('PlacentalIntegrity')]}
												>
													{placentalIntegrity}
												</Select>
											)}
										</FormItem>
									</Col >
									<Col span={4}>
										<FormItem label={this.display('PlacentalLength')} {...formItemLayout}>
											{getFieldDecorator('placentaLength', {
												initialValue: info.length ? info.length : undefined,
												rules: [{ required: false, message: '' }],
												getValueFromEvent: (event) => {
													return event.target.value.replace(/[^0-9.]/g, '')
												},
											})(
												<Input ref={this.state.refs['ref' + this.getIndex('PlacentalLength')]}
												onPressEnter={() => this.changeFocus(this.getIndex('PlacentalLength'))}/>
											)}
										</FormItem>
									</Col >
									<Col span={4}>
										<FormItem label={this.display('PlacentalWidth')} {...formItemLayout}>
											{getFieldDecorator('placentaWidth', {
												initialValue: info.width ? info.width : undefined,
												rules: [{ required: false, message: '' }],
												getValueFromEvent: (event) => {
													return event.target.value.replace(/[^0-9.]/g, '')
												},
											})(
												<Input ref={this.state.refs['ref' + this.getIndex('PlacentalWidth')]}
												onPressEnter={() => this.changeFocus(this.getIndex('PlacentalWidth'))}/>
											)}
										</FormItem>
									</Col >
									<Col span={4}>
										<FormItem label={this.display('PlacentalThickness')} {...formItemLayout}>
											{getFieldDecorator('placentaHeight', {
												initialValue: info.deep ? info.deep : undefined,
												rules: [{ required: false, message: '' }],
												getValueFromEvent: (event) => {
													return event.target.value.replace(/[^0-9.]/g, '')
												},
											})(
												<Input ref={this.state.refs['ref' + this.getIndex('PlacentalThickness')]}
												onPressEnter={() => this.changeFocus(this.getIndex('PlacentalThickness'))}/>
											)}
										</FormItem>
									</Col >
								</Row>
								<Row>
									<Col>
										<p>
											{this.display('BirthCheck')}
										</p>
									</Col>
								</Row>
								<Divider />
								<Row gutter={60} style={{ margin: '0' }}>
									<Col span={4}>
										<FormItem label={this.display('PerineumRupture')} {...formItemLayout}>
											{getFieldDecorator('ruptureOfPerineum', {
												initialValue: info.perinealRupture ? info.perinealRupture : undefined,
												rules: [{ required: false, message: '' }]
											})(
												<Select
													showSearch
													allowClear
													optionFilterProp="title"
													style={{ width: '100%' }}
													ref={this.state.refs['ref' + this.getIndex('PerineumRupture')]}
													onSelect={() => this.changeFocus(this.getIndex('PerineumRupture'))}
												>
													{ruptureOfPerineum}
												</Select>
											)}
										</FormItem>
									</Col >
									<Col span={4}>
										<FormItem label={this.display('PerinealIncision')} {...formItemLayout}>
											{getFieldDecorator('episiotomy', {
												initialValue: info.episiotomy ? info.episiotomy : undefined,
												rules: [{ required: false, message: '' }]
											})(
												<Select
													showSearch
													allowClear
													optionFilterProp="title"
													style={{ width: '100%' }}
													ref={this.state.refs['ref' + this.getIndex('PerinealIncision')]}
													onSelect={() => this.changeFocus(this.getIndex('PerinealIncision'))}
												>
													{episiotomy}
												</Select>
											)}
										</FormItem>
									</Col >
									<Col span={4}>
										<FormItem label={this.display('SutureMethod')} {...formItemLayout}>
											{getFieldDecorator('sutureMethod', {
												initialValue: info.sutureMethod ? info.sutureMethod : undefined,
												rules: [{ required: false, message: '' }]
											})(
												<Select
													showSearch
													allowClear
													optionFilterProp="title"
													style={{ width: '100%' }}
													ref={this.state.refs['ref' + this.getIndex('SutureMethod')]}
													onSelect={() => this.changeFocus(this.getIndex('SutureMethod'))}
												>
													{sutureMethod}
												</Select>
											)}
										</FormItem>
									</Col >
									<Col span={4}>
										<FormItem label={this.display('NumberOfStitches')} {...formItemLayout}>
											{getFieldDecorator('numberOfStitches', {
												initialValue: info.sutureNumbers ? info.sutureNumbers : undefined,
												rules: [{ required: false, message: '' }],
												getValueFromEvent: (event) => {
													return event.target.value.replace(/[^0-9]/g, '')
												},
											})(
												<Input ref={this.state.refs['ref' + this.getIndex('NumberOfStitches')]}
												onPressEnter={() => this.changeFocus(this.getIndex('NumberOfStitches'))}/>
											)}
										</FormItem>
									</Col >
									<Col span={4}>
										<FormItem label={this.display('CervicalLaceration')} {...formItemLayout}>
											{getFieldDecorator('cervicalLaceration', {
												initialValue: info.cervicalLaceration ? info.cervicalLaceration : undefined,
												rules: [{ required: false, message: '' }]
											})(
												<Select
													showSearch
													allowClear
													optionFilterProp="title"
													style={{ width: '100%' }}
													ref={this.state.refs['ref' + this.getIndex('CervicalLaceration')]}
													onSelect={() => this.changeFocus(this.getIndex('CervicalLaceration'))}
												>
													{cervicalLaceration}
												</Select>
											)}
										</FormItem>
									</Col >
									<Col span={4}>
										<FormItem label={this.display('CrackDepth')} {...formItemLayout}>
											{getFieldDecorator('lacerationDepth', {
												initialValue: info.lacerationDepth ? info.lacerationDepth : undefined,
												rules: [{ required: false, message: '' }],
												getValueFromEvent: (event) => {
													return event.target.value.replace(/[^0-9.]/g, '')
												},
											})(
												<Input ref={this.state.refs['ref' + this.getIndex('CrackDepth')]}
												onPressEnter={() => this.changeFocus(this.getIndex('CrackDepth'))}/>
											)}
										</FormItem>
									</Col >
								</Row>
								<Row>
									<Col>
										<p>
											{this.display('OtherInspections')}
										</p>
									</Col>
								</Row>
								<Divider />
								<Row gutter={60} style={{ margin: '0' }}>
									<Col span={4}>
										<FormItem label={this.display('PostpartumHemorrhage')} {...formItemLayout}>
											{getFieldDecorator('blood', {
												initialValue: info.blood ? info.blood : undefined,
												rules: [{ required: false, message: '' }],
												getValueFromEvent: (event) => {
													return event.target.value.replace(/[^0-9.]/g, '')
												},
											})(
												<Input ref={this.state.refs['ref' + this.getIndex('PostpartumHemorrhage')]}
												onPressEnter={() => this.changeFocus(this.getIndex('PostpartumHemorrhage'))}/>
											)}
										</FormItem>
									</Col >
									<Col span={4}>
										<FormItem label={this.display('PalaceHeight')} {...formItemLayout}>
											{getFieldDecorator('fundusHeight', {
												initialValue: info.fundusHeight ? info.fundusHeight : undefined,
												rules: [{ required: false, message: '' }]
											})(
												<Select
													showSearch
													allowClear
													optionFilterProp="title"
													style={{ width: '100%' }}
													ref={this.state.refs['ref' + this.getIndex('PalaceHeight')]}
													onSelect={() => this.changeFocus(this.getIndex('PalaceHeight'))}
												>
													{fundusHeight}
												</Select>
											)}
										</FormItem>
									</Col >
									<Col span={4}>
										<FormItem label={this.display('Contractions')} {...formItemLayout}>
											{getFieldDecorator('uterineContractions', {
												initialValue: info.uterineContractions ? info.uterineContractions : undefined,
												rules: [{ required: false, message: '' }]
											})(
												<Select
													showSearch
													allowClear
													optionFilterProp="title"
													style={{ width: '100%' }}
													ref={this.state.refs['ref' + this.getIndex('Contractions')]}
													onSelect={() => this.changeFocus(this.getIndex('Contractions'))}
												>
													{uterineContractions}
												</Select>
											)}
										</FormItem>
									</Col >
									<Col span={4}>
										<FormItem label={this.display('BloodPressure')} {...formItemLayout}>
											{getFieldDecorator('bloodPressure', {
												initialValue: info.bloodPressure ? info.bloodPressure : undefined,
												rules: [{ required: false, message: '' }],
												getValueFromEvent: (event) => {
													return event.target.value.replace(/[^0-9/]/g, '')
												},
											})(
												<Input ref={this.state.refs['ref' + this.getIndex('BloodPressure')]}
												onPressEnter={() => this.changeFocus(this.getIndex('BloodPressure'))}/>
											)}
										</FormItem>
									</Col >
								</Row>
							</Form>
						) : ''
					}
					< Row gutter={60} style={{ margin: '0', paddingLeft: "14px" }}>
						<Button type="primary" onClick={this.saveForm} disabled={this.state.saveFlag}>{this.display('Save')}</Button>
					</Row>
				</div >
			)
		}
	})
export default DeliveryInformation    