/** 
 * Creator:     JYW
 * CreatDate:   2019-03-22
 * descripts：  床位图组件
*/
import React, { Component } from 'react';
import { Tabs, Row, Col, message, Button, Divider, Radio, Input, Select } from 'antd';
import Bed from './Bed';
// import Scrollbar from 'react-scrollbar';
import PatientProcess from '../Patient/PatientProcess';
import WaitRooms from './WaitRooms';
import TransLoc from '../Trans/TransLoc';
import Discharge from '../Discharge/Discharge';
import DivideBed from './DivideBed';
import Memorandum from './Memorandum';
import DaytimePat from './DaytimePat';
import ChildbirthRegister from '../Childbirth/ChildbirthRegister';
import { $http } from '../../../containers/config/https';
import asyncComponent from '../../../routers/AsyncComponent.js';
import './CSS/bedchart.less';
import ObstetricalDepartment from './ObstetricalDepartment';
import RightMenu from './RightMenu.jsx';
import { Util } from 'tools/index';

let user;
const TabPane = Tabs.TabPane;
const Option = Select.Option;

class BedChart extends Component {
	constructor({ history }) {
		super();
		user = window.sessionStorage.userData ? JSON.parse(window.sessionStorage.userData) : {};
		this.history = history;
		this.state = {
			isObstetricsDep: '',
			wardList: [],
			locID: user.locID,
			admID: '',
			patID: '',
			selectBedID: '',
			otherSelectID: '',
			mouseInID: '',
			buttondisplay: "none",
			patStatus: '',
			wardPatientInfo: [],
			bedIcon: [],
			waitPatList: [],
			briefInformation: false,
			briefBtnTitle: "简要",
			patientLoading: true,
			memorandumloading: true,
			wardInfoLoading: true,
			roomLoading: true,
			waitroomsloading: true,
			clickIconId: "ALL",
			quickBtn: "ALL",
			activityGroup: "0",
			searchValue: '',
			searchFlag: false,
			birthVisible: false,
			admDiag: '',
			groupDesc: user.groupDesc,
			adminID: '',
			menuPage: '',
			mouseInAdmID: '',
			mouseInPatID: '',
			floorList: [],
			floorFlag: false,
			floorValue: '',
			QRCodeVisible: false,
			preSeparationBedFlag: '', // 预分床标志
		}
		this.state.timer = setInterval(() => {
			this.setState({
				waitroomsloading: true,
			})
			this.getPatients();
		}, 120000)
	}

	componentDidMount() {
		sessionStorage.removeItem('updateMessage')
		this.getLocLinkLoc();
		// 获取用户分组
		this.getUserMedGroup();
		this.getBedFloor();
		document.addEventListener('contextmenu', this._handleContextMenu);
		document.addEventListener('click', this._handleClick);
		document.addEventListener('scroll', this._handleScroll);
	}

	componentWillUnmount() {
		this.setState = (state, callback) => {
			return
		}
		clearInterval(this.state.timer);
		document.removeEventListener('contextmenu', this._handleContextMenu);
		document.removeEventListener('click', this._handleClick);
		document.removeEventListener('scroll', this._handleScroll);
	}

	_handleContextMenu = (event) => {
		// if (this.state.groupDesc.indexOf("护士") < 0) {
		this.rightMenuRef._handleContextMenu(event)
		// }
	}

	_handleClick = (event) => {
		this.rightMenuRef._handleClick(event)

	}

	_handleScroll = () => {
		this.rightMenuRef._handleScroll()
	}

	updateData = (...args) => {
		this.setState(...args);
		if (args[0].admID !== undefined) {
			// sessionStorage.setItem('admID', args[0].admID);
			// sessionStorage.setItem('patID', args[0].patID);
			var patientData = {}
			patientData = {
				admID: args[0].admID,
				patID: args[0].patID,
			}
			sessionStorage.setItem('patientData', JSON.stringify(patientData));
		}
	}

	getData = () => {
		return this.state;
	}

