123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- import React from 'react';
- import {connect} from 'react-redux';
- import {SETTEXTMODEVALUE} from '@store/types/mainSuit';
- import {SETCURRENTTEXTMODEVALUE} from '@store/types/currentIll';
- import {SETOTHERTEXTMODEVALUE} from '@store/types/otherHistory';
- import {SETCHECKTEXTMODEVALUE} from '@store/types/checkBody';
- import { SETPASTTEXTMODEVALUE } from '@store/types/pastHistory'
- import { SETPERSONALTEXTMODEVALUE } from '@store/types/personalHistory'
- import { SETFAMILYTEXTMODEVALUE } from '@store/types/familyHistory'
- import { SETMARRIAGETEXTMODEVALUE } from '@store/types/marriageHistory'
- import { SETMENSTRUATIONTEXTMODEVALUE } from '@store/types/menstruationHistory'
- import BlockInp from '@common/components/BlockInp';
- import {didPushParamChange,isAllPartClear,getAllDataList,getAllDataStringList,isAllClear} from '@utils/tools';
- import {embedPush} from '@store/async-actions/pushMessage';
- function mapStateToProps(state){
- const {homePage} = state;
- return {
- isRead:homePage.isRead,
- }
- }
- const actionsType = {
- '1': SETTEXTMODEVALUE, // 主述
- '2': SETCURRENTTEXTMODEVALUE, // 现病史
- // '3': SETOTHERTEXTMODEVALUE, // 其他史
- '4': SETCHECKTEXTMODEVALUE, // 查体
- '13': SETPASTTEXTMODEVALUE, // 设置既往史
- '14': SETPERSONALTEXTMODEVALUE, // 设置个人史
- '15': SETFAMILYTEXTMODEVALUE, // 设置家族史
- '16': SETMARRIAGETEXTMODEVALUE, // 设置婚育史
- '17': SETMENSTRUATIONTEXTMODEVALUE, // 设置月经史
- };
- const formatMode = mode => {
- switch (mode) {
- case '0':
- return 'patientia'; // 非空切非输入状态
- case '1':
- return 'chief'; // 主述
- case '2':
- return 'symptom'; // 现代史
- case '4':
- return 'vital'; // 现代史
- case '13':
- return 'other'; //其他史
- case '14':
- return 'other'; //其他史
- case '15':
- return 'other'; //其他史
- case '16':
- return 'other'; //其他史
- case '17':
- return 'other'; //其他史
- default:
- return 'null';
- }
- };
- function mapDispatchToProps(dispatch){
- return {
- handleInput(obj){ //自由模式值保存
- dispatch({
- type:actionsType[obj.boxMark],
- text:obj.text
- })
- },
- handlePush(obj={}){
- const {boxMark,isFocus,state} = obj;
- // console.log(boxMark, 'boxMark盒子标记');
- const notClear=state?isAllClear(getAllDataStringList(state)):false;
- // if(isFocus&&(boxMark==='1'||boxMark==='2')&&!notClear){
- // // dispatch(embedPush({mode:+boxMark+1}));
- // dispatch(embedPush({ mode: +boxMark + 1, action: formatMode(boxMark) }));
- // return;
- // }
- // if (isFocus && !notClear) {
- if (isFocus) {
- // dispatch(embedPush({mode:+boxMark+1}));
- dispatch(embedPush({ mode: +boxMark + 1, action: formatMode(boxMark) }));
- return;
- }
- if(!isFocus&&didPushParamChange()) { //输入的情况
- // dispatch(embedPush({mode:+boxMark+3}));
- dispatch(embedPush({ mode: +boxMark + 100, action: formatMode(boxMark) }));
- }
- }
- }
- }
- const BlockInpCont = connect(
- mapStateToProps,
- mapDispatchToProps
- )(BlockInp);
- export default BlockInpCont;
|