import React, { Component } from 'react'; import style from './index.less'; import {ConfirmModal} from '@commonComp'; import Notify from '@commonComp/Notify'; import store from '@store'; import infoShow from '@common/images/info-show.png'; import infoMove from '@common/images/info-move.png'; import {getChronic} from '@store/async-actions/homePage.js'; import {storageLocal} from '@utils/tools'; import { getMRAnalyse } from '@store/async-actions/pushMessage'; class DiagnosticItem extends Component{ constructor(props){ super(props); this.state = { visible: false, hasEnterItem: false, hasEnterImg: false } this.addDiagodal = this.addDiagodal.bind(this); this.chooseDiagodal = this.chooseDiagodal.bind(this); this.confirm = this.confirm.bind(this); this.cancel = this.cancel.bind(this) this.close = this.close.bind(this) this.getTips = this.getTips.bind(this) } confirm() { this.props.setHighter&&this.props.setHighter(48) this.close(); const diagType = 1; this.addDiagodal(diagType) } cancel() { this.props.setHighter&&this.props.setHighter(48) this.close(); const diagType = 2; this.addDiagodal(diagType) } close(){ this.setState({ visible: false }) } chooseDiagodal(item) { const { diagnosticList,getTips, type } = this.props; // getTips && getTips(item); // if (type == 'search') { // getTips && getTips({type:7,name: item.name, position: 1}); // } for (let i = 0; i < diagnosticList.length; i++) { if(diagnosticList[i].id === item.id && diagnosticList[i].name === item.name) { Notify.info('该诊断已存在'); return } } this.setState({ visible: true }) } getTips(item, e) { e.stopPropagation(); const {getTips } = this.props; getTips && getTips({id:item.id,type:7,name: item.name, position: 1}); } addDiagodal(diagType){ const {item, isChronicMag,mode,EMRScrollCont,type,addDiagnostic, clearInput, hideSearch} = this.props; item.type = diagType; if(item.type == 2&&mode=='0') { //文本模式不走慢病 isChronicMag(item); } addDiagnostic&&addDiagnostic(item); clearInput&&clearInput(); hideSearch&&hideSearch(); this.context.scrollArea&&this.context.scrollArea.refresh(); //document.getElementById("diagnosisResult").scrollIntoView(true) if(type == 'disSelect') { const scrollTop = document.getElementById("diagnosisResult").offsetTop setTimeout(() =>{ EMRScrollCont.scrollYTo(scrollTop); }) } store.dispatch(getMRAnalyse()) } handleMouseEnterDrug() { this.setState({ hasEnterItem: true, }) } handleMouseLeaveDrug() { this.setState({ hasEnterItem: false, }) } handleMouseEnterImg() { this.setState({ hasEnterImg: true }) } handleMouseLeaveImg() { this.setState({ hasEnterImg: false }) } render(){ const { visible,hasEnterItem,hasEnterImg } = this.state const { item, title, type } = this.props return ( {this.chooseDiagodal(item)}} >

{item.name} {item.retrievalName ? '('+ item.retrievalName+')': ''}

{type== 'disSelect' &&}
确定选择“{item.name}”为
) } } DiagnosticItem.contextTypes = { scrollArea: React.PropTypes.object }; export default DiagnosticItem;