	onTimeLineClick = (e) => {
	}

	onLiClick = (e) => {
		if (this.state.otherSelectID === '') {
			this.setState({ selectBedID: '', mouseInID: '', otherSelectID: e.target.value });
		} else {
			if (this.state.otherSelectID !== e.target.value) {
				this.setState({ otherSelectID: e.target.value });
			} else {
				this.setState({ otherSelectID: '' });
			}
		}
	}

	getLocLinkLoc = () => {
		let data = {
			params: [{
				type: '',
				hospID: user.hospID,
				locID: user.locID,
				detailFlag: '',
				linkFlag: "1",
				docFlag: ''
			}]
		}
		$http.post('urlDeault', this, {
			code: "04020008",
			data: data,
			success: (res) => {
				if (+res.errorCode === 0) {
					let wardList = []
					for (let i = 0; i < res.result.Data.length; i++) {
						let obj = res.result.Data[i];
						if (obj.locTypeCode === "W") {
							wardList.push(obj);
						}
						for (let j = 0; j < obj.linkLoc.length; j++) {
							let linkObj = obj.linkLoc[j];
							if (linkObj.locTypeCode === "W") {
								wardList.push(linkObj);
							}
						}

					}
					let locID = wardList[0].id;
					this.setState({
						wardList: wardList,
						locID: locID,
					}, () => {
						this.state.child.getRooms();
						this.getPatients();
					});
				}
			}
		})
	}

	getUserMedGroup = () => {
		let data = {
			params: [{
				userID: user.userID,
				locID: user.locID
			}]
		}
		$http.post('urlDeault', this, {
			code: "01040093",
			data: data,
			success: (res) => {
				if (+res.errorCode === 0) {
					const medGroup = res.result;
					if (medGroup.length > 0) {
						this.onGroupChange(medGroup[0].medGroupLogID)
					}
					this.setState({ isObstetricsDep: res.isObstetricsDep })
				}
			}
		})
	}

	// 获取床位所在楼层
	getBedFloor = () => {
		let data = {
			params: [{}]
		}
		$http.post('urlDeault', this, {
			code: "04020024",
			data: data,
			success: (res) => {
				if (+res.errorCode === 0) {
					let result = res.result
					if (result.data.length > 1) {
						this.setState({ floorList: result.data, floorValue: result.defaultFloor, floorFlag: true })
					}
				}
			}
		})
	}

	getPatients = () => {
		let data = {
			params: [{
				wardID: this.state.locID,
			}]
		}
		$http.post('urlDeault', this, {
			code: "04020004",
			data: data,
			success: (res) => {
				if (+res.errorCode === 0) {
					this.setState({
						wardPatientInfo: res.result.bedList,
						bedIcon: res.result.bedIcon,
						patientLoading: false,
						admDiag: res.result.admDiag
					});
				}
			}
		})
	}

	onBriefBtnClick = () => {
		let briefInformation = this.state.briefInformation;
		let briefBtnTitle = '';
		if (briefInformation) {
			briefBtnTitle = "简要";
		}
		else {
			briefBtnTitle = "详情";
		}
		this.setState({
			admID: '',
			patID: '',
			selectBedID: '',
			otherSelectID: '',
			mouseInID: '',
			//clickIconId: "ALL",
			briefInformation: !briefInformation,
			briefBtnTitle: briefBtnTitle
		});
		// sessionStorage.setItem('admID', '');
		// sessionStorage.setItem('patID', '');
		var patientData = {}
		patientData = {
			admID: '',
			patID: '',
		}
		sessionStorage.setItem('patientData', JSON.stringify(patientData));
	}

