import React, { Component } from 'react'; import style from './index.less'; import del_icon from './img/delete.png' import diagUp from './img/diagUp.png' import diagDown from './img/diagDown.png' import {ConfirmModal, Message} from '@commonComp'; import Notify from '@commonComp/Notify'; import Treat from '@containers/Treat' import store from '@store'; import { initItemList ,setInitHistory} from '@store/async-actions/historyTemplates'; import { pushAllDataList,inspectAndAssist } from '@utils/tools'; import iconRadioDefault from '@common/images/icon-radio-default.png' import iconRadioActive from '@common/images/icon-radio-active.png' import tableIcon from '@common/images/table.png'; import { delFollowUp } from '../../store/actions/treat'; import { CONFIRM_TYPE } from "@store/types/typeConfig"; class DiagnosticList extends Component { constructor(props) { super(props); this.state = { visible: false, delItem: {}, treatTitle: '', activeHistory: -1, sign:-1 } this.deleteItem = this.deleteItem.bind(this); this.cancel = this.cancel.bind(this); this.close = this.close.bind(this); this.showTreat = this.showTreat.bind(this); this.handleClickDiag = this.handleClickDiag.bind(this); this.referRecord = this.referRecord.bind(this); this.noReferRecord = this.noReferRecord.bind(this); this.getHistoryCase = this.getHistoryCase.bind(this); this.closeHistoryCaseModal = this.closeHistoryCaseModal.bind(this); this.referCase = this.referCase.bind(this); } componentWillReceiveProps(nextprops) { if (this.props.diagnosticStr != nextprops.diagnosticStr) { this.props.getBilling(); } } upDiagnostic(index) { const { upDiagnostic } = this.props; upDiagnostic && upDiagnostic(index) } downDiagnostic(index) { const { downDiagnostic } = this.props; downDiagnostic && downDiagnostic(index) } deleteItem() { const { delItem } = this.state; const { delDiagnostic, delReact,delFollowUp } = this.props; delDiagnostic && delDiagnostic(delItem); delReact && delReact(delItem) delFollowUp && delFollowUp(delItem) this.setState({ visible: false, }) Notify.success('删除成功') } cancel() { this.setState({ visible: false }) } close() { this.setState({ visible: false }) } handleDeleteItem(item) { this.setState({ visible: true, delItem: item, }) } showTreat(item, index) { // item.treatIndex = index const { showTreat, getTreatResult } = this.props; getTreatResult && getTreatResult(item); // showTreat && showTreat();//添加loading,移到async-actions中 this.setState({ treatTitle: item.name }) } handleClickDiag(item) { const { getTips } = this.props; // getTips && getTips(item); getTips && getTips({id:item.id,type:7}); } referRecord() { const { hideReferRecord, showHistoryCaseModal ,chronicMagItem,hisTemplates,autoFillModules,typeConfig} = this.props hideReferRecord && hideReferRecord() // showHistoryCaseModal && showHistoryCaseModal() // store.dispatch(initItemList(chronicMagItem)) initItemList(chronicMagItem).then((res)=>{ const result = res.data; if(result.code==0 && result.data){ store.dispatch(setInitHistory(result.data)); showHistoryCaseModal && showHistoryCaseModal(); }else{ if(typeConfig==0){ Notify.info("暂无历史病历,已默认展示慢病相关内容"); const timer = setTimeout(function(){ autoFillModules && autoFillModules(); clearTimeout(timer); },1000) //需求要求延时 } } }) } noReferRecord() { const { hideReferRecord ,autoFillModules,typeConfig} = this.props hideReferRecord && hideReferRecord(); if(typeConfig==0){//智能推送模式才自动填充 autoFillModules&&autoFillModules(); } } referCase() { const { hideHistoryCaseModal, items ,autoFillModules,typeConfig} = this.props const {sign} = this.state; hideHistoryCaseModal && hideHistoryCaseModal() if (this.state.activeHistory === -1 && typeConfig==0) {//没有选择历史病例直接点确定 Notify.info("未选择历史病历,已默认展示慢病相关内容"); const timer = setTimeout(function(){ autoFillModules && autoFillModules(); clearTimeout(timer); },1000) return } let baseList = store.getState(); let baseObj = items[this.state.activeHistory]; // 切换模式 if(sign != typeConfig){ store.dispatch({type: CONFIRM_TYPE, confirmType: baseObj.sign}); } pushAllDataList(baseObj.sign,'push',baseObj,'history') //引用 this.props.getBilling(); this.setState({ activeHistory: -1, sign:-1 }) } closeHistoryCaseModal() { const { hideHistoryCaseModal ,autoFillModules,typeConfig} = this.props this.setState({ activeHistory: -1, sign:-1 }) hideHistoryCaseModal && hideHistoryCaseModal() if(typeConfig==0){//智能推送模式才自动填充 autoFillModules&&autoFillModules(); } } handleQuoteClick(item, index) { const { handleQuoteClick } = this.props // handleQuoteClick && handleQuoteClick(item) this.setState({ activeHistory: index, sign:item.sign }) } getHistoryCase() { const { items } = this.props return (
{items.map((item, index) => { return
{item.diagnose + '(' + item.inquiryDate + ')'}
})}
) } render(){ const { list, treatment, showReferRecord, showHistoryCase } = this.props const { visible, treatTitle } = this.state const lastIndex = list.length -1; return(
{list && (list.length > 0) && list.map((item, index) => { const hasTreat = item.treat && (item.treat.commonTreatment.content || item.treat.surgeryTreatment.content || item.treat.treatment.length>0 ||(item.adverseReactions&&item.adverseReactions.length > 0) || (item.drugHistory && item.drugHistory['慢病用药内容'] && item.drugHistory['慢病用药内容'].length > 0) || (item.drugHistory &&item.drugHistory['普通病用药内容'] && item.drugHistory['普通病用药内容'].length > 0) ||item.follow) // const hasTreat= true; return (
{index === 0 ? '' : {this.upDiagnostic(index)}}>} {list.length === 1 ? '' : index !== 0 ? '' : {this.downDiagnostic(index)}} className={style['diag-down']}>} {index === 0 ? '主' : index+1} {this.handleClickDiag(item)}}>{item.name} {item.type === 1 ? 初诊 : 复诊} {hasTreat && this.showTreat(item, index)}}> 治疗方案 {this.handleDeleteItem(item)}}/>
) })} {treatment&&}
是否删除该诊断?
是否引用往期病历
{this.getHistoryCase()}
确定
) } } export default DiagnosticList;