Browse Source

Merge remote-tracking branch 'origin/dev/new1' into dev/new1

# Conflicts:
#	src/common/components/SearchBox/index.jsx
#	src/components/SpreadDrop/index.jsx
#	src/containers/SearchBox.js
#	src/store/actions/mainSuit.js
zhouna 5 years atrás
parent
commit
c496fea552

+ 1 - 1
src/components/MainSuit/index.jsx

@@ -162,7 +162,7 @@ class MainSuit extends Component{
         return
       }
       ev.target.blur();
-      ev.target.innerText?(ev.target.innerText = data.substr(0,config.limited)):(ev.target.innerHTML = data.substr(0,config.limited));  //输入法内输入多个字再按enter的情况
+      // ev.target.innerText?(ev.target.innerText = data.substr(0,config.limited)):(ev.target.innerHTML = data.substr(0,config.limited));  //输入法内输入多个字再按enter的情况
       //console.log(333,data,ev)
       // ev.target.blur();
       this.setState({

+ 10 - 13
src/components/SpreadDrop/index.jsx

@@ -382,7 +382,7 @@ class SpreadDrop extends Component{
         onkeydown={handleEnter}
         >{value||placeholder}</div>
           <ListItems parDiv={this.$list} data={data} order={order} left={left} boxMark={type} tagType={tagType}
-             show={show} handleSelect={this.handleSelect} handleConfirm={this.handleConfirm} handleClear={this.handleClear} {...this.state}></ListItems>
+             show={show} cliIndex={clickIndx} handleSelect={this.handleSelect} handleConfirm={this.handleConfirm} handleClear={this.handleClear} {...this.state}></ListItems>
       </div>
   }
 }
@@ -424,7 +424,7 @@ class ListItems extends Component{
   clickConfirm(){
     const {handleConfirm} = this.props;
     this.child&&this.child.reset();//重置搜索框中的数据
-    handleConfirm();   
+    handleConfirm();
   }
   getStyle(){
     const {show,left} = this.props;
@@ -433,23 +433,20 @@ class ListItems extends Component{
       left:left
     }
   }
-  searchSelect(item){
-    const {handleSelect,handleConfirm} = this.props;
-    handleSelect&&handleSelect(item);     //添加到大数据推送一起选中
-    handleConfirm&&handleConfirm();       //确定事件
-  }
   render (){
-    const {handleClear,order,parDiv,boxMark,tagType,show} = this.props;
+    const {handleClear,handleConfirm,order,parDiv,boxMark,tagType,show,cliIndex,ban} = this.props;
     return <div className={style["drop-list"]} ref={parDiv} style={this.getStyle()} contentEditable="false" onClick={(e)=>{e.stopPropagation();}}>
         <p className={style['orderTips']}>按{order?'从左到右从上到下':'点击'}顺序成文</p>
         {this.getLabels()}
-        {boxMark==1 && tagType==11 && <div className="search">
-          <SearchBox show={show} onSelect={this.searchSelect.bind(this)} onRef={(child)=>{this.child = child;}}/>
-        </div>}
         <div className="oper clearfix">
           <span className={style['clear']} onClick={handleClear}>清空选项</span>
           <span className={style['confirm']} onClick={this.clickConfirm}>确定</span>
         </div>
+
+        {boxMark==1 && tagType==11 && <div className="search">
+                  <div className={style["line"]}></div>
+                  <SearchBox show={show} cliIndex={cliIndex} onSelect={handleConfirm} onRef={(child)=>{this.child = child;}} ban={ban}/>
+                </div>}
       </div>
   }
 }
@@ -548,8 +545,8 @@ class ListItem extends Component{
   getMainData(){//主诉添加症状-带搜索框
     const {datas,isSpecialPos} = this.props;
     return datas&&datas.map((it,i)=>{
-      return <li onClick={(e)=>this.handleClick(e,it,i)} 
-            className={this.getClass(it.id)} 
+      return <li onClick={(e)=>this.handleClick(e,it,i)}
+            className={this.getClass(it.id)}
             title={it.name.length>4?it.name:''}
             style={{'width':'55px','display':'inline-block'}}>
             {it.name&&it.name.length>4?it.name.slice(0,4)+'...':it.name}

+ 29 - 1
src/containers/SearchBox.js

@@ -1,7 +1,13 @@
 import {connect} from 'react-redux';
 import SearchBox from '@commonComp/SearchBox';
 import {getSearch} from '@store/async-actions/fetchModules.js';
-import {CLEAR_ADD_SEARCH,SET_ADD_SEARCH} from '@store/types/mainSuit';
+import {CLEAR_ADD_SEARCH,SET_ADD_SEARCH,CHOOSE_SEARCH} from '@store/types/mainSuit';
+import {ISREAD} from '@store/types/homePage.js';
+import {billing} from '@store/async-actions/pushMessage';
+import {Notify} from '@commonComp';
+import {filterDataArr} from '@utils/tools.js';
+import store from '@store';
+import config from '@config/index.js';
 
 function mapStateToProps(state){
   return{
@@ -27,6 +33,28 @@ function mapDispatchToProps(dispatch){
           }
       });
     },
+    chooseSearch(obj){
+      // 主诉字数限制
+      let state = store.getState();
+      let mainSaveText = state.mainSuit.saveText;
+      let text = filterDataArr(mainSaveText);
+      let total = text.length + obj.item.name.length + 1; //+1是因为顿号
+      if(total >= config.limited){
+        Notify.info(config.limitText);
+        return
+      }
+      dispatch({
+        type: CHOOSE_SEARCH,
+        info:obj
+      })
+      dispatch({    //自由文本标签数据更新
+        type:ISREAD
+      });
+      //右侧推送
+      setTimeout(function(){ 
+        dispatch(billing());
+      },200);
+    },
     clearSearch:()=>{
       dispatch({
         type: CLEAR_ADD_SEARCH

+ 6 - 4
src/modules/HomePage/index.jsx

@@ -4,6 +4,7 @@ import BannerContainer from '@containers/TypeConfigContainer';
 //  引入组件
 import BodyContainer from "@components/BodyContainer";
 import {ConfirmModal} from '@commonComp';
+import store from '@store';
 
 import {HIDEDROP,SETMINSCREEN,SETSYSTEMCONFIG,SETPRE} from '@store/types/homePage.js';
 import {CLEAR_SEARCH} from '@types/mainSuit';
@@ -13,7 +14,7 @@ import {CHECKBODY_CLEAR} from '@types/checkBody';
 import style from './index.less';
 import {getInitModules,getChronic,getSystemConfig} from '@store/async-actions/homePage.js';
 import {getPreMsg} from '@store/async-actions/patInfo.js';
-import { getUrlArgObject,parseNameVal } from "@utils/tools";
+import { getUrlArgObject,parseNameVal,pushAllDataList } from "@utils/tools";
 import $ from 'jquery';
 import loading from '@common/images/loading.gif';
 class HomePage extends Component {
@@ -90,9 +91,10 @@ const mapStateToProps = function (state) {
   }
 };
 const mapDispatchToProps = function (dispatch) {
-    return {
-      referRecord(){
-        getPreMsg(dispatch)
+  return {
+    referRecord(){
+        pushAllDataList(1,'push',store.getState().homePage.preData,'preIcss');
+        dispatch({type:SETPRE,show:false});
       },
       noReferRecord(){
         dispatch({type:SETPRE,show:false});

+ 48 - 0
src/store/actions/mainSuit.js

@@ -403,6 +403,54 @@ export const setSearch = (state,action)=>{
   res.isEnd = action.isEnd;
   return res;
 }
+// 主诉-添加症状-选中搜索结果
+export const chooseSearch = (state,action)=>{
+  const res = Object.assign({},state);
+  const {item,cliIndex,ban} = action.info;
+  const index = parseInt(cliIndex);
+  let data = res.data;
+  let text = {id:item.questionId,name:item.name,value:item.name,tagType:config.tagType,conceptId:item.conceptId};
+  // 判断index前是saveText中是否有伴
+  let nText = {};
+  if(!data[index].pos){//第一病程
+    const preText = res.saveText.slice(0,index);
+    const ind = preText.indexOf("伴");
+    if(ind != -1 || ban){
+      nText = Object.assign({},text,{exist:2});
+    }else{
+      nText = Object.assign({},text,{exist:1});
+    }
+  }else{//第二及以上病程
+    nText = Object.assign({},text);
+  }
+
+  // 缓存到localStorage中
+  const mainSymp = storageLocal.get('mainSymp');
+  if(mainSymp){
+    let localArr = JSON.parse(mainSymp);
+    let sympArr = JSON.parse(JSON.stringify(localArr));
+    for(let k=0; k<localArr.length; k++){//判断是否已存在
+      if(localArr[k].conceptId==item.conceptId){
+        sympArr.splice(k,1);
+      }
+    }
+    sympArr.push(nText);
+    if(sympArr.length>5){
+      storageLocal.set('mainSymp',sympArr.slice(sympArr.length-5,));
+    }else{
+      storageLocal.set('mainSymp',sympArr);
+    }
+  }
+  // 插入data中
+  res.data.splice(index,0,Object.assign({},nText,{name:'、'+item.name,value:'、'+item.name}));
+  res.saveText.splice(index,0,'、'+item.name);
+  res.mainIds.push(item.conceptId);
+  if(item.questionId){
+    res.mainTailIds.push(item.questionId);
+  }
+  res.update=Math.random();
+  return res;
+}
 
 //将选中的搜索结果插入
 export const insertSearch = (state,action)=>{

+ 8 - 5
src/store/async-actions/patInfo.js

@@ -5,9 +5,10 @@ import {getInfos} from '@store/actions/getInfoByUuid';
 import {getUrlArgObject,pushAllDataList} from '@utils/tools';
 import {getInitModules,getCommonList} from '@store/async-actions/homePage.js';
 import store from '@store'
-import {ISREAD,MODI_LOADING,SETPRE} from "../types/homePage";
+import {ISREAD,MODI_LOADING,SETPRE,SETPREDATA} from "../types/homePage";
 import { initItemList } from '@store/async-actions/tabTemplate';
 import config from '@config/index';
+import {Notify} from '@commonComp';
 
 const api = {
     getPatInfo: '/patientInfo/getTopPatientInfo',
@@ -34,10 +35,10 @@ export const getPreMsg = (dispatch, getState) => {
               other:result.qts?new Array(result.qts):[],
               checkBody:result.supplement?result.supplement:''
             }
-            pushAllDataList(1,'push',preIcss,'preIcss');
-            dispatch({type:SETPRE,show:false});
+            dispatch({type:SETPRE,show:true});
+            dispatch({type:SETPREDATA,preData:preIcss});
         } else {
-            console.log(res)
+            // console.log(res)
         }
     })
 }
@@ -93,7 +94,9 @@ export const initHistoryDetails = (dispatch) => {
                   pushAllDataList(detail.sign,'push',detail,'history');
                 }else{
                   let pre = baseList.homePage.sysConfig.connect_prec;
-                  (pre==1)&&dispatch({type:SETPRE,show:true});
+                  getPreMsg(dispatch)
+                  // (pre==1)&&dispatch({type:SETPRE,show:true});
+
                 }
                 dispatch({
                   type:ISREAD

+ 5 - 2
src/store/reducers/homePage.js

@@ -1,4 +1,4 @@
-import {HIDE,RESET,SETINITDATA,SETDROPSHOW,SETADDITEMINIT,SETT0EDIT,SETREADDITEMS,
+import {HIDE,RESET,SETINITDATA,SETDROPSHOW,SETADDITEMINIT,SETT0EDIT,SETREADDITEMS,SETPREDATA,
   HIDEDROP,CLICKCOUNT,ISREAD,SETOTHERHISTORY,SETMINSCREEN,MODI_LOADING,GET_INSPECT_LIST,GET_ASSIST_LIST,SETALLMODULES,SETSYSTEMCONFIG,SETPRE} from '../types/homePage.js';
 import {showDrop,setAddItemInit,setLabelToEdit,confirmHide,clickNum,getInspectList,getAssistList} from '../actions/homePage.js';
 
@@ -17,7 +17,8 @@ const initState = {
   assistList:[],
   inspectList:[],
   sysConfig:{},
-  showPre:false
+  showPre:false,
+  preData:{}
 };
 
 export default function (state=initState,action) {
@@ -76,6 +77,8 @@ export default function (state=initState,action) {
       return res;
     case SETPRE:
       res.showPre = action.show;
+    case SETPREDATA:
+      res.preData = action.preData;
     default:
       return res;
   }

+ 1 - 0
src/store/types/homePage.js

@@ -17,3 +17,4 @@ export const GET_INSPECT_LIST = 'GET_INSPECT_LIST';    //化验
 export const SETALLMODULES = 'SETALLMODULES';    //储存所有模板数据
 export const SETSYSTEMCONFIG = 'SETSYSTEMCONFIG';   //设置配置数据
 export const SETPRE = 'SETPRE';   //设置预问诊引用弹窗
+export const SETPREDATA = 'SETPREDATA';   //设置预问诊数据暂存