	/**
	 * 转移按钮事件
	 * 
	 */
	onTransBtnClick = () => {
		if (this.state.patStatus === "D") {
			message.warning("患者已做医疗结算!");
			return;
		}
		if (this.state.patStatus === "N") {
			message.warning("患者已出院!");
			return;
		}
		if (this.state.patStatus === "P") {
			message.warning("预约患者不能进行此操作");
			return;
		}
		if (this.state.patStatus === "IO") {
			message.warning("日间病房患者,请先办理入院");
			return;
		}
		if (this.state.patStatus === "I") {
			message.warning("患者未住进该病区,不能直接转出");
			return;
		}

		if (this.state.admID === '') {
			message.warning("请先选中患者！");
			return;
		}
		this.refs.TransLoc.setState({
			visible: true,
			admID: this.state.admID,
			patStatus: this.state.patStatus,
		})
		this.refs.TransLoc.getTransInfo();
	}

	/**
	 * 出院按钮事件
	 * 
	 */
	onDisBtnClick = () => {
		if ((this.state.patStatus == "I") || (this.state.patStatus == "O") || (this.state.patStatus == "IO")) {
			message.warning("患者不能进行此操作");
			return;
		}
		if ((this.state.admID === '') || (this.state.admID === undefined)) {
			message.warning("请先选中患者！");
			return;
		}
		// this.refs.Discharge.setState({
		// 	visible: true,
		// 	admID: this.state.admID,
		// })
		// this.refs.Discharge.getPatientInfo(this.state.admID);
		// this.refs.Discharge.getDisCondition();
		this.refs.Discharge.showModal(this.state.admID);
	}

	onDivideBedBtnClick = () => {
		if (this.state.admID === '') {
			message.warning("请先选中患者！");
			return;
		}
		this.refs.DivideBed.setState({
			visible: true,
			admID: this.state.admID,
			patStatus: this.state.patStatus,
		}, () => {
			this.refs.DivideBed.getDivideInfo();
		})
	}

	visibleBed = (bedInfo) => {
		const searchValue = this.state.searchValue;
		if ((this.state.searchFlag) && (searchValue != '')) {
			if (bedInfo.patInfo.admInfo === undefined) return false;
			if ((bedInfo.patInfo.basicInfo.patName.indexOf(searchValue) < 0) && (bedInfo.patInfo.basicInfo.patNo.indexOf(searchValue) < 0) && (bedInfo.bedcode.indexOf(searchValue) < 0) && (bedInfo.patInfo.admInfo.admDocDesc.indexOf(searchValue) < 0) && (bedInfo.patInfo.admInfo.admNurDesc.indexOf(searchValue) < 0)) return false
		}
		if ((this.state.floorFlag) && (this.state.floorValue != '') && (this.state.floorValue != undefined)) {
			if (bedInfo.floorID != this.state.floorValue) return false
		}
		if ((bedInfo.unavailReason !== '') && ((this.state.clickIconId !== "ALL") & (this.state.clickIconId !== "onBed"))) { return false }
		let visible = true;
		if ((this.state.clickIconId === "emptyBed") && (bedInfo.patInfo.length === 0)) {
			return visible;
		}
		if (this.state.clickIconId === "ALL") {
			return visible;
		}
		if ((this.state.clickIconId === "onBed") && (!(Util.isEmpty(bedInfo.patInfo)))) {
			return visible;
		}
		let patIcon = [];
		if (bedInfo.patInfo.admInfo !== undefined) {
			patIcon = bedInfo.patInfo.admInfo.admIcon;
		}
		//clickIconId
		let findFlag = false;
		for (let i = 0; i < patIcon.length; i++) {
			if ((patIcon[i].id + '') === this.state.clickIconId) {
				findFlag = true;
			}
		}
		if (this.state.clickIconId !== '') return findFlag
		return visible;
	}

	onQuickBtnClick = (e) => {
		let id = e.target.value;
		if (e.target.value === this.state.clickIconId) {
			id = '';
		}
		this.setState({
			clickIconId: id,
			quickBtn: id,
		})
	}

	onWardChange = (locID) => {
		this.setState({
			admID: '',
			patID: '',
			selectBedID: '',
			otherSelectID: '',
			mouseInID: '',
			locID: locID,
		}, () => {
			this.state.child.getRooms();
			this.getPatients();
		});
		var patientData = {}
		patientData = {
			admID: '',
			patID: '',
		}
		sessionStorage.setItem('patientData', JSON.stringify(patientData));
	}

