123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142 |
- 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 (<span className={style['diag-item']} >
- <span className={`${style['diag-name']}`}
- title = {title && item.name + (item.showType === 2 || item.showType === 3 ? '('+ item.retrievalName+')': '')}
- onMouseEnter={this.handleMouseEnterDrug.bind(this)}
- onMouseLeave = {this.handleMouseLeaveDrug.bind(this)}
- onClick={() =>{this.chooseDiagodal(item)}}
- >
- <p className={`${style['diag-name-box']} ${type == 'search'?style['diag-name-search']:style['diag-name-disSelect']}`}>{item.name} {item.retrievalName ? '('+ item.retrievalName+')': ''}</p>
- {type== 'disSelect' &&<img className={style['info-img']}
- title='点击i图标可查看详细说明'
- style ={hasEnterItem ? {display: "inline-block"} : {display: "none"}}
- src={hasEnterImg ? infoMove : infoShow}
- onMouseEnter={this.handleMouseEnterImg.bind(this)}
- onMouseLeave = {this.handleMouseLeaveImg.bind(this)}
- onClick={this.getTips.bind(this,item)}
- />}
- </span>
- <ConfirmModal visible={visible} okText='初诊' cancelText='复诊' confirm={this.confirm} cancel={this.cancel} close={this.close}>
- <div className={style['confirm-info']}>确定选择“{item.name}”为</div>
- </ConfirmModal>
-
- </span>)
- }
- }
- DiagnosticItem.contextTypes = {
- scrollArea: React.PropTypes.object
- };
- export default DiagnosticItem;
|