소스 검색

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

zhouna 6 년 전
부모
커밋
5ae0fe1ebf

+ 14 - 5
src/components/DiagResultSearch/index.jsx

@@ -3,13 +3,15 @@ import style from './index.less';
 import close from './img/close.png'
 import search from './img/search.png'
 import DiagnosticItem from '@containers/DiagnosticItem'
+import config from '@config/index';
 import $ from 'jquery';
 class DiagResultSearch extends Component {
     constructor(props) {
         super(props);
         this.state = {
             showClose: false,
-            focus: true
+            focus: true,
+            timer:null
         };
         this.searchInput = React.createRef();
         this.handleInput = this.handleInput.bind(this);
@@ -54,10 +56,17 @@ class DiagResultSearch extends Component {
     handleInput(value) {
         const {  setSearchValue, getSearchResult } = this.props;
         value.length > 0 ? this.setState({showClose: true}) : this.setState({showClose: false});
-        if(value.trim() == ''){
-          return  getSearchResult('');
-        }
-        getSearchResult(value.trim());
+        clearTimeout(this.state.timer);
+        let timer = setTimeout(()=>{
+            clearTimeout(this.state.timer);
+          if(value.trim() == ''){
+            return  getSearchResult('');
+          }
+          getSearchResult(value.trim());
+        },config.delayTime);
+        this.setState({
+          timer
+        });
     }
     clearInput() {
         const {  setSearchValue, getSearchResult } = this.props;

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

@@ -108,7 +108,7 @@ class PreviewBody extends Component {
     render() {
         const { show, preInfo, dataJson, dataStr,baseObj } = this.props;
         const infoNull = JSON.stringify(preInfo) == '{}';
-        console.log(dataStr,baseObj)
+
         return <div className={style['content']}>
             <div className={style['contents']} id="content" style={{margin:"0 auto"}}>
                 <div ref={this.$content} className={style['hisName']}>{preInfo.hospitalName}</div>

+ 47 - 3
src/containers/SpreadDrop.js

@@ -7,7 +7,7 @@ import {RESET,SETDROPSHOW,HIDEDROP,CLICKCOUNT,ISREAD} from '@store/types/homePag
 import {getModules as fetchModules} from '@store/async-actions/fetchModules.js';
 import {getCommSymptomPush} from '@store/async-actions/mainSuit.js'
 import {GET_BIGDATAPUSH,MIX_CONFIRM,COMM_CONFIRM,CHANGE_LABELVAL} from '@store/types/mainSuit';
-import {SETCHECKBOX,CHANGECHECKTEXTLABEL} from '@types/checkBody';
+import {SETCHECKBOX,CHANGECHECKTEXTLABEL,CHECKCONFIRMSELECTED} from '@types/checkBody';
 import {CURRENT_CONFIRM,SETMAINCHECKBOX,CURRENT_TEXT_LABEL,CURRENT_GET_BIGDATAPUSH} from '@types/currentIll';
 import {getLabelIndex,fullfillText,getIds} from '@common/js/func.js';
 import {billing} from '@store/async-actions/pushMessage';
@@ -130,7 +130,7 @@ function otherHisConfirm(dispatch,store,params){
   }
   let existsId = getIds(exists);
   let withsId = getIds(withs);
-  const ids = existsId.join(",")+withsId.join(",");
+  const ids = existsId.join(",")+','+withsId.join(",");
   if(!ids&&nones){      //只有无的项目
     dispatch({
       type: CONFIRMSELECTED,
@@ -165,7 +165,51 @@ function otherHisConfirm(dispatch,store,params){
 }
 
 function checkBodyConfirm(dispatch,store,params){
-  console.log(params)
+  const {nones,exists,withs,exclusion,excluName,copyType} = params;
+  // const ikey = params.ikey.substr(1,1);
+  const index = params.ikey;
+  let ikey = getLabelIndex(index);
+  if(params.exclusion){
+    dispatch({
+      type: CHECKCONFIRMSELECTED,
+      data:{exclusion,excluName,ikey,copyType}
+    });
+    return ;
+  }
+  let existsId = getIds(exists);
+  let withsId = getIds(withs);
+  const ids = existsId.join(",")+','+withsId.join(",");
+  if(!ids&&nones){      //只有无的项目
+    dispatch({
+      type: CHECKCONFIRMSELECTED,
+      data: {exists:[],withs:[],nones:nones,ikey,copyType}
+    });
+    dispatch({
+      type:ISREAD
+    });
+    return;
+  }
+  // const ids = exists.join(",")+withs.join(",");
+  let has = [],wes=[];
+  //获取选中项目模板
+  fetchModules(ids).then((res)=>{
+    if(+res.data.code===0){
+      const list = res.data.data;
+      existsId.map((i)=>{
+        has.push(...list[i].questionMapping);
+      });
+      withsId.map((i)=>{
+        wes.push(...list[i].questionMapping);
+      });
+      dispatch({
+        type: CHECKCONFIRMSELECTED,
+        data: {exists:fullfillText(has,false,false).newArr,withs:fullfillText(wes,false,false).newArr,nones:nones,ikey,copyType}
+      });
+      dispatch({
+        type:ISREAD
+      });
+    }
+  });
 }
 
 //在不同模块(主诉、现病史等)下拉选中调用不同事件

+ 52 - 0
src/store/actions/checkBody.js

@@ -10,6 +10,58 @@ export function set(state,action){
   res.isEmpty = false;
   return res;
 }
+//多选标签选中确定处理
+export const confirm = (state,action) =>{
+  let res = Object.assign({},state);
+  let arr = res.data;
+  const {nones,exists,withs,ikey,exclusion,excluName,copyType} = action.data;
+  const items = [...exists||[],...withs||[]];
+  if((!exists||!withs||items.length==0)&&!nones&&!exclusion){       //取消无殊的选中,空白提交
+    arr[ikey].value = '';
+    res.saveText[ikey] = '';
+    res.selecteds.splice(ikey,1);
+    res.update=Math.random();
+    return res;
+  }
+  //选中互斥项
+  if(exclusion){
+    arr[ikey].value = excluName;
+    res.saveText[ikey] = excluName;
+    res.selecteds[ikey] = action.data;
+    res.update=Math.random();
+    return res;
+  }
+  //只有无的项目选中
+  if(+copyType===0) {      //原标签保留
+    arr.splice(ikey,1);
+  }
+  if(arr[ikey].value)  arr[ikey].value= '';
+  let preText = arr[ikey-1].value!==undefined?arr[ikey-1].value:arr[ikey-1].name||'';
+  let newPreText =preText +nones;//console.log(arr[ikey-1],newPreText)
+  if(items.length==0&&nones){
+    arr[ikey-1].value = newPreText;
+    res.saveText[ikey-1] = newPreText;
+    res.selecteds[ikey] = null;       //无殊选中状态遗留bug修改
+    res.update=Math.random();
+    return res;
+  }
+  //有,伴,无随配
+  //arr.splice(ikey-1,1);
+  let flabel = items[items.length-1];         //要插入的最后一个标签
+  let labelText = flabel.value!==undefined?flabel.value:flabel.name;
+  let text = labelText;
+  //要插入的最后一个标签为自由文本,则和后面的文本标签文字合并
+  if(flabel.tagType==8){
+    flabel.value = labelText+nones;
+    text = flabel.value;
+  }
+  arr.splice(ikey,0,...exists,...withs);
+  //arr[ikey-1].value = text;
+  //res.saveText[ikey+items.length] = text;
+  res.saveText = fullfillText(arr).saveText;
+  res.update=Math.random();         //用于触发组件更新(data变化了因在对象中无法被组件检测到)
+  return res;
+};
 //查体中数字键盘选中事件
 export function setNumberValue(state,action){
   let res = Object.assign({},state);

+ 7 - 2
src/store/reducers/checkBody.js

@@ -1,6 +1,9 @@
 import {SET,SETNUMBER4,SETSELECTED4,SETCHECKBOX,ADDLABELITEM,SETCHECKTEXT,SETSEARCHDATA,
-  SELECTSEARCHDATA,CHANGECHECKTEXTLABEL,CLEARCHECKBODY,CHECK_FOCUS_INDEX,CHECKBODY_CLEAR,SETCHECKINPUT,DEL_CHECKBODY,CHANGECHECKTEXTLABEL_NUMBER} from '../types/checkBody.js';
-import {set,setNumberValue,setRadioValue,setCheckBoxValue,addLabelItem,setCheckText,setSearchData,insertLabelData,changeLabelVal,clearCheckBody,setInputLabel,backspaceText,changeNumLabelVal} from '../actions/checkBody.js';
+  SELECTSEARCHDATA,CHANGECHECKTEXTLABEL,CLEARCHECKBODY,CHECK_FOCUS_INDEX,CHECKBODY_CLEAR,
+  SETCHECKINPUT,DEL_CHECKBODY,CHANGECHECKTEXTLABEL_NUMBER,CHECKCONFIRMSELECTED} from '../types/checkBody.js';
+import {set,setNumberValue,setRadioValue,setCheckBoxValue,addLabelItem,setCheckText,
+  setSearchData,insertLabelData,changeLabelVal,clearCheckBody,setInputLabel,backspaceText,
+  changeNumLabelVal,confirm} from '../actions/checkBody.js';
 import config from '@config/index.js';
 
 //const block = Object.assign(JSON.parse(config.textLabel),{full:false});//空白时保留一个自由文本标签
@@ -35,6 +38,8 @@ export default function(state=initState,action){
       return clearCheckBody(state,action);
     case CHANGECHECKTEXTLABEL://改变标签值
       return changeLabelVal(state,action);
+    case CHECKCONFIRMSELECTED:
+      return confirm(state,action);
     case CHANGECHECKTEXTLABEL_NUMBER://数字键盘
       return changeNumLabelVal(state,action);
     case CHECK_FOCUS_INDEX:

+ 2 - 1
src/store/types/checkBody.js

@@ -13,4 +13,5 @@ export const CHECK_FOCUS_INDEX = 'check_focus_text_index';
 export const CHECKBODY_CLEAR = 'clear_search_check_body';
 export const SETCHECKINPUT = 'set_check_body_input_label';
 export const DEL_CHECKBODY = 'DEL_CHECKBODY';//backspace
-export const CHANGECHECKTEXTLABEL_NUMBER = 'CHANGECHECKTEXTLABEL_NUMBER';//数字键盘
+export const CHANGECHECKTEXTLABEL_NUMBER = 'CHANGECHECKTEXTLABEL_NUMBER';//数字键盘
+export const CHECKCONFIRMSELECTED = 'spread_check_body_labels';