	onFloorChange = (floorValue) => {
		this.setState({
			floorValue,
			floorFlag: floorValue ? true : false
		})
	}

	onGroupChange = (groupIndex) => {
		this.setState({
			activityGroup: groupIndex + '',
		});
	}

	refreshPage = () => {
		this.getLocLinkLoc();
		this.setState({
			roomLoading: true,
		})
	}

	//患者ID/床号/姓名(回车查询)
	onSearchClick = (e) => {
		this.setState({
			searchFlag: true,
		})
	}

	//查询输入框改变
	onSearchChange = (e) => {
		this.setState({
			searchFlag: false,
			searchValue: e.target.value,
		})
	}

	//入病房
	onInWard = (e) => {
		if ((this.state.patStatus != "IO") && (this.state.patStatus != "P")) {
			message.warning("该患者不可进行此操作");
			return;
		}
		let daytimeFlag = "1";
		if (this.state.patStatus == "P") {
			daytimeFlag = "0";
		}
		this.daytime.show(this.state.patID, this.state.admID, this.state.adminID, daytimeFlag);
		// let data = {
		//     'params': [{
		//         patID: this.state.patID,
		//         admID: this.state.admID,
		//         adminID: this.state.adminID,
		//     }]
		// };
		// $http.post('urlADS', this, {
		//     code: "03060024",
		//     data: data,
		//     success: function (res) {
		//         if (+res.errorCode == '0') {
		//             this.setState({
		//                 admID: '',
		//                 patID: '',
		//                 selectBedID: '',
		//                 otherSelectID: '',
		//                 mouseInID: '',
		//             }, () => {
		//                 this.state.child.getRooms();
		//                 this.getPatients();
		//             });
		//             var patientData = {}
		//             patientData = {
		//                 admID: '',
		//                 patID: '',
		//             }
		//             sessionStorage.setItem('patientData', JSON.stringify(patientData));
		//         }
		//     }
		// });
	}

	//入产房
	onChildbirth = (e) => {
		if ((this.state.patStatus != "I") && (this.state.patStatus != "A")) {
			message.warning("患者不能进行此操作");
			return;
		}
		if (this.state.admID == '') {
			message.warn("请选择患者！");
			return;
		}
		let data = {
			'params': [{
				admID: this.state.admID,
			}]
		};
		$http.post('urlADS', this, {
			code: "04110003",
			data: data,
			success: function (res) {
				if (+res.errorCode == '0') {
					this.setState({
						birthVisible: true,
					})
				}
			}
		});
	}

	//绑定等候区组件
	onRef = (child) => {
		this.setState({
			child: child,
		})
	}

	onRefDayTime = (ref) => {
		this.daytime = ref;
	}

	/**
	 * 跳转菜单
	 */
	gotoMenuPage = (page) => {
		this.setState({
			menuPage: page,
		}, () => {
			clearInterval(this.state.timer);
		})
	}

	/**
	 * 鼠标移出床位图
	 */
	onMouseLeave = () => {
	}

	/**
	 * 
	 * @param {关联右键菜单组件} ref 
	 */
	onRightMenuRef = (ref) => {
		this.rightMenuRef = ref;
	}

	/**
	* @ByShizi: 二维码操作
	* 需求 #1073
	* Create 2022-12-06
	* */
	handleQRCodeClick = () => {
		this.setState({ QRCodeVisible: !this.state.QRCodeVisible })
	}

	// 预分床
	handleSeparateBeds = () => {
		const { separateBedID } = this.state;
		this['bedRef0'] && this['bedRef0']?.handleSeparateBeds(separateBedID, 'before');
	}

	// 打印腕带
	handlePrintBedCard = (type) => {
		const { admID } = this.state;
		const { separateBedID } = this.state;
		// if (!separateBedID) {
		// 	message.error('请先分配临时床位!');
		// 	return;
		// }
		this['bedRef0'] && this['bedRef0']?.handlePrintBedCard(admID, type, separateBedID);
	}

