瀏覽代碼

Merge remote-tracking branch 'origin/dev5.4.1' into dev/new1

# Conflicts:
#	src/containers/SpreadDrop.js
#	src/store/reducers/currentIll.js
#	src/store/types/currentIll.js
zhouna 5 年之前
父節點
當前提交
aad9cd3444

+ 4 - 4
src/components/AssessResult/ChooseItem/index.jsx

@@ -45,9 +45,9 @@ class ChooseItem extends Component {
                                 <Radio label={i.detailName}
                                        value={i.detailName}
                                        disabled={disabled}
-                                       isSelect={selecteds&&selecteds[it.name]==i.detailName}
+                                       isSelect={selecteds&&selecteds[it.name]==i.detailName||(Object.keys(selecteds||{}).length===0&&i.state==1)}
                                        handleClick={this.handleRadio.bind(this,it.name,i.detailName)}></Radio>
-                                {i.state?<i>(智能推荐)</i>:''}
+                                {/*{i.state?<i>(智能推荐)</i>:''}*/}
                               </div>;
                     }else{
                       return <div className={style['choose-item']}>
@@ -55,9 +55,9 @@ class ChooseItem extends Component {
                                           value={i.detailName}
                                           label={i.detailName}
                                           disabled={disabled}
-                                          isSelect={selecteds&&selecteds[it.name]&&selecteds[it.name].includes(i.detailName)}
+                                          isSelect={(selecteds&&selecteds[it.name]&&selecteds[it.name].includes(i.detailName))||(Object.keys(selecteds||{}).length===0&&i.state==1)}
                                           handleClick={this.handleCheckbox.bind(this,it.name,i.detailName)}/>
-                                {i.state?<i>(智能推荐)</i>:''}
+                                {/*{i.state?<i>(智能推荐)</i>:''}*/}
                               </div>;
                     }
                   })}

+ 2 - 2
src/components/AssessResult/ScaleItem/index.jsx

@@ -279,10 +279,10 @@ class ScaleItem extends Component {
                           {it.content.details&&it.content.details.map((lis,ind)=>{
                             return <div className={style["chooseItem"]}>
                               <Radio label={lis.detailName}
-                                     isSelect={radioVal&&radioVal[item.conceptId]==lis.detailName}
+                                     isSelect={radioVal&&radioVal[item.conceptId]==lis.detailName||(Object.keys(radioVal).length===0&&lis.state==1)}
                                      handleClick={this.handleRadio.bind(this,lis,item,i)}>
                               </Radio>
-                              {lis.state==1?<span className={style['recomand']}>(智能推荐)</span>:''}
+                              {/*{lis.state==1?<span className={style['recomand']}>(智能推荐)</span>:''}*/}
                             </div>
                           })}
                         </div>

+ 9 - 3
src/components/ChronicInfo/index.jsx

@@ -274,6 +274,12 @@ class ChronicInfo extends React.Component{
   confirmOption(parent,pIndex,i){//可能结果确定
     const {radioVal,possible} = this.state;
     const {savePossibleResult,chronicMagItem} = this.props;
+    if(Object.keys(radioVal).length===0){     //初始状态,可能有推荐选项
+      const defaulted = parent.details[i].content.details.filter((it)=>+it.state===1);
+      if(defaulted.length>0){
+        radioVal[parent.conceptId] = defaulted[0].detailName;
+      }
+    }
     this.setState({
       possible:Object.assign({},possible,radioVal),
       radioVal:Object.assign({},possible,radioVal),//不设置radioVal只有最近一次选中的值
@@ -482,16 +488,16 @@ class ChronicInfo extends React.Component{
                                 show={optionId&&optionId==v.conceptId?true:false}
                                 close={this.closeOption}
                                 confirm={this.confirmOption.bind(this,v,i,j)}
-                                footer={radioVal[v.conceptId]?true:false}>
+                                footer={true}>
                                 <div className={style["infoOption"]}>
                                   <span>{it.content.name?it.content.name+':':''}</span>
                                   {it.content.details&&it.content.details.map((lis,ind)=>{
                                     return <div className={style["chooseItem"]}>
                                       <Radio label={lis.detailName}
-                                               isSelect={radioVal[v.conceptId]==lis.detailName}
+                                               isSelect={radioVal[v.conceptId]==lis.detailName||(Object.keys(radioVal).length===0&&lis.state==1)}
                                                handleClick={this.handleRadio.bind(this,lis,v)}>
                                         </Radio>
-                                        {lis.state==1?<span className={style['recomand']}>(智能推荐)</span>:''}
+                                        {/*{lis.state==1?<span className={style['recomand']}>(智能推荐)</span>:''}*/}
                                     </div>
                                   })}
                                 </div>

+ 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,mouseSelect} = this.props;
     const blueBorder = this.state.editable?style['blue-border']:'';
@@ -383,10 +392,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})
     }
@@ -406,8 +416,9 @@ class SpreadDrop extends Component{
         onMouseUp={this.handleMouseUp.bind(this)}
         onMouseDown={this.handleMouseDown.bind(this)}
         >{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,SET_SELECTED_AREA} 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,//常见症状
     select_start:homePage.select_start,
   }
 }
@@ -467,6 +469,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);
       }
@@ -497,6 +502,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){

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

@@ -2,7 +2,7 @@
 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,DELETE_CURRENT_SELECTED_TAGS} from '../types/currentIll';
+  SETCURRENTINPUT,DEL_CURRENT,REMOVE_CURR_ID,CURRENT_MUL,DEL_CURRENT_LABLE,SET_RADIO_INPUT_VALUE,CURRENT_CHRONIC,SAVE_CURR_FREE,DELETE_CURRENT_SELECTED_TAGS,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 +17,8 @@ const initState = {
   addModule:[],
   emptyData:[],
   symptomIds:[], //搜索去重
-  currReadSonM:[] //回读的子模板
+  currReadSonM:[], //回读的子模板
+  showCommon:false,   //是否显示常见症状
 };
 export default function(state=initState,action){    
   const res = Object.assign({},state);
@@ -88,6 +89,9 @@ export default function(state=initState,action){
       return recoveTag(state,action);
     case DELETE_CURRENT_SELECTED_TAGS:
       return deleteSelectedLabels(state,action);
+    case SHOW_COMMON_ON_CURRENT:
+      res.showCommon = action.show;
+      return res;
     default:
       return state;
   }

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

@@ -29,5 +29,6 @@ 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';     //现病史中显示常用症状
 export const DELETE_CURRENT_SELECTED_TAGS='DELETE_CURRENT_SELECTED_TAGS';