/**
 * 医嘱信息 -- 医嘱录入
 */

import React from 'react';
import {
	Card, Table, Input, Select, Spin, Col, Checkbox, Tabs, Modal, Row, AutoComplete, DatePicker, Button, Icon, Divider, message, Tree, Radio, Tooltip, TimePicker,
	Menu, Dropdown, Empty
} from 'antd';
import { Util, dayFormat, timeFormat, Keup, dateFormat } from 'tools/index';
import { $http } from 'containers/config/https';
import { $loopPrint } from 'pages/lodop/Common/Print.js';
import { sortableContainer, sortableElement } from 'react-sortable-hoc';
import store from 'store';
import moment from 'moment';
import CopyTextModal from './CopyTextModal';
import AddPackageModal from './AddPackageModal';
import ShowConfirmModal from './ShowConfirmModal';
import AddTemplateModal from './AddTemplateModal';
import ShowExamlistModal from './ShowExamlistModal';
import WrittenOrdersModal from './WrittenOrdersModal';
import BringMedicineModal from './BringMedicineModal';
import ShowCommonTableModal from './ShowCommonTableModal';
import ShowInsuMessageModal from './ShowInsuMessageModal';
import ShowInsuPackageModal from './ShowInsuPackageModal';
import ShowPosionStatusModal from './ShowPosionStatusModal';
import ShowEnterTreatmentModal from './ShowEnterTreatmentModal';
//  import DigitalKeyboard from 'pages/common/DigitalKeyboard';
import PayContentModal from '../../../components/payModal/index';
import ShowLoadModal from "../../../components/showLoadingModal";
import PatientAdmOrderCharges from 'pages/Cashier/Report/PatientAdmOrderCharges';
import ShowConfirmApplicationModal from 'pages/scheduling/component/ShowConfirmApplicationModal';
import IframeModal from 'pages/common/IframeModal';
import PublicModalQueryTable from 'pages/common/PublicModalQueryTable';
import SharingMedicalOrders from './SharingMedicalOrders'; // 医嘱共享
import '../style/index.less';
import {base64Encode, SOFE_SignPKCS7Message} from "../../../tools/sccmPlugin";
const doctorOrder = require('../image/img/icon_doctororder.png');
const { TextArea } = Input;
const Option = Select.Option;
const confirm = Modal.confirm;
const TabPane = Tabs.TabPane;
const { TreeNode } = Tree;
var totalCount = 0;//总数量
var scrollCount = 0;
// const DragHandle = sortableHandle(() => <span>::</span>);
const searchColConfig = {
	xs: { span: 24 },
	sm: { span: 12 },
	md: { span: 10 },
	lg: { span: 2 }
}

class DoctorAdviceStepPage extends React.Component {
	constructor(props) {
		super(props)
		var userData = JSON.parse(sessionStorage.getItem('userData'));
		var titleData = JSON.parse(sessionStorage.getItem('titleData'))
		var patientData = JSON.parse(sessionStorage.getItem('patientData'))
		this.handleCallback = this.handleCallback.bind(this);
		this.state = {
			dataSource: [],
			total: 0,
			page: 1,
			codePage: 1,
			pageSize: 10,
			current: 2,
			ids: [],
			userData,
			selectData: [],
			patientData: patientData,
			titleData: titleData,
			cannelStatus: false,
			nodeId: [],
			adviceDrData: [],
			indexArray: [],
			doseUnitList: [],//剂量单位
			durationList: [],//疗程单位
			qtyUnitList: [],//数量单位
			recLocList: [],//接收科室
			frequenceList: [],//频次
			usageList: [],//用法
			skinTestWayList: [],//皮试备注
			priorityList: [],//优先级
			admReasonList: [],
			specList: [],//标本
			degreesList: [],
			priorityExtList: [],
			delCode: [],
			ordNoteList: [],
			visStatus: false,
			radioValue: '1',
			packageRadio: '1',
			moduleStatus: false,
			saveStatus: false,
			dynColumns: [],
			concatData: [],
			changeValue: '',
			items: [],
			showAllColumns: [],
			payModalVis: false, // 收银弹框显示
			chargeordIDinfo: [],
			accountID: '',
			code: [],
			info: [],
			loading: false,
			hideAdviceList: false,
			codeModal: [],
			expandedKeys: [],
			eyePartList: [],
			// activeKey: '1',
			defaultBtn: 2,
			bodyPartList: [],
			verifyModalShow: false, //事中审核模态框显示
			verifyModalInfo: {},  //事中审核反馈信息
			textAreaInput: '',    //事中审核输入框内容
			tableFlag: 'N', // 鼠标点击名称规格是否显示相关医保信息
			popoverVisible: false, // 医保信息展示
			medItemTop: '',
			medItemLeft: '',
			medicalInsuranceData: [], // 医保数据
			discountShow: false, // 优惠弹窗
			defaultExpand: 1, // 医嘱套模板是否展开 - 1为全部展开，2不展开，3只展开第一个
			insertMethod: 'vertical', //  横排： transverse  竖排： vertical
			isRenderDynColumns: false, // 是否需要重新渲染表头数据
			currentOrdMedIndex: 0, // 当前操作的名称规格框
			isShowCommonTableModal: false,
			currentLocData: {
				locID: userData?.locID,
				locDesc: userData?.locDesc
			},
			userLoginLoc: [], // 科室下拉数据
			dynLoading: false, // 表格loding
			ordDocList: [],
			ordDocID: undefined, // 开单医生
			preAndInProcess: '', // 医嘱保存成功后是否调用事前事中标志
			orderPrint: '', // 医嘱单打印标志
			priorReviewFlag: '', // 事前调阅
			PASS4Flag:'',				//是否开启合理用药
			insuNumber: '', // 事前调阅患者医保号
			hisAdmTradeNo: '', // 就诊流水
			preRemindFlag: '', // 医嘱保存成功后是否调用事前提醒标志
			discountFlag: '', // 优惠类型【N为申请 | Y为审批】
			discountSubCatID: '', // 优惠子类
			helpMediCineFlag: '', // 代开药标志
			recipeType: '1', // 保内保外处方标志【1为保内，2为保外，默认为1】
			diagTabData: [], // 诊断tab数据
			diagActive: '1', // 当前诊断
			isExistRecord: 'Y', // 病历录入标志
			configParams: {}, // 配置参数
			confirmInsertionRes: {}, // 确认插入数据
			purposeRecordData: {}, // 用药目的当前行数据
			confirmMedVisible: false, // 确认医嘱弹窗
			confirmMedColumns: [],
			confirmMedTableData: [], // 医嘱确认弹窗列表数据
			confirmMedTableWidth: 920,
			confirmMedLoading: false,
		}
		this.keyDownElements = this.keyDownAddMidical.bind(this);
		this.loadListener = this.keyDownElement.bind(this);
		this.doseFocus = React.createRef();
		this.ordDescFocus = React.createRef();
		this.ordFreqFocus = React.createRef();
		this.ordUseFocus = React.createRef();
		this.ordDurFocus = React.createRef();
		this.ordDose = React.createRef();
		this.ordRecLocID = React.createRef();
		this.ordNote = React.createRef();
		this.ordSpecID = React.createRef();
		this.ordPriorityID = React.createRef();
		this.ordSkinTestWayID = React.createRef();
		this.ordFirstDayNum = React.createRef();
		this.ordPriorityExtID = React.createRef();
		this.ordQtyUomID = React.createRef();
		this.ordQty = React.createRef();
		this.ordDurationID = React.createRef();
		this.ordDurQty = React.createRef();
		this.ordUsageID = React.createRef();
		this.ordFreqID = React.createRef();
		this.ordDoseUnitID = React.createRef();
		this.ordAdmReasonID = React.createRef();
		this.ordLinkSeqNo = React.createRef();
		this.inputRef = React.createRef();
		this.ordStageID = React.createRef();
		this.ordInfuseSpeed = React.createRef();
		this.ordSpeedUnitID = React.createRef();
		this.exceDurReason = React.createRef();
		this.ordInsuCat = React.createRef();
		this.degreesID = React.createRef();
		this.eyePartID = React.createRef();
		this.bodyPartID = React.createRef();
		this.staticConfirmMedColumns = [{
			key: '1',
			title: '序号',
			dataIndex: 'index',
			width: '50px',
			align: "center",
		}, {
			key: '2',
			title: '医嘱类型',
			dataIndex: 'ordPriorityDesc',
			width: '80px',
			align: "center",
		}, {
			key: '3',
			title: '医嘱内容',
			dataIndex: 'ordMessage',
			width: '320px',
			align: "center",
		}, {
			key: '4',
			title: '开医嘱信息',
			dataIndex: 'ordMessageO',
			width: '250px',
			align: "center",
		}, {
			key: '5',
			title: '科室',
			dataIndex: 'ordRecLocDesc',
			width: '120px',
			align: "center",
		}];
	}

	importService = () => {
		var script = document.createElement('script');
		script.type = 'text/javascript';
		script.async = true;
		script.id = "mc-config";
		script.src = `https://barmyy-mk.e24health.com/pass/McConfig.js`;
		document.head.appendChild(script);
	}

	componentWillReceiveProps(nextProp) {
		if (!Util.isEmpty(nextProp.adviceList)) {
			this.loadBatchTemplateData(nextProp.adviceList)
		} else if (this.props.isShow === false) {
			this.cleanInput();
		}
	}

	componentDidUpdate() {
		//获取当前添加的数据作为未保存数据的标识，用于step切换的校验
		var componentData = []
		var { dataSource } = this.state;
		if (!Util.isEmpty(dataSource)) {
			for (var i = 0; i < dataSource.length; i++) {
				if (!Util.isEmpty(dataSource[i].medID) && Util.isEmpty(dataSource[i].ordID)) {
					componentData.push(dataSource[i])
					break;//只取一次数据，防止多次执行
				}
			}
		}
		let sourceData = this.getUnSaveData(); // 获取未保存数据
		var routeFlag = false
		if (!Util.isEmpty(componentData)) {
			routeFlag = true
			var { componentRouter } = this.props;
			componentRouter && componentRouter(routeFlag, '3', sourceData)
		} else {
			routeFlag = false
			var { componentRouter } = this.props;
			componentRouter && componentRouter(routeFlag, '3', sourceData)
		}
		if (document.querySelector('.doctor-step-body .ant-table-body')) {
			if (this.props.patStatus !== '1') {
				document.querySelector('.doctor-step-body .ant-table-body').style.height = store.getState().tableHeight.y + 40 + 'px'
			} else if (this.props.patStatus == '1' && this.state.hideAdviceList === false && this.props.hideStatus === false) {
				document.querySelector('.doctor-step-body .ant-table-body').style.height = this.props.heightVH ? this.props.heightVH + 'vh' : '22vh'
			} else if (this.props.patStatus == '1' && this.state.hideAdviceList === false && this.props.hideStatus === true) {
				document.querySelector('.doctor-step-body .ant-table-body').style.height = store.getState().tableHeight.y + 20 + 'px'
			}
		}
	};

	// 获取未保存数据
	getUnSaveData = () => {
		var { dataSource, diagActive, diagTabData } = this.state;
		var sourceData = []
		if (!Util.isEmpty(dataSource)) {
			// 当前诊断数据
			let currentDiagRecord = diagActive && diagTabData && Array.isArray(diagTabData) && diagTabData.length > 0 ? diagTabData[diagActive - 1] : {};
			let diagExtObj = {
				code: 'Diag', // 插入医嘱时绑定当前诊断
				value: currentDiagRecord?.id || '',
				refDescripts: currentDiagRecord?.diagCode || currentDiagRecord?.ICDCode || '',
			};
			for (var i = 0; i < dataSource.length; i++) {
				if (!Util.isEmpty(dataSource[i].medID) && Util.isEmpty(dataSource[i].ordID)) {
					let oldExtValue = dataSource[i]?.extvalue || [];
					sourceData.push({ ...dataSource[i], extvalue: [...oldExtValue, diagExtObj] })
				}
			}
		}
		return sourceData;
	};

	componentDidMount() {
		this.props.onRef && this.props.onRef(this)
		this.loadColumns()
		this.loadAllColumns()
		this.getConfirmMedColumns();
		this.loadWorkstationSetting()//获取医生站配置（医嘱套默认）
		this.setState({ dataSource: [] })
		// this.loadTemplateData()
		if (this.props.patStatus !== '1') {
			this.loadPrescriptionFee()
			// this.loadData()
		} else if (this.props.patStatus == '1') {
			// this.loadDoctorMsg()
		}
		this.getExistRecordFlag();
		this.getDiagTabData();
		// this.loadData();
		this.loadModuleData()
		this.loadLocalMsg()
		this.initData()
		this.loadSeriousIllness()//大病医保列
		this.loadEndReceiveOfDisableBtn()//结束就诊后，disable按钮
		this.loadLocPersonMsg()//获取套餐的名称
		if (!Util.isEmpty(this.state.patientData)) {
			this.loadDisOpertion()//禁止操作按钮
			this.loadArrearsMessage()//欠费
		}
		//doctor-step-body

		// let self = this
		// document.addEventListener("keydown", function (e) {
		//     self.KeyDowns(e)
		// })
		document.addEventListener('keydown', this.keyDownElements)
	}

	componentWillUnmount() {
		document.removeEventListener('keydown', this.keyDownElements)
		// 组件销毁前将静止让setState修改state的状态
		this.setState = (state, callback) => { return; }
	}

	//手术申请，渲染页面
	loadPatientMsg(id) {
		var patientData = JSON.parse(sessionStorage.getItem('patientData'))
		this.setState({
			patientData: patientData,
			operationID: id,
			disMessage: undefined,
			disBtn: 'Y'
		}, () => {
			this.loadColumns()
			this.loadAllColumns()
			this.loadWorkstationSetting()//获取医生站配置（医嘱套默认）
			this.setState({ dataSource: [] })
			// this.loadTemplateData()
			if (this.props.patStatus !== '1') {
				this.loadPrescriptionFee()
				// this.loadData()
			} else if (this.props.patStatus == '1') {
				// this.loadDoctorMsg()
			}
			// this.loadData()
			this.getExistRecordFlag();
			this.getDiagTabData();
			this.loadModuleData()
			this.loadLocalMsg()
			this.initData()
			this.loadSeriousIllness()//大病医保列
			this.loadEndReceiveOfDisableBtn()//结束就诊后，disable按钮
			this.loadLocPersonMsg()//获取套餐的名称
			if (!Util.isEmpty(patientData)) {
				this.loadDisOpertion()//禁止操作按钮
				this.loadArrearsMessage()//欠费
			}
			//doctor-step-body

			// let self = this
			// document.addEventListener("keydown", function (e) {
			//     self.KeyDowns(e)
			// })
			document.addEventListener('keydown', this.keyDownElements)
		})
	};

	// 获取病历录入标志
	getExistRecordFlag = () => {
		const data = {
			params: [{
				admID: !Util.isEmpty(this.state.patientData) ? this.state.patientData.admID : '',
			}],
		}
		$http.post('urlDeault', this, {
			code: "03050280",
			data: data,
			success: function (res) {
				if (res.errorCode == '0') {
					let isExistRecord = res?.isExistRecord || 'N'; // 是否写过病历
					if (isExistRecord !== 'Y') {
						Modal.warning({
							title: '病历录入提醒',
							content: '检测到您还未录入病历，请先录入病历！',
							okText: '知道了'
						});
					}
					this.setState({
						isExistRecord
					});
				}
			}
		});
	};

	keyDownAddMidical(e) {
		if (e && e.keyCode) {
			let currKey = 0;
			e = e || event || window.event;
			currKey = e.keyCode || e.which || e.charCode;
			//快捷键F1
			// if (currKey == 112 && (e.ctrlKey || e.metaKey || e.shiftKey)) {
			if (currKey == 112) { // 添加
				e.preventDefault();
				this.addMechansim();
			} else if (currKey === 115) { // 文字医嘱
				e.preventDefault();
				this.handleInputModeSwitching();
			} else if (currKey === 27) { // Esc 关闭医嘱选择窗口
				e.preventDefault();
				let { isShowCommonTableModal, currentOrdMedIndex } = this.state;
				if (isShowCommonTableModal) {
					this.setState({
						selectData: [],
						total: 0,
						page: 1,
						isShowCommonTableModal: false
					});
					this.child && this.child.handleCancel();
					this.writtenOrdersRef && this.writtenOrdersRef.modifyVisible(false);
					this.handleOrdMedItemFocus(currentOrdMedIndex);
				}
			}
		}
	}

	loadLocPersonMsg() {
		// var params = {
		//     params: [{}]
		// }
		// $http.post('urlDeault', this, {
		//     code: "03050073",
		//     data: params,
		//     success: function (res) {
		//         if (res.errorCode == '0') {
		//             this.setState({
		//                 packageData: res.data,
		//                 authRangeID: !Util.isEmpty(res.data) ? res.data[0].id : ''

		//             }, () => {
		//                 this.loadLeftData()//套餐
		//             })
		//         }
		//     }
		// });
		var params = {
			params: [{
				hospID: this.state.userData.hospID,
				userID: this.state.userData.userID,
				locID: this.state.userData.locID,
			}]
		}
		$http.post('urlDeault', this, {
			code: "03050272",
			data: params,
			success: function (res) {
				if (res.errorCode == '0') {
					var data = res.result
					var authRangeID = ''
					if (!Util.isEmpty(data)) {
						for (var i = 0; i < data.length; i++) {
							if (data[i].default == 'Y') {
								authRangeID = data[i].id
							}
						}
					}
					this.setState({
						packageData: res.result,
						authRangeID: !Util.isEmpty(authRangeID) ? authRangeID : (!Util.isEmpty(res.result) ? res.result[0].id : '')

					}, () => {
						this.loadLeftData()//套餐
					})
				}
			}
		});
	}

	// 获取医生站配置
	loadWorkstationSetting() {
		var params = {
			params: [{
				hospID: this.state.userData.hospID,
				locID: this.state.userData.locID,
				userID: this.state.userData.userID,
				admID: !Util.isEmpty(this.state.patientData) ? this.state.patientData.admID : ''
			}]
		}
		$http.post('urlDeault', this, {
			code: "01040230",
			data: params,
			success: function (res) {
				if (res.errorCode == '0') {
					this.setState({
						configParams: res, // 配置参数
						orderPrint: res?.orderPrint || '', // 医嘱单打印
						priorReviewFlag: res?.priorReviewFlag || '', // 事前调阅
						PASS4Flag:res?.PASS4Flag || '',
						preRemindFlag: res?.preRemindFlag || '', // 事前提醒
						preAndInProcess: res?.preAndInProcess || '', // 事前事中
						authRangeID: !Util.isEmpty(res.result) ? res.result.OrderSet : '',
						radioValue: !Util.isEmpty(res.result) ? res.result.OrderTemplet : '',
						specificatio: !Util.isEmpty(res.result) && res.result.DrugFlag == '1' ? true : false,
						activeKey: !Util.isEmpty(res.result) && res.result.OrderDefaultSetTemp == 'OrderDefaultSet' ? '1' : '2',
						tableFlag: 'tableFlag' in res && res.tableFlag ? res.tableFlag : ('tableFlag' in res.result ? res.result.tableFlag : 'N'),
						defaultExpand: !Util.isEmpty(res) ? res.defaultExpand : '', // 1为全部展开，2不展开，3只展开第一个
						ordDocList: res?.ordDocList || [],
						calculateTreatmentCourse: res?.calculateTreatmentCourse || '', // 是否计算疗程
						prescriptionMaxDate: res?.prescriptionMaxDate || '', // 用药最大天数 - 不能开超过多少天的药
						discountFlag: res?.discountFlag || '', // 优惠类型【N为申请 | Y为审批】
						discountSubCatID: res?.discountSubCatID || '', // 优惠子类
					}, () => {
						this.loadLeftData(); // 套餐
						this.loadTemplateData();
					});
					/**
					 * @ByShizi: 进入医嘱录入时提示是否填写诊断，没填写提示去填写
					 * Create 2022-08-18
					 * */
					res && 'mainDiagMsg' in res && res.mainDiagMsg ? message.error(res.mainDiagMsg) : '';
				}
			}
		});
	}

	loadArrearsMessage() {
		var params = {
			params: [{
				admID: !Util.isEmpty(this.state.patientData) ? this.state.patientData.admID : ''
			}]
		}
		$http.post('urlDeault', this, {
			code: "03050267",
			data: params,
			success: function (res) {
				if (res.errorCode == '0') {
					this.setState({
						operCode: !Util.isEmpty(res.result) ? res.result.operCode : '',
						alertMessage: !Util.isEmpty(res.result) ? res.result.alertMessage : '',
						disBtn: !Util.isEmpty(res.result) && res.result.operCode == 'alert' ? 'N' : 'Y'
					}, () => {
						if (!Util.isEmpty(this.state.alertMessage)) {
							var that = this;
							const modal = Modal.error({
								title: that.state.operCode == 'alert' ? '欠费控制' : '欠费预警',
								okText: that.state.userData.language == 'CN' ? '我知道了' : 'Ok',
								content: <div>
									<div>{that.state.alertMessage}</div>
								</div>
							});
							//传参数到父组件，屏蔽申请单按钮
							var { disBtnMessage } = this.props;
							disBtnMessage && disBtnMessage(this.state.operCode)
						}
					})
				}
			}
		});
	}

	loadLeftData(page, pageSize, e) {
		var params = {
			params: [{
				userID: this.state.userData.userID,
				locID: this.state.userData.locID,
				hospID: this.state.userData.hospID,
				groupID: this.state.userData.groupID,
				authRangeID: this.state.authRangeID,
				activeFlag: 'Y',
			}]
		}
		$http.post('urlDeault', this, {
			code: "03050060",
			data: params,
			success: function (res) {
				if (res.errorCode == '0') {
					this.setState({
						packageMsg: res.data.otherList || [],
					})
				}
			}
		});
	}

	loadEndReceiveOfDisableBtn() {
		var params = {
			params: [{
				admID: this.state.patientData ? this.state.patientData.admID : '',
				hospID: this.state.userData.hospID,
				userID: this.state.userData.userID,
				locID: this.state.userData.locID,
			}]
		}
		$http.post('urlDeault', this, {
			code: "03100124",
			data: params,
			success: (res) => {
				if (res.errorCode == '0') {
					this.setState({
						disBtn: res.result
					})
				}
			}
		})
	}

	loadDisOpertion() {
		var params = {
			params: [{
				admID: this.state.patientData ? this.state.patientData.admID : '',
				hospID: this.state.userData.hospID,
				userID: this.state.userData.userID,
				locID: this.state.userData.locID,
			}]
		}
		$http.post('urlDeault', this, {
			code: "03050229",
			data: params,
			success: (res) => {
				if (res.errorCode !== '0') {
					this.setState({
						disMessage: res.errorMessage
					})
				}
			}
		})
	}

	loadSeriousIllness() {
		var params = {
			params: [{
				// admID: this.state.patientData ? this.state.patientData.admID : ''
				hospID: this.state.userData.hospID
			}]
		}
		$http.post('urlDeault', this, {
			code: "03010110",
			data: params,
			success: (res) => {
				if (res.errorCode == '0') {
					this.setState({
						ordInsuCat: res.result
					})
				}
			}
		})
	}

	//判断住院是否分配医生
	loadDoctorMsg() {
		var params = {
			params: [{
				admID: this.state.patientData ? this.state.patientData.admID : ''
			}]
		}
		$http.post('urlDeault', this, {
			code: "03040038",
			data: params,
			success: (res) => {
				if (res.errorCode == '0') {
					if (res.hasDocFlag == 'N') {
						message.error('当前病人未分配主管医生，无法录入医嘱', this.state.userData && this.state.userData.messageTime)
					}
					this.setState({
						hasDocFlag: res.hasDocFlag
					})
				}
			}
		})
	}

	loadLocalMsg() {
		let data = {
			params: [{
				compontName: "DoctorAdviceListPage",
				type: "C",
				reactCode: ['DoctorAdviceListPage', 'DoctorAdviceModal']
			}]
		}
		$http.post('urlDeault', this, {
			code: "01040073",
			data: data,
			success: (res) => {
				if (+res.errorCode === 0) {
					this.setState({
						localeProvider: this.state.userData.language == 'EN' ? res.result.language.EN : res.result.language.CN
					}, () => {
						this.initData()
					})
				}
			}
		})
	}

	keyDownElement(e) {
		if (this.state.visible) {
			if (e.keyCode == '13') {
				this.setState({
					newIndex: 0
				})
			}
		}
	}

	initData() {
		this.sunColumns = [
			{
				title: this.setMessage('DoctorAdviceModalCode', 'descripts'),
				dataIndex: 'medCode',
				width: 100,
				align: 'left',
			}, {
				// title: this.setMessage('DoctorAdviceModalSpecification', 'descripts'),
				title: <span> {this.setMessage('DoctorAdviceModalSpecification', 'descripts')}<span style={{ marginLeft: 20 }}><span style={{ color: '#007AFF' }}>药品：</span>
					<Checkbox defaultChecked={this.state.specificatio} value={this.state.specificatio} onChange={this.handleChangeChecked.bind(this, 'specificatio')} /></span></span>,
				dataIndex: 'medDesc',
				width: 260,
				align: 'left',
			}, {
				title: this.setMessage('DoctorAdviceModalStock', 'descripts'),
				dataIndex: 'medStock',
				width: 150,
				align: 'left',
			}, {
				title: '使用说明',
				dataIndex: 'drugUseInfo',
				width: 80,
				align: 'left',
				render: (text, record) => (<Tooltip placement="top" title={text}><div style={{ textOverflow: 'ellipsis', whiteSpace: 'nowrap', overflow: 'hidden' }}>{text}</div></Tooltip>)
			}, {
				title: '集采标志',
				dataIndex: 'uniformPurchFlag',
				width: 80,
				align: 'left'
			}, {
				title: this.state.userData.language == 'EN' ? 'Price(¥)' : '单价(元)',
				dataIndex: 'medPrice',
				width: 80,
				align: 'left',
			},
			//  {
			//     title: this.setMessage('DoctorAdviceModalCatDesc', 'descripts'),
			//     dataIndex: 'medCatDesc',
			//     width: 100,
			//     align: 'left',
			// },
			{
				title: this.setMessage('DoctorAdviceModalSubCatDesc', 'descripts'),
				dataIndex: 'medSubCatDesc',
				width: 120,
				align: 'left',
			},
			{
				title: '在途数',
				dataIndex: 'resQty',
				width: 100,
				align: 'left',
			},
			{
				title: '医保类型',
				dataIndex: 'medItemGrade',
				width: 80,
				align: 'left',
			}, {
				title: '商品名',
				dataIndex: 'tradeName',
				width: 100,
				align: 'left',
			}, {
				title: '整包装价格',
				dataIndex: 'price',
				width: 100,
				align: 'left',
			}, {
				title: '厂家',
				dataIndex: 'manfDesc',
				width: 300,
				align: 'left',
			}
		]
	}

	handleChangeChecked(name, e) {
		this.setState({
			[name]: e.target.checked
		}, () => {
			this.loadSelectData('', 1)
		})
	}

	loadAllColumns(name) {
		var params = {
			params: [{
				userID: name == 'hide' ? '' : this.state.userData.userID,
				hospID: this.state.userData.hospID,
				locID: this.state.userData.locID,
				admID: this.state.patientData ? this.state.patientData.admID : '',
				displayFlag: 'N'
			}]
		}
		$http.post('urlDeault', this, {
			code: "03010027",
			data: params,
			success: function (res) {
				if (res.errorCode == '0') {
					var columns = res.data;
					var showAllColumns = []
					if (columns) {
						for (var i = 0; i < columns.length; i++) {
							showAllColumns.push({
								title: this.state.userData.language == 'EN' ? columns[i].ENTitle : columns[i].title,
								dataIndex: columns[i].dataIndex,
								width: parseInt(columns[i].width),
								align: columns[i].align || 'center',
								count: columns[i].count,
								hide: columns[i].hide,
								orderListID: columns[i].orderListID,
								attribute: columns[i].attribute,
								dataMethod: columns[i].dataMethod,
								style: columns[i].style,
								validateRules: columns[i].validateRules,
								type: columns[i].type,
							})
						}
					}
					this.setState({
						showAllColumns: showAllColumns
					}, () => {
						this.loadColumns()
					})
				}
			}
		});
	}

	/**
	 * @ByShizi: 点击名称规格展示相关医保信息
	 * Create 2021-05-07
	 * */
	handleMedItemDescClick = item => {
		let { tableFlag } = this.state;
		if (!(item && item.ordID) || tableFlag === 'N') return;
		let domInfo = document.getElementById(item.ordID).getBoundingClientRect();
		let clientHeight = document.body.clientHeight;
		let height = domInfo?.height;
		let top = 0;
		if ((domInfo?.bottom + 300) < clientHeight) { // 弹框内容最高300px
			top = domInfo?.top + height + 5 + 'px'
		} else {
			top = domInfo?.top - 144 + 'px'
		}
		let left = domInfo?.left - 3 + 'px';
		this.setState({
			medItemTop: top,
			medItemLeft: left
		}, () => {
			this.getMedicalInsuranceData(item);
		});
	}

	// 获取医保展示数据
	getMedicalInsuranceData = item => {
		var params = {
			params: [{
				medID: item?.ordMedItemID
			}]
		}
		$http.post('urlDeault', this, {
			code: "03050281",
			data: params,
			success: function (res) {
				let medicalInsuranceData = res.result && Array.isArray(res.result) && res.result.length > 0 ? res.result : [];
				if (+res.errorCode === 0 && medicalInsuranceData.length > 0) {
					this.setState({ medicalInsuranceData, popoverVisible: true });
				} else {
					message.info('暂无相关医保数据');
					this.setState({ medicalInsuranceData: [], popoverVisible: false });
				}
			}
		});
	}

	loadColumns(name) {
		var params = {
			params: [{
				userID: this.state.userData.userID,
				hospID: this.state.userData.hospID,
				locID: this.state.userData.locID,
				admID: this.state.patientData ? this.state.patientData.admID : '',
				displayFlag: 'Y'
			}]
		}
		$http.post('urlDeault', this, {
			code: "03010027",
			data: params,
			success: function (res) {
				if (res.errorCode == '0') {
					var columns = res?.data || [];
					this.setState({
						dynColumns: columns,
						totalWidth: res.totalWidth,
						columnsData: res.data
					}, () => {
						this.getDynColumnsData();
					})
				}
			}
		});
	}

	// 设置当前名称规格焦点
	handleSetCurrentFocus = index => {
		// let top = document.getElementById('name-input' + index).getBoundingClientRect().top + 40;
		// let left = document.getElementById('name-input' + index).getBoundingClientRect().left + 'px';
		// let windowHeight = window.innerHeight;
		// if ((top + 360) > windowHeight) {
		//     top = top - 330 - 108 + 'px';
		// }
		this.setState({ currentOrdMedIndex: index, indexTable: index }, () => {
			this.getDynColumnsData();
		});
	}

	// 名称规格获取焦点
	handleOrdMedItemFocus = (currentIndex) => {
		let { dataSource } = this.state;
		let index = (currentIndex > -1) ? currentIndex : (dataSource && dataSource.length > 0 ? dataSource.length - 1 : 0);
		this['ordMedItemDesc' + index] && this['ordMedItemDesc' + index].focus();
	}

	// 获取医嘱录入表头数据
	getDynColumnsData = () => {
		const { currentOrdMedIndex } = this.state;
		var dynColumns = []
		let columns = this.state.dynColumns;
		if (columns) {
			for (var i = 0; i < columns.length; i++) {
				if (columns[i].dataIndex == 'ordSeqNo') {//序号
					dynColumns.push({
						title: this.state.userData.language == 'EN' ? columns[i].ENTitle : columns[i].title,
						dataIndex: columns[i].dataIndex,
						width: parseInt(columns[i].width),
						align: columns[i].align || 'center',
						count: columns[i].count,
						hide: columns[i].hide,
						orderListID: columns[i].orderListID,
						render: (text, data, index) => {
							data.tabIndex = index + 1
							data.ordSeqNo = index + 1//引用医嘱，删除，再引用，不能保存问题
							return {
								children: <div className={data.ordMinFlag == 'Y' ? 'rowClass' : ''}>{index + 1}</div>
							}
						}
					})
				}

				if (columns[i].dataIndex == 'ordLinkSeqNo') {//关联号
					dynColumns.push({
						title: this.state.userData.language == 'EN' ? columns[i].ENTitle : columns[i].title,
						dataIndex: columns[i].dataIndex,
						width: parseInt(columns[i].width),
						align: columns[i].align || 'center',
						count: columns[i].count,
						hide: columns[i].hide,
						orderListID: columns[i].orderListID,
						render: (text, data, index) => {
							var { copyData, dataSource } = this.state;
							var source = []
							//先将保存了的数据过滤掉
							for (var i = 0; i < dataSource.length; i++) {
								if (Util.isEmpty(dataSource[i].ordID)) {
									source.push(dataSource[i])
								}
							}
							//点击取消后，重新计算关联号
							// if (copyData && source && data.move !== '1' && this.state.cannelStatus !== true) {
							//     for (var i = 0; i < copyData.length; i++) {
							//         for (var j = 0; j < source.length; j++) {
							//             if (source[j].indexId == (copyData[i].indexId) && index == (source[j].tabIndex - 1)
							//                 && Util.isEmpty(source[j].ordID) && !Util.isEmpty(source[j].mainIndexId)) {
							//                 if (Util.isEmpty(source[source[j].mainIndexId]) && i > 0) {
							//                     data.ordLinkSeqNo = (source[copyData[i - 1].newCode].tabIndex)
							//                 } else {
							//                     // data.ordLinkSeqNo = (source[source[j].mainIndexId].tabIndex)
							//                     if (data.updateIndex !== true) {
							//                         // data.ordLinkSeqNo = (source[source[j].mainIndexId].tabIndex)
							//                     }
							//                 }
							//             }
							//         }
							//     }
							// }

							for (var i = 0; i < source.length; i++) {
								source[i].indexCode = i
							}

							for (var i = 0; i < source.length; i++) {
								for (var j = 0; j < source.length; j++) {
									if (!Util.isEmpty(source[i].mainIndexId)) {
										if (Util.isEmpty(source[j].indexId)) {
											if (source[i].mainIndexId == source[j].indexCode) {
												source[i].ordLinkSeqNo = source[j].tabIndex
											}
										} else {
											if (this.props.patStatus == '1') {//住院
												if (source[i].mainIndexId == source[j].indexId && source[i].updateIndex !== true && index == source[j].tabIndex) {
													source[i].ordLinkSeqNo = source[j].tabIndex
												}
											} else if (source[i].mainIndexId == source[j].indexId && source[i].updateIndex !== true) {//门诊
												source[i].ordLinkSeqNo = source[j].tabIndex
											}
										}
									}
								}
							}
							//置灰编辑框
							var unableToEdit = data.unableToEdit;
							var editFlag = false;
							if (unableToEdit) {
								for (var j = 0; j < unableToEdit.length; j++) {
									if (unableToEdit[j] == 'ordLinkSeqNo') {
										editFlag = true
									}
								}
							}
							return {
								children: editFlag ? undefined : (data.ordID ? <div style={{ display: 'flex' }}>
									<div style={{ fontFamily: '-webkit-pictograph', fontSize: '16px', color: '#64A982' }}>{data.ordLinkSign}</div>
									<div className={data.ordOrderDetailID ? 'linkStyle' : ''}>{data.ordLinkSeqNo}</div></div> :
									(Util.isEmpty(data.ordTypeCode) || data.ordTypeCode == 'D' || data.ordTypeCode == 'O' ? (
										<Input
											disabled={editFlag ? true : false}
											value={data.ordLinkSeqNo}
											style={{ width: '98%' }}
											//  ref={index == this.state.linkRoutes ? this.ordLinkSeqNo : ''}
											ref={ref => this['ordLinkSeqNo' + index] = ref}
											onKeyDown={this.handleNextColumns.bind(this, 'ordLinkSeqNo', index, data)}
											onBlur={this.handleMouseColumns.bind(this, 'ordLinkSeqNo', index, data)}
											onChange={this.changeOrdLinkInput.bind(this, 'ordLinkSeqNo', index, data)}
											onClick={this.handleClearOrdMedItemFocus}
										/>
									) : undefined))
							}
						}
					})
				}

				if (columns[i].dataIndex == 'ordAdmReasonID') {//结算类型
					dynColumns.push({
						title: this.state.userData.language == 'EN' ? columns[i].ENTitle : columns[i].title,
						dataIndex: columns[i].dataIndex,
						width: parseInt(columns[i].width),
						count: columns[i].count,
						hide: columns[i].hide,
						orderListID: columns[i].orderListID,
						align: columns[i].align || 'center',
						render: (text, data, index) => {
							var admReasonListOption = []
							var admReasonList = data.admReasonList;
							admReasonList && admReasonList.map((item, index) => {
								admReasonListOption.push(<Option key={index} value={item.id}
									onClick={this.handleOnSelectColumns.bind(this, 'ordAdmReasonID', index, data)}>{item.descripts}</Option>)
							})



							if (!Util.isEmpty(admReasonList) && !Util.isEmpty(data.ordInsuCat)) {
								for (var i = 0; i < admReasonList.length; i++) {
									if (admReasonList[i].id == '59') {
										data.ordAdmReasonID = '59'
									}
								}
							}

							//置灰编辑框
							var unableToEdit = data.unableToEdit;
							var editFlag = false;
							if (unableToEdit) {
								for (var j = 0; j < unableToEdit.length; j++) {
									if (unableToEdit[j] == 'ordAdmReasonID') {
										editFlag = true
									}
								}
							}

							return editFlag ? undefined : (data.ordID ? <span>{data.ordAdmReasonDesc}</span> : (
								<Select
									showSearch
									style={{ width: '98%' }}
									showArrow={false}
									value={data.ordAdmReasonID}
									disabled={editFlag ? true : false} ref={this.ordAdmReasonID}
									onClick={this.handleClearOrdMedItemFocus}
									onKeyDown={this.handleNextColumns.bind(this, 'ordAdmReasonID', index, data)}
									onChange={this.changeCommonSelect.bind(this, 'ordAdmReasonID', index, data)}
									onSelect={this.handleOnSelectColumns.bind(this, 'ordAdmReasonID', index, data)}
								>
									{admReasonListOption}
								</Select>
							))
						}
					})
				}

				if (columns[i].dataIndex == 'ordMedItemDesc') {//名称规格
					dynColumns.push({
						title: this.state.userData.language == 'EN' ? columns[i].ENTitle : columns[i].title,
						dataIndex: columns[i].dataIndex,
						width: parseInt(columns[i].width),
						align: columns[i].align || 'center',
						count: columns[i].count,
						hide: columns[i].hide,
						orderListID: columns[i].orderListID,
						render: (text, data, index) => {
							let isWrittenOrderFlag = data.writtenOrderFlag === 'Y' ? (currentOrdMedIndex === index ? (data.ordMedItemDesc ? false : true) : true) : false;
							return data.ordID ? (
								<span
									id={data.ordID}
									style={{ display: 'inline-block' }}
									onClick={() => this.handleMedItemDescClick(data)}
								>
									{data.ordMedItemDesc}
								</span>
							) : (
								<Input
									allowClear={isWrittenOrderFlag ? false : true}
									style={{ width: '98%' }}
									className={isWrittenOrderFlag ? 'dasp-written-orders' : ''}
									suffix={isWrittenOrderFlag ? (
										<div className="dasp-written-orders-icon">
											<span>文</span>
										</div>
									) : null}
									placeholder={isWrittenOrderFlag ? '正在录入文字医嘱' : ''}
									ref={ref => this['ordMedItemDesc' + index] = ref}
									id={"name-input" + index}
									onKeyDown={this.showCommonTableModal.bind(this, index, data, columns[i])}
									disabled={!Util.isEmpty(this.state.disMessage) || this.state.disBtn == 'N' || (this.state.patientData?.admID ? false : true)}
									autoFocus
									value={data.ordMedItemDesc}
									onChange={this.handleSearchInput.bind(this, 'ordMedItemDesc', index, data)}
									onFocus={() => this.handleSetCurrentFocus(index)}
								// onBlur={() => this.handleSetCurrentFocus('')}
								/>
							)
						}
					})
				}

				if (columns[i].dataIndex == 'ordDose') {//剂量
					dynColumns.push({
						title: this.state.userData.language == 'EN' ? columns[i].ENTitle : columns[i].title,
						dataIndex: columns[i].dataIndex,
						width: parseInt(columns[i].width),
						align: columns[i].align || 'center',
						count: columns[i].count,
						hide: columns[i].hide,
						orderListID: columns[i].orderListID,
						render: (text, data, index) => {
							//置灰编辑框
							var unableToEdit = data.unableToEdit;
							var editFlag = false;
							if (unableToEdit) {
								for (var j = 0; j < unableToEdit.length; j++) {
									if (unableToEdit[j] == 'ordDose') {
										editFlag = true
									}
								}
							}
							data.totalOrdDose = parseFloat(data.molecule || 1) / parseFloat(data.doseDenominator || 1)
							return editFlag ? undefined : (data.ordID ? <span>{data.ordDose}</span> : (
								<div>
									<Input
										style={{ width: '98%' }}
										disabled={editFlag ? true : false}
										// ref={index == this.state.linkRoutes ? this.ordDose : ''}
										value={data.ordDose}
										id={'ordDose' + index}
										ref={ref => this['ordDose' + index] = ref}
										onClick={this.onFocusCommonInput.bind(this, 'ordDose', index, data)}
										onChange={this.commonInput.bind(this, 'ordDose', index, data)}
										onKeyDown={this.handleNextColumns.bind(this, 'ordDose', index, data)}
									/>
									{/* <DigitalKeyboard integer={false} setValue={this.setValue.bind(this, 'ordDose', index, data)} ref={this.onBoardRef} /> */}
								</div>
							))
						}
					})
				}

				if (columns[i].dataIndex == 'ordDoseUnitID') {//剂量单位
					dynColumns.push({
						title: this.state.userData.language == 'EN' ? columns[i].ENTitle : columns[i].title,
						dataIndex: columns[i].dataIndex,
						width: parseInt(columns[i].width),
						align: columns[i].align || 'center',
						count: columns[i].count,
						hide: columns[i].hide,
						orderListID: columns[i].orderListID,
						render: (text, data, index) => {
							var doseUnitListOption = []

							var doseUnitList = data.doseUnitList;
							var newData = []
							doseUnitList && doseUnitList.map((item, index) => {
								doseUnitListOption.push(<Option
									key={index}
									value={item.doseUnitID}
									doseMolecule={item.molecule}
									code={item.defaultQty}
									search={item.doseUnitDesc + '^' + (item?.descriptsSPCode || '')}
									onClick={this.handleOnSelectColumns.bind(this, 'ordDoseUnitID', index, data)}
									doseDenominator={item.denominator}
								>
									{item.doseUnitDesc}
								</Option>)
							})
							// }
							//置灰编辑框
							var unableToEdit = data.unableToEdit;
							var editFlag = false;
							if (unableToEdit) {
								for (var j = 0; j < unableToEdit.length; j++) {
									if (unableToEdit[j] == 'ordDoseUnitID') {
										editFlag = true
									}
								}
							}
							return editFlag ? undefined : (data.ordID ? <span>{data.ordDoseUnitDesc}</span> : (
								<Select
									allowClear
									showSearch
									style={{ width: '98%' }}
									showArrow={false}
									disabled={editFlag ? true : false}
									optionFilterProp="search"
									// ref={index == this.state.linkRoutes ? this.ordDoseUnitID : ''}
									ref={ref => this['ordDoseUnitID' + index] = ref}
									value={data.ordDoseUnitID}
									onClick={this.handleClearOrdMedItemFocus}
									onKeyDown={this.handleNextColumns.bind(this, 'ordDoseUnitID', index, data)}
									onSelect={this.handleOnSelectColumns.bind(this, 'ordDoseUnitID', index, data)}
									onChange={(e, option) => this.changeCommonSelect('ordDoseUnitID', index, data, e, option)}
								>
									{doseUnitListOption}
								</Select>
							))
						}
					})
				}

				if (columns[i].dataIndex == 'ordFreqID') {//频次
					dynColumns.push({
						title: this.state.userData.language == 'EN' ? columns[i].ENTitle : columns[i].title,
						dataIndex: columns[i].dataIndex,
						width: parseInt(columns[i].width),
						align: columns[i].align || 'center',
						count: columns[i].count,
						hide: columns[i].hide,
						orderListID: columns[i].orderListID,
						render: (text, data, index) => {
							var frequenceListOption = []

							var frequenceList = data.frequenceList;
							frequenceList && frequenceList.map((item, index) => {
								frequenceListOption.push(<Option key={index} value={item.id} code={item.descriptsSPCode} endsp={item.enDescripts}
									desCode={item.code} title={item.descripts} ordFreqDesc={item.descripts}
									onClick={this.handleOnSelectColumns.bind(this, 'ordFreqID', index, data)} name={item.descripts}
									frequency={item.frequency} cycleDays={item.cycleDays} intervalDays={item.intervalDays}>{item.descripts}</Option>)
							})
							// }
							//置灰编辑框
							var unableToEdit = data.unableToEdit;
							var editFlag = false;
							if (unableToEdit) {
								for (var j = 0; j < unableToEdit.length; j++) {
									if (unableToEdit[j] == 'ordFreqID') {
										editFlag = true
									}
								}
							}
							return editFlag ? undefined : (data.ordID ? <span>{data.ordFrequenceDesc}</span> : (
								<Select
									allowClear
									showSearch
									showArrow={false}
									style={{ width: '98%' }}
									dropdownMatchSelectWidth={false}
									// ref={index == this.state.linkRoutes ? this.ordFreqID : ''}
									filterOption={(input, option) =>
										option.props.code.toLowerCase().indexOf(input.toLowerCase()) >= 0
										|| option.props.endsp.toLowerCase().indexOf(input.toLowerCase()) >= 0
										|| option.props.desCode.toLowerCase().indexOf(input.toLowerCase()) >= 0
										|| option.props.name.toLowerCase().indexOf(input.toLowerCase()) >= 0
									}
									disabled={editFlag ? true : (data.ordLinkStatus ? true :
										(!Util.isEmpty(data.identity) && this.state.groupStatus && data.checkIdenty == '2' ? true : (!Util.isEmpty(data.mainIndexId) ? true : false)))}
									value={frequenceList && frequenceList.length > 0 ? data.ordFreqID : data.ordFreqDesc}
									ref={ref => this['ordFreqID' + index] = ref}       //增加定位行号 add by liangjiaquan 2022.2.28
									onClick={this.handleClearOrdMedItemFocus}
									onFocus={this.onBlurFreqSelect.bind(this, 'ordFreqID', index, data)}
									onKeyDown={this.handleNextColumns.bind(this, 'ordFreqID', index, data)}
									onSelect={this.handleOnSelectColumns.bind(this, 'ordFreqID', index, data)}
									onChange={(e, option) => this.changeCommonSelect('ordFreqID', index, data, e, option)}
								>
									{frequenceListOption}
								</Select>
							))
						}
					})
				}

				if (columns[i].dataIndex == 'ordUsageID') {//用法
					dynColumns.push({
						title: this.state.userData.language == 'EN' ? columns[i].ENTitle : columns[i].title,
						dataIndex: columns[i].dataIndex,
						width: parseInt(columns[i].width),
						align: columns[i].align || 'center',
						count: columns[i].count,
						hide: columns[i].hide,
						orderListID: columns[i].orderListID,
						render: (text, data, index) => {
							var usageListOption = []
							// var { usageList } = this.state;
							// 用法下拉数据获取焦点后获取的
							var usageList = data.usageList;
							usageList && usageList.map((item, index) => {
								usageListOption.push(<Option key={index} code={item.descriptsSPCode}
									name={item.descripts}
									onClick={this.handleOnSelectColumns.bind(this, 'ordUsageID', index, data)}
									value={item.id}>{item.descripts}</Option>)
							})
							// }
							//置灰编辑框
							var unableToEdit = data.unableToEdit;
							var editFlag = false;
							if (unableToEdit) {
								for (var j = 0; j < unableToEdit.length; j++) {
									if (unableToEdit[j] == 'ordUsageID') {
										editFlag = true
									}
								}
							}
							// 当录入的医嘱皮试自动勾选了并且defaultStatus等于true的时候，用法ID赋值为皮试
							if (data.ordSkinTestFlagValue == 'Y' && data.defaultStatus == true && !Util.isEmpty(data.ordSkinTestUsageID)) {
								data.ordUsageID = data && data.ordUsageID ? data.ordUsageID : data.ordSkinTestUsageID
								data.ordUsageDesc = data && data.ordUsageDesc ? data.ordUsageDesc : data.ordSkinTestUsageDesc
							}
							return editFlag ? undefined : (data.ordID ? <span>{data.ordUsageDesc}</span> : (
								<Select
									allowClear
									showSearch
									// ref={index == this.state.linkRoutes ? this.ordUsageID : ''}
									showArrow={false}
									dropdownMatchSelectWidth={false}
									filterOption={(input, option) =>
										option.props.code.toLowerCase().indexOf(input.toLowerCase()) >= 0 ||
										option.props.name.toLowerCase().indexOf(input.toLowerCase()) >= 0
									}
									disabled={editFlag ? true : (data.ordLinkStatus ? true :
										(!Util.isEmpty(data.identity) && this.state.groupStatus && data.checkIdenty == '2' ? true : (!Util.isEmpty(data.mainIndexId) ? true : false)))}
									// value={!Util.isEmpty(data.ordSkinTestUsageID) && (data.ordSkinTestFlagValue == 'Y' && data.defaultStatus == true) ?
									//     data.ordSkinTestUsageDesc : (usageList && usageList.length > 0 ? data.ordUsageID :
									//         ((data.ordSkinTestFlagValue == 'N' || Util.isEmpty(data.ordSkinTestFlagValue)) ?
									//             (data.ordUsageDesc ? data.ordUsageDesc : '') : (data.ordUsageDesc || data.ordSkinTestUsageDesc)))}>
									value={usageList && usageList.length > 0 ? data.ordUsageID : data.ordUsageDesc}
									ref={ref => this['ordUsageID' + index] = ref}      //增加定位行号 add by liangjiaquan 2022.2.28
									onClick={this.handleClearOrdMedItemFocus}
									onFocus={this.handleLoadUsage.bind(this, 'ordUsageID', index, data)}
									onKeyDown={this.handleNextColumns.bind(this, 'ordUsageID', index, data)}
									onSelect={this.handleOnSelectColumns.bind(this, 'ordUsageID', index, data)}
									onChange={this.changeCommonSelect.bind(this, 'ordUsageID', index, data)} style={{ width: '98%' }}
								>
									{usageListOption}
								</Select>
							))
						}
					})
				}

				if (columns[i].dataIndex == 'ordDurQty') {//疗程
					dynColumns.push({
						title: this.state.userData.language == 'EN' ? columns[i].ENTitle : columns[i].title,
						dataIndex: columns[i].dataIndex,
						width: parseInt(columns[i].width),
						align: columns[i].align || 'center',
						count: columns[i].count,
						hide: columns[i].hide,
						orderListID: columns[i].orderListID,
						render: (text, data, index) => {
							//置灰编辑框
							var unableToEdit = data.unableToEdit;
							var editFlag = false;
							if (unableToEdit) {
								for (var j = 0; j < unableToEdit.length; j++) {
									if (unableToEdit[j] == 'ordDurQty') {
										editFlag = true
									}
								}
							}
							return editFlag ? undefined : (data.ordID ? <span>{data.ordDurQty}</span> : (
								<div>
									<Input
										value={data.ordDurQty}
										style={{ width: '98%' }} id={'ordDurQty' + index}
										//  ref={index == this.state.linkRoutes ? this.ordDurQty : ''}
										disabled={editFlag ? true : (data.ordLinkStatus ? true :
											(!Util.isEmpty(data.identity) && this.state.groupStatus && data.checkIdenty == '2' ? true : (this.props.patStatus == '1' ? true : false)))}
										ref={ref => this['ordDurQty' + index] = ref}       //增加定位行号 add by liangjiaquan 2022.2.28
										onChange={this.commonInput.bind(this, 'ordDurQty', index, data)}
										onClick={this.onFocusCommonInput.bind(this, 'ordDurQty', index, data)}
										onKeyDown={this.handleNextColumns.bind(this, 'ordDurQty', index, data)}
									/>
									{/* <DigitalKeyboard integer={false} setValue={this.setValue.bind(this, 'ordDurQty', index, data)} ref={this.onDurRef} /> */}
								</div>
							))
						}
					})
				}

				if (columns[i].dataIndex == 'ordDurationID') {//疗程单位
					dynColumns.push({
						title: this.state.userData.language == 'EN' ? columns[i].ENTitle : columns[i].title,
						dataIndex: columns[i].dataIndex,
						width: parseInt(columns[i].width),
						align: columns[i].align || 'center',
						count: columns[i].count,
						hide: columns[i].hide,
						orderListID: columns[i].orderListID,
						render: (text, data, index) => {
							var durationListOption = []

							// var { durationList } = this.state;
							var durationList = data.durationList;
							durationList && durationList.map((item, index) => {
								durationListOption.push(<Option key={index} value={item.id} duraFactor={item.factor}
									onClick={this.handleOnSelectColumns.bind(this, 'ordDurationID', index, data)}>{item.descripts}</Option>)
							})
							// }
							//置灰编辑框
							var unableToEdit = data.unableToEdit;
							var editFlag = false;
							if (unableToEdit) {
								for (var j = 0; j < unableToEdit.length; j++) {
									if (unableToEdit[j] == 'ordDurationID') {
										editFlag = true
									}
								}
							}
							return editFlag ? undefined : (data.ordID ? <span>{data.ordDurationDesc}</span> : (
								<Select
									style={{ width: '98%' }}
									showArrow={false}
									//  ref={index == this.state.linkRoutes ? this.ordDurationID : ''}
									ref={ref => this['ordDurationID' + index] = ref}       //增加定位行号 add by liangjiaquan 2022.2.28
									filterOption={(input, option) =>
										option.props.duraFactor.toLowerCase().indexOf(input.toLowerCase()) >= 0
									}
									disabled={editFlag ? true : (data.ordLinkStatus ? true :
										(!Util.isEmpty(data.identity) && this.state.groupStatus && data.checkIdenty == '2' ? true : (!Util.isEmpty(data.mainIndexId) ? true : (this.props.patStatus == '1' ? true : false))))}
									value={data.ordDurationID}
									onClick={this.handleClearOrdMedItemFocus}
									onKeyDown={this.handleNextColumns.bind(this, 'ordDurationID', index, data)}
									onSelect={this.handleOnSelectColumns.bind(this, 'ordDurationID', index, data)}
									onChange={(e, option) => this.changeCommonSelect('ordDurationID', index, data, e, option)}
								>
									{durationListOption}
								</Select>
							))
						}
					})
				}

				if (columns[i].dataIndex == 'ordQty') {//数量
					dynColumns.push({
						title: this.state.userData.language == 'EN' ? columns[i].ENTitle : columns[i].title,
						dataIndex: columns[i].dataIndex,
						width: parseInt(columns[i].width),
						align: columns[i].align || 'center',
						count: columns[i].count,
						hide: columns[i].hide,
						orderListID: columns[i].orderListID,
						render: (text, data, index) => {
							//(疗程数*factor*frequency)/cycleDays
							var totalNum = 0;//总次数
							var totalDosc = 0;//总剂量
							var oneDosc = 0;//剂量
							var oneQty = 0;//单次数量
							if (this.state.isCalculation !== 'N') {
								if (data.cycleDays) {//优先使用cycleDays，计算总次数
									totalNum = Math.ceil((parseFloat(!Util.isEmpty(data.ordDurQty) ? data.ordDurQty : 1) * parseFloat(data.duraFactor || 1) * parseFloat(data.frequency || 1)) / (data.cycleDays && parseFloat(data.cycleDays) > 0 ? parseFloat(data.cycleDays) : 1))
								} else {
									totalNum = Math.ceil((parseFloat(!Util.isEmpty(data.ordDurQty) ? data.ordDurQty : 1) * parseFloat(data.duraFactor || 1) * parseFloat(data.frequency || 1)) / (data.intervalDays && parseFloat(data.intervalDays) > 0 ? parseFloat(data.intervalDays) : 1))
								}
								//门诊
								if (data.ordToalCountO == 'Y') {
									totalDosc = Math.ceil((parseFloat(data.ordDose ? data.ordDose : 1) * totalNum * parseFloat(!Util.isEmpty(data.doseMolecule) ? data.doseMolecule : 1)).toFixed(2) / (parseFloat(data.doseDenominator) > 0 ? parseFloat(data.doseDenominator) : 1))
									//最后算总数量
									if (Util.isEmpty(data.duraFactor) || Util.isEmpty(data.ordDurQty) || Util.isEmpty(data.frequency) ||
										Util.isEmpty(data.cycleDays) || Util.isEmpty(data.ordDose) || Util.isEmpty(data.doseMolecule)
										|| Util.isEmpty(data.doseDenominator) || Util.isEmpty(data.doseDenominator)) {
										//阿卡波糖片问题，不知为何之前置位1
										totalCount = Math.ceil((totalDosc * parseFloat(data.qtyMolecule ? data.qtyMolecule : 1)) / (parseFloat(data.qtyDenominator) > 0 ? parseFloat(data.qtyDenominator) : 1))
										if (Util.isEmpty(data.ordID) /**&& data.qtyStatus == '2'**/) {
											data.newQty = totalCount
											data.totalCount = totalCount
										}
									} else {
										totalCount = Math.ceil((totalDosc * parseFloat(data.qtyMolecule ? data.qtyMolecule : 1)) / (parseFloat(data.qtyDenominator) > 0 ? parseFloat(data.qtyDenominator) : 1))
										if (Util.isEmpty(data.ordID) /**&& data.qtyStatus == '2'**/) {
											data.newQty = totalCount
											data.totalCount = totalCount
										} else {
											data.totalCount = data.ordQty ? data.ordQty : 1
										}
									}
								} else {//先取整，再算
									oneDosc = Math.ceil((parseFloat(data.ordDose ? data.ordDose : 1) * parseFloat(data.doseMolecule ? data.doseMolecule : 1)) / (parseFloat(data.doseDenominator) > 0 ? parseFloat(data.doseDenominator) : 1))
									// totalDosc = oneDosc * totalNum
									oneQty = Math.ceil((oneDosc * parseFloat(data.qtyMolecule ? data.qtyMolecule : 1)) / (parseFloat(data.qtyDenominator) > 0 ? parseFloat(data.qtyDenominator) : 1))
									data.newQty = oneQty * totalNum
								}

								if (this.props.patStatus == '1') {
									if (data.ordToalCountI == 'Y') {
										totalDosc = Math.ceil((parseFloat(data.ordDose ? data.ordDose : 1) * totalNum * parseFloat(data.doseMolecule)) / (parseFloat(data.doseDenominator) > 0 ? parseFloat(data.doseDenominator) : 1))
										//最后算总数量
										if (Util.isEmpty(data.duraFactor) || Util.isEmpty(data.ordDurQty) || Util.isEmpty(data.frequency) ||
											Util.isEmpty(data.cycleDays) || Util.isEmpty(data.ordDose) || Util.isEmpty(data.doseMolecule)
											|| Util.isEmpty(data.doseDenominator) || Util.isEmpty(data.doseDenominator)) {
											totalCount = 1
											if (Util.isEmpty(data.ordID) /**&& data.qtyStatus == '2'**/) {
												data.newQty = totalCount
												data.totalCount = totalCount
											}
										} else {
											totalCount = Math.ceil((totalDosc * parseFloat(data.doseMolecule ? data.doseMolecule : 1)) / (parseFloat(data.qtyDenominator) > 0 ? parseFloat(data.qtyDenominator) : 1))
											if (Util.isEmpty(data.ordID) /**&& data.qtyStatus == '2'**/) {
												data.newQty = totalCount
												data.totalCount = totalCount
											} else {
												data.totalCount = data.ordQty ? data.ordQty : 1
											}
										}
									} else {
										oneDosc = Math.ceil((parseFloat(data.ordDose ? data.ordDose : 1) * parseFloat(data.doseMolecule ? data.doseMolecule : 1)) / (parseFloat(data.doseDenominator) > 0 ? parseFloat(data.doseDenominator) : 1))
										totalDosc = oneDosc * totalNum
									}
								}
							}

							//置灰编辑框
							var unableToEdit = data.unableToEdit;
							var editFlag = false;
							if (unableToEdit) {
								for (var j = 0; j < unableToEdit.length; j++) {
									if (unableToEdit[j] == 'ordQty') {
										editFlag = true
									}
								}
							}
							return editFlag ? undefined : (data.ordID ? <span>{data.ordQty}</span> :
								<div><Input value={this.state.isCalculation == 'N' ? data.ordQty : (data.qtyStatus == '1' ? data.ordQty : (data.medID ?
									(data.defaultStatus == true ? data.ordQty : data.newQty) : undefined))}
									onKeyDown={this.handleNextColumns.bind(this, 'ordQty', index, data)} id={"ordQty" + index}
									//  ref={index == this.state.linkRoutes ? this.ordQty : ''}
									ref={ref => this['ordQty' + index] = ref}
									onClick={this.onFocusCommonInput.bind(this, 'ordQty', index, data)}
									disabled={editFlag ? true : false} style={{ width: '98%' }}
									onChange={this.commonInput.bind(this, 'ordQty', index, data)} />
									{/* <DigitalKeyboard integer={false} setValue={this.setValue.bind(this, 'ordQty', index, data)}ref={this.onQtyRef} /> */}
								</div>)
						}
					})
				}

				if (columns[i].dataIndex == 'ordQtyUomID') {//数量单位
					dynColumns.push({
						title: this.state.userData.language == 'EN' ? columns[i].ENTitle : columns[i].title,
						dataIndex: columns[i].dataIndex,
						width: parseInt(columns[i].width),
						align: columns[i].align || 'center',
						count: columns[i].count,
						hide: columns[i].hide,
						orderListID: columns[i].orderListID,
						render: (text, data, index) => {
							var qtyUnitListOption = []

							// var { qtyUnitList } = this.state;
							var qtyUnitList = data.qtyUnitList;
							var newData = []
							qtyUnitList && qtyUnitList.map((item, index) => {
								qtyUnitListOption.push(<Option key={index} code={item.price} value={item.unitID} qtyMolecule={item.molecule}
									onClick={this.handleOnSelectColumns.bind(this, 'ordQtyUomID', index, data)}
									qtyDenominator={item.denominator} price={item.price}>{item.unitDesc}</Option>)
							})
							// }

							//置灰编辑框
							var unableToEdit = data.unableToEdit;
							var editFlag = false;
							if (unableToEdit) {
								for (var j = 0; j < unableToEdit.length; j++) {
									if (unableToEdit[j] == 'ordQtyUomID') {
										editFlag = true
									}
								}
							}
							return editFlag ? undefined : (data.ordID ? <span>{data.ordQtyUomDesc}</span> : (
								<Select
									style={{ width: '98%' }}
									showArrow={false}
									//  ref={index == this.state.linkRoutes ? this.ordQtyUomID : ''}
									ref={ref => this['ordQtyUomID' + index] = ref}
									disabled={editFlag ? true : false} value={data.ordQtyUomID}
									onClick={this.handleClearOrdMedItemFocus}
									onKeyDown={this.handleNextColumns.bind(this, 'ordQtyUomID', index, data)}
									onSelect={this.handleOnSelectColumns.bind(this, 'ordQtyUomID', index, data)}
									onChange={(e, option) => this.changeCommonSelect('ordQtyUomID', index, data, e, option)}
								>
									{qtyUnitListOption}
								</Select>
							))
						}
					})
				}

				if (columns[i].dataIndex == 'ordPriorityExtID') {//附加说明
					dynColumns.push({
						title: this.state.userData.language == 'EN' ? columns[i].ENTitle : columns[i].title,
						dataIndex: columns[i].dataIndex,
						width: parseInt(columns[i].width),
						align: columns[i].align || 'center',
						count: columns[i].count,
						hide: columns[i].hide,
						orderListID: columns[i].orderListID,
						render: (text, data, index) => {
							var ordPriorityExtlistOption = []

							// var { priorityExtList } = this.state;
							var priorityExtList = data.priorityExtList;
							var newData = []
							priorityExtList && priorityExtList.map((item, index) => {
								if (!Util.isEmpty(item)) {
									ordPriorityExtlistOption.push(<Option key={index} value={item.id}
										onClick={this.handleOnSelectColumns.bind(this, 'ordPriorityExtID', index, data)}>{item.descripts}</Option>)
								}
							})
							// }
							//置灰编辑框
							var unableToEdit = data.unableToEdit;
							var editFlag = false;
							if (unableToEdit) {
								for (var j = 0; j < unableToEdit.length; j++) {
									if (unableToEdit[j] == 'ordPriorityExtID') {
										editFlag = true
									}
								}
							}
							if (data.noSub == 'Y') {
								data.ordPriorityExtID = undefined
							}
							return editFlag ? undefined : (data.ordID ? <span>{data.ordPriorityExtDesc}</span> : (
								<Select
									//  ref={index == this.state.linkRoutes ? this.ordPriorityExtID : ''}
									allowClear
									showArrow={false}
									style={{ width: '98%' }}
									onClick={this.handleClearOrdMedItemFocus}
									ref={ref => this['ordPriorityExtID' + index] = ref}
									onKeyDown={this.handleNextColumns.bind(this, 'ordPriorityExtID', index, data)}
									onSelect={this.handleOnSelectColumns.bind(this, 'ordPriorityExtID', index, data)}
									disabled={editFlag ? true : (data.noSub == 'Y' ? true : false)} value={data.ordPriorityExtID}
									onChange={(e, option) => this.changeCommonSelect('ordPriorityExtID', index, data, e, option)}
								>
									{ordPriorityExtlistOption}
								</Select>
							))
						}
					})
				}

				if (columns[i].dataIndex == 'ordFirstDayNum') {//次数
					dynColumns.push({
						title: this.state.userData.language == 'EN' ? columns[i].ENTitle : columns[i].title,
						dataIndex: columns[i].dataIndex,
						width: parseInt(columns[i].width),
						align: columns[i].align || 'center',
						count: columns[i].count,
						hide: columns[i].hide,
						orderListID: columns[i].orderListID,
						render: (text, data, index) => {
							//置灰编辑框
							var unableToEdit = data.unableToEdit;
							var editFlag = false;
							if (unableToEdit) {
								for (var j = 0; j < unableToEdit.length; j++) {
									if (unableToEdit[j] == 'ordFirstDayNum') {
										editFlag = true
									}
								}
							}
							return editFlag ? undefined : (data.ordID ? <span>{data.ordFirstDayNum}</span> : (
								<Input
									style={{ width: '98%' }}
									//  ref={index == this.state.linkRoutes ? this.ordFirstDayNum : ''}
									ref={ref => this['ordFirstDayNum' + index] = ref}
									value={data.ordFirstDayNum}
									disabled={editFlag ? true : false}
									onClick={this.handleClearOrdMedItemFocus}
									onChange={this.commonInput.bind(this, 'ordFirstDayNum', index, data)}
									onKeyDown={this.handleNextColumns.bind(this, 'ordFirstDayNum', index, data)}
								/>
							))
						}
					})
				}

				if (columns[i].dataIndex == 'ordPrice') {//单价
					dynColumns.push({
						title: this.state.userData.language == 'EN' ? columns[i].ENTitle : columns[i].title,
						dataIndex: columns[i].dataIndex,
						width: parseInt(columns[i].width),
						align: columns[i].align || 'center',
						count: columns[i].count,
						hide: columns[i].hide,
						orderListID: columns[i].orderListID,
						className: 'colClassName',
						render: (text, data) => {
							var price = 0;
							var source = data.priceData;
							source && source.map((item, index) => {
								price += Number(item)
							})
							if (source) {
								data.ordPrice = price
							}
							//data.nunmber
							return <span>{!Util.isEmpty(data.ordID) ? data.ordPrice :
								((data.priceData ? price : data.ordPrice))}</span>
						}
					})
				}

				if (columns[i].dataIndex == 'prescStatus') {//处方状态
					dynColumns.push({
						title: this.state.userData.language == 'EN' ? columns[i].ENTitle : columns[i].title,
						dataIndex: columns[i].dataIndex,
						width: parseInt(columns[i].width),
						align: columns[i].align || 'center',
						count: columns[i].count,
						hide: columns[i].hide,
						orderListID: columns[i].orderListID,
						className: 'colClassName'
					})
				}

				if (columns[i].dataIndex == 'medItemGrade') {//医保类型
					dynColumns.push({
						title: this.state.userData.language == 'EN' ? columns[i].ENTitle : columns[i].title,
						dataIndex: columns[i].dataIndex,
						width: parseInt(columns[i].width),
						align: columns[i].align || 'center',
						count: columns[i].count,
						hide: columns[i].hide,
						orderListID: columns[i].orderListID,
					})
				}

				if (columns[i].dataIndex == 'totalPrice') {//总价
					dynColumns.push({
						title: this.state.userData.language == 'EN' ? columns[i].ENTitle : columns[i].title,
						dataIndex: columns[i].dataIndex,
						width: parseInt(columns[i].width),
						align: columns[i].align || 'center',
						count: columns[i].count,
						hide: columns[i].hide,
						orderListID: columns[i].orderListID,
						className: 'totalClassName',
						render: (text, data) => {
							//(疗程数*factor*frequency)/cycleDays
							var totalNum = 0;//总次数
							var totalDosc = 0;//总剂量
							var oneDosc = 0;//剂量
							var oneQty = 0;//单次数量
							if (this.state.isCalculation !== 'N') {
								if (data.cycleDays) {//优先使用cycleDays，计算总次数
									totalNum = Math.ceil((parseFloat(!Util.isEmpty(data.ordDurQty) ? data.ordDurQty : 1) * parseFloat(data.duraFactor || 1) * parseFloat(data.frequency || 1)) / (data.cycleDays && parseFloat(data.cycleDays) > 0 ? parseFloat(data.cycleDays) : 1))
								} else {
									totalNum = Math.ceil((parseFloat(!Util.isEmpty(data.ordDurQty) ? data.ordDurQty : 1) * parseFloat(data.duraFactor || 1) * parseFloat(data.frequency || 1)) / (data.intervalDays && parseFloat(data.intervalDays) > 0 ? parseFloat(data.intervalDays) : 1))
								}
								//门诊
								if (data.ordToalCountO == 'Y') {
									totalDosc = Math.ceil((parseFloat(data.ordDose ? data.ordDose : 1) * totalNum * parseFloat(data.doseMolecule)).toFixed(2) / (parseFloat(data.doseDenominator) > 0 ? parseFloat(data.doseDenominator) : 1))
									//最后算总数量
									if (Util.isEmpty(data.duraFactor) || Util.isEmpty(data.ordDurQty) || Util.isEmpty(data.frequency) ||
										Util.isEmpty(data.cycleDays) || Util.isEmpty(data.ordDose) || Util.isEmpty(data.doseMolecule)
										|| Util.isEmpty(data.doseDenominator) || Util.isEmpty(data.doseDenominator)) {
										totalCount = Math.ceil((totalDosc * parseFloat(data.qtyMolecule)) / (parseFloat(data.qtyDenominator) > 0 ? parseFloat(data.qtyDenominator) : 1))
										if (Util.isEmpty(data.ordID) && data.qtyStatus == '2') {
											data.ordQty = totalCount
											data.totalCount = totalCount
										}
									} else {
										totalCount = Math.ceil((totalDosc * parseFloat(data.qtyMolecule)) / (parseFloat(data.qtyDenominator) > 0 ? parseFloat(data.qtyDenominator) : 1))
										if (Util.isEmpty(data.ordID) && data.qtyStatus == '2') {
											data.ordQty = totalCount
											data.totalCount = totalCount
										} else {
											data.totalCount = data.ordQty ? data.ordQty : 1
										}
									}
								} else {//先取整，再算
									oneDosc = Math.ceil((parseFloat(data.ordDose ? data.ordDose : 1) * parseFloat(data.doseMolecule ? data.doseMolecule : 1)) / (parseFloat(data.doseDenominator) > 0 ? parseFloat(data.doseDenominator) : 1))
									// totalDosc = oneDosc * totalNum
									oneQty = Math.ceil((oneDosc * parseFloat(data.qtyMolecule ? data.qtyMolecule : 1)) / (parseFloat(data.qtyDenominator) > 0 ? parseFloat(data.qtyDenominator) : 1))
									data.totalCount = oneQty * totalNum
								}

								if (this.props.patStatus == '1') {
									if (data.ordToalCountI == 'Y') {
										totalDosc = Math.ceil((parseFloat(data.ordDose ? data.ordDose : 1) * totalNum * parseFloat(data.doseMolecule)) / (parseFloat(data.doseDenominator) > 0 ? parseFloat(data.doseDenominator) : 1))
										//最后算总数量
										if (Util.isEmpty(data.duraFactor) || Util.isEmpty(data.ordDurQty) || Util.isEmpty(data.frequency) ||
											Util.isEmpty(data.cycleDays) || Util.isEmpty(data.ordDose) || Util.isEmpty(data.doseMolecule)
											|| Util.isEmpty(data.doseDenominator) || Util.isEmpty(data.doseDenominator)) {
											totalCount = 1
											if (Util.isEmpty(data.ordID) && data.qtyStatus == '2') {
												data.ordQty = totalCount
												data.totalCount = totalCount
											}
										} else {
											totalCount = Math.ceil((totalDosc * parseFloat(data.doseMolecule)) / (parseFloat(data.qtyDenominator) > 0 ? parseFloat(data.qtyDenominator) : 1))
											if (Util.isEmpty(data.ordID) && data.qtyStatus == '2') {
												data.ordQty = totalCount
												data.totalCount = totalCount
											} else {
												data.totalCount = data.ordQty ? data.ordQty : 1
											}
										}
									} else {
										oneDosc = Math.ceil((parseFloat(data.ordDose) * parseFloat(data.doseMolecule)) / (parseFloat(data.doseDenominator) > 0 ? parseFloat(data.doseDenominator) : 1))
										totalDosc = oneDosc * totalNum
									}
								}

							}

							// //最后算总数量
							// if (Util.isEmpty(data.duraFactor) || Util.isEmpty(data.ordDurQty) || Util.isEmpty(data.frequency) ||
							//     Util.isEmpty(data.cycleDays) || Util.isEmpty(data.ordDose) || Util.isEmpty(data.doseMolecule)
							//     || Util.isEmpty(data.doseDenominator) || Util.isEmpty(data.doseDenominator)) {
							//     totalCount = 1
							//     if (Util.isEmpty(data.ordID) && data.qtyStatus == '2') {
							//         data.ordQty = totalCount
							//         data.totalCount = totalCount
							//     }
							// } else {
							//     totalCount = Math.ceil((totalDosc * parseFloat(data.doseMolecule)) / (parseFloat(data.qtyDenominator) > 0 ? parseFloat(data.qtyDenominator) : 1))
							//     if (Util.isEmpty(data.ordID) && data.qtyStatus == '2') {
							//         data.ordQty = totalCount
							//         data.totalCount = totalCount
							//     } else {
							//         data.totalCount = data.ordQty ? data.ordQty : 1
							//     }
							// }
							return data.ordID ? data.ordTotalPrice : <span style={{ width: '98%' }}>
								{/* {data.defaultStatus == true ? data.totalPrice : */}
								{data.defaultStatus == true ? (data.defaultStatus == true ? (((data.ordQty || 1) * parseFloat(data.ordPrice || 0))).toFixed(2) :
									(((data.newQty || 1) * parseFloat(data.ordPrice || 0))).toFixed(2)) :
									((parseFloat(data.qtyStatus == '1' ? (data.ordQty ? data.ordQty : 0) : (data.totalCount || 1)) * parseFloat(data.ordPrice || 0)).toFixed(2))}</span>
						}
					})
				}

				if (columns[i].dataIndex == 'ordSkinTestFlag') {//皮试
					dynColumns.push({
						title: this.state.userData.language == 'EN' ? columns[i].ENTitle : columns[i].title,
						dataIndex: columns[i].dataIndex,
						width: parseInt(columns[i].width),
						align: columns[i].align || 'center',
						count: columns[i].count,
						hide: columns[i].hide,
						orderListID: columns[i].orderListID,
						render: (text, data, index) => {
							//置灰编辑框
							var unableToEdit = data.unableToEdit;
							var editFlag = false;
							if (unableToEdit) {
								for (var j = 0; j < unableToEdit.length; j++) {
									if (unableToEdit[j] == 'ordSkinTestFlag') {
										editFlag = true
									}
								}
							}
							return editFlag ? undefined : (data.ordID ? <Checkbox disabled={true} checked={data.ordSkinTestFlag == 'Y' ? true : (data.ordSkinTestFlagValue == 'Y' ? true : false)} /> :
								<Checkbox checked={data.ordSkinTestFlagValue == 'Y' ? true : (data.ordSkinTestFlag == 'Y' && data.ordSkinTestFlagValue == 'Y' ? true : false)}
									disabled={editFlag ? true : (data.testFlag == 'N' ? true : false)}
									onChange={this.changeCheckBox.bind(this, 'ordSkinTestFlag', index)} />)
						}
					})
				}

				if (columns[i].dataIndex == 'ordSkinTestWayID') {//皮试备注
					dynColumns.push({
						title: this.state.userData.language == 'EN' ? columns[i].ENTitle : columns[i].title,
						dataIndex: columns[i].dataIndex,
						width: parseInt(columns[i].width),
						align: columns[i].align || 'center',
						count: columns[i].count,
						hide: columns[i].hide,
						orderListID: columns[i].orderListID,
						render: (text, data, index) => {
							var skinTextWayListOption = []

							// var { skinTestWayList } = this.state;
							var skinTestWayList = data.skinTestWayList;
							var newData = []
							skinTestWayList && skinTestWayList.map((item, index) => {
								skinTextWayListOption.push(<Option key={index} value={item.id}
									onClick={this.handleOnSelectColumns.bind(this, 'ordSkinTestWayID', index, data)}>{item.descripts}</Option>)
							})
							// }
							//置灰编辑框
							var unableToEdit = data.unableToEdit;
							var editFlag = false;
							if (unableToEdit) {
								for (var j = 0; j < unableToEdit.length; j++) {
									if (unableToEdit[j] == 'ordSkinTestWayID') {
										editFlag = true
									}
								}
							}
							return editFlag ? undefined : (data.ordID ? <span>{data.ordSkinTestWayDesc}</span> : (
								<Select
									style={{ width: '98%' }}
									showArrow={false}
									allowClear
									// ref={index == this.state.linkRoutes ? this.ordSkinTestWayID : ''}
									value={data.ordSkinTestWayID}
									disabled={editFlag ? true : (data.ordSkinTestFlagValue == 'Y' ? false : (data.ordSkinTestFlag == 'Y' && data.ordSkinTestFlagValue == 'Y' ? false : true))}
									ref={ref => this['ordSkinTestWayID' + index] = ref}
									onClick={this.handleClearOrdMedItemFocus}
									onChange={this.changeCommonSelect.bind(this, 'ordSkinTestWayID', index, data)}
									onKeyDown={this.handleNextColumns.bind(this, 'ordSkinTestWayID', index, data)}
									onSelect={this.handleOnSelectColumns.bind(this, 'ordSkinTestWayID', index, data)}
								>
									{skinTextWayListOption}
								</Select>
							))
						}
					})
				}

				if (columns[i].dataIndex == 'ordPriorityID') {//医嘱优先级
					dynColumns.push({
						title: this.state.userData.language == 'EN' ? columns[i].ENTitle : columns[i].title,
						dataIndex: columns[i].dataIndex,
						width: parseInt(columns[i].width),
						align: columns[i].align || 'center',
						count: columns[i].count,
						hide: columns[i].hide,
						orderListID: columns[i].orderListID,
						render: (text, data, index) => {
							var priorityListOption = []

							// var { priorityList } = this.state;
							var priorityList = data.priorityList;
							priorityList && priorityList.map((item, index) => {
								priorityListOption.push(<Option key={index} value={item.id} noSub={item.noSub}
									onClick={this.handleOnSelectColumns.bind(this, 'ordPriorityID', index, data)}>{item.descripts}</Option>)
							})
							// }
							//置灰编辑框
							var unableToEdit = data.unableToEdit;
							var editFlag = false;
							if (unableToEdit) {
								for (var j = 0; j < unableToEdit.length; j++) {
									if (unableToEdit[j] == 'ordPriorityID') {
										editFlag = true
									}
								}
							}
							return editFlag ? undefined : (data.ordID ? <span>{data.ordPriorityDesc}</span> : (
								<Select
									showArrow={false}
									//  ref={index == this.state.linkRoutes ? this.ordPriorityID : ''}
									disabled={editFlag ? true : (data.ordLinkStatus ? true :
										(!Util.isEmpty(data.identity) && this.state.groupStatus && data.checkIdenty == '2' ? true : (!Util.isEmpty(data.mainIndexId) ? true : false)))}
									value={data.ordPriorityID}
									ref={ref => this['ordPriorityID' + index] = ref}
									onClick={this.handleClearOrdMedItemFocus}
									onKeyDown={this.handleNextColumns.bind(this, 'ordPriorityID', index, data)}
									onSelect={this.handleOnSelectColumns.bind(this, 'ordPriorityID', index, data)}
									onChange={this.changeCommonSelect.bind(this, 'ordPriorityID', index, data)} style={{ width: '98%' }}
								>
									{priorityListOption}
								</Select>
							))
						}
					})
				}

				if (columns[i].dataIndex == 'ordSpecID') {//标本
					dynColumns.push({
						title: this.state.userData.language == 'EN' ? columns[i].ENTitle : columns[i].title,
						dataIndex: columns[i].dataIndex,
						width: parseInt(columns[i].width),
						align: columns[i].align || 'center',
						count: columns[i].count,
						hide: columns[i].hide,
						orderListID: columns[i].orderListID,
						render: (text, data, index) => {
							var specListOption = []

							// var { specList } = this.state;
							var specList = data.specList;
							// var newData = []
							specList && specList.map((item, index) => {
								specListOption.push(<Option key={index} value={item.id}
									onClick={this.handleOnSelectColumns.bind(this, 'ordSpecID', index, data)}>{item.descripts}</Option>)
							})
							// }
							//置灰编辑框
							var unableToEdit = data.unableToEdit;
							var editFlag = false;
							if (unableToEdit) {
								for (var j = 0; j < unableToEdit.length; j++) {
									if (unableToEdit[j] == 'ordSpecID') {
										editFlag = true
									}
								}
							}
							return editFlag ? undefined : (data.ordID ? <span>{data.ordSpecDesc}</span> : (
								<Select
									style={{ width: '98%' }}
									showArrow={false}
									//  ref={index == this.state.linkRoutes ? this.ordSpecID : ''}
									disabled={editFlag ? true : false} value={data.ordSpecID}
									ref={ref => this['ordSpecID' + index] = ref}
									onClick={this.handleClearOrdMedItemFocus}
									onChange={this.changeCommonSelect.bind(this, 'ordSpecID', index, data)}
									onKeyDown={this.handleNextColumns.bind(this, 'ordSpecID', index, data)}
									onSelect={this.handleOnSelectColumns.bind(this, 'ordSpecID', index, data)}
								>
									{specListOption}
								</Select>
							))
						}
					})
				}

				if (columns[i].dataIndex == 'ordEMFlag') {//急诊
					dynColumns.push({
						title: this.state.userData.language == 'EN' ? columns[i].ENTitle : columns[i].title,
						dataIndex: columns[i].dataIndex,
						width: parseInt(columns[i].width),
						align: columns[i].align || 'center',
						count: columns[i].count,
						hide: columns[i].hide,
						orderListID: columns[i].orderListID,
						render: (text, data, index) => {
							//置灰编辑框
							var unableToEdit = data.unableToEdit;
							var editFlag = false;
							if (unableToEdit) {
								for (var j = 0; j < unableToEdit.length; j++) {
									if (unableToEdit[j] == 'ordEMFlag') {
										editFlag = true
									}
								}
							}
							return editFlag ? undefined : (data.ordID ? <Checkbox disabled={true} checked={data.ordEMFlag == 'Y' ? true : (data.ordEMFlagValue == 'Y' ? true : false)} /> :
								<Checkbox checked={data.ordEMFlag == 'Y' ? true : (data.ordEMFlagValue == 'Y' ? true : false)}
									disabled={editFlag ? true : (data.testEMFlag == 'Y' ? false : true)}
									onChange={this.changeCheckBox.bind(this, 'ordEMFlag', index)} />)
						}
					})
				}

				if (columns[i].dataIndex == 'ordNotea') {//嘱托
					dynColumns.push({
						title: this.state.userData.language == 'EN' ? columns[i].ENTitle : columns[i].title,
						dataIndex: columns[i].dataIndex,
						width: parseInt(columns[i].width),
						align: columns[i].align || 'center',
						count: columns[i].count,
						hide: columns[i].hide,
						orderListID: columns[i].orderListID,
						render: (text, data, index) => {
							//置灰编辑框
							var unableToEdit = data.unableToEdit;
							var editFlag = false;
							if (unableToEdit) {
								for (var j = 0; j < unableToEdit.length; j++) {
									if (unableToEdit[j] == 'ordNotea') {
										editFlag = true
									}
								}
							}
							return editFlag ? undefined : (data.ordID ? <span>{data.ordNotea}</span> : <Input style={{ width: '98%' }}
								// onKeyDown={this.handleNextColumns.bind(this,'ordNotea',index,data)} ref={this.ordNotea}
								disabled={editFlag ? true : false} onChange={this.commonInput.bind(this, 'ordNotea', index, data)} />)
						}
					})
				}

				if (columns[i].dataIndex == 'ordNote') {//备注
					dynColumns.push({
						title: this.state.userData.language == 'EN' ? columns[i].ENTitle : columns[i].title,
						dataIndex: columns[i].dataIndex,
						width: parseInt(columns[i].width),
						align: columns[i].align || 'center',
						count: columns[i].count,
						hide: columns[i].hide,
						orderListID: columns[i].orderListID,
						render: (text, data, index) => {
							var ordNoteListtOption = []
							var ordNoteList = data.ordNoteList;
							var newData = []
							ordNoteList && ordNoteList.map((item, index) => {
								ordNoteListtOption.push(<Option key={index} value={item.descripts}
									onClick={this.handleOnSelectColumns.bind(this, 'ordNote', index, data)}>{item.descripts}</Option>)
							})
							//置灰编辑框
							var unableToEdit = data.unableToEdit;
							var editFlag = false;
							if (unableToEdit) {
								for (var j = 0; j < unableToEdit.length; j++) {
									if (unableToEdit[j] == 'ordNote') {
										editFlag = true
									}
								}
							}
							// return editFlag ? undefined : (data.ordID ? <span>{data.ordNote}</span> : <Input style={{ width: '98%' }}
							//     onKeyDown={this.handleNextColumns.bind(this, 'ordNote', index, data)}
							//     ref={index == this.state.linkRoutes ? this.ordNote : ''} value={data.ordNote}
							//     disabled={editFlag ? true : false} onChange={this.commonInput.bind(this, 'ordNote', index, data)} />)
							return editFlag ? undefined : (data.ordID ? <span>{data.ordNote}</span> : (
								<AutoComplete
									style={{ width: '98%' }}
									//  ref={index == this.state.linkRoutes ? this.ordNote : ''}
									value={data.ordNote}
									dataSource={ordNoteListtOption}
									ref={ref => this['ordNote' + index] = ref}
									onClick={this.handleClearOrdMedItemFocus}
									onKeyDown={this.handleNextColumns.bind(this, 'ordNote', index, data)}
									onSelect={this.handleOnSelectColumns.bind(this, 'ordNote', index, data)}
									disabled={editFlag ? true : false} onChange={this.commonInput.bind(this, 'ordNote', index, data)}
								/>
							))
						}
					})
				}

				if (columns[i].dataIndex == 'ordInfuseSpeed') {//滴速
					dynColumns.push({
						title: this.state.userData.language == 'EN' ? columns[i].ENTitle : columns[i].title,
						dataIndex: columns[i].dataIndex,
						width: parseInt(columns[i].width),
						align: columns[i].align || 'center',
						count: columns[i].count,
						hide: columns[i].hide,
						orderListID: columns[i].orderListID,
						render: (text, data, index) => {
							//置灰编辑框
							var unableToEdit = data.unableToEdit;
							var editFlag = false;
							if (unableToEdit) {
								for (var j = 0; j < unableToEdit.length; j++) {
									if (unableToEdit[j] == 'ordInfuseSpeed') {
										editFlag = true
									}
								}
							}
							return editFlag ? undefined : (data.ordID ? <span>{data.ordInfuseSpeed}</span> : (
								<Input
									style={{ width: '98%' }}
									//  ref={index == this.state.linkRoutes ? this.ordInfuseSpeed : ''}
									value={data.ordInfuseSpeed}
									disabled={editFlag ? true : false} onChange={this.commonInput.bind(this, 'ordInfuseSpeed', index, data)}
									ref={ref => this['ordInfuseSpeed' + index] = ref}
									onClick={this.handleClearOrdMedItemFocus}
									onKeyDown={this.handleNextColumns.bind(this, 'ordInfuseSpeed', index, data)}
								/>
							))
						}
					})
				}

				if (columns[i].dataIndex == 'ordSpeedUnitID') { // 滴速单位
					dynColumns.push({
						title: this.state.userData.language == 'EN' ? columns[i].ENTitle : columns[i].title,
						dataIndex: columns[i].dataIndex,
						width: parseInt(columns[i].width),
						align: columns[i].align || 'center',
						count: columns[i].count,
						hide: columns[i].hide,
						orderListID: columns[i].orderListID,
						render: (text, data, index) => {
							var speedUnitListOption = []

							// var { recLocList } = this.state;
							var infuseSpeedList = data.infuseSpeedList;
							infuseSpeedList && infuseSpeedList.map((item, index) => {
								speedUnitListOption.push(<Option key={index} value={item.id}
									onClick={this.handleOnSelectColumns.bind(this, 'ordSpeedUnitID', index, data)}>{item.descripts}</Option>)
							})
							// }
							//置灰编辑框
							var unableToEdit = data.unableToEdit;
							var editFlag = false;
							if (unableToEdit) {
								for (var j = 0; j < unableToEdit.length; j++) {
									if (unableToEdit[j] == 'ordSpeedUnitID') {
										editFlag = true
									}
								}
							}
							return editFlag ? undefined : (data.ordID ? <span>{data.ordSpeedUnitDesc}</span> : (
								<Select
									style={{ width: '98%' }}
									allowClear
									showArrow={false}
									//  ref={index == this.state.linkRoutes ? this.ordSpeedUnitID : ''}
									disabled={editFlag ? true : false}
									value={data.ordSpeedUnitID}
									ref={ref => this['ordSpeedUnitID' + index] = ref}
									onClick={this.handleClearOrdMedItemFocus}
									onChange={this.changeCommonSelect.bind(this, 'ordSpeedUnitID', index, data)}
									onKeyDown={this.handleNextColumns.bind(this, 'ordSpeedUnitID', index, data)}
									onSelect={this.handleOnSelectColumns.bind(this, 'ordSpeedUnitID', index, data)}
								>
									{speedUnitListOption}
								</Select>
							))
						}
					})
				}

				if (columns[i].dataIndex == 'degreesID') { // 晶体度数
					dynColumns.push({
						title: this.state.userData.language == 'EN' ? columns[i].ENTitle : columns[i].title,
						dataIndex: columns[i].dataIndex,
						width: parseInt(columns[i].width),
						align: columns[i].align || 'center',
						count: columns[i].count,
						hide: columns[i].hide,
						orderListID: columns[i].orderListID,
						render: (text, data, index) => {
							var degreesListOption = []

							// var { recLocList } = this.state;
							var degreesList = data.degreesList;
							degreesList && degreesList.map((item, index) => {
								degreesListOption.push(<Option key={index} value={item.id} descripts={item.descripts} name={item.descriptsSPCode}
									onClick={this.handleOnSelectColumns.bind(this, 'degreesID', index, data)}>{item.descripts}</Option>)
							})
							// }
							//置灰编辑框
							var unableToEdit = data.unableToEdit;
							var editFlag = false;
							if (unableToEdit) {
								for (var j = 0; j < unableToEdit.length; j++) {
									if (unableToEdit[j] == 'degreesID') {
										editFlag = true
									}
								}
							}
							return editFlag ? undefined : (data.ordID ? <span>{data.degreesDesc}</span> : (
								<Select
									style={{ width: '98%' }}
									allowClear showArrow={false} showSearch
									filterOption={(input, option) =>
										option.props.descripts.toLowerCase().indexOf(input.toLowerCase()) >= 0
										|| option.props.name.toLowerCase().indexOf(input.toLowerCase()) >= 0
									}
									//  ref={index == this.state.linkRoutes ? this.degreesID : ''}
									disabled={editFlag ? true : false}
									value={data.degreesID}
									ref={ref => this['degreesID' + index] = ref}
									onClick={this.handleClearOrdMedItemFocus}
									onChange={this.changeCommonSelect.bind(this, 'degreesID', index, data)}
									onKeyDown={this.handleNextColumns.bind(this, 'degreesID', index, data)}
									onSelect={this.handleOnSelectColumns.bind(this, 'degreesID', index, data)}
								>
									{degreesListOption}
								</Select>
							))
						}
					})
				}

				if (columns[i].dataIndex == 'eyePart') {//眼别
					dynColumns.push({
						title: this.state.userData.language == 'EN' ? columns[i].ENTitle : columns[i].title,
						dataIndex: columns[i].dataIndex,
						width: parseInt(columns[i].width),
						align: columns[i].align || 'center',
						count: columns[i].count,
						hide: columns[i].hide,
						orderListID: columns[i].orderListID,
						render: (text, data, index) => {
							var eyePartListOption = []

							// var { recLocList } = this.state;
							var eyePartList = data.eyePartList;
							eyePartList && eyePartList.map((item, index) => {
								eyePartListOption.push(<Option key={index} value={item.descripts} descripts={item.descripts} name={item.descriptsSPCode}
									onClick={this.handleOnSelectColumns.bind(this, 'eyePartID', index, data)}>{item.descripts}</Option>)
							})
							// }
							//置灰编辑框
							var unableToEdit = data.unableToEdit;
							var editFlag = false;
							if (unableToEdit) {
								for (var j = 0; j < unableToEdit.length; j++) {
									if (unableToEdit[j] == 'eyePartID') {
										editFlag = true
									}
								}
							}
							return editFlag ? undefined : (data.ordID ? <span>{data.eyePartDesc}</span> : (
								<Select
									style={{ width: '98%' }}
									allowClear showArrow={false}
									showSearch
									filterOption={(input, option) =>
										option.props.descripts.toLowerCase().indexOf(input.toLowerCase()) >= 0
										|| option.props.name.toLowerCase().indexOf(input.toLowerCase()) >= 0
									}
									//  ref={index == this.state.linkRoutes ? this.eyePartID : ''}
									ref={ref => this['eyePartID' + index] = ref}
									disabled={editFlag ? true : false}
									value={data.eyePartID}
									onClick={this.handleClearOrdMedItemFocus}
									onKeyDown={this.handleNextColumns.bind(this, 'eyePartID', index, data)}
									onChange={this.changeCommonSelect.bind(this, 'eyePartID', index, data)}
									onSelect={this.handleOnSelectColumns.bind(this, 'eyePartID', index, data)}
								>
									{eyePartListOption}
								</Select>
							))
						}
					})
				}

				if (columns[i].dataIndex == 'bodyPartID') {//部位
					dynColumns.push({
						title: this.state.userData.language == 'EN' ? columns[i].ENTitle : columns[i].title,
						dataIndex: columns[i].dataIndex,
						width: parseInt(columns[i].width),
						align: columns[i].align || 'center',
						count: columns[i].count,
						hide: columns[i].hide,
						orderListID: columns[i].orderListID,
						render: (text, data, index) => {
							var bodyPartListOption = []

							// var { recLocList } = this.state;
							var bodyPartList = data.bodyPartList;
							bodyPartList && bodyPartList.map((item, index) => {
								bodyPartListOption.push(<Option key={index} value={item.id} partid={item.id} descripts={item.descripts}
									mutexflag={item.mutexFlag} ordprice={Number(item.ordPrice)}
									onClick={this.handleOnSelectColumns.bind(this, 'ordbodyPartID', index, data)}
								>{item.descripts}</Option>)
							})
							// }
							//置灰编辑框
							var unableToEdit = data.unableToEdit;
							var editFlag = false;
							if (unableToEdit) {
								for (var j = 0; j < unableToEdit.length; j++) {
									if (unableToEdit[j] == 'bodyPartID') {
										editFlag = true
									}
								}
							}
							return editFlag ? undefined : (data.ordID ? <span>{data.ordbodyPartDesc}</span> : (data.radioFlag == 'Y' ? (
								<Select style={{ width: '98%' }}
									allowClear showSearch
									//  ref={index == this.state.linkRoutes ? this.bodyPartID : ''}
									disabled={editFlag ? true : (data.ordLinkStatus ? true :
										(!Util.isEmpty(data.identity) && this.state.groupStatus && data.checkIdenty == '2' ? true : (!Util.isEmpty(data.mainIndexId) ? true : false)))}
									value={data.ordbodyPartID}
									ref={ref => this['bodyPartID' + index] = ref}      //增加定位行号 add by liangjiaquan 2022.2.28
									onClick={this.handleClearOrdMedItemFocus}
									onSelect={this.handleOnSelectColumns.bind(this, 'ordbodyPartID', index, data)}
									onKeyDown={this.handleNextColumns.bind(this, 'ordbodyPartID', index, data)}
									onChange={this.changeBodyPartRadioSelect.bind(this, 'ordbodyPartID', index, data)}
								>
									{bodyPartListOption}
								</Select>
							) : (
								<Select
									style={{ width: '98%' }}
									allowClear showArrow={false} showSearch mode='tags'
									//  ref={index == this.state.linkRoutes ? this.bodyPartID : ''}
									disabled={editFlag ? true : false}
									value={data.ordbodyPartID}
									ref={ref => this['bodyPartID' + index] = ref}       //增加定位行号 add by liangjiaquan 2022.2.28
									onClick={this.handleClearOrdMedItemFocus}
									onKeyDown={this.handleNextColumns.bind(this, 'ordbodyPartID', index, data)}
									onChange={this.changeBodyPartSelect.bind(this, 'ordbodyPartID', index, data)}
									onSelect={this.handleOnSelectColumns.bind(this, 'ordbodyPartID', index, data)}
								>
									{bodyPartListOption}
								</Select>
							)))
						}
					})
				}

				if (columns[i].dataIndex == 'prescribeAdoctor') {//开医嘱人
					dynColumns.push({
						title: this.state.userData.language == 'EN' ? columns[i].ENTitle : columns[i].title,
						dataIndex: columns[i].dataIndex,
						width: parseInt(columns[i].width),
						align: columns[i].align || 'center',
						count: columns[i].count,
						hide: columns[i].hide,
						orderListID: columns[i].orderListID,
						render: (text, data, index) => {
							return <span>{data.prescribeAdoctor ? data.prescribeAdoctor : this.state.userData && this.state.userData.userName}</span>
						}
					})
				}

				if (columns[i].dataIndex == 'ordRecLocID') {//执行科室
					dynColumns.push({
						title: this.state.userData.language == 'EN' ? columns[i].ENTitle : columns[i].title,
						dataIndex: columns[i].dataIndex,
						width: parseInt(columns[i].width),
						align: columns[i].align || 'center',
						count: columns[i].count,
						hide: columns[i].hide,
						orderListID: columns[i].orderListID,
						render: (text, data, index) => {
							var recLocListOption = []

							// var { recLocList } = this.state;
							var recLocList = data.recLocList;
							var newData = []
							recLocList && recLocList.map((item, index) => {
								recLocListOption.push(<Option key={index} value={item.recLocID}
									onClick={this.handleOnSelectColumns.bind(this, 'ordRecLocID', index, data)}>{item.recLocDesc}</Option>)
							})
							// }
							//置灰编辑框
							var unableToEdit = data.unableToEdit;
							var editFlag = false;
							if (unableToEdit) {
								for (var j = 0; j < unableToEdit.length; j++) {
									if (unableToEdit[j] == 'ordRecLocID') {
										editFlag = true
									}
								}
							}
							return editFlag ? undefined : (data.ordID ? <span>{data.ordRecLocDesc}</span> : (
								<Select
									style={{ width: '98%' }}
									showArrow={false}
									//  ref={index == this.state.linkRoutes ? this.ordRecLocID : ''}
									// disabled={editFlag ? true : (data.ordLinkStatus ? true :
									//     (!Util.isEmpty(data.identity) && this.state.groupStatus && data.checkIdenty == '2' ? true : (!Util.isEmpty(data.mainIndexId) ? true : false)))}
									value={data.ordRecLocID}
									ref={ref => this['ordRecLocID' + index] = ref}
									onClick={this.handleClearOrdMedItemFocus}
									onChange={this.changeCommonSelect.bind(this, 'ordRecLocID', index, data)}
									onKeyDown={this.handleNextColumns.bind(this, 'ordRecLocID', index, data)}
									onSelect={this.handleOnSelectColumns.bind(this, 'ordRecLocID', index, data)}
								>
									{recLocListOption}
								</Select>
							))
						}
					})
				}

				if (columns[i].dataIndex == 'exceDurReason') {//超疗程原因
					dynColumns.push({
						title: this.state.userData.language == 'EN' ? columns[i].ENTitle : columns[i].title,
						dataIndex: columns[i].dataIndex,
						width: parseInt(columns[i].width),
						align: columns[i].align || 'center',
						count: columns[i].count,
						hide: columns[i].hide,
						orderListID: columns[i].orderListID,
						render: (text, data, index) => {
							var causeListOption = []

							// var { recLocList } = this.state;
							var causeList = data.causeList;
							causeList && causeList.map((item, index) => {
								causeListOption.push(<Option key={index} value={item.id}
									onClick={this.handleOnSelectColumns.bind(this, 'ordOverdoseCauseID', index, data)}>{item.descripts}</Option>)
							})
							// }
							//置灰编辑框
							var unableToEdit = data.unableToEdit;
							var editFlag = false;
							if (unableToEdit) {
								for (var j = 0; j < unableToEdit.length; j++) {
									if (unableToEdit[j] == 'ordOverdoseCauseID') {
										editFlag = true
									}
								}
							}
							return editFlag ? undefined : (data.ordID ? <span>{data.ordOverdoseCauseDesc}</span> : (
								<Select
									style={{ width: '98%' }}
									allowClear showArrow={false}
									//  ref={index == this.state.linkRoutes ? this.exceDurReason : ''}
									disabled={editFlag ? true : (data.ordLinkStatus ? true :
										(!Util.isEmpty(data.identity) && this.state.groupStatus && data.checkIdenty == '2' ? true : (!Util.isEmpty(data.mainIndexId) ? true : false)))}
									value={data.ordOverdoseCauseID}
									ref={ref => this['exceDurReason' + index] = ref}
									onClick={this.handleClearOrdMedItemFocus}
									onChange={this.changeCommonSelect.bind(this, 'ordOverdoseCauseID', index, data)}
									onKeyDown={this.handleNextColumns.bind(this, 'ordOverdoseCauseID', index, data)}
									onSelect={this.handleOnSelectColumns.bind(this, 'ordOverdoseCauseID', index, data)}
								>
									{causeListOption}
								</Select>
							))
						}
					})
				}

				if (columns[i].dataIndex == 'ordStageID') {//医嘱阶段
					dynColumns.push({
						title: this.state.userData.language == 'EN' ? columns[i].ENTitle : columns[i].title,
						dataIndex: columns[i].dataIndex,
						width: parseInt(columns[i].width),
						align: columns[i].align || 'center',
						count: columns[i].count,
						hide: columns[i].hide,
						orderListID: columns[i].orderListID,
						render: (text, data, index) => {
							var stageListOption = []

							// var { qtyUnitList } = this.state;
							var stageList = data.stageList;
							stageList && stageList.map((item, index) => {
								stageListOption.push(<Option key={index} value={item.id}
									onClick={this.handleOnSelectColumns.bind(this, 'ordStageID', index, data)}>{item.descripts}</Option>)
							})
							// }

							//置灰编辑框
							var unableToEdit = data.unableToEdit;
							var editFlag = false;
							if (unableToEdit) {
								for (var j = 0; j < unableToEdit.length; j++) {
									if (unableToEdit[j] == 'ordStageID') {
										editFlag = true
									}
								}
							}
							return editFlag ? undefined : (data.ordID ? <span>{data.ordStageDesc}</span> : (
								<Select
									style={{ width: '98%' }}
									showArrow={false} allowClear
									//  ref={index == this.state.linkRoutes ? this.ordStageID : ''}
									disabled={editFlag ? true : (data.ordLinkStatus ? true :
										(!Util.isEmpty(data.identity) && this.state.groupStatus && data.checkIdenty == '2' ? true :
											(!Util.isEmpty(data.mainIndexId) ? true : false)))} value={data.ordStageID}
									ref={ref => this['ordStageID' + index] = ref}
									onClick={this.handleClearOrdMedItemFocus}
									onKeyDown={this.handleNextColumns.bind(this, 'ordStageID', index, data)}
									onSelect={this.handleOnSelectColumns.bind(this, 'ordStageID', index, data)}
									onChange={(e, option) => this.changeCommonSelect('ordStageID', index, data, e, option)}
								>
									{stageListOption}
								</Select>
							))
						}
					})
				}

				if (columns[i].dataIndex == 'ordInsuCat') {//大病医保类别
					dynColumns.push({
						title: this.state.userData.language == 'EN' ? columns[i].ENTitle : columns[i].title,
						dataIndex: columns[i].dataIndex,
						width: parseInt(columns[i].width),
						align: columns[i].align || 'center',
						count: columns[i].count,
						hide: columns[i].hide,
						orderListID: columns[i].orderListID,
						render: (text, data, index) => {
							var ordInsuCatOption = []

							// var { qtyUnitList } = this.state;
							var ordInsuCat = this.state.ordInsuCat;
							ordInsuCat && ordInsuCat.map((item, index) => {
								ordInsuCatOption.push(<Option key={index} value={item.id} code={item.descriptsSPCode} name={item.descripts}
									onClick={this.handleOnSelectColumns.bind(this, 'ordInsuCat', index, data)}>{item.descripts}</Option>)
							})
							// }

							//置灰编辑框
							var unableToEdit = data.unableToEdit;
							var editFlag = false;
							if (unableToEdit) {
								for (var j = 0; j < unableToEdit.length; j++) {
									if (unableToEdit[j] == 'ordInsuCat') {
										editFlag = true
									}
								}
							}
							return editFlag ? undefined : (data.ordID ? <span>{data.ordInsuCatDesc}</span> : (
								<Select
									style={{ width: '98%' }}
									showArrow={false} allowClear showSearch
									dropdownMatchSelectWidth={false}
									filterOption={(input, option) =>
										option.props.code.toLowerCase().indexOf(input.toLowerCase()) >= 0
										|| option.props.name.toLowerCase().indexOf(input.toLowerCase()) >= 0
									}
									//  ref={index == this.state.linkRoutes ? this.ordInsuCat : ''}
									disabled={editFlag ? true : false}
									value={data.ordInsuCat}
									ref={ref => this['ordInsuCat' + index] = ref}
									onClick={this.handleClearOrdMedItemFocus}
									onKeyDown={this.handleNextColumns.bind(this, 'ordInsuCat', index, data)}
									onSelect={this.handleOnSelectColumns.bind(this, 'ordInsuCat', index, data)}
									onChange={(e, option) => this.changeCommonSelect('ordInsuCat', index, data, e, option, data.admReasonList)}
								>
									{ordInsuCatOption}
								</Select>
							))
						}
					})
				}

				if (columns[i].dataIndex == 'ordDate') {//日期
					dynColumns.push({
						title: this.state.userData.language == 'EN' ? columns[i].ENTitle : columns[i].title,
						dataIndex: columns[i].dataIndex,
						width: parseInt(columns[i].width),
						align: columns[i].align || 'center',
						count: columns[i].count,
						hide: columns[i].hide,
						orderListID: columns[i].orderListID,
						render: (text, data, index) => {
							var date = new Date()
							//置灰编辑框
							var unableToEdit = data.unableToEdit;
							var editFlag = false;
							if (unableToEdit) {
								for (var j = 0; j < unableToEdit.length; j++) {
									if (unableToEdit[j] == 'ordDate') {
										editFlag = true
									}
								}
							}
							if (Util.isEmpty(data.ordDate) && Util.isEmpty(data.dateStatus)) {
								data.ordDate = moment(date).format(dayFormat)
							}
							return editFlag ? undefined : (data.ordID ? <span>{data.ordDate}</span> : (
								<DatePicker
									value={data.ordDate ? moment(data.ordDate, dayFormat) : ''}
									onClick={this.handleClearOrdMedItemFocus}
									onChange={this.changeCommonDate.bind(this, 'ordDate', index, data)}
								/>
							))
						}
					})
				}

				if (columns[i].dataIndex == 'ordStartDate') {//日期
					dynColumns.push({
						title: this.state.userData.language == 'EN' ? columns[i].ENTitle : columns[i].title,
						dataIndex: columns[i].dataIndex,
						width: parseInt(columns[i].width),
						align: columns[i].align || 'center',
						count: columns[i].count,
						hide: columns[i].hide,
						orderListID: columns[i].orderListID,
						render: (text, data, index) => {
							var date = new Date()
							//置灰编辑框
							var unableToEdit = data.unableToEdit;
							var editFlag = false;
							if (unableToEdit) {
								for (var j = 0; j < unableToEdit.length; j++) {
									if (unableToEdit[j] == 'ordStartDate') {
										editFlag = true
									}
								}
							}
							if (Util.isEmpty(data.ordStartDate) && Util.isEmpty(data.dateStatus)) {
								data.ordStartDate = moment(date).format(dayFormat)
							}
							return editFlag ? undefined : (data.ordID ? <span>{data.ordStartDate}</span> : (
								<DatePicker
									value={data.ordStartDate ? moment(data.ordStartDate, dayFormat) : ''}
									onClick={this.handleClearOrdMedItemFocus}
									onChange={this.changeCommonDate.bind(this, 'ordStartDate', index, data)}
								/>
							))
						}
					})
				}

				if (columns[i].dataIndex == 'ordTime') {//时间
					dynColumns.push({
						title: this.state.userData.language == 'EN' ? columns[i].ENTitle : columns[i].title,
						dataIndex: columns[i].dataIndex,
						width: parseInt(columns[i].width),
						align: columns[i].align || 'center',
						count: columns[i].count,
						hide: columns[i].hide,
						orderListID: columns[i].orderListID,
						render: (text, data, index) => {
							var date = new Date()
							//置灰编辑框
							var unableToEdit = data.unableToEdit;
							var editFlag = false;
							if (unableToEdit) {
								for (var j = 0; j < unableToEdit.length; j++) {
									if (unableToEdit[j] == 'ordTime') {
										editFlag = true
									}
								}
							}
							if (Util.isEmpty(data.ordTime) && Util.isEmpty(data.timeStatus)) {
								data.ordTime = moment(date).format(timeFormat)
							}
							return editFlag ? undefined : (data.ordID ? <span>{data.ordTime}</span> : (
								<TimePicker
									value={data.ordTime ? moment(data.ordTime, timeFormat) : ''}
									onClick={this.handleClearOrdMedItemFocus}
									onChange={this.changeCommonTime.bind(this, 'ordTime', index, data)}
								/>
							))
						}
					})
				}

				if (columns[i].dataIndex == 'ordStartTime') {//时间
					dynColumns.push({
						title: this.state.userData.language == 'EN' ? columns[i].ENTitle : columns[i].title,
						dataIndex: columns[i].dataIndex,
						width: parseInt(columns[i].width),
						align: columns[i].align || 'center',
						count: columns[i].count,
						hide: columns[i].hide,
						orderListID: columns[i].orderListID,
						render: (text, data, index) => {
							var date = new Date()
							//置灰编辑框
							var unableToEdit = data.unableToEdit;
							var editFlag = false;
							if (unableToEdit) {
								for (var j = 0; j < unableToEdit.length; j++) {
									if (unableToEdit[j] == 'ordStartTime') {
										editFlag = true
									}
								}
							}
							if (Util.isEmpty(data.ordStartTime) && Util.isEmpty(data.timeStatus)) {
								data.ordStartTime = moment(date).format(timeFormat)
							}
							return editFlag ? undefined : (data.ordID ? <span>{data.ordStartTime}</span> : (
								<TimePicker
									value={data.ordStartTime ? moment(data.ordStartTime, timeFormat) : ''}
									onClick={this.handleClearOrdMedItemFocus}
									onChange={this.changeCommonTime.bind(this, 'ordStartTime', index, data)}
								/>
							))
						}
					})
				}

				/**
				* @ByShizi: 需展示医保代码医保描述
				* Create 2022-07-01
				*/
				if (columns[i].dataIndex == 'insuCode' || columns[i].dataIndex == 'insuDesc') {// 描述展示
					dynColumns.push({
						title: this.state.userData.language == 'EN' ? columns[i].ENTitle : columns[i].title,
						dataIndex: columns[i].dataIndex,
						width: parseInt(columns[i].width),
						align: columns[i].align || 'center',
						count: columns[i].count,
						hide: columns[i].hide,
						orderListID: columns[i].orderListID,
						render: (text, data, index) => {
							return <span>{text}</span>
						}
					})
				}

				if (columns[i].dataIndex == 'antibioticDesc') { // 用药目的
					dynColumns.push({
						title: this.state.userData.language == 'EN' ? columns[i].ENTitle : columns[i].title,
						dataIndex: columns[i].dataIndex,
						width: parseInt(columns[i].width),
						align: columns[i].align || 'center',
						count: columns[i].count,
						hide: columns[i].hide,
						render: (text, data, index) => {
							if (data?.antibioticFlag === 'Y') {
								return <span className="span" title="点击修改用药目的及明细" onClick={() => this.handleAntibioticClick(data)}>{text}</span>
							} else {
								return <span>{text}</span>
							}
						}
					})
				}

				/**
				 * @ByShizi: 增加一列是否特殊医保
				 * 需要在医嘱录入列维护一个特殊医保标志列
				 * Create 2022-03-23
				*/
				if (columns[i].dataIndex == 'noINSUFlag') {//特殊医保标志
					dynColumns.push({
						title: this.state.userData.language == 'EN' ? columns[i].ENTitle : columns[i].title,
						dataIndex: columns[i].dataIndex,
						width: parseInt(columns[i].width),
						align: columns[i].align || 'center',
						count: columns[i].count,
						hide: columns[i].hide,
						orderListID: columns[i].orderListID,
						render(noINSUFlag) {
							let config = {
								'Y': '是',
								'N': '否'
							}
							return config[noINSUFlag];
						}
					})
				}

				if (columns[i].dataIndex == 'customPrice') { // 医嘱自定义价格
					dynColumns.push({
						title: this.state.userData.language == 'EN' ? columns[i].ENTitle : columns[i].title,
						dataIndex: columns[i].dataIndex,
						width: parseInt(columns[i].width),
						align: columns[i].align || 'center',
						count: columns[i].count,
						hide: columns[i].hide,
						orderListID: columns[i].orderListID,
						className: 'colClassName',
						render: (text, data, index) => {
							//置灰编辑框
							var unableToEdit = data.unableToEdit;
							var editFlag = false;
							if (unableToEdit) {
								for (var j = 0; j < unableToEdit.length; j++) {
									if (unableToEdit[j] == 'customPrice') {
										editFlag = true
									}
								}
							}
							return editFlag ? undefined : (!Util.isEmpty(data.ordID) ? data.customPrice : (
								<Input
									id={'customPrice' + index}
									type="number"
									className="input-number"
									value={data.customPrice}
									disabled={editFlag || data.customPriceFlag !== 'Y' ? true : false}
									onChange={this.commonInput.bind(this, 'customPrice', index, data)}
									onClick={this.handleClearOrdMedItemFocus}
									onKeyDown={this.handleNextColumns.bind(this, 'customPrice', index, data)}
								/>
							))
						}
					})
				}

				if (columns[i].dataIndex == 'uniformPurchFlag') { // 集采标志
					dynColumns.push({
						title: this.state.userData.language == 'EN' ? columns[i].ENTitle : columns[i].title,
						dataIndex: columns[i].dataIndex,
						width: parseInt(columns[i].width),
						align: columns[i].align || 'center',
						count: columns[i].count,
						hide: columns[i].hide,
						orderListID: columns[i].orderListID,
						render: (text, data, index) => {
							return <span>{data.uniformPurchFlag ? data.uniformPurchFlag : ''}</span>
						}
					})
				}

				if (columns[i].dataIndex == 'specialReason') { // 特殊说明
					dynColumns.push({
						title: this.state.userData.language == 'EN' ? columns[i].ENTitle : columns[i].title,
						dataIndex: columns[i].dataIndex,
						width: parseInt(columns[i].width),
						align: columns[i].align || 'center',
						count: columns[i].count,
						hide: columns[i].hide,
						orderListID: columns[i].orderListID,
						className: 'dasp-table-td-warn',
						render: (text, data, index) => {
							//置灰编辑框
							var unableToEdit = data.unableToEdit;
							var editFlag = false;
							if (unableToEdit) {
								for (var j = 0; j < unableToEdit.length; j++) {
									if (unableToEdit[j] == 'specialReason') {
										editFlag = true
									}
								}
							}
							return editFlag ? undefined : (!Util.isEmpty(data.ordID) ? data.specialReason : (
								<Input
									id={'specialReason' + index}
									value={data.specialReason}
									disabled={editFlag}
									onChange={this.commonInput.bind(this, 'specialReason', index, data)}
									onClick={this.handleClearOrdMedItemFocus}
									onKeyDown={this.handleNextColumns.bind(this, 'specialReason', index, data)}
								/>
							))
						}
					})
				}

				if (columns[i].dataIndex == 'firstBillFlag') {// 只首次计费标志
					dynColumns.push({
						title: this.state.userData.language == 'EN' ? columns[i].ENTitle : columns[i].title,
						dataIndex: columns[i].dataIndex,
						width: parseInt(columns[i].width),
						align: columns[i].align || 'center',
						count: columns[i].count,
						hide: columns[i].hide,
						orderListID: columns[i].orderListID,
						render: (text, data, index) => {
							//置灰编辑框
							var unableToEdit = data.unableToEdit;
							var editFlag = false;
							if (unableToEdit) {
								for (var j = 0; j < unableToEdit.length; j++) {
									if (unableToEdit[j] == 'firstBillFlag') {
										editFlag = true
									}
								}
							}
							return editFlag ? undefined : (!Util.isEmpty(data.ordID) ? <Checkbox disabled={true} checked={data.firstBillFlag == 'Y' ? true : (data.firstBillFlagValue == 'Y' ? true : false)} /> :
								<Checkbox
									checked={data.firstBillFlag == 'Y' ? true : (data.firstBillFlagValue == 'Y' ? true : false)}
									disabled={editFlag}
									onChange={this.changeCheckBox.bind(this, 'firstBillFlag', index)} />)
						}
					})
				}
			}
		}
		this.setState({
			dynColumns: dynColumns,
		})
	}

	//日期
	changeCommonDate(name, index, data, e) {
		this.state.dataSource[index][name] = e ? moment(e).format(dayFormat) : ''
		this.state.dataSource[index]['dateStatus'] = e ? '' : '1'
		this.setState({})
	}

	changeCommonTime(name, index, data, e) {
		this.state.dataSource[index][name] = e ? moment(e).format(timeFormat) : ''
		this.state.dataSource[index]['timeStatus'] = e ? '' : '1'
		this.setState({})
	}

	handleLoadUsage(name, index, data, e) {
		var params = {
			params: [{
				medID: data.medID,
				hospID: this.state.userData.hospID
			}]
		}
		$http.post('urlDeault', this, {
			code: "01040065",
			data: params,
			success: function (res) {
				if (res.errorCode == '0') {
					this.state.dataSource[index]['usageList'] = res.data
					this.setState({})
				}
			}
		});
	}

	onBlurFreqSelect(name, index, data, e) {
		var params = {
			params: [{
				hospID: this.state.userData.hospID,
				medID: data.medID,
				admID: this.state.patientData ? this.state.patientData.admID : '',
				ordPriorityID: data.ordPriorityID,
				language: this.state.userData.language
			}]
		}
		$http.post('urlDeault', this, {
			code: "03050143",
			data: params,
			success: function (res) {
				if (res.errorCode == '0') {
					this.state.dataSource[index]['frequenceList'] = res.result
					// this.state.dataSource[index]['ordFreqID'] = undefined
					if (name == 'status') {
						this.state.dataSource[index]['ordFreqID'] = undefined
					}
					this.setState({})
				}
			}
		});
	}

	setRowElement = (record, index) => {
		return {
			onDoubleClick: () => {
				this.rowClick(record, index)
			},
		}
	}

	setElement = (record, index) => {
		return {
			onClick: () => {
				this.setState({
					ordMessage: record.ordMessage,
					linkRoutes: index//解决列跳转不准的问题
				})
			},
		}
	}

	//enter获取行的焦点
	showTableRowClass(e) {
		if (e.keyCode == '13') {
			this.setState({
				newIndex: 0
			})
		}
	}

	//获取处方费用
	loadPrescriptionFee() {
		var params = {
			params: [{
				admID: this.state.patStatus == '1' ? (this.state.patientData ? this.state.patientData.admID : '') :
					(this.state.patientData ? this.state.patientData.admID : ''),
			}],
		}
		$http.post('urlDeault', this, {
			code: "03050044",
			data: params,
			success: function (res) {
				if (res.errorCode == '0') {
					var prescriptionFee = res.totalAmt
					var totalFee = prescriptionFee.substring(0, prescriptionFee.indexOf('^'))
					var unFree = prescriptionFee.substring(prescriptionFee.indexOf('^') + 1)
					this.setState({
						prescriptionFee: res.totalAmt,
						totalFee: totalFee,
						unFree: unFree,
						locFree: res.locFree,
						insuNumber: res?.insuNumber || '', // 患者医保号
						hisAdmTradeNo: res?.hisAdmTradeNo || '', // 就诊流水
					})
				}
			}
		});
	}

	// 获取诊断数据
	getDiagTabData = async () => {
		try {
			const { patientData } = this.state;
			const data = {
				params: [{
					admID: patientData?.admID || '',
					patID: patientData?.patID || '',
					historyFlag: 'Y',
					historyType: '',
					syFlag: 'Y',
				}]
			}
			let res = await React.$asyncPost(this, '03050033', data);
			let diagTabData = res.result?.diagList || [];
			this.setState({
				diagTabData,
			}, () => {
				diagTabData && Array.isArray(diagTabData) && diagTabData.length > 0 && this.loadData();
			});
		} catch (error) {
			console.log(error);
		}
	};

	loadData(value, page, pageSize) {
		if (this.props.patStatus == '1' && this.props.componentSourse !== 'EMR') {
			this.state.dataSource = []
			this.setState({}, () => {
				this.loadUnSaveData([], [])
			})
			return;
		}
		// 当前诊断数据
		const { diagActive, diagTabData } = this.state;
		let currentDiagRecord = diagActive && diagTabData && Array.isArray(diagTabData) && diagTabData.length > 0 ? diagTabData[diagActive - 1] : {};
		var params = {
			params: [{
				diagID: currentDiagRecord?.id || '',
				diagCode: currentDiagRecord?.diagCode || currentDiagRecord?.ICDCode || '',
				admID: this.state.patientData ? this.state.patientData.admID : '',
			}]
		}
		$http.post('urlDeault', this, {
			code: "03050022",
			data: params,
			success: function (res) {
				if (res.errorCode == '0') {
					var newCode = [{ tabIndex: this.state.dataSource.length + 1 }]
					var data = res.result.data.concat(newCode)
					// if (this.props.patStatus == '1' && this.props.componentSourse !== 'EMR') { // 住院和电子病历不需要取改接口数据
					//     this.state.dataSource = []
					//     this.setState({}, () => {
					//         this.loadUnSaveData([], [])
					//     })
					// } else {
					if (value == 'del') {//点击删除时，将为保存的数据取出，合并到历史数据中，保证重调接口，数据不清楚
						var datas = []
						var { dataSource } = this.state;
						if (!Util.isEmpty(dataSource)) {
							for (var i = 0; i < dataSource.length; i++) {
								if (Util.isEmpty(dataSource[i].ordID)) {
									datas.push(dataSource[i])
								}
							}
						}
					}
					this.setState({
						// dataSource: this.props.patStatus == '1' ? [] : value == 'del' ?
						//     res.result.data.concat(datas) : (res.result.data.concat(newCode)),
						dataSource: res.result.data,
						totalCount: res.result.totalCount,
						indexTable: data.length - 1,
						ids: [],
						accountID: res.result.accmID.split('||')[0] || '', //病人账户ID || '',
					}, () => {
						value === 'confirm' && this.props.handleMedicalOrderOk && this.props.handleMedicalOrderOk(); // 医嘱引用
						let chargeordIDinfo = []

						this.state.dataSource.map((item, i) => {
							if (item.ordID) {
								chargeordIDinfo.push(item.ordID)

							}
						})
						this.setState({
							chargeordIDinfo: chargeordIDinfo
						})
						this.loadUnSaveData(value, [])//加载未保存接口数据
					})
					// }
				}
			}
		});
	}

	loadUnSaveData(value, datas) {
		const { diagActive, diagTabData } = this.state;
		const currentDiagRecord = diagActive && diagTabData && Array.isArray(diagTabData) && diagTabData.length > 0 ? diagTabData[diagActive - 1] : {};
		var date = new Date()
		var params = {
			params: [{
				admID: this.state.patientData ? this.state.patientData.admID : '',
				locID: this.state.userData.locID,
				userID: this.state.userData.userID,
				hospID: this.state.userData.hospID,
				groupID: this.state.userData.groupID,
				medType: 'WM',
				diagID: currentDiagRecord?.id || '',
				diagCode: currentDiagRecord?.diagCode || currentDiagRecord?.ICDCode || '',
			}]
		}
		$http.post('urlDeault', this, {
			code: "03050177",
			data: params,
			success: function (res) {
				if (res.errorCode == '0') {
					var sourceData = []
					// var newCode = [{ tabIndex: this.state.dataSource.length + 1 }]
					if (!Util.isEmpty(res.result)) {
						var data = res.result
						for (var i = 0; i < data.length; i++) {
							let writtenOrderFlag = data[i].defaultData?.writtenOrderFlag || 'N'; // 文字医嘱标识
							sourceData.push({
								ordMedItemDesc: writtenOrderFlag === 'Y' ? data[i].defaultData.ordNote : data[i].defaultData.ordDesc,
								// ordMedItemDesc: data[i].defaultData.ordDesc,
								mainIndexId: data[i].mainIndexId,
								ordDose: data[i].defaultData.ordDose,
								ordDoseUnitID: data[i].defaultData.ordDoseUnitID,
								ordFreqID: data[i].defaultData.ordFreqID,
								radioFlag: data[i].defaultData.radioFlag,
								ordInsuCat: data[i].defaultData.ordInsuCat,
								ordFreqDesc: data[i].defaultData.ordFreqDesc,
								ordUsageDesc: data[i].defaultData.ordUsageDesc,
								ordUsageID: data[i].defaultData.ordUsageID,
								ordDurQty: data[i].defaultData.ordDurQty,
								ordDurationID: data[i].defaultData.ordDurationID,
								ordQty: data[i].defaultData.ordQty,
								ordQtyUomID: data[i].defaultData.ordQtyUomID,
								ordPrice: data[i].defaultData.ordPrice,
								ordSkinTestFlag: data[i].defaultData.ordSkinTestFlag,
								testFlag: data[i].defaultData.ordSkinTestFlag,
								ordSkinTestWayID: data[i].defaultData.ordSkinTestWayID,
								ordRecLocID: data[i].defaultData.ordRecLocID,
								ordPriorityID: data[i].defaultData.ordPriorityID,
								ordStageID: data[i].defaultData.ordStageID,
								ordSkinTestUsageID: data[i].defaultData.ordSkinTestUsageID,
								ordSkinTestUsageDesc: data[i].defaultData.ordSkinTestUsageDesc,
								ordEMFlag: data[i].defaultData.ordEMFlag,
								testEMFlag: data[i].defaultData.ordEMFlag,
								ordAdmReasonID: data[i].defaultData.ordAdmReasonID,
								medItemGrade: data[i].defaultData.medItemGrade,
								ordNote: data[i].defaultData.ordNote,
								ordSeqNo: data[i].defaultData.ordSeqNo,
								// this.state.dataSource[this.state.indexTable]['ordSeqNo'] = parseInt(this.state.indexTable) + 1,
								ordDate: data[i].defaultData.ordDate ? moment(data[i].defaultData.ordDate).format(dayFormat) : moment(date).format(dayFormat),
								ordTime: data[i].defaultData.ordTime ? data[i].defaultData.ordTime : moment(date).format(timeFormat),
								ordStartDate: data[i].defaultData.ordStartDate ? moment(data[i].defaultData.ordStartDate).format(dayFormat) : moment(date).format(dayFormat),
								ordStartTime: data[i].defaultData.ordStartTime ? data[i].defaultData.ordStartTime : moment(date).format(timeFormat),
								medID: data[i].defaultData.medID,
								ordMedItemID: data[i].defaultData.ordMedItemID,
								ordTypeCode: data[i].defaultData.ordTypeCode,
								ordSpecID: data[i].defaultData.ordSpecID,
								degreesID: data[i].defaultData.degreesID,
								ordbodyPartID: data[i].defaultData.ordbodyPartID,
								ordbodyPartDesc: data[i].defaultData.ordbodyPartDesc,
								ordSkinTestFlagValue: data[i].defaultData.ordSkinTestFlagValue,
								ordEMFlagValue: data[i].defaultData.ordEMFlagValue,
								ordToalCountO: data[i].defaultData.ordToalCountO,
								ordToalCountI: data[i].defaultData.ordToalCountI,
								frequency: data[i].defaultData.frequency,
								cycleDays: data[i].defaultData.cycleDays,
								intervalDays: data[i].defaultData.intervalDays,
								ordLinkSeqNo: data[i].defaultData.ordLinkSeqNo,
								duraFactor: data[i].defaultData.duraFactor,
								doseDenominator: data[i].defaultData.doseDenominator,
								doseMolecule: data[i].defaultData.doseMolecule,
								qtyMolecule: data[i].defaultData.qtyMolecule,
								eyePartID: data[i].defaultData.eyePartDesc,
								qtyDenominator: data[i].defaultData.qtyDenominator,
								ordPriorityExtDesc: data[i].defaultData.ordPriorityExtDesc,
								ordPriorityExtID: data[i].defaultData.ordPriorityExtID,
								ordInfuseSpeed: data[i].defaultData.ordInfuseSpeed,
								ordSpeedUnitID: data[i].defaultData.ordSpeedUnitID,
								specList: data[i].dataList.specList,
								infuseSpeedList: data[i].dataList.infuseSpeedList,
								doseUnitList: data[i].dataList.doseUnitList,
								durationList: data[i].dataList.durationList,
								stageList: data[i].dataList.stageList,
								qtyUnitList: data[i].dataList.qtyUnitList,
								ordNoteList: data[i].dataList.ordNoteList,
								ordMessage: data[i].dataList.ordMessage,
								recLocList: data[i].dataList.recLocList,
								causeList: data[i].dataList.causeList,
								skinTestWayList: data[i].dataList.skinTestWayList,
								degreesList: data[i].dataList.degreesList,
								priorityList: data[i].dataList.priorityList,
								admReasonList: data[i].dataList.admReasonList,
								bodyPartList: data[i].dataList.bodyPartList,
								eyePartList: data[i].dataList.eyePartList,
								priorityExtList: data[i].dataList.priorityExtList || [],
								unableToEdit: data[i].unableToEdit,
								sequence: data[i].sequence,
								ordSetID: data[i]?.defaultData?.ordSetID || undefined, // 组套ID 2022-09-25添加
								customPrice: data[i].defaultData.customPrice, // 自定义价格
								customPriceFlag: data[i].defaultData.customPriceFlag, // 自定义价格标志
								firstBillFlag: data[i].defaultData.firstBillFlag, // 只首次计费标志
								writtenOrderFlag, // 文字医嘱标志
								antibioticFlag: data[i]?.defaultData?.antibioticFlag || '', // 抗菌药物标志
								antibioticRecordData: data[i]?.defaultData?.antibioticRecordData || '', // 抗菌药物操作数据
								antibioticDesc: data[i]?.defaultData?.antibioticDesc || '', // 抗菌药物描述
							})
						}
					}
					var code = this.state.dataSource.concat(sourceData).concat(datas)
					var newCode = [{ tabIndex: code.length + 1 }]
					this.setState({
						dataSource: this.props.patStatus == '1' && this.props.componentSourse !== 'EMR' ? sourceData.concat(newCode) : (value == 'del' ?
							code : this.state.dataSource.concat(sourceData).concat({}))
					}, () => {
						this.loadPriorityData()
					})
				}
			}
		});
	}

	//获取医嘱优先级下拉数据
	loadPriorityData() {
		var params = {
			params: [{
				language: this.state.userData.language
			}],
		}
		$http.post('urlDeault', this, {
			code: "03060028",
			data: params,
			success: function (res) {
				if (res.errorCode == '0') {
					var priorityList = res.result;
					var { dataSource } = this.state;
					var ordPriorityID = ''
					var noSub = ''
					if (!Util.isEmpty(this.props.ordPriorityID)) {
						// ordPriorityID = this.props.ordPriorityID
						if (!Util.isEmpty(dataSource)) {
							for (var i = 0; i < dataSource.length; i++) {
								this.state.dataSource[i]['priorityList'] = res.result
								if (dataSource.length == 1) {
									this.state.dataSource[0]['ordPriorityID'] = this.props.ordPriorityID
								} else {
									if (Util.isEmpty(dataSource[i].medID) && Util.isEmpty(dataSource[i].ordMedItemID)) {
										this.state.dataSource[i]['ordPriorityID'] = this.props.ordPriorityID
									}
								}
							}
						}
						this.setState({ ordPriorityID: this.props.ordPriorityID })
					} else {
						if (!Util.isEmpty(priorityList)) {
							for (var i = 0; i < priorityList.length; i++) {
								if (!Util.isEmpty(priorityList[i].defaultFlag) && priorityList[i].defaultFlag == 'Y') {
									ordPriorityID = priorityList[i].id
									noSub = priorityList[i].noSub
								}
							}
						}

						if (!Util.isEmpty(dataSource)) {
							for (var i = 0; i < dataSource.length; i++) {
								this.state.dataSource[i]['priorityList'] = res.result
								if (i - 1 >= 0 && !Util.isEmpty(dataSource[i - 1].ordPriorityID)) {
									this.state.dataSource[this.state.indexTable]['ordPriorityID'] = dataSource[i - 1].ordPriorityID
									this.state.dataSource[this.state.indexTable]['noSub'] = dataSource[i - 1].noSub
								} else {
									if (Util.isEmpty(this.state.ordPriorityID)) {
										this.state.dataSource[i]['ordPriorityID'] = ordPriorityID
									} else {
										if (i > 0) {
											this.state.dataSource[i]['ordPriorityID'] = dataSource[i - 1].ordPriorityID
											this.state.dataSource[i]['noSub'] = dataSource[i - 1].noSub
										}
									}
								}
							}
							// this.setState({ ordPriorityID: ordPriorityID })
							if (!Util.isEmpty(this.state.ordPriorityID)) {
								this.setState({})
							} else {
								this.setState({ ordPriorityID: ordPriorityID })
							}
						}
					}
				}
			}
		});
	}

	/**
	 * @shizi: noCheckDetailFlag为Y不返回dataList明细数据，解决数据过多时接口返回很慢
	 * Create 2021-06-13
	 */
	loadTemplateData() {
		let { defaultExpand, currentLocData, userData } = this.state;
		var params = {
			params: [{
				input: this.state.templateInput,
				templetCatCode: '01',
				templetTypeID: this.state.radioValue ? this.state.radioValue : this.state.defaultTemplTypeID,
				noCheckDetailFlag: 'Y',
				locID: currentLocData?.locID || userData?.locID || ''
			}],
		}
		$http.post('urlDeault', this, {
			code: "03050023",
			data: params,
			success: function (res) {
				if (res.errorCode == '0') {
					var templateData = res.result;
					var expandedKeys = [];
					if (+defaultExpand === 1) { // 全部展示
						if (!Util.isEmpty(templateData)) {
							for (var i = 0; i < templateData.length; i++) {
								var ids = i + 'i^'
								expandedKeys.push(ids)
							}
						}
					} else if (+defaultExpand === 3) { // 展示第一个
						expandedKeys.push('0i^')
					}

					this.setState({
						templateData: res.result,
						expandedKeys: expandedKeys,
						userLoginLoc: res?.userLoginLoc || [],
						nodeId: [],
					})
				}
			}
		});
	}

	onSearchTemplate(e) {
		if (e.keyCode == '13') {
			const { currentLocData, userData } = this.state;
			var params = {
				params: [{
					input: this.state.templateInput,
					templetCatCode: '01',
					templetTypeID: this.state.radioValue ? this.state.radioValue : this.state.defaultTemplTypeID,
					noCheckDetailFlag: 'Y',
					locID: currentLocData?.locID || userData?.locID || ''
				}],
			}
			$http.post('urlDeault', this, {
				code: "03050023",
				data: params,
				success: function (res) {
					if (res.errorCode == '0') {
						this.setState({
							templateData: res.result
						})
					}
				}
			});
		}
	}

	loadTempTableData(status, record, data) {
		if (status !== 'temp') {
			this.deleteNullData()
		}
		//加入添加限制，只有录入了医嘱信息之后才能再次添加
		// for (var i = 0; i < dataSource.length; i++) {
		//     if (Util.isEmpty(dataSource[i].ordMedItemDesc)) {
		//         message.error('请先录入医嘱信息再添加！')
		//         return
		//     }
		// }
		if (Util.isEmpty(data.props.nodeId) && Util.isEmpty(data.props.ordSetID)) {
			message.error(this.setMessage('DoctorAdviceListPageTemp', 'descripts'), this.state.userData && this.state.userData.messageTime)
			return
		}
		if (data.props.stock == '0') {
			return
		}
		let dataSource = this.state.dataSource;
		let isNewData = true;
		for (var i = 0; i < dataSource.length; i++) {
			if (Util.isEmpty(dataSource[i].medID) && Util.isEmpty(dataSource[i].ordMedItemID)) {
				isNewData = false;
				break;
			}
		}
		if (isNewData) {
			dataSource.push({ tabIndex: dataSource.length + 1 });
		}
		this.setState({
			dataSource,
			groupStatus: false,
			indexTable: dataSource.length - 1,
			linkRoutes: dataSource.length - 1,
			batchStatus: false,
			cannelIDs: false,
		}, () => {
			setTimeout(() => {
				if (Util.isEmpty(data.props.ordSetID)) {
					this.loadTableData(status, record, data)
				} else {
					this.loadCompleteData(status, record, data)
				}
				// this.loadTableData(status, record, data)
			}, 100);
		})
	}

	loadPackageTempTableData(status, record, data) {
		this.deleteNullData()
		// var { dataSource } = this.state;
		//加入添加限制，只有录入了医嘱信息之后才能再次添加
		// for (var i = 0; i < dataSource.length; i++) {
		//     if (Util.isEmpty(dataSource[i].ordMedItemDesc)) {
		//         message.error('请先录入医嘱信息再添加！')
		//         return
		//     }
		// }
		// if (Util.isEmpty(data.props.nodeId) && Util.isEmpty(data.props.ordSetID)) {
		//     message.error(this.setMessage('DoctorAdviceListPageTemp', 'descripts'))
		//     return
		// }
		if (data.props.stock == '0') {
			return
		}
		this.state.dataSource.push({ tabIndex: this.state.dataSource.length + 1 });
		this.setState({
			groupStatus: false, indexTable: this.state.dataSource.length - 1,
			batchStatus: false,
			cannelIDs: false,
		}, () => {
			setTimeout(() => {
				if (Util.isEmpty(data.props.ordSetID)) {
					this.loadTableData(status, record, data)
				} else {
					this.loadCompleteData(status, record, data)
				}
				// this.loadTableData(status, record, data)
			}, 100);
		})
	}

	//点击复选框
	checkTreeNode(e, data) {
		// if(data.node.props.nodeId) {
		var id = []
		var newNode = []
		if (e.length > 0) {
			for (var i = 0; i < e.length; i++) {
				id.push(e[i].substring(e[i].indexOf('^') + 1))
				newNode.push({
					medID: e[i].substring(e[i].indexOf('^') + 1),
					ordSetID: e[i].substring(e[i].indexOf('-'), 0),
					ordTemplateID: e[i].substring(e[i].indexOf('^'), 1)
				})
			}
		}

		//将树结构的父级数据去除
		var code = []
		for (var i = 0; i < id.length; i++) {
			if (!Util.isEmpty(id[i])) {
				code.push(id[i])
			}
		}

		var nodeCode = []
		for (var i = 0; i < newNode.length; i++) {
			if (!Util.isEmpty(newNode[i].medID)) {
				nodeCode.push(newNode[i])
			}
		}

		this.setState({
			nodeId: code,
			newCode: e,
			nodeCode: nodeCode
		})
		// }
	}

	onExpandIcon(e) {
		this.setState({
			expandedKeys: e
		})
	}

	//点击树节点展开树
	onExpand(data, e) {
		var expandedKeys = [] = this.state.expandedKeys;
		var keys = []//该值用于点击同一节点时不会关闭其他的树节点
		if (!Util.isEmpty(e.props.children)) {//判断其点击节点下有子节点
			if (!Util.isEmpty(expandedKeys)) {
				for (var i = 0; i < expandedKeys.length; i++) {
					if (e.props.eventKey !== expandedKeys[i]) {//用于将所有的树节点展开
						keys.push(expandedKeys[i])
						this.setState({
							expandedKeys: expandedKeys.concat([e.props.eventKey])
						})
					} else {
						this.setState({//当点击的是同一节点时，控制展开，关闭
							expandedKeys: keys
						})
					}
				}
			} else {
				this.setState({
					expandedKeys: [e.props.eventKey]
				})
			}
		}
	}

	handleBatchTemplete(nodeId, nodeCode) {
		this.setState({
			nodeId: nodeId,
			nodeCode: nodeCode
		}, () => {
			if (this.state.nodeId?.length > 1) {
				this.loadBatchDoctorAdvicelistMsg()//多勾选多个得时候，批量添加住院医嘱录入模板
			} else {
				this.batchAddTemplate()
			}
		})
	}

	loadBatchDoctorAdvicelistMsg() {
		var date = new Date();
		var { nodeId, nodeCode } = this.state;
		var arr = []
		var params = {}
		var { dataSource } = this.state;
		var source = []
		for (var i = 0; i < dataSource.length; i++) {
			if (Util.isEmpty(dataSource[i].ordID) && !Util.isEmpty(dataSource[i].medID)) {
				source.push(dataSource[i])
			}
		}
		//当选择数据存在医嘱套时，将medID置为空
		if (!Util.isEmpty(nodeCode)) {
			for (var i = 0; i < nodeCode.length; i++) {
				if (!Util.isEmpty(nodeCode[i].ordSetID)) {
					nodeCode[i].medID = ''
				}
			}
		}
		var temp = []
		var newArray = []
		//将默认数据过滤掉，只传新添加的数据
		for (var i = 0; i < dataSource.length; i++) {
			if (Util.isEmpty(dataSource[i].ordID) && !Util.isEmpty(dataSource[i].medID)) {
				temp.push(dataSource[i])
			}
		}
		//过滤多余的数据
		var tempData = []
		for (var i = 0; i < temp.length; i++) {
			tempData.push({
				...temp[i],
				ordSkinTestFlag: temp[i].ordSkinTestFlag == 'N' ? temp[i].ordSkinTestFlagValue : temp[i].ordSkinTestFlag,
				ordSkinTestWayID: temp[i].ordSkinTestFlag == 'N' && temp[i].ordSkinTestFlagValue == 'N' ? '' : temp[i].ordSkinTestWayID,
				ordQty: temp[i].ordNewQty ? temp[i].ordNewQty : temp[i].newQty,
				skinTestWayList: undefined,
				admReasonList: undefined,
				doseUnitList: undefined,
				durationList: undefined,
				frequenceList: undefined,
				priorityExtList: undefined,
				priorityList: undefined,
				qtyUnitList: undefined,
				recLocList: undefined,
				specList: undefined,
				usageList: undefined,
				causeList: undefined,
				stageList: undefined,
				infuseSpeedList: undefined,
				degreesList: undefined,
				eyePartList: undefined,
				bodyPartList: undefined,
			})
		}
		for (var i = 0; i < nodeId.length; i++) {
			arr.push({
				// medID: nodeId[i],
				admID: this.state.patientData ? this.state.patientData.admID : '',
				indexID: source ? source.length : 0,
				orders: this.state.nodeCode,
				ordPriorityID: this.state.ordPriorityID,
				unSaveOrdIDs: tempData
			})
		}
		params = {
			params: [arr[0]]
		}
		$http.post('urlDeault', this, {
			code: "03050020",
			data: params,
			success: function (res) {
				if (res.errorCode == '0') {
					if (res.errorData.length == 1) {
						// message.error(res.errorData[0].errorMessage, this.state.userData && this.state.userData.messageTime)
						message.error(res.errorData[0].errorMessage)
						return
					}
					if (res.confirmData.length > 0 || res.errorData.length > 0) {

						this.setState({//确认医嘱弹框
							isShowConfirmModal: true,
							confirmData: res.confirmData,
							errorData: res.errorData,
							adviceDrData: res.data,
							isCalculation: res.countFlag
						})
					} else {
						this.setState({
							confirmData: res.confirmData,
							errorData: res.errorData,
							adviceDrData: res.data,
							isCalculation: res.countFlag
						}, () => {
							this.confirmAdviceModal(this.props.patStatus == '1' ? this.state.nodeId : nodeId)
						})
					}
				}
			}
		});
	}

	//批量添加模板
	batchAddTemplate() {
		var { nodeId, nodeCode } = this.state;
		if (nodeId && nodeId.length > 1) {
			this.deleteNullData()
		}
		var obj = {}
		if (nodeId?.length < 1) {
			message.error(this.setMessage('DoctorAdviceListPageNeedAdd', 'descripts'), this.state.userData && this.state.userData.messageTime)
			return
		}

		if (nodeId?.length > 1) {
			this.loadBatchTemplateData()
			// this.setState({
			//     batchStatus: true
			// })
			// var { dataSource } = this.state;
			// for (var i = 0; i < dataSource.length; i++) {
			//     if(Util.isEmpty(dataSource[i].ordID)){
			//         var sequence = dataSource[i].sequence;
			//         if (sequence) {
			//             for (var k = 0; k < sequence.length; i++) {
			//                 if (k <= sequence.length - 1) {
			//                     if (sequence[i] == 'ordMedItemDesc') {
			//                         this[`${sequence[1]}`].current.focus()
			//                     }
			//                 }
			//             }
			//         }
			//     }
			// }

		} else {//单条数据处理
			if (Util.isEmpty(nodeCode[0].ordSetID)) {
				this.loadTableData('batch', nodeCode, '')
			} else {
				this.loadCompleteData('batch', nodeCode, '')
			}
			// this.loadTableData('batch', nodeCode, '')
			this.state.dataSource.push({ tabIndex: this.state.dataSource.length + 1 })
			this.setState({
				groupStatus: false, indexTable: this.state.dataSource.length - 1,
				batchStatus: false,
				cannelIDs: false,
			})
		}
		// for (var i = 0; i < nodeId.length; i++) {
		//     this.state.dataSource.push({ tabIndex: this.state.dataSource.length + 1 })
		//     this.setState({ groupStatus: false, indexTable: this.state.dataSource.length - 1 })
		// }
	}

	//批量加载医嘱数据
	loadBatchTemplateData(data) {
		var date = new Date();
		var { nodeId, nodeCode } = this.state;
		var arr = []
		var params = {}
		var { dataSource } = this.state;
		var source = []
		for (var i = 0; i < dataSource.length; i++) {
			if (Util.isEmpty(dataSource[i].ordID) && !Util.isEmpty(dataSource[i].medID)) {
				source.push(dataSource[i])
			}
		}
		//当选择数据存在医嘱套时，将medID置为空
		if (!Util.isEmpty(nodeCode)) {
			for (var i = 0; i < nodeCode.length; i++) {
				if (!Util.isEmpty(nodeCode[i].ordSetID)) {
					nodeCode[i].medID = ''
				}
			}
		}
		var temp = []
		var newArray = []
		//将默认数据过滤掉，只传新添加的数据
		for (var i = 0; i < dataSource.length; i++) {
			if (Util.isEmpty(dataSource[i].ordID) && !Util.isEmpty(dataSource[i].medID)) {
				temp.push(dataSource[i])
			}
		}
		//过滤多余的数据
		var tempData = []
		for (var i = 0; i < temp.length; i++) {
			tempData.push({
				...temp[i],
				ordSkinTestFlag: temp[i].ordSkinTestFlag == 'N' ? temp[i].ordSkinTestFlagValue : temp[i].ordSkinTestFlag,
				ordSkinTestWayID: temp[i].ordSkinTestFlag == 'N' && temp[i].ordSkinTestFlagValue == 'N' ? '' : temp[i].ordSkinTestWayID,
				ordQty: temp[i].ordNewQty ? temp[i].ordNewQty : temp[i].newQty,
				skinTestWayList: undefined,
				admReasonList: undefined,
				doseUnitList: undefined,
				durationList: undefined,
				frequenceList: undefined,
				priorityExtList: undefined,
				priorityList: undefined,
				qtyUnitList: undefined,
				recLocList: undefined,
				specList: undefined,
				usageList: undefined,
				causeList: undefined,
				stageList: undefined,
				infuseSpeedList: undefined,
				degreesList: undefined,
				eyePartList: undefined,
				bodyPartList: undefined,
			})
		}
		if (this.props.patStatus == '1') {
			params = data
		} else {
			for (var i = 0; i < nodeId.length; i++) {
				arr.push({
					// medID: nodeId[i],
					admID: this.state.patientData ? this.state.patientData.admID : '',
					indexID: source ? source.length : 0,
					orders: this.state.nodeCode,
					ordPriorityID: this.state.ordPriorityID,
					unSaveOrdIDs: tempData
				})
			}
			params = {
				params: [arr[0]]
			}
		}
		$http.post('urlDeault', this, {
			code: this.props.patStatus == '1' ? '03060012' : "03050020",
			data: params,
			success: function (res) {
				if (res.errorCode == '0') {
					if (res.errorData.length == 1) {
						// message.error(res.errorData[0].errorMessage, this.state.userData && this.state.userData.messageTime)
						message.error(res.errorData[0].errorMessage)
						return
					}
					if (res.confirmData.length > 0 || res.errorData.length > 0) {

						this.setState({//确认医嘱弹框
							isShowConfirmModal: true,
							confirmData: res.confirmData,
							errorData: res.errorData,
							adviceDrData: res.data,
							isCalculation: res.countFlag
						})
					} else {
						this.setState({
							confirmData: res.confirmData,
							errorData: res.errorData,
							adviceDrData: res.data,
							isCalculation: res.countFlag
						}, () => {
							this.confirmAdviceModal(this.props.patStatus == '1' ? data.params[0].ordID : nodeId)
						})
					}
				}
			}
		});
		// 回传住院医生站，将adviceList销毁
		var { dstroyAdviceList } = this.props;
		dstroyAdviceList && dstroyAdviceList()
	}

	loadPackageTemplate() {
		var templateTrees = []
		this.state.packageMsg && this.state.packageMsg.map((item, index) => {
			templateTrees.push(<TreeNode title={item.ordSetDesc} key={index + 'i' + '^'}
				disabled={(!Util.isEmpty(this.state.disMessage) || this.state.disBtn == 'N' ? true :
					((item.stock == '0') ? true : false))}
				nodeId={item.medID} ordSetID={item.ordSetID}>
				{this.loadPackageSunTemplate(item.data)}
			</TreeNode>)
		})
		return templateTrees
	}

	loadPackageSunTemplate(data) {
		// depDoctorFlag 非本院医生不允许开医嘱
		var packageSunData = []
		data && data.map((item, index) => {
			// if(item.data) {
			packageSunData.push(<TreeNode title={item.title} nodeId={item.medID} ordSetID={item.ordSetID}
				disabled={(!Util.isEmpty(this.state.disMessage) || this.state.disBtn == 'N' ? true :
					((item.stock == '0') ? true : false))} stock={item.stock}
				key={item.ordSetID + '-' + item.ordTempletDetailID + '^' + item.ordTempletDetailItemID || item.id || index}>
				{this.loadSunTemplate(item.data)}
			</TreeNode>)
			// }
		})
		return packageSunData
	}

	//加载医嘱模板
	loadTemplate() {
		var templateTree = []
		this.state.templateData && this.state.templateData.map((item, index) => {
			templateTree.push(<TreeNode title={item.title} key={index + 'i' + '^'}>
				{this.loadSunTemplate(item.data)}
			</TreeNode>)
		})
		return templateTree
	}

	loadSunTemplate(data) {
		//depDoctorFlag 非本院医生不允许开医嘱
		var sunData = []
		data && data.map((item, index) => {
			// if(item.data) {
			sunData.push(<TreeNode title={<Tooltip placement="right" title={item.title}>{item.title}</Tooltip>} nodeId={item.medID} ordSetID={item.ordSetID}
				disabled={(!Util.isEmpty(this.state.disMessage) || this.state.disBtn == 'N' ? true :
					((item.stock == '0') ? true : false))} stock={item.stock} ordTempletDetailID={item.ordTempletDetailID}
				key={item.ordSetID + '-' + item.ordTempletDetailID + '^' + item.ordTempletDetailItemID || item.id || index}>
				{this.loadSunTemplate(item.data)}
			</TreeNode>)
			// }
		})
		return sunData
	}

	rowClick = (record, index) => {
		this.setState({
			visible: false,
			rowData: record.medDesc,
			ordSpecID: record.ordSpecID,
			selectData: [],
			focusStatus: true,//焦点标识
			visStatus: false,
		}, () => {
			scrollCount = 0
			this.child.handleCancel();
			if (Util.isEmpty(record.ordSetID)) {
				this.loadTableData('', record, index)
			} else {
				this.loadCompleteData('', record, index)
			}
		})
	}

	loadCompleteData(status, record, data) {
		var that = this;
		var date = new Date();
		var { dataSource } = this.state;
		var source = []
		for (var i = 0; i < dataSource.length; i++) {
			if (Util.isEmpty(dataSource[i].ordID) && !Util.isEmpty(dataSource[i].medID)) {
				source.push(dataSource[i])
			}
		}
		var temp = []
		var newArray = []
		//将默认数据过滤掉，只传新添加的数据
		for (var i = 0; i < dataSource.length; i++) {
			if (Util.isEmpty(dataSource[i].ordID) && !Util.isEmpty(dataSource[i].medID)) {
				temp.push(dataSource[i])
			}
		}
		//过滤多余的数据
		var tempData = []
		for (var i = 0; i < temp.length; i++) {
			tempData.push({
				...temp[i],
				ordSkinTestFlag: temp[i].ordSkinTestFlag == 'N' ? temp[i].ordSkinTestFlagValue : temp[i].ordSkinTestFlag,
				ordSkinTestWayID: temp[i].ordSkinTestFlag == 'N' && temp[i].ordSkinTestFlagValue == 'N' ? '' : temp[i].ordSkinTestWayID,
				ordQty: temp[i].ordNewQty ? temp[i].ordNewQty : temp[i].newQty,
				skinTestWayList: undefined,
				admReasonList: undefined,
				doseUnitList: undefined,
				durationList: undefined,
				frequenceList: undefined,
				priorityExtList: undefined,
				priorityList: undefined,
				qtyUnitList: undefined,
				recLocList: undefined,
				specList: undefined,
				usageList: undefined,
				causeList: undefined,
				stageList: undefined,
				infuseSpeedList: undefined,
				degreesList: undefined,
				eyePartList: undefined,
				bodyPartList: undefined,
			})
		}

		var params = {
			params: [{
				admID: this.props.patStatus == '1' ? (this.state.patientData ? this.state.patientData.admID : '') :
					(this.state.patientData ? this.state.patientData.admID : ''),
				indexID: source ? source.length : 0,
				ordPriorityID: this.state.ordPriorityID,
				orders: [{
					medID: status == 'temp' ? data.props.nodeId : (status == 'batch' ? (record[0].ordSetID ? '' : record[0].medID) : record.medID),
					ordTemplateID: data && data.props ? data.props.ordTempletDetailID : '',
					ordSetID: status == 'temp' ? data.props.ordSetID : (status == 'batch' ? record[0].ordSetID : record.ordSetID || '')
				}],
				unSaveOrdIDs: tempData
			}]
		}
		$http.post('urlDeault', this, {
			code: "03050020",
			data: params,
			success: function (res) {
				if (res.errorCode == '0') {
					// 获取当前时间戳
					let timeStamp = new Date()?.getTime();
					if (res.errorData.length == 1) {
						// message.error(res.errorData[0].errorMessage, this.state.userData && this.state.userData.messageTime)
						message.error(res.errorData[0].errorMessage)
						return
					}

					if (res.errorData.length > 0 || res.confirmData.length > 0) {
						/**
						 * @ByShizi: 医嘱保存时如果是医嘱套需传入医嘱套ID
						 * 需求 #
						 * Create 2022-04-19
						 */
						if ((status === 'temp' || status === '') && Array.isArray(res.data) && res.data.length > 0) { // 将医嘱套ID存入数据中
							for (var i = 0; i < res.data.length; i++) {
								let nOrdSetID = status == 'temp' ? data.props.ordSetID : (status == 'batch' ? record[0].ordSetID : record.ordSetID || '');
								res.data[i].defaultData.ordSetID = nOrdSetID + ',' + timeStamp;
							}
						}
						this.setState({
							isShowConfirmModal: true,
							errorData: res.errorData,
							confirmData: res.confirmData,
							adviceDrData: res.data,
							isCalculation: res.countFlag,
							newCode: []
						})
						return
					} else if (Util.isEmpty(res.errorData) && Util.isEmpty(res.confirmData) && Util.isEmpty(res.data)) {
						message.error(this.setMessage('DoctorAdviceListPageNoData', 'descripts'), this.state.userData && this.state.userData.messageTime)
						return
					}
				}
			}
		});
	}

	//获取列表行数据
	loadTableData(status, record, data) {
		var that = this;
		var { dataSource, linkRoutes } = this.state;
		var source = []
		for (var i = 0; i < dataSource.length; i++) {
			if (Util.isEmpty(dataSource[i].ordID) && !Util.isEmpty(dataSource[i].medID)) {
				source.push(dataSource[i])
			}
		}
		var temp = []
		var newArray = []
		//将默认数据过滤掉，只传新添加的数据
		for (var i = 0; i < dataSource.length; i++) {
			if (Util.isEmpty(dataSource[i].ordID) && !Util.isEmpty(dataSource[i].medID)) {
				temp.push(dataSource[i])
			}
		}
		//过滤多余的数据
		var tempData = []
		for (var i = 0; i < temp.length; i++) {
			tempData.push({
				...temp[i],
				ordSkinTestFlag: temp[i].ordSkinTestFlag == 'N' ? temp[i].ordSkinTestFlagValue : temp[i].ordSkinTestFlag,
				ordSkinTestWayID: temp[i].ordSkinTestFlag == 'N' && temp[i].ordSkinTestFlagValue == 'N' ? '' : temp[i].ordSkinTestWayID,
				ordQty: temp[i].ordNewQty ? temp[i].ordNewQty : temp[i].newQty,
				skinTestWayList: undefined,
				admReasonList: undefined,
				doseUnitList: undefined,
				durationList: undefined,
				frequenceList: undefined,
				priorityExtList: undefined,
				priorityList: undefined,
				qtyUnitList: undefined,
				recLocList: undefined,
				specList: undefined,
				usageList: undefined,
				causeList: undefined,
				stageList: undefined,
				infuseSpeedList: undefined,
				degreesList: undefined,
				eyePartList: undefined,
				bodyPartList: undefined,
			})
		}

		var params = {
			params: [{
				admID: this.props.patStatus == '1' ? (this.state.patientData ? this.state.patientData.admID : '') :
					(this.state.patientData ? this.state.patientData.admID : ''),
				indexID: source ? source.length : 0,
				ordPriorityID: this.state.ordPriorityID,
				orders: [{
					medID: status == 'temp' ? data.props.nodeId : (status == 'batch' ? (record[0].ordSetID ? '' : record[0].medID) : record.medID),
					ordTemplateID: data && data.props && data.props.ordTempletDetailID || (this.props.patStatus == '1' ? (record && record[0] ? record[0].ordTemplateID : '') : ''),
					ordSetID: status == 'temp' ? data.props.ordSetID : (status == 'batch' ? record[0].ordSetID : record.ordSetID || '')
				}],
				unSaveOrdIDs: tempData
			}]
		}
		$http.post('urlDeault', this, {
			code: "03050020",
			data: params,
			success: function (res) {
				if (res.errorCode == '0') {
					if (res.errorData.length == 1) {
						message.error(res.errorData[0].errorMessage)
						// message.error(res.errorData[0].errorMessage, this.state.userData && this.state.userData.messageTime)
						return
					}
					if (res.errorData.length > 1) {
						this.setState({
							isShowConfirmModal: true,
							errorData: res.errorData,
							confirmData: res.confirmData,
							isCalculation: res.countFlag
						})
						return
					}
					if (res.confirmData.length > 0) {
						confirm({
							title: this.setMessage('DoctorAdviceListPageConfirmation', 'descripts'),
							content: res.confirmData[0].errorMessage,
							okText: that.state.userData.language == 'EN' ? 'Ok' : '是',
							cancelText: that.state.userData.language == 'EN' ? 'cancel' : '否',
							onOk() {
								if (res.data[0] && res.data[0].defaultData.insuFlag == 'Y') {//可自费、医保医嘱弹框确认
									that.setState({
										isShowInsuMessageModal: true,
										insuSource: res.data,
										insuStatus: status,
										insuRecord: record,
										insuData: data,
										isCalculation: res.countFlag
									})
								} else {
									// that.doseFocus.current.focus()
									// //双击医嘱项，根据index，渲染对应行的默认数据
									var sequence = res.data[0].sequence;
									if (!Util.isEmpty(sequence)) {
										for (var i = 0; i < sequence.length; i++) {
											if (i <= sequence.length - 1) {
												if (sequence[i] == 'ordMedItemDesc') {
													if (that[`${sequence[1]}`]) {
														// that[`${sequence[1]}`] && that[`${sequence[1]}`].current.focus()
														that[`${sequence[1] + linkRoutes}`] ? that[`${sequence[1] + linkRoutes}`].focus() : ''
													}
												}
											}
										}
									} else {
										var arrayList = []
										var sourceData = that.state.dataSource;
										for (var i = 0; i < sourceData.length; i++) {
											if (Util.isEmpty(sourceData[i].medID) && Util.isEmpty(sourceData[i].ordMedItemID) && Util.isEmpty(sourceData[i].ordID)) {
												arrayList.push(sourceData[i])
											}
										}
										if (arrayList.length < 2) {
											that.state.dataSource.push({ tabIndex: that.state.dataSource.length + 1 })
											that.ordMedItemDesc && that.ordMedItemDesc.current && that.ordMedItemDesc.current.focus()
										} else {
											that.ordMedItemDesc && that.ordMedItemDesc.current && that.ordMedItemDesc.current.focus()
										}
									}
									that.handlePurposeOfMedication({
										...res,
										insuStatus: status,
										insuRecord: record,
										insuData: data
									});
									if (status == 'temp' || status == 'batch') {
										that.deleteNullData()
									}
								}
							},
							onCancel() {
								console.log('Cancel');
							},
						});
					} else {
						if (res.data[0] && res.data[0].defaultData.insuFlag == 'Y') {//可自费、医保医嘱弹框确认
							that.setState({
								isShowInsuMessageModal: true,
								insuSource: res.data,
								insuStatus: status,
								insuRecord: record,
								isCalculation: res.countFlag,
								insuData: data
							})
						} else {
							//enter列跳转this.[qty].current.focus()
							var sequence = res.data[0].sequence;
							if (!Util.isEmpty(sequence)) {
								for (var i = 0; i < sequence.length; i++) {
									if (i <= sequence.length - 1) {
										if (sequence[i] == 'ordMedItemDesc') {
											// this[`${sequence[1]}`].current.focus()
											this[`${sequence[1] + linkRoutes}`] ? this[`${sequence[1] + linkRoutes}`].focus() : ''
										}
									}
								}
							} else {
								var arrayList = []
								var sourceData = that.state.dataSource;
								for (var i = 0; i < sourceData.length; i++) {
									if (Util.isEmpty(sourceData[i].medID) && Util.isEmpty(sourceData[i].ordMedItemID) && Util.isEmpty(sourceData[i].ordID)) {
										arrayList.push(sourceData[i])
									}
								}
								if (arrayList.length < 2) {
									that.state.dataSource.push({ tabIndex: that.state.dataSource.length + 1 })
									that.ordMedItemDesc && that.ordMedItemDesc.current && that.ordMedItemDesc.current.focus()
								} else {
									that.ordMedItemDesc && that.ordMedItemDesc.current && that.ordMedItemDesc.current.focus()
								}
							}
							//双击医嘱项，根据index，渲染对应行的默认数据
							that.handlePurposeOfMedication({
								...res,
								insuStatus: status,
								insuRecord: record,
								insuData: data
							});
							if (status == 'temp' || status == 'batch') {
								that.deleteNullData()
							}
						}
					}
				}
			}
		});
	}

	// 抗菌药物用药目的选择
	handlePurposeOfMedication = (res) => {
		const { configParams } = this.state;
		this.setState({ confirmInsertionRes: res, purposeRecordData: {} }, () => {
			if (res.data[0]?.defaultData?.antibioticFlag === 'Y') {
				let tableData = JSON.parse(JSON.stringify(configParams?.antibioticIntent || []));
				// 默认勾选第一个
				let selectedRowKeys = tableData && tableData.length > 0 ? [tableData[0].id] : [];
				let selectedRows = tableData && tableData.length > 0 ? tableData[0] : [];
				this.antibioticsRef && this.antibioticsRef.modifyVisible(true, {
					tableData,
					selectData: {
						pathogenItem: configParams?.pathogenItem || [], // 病原微生物送检下拉数据
					},
					selectedRows,
					selectedRowKeys,
					rowID: '',
					rowData: {},
				})
			} else {
				this.handleConfirmInsertion({});
			}
		});
	}

	// 用药目的选择
	handlePurposeOk = async (params) => {
		try {
			let selectedRows = params?.selectedRows || [];
			if (!(selectedRows && Array.isArray(selectedRows) && selectedRows.length > 0)) {
				message.warning('请勾选用药目的')
				return;
			}
			const { purposeRecordData } = this.state;
			let antibioticRecordData = selectedRows && Array.isArray(selectedRows) && selectedRows.length > 0 ? selectedRows[0] : {};
			if (purposeRecordData && 'ordID' in purposeRecordData && purposeRecordData.ordID) { // 调用接口保存用药目的
				let data = {
					params: [{
						ordID: purposeRecordData?.ordID || '',
						antibioticRecordData
					}]
				}
				let res = await React.$asyncPost(this, '03050291', data);
				message.success(res?.errorMessage || '修改用药目的成功！');
				this.loadData();
			} else if (JSON.stringify(purposeRecordData) === '{}') {
				this.handleConfirmInsertion(antibioticRecordData);
			} else {
				let indexTable = (purposeRecordData?.tabIndex || 1) - 1;
				this.state.dataSource[indexTable]['antibioticRecordData'] = antibioticRecordData; // 抗菌药物操作数据
				this.state.dataSource[indexTable]['antibioticDesc'] = antibioticRecordData?.descripts || ''; // 抗菌药物描述
				this.setState({});
			}
			this.antibioticsRef && this.antibioticsRef.modifyVisible(false);
		} catch (error) {
			console.log(error);
		}
	}

	// 确认插入医嘱
	handleConfirmInsertion = (antibioticRecordData) => {
		const { confirmInsertionRes } = this.state;
		const that = this;
		// 保持原有的数据源
		const res = confirmInsertionRes;
		const status = confirmInsertionRes?.insuStatus || '';
		const date = new Date();
		const record = confirmInsertionRes?.insuRecord || {};
		const data = confirmInsertionRes?.insuData || {};
		that.state.dataSource[that.state.indexTable]['ordMedItemDesc'] = res.data[0].defaultData.ordDesc,
			that.state.dataSource[that.state.indexTable]['ordDose'] = res.data[0].defaultData.ordDose,
			that.state.dataSource[that.state.indexTable]['ordDoseUnitID'] = res.data[0].defaultData.ordDoseUnitID,
			// that.state.dataSource[that.state.indexTable]['ordFreqID'] = res.data[0].defaultData.ordFrequenceID,
			that.state.dataSource[that.state.indexTable]['ordFreqID'] = res.data[0].defaultData.ordFreqID,
			that.state.dataSource[that.state.indexTable]['ordFreqDesc'] = res.data[0].defaultData.ordFreqDesc,
			that.state.dataSource[that.state.indexTable]['defaultStatus'] = true,
			that.state.dataSource[that.state.indexTable]['ordUsageDesc'] = res.data[0].defaultData.ordUsageDesc,
			that.state.dataSource[that.state.indexTable]['ordUsageID'] = res.data[0].defaultData.ordUsageID,
			that.state.dataSource[that.state.indexTable]['ordDurQty'] = res.data[0].defaultData.ordDurQty,
			that.state.dataSource[that.state.indexTable]['ordDurationID'] = res.data[0].defaultData.ordDurationID,
			that.state.dataSource[that.state.indexTable]['ordSkinTestUsageID'] = res.data[0].defaultData.ordSkinTestUsageID,
			that.state.dataSource[that.state.indexTable]['ordSkinTestUsageDesc'] = res.data[0].defaultData.ordSkinTestUsageDesc,
			that.state.dataSource[that.state.indexTable]['ordQty'] = res.data[0].defaultData.ordQty,
			that.state.dataSource[that.state.indexTable]['ordInsuCat'] = res.data[0].defaultData.ordInsuCat,
			that.state.dataSource[that.state.indexTable]['eyePartID'] = res.data[0].defaultData.eyePartDesc,
			that.state.dataSource[that.state.indexTable]['medItemGrade'] = res.data[0].defaultData.medItemGrade,
			that.state.dataSource[that.state.indexTable]['ordQtyUomID'] = res.data[0].defaultData.ordQtyUomID,
			that.state.dataSource[that.state.indexTable]['totalPrice'] = res.data[0].defaultData.totalPrice,
			that.state.dataSource[that.state.indexTable]['ordPrice'] = res.data[0].defaultData.ordPrice,
			that.state.dataSource[that.state.indexTable]['ordNewPrice'] = res.data[0].defaultData.ordPrice,
			that.state.dataSource[that.state.indexTable]['ordSkinTestFlag'] = res.data[0].defaultData.ordSkinTestFlag,
			that.state.dataSource[that.state.indexTable]['testFlag'] = res.data[0].defaultData.ordSkinTestFlag,
			that.state.dataSource[that.state.indexTable]['ordSkinTestWayID'] = res.data[0].defaultData.ordSkinTestWayID,
			that.state.dataSource[that.state.indexTable]['ordRecLocID'] = res.data[0].defaultData.ordRecLocID,
			that.state.dataSource[that.state.indexTable]['ordPriorityID'] = res.data[0].defaultData.ordPriorityID,
			that.state.dataSource[that.state.indexTable]['medDesca'] = res.data[0].defaultData.ordDesca,
			that.state.dataSource[that.state.indexTable]['ordAdmReasonID'] = res.data[0].defaultData.ordAdmReasonID,
			that.state.dataSource[that.state.indexTable]['ordSeqNo'] = parseInt(that.state.indexTable) + 1,
			that.state.dataSource[that.state.indexTable]['ordDate'] = res.data[0]?.defaultData?.ordDate || res.data[0]?.defaultData?.date || moment(date).format(dayFormat),
			that.state.dataSource[that.state.indexTable]['ordTime'] = res.data[0]?.defaultData?.ordTime || res.data[0]?.defaultData?.time || moment(date).format(timeFormat),
			that.state.dataSource[that.state.indexTable]['ordStartDate'] = res.data[0]?.defaultData.ordStartDate || res.data[0]?.defaultData?.date || moment(date).format(dayFormat),
			that.state.dataSource[that.state.indexTable]['ordStartTime'] = res.data[0]?.defaultData.ordStartTime || res.data[0]?.defaultData?.time || moment(date).format(timeFormat),
			that.state.dataSource[that.state.indexTable]['ordNote'] = res.data[0].defaultData.ordNote,
			that.state.dataSource[that.state.indexTable]['medID'] = status == 'temp' ? data.props.nodeId : (status == 'batch' ? record[0].medID : record.medID),
			that.state.dataSource[that.state.indexTable]['ordMedItemID'] = status == 'temp' ? data.props.nodeId : (status == 'batch' ? record[0].medID : record.medID),
			that.state.dataSource[that.state.indexTable]['ordTypeCode'] = res.data[0].defaultData.ordTypeCode,
			that.state.dataSource[that.state.indexTable]['ordSpecID'] = res.data[0].defaultData.ordSpecID,
			that.state.dataSource[that.state.indexTable]['radioFlag'] = res.data[0].defaultData.radioFlag,
			that.state.dataSource[that.state.indexTable]['ordToalCountO'] = res.data[0].defaultData.ordToalCountO,
			that.state.dataSource[that.state.indexTable]['ordToalCountI'] = res.data[0].defaultData.ordToalCountI,
			that.state.dataSource[that.state.indexTable]['frequency'] = res.data[0].defaultData.frequency,
			that.state.dataSource[that.state.indexTable]['cycleDays'] = res.data[0].defaultData.cycleDays,
			that.state.dataSource[that.state.indexTable]['ordStageID'] = res.data[0].defaultData.ordStageID,
			that.state.dataSource[that.state.indexTable]['degreesID'] = res.data[0].defaultData.degreesID,
			that.state.dataSource[that.state.indexTable]['ordbodyPartID'] = res.data[0].defaultData.ordbodyPartID,
			that.state.dataSource[that.state.indexTable]['ordbodyPartDesc'] = res.data[0].defaultData.ordbodyPartDesc,
			that.state.dataSource[that.state.indexTable]['intervalDays'] = res.data[0].defaultData.intervalDays,
			that.state.dataSource[that.state.indexTable]['duraFactor'] = res.data[0].defaultData.duraFactor,
			that.state.dataSource[that.state.indexTable]['ordSkinTestFlagValue'] = res.data[0].defaultData.ordSkinTestFlagValue,
			that.state.dataSource[that.state.indexTable]['ordEMFlagValue'] = res.data[0].defaultData.ordEMFlagValue,
			that.state.dataSource[that.state.indexTable]['ordEMFlag'] = res.data[0].defaultData.ordEMFlag,
			that.state.dataSource[that.state.indexTable]['testEMFlag'] = res.data[0].defaultData.ordEMFlag,
			that.state.dataSource[that.state.indexTable]['ordSkinTestFlag'] = res.data[0].defaultData.ordSkinTestFlag,
			that.state.dataSource[that.state.indexTable]['testFlag'] = res.data[0].defaultData.ordSkinTestFlag,
			that.state.dataSource[that.state.indexTable]['doseDenominator'] = res.data[0].defaultData.doseDenominator,
			that.state.dataSource[that.state.indexTable]['doseMolecule'] = res.data[0].defaultData.doseMolecule,
			that.state.dataSource[that.state.indexTable]['qtyMolecule'] = res.data[0].defaultData.qtyMolecule,
			that.state.dataSource[that.state.indexTable]['qtyDenominator'] = res.data[0].defaultData.qtyDenominator,
			that.state.dataSource[that.state.indexTable]['ordPriorityExtID'] = res.data[0].defaultData.ordPriorityExtID,
			that.state.dataSource[that.state.indexTable]['ordPriorityExtDesc'] = res.data[0].defaultData.ordPriorityExtDesc,
			that.state.dataSource[that.state.indexTable]['ordMessage'] = res.data[0].defaultData.ordMessage,
			that.state.dataSource[that.state.indexTable]['ordInfuseSpeed'] = res.data[0].defaultData.ordInfuseSpeed,
			that.state.dataSource[that.state.indexTable]['ordSpeedUnitID'] = res.data[0].defaultData.ordSpeedUnitID,
			that.state.dataSource[that.state.indexTable]['specList'] = res.data[0].dataList.specList,
			that.state.dataSource[that.state.indexTable]['infuseSpeedList'] = res.data[0].dataList.infuseSpeedList,
			that.state.dataSource[that.state.indexTable]['doseUnitList'] = res.data[0].dataList.doseUnitList,
			that.state.dataSource[that.state.indexTable]['durationList'] = res.data[0].dataList.durationList,
			that.state.dataSource[that.state.indexTable]['stageList'] = res.data[0].dataList.stageList,
			that.state.dataSource[that.state.indexTable]['qtyUnitList'] = res.data[0].dataList.qtyUnitList,
			that.state.dataSource[that.state.indexTable]['eyePartList'] = res.data[0].dataList.eyePartList,
			that.state.dataSource[that.state.indexTable]['recLocList'] = res.data[0].dataList.recLocList,
			that.state.dataSource[that.state.indexTable]['ordNoteList'] = res.data[0].dataList.ordNoteList,
			// that.state.dataSource[that.state.indexTable]['usageList'] = res.data[0].dataList.usageList,
			that.state.dataSource[that.state.indexTable]['skinTestWayList'] = res.data[0].dataList.skinTestWayList,
			that.state.dataSource[that.state.indexTable]['priorityList'] = res.data[0].dataList.priorityList,
			that.state.dataSource[that.state.indexTable]['bodyPartList'] = res.data[0].dataList.bodyPartList,
			that.state.dataSource[that.state.indexTable]['causeList'] = res.data[0].dataList.causeList,
			that.state.dataSource[that.state.indexTable]['admReasonList'] = res.data[0].dataList.admReasonList,
			that.state.dataSource[that.state.indexTable]['priorityExtList'] = res.data[0].dataList.priorityExtList ? res.data[0].dataList.priorityExtList : [],
			that.state.dataSource[that.state.indexTable]['unableToEdit'] = res.data[0].unableToEdit,
			that.state.dataSource[that.state.indexTable]['degreesList'] = res.data[0].dataList.degreesList,
			that.state.dataSource[that.state.indexTable]['sequence'] = res.data[0].sequence,
			that.state.dataSource[that.state.indexTable]['customPrice'] = res.data[0].defaultData.customPrice, // 自定义价格
			that.state.dataSource[that.state.indexTable]['customPriceFlag'] = res.data[0].defaultData.customPriceFlag, // 自定义价格标志
			that.state.dataSource[that.state.indexTable]['writtenOrderFlag'] = res.data[0].defaultData.writtenOrderFlag, // 文字医嘱
			that.state.dataSource[that.state.indexTable]['firstBillFlag'] = res.data[0].defaultData.firstBillFlag, // 只首次计费标志
			that.state.dataSource[that.state.indexTable]['antibioticFlag'] = res.data[0]?.defaultData?.antibioticFlag || '', // 抗菌药物标志
			that.state.dataSource[that.state.indexTable]['antibioticRecordData'] = antibioticRecordData, // 抗菌药物操作数据
			that.state.dataSource[that.state.indexTable]['antibioticDesc'] = antibioticRecordData?.descripts || '', // 抗菌药物描述
			that.setState({
				ordMessage: res.data[0].defaultData.ordMessage,
				tableData: res.data[0].defaultData,
				doseUnitList: res.data[0].dataList.doseUnitList,//剂量单位
				durationList: res.data[0].dataList.durationList,//疗程单位
				qtyUnitList: res.data[0].dataList.qtyUnitList,//数量单位
				recLocList: res.data[0].dataList.recLocList,//接收科室
				// frequenceList: res.data[0].dataList.frequenceList,//频次
				// usageList: res.data[0].dataList.usageList,//用法
				skinTestWayList: res.data[0].dataList.skinTestWayList,//皮试备注
				priorityList: res.data[0].dataList.priorityList,//优先级
				eyePartList: res.data[0].dataList.eyePartList,//优先级
				admReasonList: res.data[0].dataList.admReasonList,
				ordNoteList: res.data[0].dataList.ordNoteList,
				bodyPartList: res.data[0].dataList.bodyPartList,
				// specList: res.data[0].dataList.specList,//标本
				priorityExtList: res.data[0].dataList.priorityExtList,
				sequence: res.data[0].sequence,//跳转参数
				newCode: [],
				changeValue: undefined,
				focusStatus: false,
				isCalculation: undefined
			})
	}

	//鼠标失去焦点后校验
	handleMouseColumns(name, index, data, e) {
		// console.log("触发了handleMouseColumns", name, index, data, e)
		var { dataSource } = this.state;
		var value = e.target.value;
		for (var i = 0; i < dataSource.length; i++) {
			if (this.state.linkValue == dataSource[i].ordSeqNo && !Util.isEmpty(dataSource[i].ordID)) {
				this.state.dataSource[index]['ordLinkStatus'] = false
				this.state.dataSource[index]['ordLinkSeqNo'] = '',
					this.state.dataSource[index]['ordUsageID'] = data.ordUsageID,
					this.setState({ linkValue: undefined })
				message.error(this.setMessage('DoctorAdviceListPageCanNot', 'descripts'), this.state.userData && this.state.userData.messageTime)
				return
			}
			if (value == dataSource[i].tabIndex && dataSource[parseInt(value) - 1].ordLinkStatus == true) {
				message.error(this.setMessage('DoctorAdviceListPageAssion', 'descripts'), this.state.userData && this.state.userData.messageTime)
				this.state.dataSource[index]['ordLinkSeqNo'] = ''
				this.setState({})
				return
			}
		}
		//获取子医嘱的下拉数据，校验是否可以分组
		var useageID = ''//用法id
		var array = []//用法数组
		var frequenceID = ''//频次id
		var frequenceList = []//频次数组
		var recLocList = []//执行科室
		var stageList = []//医嘱阶段
		var recLocID = ''
		var stageID = ''//医嘱阶段
		var flag = false
		var freFlag = false
		var recFlag = false
		var stageFlag = false
		if (!Util.isEmpty(value)) {
			useageID = this.state.dataSource[value - 1].ordUsageID
			array = this.state.dataSource[index].usageList
			frequenceID = this.state.dataSource[value - 1].ordFreqID
			frequenceList = this.state.dataSource[index].frequenceList
			recLocID = this.state.dataSource[value - 1].ordRecLocID
			stageID = this.state.dataSource[value - 1].ordStageID
			recLocList = this.state.dataSource[index].recLocList
			stageList = this.state.dataSource[index].stageList
			//用法
			if (!Util.isEmpty(array)) {
				for (var j = 0; j < array.length; j++) {
					if (useageID == array[j].id) {
						flag = false
						break
					} else {
						flag = true
					}
				}
			}
			//频次
			if (!Util.isEmpty(frequenceList)) {
				for (var j = 0; j < frequenceList.length; j++) {
					if (frequenceID == frequenceList[j].id) {
						freFlag = false
						break
					} else {
						freFlag = true
					}
				}
			}
			//科室
			// if (!Util.isEmpty(recLocList)) {
			//     for (var j = 0; j < recLocList.length; j++) {
			//         if (recLocID == recLocList[j].recLocID) {
			//             recFlag = false
			//             break
			//         } else {
			//             recFlag = true
			//         }
			//     }
			// }
			//医嘱阶段
			if (!Util.isEmpty(stageList)) {
				for (var j = 0; j < stageList.length; j++) {
					if (stageID == stageList[j].ordStageID) {
						stageFlag = false
						break
					} else {
						stageFlag = true
					}
				}
			}

			if (flag === true) {
				message.error(this.setMessage('DoctorAdviceListPageNoUsage', 'descripts'), this.state.userData && this.state.userData.messageTime)
				this.state.dataSource[index]['ordLinkSeqNo'] = ''
				this.setState({})
				return
			}
			if (freFlag === true) {
				message.error(this.setMessage('DoctorAdviceListPageFreq', 'descripts'), this.state.userData && this.state.userData.messageTime)
				this.state.dataSource[index]['ordLinkSeqNo'] = ''
				this.setState({})
				return
			}
			if (recFlag === true) {
				message.error(this.setMessage('DoctorAdviceListPageNoLoc', 'descripts'), this.state.userData && this.state.userData.messageTime)
				this.state.dataSource[index]['ordLinkSeqNo'] = ''
				this.setState({})
				return
			}
			// if (stageFlag === true) {
			//     message.error('关联医嘱中，无该医嘱阶段，无法关联！', this.state.userData && this.state.userData.messageTime)
			//     this.state.dataSource[index]['ordLinkSeqNo'] = ''
			//     this.setState({})
			//     return
			// }
		}


		for (var i = 0; i < dataSource.length; i++) {
			if (dataSource[i].tabIndex - 1 == index && !Util.isEmpty(value)) {
				this.state.dataSource[index][name] = value,
					this.state.dataSource[index]['ordLinkStatus'] = true
				this.state.dataSource[index]['ordDurQty'] = this.state.dataSource[value - 1].ordDurQty
				this.state.dataSource[index]['ordFreqID'] = this.state.dataSource[value - 1].ordFreqID
				this.state.dataSource[index]['ordFrequenceDesc'] = this.state.dataSource[value - 1].ordFrequenceDesc
				this.state.dataSource[index]['cycleDays'] = this.state.dataSource[value - 1].cycleDays
				this.state.dataSource[index]['frequency'] = this.state.dataSource[value - 1].frequency
				this.state.dataSource[index]['intervalDays'] = this.state.dataSource[value - 1].intervalDays
				this.state.dataSource[index]['ordFreqDesc'] = this.state.dataSource[value - 1].ordFreqDesc
				this.state.dataSource[index]['ordUsageDesc'] = this.state.dataSource[value - 1].ordUsageDesc
				this.state.dataSource[index]['ordUsageID'] = this.state.dataSource[value - 1].ordUsageID
				// this.state.dataSource[index]['ordStageID'] = this.state.dataSource[value - 1].ordStageID
				this.state.dataSource[index]['ordDurationDesc'] = this.state.dataSource[value - 1].ordDurationDesc
				this.state.dataSource[index]['ordDurationID'] = this.state.dataSource[value - 1].ordDurationID
				this.state.dataSource[index]['ordStageID'] = this.state.dataSource[value - 1].ordStageID
				this.state.dataSource[index]['ordbodyPartID'] = this.state.dataSource[value - 1].ordbodyPartID
				this.state.dataSource[index]['ordPriorityDesc'] = this.state.dataSource[value - 1].ordPriorityDesc
				this.state.dataSource[index]['ordPriorityID'] = this.state.dataSource[value - 1].ordPriorityID
				this.state.dataSource[index]['ordEMFlag'] = this.state.dataSource[value - 1].ordEMFlag
				// this.state.dataSource[index]['ordRecLocDesc'] = this.state.dataSource[value - 1].ordRecLocDesc
				// this.state.dataSource[index]['ordRecLocID'] = this.state.dataSource[value - 1].ordRecLocID // 分组不需要改变执行科室
				if (this.state.dataSource[value - 1]['ordSkinTestFlagValue'] !== "31") {
					this.state.dataSource[index]['ordSkinTestFlagValue'] = "N"; // 皮试
				}
			}

			if (dataSource[i].tabIndex == value) {
				this.state.dataSource[index]['changeIndex'] = true,
					this.state.dataSource[index]['dataCode'] = dataSource[i].tabIndex
			}

			if (dataSource[i].tabIndex - 1 == value && !Util.isEmpty(value)) {
				this.state.dataSource[value - 1]['moveStatus'] = true,
					this.state.dataSource[index]['dataCode'] = dataSource[i].tabIndex
			}

			if (Util.isEmpty(value)) {
				this.state.dataSource[index][name] = value,
					this.state.dataSource[index]['ordLinkStatus'] = false
				this.state.dataSource[index]['mainIndexId'] = ''
				this.state.dataSource[index]['checkIdenty'] = ''//单独取消一个分组，将该分组置灰的数据打开允许输入
			}
		}
		this.setState({ inputIndex: index })
	}

	//关联号相关逻辑
	changeOrdLinkInput(name, index, data, e) {
		var value = e.target.value;
		if (value == data.tabIndex) {
			message.error(this.setMessage('DoctorAdviceListPageItSelf', 'descripts'), this.state.userData && this.state.userData.messageTime)
			return
		}

		// for(var i=0;i<dataSource.length;i++){
		//     if (value == dataSource[i].tabIndex && dataSource[parseInt(value)-1].ordLinkStatus == true) {
		//         message.error('新关联号的关联号不能是已经关联后的子医嘱！')
		//         return
		//     }
		// }
		if (Util.isEmpty(value)) {

		}
		this.state.dataSource[index][name] = value
		this.state.dataSource[index]['updateIndex'] = true
		this.setState({ inputIndex: index, linkValue: e.target.value })
	}

	//列跳转设置
	handleNextColumns(name, index, data, e) {
		var { sequence, dataSource, linkRoutes } = this.state;
		if (e.keyCode == '13') {
			// if (this.onBoardRefChild) {
			//     this.onBoardRefChild.hideKeyBoard()
			// }
			// if (this.onDurRefChild) {
			//     this.onDurRefChild.hideKeyBoard()
			// }
			// if (this.onQtyRefChild) {
			//     this.onQtyRefChild.hideKeyBoard()
			// }
			// for (var i = 0; i < dataSource.length; i++) {
			//     if (Util.isEmpty(dataSource[i].medID) && Util.isEmpty(dataSource[i].ordID)) {
			//         message.error('请先录入空医嘱！')
			//         return
			//     }
			// }
			if (sequence) {
				for (var i = 0; i < sequence.length; i++) {
					if (i <= sequence.length) {
						if (name == sequence[i] && !Util.isEmpty(sequence[i + 1])) {
							this[`${sequence[i + 1] + linkRoutes}`] ? this[`${sequence[i + 1] + linkRoutes}`].focus() : ''
						} else if (name == sequence[i] && Util.isEmpty(sequence[i + 1])) {
							if (!Util.isEmpty(this.state.dataSource[index + 1]) && !Util.isEmpty(this.state.dataSource[index + 1].medID)) {
								this.setState({
									linkRoutes: this.state.linkRoutes + 1
								}, () => {
									//当存在多个已添加数据时，让跳转按顺序跳转到下一条记录
									// for(var k=0;k<sequence.length;k++){
									if (!Util.isEmpty(sequence[1])) {
										this[`${sequence[1] + linkRoutes}`] ? this[`${sequence[1] + linkRoutes}`].focus() : ''
									}
									return
									// }
								})
							}
							for (var j = 0; j < dataSource.length; j++) {
								if (Util.isEmpty(dataSource[j].medID) && Util.isEmpty(dataSource[j].ordID)) {
									this[`${sequence[0] + linkRoutes}`] ? this[`${sequence[0] + linkRoutes}`].focus() : ''
									// message.error('请先录入空医嘱！')
									return
									// this.state.dataSource.push({ tabIndex: this.state.dataSource.length + 1 })
								}
							}
							if (Util.isEmpty(this.state.dataSource[index + 1])) {
								this.state.dataSource.push({ tabIndex: this.state.dataSource.length + 1 })
							}
							this.setState({ indexTable: this.state.dataSource.length - 1 })
						}
					}
				}
				this.loadPriorityData()
			}
		}
	}

	handleOnSelectColumns(name, index, data, e) {
		var { sequence, dataSource, linkRoutes } = this.state;
		// for (var i = 0; i < dataSource.length; i++) {
		//     if (Util.isEmpty(dataSource[i].medID) && Util.isEmpty(dataSource[i].ordID)) {
		//         message.error('请先录入空医嘱！')
		//         return
		//     }
		// }
		if (sequence) {
			for (var i = 0; i < sequence.length; i++) {
				if (i <= sequence.length) {
					if (name == sequence[i] && !Util.isEmpty(sequence[i + 1])) {
						this[`${sequence[i + 1] + linkRoutes}`] && this[`${sequence[i + 1] + linkRoutes}`].focus()
					} else if (name == sequence[i] && Util.isEmpty(sequence[i + 1])) {
						for (var j = 0; j < dataSource.length; j++) {
							if (Util.isEmpty(dataSource[j].medID) && Util.isEmpty(dataSource[j].ordID)) {
								// message.error('请先录入空医嘱！')
								return
								// this.state.dataSource.push({ tabIndex: this.state.dataSource.length + 1 })
							}
						}
						this.state.dataSource.push({ tabIndex: this.state.dataSource.length + 1 })
						this.setState({ indexTable: this.state.dataSource.length - 1 })
					}
				}
			}
		}
	}

	//部位
	changeBodyPartSelect(name, index, data, e, option) {
		var priceMsg = []
		var priceData = []
		if (!Util.isEmpty(option)) {
			for (var i = 0; i < option.length; i++) {
				//眼部互斥
				if (option[i].props.mutexflag == 'Y') {
					this.state.dataSource[index]['ordbodyPartID'] = [option[i].props.value]
					if (data.ordbodyPartID[0] == option[i].props.value) {
						this.state.dataSource[index]['ordbodyPartID'] = [option[i].props.partid]
						priceMsg.push(option[i].props.ordprice)
						this.state.dataSource[index]['ordPrice'] = option[i].props.ordprice
					}
				} else {
					priceData.push(option[i].props.ordprice)
					this.state.dataSource[index]['ordbodyPartID'] = e
					this.state.dataSource[index]['priceData'] = priceData
				}
			}
		} else {
			this.state.dataSource[index]['ordbodyPartID'] = e
		}
		this.setState({})
	}

	changeBodyPartRadioSelect(name, index, data, e, option) {
		var { dataSource, ids } = this.state;
		var priceMsg = []
		if (this.state.groupStatus && data.checkIdenty == '2' && this.state.cannelIDs) {
			for (var i = 0; i < dataSource.length; i++) {
				for (var j = 0; j < ids.length; j++) {
					if (ids[j] == dataSource[i].ordID) {
						return
					} else {
						if (dataSource[i].checkIdenty == '2' && ids[j] == dataSource[i].tabIndex) {
							this.state.dataSource[i][name] = e ? [e] : [];
							if (option) {
								priceMsg.push(option.props.ordprice)
								this.state.dataSource[i]['ordPrice'] = option.props.ordprice
							}
							this.state.dataSource[index]['ordNewQty'] = ''
							this.state.dataSource[index]['defaultStatus'] = ''
							this.state.dataSource[index]['qtyStatus'] = '2'
						} else {
							this.state.dataSource[index][name] = e ? [e] : [];
							this.state.dataSource[index]['qtyStatus'] = '2'
							this.state.dataSource[index]['defaultStatus'] = ''
						}
					}
				}
			}
		} else {
			for (var i = 0; i < dataSource.length; i++) {
				if (dataSource[i].ordLinkSeqNo == data.tabIndex && this.state.cannelStatus === false) {
					this.state.dataSource[i][name] = e ? [e] : [];
					if (option) {
						priceMsg.push(option.props.ordprice)
						this.state.dataSource[i]['ordPrice'] = option.props.ordprice
					}
					this.state.dataSource[index]['ordNewQty'] = ''
					this.state.dataSource[index]['defaultStatus'] = ''
					this.state.dataSource[index]['qtyStatus'] = '2'
				} else {
					var price = this.state.dataSource[index]['ordNewPrice'] || 1//清空价格，不会将部位价格置空
					this.state.dataSource[index]['defaultStatus'] = ''
					this.state.dataSource[index][name] = e ? [e] : [];
					this.state.dataSource[index]['qtyStatus'] = '2'
					this.state.dataSource[index]['ordPrice'] = option ? option.props.ordprice : price
				}
			}
		}
		this.setState({})
	}

	//当前组件内，所有的下拉，针对index进行赋值
	changeCommonSelect(name, index, data, e, option, admReasonList) {
		// console.log(name, index, data, e, option)
		var { dataSource, ids } = this.state;
		//判断是否是分组并且是否勾选
		if (this.state.groupStatus && data.checkIdenty == '2' && this.state.cannelIDs) {
			for (var i = 0; i < dataSource.length; i++) {
				for (var j = 0; j < ids.length; j++) {
					if (ids[j] == dataSource[i].ordID) {
						return
					} else {
						if (name == 'ordFreqID' && dataSource[i].checkIdenty == '2' && ids[j] == dataSource[i].tabIndex) {
							var freqDesc = data.frequenceList
							for (var k = 0; k < freqDesc.length; k++) {
								if (e == freqDesc[k].id) {
									this.state.dataSource[i]['ordFreqDesc'] = freqDesc[k].descripts
									// this.state.dataSource[index]['ordFreqDesc'] = freqDesc[k].descripts//在默认频次为空时，分组时，给父医嘱附上值
								}
							}
							this.state.dataSource[i][name] = e
							this.state.dataSource[index]['ordNewQty'] = ''
							this.state.dataSource[i]['frequency'] = option.props.frequency// ? option.props.frequency : dataSource[i].frequency
							this.state.dataSource[i]['qtyStatus'] = '2'
							this.state.dataSource[index]['defaultStatus'] = ''
							// this.state.dataSource[i]['cycleDays'] = option.props.cycleDays// ? option.props.cycleDays : dataSource[i].cycleDays
							this.state.dataSource[i]['cycleDays'] = option.props.cycleDays// ? option.props.cycleDays : dataSource[i].cycleDays  ordSpeedUnitID
							this.state.dataSource[i]['intervalDays'] = option.props.intervalDays// ? option.props.intervalDays : dataSource[i].intervalDays
						} else if (name == 'ordDurationID' && dataSource[i].checkIdenty == '2' && ids[j] == dataSource[i].tabIndex) {
							this.state.dataSource[i][name] = e
							this.state.dataSource[index]['ordNewQty'] = ''
							this.state.dataSource[index]['defaultStatus'] = ''
							this.state.dataSource[i]['duraFactor'] = option.props.duraFactor ? option.props.duraFactor : dataSource[i].duraFactor
							this.state.dataSource[i]['qtyStatus'] = '2'
						} else if (name == 'ordStageID' && dataSource[i].checkIdenty == '2' && ids[j] == dataSource[i].tabIndex) {
							this.state.dataSource[i][name] = e
							this.state.dataSource[index]['defaultStatus'] = ''
							this.state.dataSource[index]['ordNewQty'] = ''
						} else if (name == 'ordSpeedUnitID' && dataSource[i].checkIdenty == '2' && ids[j] == dataSource[i].tabIndex) {
							this.state.dataSource[i][name] = e
							this.state.dataSource[index]['ordNewQty'] = ''
							this.state.dataSource[index]['defaultStatus'] = ''
							this.state.dataSource[i]['qtyStatus'] = '2'
						} else if ((name == 'ordQtyUomID') && dataSource[i].checkIdenty == '2' && ids[j] == dataSource[i].tabIndex) {
							this.state.dataSource[index]['defaultStatus'] = ''
							// this.state.dataSource[i][name] = e
							// this.state.dataSource[index]['ordNewQty'] = ''
							// this.state.dataSource[index]['ordPrice'] = option.props.ordPrice ? option.props.ordPrice : dataSource[i].ordPrice
							// this.state.dataSource[i]['qtyStatus'] = '2'
						} else if ((name == 'ordUsageID') && dataSource[i].checkIdenty == '2' && ids[j] == dataSource[i].tabIndex) {

							var usageList = data.usageList
							if (!Util.isEmpty(usageList)) {
								for (var f = 0; f < usageList.length; f++) {
									if (e == usageList[f].id) {
										this.state.dataSource[i]['ordUsageDesc'] = usageList[f].descripts
										// this.state.dataSource[index]['ordUsageDesc'] = usageList[f].descripts
									}
								}
							}
							// 如果当前皮试为ture的话则判断用法是否选择的皮试，如果不为皮试的话就去除皮试勾选
							if (this.state.dataSource[index]['ordSkinTestFlagValue'] && e !== "31") {
								this.state.dataSource[index]['ordSkinTestFlagValue'] = "N"; // 皮试
							}
							this.state.dataSource[i][name] = e
							this.state.dataSource[index]['ordNewQty'] = ''
							this.state.dataSource[index]['defaultStatus'] = ''
							this.state.dataSource[i]['defaultStatus'] = ''
							// this.state.dataSource[index]['ordPrice'] = option.props.ordPrice ? option.props.ordPrice : dataSource[i].ordPrice
							this.state.dataSource[i]['qtyStatus'] = '2'
						} else if (name == 'ordSkinTestWayID') {
							this.state.dataSource[index][name] = e
							this.state.dataSource[index]['defaultStatus'] = ''
							this.state.dataSource[index]['ordNewQty'] = ''
						} else if (name == 'ordPriorityID' && dataSource[i].checkIdenty == '2' && ids[j] == dataSource[i].tabIndex) {
							this.state.dataSource[i][name] = e
							this.state.dataSource[i]['noSub'] = option.props.noSub
							this.state.dataSource[index]['ordNewQty'] = ''
							this.state.dataSource[index]['defaultStatus'] = ''
							this.state.ordPriorityID = e
							this.loadDisableColumn(data, index, e)
							// this.onBlurFreqSelect('', index, data, e)
							this.onBlurFreqSelect('status', index, data, e)
						} else if (name == 'ordRecLocID') {
							this.state.dataSource[index][name] = e
							this.state.dataSource[index]['defaultStatus'] = ''
							this.state.dataSource[index]['ordNewQty'] = ''
							this.loadOrdRecLocID(data, index, e)
						}
						//  else if (name == 'ordbodyPartID') {//部位
						//     //取选中得数组，渲染到对应得数据去
						//     var priceMsg = []
						//     if (!Util.isEmpty(option)) {
						//         for (var i = 0; i < option.length; i++) {
						//             //眼部互斥
						//             if (option[i].props.mutexflag == 'Y') {
						//                 this.state.dataSource[index]['ordbodyPartID'] = [option[i].props.value]
						//                 if (data.ordbodyPartID[0] == option[i].props.value) {
						//                     this.state.dataSource[index]['ordbodyPartID'] = option[i].props.partid
						//                     // priceMsg.push(option[i].props.ordprice)
						//                     // this.state.dataSource[index]['priceData'] = priceMsg
						//                 }
						//             } else {
						//                 this.state.dataSource[index]['ordbodyPartID'] = e
						//             }
						//         }
						//     } else {
						//         this.state.dataSource[index]['ordbodyPartID'] = e
						//     }
						// }
						else {
							if (name == 'ordPriorityID') {
								this.state.ordPriorityID = e
								this.state.dataSource[index]['noSub'] = option.props.noSub
								this.state.dataSource[index]['defaultStatus'] = ''
								this.loadDisableColumn(data, index, e)
								// this.onBlurFreqSelect('', index, data, e)
								this.onBlurFreqSelect('status', index, data, e)
							}
							if (option) {
								// if (name == 'ordDoseUnitID') {
								//     // this.state.dataSource[index]['ordDose'] = option.props.code ? option.props.code : ''
								//     this.state.dataSource[index]['ordDose'] =
								//         ((parseFloat(data.doseMolecule) / parseFloat(data.doseDenominator)) /
								//             ((option.props.doseMolecule ? parseFloat(option.props.doseMolecule) : 1) /
								//                 (option.props.doseDenominator ? parseFloat(option.props.doseDenominator) : 1))) * data.ordDose
								// }
								if (name == 'ordQtyUomID') {
									this.state.dataSource[index]['ordPrice'] = option.props.price
									this.state.dataSource[index]['defaultStatus'] = ''
								}
								this.state.dataSource[index]['defaultStatus'] = ''
								this.state.dataSource[index][name] = e
								this.state.dataSource[index]['ordNewQty'] = ''
								this.state.dataSource[index]['frequency'] = option.props.frequency ? option.props.frequency : dataSource[index].frequency
								this.state.dataSource[index]['ordFreqDesc'] = option.props.ordFreqDesc ? option.props.ordFreqDesc : dataSource[index].ordFreqDesc
								this.state.dataSource[index]['cycleDays'] = option.props.cycleDays ? option.props.cycleDays : dataSource[index].cycleDays
								this.state.dataSource[index]['intervalDays'] = option.props.intervalDays ? option.props.intervalDays : dataSource[index].intervalDays
								this.state.dataSource[index]['duraFactor'] = option.props.duraFactor ? option.props.duraFactor : dataSource[index].duraFactor
								this.state.dataSource[index]['doseDenominator'] = option.props.doseDenominator ? option.props.doseDenominator : dataSource[index].doseDenominator
								this.state.dataSource[index]['doseMolecule'] = option.props.doseMolecule ? option.props.doseMolecule : dataSource[index].doseMolecule
								this.state.dataSource[index]['qtyMolecule'] = option.props.qtyMolecule ? option.props.qtyMolecule : dataSource[index].qtyMolecule
								this.state.dataSource[index]['qtyDenominator'] = option.props.qtyDenominator ? option.props.qtyDenominator : dataSource[index].qtyDenominator
								this.state.dataSource[index]['qtyStatus'] = '2'
							} else {
								this.state.dataSource[index][name] = e
								this.state.dataSource[index]['qtyStatus'] = '2'
								this.state.dataSource[index]['defaultStatus'] = ''
							}
						}
					}
				}
			}
		} else {
			//手动输入关联号时，渲染对应的下拉数据
			for (var i = 0; i < dataSource.length; i++) {
				if (name == 'ordFreqID' && dataSource[i].ordLinkSeqNo == data.tabIndex && this.state.cannelStatus === false) {
					var freqDesc = data.frequenceList
					for (var k = 0; k < freqDesc.length; k++) {
						if (e == freqDesc[k].id) {
							this.state.dataSource[i]['ordFreqDesc'] = freqDesc[k].descripts
							this.state.dataSource[index]['ordFreqDesc'] = freqDesc[k].descripts//在默认频次为空时，分组时，给父医嘱附上值
						}
					}
					this.state.dataSource[index]['defaultStatus'] = ''
					this.state.dataSource[i][name] = e
					this.state.dataSource[index]['ordNewQty'] = ''
					this.state.dataSource[i]['frequency'] = option.props.frequency
					this.state.dataSource[i]['cycleDays'] = option.props.cycleDays
					this.state.dataSource[i]['qtyStatus'] = '2'
					this.state.dataSource[i]['intervalDays'] = option.props.intervalDays
				} else if (name == 'ordDurationID' && dataSource[i].ordLinkSeqNo == data.tabIndex && this.state.cannelStatus === false) {
					this.state.dataSource[i][name] = e
					this.state.dataSource[index]['defaultStatus'] = ''
					this.state.dataSource[index]['ordNewQty'] = ''
					this.state.dataSource[i]['duraFactor'] = option.props.duraFactor
					this.state.dataSource[i]['qtyStatus'] = '2'
				} else if (name == 'ordStageID' && dataSource[i].ordLinkSeqNo == data.tabIndex && this.state.cannelStatus === false) {
					this.state.dataSource[i][name] = e
					this.state.dataSource[index]['defaultStatus'] = ''
					this.state.dataSource[index]['ordNewQty'] = ''
					this.state.dataSource[i]['qtyStatus'] = '2'
				} else if (name == 'ordSpeedUnitID' && dataSource[i].ordLinkSeqNo == data.tabIndex && this.state.cannelStatus === false) {
					this.state.dataSource[i][name] = e
					this.state.dataSource[index]['defaultStatus'] = ''
					this.state.dataSource[index]['ordNewQty'] = ''
					this.state.dataSource[i]['qtyStatus'] = '2'
				} else if ((name == 'ordQtyUomID' || name == 'ordUsageID') && dataSource[i].ordLinkSeqNo == data.tabIndex && this.state.cannelStatus === false) {
					var usageList = data.usageList
					if (!Util.isEmpty(usageList)) {
						for (var f = 0; f < usageList.length; f++) {
							if (e == usageList[f].id) {
								this.state.dataSource[i]['ordUsageDesc'] = usageList[f].descripts
							}
						}
					}
					// console.log("this.state.dataSource[i]", this.state.dataSource[i])
					// 如果当前皮试为ture的话则判断用法是否选择的皮试，如果不为皮试的话就去除皮试勾选
					if (this.state.dataSource[index]['ordSkinTestFlagValue'] && e !== "31") {
						this.state.dataSource[index]['ordSkinTestFlagValue'] = "N"; // 皮试
					}
					this.state.dataSource[i][name] = e
					this.state.dataSource[index]['defaultStatus'] = ''
					this.state.dataSource[i]['defaultStatus'] = ''
					// this.state.dataSource[index]['ordPrice'] = option.props.price
					this.state.dataSource[index]['ordPrice'] = option.props.ordPrice ? option.props.ordPrice : dataSource[i].ordPrice
					this.state.dataSource[i]['qtyStatus'] = '2'
					this.state.dataSource[index]['ordNewQty'] = ''
				} else if (name == 'ordPriorityID' && dataSource[i].ordLinkSeqNo == data.tabIndex && this.state.cannelStatus === false) {
					this.state.dataSource[i][name] = e
					this.state.dataSource[i]['noSub'] = option.props.noSub
					this.state.dataSource[index]['defaultStatus'] = ''
					this.state.dataSource[index]['ordNewQty'] = ''
					this.state.ordPriorityID = e
					this.loadDisableColumn(data, index, e)
					// this.onBlurFreqSelect('', index, data, e)
					this.onBlurFreqSelect('status', index, data, e)
				} else if (name == 'ordRecLocID') {
					this.state.dataSource[index][name] = e
					this.state.dataSource[index]['defaultStatus'] = ''
					this.state.dataSource[index]['ordNewQty'] = ''
					this.loadOrdRecLocID(data, index, e)
				}
				//  else if (name == 'ordbodyPartID') {//部位
				//     //取选中得数组，渲染到对应得数据去
				//     var priceMsg = []
				//     if (!Util.isEmpty(option)) {
				//         for (var i = 0; i < option.length; i++) {
				//             //眼部互斥
				//             if (option[i].props.mutexflag == 'Y') {
				//                 this.state.dataSource[index]['ordbodyPartID'] = [option[i].props.value]
				//                 if (data.ordbodyPartID[0] == option[i].props.value) {
				//                     this.state.dataSource[index]['ordbodyPartID'] = [option[i].props.partid]
				//                     // priceMsg.push(option[i].props.ordprice)
				//                     // this.state.dataSource[index]['priceData'] = priceMsg
				//                 }
				//             } else {
				//                 this.state.dataSource[index]['ordbodyPartID'] = e
				//             }
				//         }
				//         this.state.dataSource[index]['ordbodyPartID'] = e
				//     } else {
				//         this.state.dataSource[index]['ordbodyPartID'] = e
				//     }
				// }
				else {
					if (name == 'ordPriorityID') {
						this.state.ordPriorityID = e
						this.state.dataSource[index]['noSub'] = option.props.noSub
						this.state.dataSource[index]['defaultStatus'] = ''
						this.loadDisableColumn(data, index, e)
						// this.onBlurFreqSelect('', index, data, e)
						this.onBlurFreqSelect('status', index, data, e)
					}
					if (option) {
						// if (name == 'ordDoseUnitID') {
						//     // this.state.dataSource[index]['ordDose'] = option.props.code ? option.props.code : ''
						//     this.state.dataSource[index]['ordDose'] =
						//         ((parseFloat(data.doseMolecule) / parseFloat(data.doseDenominator)) /
						//             ((option.props.doseMolecule ? parseFloat(option.props.doseMolecule) : 1) /
						//                 (option.props.doseDenominator ? parseFloat(option.props.doseDenominator) : 1))) * data.ordDose
						// }
						this.state.dataSource[index][name] = e
						//切换用法时，先将默认的皮试用法清除数据，防止用法无法切换
						if (name == 'ordUsageID') {
							// 如果当前皮试为ture的话则判断用法是否选择的皮试，如果不为皮试的话就去除皮试勾选 31为用法下拉皮试ID
							if (this.state.dataSource[index]['ordSkinTestFlagValue'] && e !== "31") {
								this.state.dataSource[index]['ordSkinTestFlagValue'] = "N"; // 皮试
							}
							this.state.dataSource[index]['ordSkinTestUsageID'] = ''
							this.state.dataSource[index]['ordUsageDesc'] = option.props.name
							this.state.dataSource[index]['defaultStatus'] = ''
						}
						if (name == 'ordQtyUomID') {
							this.state.dataSource[index]['ordPrice'] = option.props.price
							this.state.dataSource[index]['defaultStatus'] = ''
						}
						// this.state.dataSource[index]['defaultStatus'] = ''
						this.state.dataSource[index]['ordNewQty'] = ''
						this.state.dataSource[index]['frequency'] = option.props.frequency ? option.props.frequency : dataSource[index].frequency
						this.state.dataSource[index]['ordFreqDesc'] = option.props.ordFreqDesc ? option.props.ordFreqDesc : dataSource[index].ordFreqDesc
						this.state.dataSource[index]['cycleDays'] = option.props.cycleDays ? option.props.cycleDays : dataSource[index].cycleDays
						this.state.dataSource[index]['intervalDays'] = option.props.intervalDays ? option.props.intervalDays : dataSource[index].intervalDays
						this.state.dataSource[index]['duraFactor'] = option.props.duraFactor ? option.props.duraFactor : dataSource[index].duraFactor
						this.state.dataSource[index]['doseDenominator'] = option.props.doseDenominator ? option.props.doseDenominator : dataSource[index].doseDenominator
						this.state.dataSource[index]['doseMolecule'] = option.props.doseMolecule ? option.props.doseMolecule : dataSource[index].doseMolecule
						this.state.dataSource[index]['qtyMolecule'] = option.props.qtyMolecule ? option.props.qtyMolecule : dataSource[index].qtyMolecule
						this.state.dataSource[index]['qtyDenominator'] = option.props.qtyDenominator ? option.props.qtyDenominator : dataSource[index].qtyDenominator
						this.state.dataSource[index]['qtyStatus'] = '2'
						this.state.dataSource[index]['defaultStatus'] = ''
					} else {
						this.state.dataSource[index]['defaultStatus'] = ''
						this.state.dataSource[index][name] = e
						this.state.dataSource[index]['qtyStatus'] = '2'
					}
					// this.state.dataSource[index]['ordPrice'] = option.props.price
				}
			}
			// this.state.dataSource[index][name] = e
		}
		/**
		* @ByShizi: 切换用法时不需要重新计算数量
		* Create 2023/03/11
		* */
		if (name === 'ordUsageID') {
			this.state.dataSource[index]['qtyStatus'] = '1';
		}
		this.setState({})
	}

	//切换执行科室
	loadOrdRecLocID(data, index, e) {
		var params = {
			params: [{
				admID: this.props.patStatus == '1' ? (this.state.patientData ? this.state.patientData.admID : '') :
					((this.state.patientData ? this.state.patientData.admID : '')),
				medID: data.medID,
				recLocID: e
			}]
		}
		$http.post('urlDeault', this, {
			code: "03050151",
			data: params,
			success: function (res) {
				if (res.errorCode == '0') {
					this.state.dataSource[index]['specList'] = res.result.specList,
						this.state.dataSource[index]['qtyUnitList'] = res.result.qtyUnitList,
						this.state.dataSource[index]['ordQtyUomID'] = res.result.ordQtyUomID,
						this.state.dataSource[index]['ordQtyUomDesc'] = res.result.ordQtyUomDesc,
						this.state.dataSource[index]['ordPrice'] = res.result.ordPrice,
						this.state.dataSource[index]['ordSpecID'] = res.result.ordSpecID,
						this.state.dataSource[index]['ordSpecDesc'] = res.result.ordSpecDesc,
						this.state.dataSource[index]['qtyMolecule'] = res.result.qtyMolecule,
						this.state.dataSource[index]['qtyDenominator'] = res.result.qtyDenominator,
						this.setState({})
				}
			}
		});
	}

	loadDisableColumn(data, index, id) {
		var params = {
			params: [{
				admID: this.props.patStatus == '1' ? (this.state.patientData ? this.state.patientData.admID : '') :
					((this.state.patientData ? this.state.patientData.admID : '')),
				medID: data.medID,
				ordPriorityID: id
			}]
		}
		$http.post('urlDeault', this, {
			code: "03010044",
			data: params,
			success: function (res) {
				if (res.errorCode == '0') {
					this.state.dataSource[index]['unableToEdit'] = res.result.unableToEdit,
						this.state.dataSource[index]['sequence'] = res.result.sequence,
						this.setState({})
				}
			}
		});
	}

	commonInput(name, index, data, e) {
		const value = e?.target?.value || '';
		if (name == 'ordDurQty') {
			const reg = /^[1-9]\d*$/;
			this.state.dataSource[index]['ordNewQty'] = ''
			this.state.dataSource[index]['defaultStatus'] = ''
			if (!reg.test(value) && value.length > 0) {
				message.error(this.setMessage('DoctorAdviceListPageInt', 'descripts'), this.state.userData && this.state.userData.messageTime)
				return
			}
		}

		if (name == 'ordFirstDayNum') {
			const reg = /^[0-9]\d*$/;
			if (!reg.test(value) && value.length > 0) {
				message.error(this.setMessage('DoctorAdviceListPageInt', 'descripts'), this.state.userData && this.state.userData.messageTime)
				return
			}
			if (value > data.frequency) {
				message.error(this.setMessage('DoctorAdviceListPagefirstDay', 'descripts'), this.state.userData && this.state.userData.messageTime)
				return
			}
		}

		if (name == 'ordQty') {
			this.state.dataSource[index]['ordNewQty'] = value
			this.state.dataSource[index]['defaultStatus'] = ''
		}

		if (name == 'ordDose') {
			this.state.dataSource[index]['ordNewQty'] = ''
			this.state.dataSource[index]['defaultStatus'] = ''
			var reg = /(^[1-9][0-9]*$)|(^[1-9][0-9]*\.\d{0,4}$)|^0(?!\d)\.?\d{0,4}$|^[1-9]?$/;
			if (!reg.test(value)) {
				message.error('只允许数据正整数或者4位小数', this.state.userData && this.state.userData.messageTime)
				return
			}
		}
		var { dataSource, ids } = this.state;
		//判断是否是分组并且是否勾选
		if (this.state.groupStatus && data.checkIdenty == '2' && ids.length > 1) {
			for (var i = 0; i < dataSource.length; i++) {
				for (var j = 0; j < ids.length; j++) {
					if (ids[j] == dataSource[i].ordID) {
						return
					} else {
						if (name == 'ordDurQty' && dataSource[i].checkIdenty == '2') {
							this.state.dataSource[i][name] = value
							this.state.dataSource[i]['qtyStatus'] = '2'
							this.state.dataSource[index]['defaultStatus'] = ''
						} else {
							this.state.dataSource[index][name] = value
							this.state.dataSource[i]['qtyStatus'] = '2'
							this.state.dataSource[index]['defaultStatus'] = ''
						}
					}
				}
			}
		} else {
			for (var i = 0; i < dataSource.length; i++) {
				if (dataSource[i].ordLinkSeqNo == data.tabIndex && (name == 'ordFreqID' || name == 'ordUsageID' ||
					name == 'ordDurationID' || name == 'ordPriorityID' || name == 'ordRecLocID' || name == 'ordDurQty')) {
					this.state.dataSource[i][name] = value
					this.state.dataSource[i]['qtyStatus'] = '2'
					this.state.dataSource[index]['defaultStatus'] = ''
				} else {
					if (name == 'ordQty') {
						this.state.dataSource[index]['qtyStatus'] = '1'
						this.state.dataSource[index][name] = value
						// this.state.dataSource[index]['defaultStatus'] = ''
						this.state.dataSource[index]['defaultStatus'] = true
						//修改数量计算材料问题不计算总价之前赋值defaultStatus == true,现在改成空
						this.state.dataSource[index]['defaultStatus'] = ''
					}
					else if (name == 'ordNote') {
						this.state.dataSource[index]['qtyStatus'] = '2'
						this.state.dataSource[index][name] = e
					}
					else {
						this.state.dataSource[index]['qtyStatus'] = '2'
						this.state.dataSource[index][name] = value
						this.state.dataSource[index]['defaultStatus'] = ''
					}
				}
			}
			// this.state.dataSource[index][name] = e.target.value
		}
		this.setState({}, () => {
			// 住院不根据数量计算疗程
			name == 'ordQty' && this.props.patStatus !== '1' && this.handleCalculateTreatmentCourse(data, index, value);
		});
	}

	// 计算疗程
	handleCalculateTreatmentCourse = (data, index, qty) => {
		const { calculateTreatmentCourse } = this.state; // calculateTreatmentCourse - 计算标志
		// frequency - 频次【转换数量 - 每天两次为2】 | ordDurQty - 疗程 | ordDose - 剂量 | doseDenominator - 剂量单位 | duraFactor - 疗程单位-转换天数 | cycleDays - 周期天数
		if (calculateTreatmentCourse === 'Y' && data.ordToalCountO == 'Y') { // 只处理门诊
			this.state.dataSource[index].ordDurQty = this.handleCalculateOrdDurQty(data, qty); // 疗程向上取整
			this.setState({});
		}
	}

	// 计算疗程
	handleCalculateOrdDurQty = (data, qty, type) => {
		var unableToEdit = data.unableToEdit;
		var editFlag = false;
		if (unableToEdit) {
			for (var j = 0; j < unableToEdit.length; j++) {
				if (unableToEdit[j] == 'ordDurQty') {
					editFlag = true
				}
			}
		}
		if (editFlag || data.ordID || data.ordLinkStatus || (!Util.isEmpty(data.identity) && this.state.groupStatus && data.checkIdenty == '2') || this.props.patStatus == '1') return 1; // 不需要疗程的不参与计算 - 直接赋值成1
		let oneNum = 0;
		if (type === 'ordDurQty*duraFactor') { // 只计算本次使用天数 - 疗程 * 疗程单位
			return parseFloat(data.ordDurQty || 1) * parseFloat(data.duraFactor || 1);
		} else {
			if (data.cycleDays) {//优先使用cycleDays，计算总次数
				oneNum = Math.ceil((parseFloat(data.duraFactor || 1) * parseFloat(data.frequency || 1)) / (data.cycleDays && parseFloat(data.cycleDays) > 0 ? parseFloat(data.cycleDays) : 1))
			} else {
				oneNum = Math.ceil((parseFloat(data.duraFactor || 1) * parseFloat(data.frequency || 1)) / (data.intervalDays && parseFloat(data.intervalDays) > 0 ? parseFloat(data.intervalDays) : 1))
			}
			// 单次剂量
			let oneDosc = (parseFloat(data.ordDose ? data.ordDose : 1) * parseFloat(!Util.isEmpty(data.doseMolecule) ? data.doseMolecule : 1)).toFixed(2) / (parseFloat(data.doseDenominator) > 0 ? parseFloat(data.doseDenominator) : 1);
			return Math.ceil(qty / (oneNum * oneDosc));
		}
	}

	onFocusCommonInput(name, index, data, e) {
		if (this.state.nameIndex != (name + index)) {
			// if (this.onBoardRefChild) {
			//     this.onBoardRefChild.hideKeyBoard(e, e.target.value)
			// }
			// if (this.onDurRefChild) {
			//     this.onDurRefChild.hideKeyBoard(e, e.target.value)
			// }
			// if (this.onQtyRefChild) {
			//     this.onQtyRefChild.hideKeyBoard(e, e.target.value)
			// }
		}
		// if (name == 'ordDose') {
		//     this.onBoardRefChild.showCheckBoard(e, e.target.value)
		//     this.onBoardRefChild.setCaret(document.getElementById(name + index))
		// } else if (name == 'ordDurQty') {
		//     this.onDurRefChild.showCheckBoard(e, e.target.value)
		//     this.onDurRefChild.setCaret(document.getElementById(name + index))
		// } else if (name == 'ordQty') {
		//     this.onQtyRefChild.showCheckBoard(e, e.target.value)
		//     this.onQtyRefChild.setCaret(document.getElementById(name + index))
		// }
		this.setState({
			nameIndex: name + index,
			medIndex: index
		}, () => {
			this.handleClearOrdMedItemFocus();
		})
	}

	// 点击其他的框清除焦点数据
	handleClearOrdMedItemFocus = () => {
		const { currentOrdMedIndex } = this.state;
		if (currentOrdMedIndex !== '') {
			this.setState({ currentOrdMedIndex: '' }, () => {
				this.getDynColumnsData();
			});
		}
	}

	onBoardRef = (refs) => {
		this.onBoardRefChild = refs
	}

	onDurRef = (refs) => {
		this.onDurRefChild = refs
	}

	onQtyRef = (refs) => {
		this.onQtyRefChild = refs
	}

	setValue(name, index, data, e) {
		var medIndex = this.state.medIndex
		if (name == 'ordQty') {
			this.state.dataSource[medIndex]['qtyStatus'] = '1'
			this.state.dataSource[medIndex]['ordNewQty'] = e
			// return
		}
		//  else {
		//     this.state.dataSource[index][name] = e
		//     this.state.dataSource[index]['ordNewQty'] = ''
		// }
		this.state.dataSource[medIndex][name] = e
		this.setState({})
	}

	changeCheckBox(name, index, e) {
		this.state.dataSource[index][name] = e.target.checked ? 'Y' : 'N'
		if (name == 'ordSkinTestFlag') {
			this.state.dataSource[index]['ordSkinTestFlagValue'] = e.target.checked ? 'Y' : 'N'
			if (!e.target.checked) {
				this.state.dataSource[index]['ordSkinTestWayID'] = undefined
			}
		}
		this.setState({})
	}

	//onfocus名称规格展示下拉table
	handleFocusInput(index, e) {
		if (this.state.visible) {
			this.setState({
				indexTable: index,
				visible: false
			})
		} else {
			this.setState({
				indexTable: index,
				visible: true
			})
		}
	}

	//列修改为input框，change事件处理
	handleSearchInput(name, index, data, e) {
		var { dataSource } = this.state;
		// let top = document.getElementById('name-input' + index).getBoundingClientRect().top + 40;
		// let left = document.getElementById('name-input' + index).getBoundingClientRect().left + 'px';
		// let windowHeight = window.innerHeight;
		// if ((top + 360) > windowHeight) {
		//     top = top - 330 - 80 + 'px';
		// }
		var value = e.target.value;
		//change名称规格的时候，讲关联关系去除
		if (Util.isEmpty(value)) {
			for (var i = 0; i < dataSource.length; i++) {
				if (dataSource[i].ordLinkStatus || dataSource[i].identity) {
					dataSource[i].identity = ''
					dataSource[index].ordLinkStatus = false
					dataSource[index].ordLinkSeqNo = undefined
				}
			}
			//清除数据时，保留医嘱优先级
			this.state.dataSource[index] = { tabIndex: index + 1, priorityList: data.priorityList, ordPriorityID: data.ordPriorityID, writtenOrderFlag: data.writtenOrderFlag }
		}
		this.state.dataSource[index][name] = value;
		this.setState({
			changeValue: value,
			indexTab: index,
			// top: top,
			// left: left,
			// indexTable:index//清除中间的名称规格，点击树，重新加载index
		})
		if (value.length > 0) {
			if (!this.state.isRenderDynColumns) { // 是否需要重新渲染表头数据
				this.setState({ isRenderDynColumns: true });
				this.getDynColumnsData();
			}
		} else {
			this.setState({
				selectData: [],
				total: 0,
				page: 1,
				isRenderDynColumns: false
			}, () => {
				this.getDynColumnsData();
			})
		}
		document.addEventListener('elementTable', this.loadListener)
	}

	handleSearchClear(index, value) {
		var { dataSource } = this.state;
		//change名称规格的时候，讲关联关系去除
		for (var i = 0; i < dataSource.length; i++) {
			if (dataSource[i].ordLinkStatus || dataSource[i].identity) {
				dataSource[i].identity = ''
				dataSource[i].ordLinkStatus = false
				dataSource[i].ordLinkSeqNo = undefined
			}
		}
		this.state.dataSource[index] = {}
		this.setState({
			changeValue: value,
			indexTab: index,
		})
	}

	showCommonTableModal(index, record, item, e) {
		let value = e.target.value;
		if (record.writtenOrderFlag !== 'Y' && !value) return;
		if (e.keyCode == '13') {
			let top = document.getElementById('name-input' + index).getBoundingClientRect().top + 40;
			let left = document.getElementById('name-input' + index).getBoundingClientRect().left;
			let windowHeight = window.innerHeight;
			let windowWidth = window.innerWidth;
			if ((top + 360) > windowHeight) {
				top = top - 406;
				if (top < 0) {
					top = windowHeight / 2 - 406 / 2
				}
			}
			if ((left + 1110) > windowWidth) {
				left = left - 1110 + parseInt(item?.width || 0) + 10;
				if (left < 0) {
					left = windowWidth / 2 - 1110 / 2
				}
			}
			if (record.writtenOrderFlag !== 'Y') {
				this.setState({
					isShowCommonTableModal: true,
					linkRoutes: index,
					loading: true,
					top: top + 'px',
					left: left + 'px',
					indexTable: index//删除一条空数据，重新添加
				}, () => {
					this.child.showModal();
					this.loadSelectData(value, '', '')
				})
			} else { // 文字医嘱
				this.setState({
					top: top,
					left: left,
					linkRoutes: index,
					indexTable: index,//删除一条空数据，重新添加
					isShowCommonTableModal: true,
				}, () => {
					this.writtenOrdersRef && this.writtenOrdersRef.modifyVisible(true, value);
				});
			}
		}
	}

	//分页切换
	changePageSize(current, pageSize) {
		this.setState({ pageSize: pageSize, page: current }, () => {
			this.loadSelectData('', current, pageSize, 'search');
		});
	}

	changeAdvicePage(current, pageSize) {
		this.setState({ newPage: pageSize, codePage: current }, () => {
			this.loadData('', current, pageSize);
		});
	}

	//分页切换
	onChange(e) {
		this.setState({ page: e }, () => {
			this.loadSelectData('', e, '');
		});
	}

	changeData(e) {
		this.setState({ codePage: e }, () => {
			this.loadData('', e, '');
		});
	}

	loadSelectData(value, page, pageSize, search) {
		var params = {
			params: [{
				admID: this.state.patientData ? this.state.patientData.admID : '',
				searchCode: value ? value.replace(/^\s*|\s*$/g, '') :
					(this.state.changeValue ? this.state.changeValue.replace(/^\s*|\s*$/g, '') : ''),
				logonLocID: this.state.userData.locID,
				userID: this.state.userData.userID,
				groupID: this.state.userData.groupID,
				hospID: this.state.userData.hospID,
				ordType: this.state.specificatio == true ? 'D' : '',
				judgeFlag: 'Y'
			}],
			pagination: [{
				pageSize: this.state.pageSize,
				currentPage: page
			}]

		}
		$http.post('urlDeault', this, {
			code: "03050019",
			data: params,
			success: function (res) {
				if (res.errorCode == '0') {
					this.state.selectData = res.result.data.length > 0 ? res.result.data : []
					this.setState({
						// selectData: res.result.data,
						loading: false,
						total: res.result.totalCount,
						rowMedID: !Util.isEmpty(res.result.data) ? res.result.data[0].medID : (!Util.isEmpty(res.result.data) ? res.result.data[0].ordSetID : ''),
						search: search
					})
				}
			}
		});
	}

	//鼠标移动添加样式
	addMouseOverStyle(name, e) {
		this.setState({
			addMouseStyle: true,
			indexStyle: name
		})
	}

	addMouseLeaveStyle() {
		this.setState({
			addMouseStyle: false,
			indexStyle: ''
		})
	}

	//列设置
	settingColumns() {
		if (this.state.showColumns) {
			this.setState({
				showColumns: false
			})
		} else {
			this.setState({
				showColumns: true
			})
		}
	}

	//开始分组
	handleStartGroup() {
		var { dataSource, ids } = this.state;
		//先setState一个标识值，表示分组
		if (Util.isEmpty(ids)) {
			message.error(this.setMessage('DoctorAdviceListPageNeedGroup', 'descripts'), this.state.userData && this.state.userData.messageTime)
			return
		}
		if (ids.length == 1) {
			message.error(this.setMessage('DoctorAdviceListPageTwoData', 'descripts'), this.state.userData && this.state.userData.messageTime)
			return
		}
		this.setState({
			groupStatus: true,
			cannelIDs: true
		})
		for (var i = 0; i < dataSource.length; i++) {
			for (var j = 0; j < ids.length; j++) {
				if (ids[j] == dataSource[i].ordID) {
					this.setState({ ids: [] })
					message.error(this.setMessage('DoctorAdviceListPageInsert', 'descripts'), this.state.userData && this.state.userData.messageTime)
					return
				}
			}
		}
		//使用冒泡排序，将选中的id进行排序，取最小的数值作为分组置灰标识
		for (var i = 0; i < ids.length - 1; i++) {
			for (var j = 0; j < ids.length - i - 1; j++) {
				if (ids[j] > ids[j + 1]) {
					var temp = ids[j];
					ids[j] = ids[j + 1];
					ids[j + 1] = temp;
				}
			}
			// this.state.dataSource[ids[0]]['identity'] = '1'
		}

		//获取子医嘱的下拉数据，校验是否可以分组
		var useageID = ''//用法id
		var array = []//用法数组
		var frequenceID = ''//频次id
		var frequenceList = []//频次数组
		var recLocList = []//执行科室
		var recLocID = ''
		var flag = false
		var freFlag = false
		var recFlag = false
		for (var i = 0; i < ids.length; i++) {
			// for(var j=0;j<dataSource.length;j++){
			useageID = this.state.dataSource[ids[0] - 1].ordUsageID
			array = this.state.dataSource[ids[i] - 1].usageList
			frequenceID = this.state.dataSource[ids[0] - 1].ordFreqID
			frequenceList = this.state.dataSource[ids[i] - 1].frequenceList
			recLocID = this.state.dataSource[ids[0] - 1].ordRecLocID
			recLocList = this.state.dataSource[ids[i] - 1].recLocList
			// }
		}
		//用法
		if (!Util.isEmpty(array)) {
			for (var j = 0; j < array.length; j++) {
				if (useageID == array[j].id) {
					flag = false
					break
				} else {
					flag = true
				}
			}
		}
		//频次
		if (!Util.isEmpty(frequenceList)) {
			for (var j = 0; j < frequenceList.length; j++) {
				if (frequenceID == frequenceList[j].id) {
					freFlag = false
					break
				} else {
					freFlag = true
				}
			}
		}
		//科室
		// if (!Util.isEmpty(recLocList)) {
		//     for (var j = 0; j < recLocList.length; j++) {
		//         if (recLocID == recLocList[j].recLocID) {
		//             recFlag = false
		//             break
		//         } else {
		//             recFlag = true
		//         }
		//     }
		// }

		if (flag === true) {
			message.error(this.setMessage('DoctorAdviceListPageNoUsage', 'descripts'), this.state.userData && this.state.userData.messageTime)
			return
		}
		if (freFlag === true) {
			message.error(this.setMessage('DoctorAdviceListPageFreq', 'descripts'), this.state.userData && this.state.userData.messageTime)
			return
		}
		if (recFlag === true) {
			message.error(this.setMessage('DoctorAdviceListPageNoLoc', 'descripts'), this.state.userData && this.state.userData.messageTime)
			return
		}
		for (var i = 0; i < ids.length; i++) {
			this.state.dataSource[ids[0] - 1]['identity'] = ''
			if (i > 0) {//开始分组，子医嘱与主医嘱数据一致
				this.state.dataSource[ids[i] - 1]['identity'] = '1';
				this.state.dataSource[ids[i] - 1]['ordDurQty'] = this.state.dataSource[ids[0] - 1].ordDurQty
				this.state.dataSource[ids[i] - 1]['ordFreqID'] = this.state.dataSource[ids[0] - 1].ordFreqID
				this.state.dataSource[ids[i] - 1]['frequence'] = this.state.dataSource[ids[0] - 1].frequence//频次系数保持一致
				this.state.dataSource[ids[i] - 1]['ordFrequenceDesc'] = this.state.dataSource[ids[0] - 1].ordFrequenceDesc
				this.state.dataSource[ids[i] - 1]['ordFreqDesc'] = this.state.dataSource[ids[0] - 1].ordFreqDesc
				this.state.dataSource[ids[i] - 1]['cycleDays'] = this.state.dataSource[ids[0] - 1].cycleDays
				this.state.dataSource[ids[i] - 1]['frequency'] = this.state.dataSource[ids[0] - 1].frequency
				this.state.dataSource[ids[i] - 1]['intervalDays'] = this.state.dataSource[ids[0] - 1].intervalDays
				this.state.dataSource[ids[i] - 1]['ordUsageDesc'] = this.state.dataSource[ids[0] - 1].ordUsageDesc
				this.state.dataSource[ids[i] - 1]['ordUsageID'] = this.state.dataSource[ids[0] - 1].ordUsageID
				this.state.dataSource[ids[i] - 1]['ordStageID'] = this.state.dataSource[ids[0] - 1].ordStageID
				this.state.dataSource[ids[i] - 1]['ordbodyPartID'] = this.state.dataSource[ids[0] - 1].ordbodyPartID
				this.state.dataSource[ids[i] - 1]['ordDurationDesc'] = this.state.dataSource[ids[0] - 1].ordDurationDesc
				this.state.dataSource[ids[i] - 1]['ordDurationID'] = this.state.dataSource[ids[0] - 1].ordDurationID
				this.state.dataSource[ids[i] - 1]['ordPriorityDesc'] = this.state.dataSource[ids[0] - 1].ordPriorityDesc
				this.state.dataSource[ids[i] - 1]['ordPriorityID'] = this.state.dataSource[ids[0] - 1].ordPriorityID
				this.state.dataSource[ids[i] - 1]['ordEMFlag'] = this.state.dataSource[ids[0] - 1].ordEMFlag
				// this.state.dataSource[ids[i] - 1]['ordRecLocDesc'] = this.state.dataSource[ids[0] - 1].ordRecLocDesc
				// this.state.dataSource[ids[i] - 1]['ordRecLocID'] = this.state.dataSource[ids[0] - 1].ordRecLocID // 分组不改变执行科室
				this.state.dataSource[ids[i] - 1]['ordLinkSeqNo'] = this.state.dataSource[ids[0] - 1].tabIndex
			}
			// this.setState({})
			this.setState({ ids: [], cannelStatus: false, cannelIDs: false })
		}
	}

	//取消分组
	handleCannelGroup() {
		var { dataSource, ids } = this.state;
		for (var i = 0; i < dataSource.length; i++) {
			this.state.dataSource[i]['ordLinkStatus'] = ''//清空所有分组
			if (!Util.isEmpty(ids)) {
				for (var j = 0; j < ids.length; j++) {
					if (ids[j] == dataSource[i].tabIndex && Util.isEmpty(dataSource[i].ordID)) {
						this.state.dataSource[i]['identity'] = ''
						this.state.dataSource[i]['ordLinkSeqNo'] = ''
						this.state.dataSource[i]['checkIdenty'] = ''
						this.state.dataSource[i]['mainIndexId'] = ''
					}
				}
				this.setState({
					// groupStatus: false,
					// cannelIDs:false,
					// cannelStatus: true,
					ids: []
				})
			} else {
				if (Util.isEmpty(dataSource[i].ordID)) {
					if (this.state.linkValue) {
						this.state.dataSource[this.state.inputIndex]['ordLinkStatus'] = false
						this.state.linkValue = undefined
					} else {
						this.state.dataSource[i]['identity'] = ''
						this.state.dataSource[i]['ordLinkSeqNo'] = ''
						this.state.dataSource[i]['checkIdenty'] = ''
						this.state.dataSource[i]['mainIndexId'] = ''
					}
				}
				this.setState({
					groupStatus: false,
					cannelIDs: false,
					cannelStatus: true,
					ids: []
				})
			}
		}
	}

	onSelectChange(ids, useData) {
		// var { dataSource, chooseData } = this.state;
		// console.dir(dataSource)
		// var choseData = []
		// if (!Util.isEmpty(useData)) {
		//     for (var i = 0; i < dataSource.length; i++) {
		//         for (var j = 0; j < useData.length; j++) {
		//             if (useData[j].ordSeqNo == dataSource[i].ordLinkSeqNo || useData[j].ordSeqNo == dataSource[i].ordSeqNo) {
		//                 // this.state.ids = dataSource[i].ordID
		//                 this.state.ids.push(dataSource[i].ordID)
		//                 choseData.push(dataSource[i])
		//             }
		//         }
		//     }
		// }else{
		//     this.setState({ids:ids})
		// }
		let chargeordIDinfo = [];

		if (useData.length < 1) {
			this.state.dataSource.map((item, i) => {
				if (item.ordID) {
					chargeordIDinfo.push(item.ordID)

				}
			})

		} else {
			useData.map((item, i) => {
				if (item.ordID) {
					chargeordIDinfo.push(item.ordID)

				}
			})
		}

		this.setState({
			// ids: ids,
			useData: useData,
			ordMessage: '',
			chargeordIDinfo: chargeordIDinfo,
		})

	}

	onSelectInvert(data, flag) {
		console.dir(data)
		console.dir(flag)
	}

	//根据正选和反选，向对应数据增加一个标识，处理反选下拉依旧置灰问题
	onSelect(data, flag) {
		var { dataSource, ids, useData } = this.state;
		var code = []
		var sourceData = []
		var newCode = []
		this.state.selectData.push(data)
		if (flag) {
			data['checkIdenty'] = '2'
		} else {
			data['checkIdenty'] = '1'
		}
		//当第一次点击，选中关联数据，并将checkStatus赋值为true，用于后面反选数据
		if (Util.isEmpty(data.checkStatus) || data.checkStatus == false || flag == true) {
			for (var i = 0; i < dataSource.length; i++) {
				if ((!Util.isEmpty(data.ordSeqNo) && data.ordSeqNo == dataSource[i].ordSeqNo) || (!Util.isEmpty(data.ordSeqNo) && data.ordSeqNo == dataSource[i].ordLinkSeqNo)) {
					// data['checkStatus'] = true
					this.state.dataSource[i]['checkStatus'] = true
					this.state.ids.push(dataSource[i].ordID || dataSource[i].tabIndex)
				} else if (Util.isEmpty(data.ordMedItemID) && Util.isEmpty(data.medID)) {
					this.state.dataSource[data.tabIndex - 1]['checkStatus'] = true
					this.state.ids.push(data.ordID || data.tabIndex)
				}
			}
		} else if (data.checkStatus == true) {//取消多个选中后，需要点击两次选中问题
			data.checkStatus = false
			//先将数据过滤，确保当前所有的数据为勾选中的数据
			if (!Util.isEmpty(useData)) {
				for (var i = 0; i < useData.length; i++) {
					if (Util.isEmpty(useData[i].ordMedItemID) && Util.isEmpty(useData[i].medID)) {
						sourceData.push(useData[i])
					} else {
						for (var j = 0; j < ids.length; j++) {
							if ((useData[i].ordID || useData[i].tabIndex) == ids[j]) {
								sourceData.push(useData[i])
							}
						}
					}
				}
				for (var i = 0; i < sourceData.length; i++) {
					if (Util.isEmpty(sourceData[i].ordMedItemID) && Util.isEmpty(sourceData[i].medID) && !Util.isEmpty(sourceData[i].ordMedItemDesc)) {
						for (var j = 0; j < ids.length; j++) {
							if (data.tabIndex !== ids[j]) {
								newCode.push(ids[j])
							}
						}
						this.setState({ ids: newCode })
					} else {
						if ((data.ordID !== sourceData[i].ordID) || (data.tabIndex !== sourceData[i].tabIndex)) {
							if (data.ordSeqNo == sourceData[i].ordLinkSeqNo) {
								this.state.ids = []
								this.setState({})
							} else {
								code.push(sourceData[i].ordID || sourceData[i].tabIndex)
								this.setState({ ids: code })
							}
						} else if (sourceData.length == 1) {
							this.state.ids = []
						}
					}
				}
			} else {
				this.state.ids = []
			}
		}
		this.setState({})
	}

	onSelectAll(flag, selectedRows, changeRows) {
		this.state.selectData.push(changeRows)
		for (var i = 0; i < changeRows.length; i++) {
			if (flag) {
				changeRows[i]['checkIdenty'] = '2'
				changeRows[i]['checkStatus'] = true
				this.state.ids.push((changeRows[i].ordID || changeRows[i].tabIndex))
			} else {
				changeRows[i]['checkIdenty'] = '1'
				changeRows[i]['checkStatus'] = false
				this.state.ids = []
			}
		}
		this.setState({})
	}

	doubleElement() {
		this.setState({
			saveStatus: false
		})
	}

	/**
	 * @ByYQL: 保存时展示公共组件加载等待框
	 * Create 2021-12-20
	 */
	// onLoadModalRef = (ref) => {
	// 	this.childLoadExamine = ref;
	// };

	// 医嘱保存
	handleOrdSave = (e) => {
		const { dataSource, prescriptionMaxDate } = this.state;
		var temp = []
		// var newArray = []
		//将默认数据过滤掉，只传新添加的数据
		for (var i = 0; i < dataSource.length; i++) {
			if (Util.isEmpty(dataSource[i].ordID) && !Util.isEmpty(dataSource[i].medID)) {
				temp.push(dataSource[i])
			}
		}
		for (var i = 0; i < temp.length; i++) {
			let index = temp[i] && temp[i].ordSeqNo && Number(temp[i].ordSeqNo) > 0 ? Number(temp[i].ordSeqNo) - 1 : Number(temp[i].ordSeqNo); //增加定位行号 add by liangjiaquan 2022.2.28
			if (temp[i].ordTypeCode == 'D') {//医嘱为药品时
				if (Util.isEmpty(temp[i].ordFreqID)) { // 频次
					this['ordFreqID' + index] && this['ordFreqID' + index].focus();       //增加定位行号 add by liangjiaquan 2022.2.28
					message.error(this.setMessage('DoctorAdviceListPageFreNo', 'descripts'), this.state.userData && this.state.userData.messageTime);
					return
				}
				if (Util.isEmpty(temp[i].ordUsageID)) { // 用法
					this['ordUsageID' + index] && this['ordUsageID' + index].focus();      //增加定位行号 add by liangjiaquan 2022.2.28
					message.error('药品用法不能为空', this.state.userData && this.state.userData.messageTime);
					return
				}
				if (Util.isEmpty(temp[i].ordDose)) { // 剂量
					this['ordDose' + index] && this['ordDose' + index].focus();        //增加定位行号 add by liangjiaquan 2022.2.28
					message.error(this.setMessage('DoctorAdviceListPageDose', 'descripts'), this.state.userData && this.state.userData.messageTime);
					return
				}
				if (Util.isEmpty(temp[i].ordDoseUnitID)) { // 剂量单位
					this['ordDoseUnitID' + index] && this['ordDoseUnitID' + index].focus();        //增加定位行号 add by liangjiaquan 2022.2.28
					message.error(this.setMessage('DoctorAdviceListPageDUnit', 'descripts'), this.state.userData && this.state.userData.messageTime);
					return
				}
				if (!Util.isEmpty(temp[i].ordSkinTestFlagValue) && temp[i].ordSkinTestFlagValue == 'Y' && Util.isEmpty(temp[i].ordSkinTestWayID)) { // 皮试备注
					this['ordSkinTestWayID' + index] && this['ordSkinTestWayID' + index].focus();      //增加定位行号 add by liangjiaquan 2022.2.28
					message.error(this.setMessage('DoctorAdviceListPageSkin', 'descripts'), this.state.userData && this.state.userData.messageTime);
					return
				}
			}
		}
		if (prescriptionMaxDate) {
			let maxMedTableData = []; // 最大用药数据
			for (let i = 0; i < dataSource.length; i++) {
				let data = dataSource[i];
				let currentDurDay = this.handleCalculateOrdDurQty(data, this.state.isCalculation == 'N' ? data.ordQty : (data.qtyStatus == '1' ? data.ordQty : (data.medID ?
					(data.defaultStatus == true ? data.ordQty : data.newQty) : undefined)), 'ordDurQty*duraFactor'); // ordDurQty - 疗程 | duraFactor - 疗程单位
				if (currentDurDay > parseInt(prescriptionMaxDate)) {
					maxMedTableData.push({ ...dataSource[i], currentDurDay });
				}
			}
			if (maxMedTableData && maxMedTableData.length > 0) {
				this.maxMedRef && this.maxMedRef.modifyVisible(true, { tableData: maxMedTableData });
			} else {
				this.insuTypeCodeFlagFun(e);
			}
		} else {
			this.insuTypeCodeFlagFun(e);
		}
	}

	/**
	 * @ByYQL: 事中审核,根据险种类型insuTypeCode是否有值
	 * 决定是否需要走事中审核流程
	 * 原流程为点击按钮调用loadColdChain
	 * Create 2022-1-4
	 */
	insuTypeCodeFlagFun = (clickSource) => {
		var { titleData, dataSource } = this.state;
		this.setState({ saveStatus: true });
		var saveOrder = []  //已保存医嘱列表
		var unSaveOrder = []    //未保存医嘱列表
		for (var i = 0; i < dataSource.length; i++) {
			if (Util.isEmpty(dataSource[i].ordID) && !Util.isEmpty(dataSource[i].medID)) {
				unSaveOrder.push(
					{
						ordSeqNo: dataSource[i].ordSeqNo,
						ordDate: dataSource[i].ordDate,
						ordTime: dataSource[i].ordTime,
						ordStartDate: dataSource[i].ordStartDate,
						ordStartTime: dataSource[i].ordStartTime,
						ordPriorityID: dataSource[i].ordPriorityID,
						ordAdmReasonID: dataSource[i].ordAdmReasonID,
						medID: dataSource[i].medID,
						ordQty: dataSource[i].ordQty,
						ordQtyUomID: dataSource[i].ordQtyUomID,
						ordRecLocID: dataSource[i].ordRecLocID
					})
			} else if (!Util.isEmpty(dataSource[i].ordID) && Util.isEmpty(dataSource[i].medID)) {
				saveOrder.push(
					{
						id: dataSource[i].ordID
					}
				)
			}
		}
		if (titleData?.insuTypeCode && titleData?.insuTypeCode != "") {
			// 发起事中审核
			var params = {
				params: [{
					admID: this.state.patientData ? this.state.patientData.admID : '',
					saveOrder: saveOrder,
					unSaveOrder: unSaveOrder
				}
				]
			}
			$http.post('urlDeault', this, {
				code: "pr02904",
				data: params,
				success: function (res) {
					if (res.errorCode == '0') {
						this.loadColdChain(clickSource)
					} else {
						//审核异常弹框
						this.setState({
							verifyModalInfo: res.result,
							verifyModalShow: true
						})
					}
				}
			});
		} else {
			this.loadColdChain(clickSource)
		}
	}

	//事中审核模态框函数-遵从、不遵从
	followVerifyFun(onPress) {
		var params = {
			params: [{
				insuMessageId: this.state.verifyModalInfo.id,
				confirmType: onPress,
				confirmReason: this.state.textAreaInput
			}]
		}
		$http.post('urlDeault', this, {
			code: "pr02903",
			data: params,
			success: function (res) {
				if (res.errorCode == '0') {
				}
			}
		});

		this.setState({
			verifyModalShow: false
		}, function () {
			this.loadColdChain()
		})
	}

	//事中审核模态框输入框内容监听
	textAreaInfo(e) {
		this.setState({
			textAreaInput: e.target.value
		})
	}

	//获取冷链标识
	loadColdChain(clickSource) {
		var { dataSource } = this.state;
		var that = this;
		var medData = []
		for (var i = 0; i < dataSource.length; i++) {
			if (Util.isEmpty(dataSource[i].ordID) && !Util.isEmpty(dataSource[i].medID)) {
				medData.push(dataSource[i].medID)
			}
		}

		var params = {
			params: [{
				medData: medData
			}]
		}
		$http.post('urlDeault', this, {
			code: "03050243",
			data: params,
			success: function (res) {
				if (res.errorCode == '0') {
					var flag = res.result;
					if (flag == 'Y') {
						confirm({
							title: '确认冷链医嘱',
							content: '含有需冷链运输药品，快递费80元以上，请告知患者，是否确认医嘱？',
							okText: that.state.userData.language == 'EN' ? 'YES' : '是',
							cancelText: that.state.userData.language == 'EN' ? 'NO' : '否',
							onOk() {
								that.checkPoisonMsg(clickSource)
							},
							onCancel() {
								console.log('Cancel');
								this.setState({ saveStatus: false });
							},
						});
					} else {
						that.checkPoisonMsg(clickSource)
					}
				}
			}
		});
	}

	//保存先校验毒麻精一类
	checkPoisonMsg(clickSource) {
		var { dataSource } = this.state;
		var temp = []
		var examList = []
		for (var i = 0; i < dataSource.length; i++) {
			if (Util.isEmpty(dataSource[i].ordID) && !Util.isEmpty(dataSource[i].medID)) {
				temp.push(dataSource[i].medID)
				if (dataSource[i].ordTypeCode == 'E') {//获取检查类，单独抽出数据，用于弹框
					examList.push(dataSource[i])
				}
			}
		}
		if (!Util.isEmpty(examList)) {
			// this.setState({
			//     isShowExamlistModal: true,
			//     examList: examList
			// })
			this.loadAnestheticData(clickSource)
		} else {
			this.loadAnestheticData(clickSource)
		}
	}

	//获取麻药弹框
	loadAnestheticData(clickSource) {
		var { dataSource, helpMediCineFlag } = this.state;
		var temp = []
		this.setState({
			saveStatus: true
		})
		for (var i = 0; i < dataSource.length; i++) {
			if (Util.isEmpty(dataSource[i].ordID) && !Util.isEmpty(dataSource[i].medID)) {
				temp.push(dataSource[i].medID)
			}
		}
		var params = {
			params: [{
				patID: this.state.patientData.patID,
				medID: temp
			}]
		}
		$http.post('urlDeault', this, {
			code: "03050140",
			data: params,
			success: function (res) {
				if (res.errorCode == '0') {
					if (!Util.isEmpty(res.result) || helpMediCineFlag === '1') {
						this.setState({
							isShowPosionStatusModal: true,
							saveStatus: false,
							posionStatus: helpMediCineFlag === '1' ? temp : res.result, // helpMediCineFlag为1则需要填写代开药人的身份证等信息，跟毒麻药一样的逻辑
						})
					} else {
						this.insertDoctorAdvice(clickSource)
					}
				}
			}
		});
	}

	saveCheckParts(data, source) {
		var { dataSource } = this.state;
		//将弹框的两个change数据重新
		if (!Util.isEmpty(source) && !Util.isEmpty(dataSource)) {
			for (var i = 0; i < dataSource.length; i++) {
				for (var j = 0; j < source.length; j++) {
					if (dataSource[i].tabIndex == source[j].tabIndex) {
						this.state.dataSource[i]['ordEMFlag'] = source[j].ordEMFlag,
							this.state.dataSource[i]['ordRecLocID'] = source[j].ordRecLocID
					}
				}
			}
		}
		this.setState({
			appMessage: data
		}, () => {
			this.hideModal('isShowExamlistModal')
			this.loadAnestheticData()
		})
	}

	submitPostionMsg(IDCardNo, agentName, agentIDCardNo, agentCredTypeID) {
		var { dataSource, posionStatus } = this.state;
		for (var i = 0; i < dataSource.length; i++) {
			for (var j = 0; j < posionStatus.length; j++) {
				if (dataSource[i].medID == posionStatus[j]) {
					this.state.dataSource[i]['IDCardNo'] = IDCardNo,
						this.state.dataSource[i]['agentName'] = agentName,
						this.state.dataSource[i]['agentIDCardNo'] = agentIDCardNo
					this.state.dataSource[i]['agentCredTypeID'] = agentCredTypeID
				}
			}
		}
		this.setState({}, () => {
			this.hideModal('isShowPosionStatusModal')
			this.insertDoctorAdvice()
		})
	}

	//插入医嘱
	insertDoctorAdvice(clickSource) {
		let { dataSource, ordDocID, preAndInProcess, titleData, preRemindFlag, helpMediCineFlag, recipeType, diagActive, diagTabData,PASS4Flag } = this.state;
		this.setState({
			saveStatus: true
		})
		var temp = []
		// var newArray = []
		//将默认数据过滤掉，只传新添加的数据
		for (var i = 0; i < dataSource.length; i++) {
			if (Util.isEmpty(dataSource[i].ordID) && !Util.isEmpty(dataSource[i].medID)) {
				temp.push(dataSource[i])
			}
			// if (Util.isEmpty(dataSource[i].identity) && this.state.groupStatus) {
			//     this.state.dataSource[i].ordLinkSeqNo = ids[0] + 1
			// }
		}

		// 当前诊断数据
		let currentDiagRecord = diagActive && diagTabData && Array.isArray(diagTabData) && diagTabData.length > 0 ? diagTabData[diagActive - 1] : {};

		//过滤多余的数据
		var tempData = []
		for (var i = 0; i < temp.length; i++) {
			let extvalue = [{
				code: 'eyePart',
				value: temp[i].eyePartID,
				refDescripts: 'eyePartDesc',
			}, {
				code: 'Diag', // 插入医嘱时绑定当前诊断
				value: currentDiagRecord?.id || '',
				refDescripts: currentDiagRecord?.diagCode || currentDiagRecord?.ICDCode || '',
			}];
			if (temp[i]?.antibioticFlag === 'Y') {
				// 抗菌药物用药目的
				let antibioticRecordData = temp[i]?.antibioticRecordData || {};
				extvalue.push({
					code: 'AntibioticIntent',
					value: antibioticRecordData && Object.prototype.toString.call(antibioticRecordData) === '[object Object]' ? JSON.stringify(antibioticRecordData) : '',
					refDescripts: '抗菌药物用药目的',
				})
			}
			tempData.push({
				...temp[i],
				ordDocID, // 开单医生
				// ordSkinTestFlag: temp[i].ordSkinTestFlagValue,
				ordSkinTestFlag: temp[i].ordSkinTestFlagValue == 'N' ? temp[i].ordSkinTestFlagValue : temp[i].ordSkinTestFlag,
				ordSkinTestWayID: temp[i].ordSkinTestFlag == 'N' && temp[i].ordSkinTestFlagValue == 'N' ? '' : temp[i].ordSkinTestWayID,
				oPer: this.state.operationID,
				ordbodyPart: temp[i].ordbodyPartID,
				// ordQty: temp[i].ordNewQty ? temp[i].ordNewQty : temp[i].newQty,
				// ordQty: temp[i].defaultStatus == true ? temp[i].ordQty : (temp[i].ordNewQty ? temp[i].ordNewQty : temp[i].newQty),
				ordQty: (temp[i].ordNewQty ? temp[i].ordNewQty : (temp[i].defaultStatus == true ? temp[i].ordQty : temp[i].newQty)),
				extvalue,
				skinTestWayList: undefined,
				admReasonList: undefined,
				doseUnitList: undefined,
				durationList: undefined,
				frequenceList: undefined,
				priorityExtList: undefined,
				priorityList: undefined,
				qtyUnitList: undefined,
				recLocList: undefined,
				specList: undefined,
				usageList: undefined,
				causeList: undefined,
				stageList: undefined,
				infuseSpeedList: undefined,
				degreesList: undefined,
				eyePartList: undefined,
				bodyPartList: undefined,

				// unableToEdit: undefined
			})
		}

		for (var i = 0; i < tempData.length; i++) {
			if ((Util.isEmpty(tempData[i].ordSkinTestFlag) || tempData[i].ordSkinTestFlag == 'N') && !Util.isEmpty(tempData[i].ordSkinTestWayID)) {
				this.setState({
					saveStatus: false
				})
				message.error(this.setMessage('DoctorAdviceListPagechosen', 'descripts'), this.state.userData && this.state.userData.messageTime)
				return
			}
		}

		var params = {
			params: [
				{
					admID: this.props.patStatus == '1' ? (this.state.patientData ? this.state.patientData.admID : '') :
						((this.state.patientData ? this.state.patientData.admID : '')),
					locID: this.state.userData.locID,
					docID: this.state.userData.userID,
					userID: this.state.userData.userID,
					hospID: this.state.userData.hospID,
					orders: tempData,
					appMessage: this.state.appMessage,
					ordSpecID: this.state.ordSpecID,
					medType: 'WM',
					orderReSorce: 'Doctor',
					helpMediCineFlag, // 代开药标志
					recipeType, // 保内保外处方标志【1为保内，2为保外，默认为1】
				}
			]
		};

		let that = this;
        let containerNames = sessionStorage.getItem('CAcontainerName');
        // 触发CA签名
        SOFE_SignPKCS7Message(0, containerNames, base64Encode(JSON.stringify(params))).then(function(res){
            params.params[0].PKCSData = {
                "toSign":JSON.stringify(params),
                "signedData":res
            };
            // that.handleDocumentReview(params); // 医保智能审核
            $http.post('urlDeault', that, {
                code: "03050001",
                data: params,
                success: function (res) {
                    if (res.errorCode == '0') {
                        if (clickSource && 'type' in clickSource && clickSource.type === 'callback') { // 切换诊断
                            'fn' in clickSource && clickSource.fn && clickSource?.fn();
                        } else {
                            that.loadData(clickSource || '', 1)
                        }
                        that.loadPrescriptionFee();
                        // 门诊才调用事前提醒
                        if ((preRemindFlag === 'Y' && that.props.patStatus != '1') || (preAndInProcess === 'Y' && +titleData.patAdmReasonID !== 1)) {
                            that.handlePreAndInProcess(res?.ordIDs || ''); // 事前事中 | 事前提醒
                        }
                        setTimeout(
                            that.setState({
                                groupStatus: false,
                                cannelIDs: false,
                                saveStatus: false,
                                confirmMedVisible: false,
                                linkValue: undefined,//保存成功后，将输入的关联号清除
                                showColumns: false,
                                appMessage: []
                            }, () => {
                                if (!Util.isEmpty(res.cureAppIDs)) {
                                    confirm({
                                        title: '治疗申请单',
                                        content: '是否立即录入治疗申请单？',
                                        okText: '是',
                                        cancelText: '否',
                                        onOk() {
                                            that.setState({
                                                isShowEnterTreatmentModal: true,
                                                cureAppIDs: res.cureAppIDs
                                            })
                                        },
                                        onCancel() {
                                            confirm({
                                                title: '预约治疗',
                                                content: '是否立即预约治疗？',
                                                okText: '是',
                                                cancelText: '否',
                                                onOk() {
                                                    that.setState({
                                                        isShowConfirmApplicationModal: true,
                                                        cureAppIDs: res.cureAppIDs
                                                    })
                                                },
                                                onCancel() {
                                                    that.loadData()
                                                },
                                            });
                                        },
                                    });
                                } else {
                                    message.success(that.setMessage('DoctorAdviceListPageInsertSuccess', 'descripts'), that.state.userData && that.state.userData.messageTime)
                                }
                            }), 1000)
                        if (that.props.patStatus == '1') {
                            var { loadData } = that.props;
                            loadData && loadData();
                        }
                        // 合理用药
                        PASS4Flag=== 'Y' && that.handleRationalUse();
                    } else {
                        setTimeout(
                            that.setState({
                                saveStatus: false,
                                showColumns: false
                            }), 1000)
                        // 后台验证不为空，前端处理光标跳转的位置 - 部位校验 add by liangjiaquan 2022.2.28
                        if (res && res.requireIndexCol && res.requireIndex && Array.isArray(res.requireIndex) && res.requireIndex.length > 0) {
                            // 获取当前错误提醒所在行
                            let colIndex = res.requireIndex[0] && Number(res.requireIndex[0]) > 0 ? res.requireIndex[0] - 1 : res.requireIndex[0];
                            setTimeout(() => {
                                that[res.requireIndexCol + colIndex] && that[res.requireIndexCol + colIndex].focus();
                            }, 300)
                        }
                    }
                }
            });
        });
	};

	// 事前事中、事前提醒
	handlePreAndInProcess = async (orderDetailArr) => {
		try {
			if (!orderDetailArr) {
				message.error('事前事中调用异常！');
				return;
			};
			const { preAndInProcess, titleData, preRemindFlag } = this.state;
			let data = {
				params: [{
					orderDetailArr,
					preAndInProcess, // 事前事中
					preRemindFlag, // 事前提醒
				}]
			}
			let res = await React.$asyncPost(this, '05110023', data);
			if (preAndInProcess === 'Y' && +titleData.patAdmReasonID !== 1) { // 事前事中
				let dllres = await React.$dllPost(res?.dllFuncName || 'PlatformDirectConnect', res?.result || {}, res?.dllPath || 'INSUNew/PTMedInsuInterface.dll', res?.dllClassName || 'PTMedInsuInterface.InsuBusiness');
				if (dllres?.errorCode != '0') {
					message.error(dllres?.errorMessage || '调用失败');
				}
			}
			if (preRemindFlag === 'Y' && this.props.patStatus != '1') { // 事前提醒 - 门诊才需要
				this.getPriorReviewSign(this.handleReminderInAdvance, res?.preRemindData || '');
			}
		} catch (error) {
			console.log('6138', error);
		}
	}

	// 医保智能审核
	handleDocumentReview = (params) => {
		$http.post('urlDeault', this, {
			code: "03050278",
			data: params,
			success: function (res) {
				if (res.errorCode == '0') {
					if (res) {
						console.log(res)
					}
				}
			}
		});
	}

	//保存治疗申请单
	onSubmitTreatment(data) {
		var that = this;
		var source = []
		if (!Util.isEmpty(data)) {
			for (var i = 0; i < data.length; i++) {
				source.push({
					cureAppID: data[i].ID,
					curePlan: data[i].curePlan,
					cureNote: data[i].cureNote
				})
			}
		}
		var params = {
			params: [{
				userID: this.state.userData.userID,
				cureAppData: source
			}]
		}
		$http.post('urlDeault', this, {
			code: "03050189",
			data: params,
			success: function (res) {
				if (res.errorCode == '0') {
					this.hideModal('isShowEnterTreatmentModal')
					confirm({
						title: '预约治疗',
						content: '是否立即预约治疗？',
						okText: '是',
						cancelText: '否',
						onOk() {
							that.setState({
								isShowConfirmApplicationModal: true,
								admID: res.admID,
								cureConAppID: res.cureAppID
							})
						},
						onCancel() {
							that.loadData()
						},
					});
				}
			}
		});
	}

	//添加处方信息
	addMechansim(data) {
		var { dataSource } = this.state;
		//加入添加限制，只有录入了医嘱信息之后才能再次添加
		for (var i = 0; i < dataSource.length; i++) {
			if (Util.isEmpty(dataSource[i].medID) && Util.isEmpty(dataSource[i].ordMedItemID)) {
				message.error(this.setMessage('DoctorAdviceListPageAddMed', 'descripts'), this.state.userData && this.state.userData.messageTime)
				return
			}
		}
		this.state.dataSource.push({ tabIndex: this.state.dataSource.length + 1 });
		this.setState({
			groupStatus: false,
			cannelIDs: false,
			batchStatus: false,
			visible: true,
			changeValue: undefined,
			indexTable: this.state.dataSource.length - 1
		}, () => {
			this.handleOrdMedItemFocus();
			this.loadPriorityData()
			// this.selectFocus.current.props.onChange(this.state.dataSource.length-1)
		})
	}

	//删除历史模板数据
	loadDeleteTemplate() {
		var { ids } = this.state;
		this.setState({ saveStatus: true })
		var code = []
		for (var i = 0; i < ids.length; i++) {
			if (typeof (ids[i]) == 'string') {
				code.push(ids[i])
			}
		}
		var params = {
			params: [{
				ordID: code
			}],
		}
		$http.post('urlDeault', this, {
			code: "03050038",
			data: params,
			success: function (res) {
				if (res.errorCode == '0') {
					this.setState({
						saveStatus: false
					}, () => {
						this.deleteNewData(res.result)
					})
					message.success(this.setMessage('DoctorAdviceListPageSuccess', 'descripts'), this.state.userData && this.state.userData.messageTime)
					this.loadData('del')
					this.loadPrescriptionFee();
				} else {
					this.setState({ saveStatus: false })
				}
			}
		});
	}

	deleteNewData(data) {
		var { dataSource } = this.state;
		if (!Util.isEmpty(data)) {
			for (var i = 0; i < data.length; i++) {
				for (var j = 0; j < dataSource.length; j++) {
					if (data[i] == dataSource[j].ordID) {
						this.state.dataSource.splice(j, 1);
					}
				}
			}
		}
		this.setState({ saveStatus: false })
	}

	//删除
	delMechansim() {
		// this.loadDeleteTemplate()
		var flag = true;
		var that = this;
		var { dataSource, ids } = this.state;
		var test = []
		if (ids.length < 1) {
			message.error(this.setMessage('DoctorAdviceListPageChoose', 'descripts'), this.state.userData && this.state.userData.messageTime)
			return
		}
		for (var i = 0; i < dataSource.length; i++) {
			if (!Util.isEmpty(dataSource[i].ordID)) {
				test.push(dataSource[i])
			}
		}

		confirm({
			title: that.setMessage('DoctorAdviceListPageDel', 'descripts'),
			content: that.setMessage('DoctorAdviceListPageSure', 'descripts'),
			okText: that.state.userData.language == 'EN' ? 'Ok' : '确定',
			cancelText: that.state.userData.language == 'EN' ? 'cancel' : '取消',
			onOk() {
				for (var i = 0; i < ids.length; i++) {
					for (var j = 0; j < dataSource.length; j++) {
						if (typeof (ids[i]) == 'string' && dataSource[j].ordID == ids[i]) {
							//防止删除时，多次调用
							if (flag) {
								flag = false
								that.loadDeleteTemplate()
							}
						} else {
							if (dataSource[j].tabIndex && ids[i] == dataSource[j].tabIndex) {
								that.state.dataSource.splice(j, 1);
							}
						}
						//删除时，统一将所填关联号置空
						if (dataSource[j] && Util.isEmpty(dataSource[j].ordID)) {
							that.state.dataSource[j]['ordLinkSeqNo'] = undefined
							that.state.dataSource[j]['identity'] = undefined
							that.state.dataSource[j]['ordLinkStatus'] = false
							// that.state.dataSource[j]['tabIndex'] = dataSource[j].rowDataIndex
						}
						// test.push({
						//     tabIndex:dataSource[j].tabIndex?dataSource[j].tabIndex - that.state.ids.length:undefined,
						//     ...dataSource[j]
						// })
					}
				}
				that.setState({ ids: [], changeValue: '' }, () => {
					that.handleSaveTemporaryData()//删除临时数据后，保存临时数据
				})
			},
			onCancel() {
				console.log('Cancel');
			},
		});
	}

	handleSaveTemporaryData() {
		var sourceData = []
		var tempData = []
		var { dataSource, diagActive, diagTabData } = this.state;
		if (!Util.isEmpty(dataSource)) {
			for (var i = 0; i < dataSource.length; i++) {
				if (!Util.isEmpty(dataSource[i].medID) && Util.isEmpty(dataSource[i].ordID)) {
					sourceData.push(dataSource[i])
				}
			}
		}

		//过滤已勾选的删除数据，其余数据作为暂存
		if (!Util.isEmpty(sourceData)) {
			// 当前诊断数据
			let currentDiagRecord = diagActive && diagTabData && Array.isArray(diagTabData) && diagTabData.length > 0 ? diagTabData[diagActive - 1] : {};
			let diagExtObj = {
				code: 'Diag', // 插入医嘱时绑定当前诊断
				value: currentDiagRecord?.id || '',
				refDescripts: currentDiagRecord?.diagCode || currentDiagRecord?.ICDCode || '',
			};
			for (var i = 0; i < sourceData.length; i++) {
				if (sourceData[i].checkStatus !== true) {
					let oldExtValue = sourceData[i]?.extvalue || [];
					tempData.push({ ...sourceData[i], extvalue: [...oldExtValue, diagExtObj] })
				}
			}
		}

		var temp = []
		if (!Util.isEmpty(tempData)) {
			for (var i = 0; i < tempData.length; i++) {
				temp.push({
					...tempData[i],
					indexCode: undefined,
					skinTestWayList: undefined,
					admReasonList: undefined,
					doseUnitList: undefined,
					durationList: undefined,
					frequenceList: undefined,
					priorityExtList: undefined,
					priorityList: undefined,
					qtyUnitList: undefined,
					recLocList: undefined,
					specList: undefined,
					usageList: undefined,
					causeList: undefined,
					stageList: undefined,
					infuseSpeedList: undefined,
					bodyPartList: undefined,
				})
			}
		}

		var params = {
			params: [{
				admID: !Util.isEmpty(this.state.patientData) ? this.state.patientData.admID : '',
				locID: this.state.userData.locID,
				userID: this.state.userData.userID,
				docID: this.state.userData.userID,
				hospID: this.state.userData.hospID,
				medType: 'WM',
				orders: temp
			}]
		}
		$http.post('urlDeault', this, {
			code: "03050176",
			data: params,
			success: function (res) {
				if (res.errorCode == '0') {
				}
			}
		});
	}

	//上移
	handleUpSort() {
		var keys = this.state.ids
		var data = this.state.dataSource
		var newKeys = []
		var temp = []
		for (var i = 0; i < data.length; i++) {
			for (var j = 0; j < keys.length; j++) {
				if (data[i].ordID == keys[j]) {
					message.error(this.setMessage('DoctorAdviceListPageReSelect', 'descripts'), this.state.userData && this.state.userData.messageTime)
					return
				}
			}
			if (!Util.isEmpty(data[i].ordID)) {
				temp.push(data[i])
			}
		}
		keys = keys.sort(function (m, n) {
			if (m < n) return -1
			else if (m > n) return 1
			else return 0
		});
		for (var i = 0; i < keys.length; i++) {
			if (keys[i] - 1 === temp.length) {
				newKeys.push(keys[i])
				// continue
				message.warn(this.setMessage('DoctorAdviceListPageTop', 'descripts'), this.state.userData && this.state.userData.messageTime)
				return
			}
			// if (keys[i] == data[keys[i]-1].tabIndex) {
			var curRowData = data[keys[i] - 1]
			var curRowKey = curRowData.tabIndex
			var upRowData = data[keys[i] - 2]
			var upRowKey = upRowData.tabIndex
			upRowData.tabIndex = curRowKey
			curRowData.tabIndex = upRowKey
			// if(curRowData.ordLinkSeqNo){
			//     curRowData.ordLinkSeqNo = parseInt(curRowData.ordLinkSeqNo) + 1
			// }
			data[keys[i] - 1] = upRowData
			data[keys[i] - 2] = curRowData
			newKeys.push(keys[i] - 1)
			if (Util.isEmpty(data[keys[i] - 2].tabIndex)) {
				return
			}
		}
		// for (var i = 0; i < data.length; i++) {
		//     if (data[i].changeIndex) {
		//         this.state.dataSource[i].ordLinkSeqNo = data[i].tabIndex
		//     }
		// }
		var indexID = ''
		var indexBtn = ''
		for (var i = 0; i < data.length; i++) {

			if (data[i].moveStatus) {
				indexID = data[i].tabIndex
			} else if (data[i].identity == '') {
				indexBtn = data[i].tabIndex
			}
			// if (data[i].ordLinkStatus && indexID) {
			//     data[i].ordLinkSeqNo = indexID
			// }
		}

		for (var i = 0; i < data.length; i++) {
			if (data[i].ordLinkStatus && indexID) {
				data[i].ordLinkSeqNo = indexID
			} else if (data[i].identity && indexBtn) {
				data[i].ordLinkSeqNo = indexBtn,
					data[i]['move'] = '1'
			}
		}
		this.setState(
			{
				dataSource: data,
				ids: newKeys
			}
		)

	}

	handleDownSort() {
		var keys = this.state.ids
		var data = this.state.dataSource
		for (var i = 0; i < data.length; i++) {
			for (var j = 0; j < keys.length; j++) {
				if (data[i].ordID == keys[j]) {
					message.error(this.setMessage('DoctorAdviceListPageReSelect', 'descripts'), this.state.userData && this.state.userData.messageTime)
					return
				}
			}
		}
		var newKeys = []
		keys = keys.sort(function (m, n) {
			if (m < n) return -1
			else if (m > n) return 1
			else return 0
		});
		for (var i = keys.length - 1; i >= 0; i--) {
			if (keys[i] === data.length) {
				newKeys.push(keys[i])
				// continue
				message.warn(this.setMessage('DoctorAdviceListPageEnd', 'descripts'), this.state.userData && this.state.userData.messageTime)
				return
			}
			// var curRowData = data[keys[i]]
			// var upRowData = data[keys[i] + 1]
			// data[keys[i]] = upRowData
			// data[keys[i] + 1] = curRowData
			// newKeys.push(keys[i] + 1)
			var curRowData = data[keys[i] - 1]
			var upRowData = data[keys[i]]
			var curRowKey = curRowData.tabIndex
			var upRowKey = upRowData.tabIndex
			upRowData.tabIndex = curRowKey
			curRowData.tabIndex = upRowKey
			// if(curRowData.ordLinkSeqNo){
			//     curRowData.ordLinkSeqNo = parseInt(curRowData.ordLinkSeqNo) - 1
			// }
			data[keys[i] - 1] = upRowData
			data[keys[i]] = curRowData
			newKeys.push(keys[i] + 1)
		}

		var indexID = ''
		var indexBtn = ''
		for (var i = 0; i < data.length; i++) {

			if (data[i].moveStatus) {
				indexID = data[i].tabIndex
			} else if (data[i].identity == '') {
				indexBtn = data[i].tabIndex
			}
			// if (data[i].ordLinkStatus && indexID) {
			//     data[i].ordLinkSeqNo = indexID
			// }
		}

		for (var i = 0; i < data.length; i++) {
			if (data[i].ordLinkStatus && indexID) {
				data[i].ordLinkSeqNo = indexID
			} else if (data[i].identity && indexBtn) {
				data[i].ordLinkSeqNo = indexBtn
				data[i]['move'] = '1'
			}
		}

		this.setState(
			{
				dataSource: data,
				ids: newKeys
			}
		)
	}

	//隐藏弹出框
	hideModal(name) {
		this.setState({
			[name]: false,//将所有参数置为false
			codeModal: []
		});
	}

	hideInsuModal(data) {
		var that = this;
		var date = new Date()
		// this.state.dataSource[this.state.indexTable]['noINSUFlag'] = data[0].noINSUFlag == true ? 'N' : 'Y'
		var { insuRecord, insuData, insuStatus, insuSource, linkRoutes } = this.state;
		this.setState({
			isShowInsuMessageModal: false
		}, () => {
			var sequence = insuSource[0].sequence;
			if (!Util.isEmpty(sequence)) {
				for (var i = 0; i < sequence.length; i++) {
					if (i <= sequence.length - 1) {
						if (sequence[i] == 'ordMedItemDesc') {
							// this[`${sequence[1]}`].current.focus()
							this[`${sequence[1] + linkRoutes}`] ? this[`${sequence[1] + linkRoutes}`].focus() : ''
						}
					}
				}
			} else {
				var arrayList = []
				var sourceData = that.state.dataSource;
				for (var i = 0; i < sourceData.length; i++) {
					if (Util.isEmpty(sourceData[i].medID) && Util.isEmpty(sourceData[i].ordMedItemID) && Util.isEmpty(sourceData[i].ordID)) {
						arrayList.push(sourceData[i])
					}
				}
				if (arrayList.length < 2) {
					that.state.dataSource.push({ tabIndex: that.state.dataSource.length + 1 })
					that.ordMedItemDesc && that.ordMedItemDesc.current && that.ordMedItemDesc.current.focus()
				} else {
					that.ordMedItemDesc && that.ordMedItemDesc.current && that.ordMedItemDesc.current.focus()
				}
			}
			//双击医嘱项，根据index，渲染对应行的默认数据
			this.state.dataSource[this.state.indexTable]['ordMedItemDesc'] = insuSource[0].defaultData.ordDesc,
				this.state.dataSource[this.state.indexTable]['ordDose'] = insuSource[0].defaultData.ordDose,
				this.state.dataSource[this.state.indexTable]['ordDoseUnitID'] = insuSource[0].defaultData.ordDoseUnitID,
				// this.state.dataSource[this.state.indexTable]['ordFreqID'] = insuSource[0].defaultData.ordFrequenceID,
				this.state.dataSource[this.state.indexTable]['ordFreqID'] = insuSource[0].defaultData.ordFreqID,
				this.state.dataSource[this.state.indexTable]['defaultStatus'] = true,
				that.state.dataSource[that.state.indexTable]['ordFreqDesc'] = insuSource[0].defaultData.ordFreqDesc,
				that.state.dataSource[that.state.indexTable]['ordUsageDesc'] = insuSource[0].defaultData.ordUsageDesc,
				this.state.dataSource[this.state.indexTable]['ordUsageID'] = insuSource[0].defaultData.ordUsageID,
				this.state.dataSource[this.state.indexTable]['ordDurQty'] = insuSource[0].defaultData.ordDurQty,
				this.state.dataSource[this.state.indexTable]['ordDurationID'] = insuSource[0].defaultData.ordDurationID,
				this.state.dataSource[this.state.indexTable]['radioFlag'] = insuSource[0].defaultData.radioFlag,
				this.state.dataSource[this.state.indexTable]['noINSUFlag'] = data[0].noINSUFlag == true ? 'N' : 'Y',
				this.state.dataSource[this.state.indexTable]['ordSelectFlag'] = insuSource[0].defaultData.ordSelectFlag,
				this.state.dataSource[this.state.indexTable]['ordbodyPartID'] = insuSource[0].defaultData.ordbodyPartID,
				this.state.dataSource[this.state.indexTable]['ordbodyPartDesc'] = insuSource[0].defaultData.ordbodyPartDesc,
				this.state.dataSource[this.state.indexTable]['ordQty'] = insuSource[0].defaultData.ordQty,
				this.state.dataSource[this.state.indexTable]['medItemGrade'] = insuSource[0].defaultData.medItemGrade,
				this.state.dataSource[this.state.indexTable]['ordQtyUomID'] = insuSource[0].defaultData.ordQtyUomID,
				this.state.dataSource[this.state.indexTable]['ordPrice'] = insuSource[0].defaultData.ordPrice,
				this.state.dataSource[this.state.indexTable]['ordNewPrice'] = insuSource[0].defaultData.ordPrice,
				this.state.dataSource[this.state.indexTable]['ordSkinTestFlag'] = insuSource[0].defaultData.ordSkinTestFlag,
				this.state.dataSource[this.state.indexTable]['testFlag'] = insuSource[0].defaultData.ordSkinTestFlag,
				this.state.dataSource[this.state.indexTable]['totalPrice'] = insuSource[0].defaultData.totalPrice,
				this.state.dataSource[this.state.indexTable]['eyePartID'] = insuSource[0].defaultData.eyePartDesc,
				this.state.dataSource[this.state.indexTable]['ordInsuCat'] = insuSource[0].defaultData.ordInsuCat,
				this.state.dataSource[this.state.indexTable]['ordSkinTestWayID'] = insuSource[0].defaultData.ordSkinTestWayID,
				this.state.dataSource[this.state.indexTable]['ordRecLocID'] = insuSource[0].defaultData.ordRecLocID,
				this.state.dataSource[this.state.indexTable]['ordPriorityID'] = insuSource[0].defaultData.ordPriorityID,
				this.state.dataSource[this.state.indexTable]['ordStageID'] = insuSource[0].defaultData.ordStageID,
				this.state.dataSource[this.state.indexTable]['medDesca'] = insuSource[0].defaultData.ordDesca,
				this.state.dataSource[this.state.indexTable]['ordSkinTestUsageID'] = insuSource[0].defaultData.ordSkinTestUsageID,
				this.state.dataSource[this.state.indexTable]['ordSkinTestUsageDesc'] = insuSource[0].defaultData.ordSkinTestUsageDesc,
				this.state.dataSource[this.state.indexTable]['ordEMFlag'] = insuSource[0].defaultData.ordEMFlag,
				this.state.dataSource[this.state.indexTable]['testEMFlag'] = insuSource[0].defaultData.ordEMFlag,
				this.state.dataSource[this.state.indexTable]['ordSkinTestFlag'] = insuSource[0].defaultData.ordSkinTestFlag,
				this.state.dataSource[this.state.indexTable]['testFlag'] = insuSource[0].defaultData.ordSkinTestFlag,
				this.state.dataSource[this.state.indexTable]['ordAdmReasonID'] = insuSource[0].defaultData.ordAdmReasonID,
				this.state.dataSource[this.state.indexTable]['ordSeqNo'] = parseInt(this.state.indexTable) + 1,
				this.state.dataSource[this.state.indexTable]['ordDate'] = insuSource[0]?.defaultData?.ordDate || insuSource[0]?.defaultData?.date || moment(date).format(dayFormat),
				this.state.dataSource[this.state.indexTable]['ordTime'] = insuSource[0]?.defaultData?.ordTime || insuSource[0]?.defaultData?.time || moment(date).format(timeFormat),
				this.state.dataSource[this.state.indexTable]['ordStartDate'] = insuSource[0]?.defaultData?.ordStartDate || insuSource[0]?.defaultData?.date || moment(date).format(dayFormat),
				this.state.dataSource[this.state.indexTable]['ordStartTime'] = insuSource[0]?.defaultData?.ordStartTime || insuSource[0]?.defaultData?.time || moment(date).format(timeFormat),
				this.state.dataSource[this.state.indexTable]['ordNote'] = insuSource[0].defaultData.ordNote,
				this.state.dataSource[this.state.indexTable]['medID'] = insuStatus == 'temp' ? insuData.props.nodeId : (insuStatus == 'batch' ? insuRecord[0].medID : insuRecord.medID),
				this.state.dataSource[this.state.indexTable]['ordMedItemID'] = insuStatus == 'temp' ? insuData.props.nodeId : (insuStatus == 'batch' ? insuRecord[0].medID : insuRecord.medID),
				this.state.dataSource[this.state.indexTable]['ordTypeCode'] = insuSource[0].defaultData.ordTypeCode,
				this.state.dataSource[this.state.indexTable]['ordSpecID'] = insuSource[0].defaultData.ordSpecID,
				this.state.dataSource[this.state.indexTable]['degreesID'] = insuSource[0].defaultData.degreesID,
				this.state.dataSource[this.state.indexTable]['ordSkinTestFlagValue'] = insuSource[0].defaultData.ordSkinTestFlagValue,
				this.state.dataSource[this.state.indexTable]['ordEMFlagValue'] = insuSource[0].defaultData.ordEMFlagValue,
				this.state.dataSource[this.state.indexTable]['ordToalCountO'] = insuSource[0].defaultData.ordToalCountO,
				this.state.dataSource[this.state.indexTable]['ordToalCountI'] = insuSource[0].defaultData.ordToalCountI,
				this.state.dataSource[this.state.indexTable]['frequency'] = insuSource[0].defaultData.frequency,
				this.state.dataSource[this.state.indexTable]['cycleDays'] = insuSource[0].defaultData.cycleDays,
				this.state.dataSource[this.state.indexTable]['intervalDays'] = insuSource[0].defaultData.intervalDays,
				this.state.dataSource[this.state.indexTable]['duraFactor'] = insuSource[0].defaultData.duraFactor,
				this.state.dataSource[this.state.indexTable]['doseDenominator'] = insuSource[0].defaultData.doseDenominator,
				this.state.dataSource[this.state.indexTable]['doseMolecule'] = insuSource[0].defaultData.doseMolecule,
				this.state.dataSource[this.state.indexTable]['qtyMolecule'] = insuSource[0].defaultData.qtyMolecule,
				this.state.dataSource[this.state.indexTable]['qtyDenominator'] = insuSource[0].defaultData.qtyDenominator,
				this.state.dataSource[this.state.indexTable]['ordPriorityExtDesc'] = insuSource[0].defaultData.ordPriorityExtDesc,
				this.state.dataSource[this.state.indexTable]['ordPriorityExtID'] = insuSource[0].defaultData.ordPriorityExtID,
				that.state.dataSource[that.state.indexTable]['ordInfuseSpeed'] = insuSource[0].defaultData.ordInfuseSpeed,
				that.state.dataSource[that.state.indexTable]['ordSpeedUnitID'] = insuSource[0].defaultData.ordSpeedUnitID,
				that.state.dataSource[that.state.indexTable]['specList'] = insuSource[0].dataList.specList,
				that.state.dataSource[that.state.indexTable]['infuseSpeedList'] = insuSource[0].dataList.infuseSpeedList,
				this.state.dataSource[this.state.indexTable]['doseUnitList'] = insuSource[0].dataList.doseUnitList,
				this.state.dataSource[this.state.indexTable]['durationList'] = insuSource[0].dataList.durationList,
				that.state.dataSource[that.state.indexTable]['stageList'] = insuSource[0].dataList.stageList,
				this.state.dataSource[this.state.indexTable]['qtyUnitList'] = insuSource[0].dataList.qtyUnitList,
				this.state.dataSource[this.state.indexTable]['ordNoteList'] = insuSource[0].dataList.ordNoteList,
				this.state.dataSource[this.state.indexTable]['eyePartList'] = insuSource[0].dataList.eyePartList,
				this.state.dataSource[this.state.indexTable]['bodyPartList'] = insuSource[0].dataList.bodyPartList,
				this.state.dataSource[this.state.indexTable]['ordMessage'] = insuSource[0].defaultData.ordMessage,
				this.state.dataSource[this.state.indexTable]['recLocList'] = insuSource[0].dataList.recLocList,
				// this.state.dataSource[this.state.indexTable]['frequenceList'] = insuSource[0].dataList.frequenceList,
				this.state.dataSource[this.state.indexTable]['causeList'] = insuSource[0].dataList.causeList,
				// this.state.dataSource[this.state.indexTable]['usageList'] = insuSource[0].dataList.usageList,
				this.state.dataSource[this.state.indexTable]['skinTestWayList'] = insuSource[0].dataList.skinTestWayList,
				this.state.dataSource[this.state.indexTable]['priorityList'] = insuSource[0].dataList.priorityList,
				this.state.dataSource[this.state.indexTable]['admReasonList'] = insuSource[0].dataList.admReasonList,
				this.state.dataSource[this.state.indexTable]['degreesList'] = insuSource[0].dataList.degreesList,
				this.state.dataSource[this.state.indexTable]['priorityExtList'] = insuSource[0].dataList.priorityExtList ? insuSource[0].dataList.priorityExtList : [],
				this.state.dataSource[this.state.indexTable]['unableToEdit'] = insuSource[0].unableToEdit,
				this.state.dataSource[this.state.indexTable]['sequence'] = insuSource[0].sequence,
				this.state.dataSource[this.state.indexTable]['writtenOrderFlag'] = insuSource[0].defaultData.writtenOrderFlag, // 文字医嘱
				this.state.dataSource[this.state.indexTable]['customPrice'] = insuSource[0].defaultData.customPrice, // 自定义价格
				this.state.dataSource[this.state.indexTable]['customPriceFlag'] = insuSource[0].defaultData.customPriceFlag, // 自定义价格标志
				this.state.dataSource[this.state.indexTable]['firstBillFlag'] = insuSource[0].defaultData.firstBillFlag, // 只首次计费标志
				this.state.dataSource[this.state.indexTable]['antibioticFlag'] = insuSource[0]?.defaultData?.antibioticFlag || '', // 抗菌药物标志
				this.state.dataSource[this.state.indexTable]['antibioticRecordData'] = insuSource[0]?.defaultData?.antibioticRecordData || '', // 抗菌药物操作数据
				this.state.dataSource[this.state.indexTable]['antibioticDesc'] = insuSource[0]?.defaultData?.antibioticDesc || '', // 抗菌药物描述
				this.setState({
					tableData: insuSource[0].defaultData,
					ordMessage: insuSource[0].defaultData.ordMessage,
					doseUnitList: insuSource[0].dataList.doseUnitList,//剂量单位
					durationList: insuSource[0].dataList.durationList,//疗程单位
					qtyUnitList: insuSource[0].dataList.qtyUnitList,//数量单位
					recLocList: insuSource[0].dataList.recLocList,//接收科室
					// frequenceList: insuSource[0].dataList.frequenceList,//频次
					// usageList: insuSource[0].dataList.usageList,//用法
					skinTestWayList: insuSource[0].dataList.skinTestWayList,//皮试备注
					priorityList: insuSource[0].dataList.priorityList,//优先级
					admReasonList: insuSource[0].dataList.admReasonList,
					eyePartList: insuSource[0].dataList.eyePartList,
					ordNoteList: insuSource[0].dataList.ordNoteList,
					bodyPartList: insuSource[0].dataList.bodyPartList,
					// specList: insuSource[0].dataList.specList,//标本
					priorityExtList: insuSource[0].dataList.priorityExtList,//标本
					sequence: insuSource[0].sequence,//跳转参数
					newCode: [],
					changeValue: undefined,
					focusStatus: false
				})
			if (insuStatus == 'temp' || insuStatus == 'batch') {
				that.deleteNullData()
			}
		})
	}

	//获取引用弹框
	showCopyTextModal() {
		this.setState({
			isCopyTextModal: true
		})
	}

	//引用模板
	onCopyText(admID, ordID, concatData = [], firstConcatData = []) {
		var { nodeId, dataSource } = this.state;
		var source = []
		for (var i = 0; i < dataSource.length; i++) {
			if (Util.isEmpty(dataSource[i].ordID) && !Util.isEmpty(dataSource[i].medID)) {
				source.push(dataSource[i])
			}
		}
		var params = {
			params: [{
				admID: admID,
				groupID: this.state.userData ? this.state.userData.groupID : '',
				locID: this.state.userData ? this.state.userData.locID : '',
				userID: this.state.userData ? this.state.userData.userID : '',
				hospID: this.state.userData ? this.state.userData.hospID : '',
				indexID: source ? source.length : 0,
				ordID: ordID
			}],

		}
		$http.post('urlDeault', this, {
			code: "03050055",
			data: params,
			success: function (res) {
				if (res.errorCode == '0') {
					if (res.confirmData.length > 0 || res.errorData.length > 0) {
						/**
						 * @ByShizi: 引用历史处方时特殊药品需要弹窗提醒是否特殊医保
						 * Create 2022-03-23
						*/
						let confirmData = res.confirmData;
						for (var i = 0; i < res.data.length; i++) { // 获取错
							let defaultData = res.data[i] && 'defaultData' in res.data[i] ? res.data[i].defaultData : {};
							for (var j = 0; j < confirmData.length; j++) {
								if (defaultData.insuFlag && defaultData.insuFlag === 'Y' && confirmData[j].medID !== defaultData.medID) {
									confirmData.push({
										indexId: res.data[i].indexId,
										errorMessage: '需医保确认',
										medID: defaultData.medID,
										ordDesc: defaultData.ordDesc,
										disabled: "N"
									})
								}
								break;
							}
						}
						this.setState({//确认医嘱弹框
							isShowConfirmModal: true,
							confirmData,
							errorData: res.errorData,
							adviceDrData: res.data
						})
					} else {
						this.setState({
							dataSource: dataSource && dataSource.filter(item => {
								return Util.isEmpty(item.medID) && Util.isEmpty(item.ordMedItemID)
							}),
							confirmData: res.confirmData,
							errorData: res.errorData,
							adviceDrData: res.data,
						}, () => {
							this.confirmAdviceModal(nodeId, concatData, firstConcatData)
						})
					}
					this.hideModal('isCopyTextModal');
				} else {
					this.setState({ dynLoading: false })
				}
			},
			error: () => {
				this.setState({ dynLoading: false })
			}
		});
	}

	//添加模板
	addTemplateModal() {
		var { ids, useData } = this.state;
		if (!Util.isEmpty(ids)) {
			for (var i = 0; i < useData.length; i++) {
				// if (!Util.isEmpty(useData[i].ordID)) {
				//     message.error(this.setMessage('DoctorAdviceListPagetemplateMSg', 'descripts'))
				//     return
				// }
				if (Util.isEmpty(useData[i].medID) && Util.isEmpty(useData[i].ordMedItemID)) {
					message.error(this.setMessage('DoctorAdviceListPageEmpty', 'descripts'), this.state.userData && this.state.userData.messageTime)
					return
				}
			}
		}
		if (!Util.isEmpty(ids)) {
			this.setState({
				isAddTemplateModal: true
			})
		} else {
			message.error(this.setMessage('DoctorAdviceListPagefirst', 'descripts'), this.state.userData && this.state.userData.messageTime)
			return
		}
	}

	onAddTemplateMOdal(data, code, record) {
		var { dataSource, ids, useData } = this.state;
		this.setState({ saveStatus: true })
		var source = []
		if (!Util.isEmpty(ids)) {
			for (var i = 0; i < dataSource.length; i++) {
				for (var j = 0; j < ids.length; j++) {
					if (dataSource[i].ordID == ids[j] || dataSource[i].tabIndex == ids[j]) {
						source.push(dataSource[i])
					}
				}
			}
		}
		var tempData = []
		for (var i = 0; i < source.length; i++) {
			if (code == 1) {
				tempData.push({
					...source[i],
					ordTempletID: '',
					ordTempletDetailID: '',
					ordTempletDetailSeqNo: i,
					ordTempletDetailTemplItemTypeCode: '01',
					ordTempletDetailItemID: source[i].ordMedItemID,
					// ordTempletDetailQty: source[i].ordQty,
					ordTempletDetailQtyUnitDr: source[i].ordQtyUomID,
					bodyPart: source[i].ordbodyPartID,
					ordPrioID: source[i].ordPriorityID,//优先级
					dose: source[i].ordDose,//剂量
					doseUnitID: source[i].ordDoseUnitID,//剂量单位
					frequenceID: source[i].ordFreqID,//频次
					usageID: source[i].ordUsageID,//用法
					durQty: source[i].ordDurQty,//疗程
					durationID: source[i].ordDurationID,//疗程单位
					priorityExtID: source[i].ordPriorityExtID,//附加说明
					recLocID: source[i].ordRecLocID,//执行科室
					ordSpecID: source[i].ordSpecID,//标本
					emergencyFlag: source[i].ordEMFlag,//加急
					note: source[i].ordNote,//备注
					ordTempletDetailQty: Util.isEmpty(source[i].ordID) ? (source[i].ordNewQty ? source[i].ordNewQty : source[i].newQty) : source[i].ordQty,
					skinTestFlag: source[i].ordSkinTestFlag == 'N' ? source[i].ordSkinTestFlagValue : source[i].ordSkinTestFlag,
					skinTestWayID: source[i].ordSkinTestFlag == 'N' && source[i].ordSkinTestFlagValue == 'N' ? '' : source[i].ordSkinTestWayID,
				})
			} else {
				tempData.push({
					ordTempletID: record.ordTempletID,
					ordTempletDetailID: '',
					ordTempletDetailSeqNo: i,
					ordTempletDetailTemplItemTypeCode: '01',
					ordTempletDetailItemID: source[i].ordMedItemID,
					// ordTempletDetailQty: source[i].ordQty,
					ordTempletDetailQtyUnitDr: source[i].ordQtyUomID,
					bodyPart: source[i].ordbodyPartID,
					ordPrioID: source[i].ordPriorityID,//优先级
					dose: source[i].ordDose,//剂量
					doseUnitID: source[i].ordDoseUnitID,//剂量单位
					frequenceID: source[i].ordFreqID,//频次
					usageID: source[i].ordUsageID,//用法
					durQty: source[i].ordDurQty,//疗程
					durationID: source[i].ordDurationID,//疗程单位
					priorityExtID: source[i].ordPriorityExtID,//附加说明
					recLocID: source[i].ordRecLocID,//执行科室
					ordSpecID: source[i].ordSpecID,//标本
					emergencyFlag: source[i].ordEMFlag,//加急
					note: source[i].ordNote,//备注
					ordTempletDetailQty: Util.isEmpty(source[i].ordQty) ? (source[i].ordNewQty ? source[i].ordNewQty : source[i].newQty) : source[i].ordQty,
					skinTestFlag: source[i].ordSkinTestFlag == 'N' ? source[i].ordSkinTestFlagValue : source[i].ordSkinTestFlag,
					skinTestWayID: source[i].ordSkinTestFlag == 'N' && source[i].ordSkinTestFlagValue == 'N' ? '' : source[i].ordSkinTestWayID,
				})
			}
		}
		var params = {
			params: [{
				ordTempletID: record ? record.ordTempletID : '',
				ordTempletDesc: data.ordTempletDesc,
				ordTempletTypeID: data.ordTempletTypeID,
				ordTempletCatCode: "01",
				ordTempletAlias: data.ordTempletAlias,
				ordTempletStartDate: data.ordTempletStartDate,
				ordTempletStopDate: data.ordTempletStopDate,
				detailData: tempData
			}]
		}
		$http.post('urlS', this, {
			code: '03050012',
			data: params,
			success: function (res) {
				if (res.errorCode == '0') {
					message.success(this.setMessage('DoctorAdviceListPageAddSuccess', 'descripts'), this.state.userData && this.state.userData.messageTime)
					this.hideModal('isAddTemplateModal')
					this.loadTemplateData()
					this.setState({
						ids: [],
						saveStatus: false
					})
				}
			}
		})
	}

	//添加套餐
	addPackageModal() {
		var { ids, useData } = this.state;
		if (Util.isEmpty(ids)) {
			message.error(this.setMessage('DoctorAdviceListPageOrder', 'descripts'), this.state.userData && this.state.userData.messageTime)
			return
		}
		if (!Util.isEmpty(ids)) {
			for (var i = 0; i < useData.length; i++) {
				// if (!Util.isEmpty(useData[i].ordID)) {
				//     message.error(this.setMessage('DoctorAdviceListPageSaveMedical', 'descripts'))
				//     return
				// }
				if (Util.isEmpty(useData[i].medID) && Util.isEmpty(useData[i].ordMedItemID)) {
					message.error(this.setMessage('DoctorAdviceListPageEmpty', 'descripts'), this.state.userData && this.state.userData.messageTime)
					return
				}
			}
		}
		this.setState({
			isAddPackageModal: true
		})
	}

	onAddPackageModal(data) {
		this.setState({ saveStatus: true })
		var { dataSource, ids } = this.state;
		var source = []
		if (!Util.isEmpty(ids)) {
			for (var i = 0; i < dataSource.length; i++) {
				for (var j = 0; j < ids.length; j++) {
					if (dataSource[i].ordID == ids[j] || dataSource[i].tabIndex == ids[j]) {
						source.push({
							...dataSource[i],
							ordSkinTestFlag: dataSource[i].ordSkinTestFlag == 'N' ? dataSource[i].ordSkinTestFlagValue : dataSource[i].ordSkinTestFlag,
							ordSkinTestWayID: dataSource[i].ordSkinTestFlag == 'N' && dataSource[i].ordSkinTestFlagValue == 'N' ? '' : dataSource[i].ordSkinTestWayID,
							oPer: this.state.operationID,
							ordbodyPart: dataSource[i].ordbodyPartID,
							// ordQty: temp[i].ordNewQty ? temp[i].ordNewQty : temp[i].newQty,
							// ordQty: temp[i].defaultStatus == true ? temp[i].ordQty : (temp[i].ordNewQty ? temp[i].ordNewQty : temp[i].newQty),
							ordQty: (dataSource[i].ordNewQty ? dataSource[i].ordNewQty : (dataSource[i].defaultStatus == true ? dataSource[i].ordQty : (dataSource[i] && dataSource[i].newQty ? dataSource[i].newQty : dataSource[i].ordQty))),
							extvalue: [{
								code: 'eyePart',
								value: dataSource[i].eyePartID,
								refDescripts: 'eyePartDesc',
							}],
							skinTestWayList: undefined,
							admReasonList: undefined,
							doseUnitList: undefined,
							durationList: undefined,
							frequenceList: undefined,
							priorityExtList: undefined,
							priorityList: undefined,
							qtyUnitList: undefined,
							recLocList: undefined,
							specList: undefined,
							usageList: undefined,
							causeList: undefined,
							stageList: undefined,
							infuseSpeedList: undefined,
							degreesList: undefined,
							eyePartList: undefined,
							bodyPartList: undefined,
						})
					}
				}
			}
		}
		var params = {
			params: [{
				userID: this.state.userData.userID,
				locID: this.state.userData.locID,
				hospID: this.state.userData.hospID,
				ordSetID: data.ordSetID,
				code: data.descripts,
				descripts: data.descripts,
				alias: data.alias,
				authRangeID: data.authRangeID,
				startDate: data.startDate,
				stopDate: data.stopDate,
				orders: source
			}]
		}
		$http.post('urlDeault', this, {
			code: "03050061",
			data: params,
			success: function (res) {
				if (res.errorCode == '0') {
					// message.success('添加成功！')
					this.setState({ saveStatus: false })
					message.success(this.setMessage('DoctorAdviceListPageAddSuccess', 'descripts'), this.state.userData && this.state.userData.messageTime)
					this.hideModal('isAddPackageModal')
					this.loadLeftData()
				}
			}
		});
	}

	compareSort(arg) {
		return function (a, b) {
			return a[arg] - b[arg];
		}
	}

	handleOnSubmitAdvice(data, insuData) {
		if (insuData && insuData.length > 0) {
			this.setState({
				isShowInsuPackageModal: true,//医嘱套弹框
				insuSource: insuData,
				packageSource: data
			})
		} else {
			this.confirmAdviceModal(data)
		}
	}

	hidePackageModal(data, insuData) {
		this.setState({
			isShowInsuPackageModal: false
		}, () => {
			var { adviceDrData } = this.state;
			if (!Util.isEmpty(adviceDrData)) {
				for (var i = 0; i < adviceDrData.length; i++) {
					for (var j = 0; j < insuData.length; j++) {
						if (adviceDrData[i].defaultData.medID == insuData[j].medID) {
							adviceDrData[i].defaultData['noINSUFlag'] = (insuData[j].noINSUFlag == true ? 'N' : 'Y')
						}
					}
				}
			}
			this.confirmAdviceModal(data)
		})
	}

	//多选模板，确认错误弹框
	confirmAdviceModal(data, concatData = [], firstConcatData = []) {
		var that = this;
		var date = new Date();
		var validData = [], textData = [];
		var { adviceDrData, confirmData } = this.state;
		// console.log("adviceDrData", adviceDrData, dataSource)
		this.deleteNullData()
		var result = [];
		//取两个数组的不同数据
		for (var i = 0; i < adviceDrData.length; i++) {
			var obj = adviceDrData[i];
			var num = obj.indexId;
			var isExist = false;
			for (var j = 0; j < confirmData.length; j++) {
				var aj = confirmData[j];
				var n = aj.indexId;
				if (n == num) {
					isExist = true;
					break;
				}
			}
			if (!isExist) {
				result.push(obj);
			}
		}
		var userCode = []
		for (var i = 0; i < adviceDrData.length; i++) {
			var obj = adviceDrData[i];
			var num = obj.indexId;
			var isExist = false;
			for (var j = 0; j < data.length; j++) {
				var aj = data[j];
				var n = aj.indexId;
				if (n == num) {
					textData.push(obj)
					isExist = true;
					break;
				}
			}
			if (!isExist) {
				userCode.push(obj);
			}
		}
		// if(this.props.patStatus == '1'){
		//     validData = adviceDrData
		// }else{
		validData = result.concat(textData)
		// }
		//冒泡排序，用来处理关联排序问题
		// for (var i = 0; i < validData.length - 1; i++) {
		//     for (var j = 0; j < validData.length - 1 - i; j++) {
		//         if (validData[j].indexId > validData[j + 1].indexId) {
		//             var temp = validData[j].indexId
		//             validData[j].indexId = validData[j + 1].indexId
		//             validData[j + 1].indexId = temp
		//         }
		//     }
		// }
		validData = validData.sort(this.compareSort('indexId'));
		// console.log("validData", validData)
		for (var i = 0; i < validData.length; i++) {
			if (!Util.isEmpty(validData[i].defaultData)) {
				this.state.dataSource.push({ tabIndex: this.state.dataSource.length + 1 })
				this.state.indexArray.push({ index: this.state.dataSource.length - 1, indexId: validData[i].indexId })
				this.setState({ groupStatus: false, cannelIDs: false })
			}
		}
		var { indexArray } = this.state;
		// console.log("indexArray, that.state.dataSource", indexArray, that.state.dataSource)
		for (var i = 0; i < validData.length; i++) {
			for (var j = 0; j < indexArray.length; j++) {
				//indexArray[j].index && indexArray[j].indexId == validData[i].indexId
				if (indexArray[j].indexId == validData[i].indexId) {
					that.state.dataSource[indexArray[j].index]['indexId'] = validData[i].indexId
					if (indexArray[j - 1] && indexArray[j - 1].indexId == validData[i].mainIndexId) {
						that.state.dataSource[indexArray[j - 1].index]['identity'] = ''
					}
					if (j > 0 && !Util.isEmpty(validData[i].mainIndexId)) {
						that.state.dataSource[indexArray[i].index]['identity'] = '1'
					}
					validData[i]['newCode'] = i,
						that.state.dataSource[indexArray[j].index]['ordSetID'] = 'ordSetID' in validData[i].defaultData && validData[i].defaultData.ordSetID ? validData[i].defaultData.ordSetID : '', // 医嘱套ID
						that.state.dataSource[indexArray[j].index]['mainIndexId'] = validData[i].mainIndexId,
						// that.state.dataSource[indexArray[j].index]['ordLinkSeqNo'] = validData[i].mainIndexId,
						that.state.dataSource[indexArray[j].index]['ordMedItemDesc'] = validData[i].defaultData.ordDesc,
						that.state.dataSource[indexArray[j].index]['ordDose'] = validData[i].defaultData.ordDose,
						that.state.dataSource[indexArray[j].index]['ordDoseUnitID'] = validData[i].defaultData.ordDoseUnitID,
						// that.state.dataSource[indexArray[j].index]['ordFreqID'] = validData[i].defaultData.ordFrequenceID,
						that.state.dataSource[indexArray[j].index]['ordFreqID'] = validData[i].defaultData.ordFreqID,
						that.state.dataSource[indexArray[j].index]['ordFreqDesc'] = validData[i].defaultData.ordFreqDesc,
						that.state.dataSource[indexArray[j].index]['medItemGrade'] = validData[i].defaultData.medItemGrade,
						that.state.dataSource[indexArray[j].index]['ordInsuCat'] = validData[i].defaultData.ordInsuCat,
						// that.state.dataSource[indexArray[j].index]['ordUsageID'] = validData[i].defaultData.ordUsageID,
						that.state.dataSource[indexArray[j].index]['ordDurQty'] = validData[i].defaultData.ordDurQty,
						that.state.dataSource[indexArray[j].index]['ordDurationID'] = validData[i].defaultData.ordDurationID,
						that.state.dataSource[indexArray[j].index]['ordbodyPartID'] = validData[i].defaultData.ordbodyPartID,
						that.state.dataSource[indexArray[j].index]['ordbodyPartDesc'] = validData[i].defaultData.ordbodyPartDesc,
						that.state.dataSource[indexArray[j].index]['ordQty'] = validData[i].defaultData.ordQty,
						that.state.dataSource[indexArray[j].index]['defaultStatus'] = true,
						that.state.dataSource[indexArray[j].index]['ordQtyUomID'] = validData[i].defaultData.ordQtyUomID,
						that.state.dataSource[indexArray[j].index]['ordPrice'] = validData[i].defaultData.ordPrice,
						that.state.dataSource[indexArray[j].index]['noINSUFlag'] = validData[i].defaultData.noINSUFlag,
						that.state.dataSource[indexArray[j].index]['ordSelectFlag'] = validData[i].defaultData.ordSelectFlag,
						that.state.dataSource[indexArray[j].index]['ordNewPrice'] = validData[i].defaultData.ordPrice,
						that.state.dataSource[indexArray[j].index]['ordSkinTestWayID'] = validData[i].defaultData.ordSkinTestWayID,
						that.state.dataSource[indexArray[j].index]['ordRecLocID'] = validData[i].defaultData.ordRecLocID,
						that.state.dataSource[indexArray[j].index]['ordSkinTestUsageDesc'] = validData[i].defaultData.ordSkinTestUsageDesc,
						that.state.dataSource[indexArray[j].index]['ordSkinTestUsageID'] = validData[i].defaultData.ordSkinTestUsageID,

						that.state.dataSource[indexArray[j].index]['ordUsageDesc'] = validData[i].defaultData.ordUsageDesc,
						that.state.dataSource[indexArray[j].index]['ordUsageID'] = validData[i].defaultData.ordUsageID,

						that.state.dataSource[indexArray[j].index]['ordPriorityID'] = validData[i].defaultData.ordPriorityID,
						that.state.dataSource[indexArray[j].index]['medDesca'] = validData[i].defaultData.ordDesca,
						that.state.dataSource[indexArray[j].index]['ordAdmReasonID'] = validData[i].defaultData.ordAdmReasonID,
						that.state.dataSource[indexArray[j].index]['ordSeqNo'] = parseInt(indexArray[j].index) + 1,

						that.state.dataSource[indexArray[j].index]['ordDate'] = validData[i]?.defaultData?.ordDate || validData[i]?.defaultData?.date || moment(date).format(dayFormat),
						that.state.dataSource[indexArray[j].index]['ordTime'] = validData[i]?.defaultData?.ordTime || validData[i]?.defaultData?.time || moment(date).format(timeFormat),

						that.state.dataSource[indexArray[j].index]['ordStartDate'] = validData[i]?.defaultData?.ordStartDate || validData[i]?.defaultData?.date || moment(date).format(dayFormat),
						that.state.dataSource[indexArray[j].index]['ordStartTime'] = validData[i]?.defaultData?.ordStartTime || validData[i]?.defaultData?.time || moment(date).format(timeFormat),
						that.state.dataSource[indexArray[j].index]['ordNote'] = validData[i].defaultData.ordNote,
						that.state.dataSource[indexArray[j].index]['medID'] = validData[i].defaultData.medID,
						that.state.dataSource[indexArray[j].index]['ordTypeCode'] = validData[i].defaultData.ordTypeCode,
						that.state.dataSource[indexArray[j].index]['ordSpecID'] = validData[i].defaultData.ordSpecID,
						that.state.dataSource[indexArray[j].index]['degreesID'] = validData[i].defaultData.degreesID,
						that.state.dataSource[indexArray[j].index]['radioFlag'] = validData[i].defaultData.radioFlag,
						that.state.dataSource[indexArray[j].index]['ordSkinTestFlag'] = validData[i].defaultData.ordSkinTestFlagValue ? validData[i].defaultData.ordSkinTestFlagValue : validData[i].defaultData.ordSkinTestFlag,
						that.state.dataSource[indexArray[j].index]['testFlag'] = validData[i].defaultData.ordSkinTestFlag,
						that.state.dataSource[indexArray[j].index]['ordEMFlag'] = validData[i].defaultData.ordEMFlag,
						that.state.dataSource[indexArray[j].index]['testEMFlag'] = validData[i].defaultData.ordEMFlag,
						that.state.dataSource[indexArray[j].index]['ordToalCountO'] = validData[i].defaultData.ordToalCountO,
						that.state.dataSource[indexArray[j].index]['ordToalCountI'] = validData[i].defaultData.ordToalCountI,
						that.state.dataSource[indexArray[j].index]['frequency'] = validData[i].defaultData.frequency,
						that.state.dataSource[indexArray[j].index]['cycleDays'] = validData[i].defaultData.cycleDays,
						that.state.dataSource[indexArray[j].index]['ordStageID'] = validData[i].defaultData.ordStageID,
						that.state.dataSource[indexArray[j].index]['eyePartID'] = validData[i].defaultData.eyePartDesc,
						that.state.dataSource[indexArray[j].index]['intervalDays'] = validData[i].defaultData.intervalDays,
						that.state.dataSource[indexArray[j].index]['duraFactor'] = validData[i].defaultData.duraFactor,
						that.state.dataSource[indexArray[j].index]['doseDenominator'] = validData[i].defaultData.doseDenominator,
						that.state.dataSource[indexArray[j].index]['doseMolecule'] = validData[i].defaultData.doseMolecule,
						that.state.dataSource[indexArray[j].index]['qtyMolecule'] = validData[i].defaultData.qtyMolecule,
						that.state.dataSource[indexArray[j].index]['qtyDenominator'] = validData[i].defaultData.qtyDenominator,
						that.state.dataSource[indexArray[j].index]['ordPriorityExtID'] = validData[i].defaultData.ordPriorityExtID,
						that.state.dataSource[indexArray[j].index]['ordMessage'] = validData[i].defaultData.ordMessage,
						that.state.dataSource[indexArray[j].index]['ordMedItemID'] = validData[i].defaultData.medID,
						that.state.dataSource[indexArray[j].index]['ordEMFlagValue'] = validData[i].defaultData.ordEMFlagValue,
						that.state.dataSource[indexArray[j].index]['ordSkinTestFlagValue'] = validData[i].defaultData.ordSkinTestFlagValue,
						that.state.dataSource[indexArray[j].index]['ordPriorityExtDesc'] = validData[i].defaultData.ordPriorityExtDesc,
						that.state.dataSource[indexArray[j].index]['ordInfuseSpeed'] = validData[i].defaultData.ordInfuseSpeed,
						that.state.dataSource[indexArray[j].index]['ordSpeedUnitID'] = validData[i].defaultData.ordSpeedUnitID,
						that.state.dataSource[indexArray[j].index]['totalPrice'] = validData[i].defaultData.totalPrice,
						// that.state.dataSource[indexArray[j].index]['usageList'] = validData[i].dataList.usageList,
						that.state.dataSource[indexArray[j].index]['doseUnitList'] = validData[i].dataList.doseUnitList,
						that.state.dataSource[indexArray[j].index]['infuseSpeedList'] = validData[i].dataList.infuseSpeedList,
						that.state.dataSource[indexArray[j].index]['durationList'] = validData[i].dataList.durationList,
						that.state.dataSource[indexArray[j].index]['stageList'] = validData[i].dataList.stageList,
						that.state.dataSource[indexArray[j].index]['qtyUnitList'] = validData[i].dataList.qtyUnitList,
						that.state.dataSource[indexArray[j].index]['ordNoteList'] = validData[i].dataList.ordNoteList,
						that.state.dataSource[indexArray[j].index]['degreesList'] = validData[i].dataList.degreesList,
						that.state.dataSource[indexArray[j].index]['eyePartList'] = validData[i].dataList.eyePartList,
						that.state.dataSource[indexArray[j].index]['bodyPartList'] = validData[i].dataList.bodyPartList,
						that.state.dataSource[indexArray[j].index]['recLocList'] = validData[i].dataList.recLocList,
						// that.state.dataSource[indexArray[j].index]['frequenceList'] = validData[i].dataList.frequenceList,
						that.state.dataSource[indexArray[j].index]['skinTestWayList'] = validData[i].dataList.skinTestWayList,
						that.state.dataSource[indexArray[j].index]['priorityList'] = validData[i].dataList.priorityList,
						that.state.dataSource[indexArray[j].index]['admReasonList'] = validData[i].dataList.admReasonList,
						that.state.dataSource[indexArray[j].index]['specList'] = validData[i].dataList.specList,
						that.state.dataSource[indexArray[j].index]['causeList'] = validData[i].dataList.causeList,
						that.state.dataSource[indexArray[j].index]['priorityExtList'] = validData[i].dataList.priorityExtList ? validData[i].dataList.priorityExtList : [],
						that.state.dataSource[indexArray[j].index]['unableToEdit'] = validData[i].unableToEdit,
						that.state.dataSource[indexArray[j].index]['sequence'] = validData[i].sequence,
						that.state.dataSource[indexArray[j].index]['writtenOrderFlag'] = validData[i].defaultData.writtenOrderFlag, // 文字医嘱
						that.state.dataSource[indexArray[j].index]['customPrice'] = validData[i].defaultData.customPrice, // 自定义价格
						that.state.dataSource[indexArray[j].index]['customPriceFlag'] = validData[i].defaultData.customPriceFlag, // 自定义价格标志
						that.state.dataSource[indexArray[j].index]['firstBillFlag'] = validData[i].defaultData.firstBillFlag, // 只首次计费标志
						that.state.dataSource[indexArray[j].index]['antibioticFlag'] = validData[i]?.defaultData?.antibioticFlag || '', // 抗菌药物标志
						that.state.dataSource[indexArray[j].index]['antibioticRecordData'] = validData[i]?.defaultData?.antibioticRecordData || '', // 抗菌药物操作数据
						that.state.dataSource[indexArray[j].index]['antibioticDesc'] = validData[i]?.defaultData?.antibioticDesc || '', // 抗菌药物描述
						// that.state.usageList[indexArray[j].index] = validData[i].dataList.usageList,
						that.state.doseUnitList[indexArray[j].index] = validData[i] && validData[i].dataList.doseUnitList,
						that.state.durationList[indexArray[j].index] = validData[i] && validData[i].dataList.durationList,
						that.state.ordNoteList[indexArray[j].index] = validData[i] && validData[i].dataList.ordNoteList,
						that.state.qtyUnitList[indexArray[j].index] = validData[i] && validData[i].dataList.qtyUnitList,
						that.state.recLocList[indexArray[j].index] = validData[i] && validData[i].dataList.recLocList,
						// that.state.frequenceList[indexArray[j].index] = validData[i].dataList.frequenceList,
						that.state.skinTestWayList[indexArray[j].index] = validData[i] && validData[i].dataList.skinTestWayList,
						that.state.priorityList[indexArray[j].index] = validData[i] && validData[i].dataList.priorityList,
						that.state.admReasonList[indexArray[j].index] = validData[i] && validData[i].dataList.admReasonList,
						that.state.bodyPartList[indexArray[j].index] = validData[i] && validData[i].dataList.bodyPartList,
						that.state.specList[indexArray[j].index] = validData[i] && validData[i].dataList.specList,
						that.state.priorityExtList[indexArray[j].index] = validData[i] && validData[i].dataList.priorityExtList,
						that.state.degreesList[indexArray[j].index] = validData[i] && validData[i].dataList.degreesList,
						that.state.eyePartList[indexArray[j].index] = validData[i] && validData[i].dataList.eyePartList,
						this.setState({
							tableData: validData[i].defaultData, batchStatus: true, copyData: validData,
							indexArray: [], newCode: [], isCalculation: undefined
						})
				}
			}
		}
		if ((concatData && concatData.length > 0) || (firstConcatData && firstConcatData.length > 0)) {
			this.state.dataSource = [...firstConcatData, ...this.state.dataSource, ...concatData];
			this.setState({});
		}
		this.setState({ dynLoading: false });
		this.hideModal('isShowConfirmModal');
	}

	deleteNullData() {
		var that = this;
		var { dataSource } = this.state;
		for (var j = 0; j < dataSource.length; j++) {
			if (Util.isEmpty(dataSource[j].ordMedItemID) && Util.isEmpty(dataSource[j].medID)) {
				that.state.dataSource.splice(j, 1);
				// that.state.dataSource.filter(data => Util.isEmpty(data.medID))
			}
		}
		that.setState({})
	}

	//点击保存，回传current，渲染步骤进度
	saveDiagnosisMsg() {
		var { saveDiagnosisMsg } = this.props;
		saveDiagnosisMsg && saveDiagnosisMsg(3)
	}

	//跳转到草药录入界面
	goCMRrderSave() {
		var { hashROuter } = this.props;
		hashROuter && hashROuter(1);
	}

	handleChangeBtn(name, e) {
		this.setState({
			[name]: e.target.value
		}, () => {
			if (this.state.defaultBtn == 1) {
				this.goCMRrderSave()
			} else if (this.state.defaultBtn == 3) {
				this.goDoctorAdviceStepPage(3)
			}
		})
	}

	changeRadio(e) {
		this.setState({
			radioValue: e.target.value
		}, () => {
			this.loadTemplateData()
		})
	}

	loadModuleData() {
		// var params = {
		//     params: [{
		//         orderTemplTypeFlag: '1'
		//     }]
		// }
		// $http.post('urlS', this, {
		//     code: '03050017',
		//     data: params,
		//     success: function (res) {
		//         if (res.errorCode == '0') {
		//             this.setState({
		//                 moduleData: res.orderTemplType,
		//                 defaultTemplTypeID: res.defaultTemplTypeID
		//             }, () => {
		//                 this.loadTemplateData()
		//             })
		//         }
		//     }
		// })
		var params = {
			params: [{
				userID: this.state.userData.userID,
				locID: this.state.userData.locID,
				hospID: this.state.userData.hospID,
			}]
		}
		$http.post('urlS', this, {
			code: '03050273',
			data: params,
			success: function (res) {
				if (res.errorCode == '0') {
					var data = res.result
					var defaultTemplTypeID = ''
					if (!Util.isEmpty(data)) {
						for (var i = 0; i < data.length; i++) {
							if (data[i].default == 'Y') {
								defaultTemplTypeID = data[i].id
							}
						}
					}
					this.setState({
						moduleData: res.result,
						defaultTemplTypeID: defaultTemplTypeID
					}, () => {
						this.loadTemplateData()
					})
				}
			}
		})
	}

	//隐藏导航栏
	hideModule() {
		this.setState({
			moduleStatus: true
		})
	}

	showModule() {
		this.setState({
			moduleStatus: false
		})
	}

	//获取模板库
	showModuleData() {
		var { showModal } = this.props;
		showModal && showModal(this.state.showModal)
	}

	arrayMoveMutate = (array, from, to) => {
		array.splice(to < 0 ? array.length + to : to, 0, array.splice(from, 1)[0]);
	};

	arrayMove = (array, from, to) => {
		array = array.slice();
		this.arrayMoveMutate(array, from, to);
		return array;
	};

	onSortEnd = ({ oldIndex, newIndex }) => {
		this.setState(({ showAllColumns }) => ({
			showAllColumns: this.arrayMove(showAllColumns, oldIndex, newIndex),
		}));
	};

	commonChangeDragInput(name, e) {
		this.state.dynColumns[name - 1]['title'] = e.target.value;
		this.setState({})
	}

	changeCommonWidth(name, e) {
		var { showAllColumns } = this.state;
		for (var i = 0; i < showAllColumns.length; i++) {
			if (name == showAllColumns[i].dataIndex) {
				this.state.showAllColumns[i]['width'] = e.target.value;
			}
		}
		this.setState({})
		e.stopPropagation();
	}

	changeCommonCheckbox(name, e) {
		var { showAllColumns } = this.state;
		for (var i = 0; i < showAllColumns.length; i++) {
			if (name == showAllColumns[i].dataIndex) {
				this.state.showAllColumns[i]['hide'] = e.target.checked ? 'N' : 'Y'
			}
		}
		this.setState({})
	}

	searchColumnName(e) {
		if (e.keyCode == '13') {
			this.setState({
				positionCol: true
			})
		}
	}

	handleSaveBtn(name) {
		var params = {
			params: [{
				userID: this.state.userData.userID,
				hospID: this.state.userData.hospID,
				logonUserID: this.state.userData.userID,
				locID: this.state.userData.locID,
				saveType: name,
				datas: this.state.showAllColumns,
				admID: this.state.patientData ? this.state.patientData.admID : '',
			}]
		}
		$http.post('urlDeault', this, {
			code: "03010021",
			data: params,
			success: function (res) {
				if (res.errorCode === '0') {
					message.success(this.setMessage('DoctorAdviceListPageSaveSuccess', 'descripts'), this.state.userData && this.state.userData.messageTime)
					this.loadColumns()
					this.loadAllColumns()
				}
			}
		});
	}

	/**自备药 */
	addBringMedicineModal() {
		this.setState({
			showBringMedicineModal: true
		})
	}

	loadBringMedchine(data, code) {
		$http.post('urlDeault', this, {
			code: "03050020",
			data: data,
			success: function (res) {
				if (res.errorCode == '0') {
					if (res.confirmData.length > 0 || res.errorData.length > 0) {

						this.setState({//确认医嘱弹框
							isShowConfirmModal: true,
							confirmData: res.confirmData,
							errorData: res.errorData,
							adviceDrData: res.data,
						})
					} else {
						this.setState({
							confirmData: res.confirmData,
							errorData: res.errorData,
							adviceDrData: res.data,
						}, () => {
							this.confirmAdviceModal(code)
						})
					}
					this.hideModal('showBringMedicineModal')
				}
			}
		});
	}

	//常用用法
	addCommonUserMsg() {
		// var { ids } = this.state;
		if (Util.isEmpty(this.state.ids)) {
			message.error(this.setMessage('DoctorAdviceListPageNeed', 'descripts'), this.state.userData && this.state.userData.messageTime)
			return
		}
		var { useData } = this.state;
		for (var i = 0; i < useData.length; i++) {
			if (Util.isEmpty(useData[i].medID) && Util.isEmpty(useData[i].ordMedItemID)) {
				message.error(this.setMessage('DoctorAdviceListPageNullAdvice', 'descripts'), this.state.userData && this.state.userData.messageTime)
				return
			}
		}
		var data = []
		if (useData) {
			for (var i = 0; i < useData.length; i++) {
				data.push({
					userID: this.state.userData.userID,
					hospID: this.state.userData.hospID,
					medID: useData[i].ordMedItemID ? useData[i].ordMedItemID : useData[i].medID,
					ordDose: useData[i].ordDose,
					ordDoseUnitID: useData[i].ordDoseUnitID,
					ordFreqID: useData[i].ordFreqID,
					ordUsageID: useData[i].ordUsageID,
					ordDurQty: useData[i].ordDurQty,
					ordDurationID: useData[i].ordDurationID,
					ordSkinTestFlag: useData[i].ordSkinTestFlag,
					ordSkinTestWayID: useData[i].ordSkinTestWayID,
					ordNote: useData[i].ordNote,
				})
			}
		}
		var params = {
			params: data
		}
		$http.post('urlDeault', this, {
			code: "03050067",
			data: params,
			success: function (res) {
				if (res.errorCode == '0') {
					message.success(this.setMessage('DoctorAdviceListPageCommon', 'descripts'), this.state.userData && this.state.userData.messageTime)
					this.setState({
						ids: []
					})
				}
			}
		});
	}


	// 操作弹框
	onClickRowPublic = (record, index) => {
		return {
			onDoubleClick: () => {
				// if (Util.isEmpty(record.medStock) && record.orderType == 'D') {
				//     message.error('库存不足，无法添加')
				//     return
				// }
				// this.rowClick(record, index)
			},
			onClick: () => {
				if (Util.isEmpty(record.medStock) && record.orderType == 'D') {
					message.error('库存不足，无法添加', this.state.userData && this.state.userData.messageTime)
					return
				}
				this.setState({
					rowMedID: record.medID || record.ordSetID
				}, () => {
					this.rowClick(record, index)
				})
			}
		}
	}

	setRowClassNamePublic = (record) => {
		return (record.medID || record.ordSetID) === this.state.rowMedID ? 'clickRowStyle' : '';
	}


	handleOnKeydown(e) {
		let { isShowCommonTableModal, dataSource, currentOrdMedIndex } = this.state;
		if (!isShowCommonTableModal) return;
		var e = window.event || e;
		let scroll_height = document.getElementsByClassName('clickRowStyle')[0] ? document.getElementsByClassName('clickRowStyle')[0].clientHeight : 26;
		if (scrollCount < 0) {
			scrollCount = 0
		}
		let id = '';
		let oneArr = this.state.selectData && this.state.selectData.length > 0 ? this.state.selectData : [];
		let currentRecord = currentOrdMedIndex !== '' ? dataSource[currentOrdMedIndex] : {};
		switch (e.keyCode) {
			case 13:
				if (currentRecord && currentRecord.writtenOrderFlag === 'Y') { // 文字医嘱
					this.writtenOrdersRef && this.writtenOrdersRef.handleOK();
				} else {
					if (this.state.rowMedID) {
						let obj = {}
						for (var i = 0; i < oneArr.length; i++) {
							if ((oneArr[i].medID || oneArr[i].ordSetID) === this.state.rowMedID) {
								obj = i > 0 ? oneArr[i] : oneArr[0];
								break;
							}
						}
						if (Util.isEmpty(obj)) {
							message.error(this.setMessage('DoctorAdviceListPageNoOptional', 'descripts'), this.state.userData && this.state.userData.messageTime)
							return
						}
						if (Util.isEmpty(obj.medStock) && obj.orderType == 'D') {
							message.error('库存不足，无法添加！', this.state.userData && this.state.userData.messageTime)
							return
						}
						this.rowClick(obj);
					} else {
						message.info(this.setMessage('DoctorAdviceListPageAData', 'descripts'), this.state.userData && this.state.userData.messageTime)
					}
				}
				break;
			case 38: //上
				if (currentRecord && currentRecord.writtenOrderFlag === 'Y') { // 文字医嘱
					this.writtenOrdersRef && this.writtenOrdersRef.handleWrittenOrderMove(38); // 上移
				} else {
					if (this.state.rowMedID) {
						for (var i = 0; i < oneArr.length; i++) {
							if ((oneArr[i].medID || oneArr[i].ordSetID) === this.state.rowMedID) {
								id = i > 0 ? (oneArr[i - 1].medID || oneArr[i - 1].ordSetID) : (oneArr[0].medID || oneArr[0].ordSetID);
								break;
							}
						}
						this.setState({ rowMedID: id }, () => {
							// var gundong = document.getElementById("gundong");
							// var gundong = document.getElementsByClassName('ant-table-body')[1]
							// gundong.scrollTop = gundong.scrollTop - scroll_height;
							scrollCount -= document.getElementsByClassName('clickRowStyle')[0].clientHeight
							var gundong = ''
							if (this.props.patStatus == '1') {
								gundong = document.getElementsByClassName('ant-table-body')[2] ? document.getElementsByClassName('ant-table-body')[2] : document.getElementsByClassName('ant-table-body')[1]
							} else {
								gundong = document.getElementsByClassName('ant-table-body')[1]
							}
							// if (scrollCount > 280) {
							if (gundong) {
								gundong.scrollTop = gundong.scrollTop - scroll_height;
							}
							// }
						})
					} else {
						this.setState({ rowMedID: oneArr[0] ? (oneArr[0].medID || oneArr[0].ordSetID) : '' })
					}
				}
				break;
			case 40: //下
				if (currentRecord && currentRecord.writtenOrderFlag === 'Y') { // 文字医嘱
					this.writtenOrdersRef && this.writtenOrdersRef.handleWrittenOrderMove(40); // 下移
				} else {
					if (this.state.rowMedID) {
						for (let i = 0; i < oneArr.length; i++) {
							if ((oneArr[i].medID || oneArr[i].ordSetID) === this.state.rowMedID) {
								id = i + 1 >= oneArr.length ? (oneArr[oneArr.length - 1].medID || oneArr[oneArr.length - 1].ordSetID)
									: (oneArr[i + 1].medID || oneArr[i + 1].ordSetID);
								break;
							}
						}
						this.setState({ rowMedID: id }, () => {
							// var gundong = document.getElementById("gundong");
							scrollCount += document.getElementsByClassName('clickRowStyle')[0].clientHeight
							// var gundong = document.getElementsByClassName('ant-table-body')[1]
							var gundong = ''
							if (this.props.patStatus == '1') {
								gundong = document.getElementsByClassName('ant-table-body')[2] ? document.getElementsByClassName('ant-table-body')[2] : document.getElementsByClassName('ant-table-body')[1]
							} else {
								gundong = document.getElementsByClassName('ant-table-body')[1]
							}
							if (scrollCount > 270) {
								if (gundong) {
									gundong.scrollTop = gundong.scrollTop + scroll_height;
								}
							}
						})
					} else {
						this.setState({ rowMedID: oneArr[0] ? (oneArr[0].medID || oneArr[0].ordSetID) : '' })
					}
				}
				break;
		}
	}

	//申请单路由跳转
	goDoctorAdviceStepPage = (num) => {
		var { hashROuter } = this.props;
		hashROuter && hashROuter(num);
	}

	payModal = (e) => {
		this.setState({
			payModalVis: true
		}, () => {
			setTimeout(() => {
				this.childPayContenRef.someVar()
			}, 100);
		})
	}

	handleCancelMoney = () => {
		this.setState({
			payModalVis: false
		})

		let chargeRecodeId = this.childPayContenRef.chargeRecodeId()
		var data = {
			params: [{
				"recordIDinfo": chargeRecodeId, //付款记录串
				"hisTradeNum": "",   //his交易流水
				"userID": JSON.parse(window.sessionStorage.userData).userID || '', //操作人
				"ip": React.$getSessionData('ipConfig')?.ipv4 || '', //ip
			}]
		}


		$http.post('urlADS', this, {
			code: "05210010",
			data: data,
			success: function (res) {
				let errorCode = res.errorCode;
				if (errorCode === '0') {

				}
			}
		});

	}

	handleOK = () => {
		this.childPayContenRef.chargingConfir()
	}

	onRef = (ref) => {
		this.child = ref;
	}


	PayContenRef = (ref) => {
		this.childPayContenRef = ref;
	}

	handleCallback(res) {
		this.setState({
			payModalVis: false,
		})
		if (res) {
			let messageTime = this.state.userData && this.state.userData.messageTime ? this.state.userData.messageTime : 3;
			Keup.ModalMessage(messageTime, this, res.errorMessage, '自动关闭', 'destroy', '确定', 'success')

		}
	}

	//取消弹框显示，焦点问题
	handleFocus() {
		scrollCount = 0;
		this.setState({
			selectData: [],
			isShowCommonTableModal: false
		}, () => {
			if (!this.state.focusStatus && this.state.isShowCommonTableModal) {
				this.handleOrdMedItemFocus();
			}
		})
	}

	//国际化
	setMessage(name, message) {
		return this.state.localeProvider && this.state.localeProvider[name] ? this.state.localeProvider[name][message] : ''
	}

	hideAppListModal(name) {
		this.setState({
			[name]: false
		}, () => {
			this.loadData()
		})
	}

	//显示和隐藏医嘱录入，回传给住院
	handleHideAdviceList() {
		if (this.state.hideAdviceList === true) {
			this.setState({
				hideAdviceList: false
			}, () => {//各自在set时去回调，防止异步问题
				var { handleHideAdviceList } = this.props;
				handleHideAdviceList && handleHideAdviceList(this.state.hideAdviceList)
			})
		} else {
			this.setState({
				hideAdviceList: true
			}, () => {
				var { handleHideAdviceList } = this.props;
				handleHideAdviceList && handleHideAdviceList(this.state.hideAdviceList)
			})
		}
	}

	/************pass系统**************/
	// showDrugDescription(){
	//     var ipConfig = React.$getSessionData('ipConfig');
	//     var data = new Params_MC_PASSclient_In()
	//     data.HospID = this.state.userData.hospID; //医院编码
	//     data.HospName = this.state.userData.hospDesc; //医院名称
	//     data.UserID = this.state.userData.userID;
	//     data.UserName = this.state.userData.userName;
	//     data.DeptID = this.state.userData.locID;
	//     data.DeptName = this.state.userData.locDesc;
	//     data.IP = ipConfig.ipv4;
	//     data.PCName = ipConfig.hostName;
	//     data.OSInfo = ""; //操作系统
	//     data.Resolution = ""; //分辨率
	//     data.PassVersion = McPASS.isPC() ? "1" : "2";//1pc 2pad
	//     data.mac = ipConfig.mac;//服务器电脑mac地址
	//     data.otherinfo = "";//其它信息,备用
	//     data.ProductCode = "mlf35wieQdgHJ478gk06slVGSMrhy9Y2yjfhlkTv1";
	//     New_MC_PASSclient(data)
	//     MDC_DoRefDrug(11)
	// }

	//套餐radio
	changePackageRadio(name, e) {
		this.setState({
			[name]: e.target.value
		}, () => {
			this.loadLeftData()
		})
	}

	changeActiveKey(e) {
		this.setState({
			activeKey: e
		})
	}

	//同步时间
	handleSynchronization(string) {
		var { ids, dataSource, useData } = this.state;
		if (useData) {
			for (var i = 0; i < useData.length; i++) {
				if (!Util.isEmpty(useData[i].ordID)) {
					message.error('只能针对未保存的医嘱进行同步！')
					return
				}
				if (Util.isEmpty(useData[i].ordMedItemDesc)) {
					message.error('空医嘱无法同步时间！')
					return
				}
			}
		}

		let data = { params: [{}] };
		let TimeResult = {};
		$http.post("urlS", this, {
			code: "pr00000",
			data: data,
			success: function (res) {
				TimeResult = res.result
			}
		});

		var source = []
		if (!Util.isEmpty(dataSource)) {
			for (var j = 0; j < dataSource.length; j++) {
				if (Util.isEmpty(dataSource[j].ordID) && !Util.isEmpty(dataSource[j].medID)) {
					source.push(dataSource[j])

					/**
					 * @ByYQL: 更新最新时间
					 * Create 2022-1-12
					 */
					if (string == 'NewTime') {
						dataSource[j].ordDate = TimeResult.date || moment().format('YYYY-MM-DD')
						dataSource[j].ordTime = TimeResult.time || moment().format('HH:mm:ss')
						dataSource[j].ordStartDate = TimeResult.date || moment().format('YYYY-MM-DD')
						dataSource[j].ordStartTime = TimeResult.time || moment().format('HH:mm:ss')
					}
				}
			}
		}
		if (!Util.isEmpty(ids) && !Util.isEmpty(source)) {
			for (var i = 0; i < ids.length; i++) {
				for (var j = 0; j < source.length; j++) {
					if (ids[0] == source[j].tabIndex) {
						source[i]['ordDate'] = source[j].ordDate
						source[i]['ordTime'] = source[j].ordTime
						source[i]['ordStartDate'] = source[j].ordStartDate
						source[i]['ordStartTime'] = source[j].ordStartTime
					}
				}
			}
		}
		this.setState({})
	}

	// 阻止事件冒泡
	stopPropagation = e => {
		e.stopPropagation && e.stopPropagation();
	}

	// 优惠
	discountOnClick = () => {
		let { patientData } = this.state;
		this.setState({ discountShow: true, showColumns: false })
		this.discountChild && this.discountChild.medicalInformation(patientData?.admID);
	}

	closeDiscountModal = () => {
		this.setState({ discountShow: false });
	}

	// 查询医嘱列表是否有未保存的医嘱
	handleDetermineWhetherToSave = () => {
		const { dataSource } = this.state;
		console.log("dataSource", dataSource)
		let isSave = false;
		for (var i = 0; i < dataSource.length; i++) {
			if (Util.isEmpty(dataSource[i].ordID) && !Util.isEmpty(dataSource[i].medID)) {
				isSave = true
				break
			}
		}
		return isSave;
	}

	// 获取医嘱勾选数据
	getSelectedRows = () => {
		let { useData, dataSource } = this.state;
		if (useData && useData.length > 0) {
			return useData || []
		}
		return dataSource;
	}

	// 向外输出插入方式
	getInsertMethod = () => {
		let { insertMethod } = this.state;
		return insertMethod;
	}

	// 医嘱录入模式切换
	handleInputModeSwitching = () => {
		const { isShowCommonTableModal, currentOrdMedIndex, dataSource } = this.state;
		if (isShowCommonTableModal) {
			message.error('选择医嘱时不允许切换录入模式！');
			return;
		}
		if (currentOrdMedIndex !== '') {
			let record = dataSource[Number(currentOrdMedIndex)];
			if (Util.isEmpty(record.medID) && Util.isEmpty(record.ordMedItemID)) {
				let writtenOrderFlag = this.state.dataSource[currentOrdMedIndex]?.writtenOrderFlag === 'Y' ? true : false;
				this.state.dataSource[currentOrdMedIndex].writtenOrderFlag = writtenOrderFlag ? 'N' : 'Y';
				this.setState({}, () => {
					this.getDynColumnsData();
					this.handleOrdMedItemFocus(currentOrdMedIndex);
					record && record.ordMedItemDesc ? message.success(writtenOrderFlag ? '已取消文字医嘱录入模式' : '已切换为文字医嘱录入模式') : '';
				});
			} else {
				message.error('已选择的医嘱不允许切换医嘱类型，如需切换可清空名称*规格');
			}
		} else {
			message.error('切换医嘱模式前请将焦点定位到名称*规格输入框中');
		}
	}

	// 确认选择文字医嘱
	handleConfirmSelection = (res) => {
		let resData = res?.data || [];
		if (res.confirmData.length > 0) {
			let { userData } = this.state;
			confirm({
				title: this.setMessage('DoctorAdviceListPageConfirmation', 'descripts'),
				content: res.confirmData[0]?.errorMessage || '',
				okText: userData.language == 'EN' ? 'Ok' : '是',
				cancelText: userData.language == 'EN' ? 'cancel' : '否',
				onOk: () => {
					this.handleOrderAssignment(resData)
				}
			})
		} else {
			this.handleOrderAssignment(resData)
		}
	}

	// 医嘱列表赋值
	handleOrderAssignment = (resData) => {
		this['ordMedItemDesc' + this.state.indexTable] && (this['ordMedItemDesc' + this.state.indexTable].state.value = resData[0].defaultData.ordDesc);
		//双击医嘱项，根据index，渲染对应行的默认数据
		this.state.dataSource[this.state.indexTable]['ordMedItemDesc'] = resData[0].defaultData.ordDesc;
		this.state.dataSource[this.state.indexTable]['ordDose'] = resData[0].defaultData.ordDose;
		this.state.dataSource[this.state.indexTable]['ordDoseUnitID'] = resData[0].defaultData.ordDoseUnitID;
		// this.state.dataSource[this.state.indexTable]['ordFreqID'] = resData[0].defaultData.ordFrequenceID;
		this.state.dataSource[this.state.indexTable]['ordFreqID'] = resData[0].defaultData.ordFreqID;
		this.state.dataSource[this.state.indexTable]['defaultStatus'] = true;
		this.state.dataSource[this.state.indexTable]['ordFreqDesc'] = resData[0].defaultData.ordFreqDesc;
		this.state.dataSource[this.state.indexTable]['ordUsageDesc'] = resData[0].defaultData.ordUsageDesc;
		this.state.dataSource[this.state.indexTable]['ordUsageID'] = resData[0].defaultData.ordUsageID;
		this.state.dataSource[this.state.indexTable]['ordDurQty'] = resData[0].defaultData.ordDurQty;
		this.state.dataSource[this.state.indexTable]['ordDurationID'] = resData[0].defaultData.ordDurationID;
		this.state.dataSource[this.state.indexTable]['radioFlag'] = resData[0].defaultData.radioFlag;
		this.state.dataSource[this.state.indexTable]['noINSUFlag'] = resData[0].defaultData.noINSUFlag;
		this.state.dataSource[this.state.indexTable]['ordbodyPartID'] = resData[0].defaultData.ordbodyPartID;
		this.state.dataSource[this.state.indexTable]['ordbodyPartDesc'] = resData[0].defaultData.ordbodyPartDesc;
		this.state.dataSource[this.state.indexTable]['ordQty'] = resData[0].defaultData.ordQty;
		this.state.dataSource[this.state.indexTable]['medItemGrade'] = resData[0].defaultData.medItemGrade;
		this.state.dataSource[this.state.indexTable]['ordQtyUomID'] = resData[0].defaultData.ordQtyUomID;
		this.state.dataSource[this.state.indexTable]['ordPrice'] = resData[0].defaultData.ordPrice;
		this.state.dataSource[this.state.indexTable]['ordNewPrice'] = resData[0].defaultData.ordPrice;
		this.state.dataSource[this.state.indexTable]['ordSkinTestFlag'] = resData[0].defaultData.ordSkinTestFlag;
		this.state.dataSource[this.state.indexTable]['testFlag'] = resData[0].defaultData.ordSkinTestFlag;
		this.state.dataSource[this.state.indexTable]['totalPrice'] = resData[0].defaultData.totalPrice;
		this.state.dataSource[this.state.indexTable]['eyePartID'] = resData[0].defaultData.eyePartDesc;
		this.state.dataSource[this.state.indexTable]['ordInsuCat'] = resData[0].defaultData.ordInsuCat;
		this.state.dataSource[this.state.indexTable]['ordSkinTestWayID'] = resData[0].defaultData.ordSkinTestWayID;
		this.state.dataSource[this.state.indexTable]['ordRecLocID'] = resData[0].defaultData.ordRecLocID;
		this.state.dataSource[this.state.indexTable]['ordPriorityID'] = resData[0].defaultData.ordPriorityID;
		this.state.dataSource[this.state.indexTable]['ordStageID'] = resData[0].defaultData.ordStageID;
		this.state.dataSource[this.state.indexTable]['medDesca'] = resData[0].defaultData.ordDesca;
		this.state.dataSource[this.state.indexTable]['ordSkinTestUsageID'] = resData[0].defaultData.ordSkinTestUsageID;
		this.state.dataSource[this.state.indexTable]['ordSkinTestUsageDesc'] = resData[0].defaultData.ordSkinTestUsageDesc;
		this.state.dataSource[this.state.indexTable]['ordEMFlag'] = resData[0].defaultData.ordEMFlag;
		this.state.dataSource[this.state.indexTable]['testEMFlag'] = resData[0].defaultData.ordEMFlag;
		this.state.dataSource[this.state.indexTable]['ordSkinTestFlag'] = resData[0].defaultData.ordSkinTestFlag;
		this.state.dataSource[this.state.indexTable]['testFlag'] = resData[0].defaultData.ordSkinTestFlag;
		this.state.dataSource[this.state.indexTable]['ordAdmReasonID'] = resData[0].defaultData.ordAdmReasonID;
		this.state.dataSource[this.state.indexTable]['ordSeqNo'] = parseInt(this.state.indexTable) + 1;
		this.state.dataSource[this.state.indexTable]['ordDate'] = resData[0]?.defaultData?.ordDate || resData[0].defaultData?.date || moment().format(dayFormat);
		this.state.dataSource[this.state.indexTable]['ordTime'] = resData[0]?.defaultData?.ordTime || resData[0].defaultData?.time || moment().format(timeFormat);
		this.state.dataSource[this.state.indexTable]['ordStartDate'] = resData[0]?.defaultData?.ordStartDate || resData[0].defaultData?.date || moment().format(dayFormat);
		this.state.dataSource[this.state.indexTable]['ordStartTime'] = resData[0]?.defaultData?.ordStartTime || resData[0].defaultData?.time || moment().format(timeFormat);
		this.state.dataSource[this.state.indexTable]['ordNote'] = resData[0].defaultData.ordNote;
		this.state.dataSource[this.state.indexTable]['medID'] = resData[0].defaultData.medID;
		this.state.dataSource[this.state.indexTable]['ordMedItemID'] = resData[0].defaultData.medID;
		this.state.dataSource[this.state.indexTable]['ordTypeCode'] = resData[0].defaultData.ordTypeCode;
		this.state.dataSource[this.state.indexTable]['ordSpecID'] = resData[0].defaultData.ordSpecID;
		this.state.dataSource[this.state.indexTable]['degreesID'] = resData[0].defaultData.degreesID;
		this.state.dataSource[this.state.indexTable]['ordSkinTestFlagValue'] = resData[0].defaultData.ordSkinTestFlagValue;
		this.state.dataSource[this.state.indexTable]['ordEMFlagValue'] = resData[0].defaultData.ordEMFlagValue;
		this.state.dataSource[this.state.indexTable]['ordToalCountO'] = resData[0].defaultData.ordToalCountO;
		this.state.dataSource[this.state.indexTable]['ordToalCountI'] = resData[0].defaultData.ordToalCountI;
		this.state.dataSource[this.state.indexTable]['frequency'] = resData[0].defaultData.frequency;
		this.state.dataSource[this.state.indexTable]['cycleDays'] = resData[0].defaultData.cycleDays;
		this.state.dataSource[this.state.indexTable]['intervalDays'] = resData[0].defaultData.intervalDays;
		this.state.dataSource[this.state.indexTable]['duraFactor'] = resData[0].defaultData.duraFactor;
		this.state.dataSource[this.state.indexTable]['doseDenominator'] = resData[0].defaultData.doseDenominator;
		this.state.dataSource[this.state.indexTable]['doseMolecule'] = resData[0].defaultData.doseMolecule;
		this.state.dataSource[this.state.indexTable]['qtyMolecule'] = resData[0].defaultData.qtyMolecule;
		this.state.dataSource[this.state.indexTable]['qtyDenominator'] = resData[0].defaultData.qtyDenominator;
		this.state.dataSource[this.state.indexTable]['ordPriorityExtDesc'] = resData[0].defaultData.ordPriorityExtDesc;
		this.state.dataSource[this.state.indexTable]['ordPriorityExtID'] = resData[0].defaultData.ordPriorityExtID;
		this.state.dataSource[this.state.indexTable]['ordInfuseSpeed'] = resData[0].defaultData.ordInfuseSpeed;
		this.state.dataSource[this.state.indexTable]['ordSpeedUnitID'] = resData[0].defaultData.ordSpeedUnitID;
		this.state.dataSource[this.state.indexTable]['specList'] = resData[0].dataList.specList;
		this.state.dataSource[this.state.indexTable]['infuseSpeedList'] = resData[0].dataList.infuseSpeedList;
		this.state.dataSource[this.state.indexTable]['doseUnitList'] = resData[0].dataList.doseUnitList;
		this.state.dataSource[this.state.indexTable]['durationList'] = resData[0].dataList.durationList;
		this.state.dataSource[this.state.indexTable]['stageList'] = resData[0].dataList.stageList;
		this.state.dataSource[this.state.indexTable]['qtyUnitList'] = resData[0].dataList.qtyUnitList;
		this.state.dataSource[this.state.indexTable]['ordNoteList'] = resData[0].dataList.ordNoteList;
		this.state.dataSource[this.state.indexTable]['eyePartList'] = resData[0].dataList.eyePartList;
		this.state.dataSource[this.state.indexTable]['bodyPartList'] = resData[0].dataList.bodyPartList;
		this.state.dataSource[this.state.indexTable]['ordMessage'] = resData[0].defaultData.ordMessage;
		this.state.dataSource[this.state.indexTable]['recLocList'] = resData[0].dataList.recLocList;
		// this.state.dataSource[this.state.indexTable]['frequenceList'] = resData[0].dataList.frequenceList;
		this.state.dataSource[this.state.indexTable]['causeList'] = resData[0].dataList.causeList;
		// this.state.dataSource[this.state.indexTable]['usageList'] = resData[0].dataList.usageList;
		this.state.dataSource[this.state.indexTable]['skinTestWayList'] = resData[0].dataList.skinTestWayList;
		this.state.dataSource[this.state.indexTable]['priorityList'] = resData[0].dataList.priorityList;
		this.state.dataSource[this.state.indexTable]['admReasonList'] = resData[0].dataList.admReasonList;
		this.state.dataSource[this.state.indexTable]['degreesList'] = resData[0].dataList.degreesList;
		this.state.dataSource[this.state.indexTable]['priorityExtList'] = resData[0].dataList.priorityExtList ? resData[0].dataList.priorityExtList : [];
		this.state.dataSource[this.state.indexTable]['unableToEdit'] = resData[0].unableToEdit;
		this.state.dataSource[this.state.indexTable]['sequence'] = resData[0].sequence;
		this.state.dataSource[this.state.indexTable]['customPrice'] = resData[0].defaultData.customPrice; // 自定义价格
		this.state.dataSource[this.state.indexTable]['customPriceFlag'] = resData[0].defaultData.customPriceFlag; // 自定义价格标志
		this.state.dataSource[this.state.indexTable]['writtenOrderFlag'] = resData[0].defaultData.writtenOrderFlag; // 文字医嘱
		this.state.dataSource[this.state.indexTable]['firstBillFlag'] = resData[0].defaultData.firstBillFlag; // 只首次计费标志
		this.state.dataSource[this.state.indexTable]['antibioticFlag'] = resData[0]?.defaultData?.antibioticFlag || ''; // 抗菌药物标志
		this.state.dataSource[this.state.indexTable]['antibioticRecordData'] = resData[0]?.defaultData?.antibioticRecordData || ''; // 抗菌药物操作数据
		this.state.dataSource[this.state.indexTable]['antibioticDesc'] = resData[0]?.defaultData?.antibioticDesc || ''; // 抗菌药物描述
		this.setState({
			tableData: resData[0].defaultData,
			ordMessage: resData[0].defaultData.ordMessage,
			doseUnitList: resData[0].dataList.doseUnitList,//剂量单位
			durationList: resData[0].dataList.durationList,//疗程单位
			qtyUnitList: resData[0].dataList.qtyUnitList,//数量单位
			recLocList: resData[0].dataList.recLocList,//接收科室
			// frequenceList: resData[0].dataList.frequenceList,//频次
			// usageList: resData[0].dataList.usageList,//用法
			skinTestWayList: resData[0].dataList.skinTestWayList,//皮试备注
			priorityList: resData[0].dataList.priorityList,//优先级
			admReasonList: resData[0].dataList.admReasonList,
			eyePartList: resData[0].dataList.eyePartList,
			ordNoteList: resData[0].dataList.ordNoteList,
			bodyPartList: resData[0].dataList.bodyPartList,
			// specList: resData[0].dataList.specList,//标本
			priorityExtList: resData[0].dataList.priorityExtList,//标本
			sequence: resData[0]?.sequence,//跳转参数
			newCode: [],
			changeValue: undefined,
			focusStatus: false,
			isShowCommonTableModal: false,
		}, () => {
			this.handleClearOrdMedItemFocus();
			this['ordDose' + this.state.indexTable] && this['ordDose' + this.state.indexTable].focus(); // 剂量获取焦点
		})
	}

	// 文字医嘱弹窗键盘事件
	handleWrittenOrdersKeydown = (e) => {
		var e = window.event || e;
		console.log("文字医嘱弹窗键盘事件", e.keyCode)
		switch (e.keyCode) {
			case 13:
				this.writtenOrdersRef && this.writtenOrdersRef.handleOK();
				break;
			case 38:
				this.writtenOrdersRef && this.writtenOrdersRef.handleWrittenOrderMove(38); // 上移
				break;
			case 40:
				this.writtenOrdersRef && this.writtenOrdersRef.handleWrittenOrderMove(40); // 下移
				break;
		}
	}

	// 关闭文字医嘱弹窗
	handleWrittenOrdersCancel = () => {
		this.setState({
			isShowCommonTableModal: false
		})
	}

	/**
	 * @ByShizi: 科室切换
	 * Create 2022-12-01
	 * */
	handleMenuItemChange = item => {
		this.setState({ currentLocData: item }, () => {
			this.loadTemplateData();
		});
	}

	/**
	 * @ByShizi: 修改医嘱
	 * 需求：1136
	 * Create 2023-02-13
	 * */
	handleModifyMechansim = async () => {
		try {
			let dataSource = JSON.parse(JSON.stringify(this.state.dataSource)); // 深拷贝数据源
			let firstData = [];
			let newData = [];
			let deleteID = [];
			for (var i = 0; i < dataSource.length; i++) {
				if (dataSource[i].ordID && dataSource[i].ordBilledCode !== 'P') { // 已保存但是没有支付的医嘱需要删除重新引入
					deleteID.push(dataSource[i].ordID);
				} else if (Util.isEmpty(dataSource[i].medID) && Util.isEmpty(dataSource[i].ordMedItemID)) {
					continue;
				} else {
					if (dataSource[i].ordBilledCode === 'P') {
						firstData.push(dataSource[i]);
					} else {
						newData.push(dataSource[i]);
					}
				}
			}
			if (!(deleteID && deleteID.length > 0)) {
				message.error('没有需要修改的医嘱');
				return;
			}
			this.setState({ dynLoading: true });
			var deleteData = {
				params: [{
					ordID: deleteID
				}],
			}
			let deleteRes = await React.$asyncPost(this, '03050038', deleteData);
			if (+deleteRes.errorCode === 0) {
				// console.log("newData, firstData", newData, firstData)
				this.onCopyText(!Util.isEmpty(this.state.patientData) ? this.state.patientData.admID : '', deleteID, newData, firstData);
			} else {
				this.setState({ dynLoading: false });
			}
		} catch (error) {
			this.setState({ dynLoading: false });
		}
	}

	// 医嘱单打印
	handlePrintExecSheet = async () => {
		try {
			const { patientData } = this.state;
			let data = {
				params: [{
					admID: patientData?.admID || ''
				}]
			}
			let res = await React.$asyncPost(this, '0406021', data);
			res && 'result' in res && res.result && $loopPrint('', res.result);
		} catch (error) {
			console.log(error);
		}
	}

	// 事前调阅 - 获取签名测试
	getPriorReviewSign = (fn, parData) => {
		let timeStamp = String(moment().valueOf());
		let timer = moment().format(dateFormat);
		let accessKey = parData?.accessKey || '9cc369f21e2040ae998d03ba28537326';
		let secretKey = parData?.secretKey || 'bMHs3qicm3sfor4ROjNhAXqqKjc=';
		const data = {
			apiName: parData?.apiName || 'ims-svc-beforeAccess',
			apiVersion: '1.0.0',
			timeStamp,
			accessKey,
			secretKey,
			formParamMap: null,
			body: ''
		};
		console.log(timer + ' inPar => 签名地址: http://172.18.1.130:8086/CSB');
		console.log(timer + ' inPar => 签名前入参', JSON.stringify(data));
		fetch('http://172.18.1.130:8086/CSB', {
			method: 'POST',
			headers: {
				'Accept': '*/*',
				'Content-Type': 'application/json',
				'_api_name': 'ims-sdk',
				'_api_version': '1.0.0',
				'_api_access_key': accessKey,
				'_api_secret_key': secretKey,
				'_api_timestamp': timeStamp,
			},
			body: JSON.stringify(data)
		})
			.then(response => response.json())
			.then(res => {
				console.log(timer + ' outPar => 签名后返回值', JSON.stringify(res));
				if (res?.code == '200') {
					let signature = res?.data?.signature || '';
					// this.handlePriorReview(signature, accessKey, timeStamp, timer);
					fn && fn(signature, accessKey, timeStamp, timer, parData)
				} else {
					message.error(res?.message || '事前调阅获取签名异常！');
				}
			})
			.catch(error => {
				console.log('Error:', error);
				message.error('事前调阅获取签名接口异常！');
			});
	}

	// 事前调阅
	handlePriorReview = (signature, accessKey, timeStamp, timer) => {
		const { titleData, insuNumber, hisAdmTradeNo } = this.state;
		let data = {
			syscode: '01',
			mdtrtSn: hisAdmTradeNo || '', //  2473524
			patientDto: {
				patnId: insuNumber || '', // 20000376963
				patnName: titleData?.patName || '', // 王吉兰
				// currMdtrtId: patientData?.admID || '', // 暂时不需要
				// patnId: '20000376963',
				// patnName: '王吉兰',
			},
			internetHospital: '0',
		}
		console.log(timer + ' inPar => 事前调阅地址: http://172.18.1.130:8086/CSB');
		console.log(timer + ' inPar => 事前调阅返回值入参', JSON.stringify(data));
		fetch('http://172.18.1.130:8086/CSB', {
			method: 'POST',
			headers: {
				'Accept': '*/*',
				'Content-Type': 'application/json',
				'_api_name': 'ims-svc-beforeAccess',
				'_api_version': '1.0.0',
				'_api_access_key': accessKey || '',
				'_api_timestamp': timeStamp,
				'_api_signature': signature, // 签名
			},
			body: JSON.stringify(data)
		})
			.then(response => response.json())
			.then(res => {
				console.log(timer + ' outPar => 事前调阅返回值返回值', JSON.stringify(res));
				if (res?.code == 0) {
					let popUrl = res?.data?.popUrl || '';
					this.iframeRef && this.iframeRef.modifyVisible(true, popUrl);
				} else {
					message.error(res?.message || '事前调阅获取地址异常！');
				}

			})
			.catch(error => {
				console.log('Error:', error);
				message.error('事前调阅获取地址接口异常！');
			});
	}

	// 事前提醒
	handleReminderInAdvance = (signature, accessKey, timeStamp, timer, preRemindData) => {
		if (!preRemindData) {
			message.error('事前调阅入参异常！');
			return;
		}
		console.log(timer + ' inPar => 事前提醒地址: http://172.18.1.130:8086/CSB');
		console.log(timer + ' inPar => 事前提醒返回值入参', JSON.stringify(preRemindData));
		fetch('http://172.18.1.130:8086/CSB', {
			method: 'POST',
			headers: {
				'Accept': '*/*',
				'Content-Type': 'application/json',
				'_api_name': preRemindData?.apiName || 'ims-svc-beforeAccess',
				'_api_version': '1.0.0',
				'_api_access_key': accessKey || '',
				'_api_timestamp': timeStamp,
				'_api_signature': signature, // 签名
			},
			body: JSON.stringify(preRemindData)
		})
			.then(response => response.json())
			.then(res => {
				console.log(timer + ' outPar => 事前提醒返回值返回值', JSON.stringify(res));
				if (res?.code == 0) {
					let popUrl = res?.data?.popUrl || '';
					this.iframeRef && this.iframeRef.modifyVisible(true, popUrl);
				} else {
					message.error(res?.message || '事前提醒获取地址异常！');
				}
			})
			.catch(error => {
				console.log('Error:', error);
				message.error('事前调阅获取地址接口异常！');
			});
	};

	// 输入域值修改
	handleInputChange = (dataIndex, value) => {
		this.state[dataIndex] = value;
		this.setState({});
	};

	// 事前调阅入口
	handleAccessInAdvance = () => {
		const { userData, patientData } = this.state;
		switch (userData?.hospCode || '') {
			case 'H17':
				this.getPriorReviewSign(this.handlePriorReview); // 天津
				break;
			case 'H16':
				this.handleH16PriorReview(); // 沈阳
				break;
			case 'H12': // 北京华德
				this.sharingMedicalOrdersRef && this.sharingMedicalOrdersRef.modifyVisible(true, { admID: patientData?.admID || '', patID: patientData?.patID || '' });
				break;
			default:
				console.log('hospCode:', userData?.hospCode || '');
		}
	};

	// 沈阳 - 事前调阅
	handleH16PriorReview = async () => {
		try {
			const { patientData } = this.state;
			let data = {
				params: [{
					admID: patientData?.admID || ''
				}]
			}
			let res = await React.$asyncPost(this, '05110028', data);
			let dllres = await React.$dllPost(res?.dllFuncName || 'PlatformDirectConnect', res?.result || {}, res?.dllPath || 'INSUNew/PTMedInsuInterface.dll', res?.dllClassName || 'PTMedInsuInterface.InsuBusiness');
			if (dllres?.errorCode != '0') {
				message.error(dllres?.errorMessage || '调用失败');
			}
		} catch (error) {
			console.log(error);
		}
	};

	// 诊断切换
	handleDiagTabChange = (key) => {
		let that = this;
		let componentData = []
		let { dataSource } = this.state;
		if (!Util.isEmpty(dataSource)) {
			for (let i = 0; i < dataSource.length; i++) {
				if (!Util.isEmpty(dataSource[i].medID) && Util.isEmpty(dataSource[i].ordID)) {
					componentData.push(dataSource[i])
					break; // 只取一次数据，防止多次执行
				}
			}
		}
		if (!Util.isEmpty(componentData)) { // 提示是否需要暂存
			confirm({
				title: '提示',
				content: '当前数据未保存，是否需要保存？',
				okText: that.state.userData.language == 'EN' ? 'Ok' : '是',
				cancelText: that.state.userData.language == 'EN' ? 'cancel' : '否',
				onOk() {
					that.handleOrdSave({ type: 'callback', fn: () => that.handleConfirmTabChange(key) })
				},
				onCancel() {
					that.handleConfirmTabChange(key);
				}
			})
		} else {
			this.handleConfirmTabChange(key);
		}
	};

	handleConfirmTabChange = (key) => {
		this.setState({ diagActive: key }, () => {
			this.loadData();
		});
	};

	// 修改用药目的
	handleAntibioticClick = record => {
		const antibioticRecordData = record?.antibioticRecordData || {};
		const { configParams } = this.state;
		let tableData = JSON.parse(JSON.stringify(configParams?.antibioticIntent || []));
		let selectedRecrod = {};
		for (let i = 0; i < tableData.length; i++) {
			if (tableData[i].id === antibioticRecordData?.id) {
				tableData[i].pathogenIDArr = antibioticRecordData?.pathogenIDArr || [];
				selectedRecrod = tableData[i];
				break;
			}
		}
		this.setState({ purposeRecordData: record }, () => {
			// 默认勾选第一个
			this.antibioticsRef && this.antibioticsRef.modifyVisible(true, {
				tableData,
				selectData: {
					pathogenItem: configParams?.pathogenItem || [], // 病原微生物送检下拉数据
				},
				selectedRows: [selectedRecrod],
				selectedRowKeys: [antibioticRecordData?.id || ''],
				rowID: '',
				rowData: {},
			})
		})
	};

	// 合理用药
	handleRationalUse = async () => {
		try {
			const { patientData } = this.state;
			let data = {
				params: [{
					admID: patientData?.admID || ''
				}]
			}
			let res = await React.$asyncPost(this, '03050292', data);
			let result = res?.result || {};
			if (Object.prototype.toString.call(result) === '[object Object]' && JSON.stringify(result) !== '{}') {
				let paramsJSON = "{'inputDir':'" + "PASS4Client/HisPASS4InvokeAPI.dll" + "','clsName':'" + "HisPASS4InvokeAPI.PASS4InvokeAPI" + "','funcName':'" + "PASS4InvokeInfo" + "','dllInput':'" + JSON.stringify(result) + "'}";
				console.log(paramsJSON);
				if (typeof (CefSharp) != 'undefined') { // 定制浏览器
					CefSharp.BindObjectAsync('xysCefToJavaScripts');
					return new Promise((resolve, reject) => {
							//xysCefToJavaScripts.driveLocalHardware(paramsJSON).then((returnVale) => {  ;//反复加载卸载
							xysCefToJavaScripts.driveLocalHardwareNew(paramsJSON).then((returnVale) => {  //只加载第一次
								let res = JSON.parse(returnVale);
								// if (res.errorCode != '0') {
								// 	message.error(res.errorMessage)
								// }
								if (!!(res?.messageInfo)) {
									Modal.error({
										title: '异常提醒',
										content: res?.messageInfo || '',
										okText: '我知道了',
									})
								}
								// 保存调用结果
								this.handleSaveRationalMedicationResults(res?.result || {});
							})

					})
				}else {
					const frame = chrome?.webview?.hostObjects?.Bridge || ''; // 使用暴露的c#的对象
					return new Promise((resolve, reject) => {
						if (frame) {
							// 获取的属性是proxy promise;
							//frame.DynamicLoadingDLL(paramsJSON)  ;//反复加载卸载
							frame.DynamicDLL(paramsJSON)	//只加载第一次
								.then(
									res => {
										let result = JSON.parse(res);
										if (!!(res?.messageInfo)) {
											Modal.error({
												title: '异常提醒',
												content: res?.messageInfo || '',
												okText: '我知道了',
											})
										}
										// 保存调用结果
										this.handleSaveRationalMedicationResults(res?.result || {});
									},
									err => {
										console.log(err);
										message.error('动态库调用异常，请稍后再试！');
										Modal.error({
											title: '异常提醒',
											content: '动态库调用异常，请稍后再试！',
											okText: '我知道了',
										})
									}
								)
						} else {
							fetchJsonp('http://127.0.0.1:62534/XYSWCFService/DynamicLoadingDLL?' + '&input=' + paramsJSON, {
								jsonpCallback: 'JsonCallback',
								timeout: 500000,
							}).then(function (response) {
								return response.json()
							}).then(function (json) {
								resolve(JSON.parse(json));
								openYBModal.destroy(); // 弹框等待提示
							}).catch(function (err) {
								reject(err);
								message.error('动态库调用异常，请稍后再试！');
								openYBModal.destroy(); // 弹框等待提示
							})
						}
					})
				}
			}
		} catch (error) {
			console.log(error);
		}
	};

	// 保存合理用药调用结果
	handleSaveRationalMedicationResults = async (result) => {
		try {
			const { patientData } = this.state;
			let data = {
				params: [{
					admID: patientData?.admID || '',
					...result
				}]
			}
			let res = await React.$asyncPost(this, '03050294', data);
			console.log(res);
		} catch (error) {
			console.log(error);
		}
	};

	// 获取确认医嘱弹窗列表表头数据
	getConfirmMedColumns = async () => {
		try {
			let data = {
				params: [{
					compontName: 'HospitalConfirmMed',
					type: 'C',
				}]
			}
			let res = await React.$asyncPost(this, '01040073', data);
			let filterArr = res.result && res.result.C && Array.isArray(res.result.C) && res.result.C.length > 0 ? res.result.C.filter(function (item) { return item.display === 'Y' }) : [];
			if (filterArr && filterArr.length > 0) {
				this.setState({
					confirmMedColumns: filterArr,
					confirmMedTableWidth: res.totalWidth
				})
			}
		} catch (error) {
			console.log(error)
		}
	}

	// 住院医嘱录入需提示需保存的列表
	handleSubmitForConfirmation = () => {
		const { dataSource } = this.state;
		let medDataSource = [];
		let isSave = false;
		for (var i = 0; i < dataSource.length; i++) {
			if (Util.isEmpty(dataSource[i].ordID) && !Util.isEmpty(dataSource[i].medID)) {
				isSave = true
				medDataSource.push(dataSource[i]);
			}
		}
		if (isSave) {
			// this.setState({ confirmMedVisible: true, confirmMedLoading: true }, () => {
			this.getConfirmMedTableData(medDataSource);
			// })
		} else {
			message.error('没有需要保存的数据')
		}
	}

	// 获取确认信息
	getConfirmMedTableData = async (orderArr) => {
		try {
			let data = {
				params: [{
					orderArr
				}]
			}
			let res = await React.$asyncPost(this, '03050293', data);
			let tip = res?.result || '';
			confirm({
				title: '保存成功',
				content: (typeof (tip) === 'string' ? (tip + '，') : '') + '是否直接进行【计费】操作？',
				okText: '确认',
				cancelText: '取消',
				onOk: () => this.handleOrdSave(),
				onCancel: () => { },
			});
			// this.setState({
			// 	confirmMedTableData: res.result,
			// 	confirmMedLoading: false
			// })
		} catch (error) {
			console.log(error);
			// this.setState({
			// 	confirmMedTableData: [],
			// 	confirmMedLoading: false
			// })
		}
	}

	// 药品信息查询
	handleDrugInfoInquiry = async () => {
		try {
			const { patientData } = this.state;
			let data = {
				params: [{
					admID: patientData?.admID || ''
				}]
			}
			let res = await React.$asyncPost(this, '03050295', data);
			let result = res?.result || {};
			if (Object.prototype.toString.call(result) === '[object Object]' && JSON.stringify(result) !== '{}') {
				let paramsJSON = "{'inputDir':'" + "PASS4Client/HisPASS4InvokeAPI.dll" + "','clsName':'" + "HisPASS4InvokeAPI.PASS4InvokeAPI" + "','funcName':'" + "PASS4InvokeInfo" + "','dllInput':'" + JSON.stringify(result) + "'}";
				console.log(paramsJSON);
				if (typeof (CefSharp) != 'undefined') { // 定制浏览器
					CefSharp.BindObjectAsync('xysCefToJavaScripts');
					return new Promise((resolve, reject) => {
							//xysCefToJavaScripts.driveLocalHardware(paramsJSON).then((returnVale) => {  ;//反复加载卸载
							xysCefToJavaScripts.driveLocalHardwareNew(paramsJSON).then((returnVale) => {  //只加载第一次
								let res = JSON.parse(returnVale);
								if (!!(res?.messageInfo)) {
									Modal.error({
										title: '异常提醒',
										content: res?.messageInfo || '',
										okText: '我知道了',
									})
								}
							})

					})
				}else {
					const frame = chrome?.webview?.hostObjects?.Bridge || ''; // 使用暴露的c#的对象
					return new Promise((resolve, reject) => {
						if (frame) {
							// 获取的属性是proxy promise;
							//frame.DynamicLoadingDLL(paramsJSON)  ;//反复加载卸载
							frame.DynamicDLL(paramsJSON)	//只加载第一次
								.then(
									res => {
										let result = JSON.parse(res);
										if (!!(res?.messageInfo)) {
											Modal.error({
												title: '异常提醒',
												content: res?.messageInfo || '',
												okText: '我知道了',
											})
										}
									},
									err => {
										console.log(err);
										message.error('动态库调用异常，请稍后再试！');
										Modal.error({
											title: '异常提醒',
											content: '动态库调用异常，请稍后再试！'+err,
											okText: '我知道了',
										})
									}
								)
						} else {
							fetchJsonp('http://127.0.0.1:62534/XYSWCFService/DynamicLoadingDLL?' + '&input=' + paramsJSON, {
								jsonpCallback: 'JsonCallback',
								timeout: 500000,
							}).then(function (response) {
								return response.json()
							}).then(function (json) {
								resolve(JSON.parse(json));
								openYBModal.destroy(); // 弹框等待提示
							}).catch(function (err) {
								reject(err);
								message.error('动态库调用异常，请稍后再试！');
								openYBModal.destroy(); // 弹框等待提示
							})
						}
					})
				}








			}
		} catch (error) {
			console.log(error);
		}
	}

	render() {
		const { ids, dataSource, page, total, top, left, selectData, medItemTop, medItemLeft, medicalInsuranceData, discountShow, patientData, titleData, insertMethod, dynLoading,
			ordDocList, ordDocID, currentLocData, userLoginLoc, userData, ordPriorityID, orderPrint, priorReviewFlag, prescriptionMaxDate, discountFlag, discountSubCatID, diagTabData,
			diagActive, isExistRecord, confirmMedVisible, confirmMedColumns, confirmMedTableWidth, confirmMedTableData, confirmMedLoading,PASS4Flag
		} = this.state;
		const rowSelection = {
			ids,
			onChange: this.onSelectChange.bind(this),
			onSelect: this.onSelect.bind(this),
			onSelectAll: this.onSelectAll.bind(this),
			onSelectInvert: this.onSelectInvert.bind(this),
			selectedRowKeys: ids,
			getCheckboxProps: record => ({
				disabled: record.ordSelectFlag === 'N',
			}),
		};

		let param = {
			width: document.body.clientWidth < 1400 ? '600px' : '96vh',
			height: document.body.clientWidth < 1400 ? '360px' : '',
			top: document.body.clientWidth < 1400 ? '85px' : top,
			left: document.body.clientWidth < 1400 ? '640px' : left,
			columns: this.sunColumns,
			data: selectData,
			isOnRow: true,
			TableClassName: 'tab-placeholder',
			rowClassName: true,
			showPagination: true,
			page,
			total,
		};

		let writtenOrdersParams = {
			top,
			left
		};

		var sum = 0;
		if (dataSource) {
			for (var i = 0; i < dataSource.length; i++) {
				if (Util.isEmpty(dataSource[i].ordID) && !Util.isEmpty(dataSource[i].ordQty)) {
					// var totalNum = 0;//总次数
					// var totalDosc = 0;//总剂量
					// var oneDosc = 0;//剂量
					// var totala = 0
					// if (Util.isEmpty(dataSource[i].duraFactor) || Util.isEmpty(dataSource[i].ordDurQty) || Util.isEmpty(dataSource[i].frequency) ||
					//     Util.isEmpty(dataSource[i].cycleDays) || Util.isEmpty(dataSource[i].ordDose) || Util.isEmpty(dataSource[i].doseMolecule)
					//     || Util.isEmpty(dataSource[i].doseDenominator) || Util.isEmpty(dataSource[i].doseDenominator)) {
					//     sum += parseFloat(dataSource[i].ordPrice || 1) * (parseFloat(dataSource[i].qtyStatus == '1' ? (dataSource[i].ordQty || 1) : totala))
					// } else {
					//     if (dataSource[i].cycleDays) {//优先使用cycleDays，计算总次数
					//         totalNum = Math.ceil((parseFloat(dataSource[i].ordDurQty || 1) * parseFloat(dataSource[i].duraFactor || 1) * parseFloat(dataSource[i].frequency || 1)) / parseFloat(dataSource[i].cycleDays) > 0 ? parseFloat(dataSource[i].cycleDays) : 1)
					//     } else {
					//         totalNum = Math.ceil((parseFloat(dataSource[i].ordDurQty || 1) * parseFloat(dataSource[i].duraFactor || 1) * parseFloat(dataSource[i].frequency || 1)) / parseFloat(dataSource[i].intervalDays) > 0 ? parseFloat(dataSource[i].intervalDays) : 1)
					//     }
					//     //门诊
					//     if (dataSource[i].ordToalCountO == 'Y') {
					//         totalDosc = Math.ceil((parseFloat(dataSource[i].ordDose || 1) * totalNum * parseFloat(dataSource[i].doseMolecule || 1)) / (parseFloat(dataSource[i].doseDenominator) > 0 ? parseFloat(dataSource[i].doseDenominator) : 1))
					//     } else {//先取整，再算
					//         oneDosc = Math.ceil((parseFloat(dataSource[i].ordDose || 1) * parseFloat(dataSource[i].doseMolecule || 1)) / (parseFloat(dataSource[i].doseDenominator) > 0 ? parseFloat(dataSource[i].doseDenominator) : 1))
					//         totalDosc = oneDosc * totalNum
					//     }
					//     if (this.props.patStatus == '1') {
					//         if (dataSource[i].ordToalCountI == 'Y') {
					//             totalDosc = Math.ceil((parseFloat(dataSource[i].ordDose || 1) * totalNum * parseFloat(dataSource[i].doseMolecule || 1)) / (parseFloat(dataSource[i].doseDenominator) > 0 ? parseFloat(dataSource[i].doseDenominator) : 1))
					//         } else {
					//             oneDosc = Math.ceil((parseFloat(dataSource[i].ordDose || 1) * parseFloat(dataSource[i].doseMolecule || 1)) / (parseFloat(dataSource[i].doseDenominator) > 0 ? parseFloat(dataSource[i].doseDenominator) : 1))
					//             totalDosc = oneDosc * totalNum
					//         }
					//     }
					//     totala = (totalDosc * parseFloat(dataSource[i].doseMolecule || 1)) / parseFloat(dataSource[i].qtyDenominator || 1)
					sum += parseFloat(dataSource[i].ordPrice || 1) * (parseFloat(dataSource[i].qtyStatus == '1' ? (dataSource[i].ordQty ? dataSource[i].ordQty : 0) : dataSource[i].ordQty ? dataSource[i].ordQty : 0))
					// }
				}
			}
		}
		var moduleDataOption = []
		if (this.state.moduleData) {
			this.state.moduleData && this.state.moduleData.map((item, index) => {
				moduleDataOption.push(
					<Radio value={item.id} key={item.id}>{item.descripts}</Radio>
				)
			})
		}

		//套餐
		var packageDataOption = []
		this.state.packageData && this.state.packageData.map((item, index) => {
			packageDataOption.push(
				<Radio value={item.id} key={item.id}>{item.descripts}</Radio>
			)
		})

		const SortableItem = sortableElement(({ value, width, count, hide, dataIndex }) => {
			return <Col {...searchColConfig} style={{ zIndex: 1000000 }}><div className='draggable-style'>
				<div className={this.state.positionCol && value == this.state.searchColumn ? 'position-col-style' : ''}
					style={{ background: '#e9f7fe' }}>
					<Checkbox checked={hide == 'N' ? true : false} onChange={this.changeCommonCheckbox.bind(this, dataIndex)} />
					<span style={{ width: 90, marginLeft: 5, marginTop: 5 }}>{value}</span>
					{/* <Input ref={this.inputRef} defaultValue={width} style={{ marginTop: 5, width: '77%' }} onChange={this.changeCommonWidth.bind(this, dataIndex)} /> */}
					<Input defaultValue={width} style={{ marginTop: 5, width: '77%' }} onBlur={this.changeCommonWidth.bind(this, dataIndex)} />
				</div>
			</div></Col>
		});

		const SortableContainer = sortableContainer(({ items }) => {
			return <Row style={{ paddingTop: 20 }}><div> {items.map((value, index) => (
				<SortableItem key={value.dataIndex} index={index} value={value.title} width={value.width}
					count={value.count} hide={value.hide} dataIndex={value.dataIndex} />
			))}</div></Row>
		});

		const locMenuData = (
			<Menu>
				{userLoginLoc && userLoginLoc.map((item, index) => {
					return (
						<Menu.Item key={index} onClick={() => this.handleMenuItemChange(item)}>
							<span>{item.locDesc}</span>
						</Menu.Item>
					)
				})}
			</Menu>
		);
		return <Spin spinning={this.state.saveStatus} tip="正在保存，请耐心等待...">
			<div
				tabIndex={1}
				className="doctor-step-body"
				style={{ background: '#f5f4f4', height: '100%', outline: 'none' }}
				onKeyDown={this.handleOnKeydown.bind(this)}
			>
				{/**列input框新表格弹框 */}
				<div className='doctor-advice-common-modal'>
					<ShowCommonTableModal onClickRowPublic={this.onClickRowPublic}
						setRowClassNamePublic={this.setRowClassNamePublic}
						isShow={this.state.isShowCommonTableModal}
						handleFocus={this.handleFocus.bind(this)}
						onHide={this.hideModal.bind(this, 'isShowCommonTableModal')}
						param={param}
						onRef={this.onRef}
						loading={this.state.loading}
						search={this.state.search}
						id="gundong"
						compilePage={this.changePageSize.bind(this)}>
					</ShowCommonTableModal>
				</div>

				{/**自备药 */}
				<BringMedicineModal isShow={this.state.showBringMedicineModal}
					onSubmit={this.loadBringMedchine.bind(this)}
					onHide={this.hideModal.bind(this, 'showBringMedicineModal')}>
				</BringMedicineModal>

				{/**引用弹框 */}
				{this.props.patStatus == '1' ? null : <CopyTextModal isShow={this.state.isCopyTextModal}
					onSubmit={this.onCopyText.bind(this)}
					onHide={this.hideModal.bind(this, 'isCopyTextModal')}>
				</CopyTextModal>}

				{/**添加模板 */}
				<AddTemplateModal isShow={this.state.isAddTemplateModal}
					onSubmit={this.onAddTemplateMOdal.bind(this)}
					onHide={this.hideModal.bind(this, 'isAddTemplateModal')}>
				</AddTemplateModal>

				{/**添加套餐 */}
				<AddPackageModal isShow={this.state.isAddPackageModal}
					onSubmit={this.onAddPackageModal.bind(this)}
					onHide={this.hideModal.bind(this, 'isAddPackageModal')}>
				</AddPackageModal>

				{/**确认医嘱弹框 */}
				<ShowConfirmModal isShow={this.state.isShowConfirmModal}
					confirmData={this.state.confirmData}
					errorData={this.state.errorData}
					code={this.state.codeModal}
					adviceDrData={this.state.adviceDrData}
					onSubmit={this.handleOnSubmitAdvice.bind(this)}
					onHide={this.hideModal.bind(this, 'isShowConfirmModal')}>
				</ShowConfirmModal>

				{/**开毒麻精弹框 */}
				<ShowPosionStatusModal isShow={this.state.isShowPosionStatusModal}
					onSubmit={this.submitPostionMsg.bind(this)}
					onHide={this.hideModal.bind(this, 'isShowPosionStatusModal')}>
				</ShowPosionStatusModal>

				{/**检查申请单弹框 */}
				<ShowExamlistModal isShow={this.state.isShowExamlistModal}
					examList={this.state.examList}
					onSubmit={this.saveCheckParts.bind(this)}
					onHide={this.hideModal.bind(this, 'isShowExamlistModal')}>
				</ShowExamlistModal>

				{/**录入治疗申请单 */}
				<ShowEnterTreatmentModal isShow={this.state.isShowEnterTreatmentModal}
					cureAppIDs={this.state.cureAppIDs}
					onSubmit={this.onSubmitTreatment.bind(this)}
					onHide={this.hideModal.bind(this, 'isShowEnterTreatmentModal')}>
				</ShowEnterTreatmentModal>

				{/**治疗预约 */}
				<ShowConfirmApplicationModal isShow={this.state.isShowConfirmApplicationModal}
					cureConAppID={this.state.cureAppIDs}
					admID={this.state.admID}
					flag={'doctor'}
					onHide={this.hideAppListModal.bind(this, 'isShowConfirmApplicationModal')}>
				</ShowConfirmApplicationModal>

				{/**自费、医保弹框 */}
				{this.state.isShowInsuMessageModal ?
					<ShowInsuMessageModal isShow={this.state.isShowInsuMessageModal}
						insuSource={this.state.insuSource}
						onHide={this.hideInsuModal.bind(this)}>
					</ShowInsuMessageModal> : null}

				{/**自费、医保医嘱套弹框 */}
				{this.state.isShowInsuPackageModal ?
					<ShowInsuPackageModal isShow={this.state.isShowInsuPackageModal}
						insuSource={this.state.insuSource}
						packageSource={this.state.packageSource}
						onHide={this.hidePackageModal.bind(this)}>
					</ShowInsuPackageModal> : null}

				{/* 收银弹框显示 */}
				<Modal
					visible={this.state.payModalVis}
					onCancel={this.handleCancelMoney}
					onOk={this.handleOK}
					width='600px'
					title="收银"
				>  <div>
						<PayContentModal ref={this.PayContenRef} accountID={this.state.accountID} admIDinfo={this.state.patientData ? this.state.patientData.admID : ''} chargeordIDinfo={this.state.chargeordIDinfo} key={this.state.chargeordIDinfo} handleCallback={this.handleCallback}></PayContentModal>
					</div>

				</Modal>

				{/* 医保信息展示 */}
				<Modal
					title=""
					visible={this.state.popoverVisible}
					onCancel={() => this.setState({ popoverVisible: false })}
					mask={false}
					closable={true}
					footer={null}
					width="300px"
					style={{ position: 'absolute', top: medItemTop ? medItemTop : '40%', left: medItemLeft ? medItemLeft : '40%', boxShadow: '0px 1px 4px rgba(0,0,0,0.3), 0px 0px 20px rgba(0,0,0,0.1) inset', paddingBottom: '0' }}
					wrapClassName="dasp-popover-modal"
				>
					<div className="dasp-popover-modal-content" onClick={this.stopPropagation}>
						{medicalInsuranceData && medicalInsuranceData.map((item, index) => {
							return (
								<div key={index} className="dasp-popover-modal-content-item">
									<p>收费项代码：<span>{item?.chargeItemCode}</span></p>
									<p>收费项描述：<span>{item?.chargeItemDesc}</span></p>
									<p>医保代码：<span>{item?.insuItemCode}</span></p>
									<p>医保描述：<span>{item?.insuItemDesc}</span></p>
								</div>
							)
						})}
					</div>
				</Modal>
				{this.props.patStatus == '1' ? null : this.state.moduleStatus ?
					<Card style={{
						width: '1.58%', height: store.getState().tableHeight.y + 117 + 'px', float: 'left', background: '#f5f4f4'
						, cursor: 'pointer', paddingTop: 200, textAlign: 'center'
					}} hoverable={true} onClick={this.showModule.bind(this)}>
						<div className='change-card-icon-show'><Tooltip title={this.setMessage('DoctorAdviceListPageShow', 'descripts')}>
							<Icon type='double-right' style={{ fontSize: '18px' }} /></Tooltip></div>{this.setMessage('DoctorAdviceListPageShow', 'descripts')}</Card> :
					<Card
						style={{ float: 'left', width: '13.8%' }}
						hoverable={true}
						title={this.state.activeKey == '1' ? <span style={{ marginLeft: 10 }}><img src={doctorOrder} style={{ marginRight: 5 }} />{'医嘱套'}</span> :
							<span style={{ marginLeft: 10 }}><img src={doctorOrder} style={{ marginRight: 5 }} />{this.setMessage('DoctorAdviceListPageMedicalTemplate', 'descripts')}</span>}
						extra={(
							this.state.activeKey == '1' ? null : (
								<Dropdown overlay={locMenuData}>
									<span className="span" style={{ color: '#333' }}>
										{currentLocData?.locDesc || userData?.locDesc}
										<Icon type="down" />
									</span>
								</Dropdown>
							)
						)}
					>
						<div className='doctor-tree-tabs'>
							<Tabs onChange={this.changeActiveKey.bind(this)} activeKey={this.state.activeKey}>
								<TabPane tab='医嘱套' key='1'>
									<div className='doctor-left-radio'>
										<Radio.Group value={this.state.authRangeID}
											onChange={this.changePackageRadio.bind(this, 'authRangeID')}>
											{packageDataOption}
										</Radio.Group>
									</div>
									{this.state.packageMsg && this.state.packageMsg.length > 0 ? (
										<div style={{ height: store.getState().tableHeight.y + 50 + 'px', overflow: 'auto' }}>
											<Tree
												defaultExpandAll={true}
												defaultExpandedKeys={['1']}
												checkedKeys={this.state.newCode}
												onCheck={this.checkTreeNode.bind(this)}
												onClick={this.onExpand.bind(this)}
												onExpand={this.onExpandIcon.bind(this)}
												expandedKeys={this.state.expandedKeys}
												onDoubleClick={this.loadPackageTempTableData.bind(this, 'temp')}>
												{this.loadPackageTemplate()}
											</Tree>
										</div>
									) :
										<div style={{ marginLeft: '25%', marginTop: 40 }}>
											<span style={{ color: 'red', fontSize: '16px' }}>{this.setMessage('DoctorAdviceListPageYet', 'descripts')}</span></div>}
								</TabPane>
								<TabPane tab='医嘱模板' key='2'>
									<div style={{ position: 'relative', paddingBottom: '46px' }}>
										<div className='doctor-left-radio'>
											<Radio.Group value={this.state.radioValue}
												onChange={this.changeRadio.bind(this)}>
												{moduleDataOption}
											</Radio.Group>
										</div>
										{this.state.templateData && this.state.templateData.length > 0 ? (
											<>
												<div style={{ height: store.getState().tableHeight.y + 2 + 'px', overflow: 'auto' }}>
													<Tree
														checkable defaultExpandAll={true}
														defaultExpandedKeys={['1']}
														checkedKeys={this.state.newCode}
														onCheck={this.checkTreeNode.bind(this)}
														onClick={this.onExpand.bind(this)}
														onExpand={this.onExpandIcon.bind(this)}
														expandedKeys={this.state.expandedKeys}
														onDoubleClick={this.loadTempTableData.bind(this, 'temp')}
													>
														{this.loadTemplate()}
													</Tree>
												</div>
												<div style={{ position: 'absolute', bottom: '6px', left: 0, width: '100%', padding: '0 12px' }}>
													{/* 批量添加 */}
													<Button block onClick={this.batchAddTemplate.bind(this)}>{this.setMessage('DoctorAdviceListPageAddBatch', 'descripts')}</Button>
												</div>
											</>
										) : (
											<div style={{ height: store.getState().tableHeight.y - 33 + 'px', marginLeft: '25%', marginTop: 40 }}>
												<span style={{ color: 'red', fontSize: '16px' }}>{this.setMessage('DoctorAdviceListPageYet', 'descripts')}</span>
											</div>
										)}
									</div>
								</TabPane>
							</Tabs>
							{<div className='change-card-icon' onClick={this.hideModule.bind(this)}><Tooltip title={this.setMessage('DoctorAdviceListPageHide', 'descripts')}>
								<Icon type='double-left' style={{ fontSize: '18px' }} /></Tooltip></div>}
						</div>
					</Card>}
				<Card
					style={{
						float: 'right',
						width: this.state.moduleStatus ? '98%' : (this.props.patStatus == '1' ? '100%' : '85.8%'),
						border: this.props.patStatus == '1' ? 0 : '1px solid #e8e8e8'
					}}
					title={this.props.patStatus == '1' ? null : <div><div style={{ float: 'left' }}>
						<span style={{ marginLeft: 10 }}>
							<span style={{ color: '#666666' }}>{this.setMessage('DoctorAdviceListPageCurrentTotal', 'descripts')}</span>
							<span>{this.state.totalFee ? (parseFloat(this.state.totalFee) + sum).toFixed(2) : 0}</span>
						</span>
						<span style={{ marginLeft: 20 }}>
							<span style={{ color: '#666666' }}>{this.setMessage('DoctorAdviceListPageUncharge', 'descripts')}</span>
							<span style={{ color: '#EE9F00' }}>{(sum + parseFloat(this.state.unFree ? this.state.unFree : 0)).toFixed(2) || 0}</span>
						</span>
						<span style={{ marginLeft: 10 }}>
							<span style={{ color: '#666666' }}>本科室费用 (元): </span>
							<span>{this.state.locFree ? (parseFloat(this.state.locFree) + sum).toFixed(2) : 0}</span>
						</span>
						{!Util.isEmpty(this.state.titleData) && this.state.titleData.admTypeCode == 'W' ? null : <span style={{ marginLeft: 20 }}>
							<Button size='small' style={{ border: '1px solid #1999db', color: '#1999db' }} onClick={(e) => this.payModal(e)}
								disabled={!Util.isEmpty(this.state.disMessage) || this.state.disBtn == 'N'}>
								{this.setMessage('DoctorAdviceListPageCardConsumption', 'descripts')}</Button>
						</span>}
						<Icon className='doctor-table-title-splice' />
						<span>
							<span style={{ color: 'red' }}>{this.setMessage('DoctorAdviceListPageTips', 'descripts')}</span>
							<div style={{ maxWidth: '120px' }} className="tool-title-span">
								<Tooltip title={this.state.ordMessage}>
									<span style={{ width: '100%', display: 'inline-block' }} className="ellipsis">{this.state.ordMessage}</span>
								</Tooltip>
							</div>
						</span>
						{/* <Checkbox style={{ margin: '0 12px 0 6px' }} checked={helpMediCineFlag == '1' ? true : false} onChange={(e) => this.handleInputChange('helpMediCineFlag', e.target.checked ? '1' : '')}>代开药</Checkbox>
						<Radio.Group value={recipeType} onChange={(e) => this.handleInputChange('recipeType', e.target.value)}>
							<Radio value="1">保内</Radio>
							<Radio value="2">保外</Radio>
						</Radio.Group> */}
					</div>
						{/* <div style={{ float: 'right', marginRight: 20 }}>
                          <span style={{ color: '#1890FF', cursor: 'pointer' }} onClick={this.goCMRrderSave.bind(this)}>{this.setMessage('DoctorAdviceListPageHerbalEntry', 'descripts')}</span>
                          <Divider type="vertical" />
                          {!Util.isEmpty(this.state.disMessage) || this.state.disBtn == 'N' ?
                              <span style={{ color: 'rgba(0, 0, 0, 0.25)' }}>{this.setMessage('DoctorAdviceListPageRequisition', 'descripts')}</span>
                              : <span style={{ color: '#1890FF', cursor: 'pointer' }}
                                  onClick={() => this.goDoctorAdviceStepPage(3)}>{this.setMessage('DoctorAdviceListPageRequisition', 'descripts')}</span>}
                      </div> */}
						<div style={{ float: 'right', marginRight: 12 }}>
							<Radio.Group value={this.state.defaultBtn} buttonStyle="solid" onChange={this.handleChangeBtn.bind(this, 'defaultBtn')}>
								<Radio.Button value={2}>西药及其他</Radio.Button>
								<Radio.Button value={1}>{this.setMessage('DoctorAdviceListPageHerbalEntry', 'descripts')}</Radio.Button>
								<Radio.Button value={3} disabled={!Util.isEmpty(this.state.disMessage) || this.state.disBtn == 'N'}>
									{this.setMessage('DoctorAdviceListPageRequisition', 'descripts')}</Radio.Button>
							</Radio.Group>
						</div>
					</div>}>
					{this.state.hideAdviceList ? <div>
						<span>
							<Icon className={this.state.hideAdviceList === true ? 'hospital-advice-list-hide' : 'hospital-advice-list-show'} style={{ float: 'left' }}
								onClick={this.handleHideAdviceList.bind(this)} />
							<span>
								<span className='hospital-line-left' style={{ marginRight: 10, marginLeft: 10 }}></span>
								<span style={{ lineHeight: '32px', color: '#007AFF' }}>医嘱录入</span></span>
						</span>
					</div> :
						<div
							style={{
								height: this.props.patStatus == '1' && this.state.hideAdviceList === false && this.props.hideStatus === false ? (this.props.heightVH ? this.props.heightVH + 'vh' : '32vh') :
									store.getState().tableHeight.y + 128 + 'px',
								overflow: 'auto'
							}}
							className="doctor-tree-tabs"
						>
							{diagTabData && diagTabData.length > 0 && isExistRecord === 'Y' ? (
								<>
									<Tabs activeKey={diagActive} onChange={this.handleDiagTabChange}>
										{diagTabData && diagTabData.map((item, index) => {
											return (
												<TabPane tab={item?.diagDesc || ''} key={String(index + 1)}></TabPane>
											)
										})}
									</Tabs>
									<Table columns={this.state.dynColumns}
										style={{
											height: this.props.patStatus == '1' && this.state.hideAdviceList === false && this.props.hideStatus === false ? (this.props.heightVH ? this.props.heightVH + 'vh' : '22vh') :
												store.getState().tableHeight.y - 50 + 'px'
										}}
										loading={dynLoading}
										dataSource={this.state.dataSource}
										// className={document.body.clientWidth > 1900 ? 'doctor-redirect-width' : 'doctor-redir-width'}
										loadData={this.loadData.bind(this)}
										rowSelection={rowSelection}
										onRow={this.setElement}
										rowClassName={(data) => {
											return data.ordBilledCode == 'P' ? 'rowClassStyle' : (data.billFlag === "Y" ? "rowBillClassStyle" : '')
										}}
										scroll={{
											x: this.state.totalWidth + 200,
											y: this.props.patStatus == '1' && this.state.hideAdviceList === false && this.props.hideStatus === false ? (this.props.heightVH ? (this.props.heightVH - 2 + 'vh') : '17vh') :
												store.getState().tableHeight.y - 10
										}}
										bordered
										title={() => {
											return <div style={{ height: 40, lineHeight: '40px', paddingRight: 12 }}>
												{this.props.patStatus == '1' && this.props.componentSourse !== 'EMR' ? (
													<span>
														<Icon
															className={this.state.hideAdviceList === true ? 'hospital-advice-list-hide' : 'hospital-advice-list-show'}
															style={{ float: 'left' }}
															onClick={this.handleHideAdviceList.bind(this)}
														/>
														<span className='hospital-line-left' style={{ marginRight: 10, marginLeft: 10 }}></span>
														<span style={{ lineHeight: '32px', color: '#007AFF' }}>医嘱录入</span>
													</span>
												) : null}
												<span style={{ cursor: !Util.isEmpty(this.state.disMessage) || this.state.disBtn == 'N' ? 'not-allowed' : 'pointer' }} className={this.state.indexStyle == '1' ? 'mouse-add-Style' : ''}
													onClick={!Util.isEmpty(this.state.disMessage) ? this.loadDisOpertion.bind(this) : (this.state.disBtn == 'N' ? '' : this.addMechansim.bind(this))}
													onMouseLeave={!Util.isEmpty(this.state.disMessage) || this.state.disBtn == 'N' ? '' : this.addMouseLeaveStyle.bind(this)}
													onMouseOver={!Util.isEmpty(this.state.disMessage) || this.state.disBtn == 'N' ? '' : this.addMouseOverStyle.bind(this, '1')}>
													<Icon className='doctor-add-splice' />
													<span>{this.setMessage('DoctorAdviceListPageAdd', 'descripts') + '(F1)'}</span>
												</span><Divider type="vertical" />
												<span style={{ cursor: !Util.isEmpty(this.state.disMessage) || this.state.disBtn == 'N' ? 'not-allowed' : 'pointer' }} className={this.state.indexStyle == '2' ? 'mouse-add-Style' : ''}
													onClick={!Util.isEmpty(this.state.disMessage) ? this.loadDisOpertion.bind(this) : (this.state.disBtn == 'N' ? '' : this.delMechansim.bind(this))}
													onMouseLeave={!Util.isEmpty(this.state.disMessage) || this.state.disBtn == 'N' ? '' : this.addMouseLeaveStyle.bind(this)}
													onMouseOver={!Util.isEmpty(this.state.disMessage) || this.state.disBtn == 'N' ? '' : this.addMouseOverStyle.bind(this, '2')}>
													<Icon className='doctor-delete-splice' />
													<span>{this.setMessage('DoctorAdviceListPageDelete', 'descripts')}</span>
												</span><Divider type="vertical" />
												{/* 修改 */}
												{this.props.patStatus == '1' ? null : (
													<>
														<span
															style={{ cursor: !Util.isEmpty(this.state.disMessage) || this.state.disBtn == 'N' ? 'not-allowed' : 'pointer' }}
															className={this.state.indexStyle == '0' ? 'mouse-add-Style' : ''}
															onClick={!Util.isEmpty(this.state.disMessage) ? this.loadDisOpertion.bind(this) : (this.state.disBtn == 'N' ? '' : this.handleModifyMechansim)}
															onMouseLeave={!Util.isEmpty(this.state.disMessage) || this.state.disBtn == 'N' ? '' : this.addMouseLeaveStyle.bind(this)}
															onMouseOver={!Util.isEmpty(this.state.disMessage) || this.state.disBtn == 'N' ? '' : this.addMouseOverStyle.bind(this, '0')}
														>
															<Icon className='doctor-save-splice' />
															<span>修改</span>
														</span>
														<Divider type="vertical" />
													</>
												)}
												{!Util.isEmpty(this.state.titleData) && this.state.titleData.admTypeCode == 'W' ? null : <span>
													<span style={{ cursor: !Util.isEmpty(this.state.disMessage) || this.state.disBtn == 'N' ? 'not-allowed' : 'pointer' }} className={this.state.indexStyle == '3' ? 'mouse-add-Style' : ''}
														onMouseLeave={!Util.isEmpty(this.state.disMessage) || this.state.disBtn == 'N' ? '' : this.addMouseLeaveStyle.bind(this)}
														onClick={!Util.isEmpty(this.state.disMessage) ? this.loadDisOpertion.bind(this) : (this.state.disBtn == 'N' ? '' : this.handleUpSort.bind(this))}
														onMouseOver={!Util.isEmpty(this.state.disMessage) || this.state.disBtn == 'N' ? '' : this.addMouseOverStyle.bind(this, '3')}>
														<Icon className='doctor-up-splice' />
														<span>{this.setMessage('DoctorAdviceListPageMoveUp', 'descripts')}</span>
													</span><Divider type="vertical" />
													<span style={{ cursor: !Util.isEmpty(this.state.disMessage) || this.state.disBtn == 'N' ? 'not-allowed' : 'pointer' }} className={this.state.indexStyle == '4' ? 'mouse-add-Style' : ''}
														onMouseLeave={!Util.isEmpty(this.state.disMessage) || this.state.disBtn == 'N' ? '' : this.addMouseLeaveStyle.bind(this)}
														onClick={!Util.isEmpty(this.state.disMessage) ? this.loadDisOpertion.bind(this) : (this.state.disBtn == 'N' ? '' : this.handleDownSort.bind(this))}
														onMouseOver={!Util.isEmpty(this.state.disMessage) || this.state.disBtn == 'N' ? '' : this.addMouseOverStyle.bind(this, '4')}>
														<Icon className='doctor-down-splice' />
														<span>{this.setMessage('DoctorAdviceListPageMoveDown', 'descripts')}</span>
													</span><Divider type="vertical" />
													<span style={{ cursor: !Util.isEmpty(this.state.disMessage) || this.state.disBtn == 'N' ? 'not-allowed' : 'pointer' }} className={this.state.indexStyle == '5' ? 'mouse-add-Style' : ''}
														onMouseLeave={!Util.isEmpty(this.state.disMessage) || this.state.disBtn == 'N' ? '' : this.addMouseLeaveStyle.bind(this)}
														onClick={!Util.isEmpty(this.state.disMessage) ? this.loadDisOpertion.bind(this) : (this.state.disBtn == 'N' ? '' : this.handleStartGroup.bind(this))}
														onMouseOver={!Util.isEmpty(this.state.disMessage) || this.state.disBtn == 'N' ? '' : this.addMouseOverStyle.bind(this, '5')}>
														<Icon className='doctor-group-splice' />
														<span>{this.setMessage('DoctorAdviceListPageStartGrouping', 'descripts')}</span>
													</span><Divider type="vertical" />
													<span style={{ cursor: !Util.isEmpty(this.state.disMessage) || this.state.disBtn == 'N' ? 'not-allowed' : 'pointer' }} className={this.state.indexStyle == '6' ? 'mouse-add-Style' : ''}
														onMouseLeave={!Util.isEmpty(this.state.disMessage) || this.state.disBtn == 'N' ? '' : this.addMouseLeaveStyle.bind(this)}
														onClick={!Util.isEmpty(this.state.disMessage) ? this.loadDisOpertion.bind(this) : (this.state.disBtn == 'N' ? '' : this.handleCannelGroup.bind(this))}
														onMouseOver={!Util.isEmpty(this.state.disMessage) || this.state.disBtn == 'N' ? '' : this.addMouseOverStyle.bind(this, '6')}>
														<Icon className='doctor-cannel-group-splice' />
														<span>{this.setMessage('DoctorAdviceListPageEndGroup', 'descripts')}</span>
													</span><Divider type="vertical" />
												</span>}
												{this.props.patStatus == '1' ? null : <span><span style={{ cursor: !Util.isEmpty(this.state.disMessage) || this.state.disBtn == 'N' ? 'not-allowed' : 'pointer' }}
													onClick={!Util.isEmpty(this.state.disMessage) ? this.loadDisOpertion.bind(this) : (this.state.disBtn == 'N' ? '' : this.showCopyTextModal.bind(this))}
													className={this.state.indexStyle == '7' ? 'mouse-add-Style' : ''}
													onMouseLeave={!Util.isEmpty(this.state.disMessage) || this.state.disBtn == 'N' ? '' : this.addMouseLeaveStyle.bind(this)}
													onMouseOver={!Util.isEmpty(this.state.disMessage) || this.state.disBtn == 'N' ? '' : this.addMouseOverStyle.bind(this, '7')}>
													<Icon className='doctor-copy-splice' />
													<span>{this.setMessage('DoctorAdviceListPageReference', 'descripts')}</span>
												</span><Divider type="vertical" /></span>}
												{/**模板库 */}
												{this.props.patStatus == '1' ? <span><span style={{ cursor: !Util.isEmpty(this.state.disMessage) || this.state.disBtn == 'N' ? 'not-allowed' : 'pointer' }}
													onClick={!Util.isEmpty(this.state.disMessage) ? this.loadDisOpertion.bind(this) : (this.state.disBtn == 'N' ? '' : this.showModuleData.bind(this))}
													className={this.state.indexStyle == '7' ? 'mouse-add-Style' : ''}
													onMouseLeave={!Util.isEmpty(this.state.disMessage) || this.state.disBtn == 'N' ? '' : this.addMouseLeaveStyle.bind(this)}
													onMouseOver={!Util.isEmpty(this.state.disMessage) || this.state.disBtn == 'N' ? '' : this.addMouseOverStyle.bind(this, '7')}>
													<Icon className='doctor-copy-splice' />
													<span>模板库</span>
												</span><Divider type="vertical" /></span> : null}
												{/* 添加模板 */}
												<span style={{ cursor: !Util.isEmpty(this.state.disMessage) || this.state.disBtn == 'N' ? 'not-allowed' : 'pointer' }}
													onClick={!Util.isEmpty(this.state.disMessage) ? this.loadDisOpertion.bind(this) : (this.state.disBtn == 'N' ? '' : this.addTemplateModal.bind(this))}
													className={this.state.indexStyle == '8' ? 'mouse-add-Style' : ''}
													onMouseLeave={!Util.isEmpty(this.state.disMessage) || this.state.disBtn == 'N' ? '' : this.addMouseLeaveStyle.bind(this)}
													onMouseOver={!Util.isEmpty(this.state.disMessage) || this.state.disBtn == 'N' ? '' : this.addMouseOverStyle.bind(this, '8')}>
													<Icon className='doctor-plus-square-splice' />
													<span>{this.setMessage('DoctorAdviceListPageAddTemplate', 'descripts')}</span>
												</span><Divider type="vertical" />
												{/* 添加套餐 */}
												{/*<span style={{ cursor: !Util.isEmpty(this.state.disMessage) || this.state.disBtn == 'N' ? 'not-allowed' : 'pointer' }}*/}
												{/*	onClick={!Util.isEmpty(this.state.disMessage) ? this.loadDisOpertion.bind(this) : (this.state.disBtn == 'N' ? '' : this.addPackageModal.bind(this))}*/}
												{/*	className={this.state.indexStyle == '9' ? 'mouse-add-Style' : ''}*/}
												{/*	onMouseLeave={!Util.isEmpty(this.state.disMessage) || this.state.disBtn == 'N' ? '' : this.addMouseLeaveStyle.bind(this)}*/}
												{/*	onMouseOver={!Util.isEmpty(this.state.disMessage) || this.state.disBtn == 'N' ? '' : this.addMouseOverStyle.bind(this, '9')}>*/}
												{/*	<Icon className='doctor-menu-unfold-splice' />*/}
												{/*	<span>{this.setMessage('DoctorAdviceListPageAddPackage', 'descripts')}</span>*/}
												{/*</span><Divider type="vertical" />*/}
												{/* 文字医嘱 */}
												{this.props.patStatus == '1' ? (
													<>
														<span
															style={{ cursor: !Util.isEmpty(this.state.disMessage) || this.state.disBtn == 'N' ? 'not-allowed' : 'pointer' }}
															onClick={!Util.isEmpty(this.state.disMessage) ? this.loadDisOpertion.bind(this) : (this.state.disBtn == 'N' ? '' : this.handleInputModeSwitching)}
															className={this.state.indexStyle == '10' ? 'mouse-add-Style' : ''}
															onMouseLeave={!Util.isEmpty(this.state.disMessage) || this.state.disBtn == 'N' ? '' : this.addMouseLeaveStyle.bind(this)}
															onMouseOver={!Util.isEmpty(this.state.disMessage) || this.state.disBtn == 'N' ? '' : this.addMouseOverStyle.bind(this, '10')}>
															<Icon style={{ color: '#ff6462', marginRight: '4px' }} type="font-size" />
															<span>文字医嘱(F4)</span>
														</span>
														<Divider type="vertical" />
													</>
												) : ''}
												{/* <span style={{ cursor: !Util.isEmpty(this.state.disMessage) || this.state.disBtn == 'N' ? 'not-allowed' : 'pointer' }} className={this.state.indexStyle == '10' ? 'mouse-add-Style' : ''}
                                          onMouseLeave={!Util.isEmpty(this.state.disMessage) || this.state.disBtn == 'N' ? '' : this.addMouseLeaveStyle.bind(this)}
                                          onClick={!Util.isEmpty(this.state.disMessage) ? this.loadDisOpertion.bind(this) : (this.state.disBtn == 'N' ? '' : this.addCommonUserMsg.bind(this))}
                                          onMouseOver={!Util.isEmpty(this.state.disMessage) || this.state.disBtn == 'N' ? '' : this.addMouseOverStyle.bind(this, '10')}>
                                          <Icon className='doctor-profile-splice' />
                                          <span>{this.setMessage('DoctorAdviceListPageCommonUsage', 'descripts')}</span>
                                      </span><Divider type="vertical" /> */}
												{/* <span style={{ cursor: 'pointer' }} className={this.state.indexStyle == '11' ? 'mouse-add-Style' : ''}
                                      onMouseLeave={this.addMouseLeaveStyle.bind(this)}
                                      onMouseOver={this.addMouseOverStyle.bind(this, '11')}>
                                      <Icon className='doctor-cannel-splice' />
                                      <span>撤销</span>
                                  </span><Divider type="vertical" /> */}

												{/* {this.props.patStatus == '1' ? <span style={{ cursor: !Util.isEmpty(this.state.disMessage) || this.state.disBtn == 'N' ? 'not-allowed' : 'pointer' }}
                                          onClick={!Util.isEmpty(this.state.disMessage) ? this.loadDisOpertion.bind(this) : (this.state.disBtn == 'N' ? '' : this.addBringMedicineModal.bind(this))}
                                          className={this.state.indexStyle == '14' ? 'mouse-add-Style' : ''}
                                          onMouseLeave={!Util.isEmpty(this.state.disMessage) || this.state.disBtn == 'N' ? '' : this.addMouseLeaveStyle.bind(this)}
                                          onMouseOver={!Util.isEmpty(this.state.disMessage) || this.state.disBtn == 'N' ? '' : this.addMouseOverStyle.bind(this, '14')}>
                                          <Icon className='hospital-menu-unfold-splice' />
                                          <span>自备药</span><Divider type="vertical" />
                                      </span> : null} */}

												{/* <span style={{ cursor: 'pointer' }} className={this.state.indexStyle == '12' ? 'mouse-add-Style' : ''}
                                      onMouseLeave={this.addMouseLeaveStyle.bind(this)}
                                      onClick={this.insertDoctorAdvice.bind(this)}
                                      onMouseOver={this.addMouseOverStyle.bind(this, '12')}>
                                      <Icon className='doctor-save-splice' />
                                      <span>保存</span><Divider type="vertical" />
                                  </span> */}
												<Button
													type='primary'
													size='small'
													loading={this.state.saveStatus}
													onClick={this.handleSubmitForConfirmation}
													disabled={!Util.isEmpty(this.state.disMessage) || this.state.saveStatus == true || this.state.disBtn == 'N' || (this.state.patientData?.admID ? false : true)}
												>
													{this.setMessage('DoctorAdviceListPageSave', 'descripts')}</Button>
												<Divider type="vertical" />
												<span style={{ cursor: !Util.isEmpty(this.state.disMessage) || this.state.disBtn == 'N' ? 'not-allowed' : 'pointer' }} className={this.state.indexStyle == '13' ? 'mouse-add-Style' : ''}
													onMouseLeave={!Util.isEmpty(this.state.disMessage) || this.state.disBtn == 'N' ? '' : this.addMouseLeaveStyle.bind(this)}
													onClick={!Util.isEmpty(this.state.disMessage) ? this.loadDisOpertion.bind(this) : (this.state.disBtn == 'N' ? '' : this.settingColumns.bind(this))}
													onDoubleClick={this.doubleElement.bind(this)}
													onMouseOver={!Util.isEmpty(this.state.disMessage) || this.state.disBtn == 'N' ? '' : this.addMouseOverStyle.bind(this, '13')}>
													<Icon type='setting' />
													<span>{this.setMessage('DoctorAdviceListPageColumnSet', 'descripts')}</span>
													{/* <Button type='primary' size='small' onClick={this.insertDoctorAdvice.bind(this)}>保存</Button> */}
												</span>
												<Divider type="vertical" />
												<Button type='primary' size='small' disabled={Util.isEmpty(this.state.ids)} onClick={this.handleSynchronization.bind(this)}>同步时间</Button>
												<Button type='primary' size='small' style={{ marginLeft: '8px' }} disabled={Util.isEmpty(this.state.ids)} onClick={this.handleSynchronization.bind(this, 'NewTime')}>更新时间</Button>
												{/*{this.props.patStatus == '1' ? '' : (*/}
												{/*	<>*/}
												{/*		<Divider type="vertical" />*/}
												{/*		<Button size="small" style={{ background: '#ff3399', color: '#fff' }} onClick={this.discountOnClick}>优惠</Button>*/}
												{/*	</>*/}
												{/*)}*/}
												{this.props.patStatus != '1' && orderPrint === 'Y' ? (
													<>
														<Divider type="vertical" />
														<Button ghost size="small" type="primary" onClick={this.handlePrintExecSheet}>医嘱单打印</Button>
													</>
												) : ''}

												{/*this.props.patStatus != '1' && PASS4Flag === 'Y' ? (
													<>
														<Divider type="vertical" />
														<Button ghost size="small" type="primary" onClick={this.handleDrugInfoInquiry}>药品信息查询</Button>
													</>
												) : ''*/}
												{this.props.patStatus != '1' && priorReviewFlag === 'Y' ? ( // 天津医保用 - 沈阳
													<>
														<Divider type="vertical" />
														<Button ghost size="small" type="primary" onClick={this.handleAccessInAdvance}>事前调阅</Button>
													</>
												) : ''}
												{/* <Button type='primary' size='small' onClick={this.showDrugDescription.bind(this)}
                                          id='what-is-that'>
                                          药品说明书</Button><Divider type="vertical" /> */}
												{this.props.patStatus == '1' && this.props.componentSourse === 'EMR' ? (
													<div style={{ float: 'right' }}>
														插入医嘱排序方式：
														<Select
															style={{ width: '100px' }}
															value={insertMethod}
															placeholder="请选择"
															onChange={Util.handleSelectChange.bind(this, 'insertMethod')}
														>
															<Option key="1" value="transverse" title="横排">横排</Option>
															<Option key="2" value="vertical" title="竖排">竖排</Option>
														</Select>
													</div>
												) : ''}
												{this.props.billingDoctor === 'Y' ? ( // 开单医生
													<Select
														allowClear
														showSearch
														placeholder="开单医生"
														optionFilterProp="search"
														style={{ width: '102px', marginLeft: '6px' }}
														value={ordDocID}
														onChange={Util.handleSelectChange.bind(this, 'ordDocID')}
													>
														{React.$SelectOptions(ordDocList)}
													</Select>
												) : ''}
											</div>
										}}
										rowKey={(data) => {
											return data.ordID || data.tabIndex
										}}
										pagination={false}
									/>
								</>
							) : (
								<Empty
									style={{ marginTop: '100px' }}
									description={(
										<div>
											{isExistRecord !== 'Y' ? '没有录入病历的话是不能录医嘱的哦！' : '没下诊断的话是不能录医嘱的哦！'}
										</div>
									)}
									image={Empty.PRESENTED_IMAGE_SIMPLE}
								/>
							)}
						</div>}
					{this.state.showColumns ? <div className='doctor-advice-draggable'>
						<Card style={{ height: 398 }} title={<span style={{ marginLeft: 10 }}>{this.setMessage('DoctorAdviceListPageMedical', 'descripts')}</span>}
							extra={<div className='batch-add-temp'><Icon type='close' style={{ color: 'white' }}
								onClick={this.settingColumns.bind(this)} /></div>}>
							<div>
								<div style={{ float: 'left', color: '#4191f7' }} className={document.body.clientWidth < 1400 ? 'column-setting' : ''}>
									<Tooltip title={this.setMessage('DoctorAdviceListPageOperation', 'descripts')}>
										{this.setMessage('DoctorAdviceListPageOperation', 'descripts')}</Tooltip>
								</div>
								<div style={{ float: 'right' }}>
									<Input placeholder={this.setMessage('DoctorAdviceListPageenter', 'descripts')} style={{ width: 180, marginRight: 10 }}
										onChange={Util.commonInputChange.bind(this, 'searchColumn')}
										onKeyDown={this.searchColumnName.bind(this)} />
									<Button size='small' type='primary' style={{ marginRight: 10 }} disabled={true}
										onClick={this.handleSaveBtn.bind(this, 'HOSP')}>{this.setMessage('DoctorAdviceListPageApplication', 'descripts')}</Button>
									<Button size='small' type='primary' style={{ marginRight: 10 }} disabled={true}
										onClick={this.handleSaveBtn.bind(this, 'LOC')}>{this.setMessage('DoctorAdviceListPageDepartment', 'descripts')}</Button>
									<Button size='small' type='primary' onClick={this.handleSaveBtn.bind(this, 'USER')}>{this.setMessage('DoctorAdviceListPageIndividual', 'descripts')}</Button>
									<span style={{ color: '#4191f7', margin: '0 10px', cursor: 'pointer' }} onClick={this.loadAllColumns.bind(this, 'hide')}>{this.setMessage('DoctorAdviceListPageReset', 'descripts')}</span>
								</div>
							</div>
							<div style={{ width: '100%', height: 350, marginTop: 20 }}>
								<SortableContainer items={this.state.showAllColumns} onSortEnd={this.onSortEnd} axis='xy'>
								</SortableContainer>
							</div>
						</Card>
					</div> : null}
				</Card>

				{/**
                 * @ByYQL: 事中审核结果弹框
                 * Create 2022-1-5
                 */}
				<Modal
					visible={this.state.verifyModalShow}
					title={this.state.verifyModalInfo.type}
					onOk={() => this.followVerifyFun('Y')}
					onCancel={() => this.followVerifyFun('N')}
					width='500px'
					style={{ top: '35%' }}
					footer={[
						<Button key="cancel" onClick={() => this.followVerifyFun('N')}>不遵从</Button>,
						<Button key="sure" type="primary" onClick={() => this.followVerifyFun('Y')}>遵从</Button>,
					]}>
					<Row>
						<Row>
							<span>{this.state.verifyModalInfo.centerResult + ': ' + this.state.verifyModalInfo.centerResultDetail}</span>
						</Row>
						<Row>
							<span>若不遵从请输入反馈原因</span><TextArea placeholder='请输入不遵从的原因，若选择遵从无需输入内容' onChange={(e) => this.textAreaInfo(e)} rows={3} />
						</Row>
					</Row>
				</Modal>

				{/*公用加载框*/}
				{/* <ShowLoadModal
					onRef={this.onLoadModalRef}
				/> */}

				<Modal
					title="优惠折扣"
					className='discount-modal'
					visible={discountShow}
					onCancel={() => this.setState({ discountShow: false })}
					footer={false}
				>
					<PatientAdmOrderCharges
						admID={patientData?.admID}
						patID={patientData?.patID}
						applyflag={discountFlag === 'Y' ? 'N' : 'Y'}
						selectData={{ discountSubCatID }} // 医嘱子类
						userInfo={titleData}
						onRef={ref => this.discountChild = ref}
						closeModal={this.closeDiscountModal}
					/>
				</Modal>

				{/* 文字医嘱 */}
				<WrittenOrdersModal ordPriorityID={ordPriorityID} param={writtenOrdersParams} confirmSelection={this.handleConfirmSelection} onRef={ref => this.writtenOrdersRef = ref} onCancel={this.handleWrittenOrdersCancel} />

				{/* 事前调阅 */}
				<IframeModal title="事前调阅" width="60vw" bodyPadding="8px" onRef={ref => this.iframeRef = ref} />

				{/* 最大用药提醒 */}
				<PublicModalQueryTable
					cancelText="返回修改"
					okText="继续保存"
					title={'用药天数超出限制提醒【最大为：' + prescriptionMaxDate + '】'}
					width="50vw"
					autoQueryFlag="N"
					doubleRecordFlag="N"
					tableHeight={store.getState().tableHeight.y - 148}
					componentName="MaximumMedicationReminder"
					onRef={ref => this.maxMedRef = ref}
					handleOk={this.insuTypeCodeFlagFun}
				/>

				{/* 医嘱共享查看 */}
				<SharingMedicalOrders onRef={ref => this.sharingMedicalOrdersRef = ref} />

				{/* 抗菌药物选择 */}
				<PublicModalQueryTable
					autoQueryFlag="N"
					idIndex="id"
					autoClose="N"
					multipleFlag="Y"
					doubleRecordFlag="N"
					mutualExclusionFlag="Y"
					title="抗菌药物的用药目的"
					componentName="DoctorAdviceStepPageAntibiotics"
					onRef={ref => this.antibioticsRef = ref}
					handleOk={this.handlePurposeOk}
				/>
			</div>

			{/* 确认提交医嘱 */}
			<Modal
				width="1200px"
				title="确认提交医嘱"
				maskClosable={false}
				visible={confirmMedVisible}
				onOk={this.handleOrdSave}
				onCancel={() => this.setState({ confirmMedVisible: false })}
			>
				<div className="table-body-height" style={{ height: '450px', overflow: 'hidden' }}>
					<Table
						bordered
						pagination={false}
						loading={confirmMedLoading}
						dataSource={confirmMedTableData}
						scroll={{ x: confirmMedTableWidth, y: 400 }}
						columns={confirmMedColumns && confirmMedColumns.length > 0 ? confirmMedColumns : this.staticConfirmMedColumns}
						rowKey={(row) => {
							return row.key || row.id;
						}}
					/>
				</div>
			</Modal>
		</Spin>
	}

}
export default DoctorAdviceStepPage;