	getBedList = (bedList) => {
		let filterList = bedList && Array.isArray(bedList) && bedList.filter(item => this.visibleBed(item));
		return filterList.map((item, index) => {
			return (this.state.isObstetricsDep == 'N' ? (
				<Col
					xxl={4}
					xl={6}
					lg={8}
					key={item.id}
					className={this.state.briefInformation ? 'bed itembrief' : 'bed item'}
				>
					<Bed
						BedInfo={item}
						briefInformation={this.state.briefInformation}
						selectBedID={this.state.selectBedID}
						admID={this.state.admID}
						updateData={this.updateData}
						getData={this.getData}
						patStatus={this.state.patStatus}
						getPatients={this.getPatients}
						locID={this.state.locID}
						child={this.state.child}
						history={this.props.history}
						gotoMenuPage={this.gotoMenuPage}
						onRef={ref => this['bedRef' + index] = ref}
					/>
				</Col>
			) : (
				<Col span={6}
					className={this.state.briefInformation ? 'bed itembrief' : 'bed item'}
				>
					<ObstetricalDepartment
						BedInfo={item}
						briefInformation={this.state.briefInformation}
						selectBedID={this.state.selectBedID}
						updateData={this.updateData}
						admDiag={this.state.admDiag}
						admID={this.state.admID}
						getPatients={this.getPatients}
						patStatus={this.state.patStatus}
						locID={this.state.locID}
						child={this.state.child}
						getData={this.getData}
						onRef={ref => this['bedRef' + index] = ref}
					/>
				</Col>
			))
		})
	}

