import {connect} from 'react-redux'; import ChronicInfo from '../components/ChronicInfo'; import {SHOW_TABLE_LIST,HIDE_TABLE_LIST, SET_CHRONIC_PUSHS} from '@store/types/pushMessage'; import {getTableList,getScaleInfo,getTips} from '../store/async-actions/pushMessage'; import {ADD_ASSESS_ITEMS,SET_SAVE_ASSESS_DATA,SET_CHRONIC_CALCU_RESULT} from "@types/assessResult"; import {saveMessage} from "../store/async-actions/print"; import {saveClickNum} from '@store/async-actions/homePage'; import { getFormulaResult } from '@store/async-actions/fetchModules' import {deepClone} from '@utils/tools'; import Notify from '@commonComp/Notify'; import {SET_CALCU_VALUES} from "../store/types/pushMessage"; function mapStateToProps(state){ const {pushMessage,assessResult} = state; return{ chronicMagItem: state.diagnosticList.chronicMagItem,//慢病疾病 chronicPushItems: pushMessage.chronicPushItems, //慢病右侧推送 tableList: pushMessage.tableList, showList: pushMessage.showList, showHide: pushMessage.showHide, scaleInfo: pushMessage.scaleInfo,//量表内容 chronicDesease:state.mainSuit.chronicDesease,//主诉存的慢病 update:assessResult.update1, cupdate:pushMessage.update, formulaResult:pushMessage.formulaResult, //量表信息 indexs:assessResult.wholeIndexs, wholeResults:assessResult.wholeResults, //整体评估可能结果 calcuResult:pushMessage.calcuResult, //计算公式结果 calcuValues:pushMessage.calcuValues, //计算公式填的值 } } function mapDispatchToProps(dispatch){ return { getTableList(id){ dispatch(getTableList(id)) // dispatch({type:SHOW_TABLE_LIST}) }, hideList(item){ dispatch({ type:SHOW_TABLE_LIST, name:item.name, value:item.value }) }, getScaleInfo(item){ dispatch(getScaleInfo(item)) }, addAssessItem(row,pIndex,i){ //加入评估记录 let obj = Object.assign({},row); //obj.details[i].add=true; dispatch({ type:ADD_ASSESS_ITEMS, data:obj, index:pIndex, subIndex:i }) }, //保存管理评估 saveAssessInfos(obj,flg,noSave){ //noSave未true则不调页面保存接口 dispatch(Object.assign({},obj,{type:SET_SAVE_ASSESS_DATA})); if(!noSave){ dispatch(saveClickNum); if(flg != 1 && flg != 2){ dispatch(() => saveMessage()) } } }, savePossibleResult(data){ dispatch({ type: 'SAVE_POSSIBLE_RESULT', wholeResults: data }) }, //设置量表推送内容 setChronicPush(data,id,calcuItem) { dispatch({ type: SET_CHRONIC_PUSHS, data: data, calcuItem, id }) }, // 计算公式计算 calcuFormula(item) { // dispatch(getFormulaResult(item)) const {param,chronicPushItems} = item; getFormulaResult(param).then((res)=>{ if(+res.data.code==0){ const data = chronicPushItems; const result = res.data.data.result; const content = data[param.ppIndex].details[param.pIndex].content; content.result = result; dispatch({ type: SET_CALCU_VALUES, result:deepClone(result), id:item.param.disId }) }else{ Notify.error(res.data.msg||'计算没有结果返回'); } }) }, // 获取量表静态知识 getInfomation(item){ dispatch(getTips(item)); } } } const ChronicInfoContainer = connect(mapStateToProps,mapDispatchToProps)(ChronicInfo); export default ChronicInfoContainer;