浏览代码

现病史添加症状无推送数据时显示常用症状

zhouna 5 年之前
父节点
当前提交
2d6592912a

+ 3 - 3
src/components/CommonSymptom/index.jsx

@@ -56,7 +56,7 @@ class CommonSymptom extends Component{
         ids.push(id);
       }
       conceptId.push(copid);
-      select.push(item);
+      select.push(Object.assign(item,{id:item.questionId}));
     }
     this.setState({
       select,
@@ -112,11 +112,11 @@ class CommonSymptom extends Component{
   }
 
   render(){ 
-    const {data} = this.props;
+    const {data,isCurrent} = this.props;
     const {hide} = this.state;
     const mainSymp = storageLocal.get('mainSymp');
     const mainHis = mainSymp?JSON.parse(mainSymp).reverse():[];
-    return <div className={this.getClass()} contenteditable="false" style={{'display':hide?'none':'block'}} ref={this.div} onClick={this.handleOuter}>
+    return <div className={this.getClass()} contenteditable="false" style={{'display':hide?'none':'block',left:isCurrent?"auto":undefined}} ref={this.div} onClick={this.handleOuter}>
       <ul className={style["listBox"]}>
         {mainHis.length>0?<ul className={style["his"]}>
           <div className='clearfix'>

+ 1 - 1
src/components/CommonSymptom/index.less

@@ -6,7 +6,7 @@
   padding: 5px;
   white-space: pre-wrap;
   .listBox{
-    max-width: 460px;
+    width: 460px;
   }
   .his{
       color: #3B9ED0;

+ 16 - 5
src/components/SpreadDrop/index.jsx

@@ -5,6 +5,7 @@ import style from './index.less';
 import {setPosition,deepClone,handleEnter,isIE,windowEventHandler,filterDataArr,getIds,getPageCoordinate,setFontColorSize} from '@utils/tools.js';
 import {Notify} from '@commonComp';
 import ListItems from '@components/ListItems';
+import CommonSymptom from '@components/CommonSymptom';
 import $ from 'jquery';
 /****
  * 标签组合下拉,选中的项目展开
@@ -66,7 +67,7 @@ class SpreadDrop extends Component{
   }
   handleShow(e){//单击
     e&&e.stopPropagation();
-    const {ikey,handleShow,placeholder,flag,id,value,tagType,type,data,windowWidth,setHighter} = this.props;
+    const {ikey,handleShow,placeholder,flag,id,value,tagType,type,data,windowWidth,setHighter,CommonSymptoms} = this.props;
     let num = 0;//判断为五类切超出页面
     data && data.map((item)=>{
       if(item.formPosition != 1){
@@ -99,8 +100,8 @@ class SpreadDrop extends Component{
         $(e.target).parent().prev().attr({"contentEditable":false})
         this.setState({
           tmpDom:e.target
-        })
-        handleShow&&handleShow({ikey,placeholder,flag,id,value,tagType,type});
+        });
+        handleShow&&handleShow({ikey,placeholder,flag,id,value,tagType,type,hasCommon:CommonSymptoms.length>0});
       }
     },300)
 
@@ -340,6 +341,14 @@ class SpreadDrop extends Component{
       //withsName,
     });
   }
+  handleCommonSelect(obj){
+    const {handleConfirm,tagType,ikey,mainData,mainSaveText,type} = this.props;
+    const param = {tagType,ikey,exists:obj.select,type,mainData,mainSaveText,withs:[],nones:'',ban:{},noneIds:[],isCommon:true};
+    handleConfirm&&handleConfirm(param);
+    this.btnClickFlag = true;
+    //点确定后隐藏弹窗
+    this.props.handleHide();
+  }
   getClass(){
     const {isImports,show,value,isExtBlue,defaulted} = this.props;
     const blueBorder = this.state.editable?style['blue-border']:'';
@@ -372,10 +381,11 @@ class SpreadDrop extends Component{
     }
   }
   render(){
-    const {placeholder,value,show,data,order,type,tagType,pos,defaulted,showVal} = this.props;
+    const {placeholder,value,show,data,order,type,tagType,pos,defaulted,showVal,CommonSymptoms} = this.props;
     const {tmpDom,left} = this.state;
     let showDefaulted = this.ifDefault();
     let showV = showDefaulted&&value===undefined?showVal:value;       //未选中过值时展示默认选中
+    const showCommonData = (+type===2)&&(+tagType===11)&&CommonSymptoms.length>0?true:false;
     if(!show&&tmpDom){
       $(tmpDom).parent().prev().attr({"contentEditable":true})
     }
@@ -394,8 +404,9 @@ class SpreadDrop extends Component{
         onInput={this.onChange}
         onkeydown={handleEnter}
         >{showV||placeholder}</div>
+      {showCommonData&&show?<CommonSymptom data={CommonSymptoms} show={true} onSelect={this.handleCommonSelect.bind(this)} isCurrent={true} />:
           <ListItems parDiv={this.$list} defaulted={showDefaulted&&defaulted} pos={pos} 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} handleSelect={this.handleSelect} handleConfirm={this.handleConfirm} handleClear={this.handleClear} {...this.state}></ListItems>}
       </div>
   }
 }

+ 15 - 2
src/containers/SpreadDrop.js

@@ -5,14 +5,15 @@ import SpreadDrop from '@components/SpreadDrop';
 import {SETSELECTED,CLEARSELECTED,CONFIRMSELECTED,SETOTHERCHECKBOX,CHANGEOTHERTEXTLABEL} from '@types/otherHistory';
 import {RESET,SETDROPSHOW,HIDEDROP,CLICKCOUNT,ISREAD} from '@store/types/homePage.js';
 import {getModules as fetchModules} from '@store/async-actions/fetchModules.js';
-import {getCommSymptomPush} from '@store/async-actions/mainSuit.js'
+import {getCommSymptomPush,getCommSymptoms} from '@store/async-actions/mainSuit.js'
 import {GET_BIGDATAPUSH,MIX_CONFIRM,COMM_CONFIRM,CHANGE_LABELVAL} from '@store/types/mainSuit';
 import {SETCHECKBOX,CHANGECHECKTEXTLABEL,CHECKCONFIRMSELECTED} from '@types/checkBody';
-import {CURRENT_CONFIRM,SETMAINCHECKBOX,CURRENT_TEXT_LABEL,CURRENT_GET_BIGDATAPUSH} from '@types/currentIll';
+import {CURRENT_CONFIRM,SETMAINCHECKBOX,CURRENT_TEXT_LABEL,CURRENT_GET_BIGDATAPUSH,SHOW_COMMON_ON_CURRENT} from '@types/currentIll';
 import {billing} from '@store/async-actions/pushMessage';
 import {Notify} from '@commonComp';
 import {filterArr,didPushParamChange,filterDataArr,getLabelIndex,fullfillText,checkFullfillText,getIds} from '@utils/tools.js';
 import config from '@config/index.js';
+import {CLEAR_COMSYMPTOMS} from "../store/types/mainSuit";
 
 function mapStateToProps(state) {//console.log(state);
   const {mainSuit,homePage} = state;
@@ -26,6 +27,7 @@ function mapStateToProps(state) {//console.log(state);
     windowWidth:homePage.windowWidth,
     otherDefault:+curOtherMode===1,
     curDefault:+curMode===1,
+    CommonSymptoms:mainSuit.CommonSymptoms,//常见症状
   }
 }
 
@@ -466,6 +468,9 @@ function mapDispatchToProps(dispatch,store){
     handleConfirm(obj){
       if(obj.tagType == 6||obj.tagType == 11){//铺开
         handleModuleDiff(dispatch,store,obj);
+        obj.isCommon&&dispatch({     //选中常见后清空常见症状
+          type:CLEAR_COMSYMPTOMS
+        });
       }else if(obj.tagType == 2){//普通多选
         handleCheckBox(dispatch,store,obj);
       }
@@ -496,6 +501,14 @@ function mapDispatchToProps(dispatch,store){
         if(+result.code == 0){
           // let pushDataList = result.data.symptom;
           let bigDataList = result.data.symptom;
+          if(+obj.type===2&&!bigDataList&&!obj.hasCommon){
+            dispatch(getCommSymptoms());
+            dispatch({
+              type:SETDROPSHOW,
+              data:obj
+            });
+            return;
+          }
           let pushDataList = [];
           if(bigDataList&&bigDataList.length>0){//剔除没有id
             pushDataList = bigDataList.filter(function(item){

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

@@ -2,7 +2,8 @@
 import {RECOVER_TAG_CURRENT,SET_CURRENT,CURRENT_CONFIRM,INSERT_PROCESS,SET_CURRENT_DATA,SET_LABEL_MODULE,SETMAINCHECKBOX,
   CURRENT_RADIO,CURRENT_NUMBER,CURRENT_TEXT_LABEL,CLEAR_CURRENT_ILL,SETTEXTMODEVALUE,CURRENT_GET_BIGDATAPUSH,CURRENT_CLEAR,
   SET_CURRENT_SEARCH,SETCURRENTTEXT,CURRENT_FOCUS_INDEX,SELECT_SEARCHDATA,CLEAR_CURRENT_EDIT,CURRENTADDLABELITEM,
-  SETCURRENTINPUT,DEL_CURRENT,REMOVE_CURR_ID,CURRENT_MUL,DEL_CURRENT_LABLE,SET_RADIO_INPUT_VALUE,CURRENT_CHRONIC,SAVE_CURR_FREE} from '../types/currentIll';
+  SETCURRENTINPUT,DEL_CURRENT,REMOVE_CURR_ID,CURRENT_MUL,DEL_CURRENT_LABLE,SET_RADIO_INPUT_VALUE,CURRENT_CHRONIC,
+  SAVE_CURR_FREE,SHOW_COMMON_ON_CURRENT} from '../types/currentIll';
 import {confirm,insertProcess,setData,setCheckBox,changeLabelVal,clearCurrentIll,
   setTextModeValue,setModule,bigDataSymptom,insertLabelData,clearCurrentEdit,
   backspaceText,removeId,multipleComfirn,delSingleLable,fillChronicModule} from '../actions/currentIll';
@@ -17,7 +18,8 @@ const initState = {
   addModule:[],
   emptyData:[],
   symptomIds:[], //搜索去重
-  currReadSonM:[] //回读的子模板
+  currReadSonM:[], //回读的子模板
+  showCommon:false,   //是否显示常见症状
 };
 export default function(state=initState,action){    
   const res = Object.assign({},state);
@@ -86,6 +88,9 @@ export default function(state=initState,action){
       return res;
     case RECOVER_TAG_CURRENT:
       return recoveTag(state,action);
+    case SHOW_COMMON_ON_CURRENT:
+      res.showCommon = action.show;
+      return res;
     default:
       return state;
   }

+ 1 - 1
src/store/types/currentIll.js

@@ -29,4 +29,4 @@ export const CURRENT_CHRONIC = 'CURRENT_CHRONIC';//慢病填充模板
 export const SAVE_CURR_FREE = 'SAVE_CURR_FREE';//自由输入
 export const CHANGE_CURRENT_LABELVAL = 'CHANGE_CURRENT_LABELVAL';//双击标签输入改变值
 export const RECOVER_TAG_CURRENT = 'RECOVER_TAG_CURRENT';     //恢复已删除标签
-
+export const SHOW_COMMON_ON_CURRENT = 'SHOW_COMMON_ON_CURRENT';     //现病史中显示常用症状