import React from 'react'; import style from './index.less'; import chronicPic from "../../common/images/chronic.png"; import level1 from "../../common/images/级别1.png"; import tableIcon from '@common/images/table.png'; import allTableIcon from '@common/images/all-table.png'; import checkIcon from '@common/images/check.png'; import up from '@common/images/slide-up.png'; import down from '@common/images/slide-down.png'; import {ComplexModal,ConfirmModal,MiniToast, Radio,CheckBtn,Footer,Notify} from '@commonComp'; import infoShow from '@common/images/info-show.png'; import infoMove from '@common/images/info-move.png'; import ScaleTable from '@containers/ScaleTable'; import {deepClone} from '@utils/tools'; import $ from 'jquery'; import config from '@config/index'; /*** 慢病右侧推送模块规则: 慢病--显示慢病名称以及管理和评估 普通病--不显示管理和评估和量表按钮 明细--量表-计算公式-核心指标 controlType:0-radio 1-checkbox 2-text 3-dropdownlist **/ class ChronicInfo extends React.Component{ constructor(props){ super(props); this.state = { show:true, showInfo:false, showOption:false, showAssess:false, //评估弹窗 infoId:null, //静态知识 formulaId:null, //计算公式 optionId:null, //可能结果, isAssessConfirm:false, //是否点击评估弹窗确定按钮 radioVal:{}, //可能结果选择内容 possible:{}, //可能结果 formulaParam: {}, //量表计算公式计算入参 isCalculated:false, //是否刚计算过,关闭时值与结果对应 calcuValues:deepClone(props.calcuValues), //计算公式填的值 hasEnterImg: false, //是否移入info currentIndex: -1, //当前index comfirnFlag:false, flag:true, ff:false, timer:null, scaleParam:{}, //加入病例需要的参数 }; this.$result = React.createRef(); this.$content = React.createRef(); this.showInfo = this.showInfo.bind(this); this.closeInfo = this.closeInfo.bind(this); this.showOption = this.showOption.bind(this); this.closeOption = this.closeOption.bind(this); this.showTable = this.showTable.bind(this);//显示量表弹窗 this.closeTable = this.closeTable.bind(this);//关闭量表弹窗 this.showFormula = this.showFormula.bind(this); //打开计算公式 this.handleAddAssessItem = this.handleAddAssessItem.bind(this); //加入病例记录 this.onPrint = this.onPrint.bind(this); this.handleForRadio = this.handleForRadio.bind(this); this.handleSaveCalcu = this.handleSaveCalcu.bind(this); //保存评估修改的计算和可能结果 this.slideToggle = this.slideToggle.bind(this); this.resetComfirnFlag = this.resetComfirnFlag.bind(this); this.slideToggle = this.slideToggle.bind(this); this.comfirnTable = this.comfirnTable.bind(this); this.unscroeClose = this.unscroeClose.bind(this); } onPrint() { const {showHide} = this.props; let dom = showHide&&showHide.showTable?$("#printcontent"):$("#AssistResult"); dom.jqprint({ debug: false, importCSS: true, printContainer: true, operaSupport: false, }); } showInfo(item){ // 静态知识显示在提示信息里(4-18) const {getInfomation} = this.props; const param = { id:item.id, name: item.name, // id:40738, //目前只有“肾功能不全”有数据 type:22, position: 1 } getInfomation&&getInfomation(param); } closeInfo(){//关闭静态知识 this.setState({ infoId:null }) } showOption(id){ this.setState({ optionId:id, formulaId:null //关闭计算公式 }); const {patDom} = this.props; const ht = $(patDom.current).height(); setTimeout(function(){ $(patDom.current).scrollTop(ht+200); }) } closeOption(){ // 关闭-有可能结果则保持与结果一致,没有就保持最新选择的内容 let {possible,radioVal} = this.state; if(JSON.stringify(possible)=='{}'){ this.setState({ optionId:null }) }else{ this.setState({ radioVal:Object.assign({},radioVal,possible), optionId:null, }); } } showTable(it,v,i,j){ const {scaleInfo} = this.props; // 密西根糖尿病周围神经病评分(MDNS), id:40744 const item = { conceptId:it.conceptId, name:it.name }; // 判断:store里已经有该量表就无需重新调接口 if(scaleInfo&&scaleInfo[it.conceptId]){ this.props.hideList({name:'showTable',value:true},it); }else{ this.props.getScaleInfo(item); } this.setState({ formulaId:null, //关闭计算公式和可能结果弹窗 optionId:null, scaleParam:{ v,i,j } }) } // 量表明细-关闭,isClose是否是点击关闭按钮 closeTable(isClose){ const {scaleParam} = this.state; const {showHide} = this.props; if(!showHide.isPop){ //量表结果,判断需要计算并且dom中有值才能加入病例记录 const res = this.$result.current&&this.$result.current.innerText; if(!isClose&&(this.$result.current&&!res)){ Notify.info("请先计算量表结果!"); return ; } !isClose&&this.handleAddAssessItem(scaleParam.v,scaleParam.i,scaleParam.j); this.setState({ scaleParam:{} }); } this.props.hideList({name:'showTable',value:false}); } // 非计分量表确定-延时关闭->量表存值 unscroeClose(){ let {timer} = this.state; this.setState({ ff:true }) clearTimeout(timer) let _timer = setTimeout(()=>{ this.closeTable(); },200) this.setState({ timer:_timer }) } // 量表明细-确定 comfirnTable(){ const {flag} = this.state; this.setState({ comfirnFlag:true, flag:!flag //触发更新 }) } resetComfirnFlag(){ this.setState({ comfirnFlag:false, ff:false }) } showFormula(id){//计算公式 this.setState({ formulaId:id, optionId:null //关闭可能结果 }); const {patDom} = this.props; const ht = $(patDom.current).height(); setTimeout(function(){ $(patDom.current).scrollTop(ht+200); }) } closeFormula(it){ const {formulaId,isCalculated} =this.state; if(!isCalculated){ //没有计算结果时,保存输入的值 const {calcuResult,calcuValues} = this.props; const cres = calcuResult&&calcuResult[formulaId]||it.content.result; const result = cres&&cres[1]&&cres[1].text; if(result){ this.setState({ calcuValues:deepClone(calcuValues) }); } } this.setState({ formulaId:null, }); } handleAddAssessItem(v,pIndex,i){ const {addAssessItem,showHide,addScaleItems,scaleInfo} = this.props; if(!v){ addScaleItems(scaleInfo[showHide.conceptId],showHide.conceptId); return ; } addAssessItem(v,pIndex,i); } addFormula(it,v,pIndex,i){ const {chronicMagItem} = this.props; this.closeFormula(it); chronicMagItem&&this.handleAddAssessItem(v,pIndex,i); } handleReg(e){ //只能输入数字和特殊符号 //const hasDot = e.target.value.indexOf('.')!=-1; const key = e.key; if(key!='Backspace'&&((/[^\d|.\/%*~]/.test(key)))){ e.preventDefault(); } } handleInputformula(id,calcuContent,i,e) { const {calcuValues} = this.state; let obj = deepClone(calcuValues); let values = (obj&&obj[id])||deepClone(calcuContent); const txt = e.target.value; values[i].value = txt.replace(/[\u4e00-\u9fa5]|[^\d|.\/%*~]/g,''); //处理中文输入法的情况 obj[id] = values; if(/[\u4e00-\u9fa5]|[^\d|.\/%*~]/g.test(txt)){ e.target.value = txt.replace(/[\u4e00-\u9fa5]|[^\d|.\/%*~]/g,''); } this.setState({ isCalculated:false, calcuValues:obj }); } handleForRadio(id,calcuContent,i,fidx){//计算公式 const { calcuValues } = this.state; let obj = deepClone(calcuValues); let values = (obj&&obj[id])||deepClone(calcuContent); let details = values[i].details; for(let x=0;x{ return
{v.name?

患者可能有 {v.name} {} {/* */} :

:''} {v.details&&v.details.map((it,j)=>{ if(it.type==1){ return

{'【'+it.content.name+'】'} {formulaResult&&formulaResult[it.content.conceptId]?{'结果:'}{formulaResult[it.content.conceptId].calcalculate&&formulaResult[it.content.conceptId].calcalculate.result.value +' '+ formulaResult[it.content.conceptId].calcalculate.result.text}:''}

}else if(it.type==2){ const cres = calcuResult&&calcuResult[v.conceptId]||it.content.result; const result = cres&&cres[1]&&cres[1].text; const details = calcuValues&&calcuValues[v.conceptId]||it.content.details; return
计算公式结果: {result?result:'请选择'} {formulaId&&formulaId==v.conceptId&& {details.map((item,idd)=>{ if(item.controlType==0){//单选 return }else if(item.controlType==2){//输入框 return } })}
{'请选择'+item.name+':'} {Array.isArray(item.details)&&item.details.map((ii,ind)=>{ return
})}
{'请输入'+item.name+':'} {item.uint}
计算
{cres && Array.isArray(cres) &&cres.map((itemResult, resultIndex) => { return })}
{itemResult.name+':'} {itemResult.text}
}
}else if(it.type==3){ return
可能结果: {possible[v.conceptId]?possible[v.conceptId]:'请选择'}
{it.content.name?it.content.name+':':''} {it.content.details&&it.content.details.map((lis,ind)=>{ return
{lis.state==1?(智能推荐):''}
})}
} })}
}) return list; } componentWillReceiveProps(next){ if(JSON.stringify(next.calcuValues)!=JSON.stringify(this.props.calcuValues)){ this.setState({ calcuValues:next.calcuValues }) } if (JSON.stringify(next.wholeResults.possible) != JSON.stringify(this.props.possible)) { this.setState({ radioVal: next.wholeResults.radioVal, possible: next.wholeResults.possible }) } if(next.slideUp!=this.props.slideUp){ if(next.slideUp){ $(this.$content.current).slideUp(config.slideTime); }else{ $(this.$content.current).slideDown(config.slideTime); } } } slideToggle(){ const {toggleSlide,slideUp} = this.props; toggleSlide&&toggleSlide(!slideUp); } render(){ const {comfirnFlag,flag,ff} = this.state; const {chronicMagItem,chronicDesease,data,showHide,slideUp} = this.props; const scaleFooter =