	render() {
		const { QRCodeVisible, preSeparationBedFlag } = this.state;
		let ward = [];
		this.state.wardList.map((item) => {
			ward.push(<Option key={item.id} value={String(item.id)} title={item.descripts} role={item.descripts + '^' + item.descriptsSPCode}>{item.descripts}</Option>);
		})
		let floor = [];
		this.state.floorList.map((item) => {
			floor.push(<Option key={item.id} value={String(item.id)}>{item.descripts}</Option>);
		})
		let btnDis = true;
		if (this.state.groupDesc.indexOf("护士") < 0) {
			btnDis = false
		}
		const BarExtra = btnDis ?
			(
				<div style={{ textAlign: "right" }} className="bed">
					<Button
						className="DisBtn"
						onClick={this.onDisBtnClick}
						style={{ marginRight: "14px", padding: '0 7px' }}
					>
						{this.state.patStatus === "N" ? "召回" : "出院"}
					</Button>
					<Button
						className="TransBtn"
						onClick={this.onTransBtnClick}
						style={{ marginRight: "14px", padding: '0 7px' }}
					>
						转科
					</Button>
					{this.state.isObstetricsDep == 'Y' ? <Button
						className="TransBtn"
						onClick={this.onChildbirth}
						style={{ marginRight: "14px", padding: '0 7px' }}
					>
						入产房
					</Button> : ''}
					<Button
						className="TransBtn"
						onClick={this.onInWard}
						style={{ marginRight: "14px", padding: '0 7px' }}
					>
						登记
					</Button>
					<Button
						className="BriefBtn"
						onClick={this.onBriefBtnClick}
						style={{ marginRight: "14px", padding: '0 7px' }}
					>
						{this.state.briefBtnTitle}
					</Button>
				</div>
			) : (
				<div style={{ textAlign: "right" }} className="bed">
					<Button
						className="DisBtn"
						onClick={this.onDisBtnClick}
						style={{ marginRight: "14px", display: this.state.groupDesc.indexOf("医师") > -1 }}
					>
						{this.state.patStatus === "N" ? "召回" : "出院"}
					</Button>
					<Button
						className="BriefBtn"
						onClick={this.onBriefBtnClick}
						style={{ marginRight: "14px" }}
					>
						{this.state.briefBtnTitle}
					</Button>
				</div>);

		let bedGroup = [];
		this.state.wardPatientInfo.map(
			(item, groupIndex) => {
				bedGroup.push(
					<TabPane
						tab={item.descripts}
						key={item.id}
					>
						{
							<Row
								className="bed"
								style={{ height: "calc(100% - 55px)", overflowY: 'auto', paddingRight: '25px' }}
							>
								{(this.state.activityGroup === (item.id)) ? this.getBedList(this.state.wardPatientInfo[groupIndex]?.bedList || []) : ''}
							</Row>
						}
					</TabPane>
				)
			}
		)
		bedGroup.push(
			<TabPane
				tab="全部"
				key={this.state.wardPatientInfo.length + 1 + ''}
			>
				{
					<Row
						className="bed"
						style={{ height: 'calc(100% - 55px)', overflowY: 'auto', paddingRight: '25px' }}
					>
						{(this.state.activityGroup === ((this.state.wardPatientInfo.length + 1) + '')) ?
							this.state.wardPatientInfo.map((groupitem) => {
								return this.getBedList(groupitem?.bedList || []);
							})
							: ''
						}
					</Row>
				}
			</TabPane>)
		let Component = this.state.menuPage != '' ? asyncComponent(() => import('../../' + this.state.menuPage)) : '';
		return (this.state.menuPage != '' ? (<Component></Component>) :
			<div className="bedChart" style={{ height: "100%" }}>
				<Row style={{ height: "100%" }}>
					<Col span={3} className="bedChart-left">
						<Row style={{ height: "50px" }}>
							<Col span={24} style={{ height: "100%", textAlign: 'right' }}>
								<Select
									className="selection"
									style={{ width: '90%', height: '100%', }}
									value={this.state.locID}
									onChange={this.onWardChange}
									dropdownClassName="dropdownClassName"
								>
									{ward}
								</Select>
							</Col>
						</Row>
						<Row style={{ height: 'calc(100% - 50px)' }}>
							<Col span={24} style={{ height: "100%", width: '100%' }}>
								<WaitRooms
									selectBedID={this.state.selectBedID}
									admID={this.state.admID}
									key={user.locDr}
									roomLoading={this.state.roomLoading}
									reloading={this.state.waitroomsloading}
									updateData={this.updateData}
									getData={this.getData}
									onRef={this.onRef}
									getPatients={this.getPatients}
								/>
							</Col>
						</Row>
					</Col>
					<Col span={18} className="bedChart-center" >
						<Row style={{ lineHeight: "50px", borderBottom: '1px solid #cccccc', marginBottom: '2px' }}  >
							<Col span={8} style={{ height: '50px', padding: '0 7px' }} className="flex-align-items">
								<Radio.Group
									onChange={this.onQuickBtnClick} value={this.state.quickBtn}
								>
									<Radio value="ALL"
										key="ALL"
									>
										全部
									</Radio>
									{
										this.state.bedIcon.map(
											(button) => {
												return (
													<Radio value={button.id}
														key={button.id}
													>
														{
															button.descripts + "(" + button.number + ")"
														}
													</Radio>
												)
											}
										)
									}
								</Radio.Group>
								<Button
									ghost
									type="primary"
									size="small"
									onClick={this.handleQRCodeClick}
								>
									{QRCodeVisible ? '关闭' : '展示'}二维码
								</Button>
							</Col>
							<Col span={2}>
								{this.state.floorList.length > 0 ?
									<div>
										楼层：<Select
											allowClear
											style={{ width: '60px' }}
											value={this.state.floorValue}
											onChange={this.onFloorChange}
										>
											{floor}
										</Select>
									</div>
									: ''
								}
							</Col>
							<Col span={8} style={{ height: '32px' }}>
								<Divider style={{
									width: '21px',
									height: '5px',
									minWidth: '1px',
									position: "absolute",
									backgroundColor: "#EB2F96",
								}}>
								</Divider>
								<span style={{
									position: "absolute",
									left: '30px',
								}}>女</span>
								<Divider style={{
									width: '21px',
									height: '5px',
									left: '50px',
									minWidth: '1px', position: "absolute",
									backgroundColor: "#40A9FF",
								}}></Divider>
								<span style={{
									position: "absolute",
									left: '75px',
								}}>男</span>
								<Divider style={{
									width: '21px',
									height: '5px',
									left: '100px',
									minWidth: '1px', position: "absolute",
									backgroundColor: "#A0D911",
								}}></Divider>
								<span style={{
									position: "absolute",
									left: '125px',
								}}>未知性别</span>
								<Divider style={{
									width: '21px',
									height: '5px',
									left: '190px',
									minWidth: '1px', position: "absolute",
									backgroundColor: "#722ED1",
								}}></Divider>
								<span style={{
									position: "absolute",
									left: '215px',
								}}>包床</span>
								<Input
									allowClear={true}
									onChange={this.onSearchChange}
									value={this.state.searchValue}
									placeholder="患者ID/床号/姓名/主管医生/主管护士"
									onPressEnter={this.onSearchClick}
									style={{
										width: '200px',
										left: '250px',
										top: '8px',
										minWidth: '1px',
										position: "absolute",
									}} />
							</Col>
							<Col span={6}>
								{BarExtra}
							</Col>
						</Row>
						<Row style={{ height: "calc(100% - 55px)" }} onMouseLeave={this.onMouseLeave}>
							<Col style={{ height: "100%" }} span={24} className="bedGroup">
								{
									this.state.wardPatientInfo.length < 2
										?
										(
											<Row className="bed" style={{ height: '100%', overflowY: 'auto', paddingRight: '25px', width: '100%' }} >
												{this.getBedList(this.state.wardPatientInfo.length === 1 ? (this.state.wardPatientInfo[0]?.bedList || []) : [])}
											</Row>
										)
										:
										(
											<Tabs tabPosition="left" tabBarStyle={{ width: '32px' }} onChange={this.onGroupChange} activeKey={this.state.activityGroup} >
												{bedGroup}
											</Tabs>
										)
								}
							</Col>
						</Row>
					</Col>
					<Col span={3} className="bedChart-right">
						<Row>
							<Col>
								<PatientProcess admID={this.state.admID} locID={this.state.locID} reloading={this.state.wardInfoLoading} />
							</Col>
						</Row>
						<Row style={{ height: 'calc(100% - 380px)' }}>
							<Memorandum handelThis={this} admID={this.state.admID} locID={this.state.locID} reloading={this.state.memorandumloading} />
						</Row>
					</Col>
				</Row>
				<DaytimePat getPatients={this.getPatients} updateData={this.updateData} onRef={this.onRefDayTime} child={this.state.child} ></DaytimePat>
				<TransLoc getPatients={this.getPatients} updateData={this.updateData} ref="TransLoc" key={Math.random()} child={this.state.child} ></TransLoc>
				<Discharge getPatients={this.getPatients} updateData={this.updateData} ref="Discharge" key={Math.random()} child={this.state.child} history={this.props.history} ></Discharge>
				<DivideBed getPatients={this.getPatients} updateData={this.updateData} ref="DivideBed" key={Math.random()} child={this.state.child} ></DivideBed>
				{this.state.isObstetricsDep == 'Y' ? (
					<ChildbirthRegister
						admID={this.state.admID}
						visible={this.state.birthVisible}
						onCancel={
							() => {
								this.setState({
									birthVisible: false,
								})
							}
						}
					/>
				) : ''}
				<RightMenu
					admID={this.state.mouseInAdmID}
					patID={this.state.mouseInPatID}
					preSeparationBedFlag={preSeparationBedFlag}
					history={this.props.history}
					onRef={this.onRightMenuRef}
					handleSeparateBeds={this.handleSeparateBeds}
					handlePrintBedCard={this.handlePrintBedCard}
				></RightMenu>
			</div>
		);
	}
};

export default BedChart;
