123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153 |
- import React from 'react';
- import { connect } from 'react-redux';
- import CurrentIll from '@components/CurrentIll';
- import {INSERT_PROCESS,SET_CURRENT_DATA,SETTEXTMODEVALUE,SET_LABEL_MODULE,SELECT_SEARCHDATA,CLEAR_CURRENT_EDIT} from '@store/types/currentIll';
- import {SET_CURRENT_ILL} from '@store/types/fillInfo'
- import {pushMessage} from '../store/async-actions/pushContainer';
- import {getModules} from '../store/async-actions/fetchModules.js';
- import {SETDROPSHOW} from '@types/homePage.js';
- import {HIDE,RESET,CLICKCOUNT,ISREAD,SEARCH_DROP_LOCATION} from '@store/types/homePage.js';
- import {billing} from '@store/async-actions/pushMessage';
- import {getModule} from '@store/async-actions/fetchModules.js';
- import {didPushParamChange} from '@utils/tools.js';
- function mapStateToProps(state) { //console.log(111,state);
- const {homePage} = state;
- return {
- data:state.currentIll.data,//主诉模板
- emptyData:state.currentIll.emptyData,//空模板
- searchData:state.currentIll.searchDatas,//搜索结果
- focusIndex:state.currentIll.focusIndex,
- processModule:state.currentIll.processModule,//病程变化模板
- processModuleName:state.currentIll.processModuleName,//病程变化模板名称
- showArr:homePage.showDrop,
- span:state.currentIll.span,
- update:state.currentIll.update,//用于更新
- mainText:state.mainSuit.saveText,//主诉选中的数据
- mainData:state.mainSuit.data,//主诉使用的模板
- symptomFeature:state.mainSuit.symptomFeature,//主诉分词数据
- moduleNum:state.mainSuit.moduleNum,//主诉使用的模板
- type: state.typeConfig.typeConfig,
- mainIds:state.mainSuit.mainIds,//主诉症状选中的id(去重用)
- fillInfo: state.fillInfo,
- showArr:homePage.showDrop,
- totalHide: homePage.totalHide,
- saveText:state.currentIll.saveText,
- selecteds:state.currentIll.selecteds, //普通多选选中状态
- editClear:state.currentIll.editClear,
- symptomIds:state.currentIll.symptomIds,//症状id,去重用
- isRead:state.homePage.isRead,
- fuzhen:state.diagnosticList.mainSuitStr,//诊断第一个复诊值
- boxTop:state.homePage.boxTop,
- boxLeft:state.homePage.boxLeft,
- allModules:state.homePage.allModules,
- // isChronic:!!state.diagnosticList.chronicMagItem,
- isChronic:state.mainSuit.chronicDesease,
- }
- }
- function mapDispatchToProps(dispatch) {
- return {
- insertProcess(obj,allModules){//点击病程变化
- // 埋点dispatch
- dispatch({
- type:CLICKCOUNT,
- data:{id:obj.id},
- clickType:'单击',
- num:1
- });
- dispatch({
- type:INSERT_PROCESS,
- id:obj.relationModule,
- allModules:allModules
- });
- dispatch({
- type:ISREAD
- })
- },
- async setData(info){//设置现病史使用模板
- let idsArr = info.mainIds;
- let ids = idsArr.join(",");
- let labelModule = await getModules(ids);
- if(labelModule.data.code==0){//根据id获取标签模板
- dispatch({
- type:SET_LABEL_MODULE,
- data:labelModule.data.data
- })
- }
- dispatch({
- type:SET_CURRENT_DATA,
- info
- })
- //右侧推送
- setTimeout(function(){ //延迟待确定后的数据更新后推送,避免获取的参数还是旧的
- if(didPushParamChange()){ //操作后内容有变化才推送
- dispatch(billing());
- }
- },500);
- },
- setCurrentIll: value => {
- dispatch({type: SET_CURRENT_ILL, value})
- },
- pushMessage: (data) => {
- dispatch(() => pushMessage(data))
- },
- //文本模式下推送
- fetchPushInfos(){
- //调右侧推送
- dispatch(billing());
- },
- handleInput(obj){ //文本模式值保存
- dispatch({
- type:SETTEXTMODEVALUE,
- text:obj.text
- })
- },
- fetchModules(param){
- const {id,name,index,span} = param;
- getModule(id).then((res)=>{
- if(res.data.code=='0'){
- dispatch({
- type:SELECT_SEARCHDATA,
- index,
- name,
- data: res.data.data,
- span,
- isReplace:false
- })
- dispatch({
- type:ISREAD
- })
- }
- });
- //右侧推送
- setTimeout(function(){
- dispatch(billing());
- },200);
- },
- changeEditIll(bool){
- dispatch({
- type:CLEAR_CURRENT_EDIT,
- editClear:bool
- })
- },
-
- getSearchLocation(top,left){
- dispatch({
- type:SEARCH_DROP_LOCATION,
- top:top,
- left:left,
- dis:0
- })
- }
- }
- }
- const CurrentIllContainer = connect(
- mapStateToProps,
- mapDispatchToProps
- )(CurrentIll);
- export default CurrentIllContainer;
|