Browse Source

主诉现病史代码优化,删除多余无用代码

liucf 6 years ago
parent
commit
173eb8dbda

+ 3 - 1
src/common/components/index.js

@@ -23,6 +23,7 @@ import NumberUnitPan from "./NumberUnitPan";
 import Add from "./Add";
 import ComplexModal from "./ComplexModal";
 import MiniToast from "./MiniToast";
+import TailInlineTag from "./TailInlineTag";
 
 module.exports = {
     Banner,
@@ -49,5 +50,6 @@ module.exports = {
     NumberUnitPan,
     Add,
     ComplexModal,
-    MiniToast
+    MiniToast,
+    TailInlineTag
 };

+ 15 - 34
src/components/CurrentIll/index.jsx

@@ -1,7 +1,6 @@
 import React,{Component} from 'react';
 import style from './index.less';
-import {Button,InlineTag,ItemBox,Notify,Textarea} from '@commonComp';
-import TailInlineTag from '@commonComp/TailInlineTag';
+import {ItemBox,Notify,Textarea,TailInlineTag} from '@commonComp';
 import chooseType from '@containers/eleType.js';
 import SearchDrop from '@components/SearchDrop';
 import {filterDataArr,getPageCoordinate,windowEventHandler,isIE} from '@utils/tools'
@@ -12,14 +11,9 @@ class CurrentIll extends Component{
     super(props);
     this.state = {
       boxEditable:true,
-      showMoudle:false,
       forbidInput:false,
-      mainFlag:true,
-      mainData:[],
-      boxMark:"2",
       boxLeft:0,
       boxTop:0,
-      show:true,
       tmpScroll:0,
       tmpTop:0,
       setDataTimer:null
@@ -46,6 +40,8 @@ class CurrentIll extends Component{
     // 判断主诉是否为空
     const {mainData,mainText,setData,moduleNum,mainIds,data,changeEditIll,editClear,symptomFeature,isChronic} = this.props;
     const that = this;
+    const ev = e || window.event;
+    const text = ev.target.innerText || ev.target.innerHTML;
     let {setDataTimer} = this.state; 
     let mainFinallyText = filterDataArr(mainText);
     // if(mainData.length == 0 && !mainText[0]){
@@ -55,9 +51,8 @@ class CurrentIll extends Component{
       this.setState({
         forbidInput:true
       })
-    }else {
+    }else if(!text){
       let num = moduleNum.num;//主诉使用了几个模板
-        // isChronic为一个对象
       if(data.length==0 && !isChronic || !isChronic.name ){
         clearTimeout(setDataTimer);
         setDataTimer = setTimeout(function(){//延时,等待主诉失焦数据返回
@@ -68,21 +63,11 @@ class CurrentIll extends Component{
         })
       }
       this.setState({
-          showMoudle:true,
           forbidInput:false,
           boxEditable:false,
           setDataTimer
       })
       changeEditIll(false)
-      /*const showTimer = setTimeout(function(){
-        that.setState({
-          showMoudle:true,
-          forbidInput:false,
-          boxEditable:false,
-        })
-        changeEditIll(false)
-      },150)
-      clearTimeout(showTimer);*/
     }
 
   }
@@ -106,12 +91,8 @@ class CurrentIll extends Component{
       }
       leftL = ele.offsetLeft+90
     }
-    // console.log(getPageCoordinate(e).boxTop)
     getSearchLocation(getPageCoordinate(e).boxTop,leftL)
     this.setState({
-      // boxLeft:getPageCoordinate(e).boxLeft,
-      // boxLeft:leftL,
-      // boxTop:getPageCoordinate(e).boxTop,
       tmpScroll: $("#addScrollEvent")[0].scrollTop,
       tmpTop:getPageCoordinate(e).boxTop
     });
@@ -142,22 +123,22 @@ class CurrentIll extends Component{
     return list;
   }
   handleBlur(e){
-    const {freeText} = this.props;
+    const {freeText,data} = this.props;
     const ev = e || window.event;
-    const data = ev.target.innerText || e.target.innerHTML;
-    if(!isIE()){
-      e.target.innerText?(e.target.innerText=""):(e.target.innerHTML="")
-      freeText && freeText(data.trim());
-    }else{
-      if(datas.length==0){
-        freeText && freeText(data);
+    const text = ev.target.innerText || e.target.innerHTML;
+    if(data.length==0){
+      if(!isIE()){
+        e.target.innerText?(e.target.innerText=""):(e.target.innerHTML="")
+        freeText && freeText(text.trim());
+      }else{
+        freeText && freeText(text);
       }
-    }
+    } 
   }
 
   render(){
-    const {fuzhen,isChronic,type,fetchPushInfos,handleInput,isRead,saveText,searchData,totalHide,showArr,focusIndex,editClear,data,boxLeft,boxTop} = this.props;
-    const {showMoudle,forbidInput,boxMark,show} = this.state;
+    const {fuzhen,isChronic,type,fetchPushInfos,handleInput,isRead,saveText,searchData,totalHide,editClear,data,boxLeft,boxTop} = this.props;
+    const {forbidInput} = this.state;
     const searchFlag = searchData.length > 0 ? true : false;
 
     if(+type===1){      //文本模式

+ 2 - 2
src/components/CurrentIll/index.less

@@ -15,9 +15,9 @@
   width: 40px;
   display: inline-block;
 } */
-.textarea{
+/* .textarea{
   width: 100%;
   font-size: 14px;
   line-height: 21px;
   height: 108px;
-}
+} */

+ 6 - 36
src/components/MainSuit/index.jsx

@@ -1,17 +1,11 @@
 import React,{Component} from 'react';
 import style from './index.less';
-import {Button,InlineTag,ItemBox,DropDown,DropList,Textarea,Notify,ConfirmModal} from '@commonComp';
-import TailInlineTag from '@commonComp/TailInlineTag';
+import {ItemBox,Textarea,Notify,TailInlineTag} from '@commonComp';
 import SearchDrop from '@components/SearchDrop';
 import CommonSymptom from '@components/CommonSymptom';
 import chooseType from '@containers/eleType.js';
 import config from "@config/index";
-import {isIE,getPageCoordinate,windowEventHandler,filterDataArr,getAllDataList,getAllDataStringList,ifOtherClear} from "@utils/tools.js"
-import { initItemList,setInitHistory } from '@store/async-actions/historyTemplates';
-import tableIcon from '@common/images/table.png';
-import iconRadioDefault from '@common/images/icon-radio-default.png'
-import iconRadioActive from '@common/images/icon-radio-active.png'
-import { pushAllDataList,inspectAndAssist } from '@utils/tools';
+import {isIE,getPageCoordinate,windowEventHandler,filterDataArr,getAllDataList,getAllDataStringList,ifOtherClear} from "@utils/tools.js";
 import $ from 'jquery';
 import store from '@store';
 
@@ -20,16 +14,10 @@ class MainSuit extends Component{
     super(props);
     this.state = {
       boxEditable:true,
-      show:false,
-      showModule:false,
-      inputData:"",
       boxLeft:null,
       boxTop:null,
-      selecSearch:"",
       symptom:false,
-      search:false,
       timer:null,
-      blurTimer:null,
       inpText:'',
       clearTimer:null,
       overFlag:false,
@@ -98,14 +86,6 @@ class MainSuit extends Component{
     
   }
 
-
-  /*handleShow(e,show){
-    e.stopPropagation();
-    if(e.target.tagName=="INPUT"){
-      return ;
-    }
-  }*/
-
   handleSelect(item){//选中的常见症状
     if(item.select.length>0){
       const {clearCommS,insertMain,getData} = this.props;
@@ -113,7 +93,6 @@ class MainSuit extends Component{
       getData && getData();
       // 让模板出现
       this.setState({
-          showModule:true,
           symptom: false,
         }) 
       //选中后清空下拉结果
@@ -137,12 +116,10 @@ class MainSuit extends Component{
       clearSearch && clearSearch();
       return
     }
-    // clearTimeout(this.state.timer);
     if(datas.length==0){//没有使用模板时点击搜索结构要展开模板
       insertSearch &&insertSearch({item,span});
       this.setState({
         search: false,
-        showModule:true,
         inpText:''
       })
     }else{
@@ -150,8 +127,7 @@ class MainSuit extends Component{
       this.setState({
         search: false,
       })
-    }
-    
+    }    
      // 清空搜索结果
      clearSearch && clearSearch();
   }
@@ -171,9 +147,6 @@ class MainSuit extends Component{
     }
     getSearchLocation(getPageCoordinate(e).boxTop,leftL)
     this.setState({
-      // boxLeft:getPageCoordinate(e).boxLeft,
-      // boxLeft:leftL,
-      // boxTop:getPageCoordinate(e).boxTop,
       tmpScroll: $("#addScrollEvent")[0].scrollTop,
       tmpTop:getPageCoordinate(e).boxTop
     });
@@ -267,16 +240,13 @@ class MainSuit extends Component{
       const clearTimer = setTimeout(function(){
         clearSearch && clearSearch();
         clearTimeout(clearTimer);
-        // that.setState({
-        //   symptom:false
-        // })
       },config.delayTime-200); 
   }
 
 
   render(){
-    const {type,CommonSymptoms,searchData,fetchPushInfos,isRead,totalHide,handleInput,fuzhen,saveText,editClear,datas,commSymHide,boxLeft,boxTop,showHisBox} = this.props;
-    const {showModule,show,symptom,search} = this.state;
+    const {type,CommonSymptoms,searchData,fetchPushInfos,isRead,totalHide,handleInput,fuzhen,saveText,editClear,datas,commSymHide,boxLeft,boxTop} = this.props;
+    const {symptom} = this.state;
     const symptomFlag = CommonSymptoms.length>0 ? true : false;
     const searchFlag = searchData.length>0 ? true : false;
     const boxTop1 = datas.length>0?boxTop:45;
@@ -284,7 +254,7 @@ class MainSuit extends Component{
     if(+type===1){      //文本模式
       return <Textarea title='主诉' boxMark='1' isRead={isRead} value={saveText[0]} handlePush={fetchPushInfos} handleInput={handleInput} />;
     }
-    return  <div className={`${'mainsuit-box'} ${style['main-suit']}`} id="mainsuitBox">
+    return  <div className={style['main-suit']}>
       <ItemBox
       fuzhen={fuzhen} 
       title='主诉' 

+ 4 - 4
src/components/MainSuit/index.less

@@ -2,15 +2,15 @@
 .main-suit{
   position: relative;
 }
-.input-cell{
+/* .input-cell{
   border:none;
   border-bottom: 1px #ccc solid;
   margin:0 5px;
   padding: 0 5px;
   width: 40px;
   display: inline-block;
-}
-.textarea {
+} */
+/* .textarea {
   width: 100%;
   height: 30px;
   font-size: 14px;
@@ -22,4 +22,4 @@
             border: 1px solid red !important;
         }
     }
-}
+} */

+ 1 - 6
src/containers/CurrentIll.js

@@ -2,7 +2,6 @@ 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,SAVE_CURR_FREE} 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';
@@ -29,7 +28,6 @@ function mapStateToProps(state) { //console.log(111,state);
         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,
@@ -42,7 +40,7 @@ function mapStateToProps(state) { //console.log(111,state);
         boxLeft:state.homePage.boxLeft,
         allModules:state.homePage.allModules,
         // isChronic:!!state.diagnosticList.chronicMagItem,
-        isChronic:state.mainSuit.chronicDesease,
+        isChronic:state.mainSuit.chronicDesease||state.diagnosticList.chronicMagItem,
 
     }
 }
@@ -88,9 +86,6 @@ function mapDispatchToProps(dispatch) {
            }
          },500);
        },
-        setCurrentIll: value => {
-          dispatch({type: SET_CURRENT_ILL, value})
-        },
         pushMessage: (data) => {
           dispatch(() => pushMessage(data))
         },

+ 4 - 23
src/containers/MainSuit.js

@@ -1,22 +1,19 @@
 import React from 'react';
 import { connect } from 'react-redux';
 import MainSuit from '@components/MainSuit';
-import {CLEAR_COMSYMPTOMS,SHOW_TAIL,INSERT_MAIN,CLEAR_SEARCH,SET_SEARCH,SAVE_FREE,SET_DATA,INSERT_SEARCH,SETTEXTMODEVALUE,SET_FEATURE,SAVE_CHRONIC,SHOW_HISTORY_BOX,HIDE_HISTORY_BOX} from '@store/types/mainSuit';
+import {CLEAR_COMSYMPTOMS,SHOW_TAIL,INSERT_MAIN,CLEAR_SEARCH,SET_SEARCH,SAVE_FREE,SET_DATA,INSERT_SEARCH,SETTEXTMODEVALUE,SET_FEATURE,SAVE_CHRONIC} from '@store/types/mainSuit';
 import {RESET,CLICKCOUNT,ISREAD,SEARCH_DROP_LOCATION,MODI_LOADING} from '@store/types/homePage.js';
 import {getCommSymptoms,getCommSymptomPush} from '@store/async-actions/mainSuit.js'
-import {SET_MAIN_SUIT} from '@store/types/fillInfo';
 import {CLEAR_DIAGNOSE} from '@store/types/diagnosticList';
-import {getSearch,getFeature,setOtherHisModule,autoFillModules} from '@store/async-actions/fetchModules';
+import {getSearch,getFeature,autoFillModules} from '@store/async-actions/fetchModules';
 import {billing} from '@store/async-actions/pushMessage';
 import {didPushParamChange,filterDataArr,inspectAndAssist} from '@utils/tools.js';
 import config from '@config/index.js';
 import {Notify} from '@commonComp';
 import {getInitModules} from '@store/async-actions/homePage.js';
-import {CURRENT_CHRONIC} from '@store/types/currentIll';
-import {SET} from '@types/checkBody';
 import {SHOW_REFER_RECORD} from '@store/types/diagnosticList';
 
-function mapStateToProps(state) {//console.log(11,state);
+function mapStateToProps(state) {
   return {
     showDrop:state.mainSuit.showDrop,//用于更新
     update:state.mainSuit.update,
@@ -26,7 +23,6 @@ function mapStateToProps(state) {//console.log(11,state);
     saveText:state.mainSuit.saveText,
 	  searchData:state.mainSuit.searchDatas,//搜索结果
     type: state.typeConfig.typeConfig,
-    fillInfo: state.fillInfo,
     showArr:state.homePage.showDrop,
     totalHide:state.homePage.totalHide,
     focusIndex:state.mainSuit.focusIndex,
@@ -41,9 +37,7 @@ function mapStateToProps(state) {//console.log(11,state);
     boxLeft:state.homePage.boxLeft,
     currentData:state.currentIll.data,
     allModules:state.homePage.allModules,
-    chronicDesease:state.mainSuit.chronicDesease,
-    items:state.historyTemplates.items,
-    showHisBox:state.mainSuit.showHisBox,
+    chronicDesease:state.mainSuit.chronicDesease||state.diagnosticList.chronicMagItem,
   }
 }
 
@@ -102,11 +96,7 @@ function mapDispatchToProps(dispatch) {
             type: SET_DATA
           })
         },
-      setMainSuit: (value) => {
-        dispatch({type: SET_MAIN_SUIT, value})
-      },
       pushMessage(data) {//结构模式右侧推送
-        // console.log("右侧推送接口");
         dispatch(billing(data));
       },
       getSearchData:(item)=>{
@@ -156,7 +146,6 @@ function mapDispatchToProps(dispatch) {
       },
       fetchPushInfos(){//文本模式下推送
         //调右侧推送
-        console.log('右侧推送内容');
         dispatch(billing());
       },
       handleInput(obj){   //文本模式值保存
@@ -190,8 +179,6 @@ function mapDispatchToProps(dispatch) {
         }
       },
       async saveChronic(item){//储存慢病信息
-        // 页面已有数据不再请求
-        
         // loading
         dispatch({type:MODI_LOADING,flag:true});
         // 存慢病
@@ -203,10 +190,7 @@ function mapDispatchToProps(dispatch) {
         await dispatch(getInitModules);
         // 模板回来关闭;loading
         dispatch({type:MODI_LOADING,flag:false});
-        // 弹窗是否引用历史病例?
-        // dispatch({type:SHOW_HISTORY_BOX});
         dispatch({type:SHOW_REFER_RECORD});
-
       },
       pureSaveChronic(item){//引用病例时储存
         // 存慢病
@@ -215,9 +199,6 @@ function mapDispatchToProps(dispatch) {
           data:item
         })
       },
-      closeHisBox(){
-        dispatch({type:HIDE_HISTORY_BOX})
-      },
       getBilling: () => {
         dispatch(billing())
       },

+ 0 - 17
src/store/actions/fillInfo.js

@@ -1,17 +0,0 @@
-export const setMainSuit=(state,action)=>{
-  const res=Object.assign({},state);
-  res.mainSuit = action.value
-  return res;
-};
-
-export const setCurrentIll=(state,action)=>{
-  const res=Object.assign({},state);
-  res.currentIll = action.value
-  return res;
-};
-
-export const setOtherHistory=(state,action)=>{
-  const res=Object.assign({},state);
-  res.otherHistory = action.value
-  return res;
-};

+ 0 - 2
src/store/index.js

@@ -21,7 +21,6 @@ import homePage from './reducers/homePage';
 import mainSuit from './reducers/mainSuit';
 import diagnosticSearch from './reducers/diagnosticSearch'
 import typeConfig from './reducers/typeConfig';
-import fillInfo from './reducers/fillInfo';
 import pushMessage from './reducers/pushMessage';
 import submit from './reducers/submit';
 import checkBody from './reducers/checkBody';
@@ -56,7 +55,6 @@ const rootReducer = combineReducers({
     mainSuit,
     diagnosticSearch,
     typeConfig,
-    fillInfo,
     pushMessage,
     submit,
     treat,

+ 0 - 20
src/store/reducers/fillInfo.js

@@ -1,20 +0,0 @@
-import {SET_MAIN_SUIT, SET_CURRENT_ILL, SET_OTHER_HISTORY} from '../types/fillInfo'
-import {setMainSuit, setCurrentIll, setOtherHistory} from '../actions/fillInfo'
-
-const initState = {
-  mainSuit: '',
-  currentIll: '',
-  otherHistory: ''
-};
-export default function(state = initState, action) {
-  switch (action.type) {
-    case SET_MAIN_SUIT:
-      return setMainSuit(state, action);
-    case SET_CURRENT_ILL:
-      return setCurrentIll(state, action);
-    case SET_OTHER_HISTORY:
-      return setOtherHistory(state, action);
-    default:
-      return state;
-  }
-}

+ 1 - 7
src/store/reducers/mainSuit.js

@@ -2,7 +2,7 @@ import {COMM_SYMPTOMS,CLEAR_COMSYMPTOMS,SHOW_TAIL,INSERT_MAIN,
   SET_SEARCH,CLEAR_SEARCH,GET_BIGDATAPUSH,SET_MAINSUIT,MIX_CONFIRM,NUMBER_SELECT,
   RADIO_SELECT,COMM_CONFIRM,CHANGE_LABELVAL,SAVE_FREE,CLEAR_MAIN_SUIT,SET_DATA,
   INSERT_SEARCH,MAIN_FOCUS_INDEX,SETTEXTMODEVALUE,SETMAINTEXT,MAINADDLABELITEM,SETMAININPUT,DEL_MAIN,CHANGE_LABELVAL_NUMBER,
-  REMOVE_MAIN_ID,MAINSUIT_MUL,DEL_MAIN_LABLE,SET_FEATURE,SET_MS_RADIO_INPUT_VAL,SAVE_CHRONIC,SHOW_HISTORY_BOX,HIDE_HISTORY_BOX} from '../types/mainSuit'
+  REMOVE_MAIN_ID,MAINSUIT_MUL,DEL_MAIN_LABLE,SET_FEATURE,SET_MS_RADIO_INPUT_VAL,SAVE_CHRONIC} from '../types/mainSuit'
 import {getCommSymptoms,handleTailClick,insertMain,setSearch,getBigSymptom,setMainMoudle,confirm,
   setNumberValue,setRadioValue,commConfirm,changeLabelVal,saveFreeVal,clearMainSuit,insertSearch,setTextModeValue,setCheckText,
   addLabelItem,setInputLabel,backspaceText,changeNumLabelVal,removeId,multipleComfirn,delSingleLable,
@@ -103,12 +103,6 @@ export default function(state=initState,action){
     case SAVE_CHRONIC:
       res.chronicDesease = action.data;
       return res;
-    case SHOW_HISTORY_BOX://显示是否引用历史病例弹窗
-      res.showHisBox = true;
-      return res;
-    case HIDE_HISTORY_BOX://关闭
-      res.showHisBox = false;
-      return res;
     default:
       return state;
   }

+ 0 - 3
src/store/types/fillInfo.js

@@ -1,3 +0,0 @@
-export const SET_MAIN_SUIT = 'SET_MAIN_SUIT';
-export const SET_CURRENT_ILL = 'SET_CURRENT_ILL';
-export const SET_OTHER_HISTORY = 'SET_OTHER_HISTORY';

+ 0 - 2
src/store/types/mainSuit.js

@@ -29,5 +29,3 @@ export const DEL_MAIN_LABLE = 'DEL_MAIN_LABLE';
 export const SET_FEATURE = 'SET_FEATURE';  //主诉分词
 export const SET_MS_RADIO_INPUT_VAL = 'SET_MS_RADIO_INPUT_VAL';
 export const SAVE_CHRONIC = 'SAVE_CHRONIC'; //储存慢病信息
-export const SHOW_HISTORY_BOX = 'SHOW_HISTORY_BOX'; //是否引用历史病例弹窗
-export const HIDE_HISTORY_BOX = 'HIDE_HISTORY_BOX'; //关闭是否引用历史病例弹窗

+ 4 - 0
src/utils/tools.js

@@ -1029,6 +1029,10 @@ function fullfillText(arr,noPre=false,noEnd=false,ifEmpty=true){
         tempText = getSaveText(it);
       }
       saveText.push(tempText);
+      if(arr.length==1){
+        newArr.push(textLabel);
+        saveText.push('');
+      }
     }else{
       pre = arr[i-1];
       item = !ifEmpty&&i<config.showCheckNum?Object.assign({},it,{showInCheck:true}):it;