Selaa lähdekoodia

Merge branch 'optimize' of http://192.168.2.236:10080/zhouna/newICSS into optimize

Luolei 6 vuotta sitten
vanhempi
commit
bbd35ad2a0

+ 1 - 1
src/common/components/Footer/index.jsx

@@ -14,7 +14,7 @@ const Footer = (props) => {
   const {footText,print,handlePrint,handleConfirm} = props;
   return <div className={style['footer']}>
     {print?<span className={style['print']} onClick={handlePrint}><img src={printIcon} alt=""/>打印</span>:''}
-        <span className={style['okBtn']} onClick={handleConfirm}>{footText}</span>
+    {handleConfirm?<span className={style['okBtn']} onClick={handleConfirm}>{footText}</span>:''}
   </div>;
 }
 

+ 2 - 1
src/common/components/Footer/index.less

@@ -18,7 +18,8 @@
       }
       .okBtn{
         .btnCom;
-        width: 80px;
+        /*width: 80px;*/
+        padding: 0 10px;
         height: 34px;
         line-height: 32px;
         border: 1px solid #3B9ED0;

+ 3 - 1
src/common/components/MiniToast/index.less

@@ -7,6 +7,7 @@
   border: 1px solid #EAEDF1;
   /*box-shadow: 0 5px 10px 0 rgba(0,0,0,0.10);*/
   box-shadow: 0 10px 20px 0 #989DA3;
+  margin-bottom: 20px;
   .infoTitle{
     height: 40px;
     line-height: 40px;
@@ -32,7 +33,8 @@
     span{
       color:#3B9ED0;
       display: inline-block;
-      width: 66px;
+      /*width: 66px;*/
+      padding:0 10px;
       height: 32px;
       line-height: 32px;
       text-align: center;

+ 1 - 1
src/common/components/Textarea/index.jsx

@@ -22,7 +22,7 @@ class Textarea extends Component {
   handleFocus(){            //初始显示props中的值,focus已经显示输入的值,避免值更新闪烁
     const {handleFocus,fuzhen,handleInput,isChronic} = this.props;
     handleFocus&&handleFocus();         //其他史、查体获取数据的方法
-    if(fuzhen&& !isChronic.name&&!(this.$dom.current.innerText?this.$dom.current.innerText:this.$dom.current.innerHTML)){
+    if(fuzhen&& !isChronic&&!(this.$dom.current.innerText?this.$dom.current.innerText:this.$dom.current.innerHTML)){
       const text = config.currentText.replace("(**)",fuzhen.replace(";",''));
       this.$dom.current.innerText?(this.$dom.current.innerText = text):(this.$dom.current.innerHTML = text);
       handleInput&&handleInput({text});

BIN
src/common/images/likely.png


+ 23 - 9
src/components/AssessResult/ScaleItem/index.jsx

@@ -65,13 +65,13 @@ class ScaleItem extends Component {
   handleShowScale(item){
     const {showScaleFn,closeAssess} = this.props;
     //closeAssess&&closeAssess();    //关闭评估弹窗
-    showScaleFn&&showScaleFn(item);
+    showScaleFn&&showScaleFn(item,true);
   }
   handleRadio(item,parent){
     let {result} = this.props;
     let radioVal = result&&result.radioVal;
     this.setState({
-      radioVal:Object.assign({},radioVal,{[parent.id]:item.detailName})
+      radioVal:Object.assign({},radioVal,{[parent.conceptId]:item.detailName})
     })
   }
   handleInputformula(id,calcuContent,i,e) {
@@ -171,7 +171,7 @@ class ScaleItem extends Component {
       let it=its;
       if(indexs[i]&&indexs[i].includes(j)){
         if(its.type==1){     //量表
-          let scaleRes=formulaResult&&formulaResult[it.content.id]&&formulaResult[it.content.id].calcalculate;
+          let scaleRes=formulaResult&&formulaResult[it.content.conceptId]&&formulaResult[it.content.conceptId].calcalculate;
           temp =<span className={style['scale']}
                       onClick={()=>this.handleShowScale(it.content)}>
                         {scaleRes&&scaleRes.result?(' 【'+it.content.name+'】 结果:'+scaleRes.result.value+" "+(scaleRes.result.text||'')):'【'+it.content.name+'】'}
@@ -252,7 +252,7 @@ class ScaleItem extends Component {
                          show={optionId&&optionId==item.conceptId?true:false}
                          close={this.closeOption}
                          confirm={this.confirmOption.bind(this,item.conceptId)}
-                         footer="true">
+                         footer={true}>
                         <div className={style["infoOption"]}>
                           <span>{it.content.name?it.content.name+':':''}</span>
                           {it.content.details&&it.content.details.map((lis,ind)=>{
@@ -269,7 +269,7 @@ class ScaleItem extends Component {
                     </MiniToast>
                   </div>;
         }
-        const passId = item.details[j].type==1?item.details[j].content.id:undefined;
+        const passId = item.details[j].type==1?item.details[j].content.conceptId:undefined;
         const li = disabled?<li>
             <span>{item.name}:</span>
             <div className={style['row']}>{temp}</div>
@@ -291,10 +291,24 @@ class ScaleItem extends Component {
       return this.getDetailItems(it,i);
     });
   }
+  getScaleContent(data){
+    const item = data&&data.find((it)=>{
+      return it.type==1;
+    });
+    if(!item){
+      return null;
+    }
+    const content = JSON.parse(item.content||null);
+    return {id:item.conceptId,content,name:content.scaleName};
+  }
   getScales(){
     const {scaleItems,disabled,formulaResult} = this.props;
-    let li='',temp='';
-    const arr = scaleItems&&scaleItems.map((it,i)=>{
+    let li='',temp='',arr=[],it={};
+    if(!scaleItems){
+      return '';
+    }
+    for( let i in scaleItems){
+      it = this.getScaleContent(scaleItems[i]);
       if(!it) return '';
       let scaleRes=formulaResult&&formulaResult[it.id]&&formulaResult[it.id].calcalculate;
       temp =<span className={style['scale']} onClick={()=>this.handleShowScale(it)}>
@@ -306,12 +320,12 @@ class ScaleItem extends Component {
       </li>:<li>
         <span>相关量表:</span>
         <div className={style['row']}>{temp}</div>
-        <div className={style["recommend"]} onClick={()=>this.props.handleRemove(true,i,it.id)}>
+        <div className={style["recommend"]} onClick={()=>this.props.handleRemove(true,it.id)}>
           <img className={style["deleteIcon"]} src={deleteIcon} />
         </div>
       </li>;
       return li;
-    });
+    };
     return arr;
   }
   handleInput(e){

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

@@ -55,7 +55,7 @@ class AssessResult extends Component {
       ids.splice(idIndex,1);
     }
     if(isList){         //删除全部量表中的项目
-      const items = [...this.state.wholeScaleItems];
+      const items = Object.assign({},this.state.wholeScaleItems);
       items[i]=null;
       this.setState({
         wholeScaleItems: items,

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

@@ -148,8 +148,8 @@
   line-height: 32px;
   color: #fff;
   background: #3B9ED0;
-  cursor: auto;
   margin-top: 15px;
+  cursor: pointer;
 }
 .textareaStatic {
   display: none;

+ 94 - 108
src/components/ChronicInfo/index.jsx

@@ -43,9 +43,15 @@ class ChronicInfo extends React.Component{
       isCalculated:false,     //是否刚计算过,关闭时值与结果对应
       calcuValues:deepClone(props.calcuValues),       //计算公式填的值
       hasEnterImg: false, //是否移入info
-      currentIndex: -1 //当前index
+      currentIndex: -1, //当前index
+      comfirnFlag:false,
+      flag:true,
+      ff:false,
+      timer:null,
+	  scaleParam:{},    //加入病例需要的参数
     };
-
+    this.$result = React.createRef();
+    this.$content = React.createRef();
     this.$content = React.createRef();
     this.showInfo = this.showInfo.bind(this);
     this.closeInfo = this.closeInfo.bind(this);
@@ -53,15 +59,16 @@ class ChronicInfo extends React.Component{
     this.closeOption = this.closeOption.bind(this);
     this.showTable = this.showTable.bind(this);//显示量表弹窗
     this.closeTable = this.closeTable.bind(this);//关闭量表弹窗
-    this.close = this.close.bind(this); //关闭量表列表
     this.showFormula = this.showFormula.bind(this); //打开计算公式
-    //this.closeFormula = this.closeFormula.bind(this); //关闭计算公式
     this.handleAddAssessItem = this.handleAddAssessItem.bind(this);   //加入病例记录
     this.onPrint = this.onPrint.bind(this);
     this.handleForRadio = this.handleForRadio.bind(this);
     this.handleSaveCalcu = this.handleSaveCalcu.bind(this);     //保存评估修改的计算和可能结果
-    this.getAddBtnState = this.getAddBtnState.bind(this);
     this.slideToggle = this.slideToggle.bind(this);
+    this.resetComfirnFlag = this.resetComfirnFlag.bind(this);
+    this.slideToggle = this.slideToggle.bind(this);
+    this.comfirnTable = this.comfirnTable.bind(this);
+	  this.unscroeClose = this.unscroeClose.bind(this);
   }
 
   onPrint() {
@@ -74,22 +81,6 @@ class ChronicInfo extends React.Component{
       operaSupport: false,
     });
   }
-  
-  showTableList(name){//量表按钮
-    const {getTableList} = this.props;
-    if(name){
-      getTableList(name);
-    }
-  }
-  close(){//关闭量表列表
-    const {hideList} = this.props;
-    hideList&&hideList({name:'showList',value:false});
-  }
-  handleListClick(item){//量表列表单项点击
-    this.showTable(item,null);
-    //this.close()
-  }
-
   showInfo(item){
     // 静态知识显示在提示信息里(4-18)
     const {getInfomation} = this.props;
@@ -127,7 +118,7 @@ class ChronicInfo extends React.Component{
       });
     }
   }
-  showTable(it){
+  showTable(it,v,i,j){
     const {scaleInfo} = this.props;
     // 密西根糖尿病周围神经病评分(MDNS), id:40744
     const item = {
@@ -143,12 +134,56 @@ class ChronicInfo extends React.Component{
 
     this.setState({
       formulaId:null, //关闭计算公式和可能结果弹窗
-      optionId:null
+      optionId:null,
+      scaleParam:{
+        v,i,j
+      }
     })
   }
-  closeTable(){
+  // 量表明细-关闭,isClose是否是点击关闭按钮
+  closeTable(isClose){
+    const {scaleParam} = this.state;
+    const {showHide} = this.props;
+    if(!showHide.isPop){
+      //量表结果,判断需要计算并且dom中有值才能加入病例记录
+      const res = this.$result.current&&this.$result.current.innerText;
+      if(!isClose&&(this.$result.current&&!res)){
+        Notify.info("请先计算量表结果!");
+        return ;
+      }
+      this.handleAddAssessItem(scaleParam.v,scaleParam.i,scaleParam.j);
+    }
     this.props.hideList({name:'showTable',value:false});
   }
+  // 非计分量表确定-延时关闭->量表存值
+  unscroeClose(){
+    let {timer} = this.state;
+    this.setState({
+      ff:true
+    })
+    clearTimeout(timer)
+    let _timer = setTimeout(()=>{
+      this.closeTable();
+    },200) 
+    this.setState({
+      timer:_timer
+    })
+  }
+  // 量表明细-确定
+  comfirnTable(){
+    const {flag} = this.state;
+    this.setState({
+      comfirnFlag:true,
+      flag:!flag //触发更新
+    })
+  }
+  resetComfirnFlag(){
+    this.setState({
+      comfirnFlag:false,
+      ff:false
+    })
+  }
+ 
   showFormula(id){//计算公式
     this.setState({
       formulaId:id,
@@ -173,9 +208,17 @@ class ChronicInfo extends React.Component{
     });
   }
   handleAddAssessItem(v,pIndex,i){
-    const {addAssessItem} = this.props;
+    const {addAssessItem,showHide,addScaleItems,scaleInfo} = this.props;
+    if(!v){
+      addScaleItems(scaleInfo[showHide.id],showHide.id);
+      return ;
+    }
     addAssessItem(v,pIndex,i);
   }
+  addFormula(it,v,pIndex,i){
+    this.closeFormula(it);
+    this.handleAddAssessItem(v,pIndex,i);
+  }
   handleReg(e){   //只能输入数字
     const hasDot = e.target.value.indexOf('.')!=-1;
     const key = e.key;
@@ -222,7 +265,7 @@ class ChronicInfo extends React.Component{
       radioVal:Object.assign({},radioVal,{[parent.conceptId]:item.detailName})
     })
   }
-  confirmOption(parent,pIndex){//可能结果确定
+  confirmOption(parent,pIndex,i){//可能结果确定
     const {radioVal,possible} = this.state;
     const {savePossibleResult} = this.props;
     this.setState({
@@ -231,6 +274,8 @@ class ChronicInfo extends React.Component{
       optionId:null,
     });
     savePossibleResult&&savePossibleResult({possible:Object.assign({},possible,radioVal),radioVal:Object.assign({},possible,radioVal)})
+    this.handleAddAssessItem(parent,pIndex,i);
+
   }
   handleSaveCalcu(obj){
     this.setState({
@@ -276,43 +321,6 @@ class ChronicInfo extends React.Component{
       Notify.info('请填写计算公式内容')
     }
   }
-  getAddBtnState(flag,v,i,j){
-    const {indexs,wholeScaleItems,addScaleItems,chronicMagItem,chronicDesease,addedScaleIds} = this.props;
-    let btn = '',reCheck=false;
-    let show = chronicMagItem&&chronicMagItem.name||chronicDesease&&chronicDesease.name;
-    if(!show){
-      return '';
-    }
-    if(flag){     //有结果
-      if(j!==undefined){
-        reCheck = addedScaleIds.includes(v.details[j].content.id);      //列表中是否加入同一量表
-        btn = (indexs[i]&&indexs[i].includes(j))||reCheck?<span className={style["add-record"]}>
-                   <img src={added} />
-                   已加入
-                 </span>:<span className={style["listResult"]} onClick={()=>this.handleAddAssessItem(v,i,j)}>
-                   <img src={add} />
-                   加入病历记录
-                 </span>;
-      }else{
-        reCheck = addedScaleIds.includes(v.id);         //推送中是否加入同一量表
-        btn = (wholeScaleItems&&wholeScaleItems[i])||reCheck?<span className={style["add-record"]}>
-                   <img src={added} />
-                   已加入
-                 </span>:<span className={style["listResult"]} onClick={()=>addScaleItems(v,i)}>
-                   <img src={add} />
-                   加入病历记录
-                 </span>;
-      }
-
-    }else{
-      btn = <span className={style["disable-add"]}>
-                   <img src={add} />
-                   加入病历记录
-                 </span>;
-    }
-
-    return btn;
-  }
   handleMouseEnterDrug(index) {
     this.setState({
         currentIndex: index,
@@ -333,6 +341,7 @@ class ChronicInfo extends React.Component{
       hasEnterImg: false
     })
   }
+  
   getDetail(){
     const {data,formulaResult,calcuResult,indexs} = this.props;
     const {formulaId,optionId,possible,radioVal,calcuValues,currentIndex,hasEnterImg} = this.state;
@@ -358,22 +367,13 @@ class ChronicInfo extends React.Component{
 
                               </p>:''}
-                      {/*<MiniToast title='静态知识'
-                                icon={allTableIcon}
-                                show={infoId&&infoId==v.id?true:false}
-                                close={this.closeInfo}>
-                          {pureText}
-                      </MiniToast>*/}
                       {v.details&&v.details.map((it,j)=>{
                         if(it.type==1){
                           return <p>
                                 <span className={style["listName"]}>
-                                  <i onClick={this.showTable.bind(this,it.content,v.conceptId,i)}>{'【'+it.content.name+'】'}</i>
+                                  <i onClick={this.showTable.bind(this,it.content,v,i,j)}>{'【'+it.content.name+'】'}</i>
                                   {formulaResult&&formulaResult[it.content.conceptId]?<i>{'结果:'}{formulaResult[it.content.conceptId].calcalculate&&formulaResult[it.content.conceptId].calcalculate.result.value +' '+ formulaResult[it.content.conceptId].calcalculate.result.text}</i>:''}
                                 </span>
-                                {
-                                  this.getAddBtnState(formulaResult&&formulaResult[it.content.conceptId],v,i,j)
-                                }
                               </p>
                         }else if(it.type==2){
                           const cres = calcuResult&&calcuResult[v.conceptId]||it.content.result;
@@ -385,16 +385,13 @@ class ChronicInfo extends React.Component{
                               <i className={style["blue"]} onClick={this.showFormula.bind(this,v.conceptId)}>{result?result:'请选择'}</i>
                               <img src={level1} />
                             </span>
-                            {
-                              this.getAddBtnState(result,v,i,j)
-                            }
                             {formulaId&&formulaId==v.conceptId&&<MiniToast title={it.content.name}
                                 icon={allTableIcon}
-                                confirmText='关闭'
+                                confirmText='加入病例记录'
                                 show={formulaId&&formulaId==v.conceptId?true:false}
                                 close={this.closeFormula.bind(this,it)}
-                                confirm={this.closeFormula.bind(this,it)}
-                                footer="true">
+                                confirm={this.addFormula.bind(this,it,v,i,j)}
+                                footer={result?true:false}>
                                 <table>
                                 {details.map((item,idd)=>{
                                     if(item.controlType==0){//单选
@@ -452,15 +449,13 @@ class ChronicInfo extends React.Component{
                               <i onClick={this.showOption.bind(this,v.conceptId)} className={style["blue"]}>{possible[v.conceptId]?possible[v.conceptId]:'请选择'}</i>
                               <img src={level1} />
                             </span>
-                            {
-                              this.getAddBtnState(possible[v.conceptId],v,i,j)
-                            }
                             <MiniToast title='结果选择'
                                 icon={checkIcon}
+                                confirmText='加入病例记录'
                                 show={optionId&&optionId==v.conceptId?true:false}
                                 close={this.closeOption}
-                                confirm={this.confirmOption.bind(this,v,i)}
-                                footer="true">
+                                confirm={this.confirmOption.bind(this,v,i,j)}
+                                footer={radioVal[v.conceptId]?true:false}>
                                 <div className={style["infoOption"]}>
                                   <span>{it.content.name?it.content.name+':':''}</span>
                                   {it.content.details&&it.content.details.map((lis,ind)=>{
@@ -500,11 +495,12 @@ class ChronicInfo extends React.Component{
     toggleSlide&&toggleSlide(!slideUp);
   }
   render(){
+    const {comfirnFlag,flag,ff} = this.state;
+    const {chronicMagItem,chronicDesease,formulaResult,showHide,slideUp} = this.props;
     const scaleFooter = <Footer print={true}
-                                footText="确定"
+                                footText={showHide.isPop?"确定":"加入病例记录"}
                                 handlePrint={this.onPrint}
-                                handleConfirm={this.closeTable}/>;
-    const {chronicMagItem,tableList,chronicDesease,formulaResult,showHide,slideUp} = this.props;
+                                handleConfirm={()=>{this.comfirnTable()}}/>;
     return <div className={style["tips"]} style={{marginBottom:'15px'}}>
               <div className={`${style["tips-title"]} ${style["chronic"]}`}>
                 <div className={style["tips-name"]}>
@@ -515,36 +511,26 @@ class ChronicInfo extends React.Component{
                 <div className={style['toggle-btn']}>
                   <img src={slideUp?down:up} alt="展开/收起" onClick={this.slideToggle}/>
                 </div>
-                {/*<div className={style["tips-btn"]} style={{display:chronicMagItem&&chronicMagItem.name||chronicDesease&&chronicDesease.name?'block':'none'}}>
-                  <span className={style["tipsDetails"]} onClick={() => this.showTableList(chronicDesease&&chronicDesease.name||chronicMagItem&&chronicMagItem.name)}>量表
-                  </span>
-                </div>*/}
               </div>
               <div className={style["content"]} ref={this.$content}>
                   {this.getDetail()}
               </div>
-              {/*<ConfirmModal visible={showHide&&showHide.showList} noFooter='true' title='全部量表' close={this.close} titleBg="#DFEAFE" icon={allTableIcon} height={450} width={450}>
-                      <ul className={style['toast-cont']}>
-                        {tableList&&tableList.map((v,i)=>{
-                          return <li>
-                            <span className={style["scaleName"]}>
-                              <i onClick={this.handleListClick.bind(this,v)}>{'【'+v.name+'】'}</i>
-                              {formulaResult&&formulaResult[v.conceptId]?<i className={style['res']}>{'结果:'}{formulaResult[v.conceptId].calcalculate&&formulaResult[v.conceptId].calcalculate.result.value+' '+ (formulaResult[v.conceptId].calcalculate.result.text?formulaResult[v.conceptId].calcalculate.result.text:'')}</i>:''}
-                            </span>
-                            {
-                              this.getAddBtnState(formulaResult&&formulaResult[v.conceptId],v,i)
-                            }
-                          </li>
-                        })}
-                      </ul>
-              </ConfirmModal>*/}
-              {showHide&&showHide.showTable?<ComplexModal onclose={this.closeTable} footer={scaleFooter}
+              {showHide&&showHide.showTable?<ComplexModal onclose={()=>this.closeTable(true)} footer={scaleFooter}
                       title={showHide.name}
                       icon={tableIcon}
                       top={20}
                       bottom={20}
                       width={820}>
-                <ScaleTable title={showHide.name} tableId={showHide.id}></ScaleTable>
+                <ScaleTable title={showHide.name} 
+                            tableId={showHide.id} 
+                            comfirnFlag={comfirnFlag} 
+                            flag={flag}
+                            flagT={ff}
+                            resetFlag={this.resetComfirnFlag}
+                            unscroeClose={this.unscroeClose}
+                            closeTable={this.closeTable}
+							resRef={this.$result}
+                            ></ScaleTable>
               </ComplexModal>:''}
       </div>
   }

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

@@ -263,7 +263,7 @@ class DiagnosticList extends Component {
         return(
                 <div className={style['diaglist-wrap']}>
                     {list && (list.length > 0) && list.map((item, index) => {
-                        const hasTreat = item.treat && (item.treat.commonTreatment.content || item.treat.surgeryTreatment.content || item.treat.treatment.length>0 ||(item.adverseReactions&&item.adverseReactions.length > 0)
+                        const hasTreat = item.treat && ((item.treat.commonTreatment&&item.treat.commonTreatment.content) || (item.treat.surgeryTreatment&&item.treat.surgeryTreatment.content) || item.treat.treatment.length>0 ||(item.adverseReactions&&item.adverseReactions.length > 0)
                            || (item.drugHistory && item.drugHistory['慢病用药内容'] &&  item.drugHistory['慢病用药内容'].length > 0) || (item.drugHistory &&item.drugHistory['普通病用药内容'] &&  item.drugHistory['普通病用药内容'].length > 0) ||item.follow)
                         isChronic = chronicLine&&item.type==2&&chronicList.findIndex((it)=>it.conceptId==item.conceptId)!=-1;
                         return (<div draggable={true} className={style['diag-box'] + ' clearfix'}  key={item.conceptId} >

+ 6 - 2
src/components/Emergency/index.jsx

@@ -93,14 +93,18 @@ class EmergencyHis extends Component{
   handleAdd(){
     const {chooseItem,index} = this.state;
     const {addSecond,data} = this.props;
-    console.log("添加成功")
     if(chooseItem.trim()){
       // 添加接口
       const item = {
         name:chooseItem,
         id:data[index].inquiryId
       }
-      addSecond&&addSecond(item)
+      addSecond&&addSecond(item);
+      this.searInp.current.value = "";
+      this.setState({
+        valChange:true,
+        chooseItem:''
+      });
     }
   }
 

+ 1 - 0
src/components/Emergency/index.less

@@ -35,6 +35,7 @@
     display: inline-block;
     vertical-align: top;
     position: relative;
+    padding-top: 57px;
     .no-data{
       font-size: 18px;
       position: absolute;

+ 11 - 2
src/components/PushItems/index.jsx

@@ -5,8 +5,7 @@ import doubtImg from "../../common/images/doubt.png";
 import recommendImg from "../../common/images/recommend.png";
 import tipsImg from "../../common/images/tips.png";
 import vigilantImg from "../../common/images/vigilant.png";
-import showImg from "../../common/images/show.png";
-import hideImg from "../../common/images/close.png";
+import likelyImg from "../../common/images/likely.png";
 import DetailsModal from './DetailsModal';
 import PushDiag from "./PushDiag";
 import DiagnosticItem from "@containers/DiagnosticItem";
@@ -144,6 +143,7 @@ class PushItems extends Component {
       determine,
       doubt,
       possible,
+      likely,
       assay,
       check,
       tips,
@@ -196,6 +196,15 @@ class PushItems extends Component {
                 maxShowNum={24}
               />
             )}
+            {likely && likely.length > 0 && (
+              <PushDiag
+                titleBg="#FAEBEC"
+                icon={likelyImg}
+                title="鉴别诊断"
+                diagList={likely}
+                maxShowNum={24}
+              />
+            )}
             <div className={style["diagnose"]}>
               {vigilant.length === 0 &&
                 determine.length === 0 &&

+ 11 - 4
src/components/ScaleSearch/index.jsx

@@ -24,12 +24,19 @@ class ScaleSearch extends Component {
     }
     return '';
   }
+  showScale(item){
+    const {scaleInfo,getScale,showScaleFn} = this.props;
+    if(scaleInfo&&scaleInfo[item.id]){
+      showScaleFn&&showScaleFn(item);
+    }else{
+      getScale(item);
+    }
+  }
   getSearchList() {
-    const { searchResult,getScale } = this.props;
+    const { searchResult } = this.props;
     return searchResult && searchResult.map((item) => {
-      return <li key={item.conceptId} onClick={()=>getScale({id:item.conceptId,name:item.name})}>
-        <span className={style['scale-name']}>{item.name}</span>
-        {this.getResult(item.conceptId)}
+      return <li key={item.conceptId} onClick={this.showScale.bind(this,{id:item.conceptId,name:item.name})}>
+        <span className={style['scale-name']}>{item.name}{this.getResult(item.conceptId)}</span>
         <button>查看</button>
       </li>;
     });

+ 159 - 24
src/components/ScaleTable/index.jsx

@@ -4,11 +4,14 @@ import { Radio,CheckBtn ,Notify} from '@commonComp';
  import Information from '../Information';
  import {getFormulaResult} from '@store/async-actions/fetchModules.js';
 /**
-*量表明细组件
-*scaleName: 量表标题;
-*data: store中存的所有量表;
-*tableId:表格id,根据id从data中拿到当前量表的内容;
-*formulaResult:store中存的量表计算结果;
+*量表明细 @By_Liucf
+*title: 量表标题/scaleName;
+*tableId:量表id;
+*scaleType:量表类型, 1-计分量表,接口算分;2-不计分量表,前端拼接结果;
+*required:是否为必填项,1-必填,0-非必填;
+*isSelect:必填项选中标识,true-表示该项下已有选中数据;
+*select: 明细选中标识,1-选中,0-未选中;
+*comfirnFlag:不计分量表父级确定事件标识,用于触发是否有必填项未填;
 **/
 class ScaleTable extends React.Component{
   constructor(props){
@@ -17,10 +20,42 @@ class ScaleTable extends React.Component{
       selecteds:{},  //当前页面的选中标识,保存后使用select标识
       valueData:{},
       start:false,   //点击计算
-      scaleResult1:null
+      scaleResult1:null,
+      result:{},
+      saveFlag:false
     }
     this.handleFormula = this.handleFormula.bind(this);
   }
+  // 不计分选中事件
+  handleRadio2(name,item,index){
+    const {selecteds,valueData,result} = this.state;
+    const selectName = item.detailName;
+    const selectResult = item.result;
+    // let newResult = Object.assign({},result,{[name]:selectName+'('+selectResult+')'});
+    // 使用index,便于按顺序拼接结果
+    let newResult = Object.assign({},result,{[index]:selectName+'('+selectResult+')'});
+    this.setState({
+      selecteds:Object.assign({},selecteds,{[name]:selectName}),
+      result:newResult
+    })
+    const datas = JSON.parse(JSON.stringify(valueData));
+    let rows = datas.rows;
+    for(let i=0; i<rows.length; i++){
+      if(rows[i].name==name){
+        rows[i].isSelect = true;
+        let details = rows[i].details;
+        for(let k=0; k<details.length; k++){
+          details[k].select = 0;
+          if(details[k].detailName == selectName){
+            details[k].select = 1;
+          }
+        }
+      }
+    }
+    this.setState({
+      valueData:datas
+    })
+  }
   
   handleRadio(groupName,name,item,indexId){
     const {selecteds,valueData} = this.state;
@@ -177,34 +212,87 @@ class ScaleTable extends React.Component{
     }
     return scale;
   }
-  componentWillReceiveProps(nextProps){ 
-    const {tableId} = this.props;
+  // 不计分结果
+  getType2Reult(){
+    const {result} = this.state;
+    if(JSON.stringify(result) != '{}'){
+      let data = '';
+      for(let i in result){
+        if(result[i]){
+          data += result[i]+',';
+        }
+      }
+      return data.slice(0,data.length-1);
+    }
+    return ''
+  }
+  componentWillReceiveProps(nextProps){
+    const {tableId,saveScaleData,getResult,closeTable,scaleInfo,unscroeClose} = this.props;
+    const {valueData,saveFlag} = this.state;
     const data = nextProps.scaleInfo;
-    if(JSON.stringify(data) !== '{}' && data[tableId]){
+    // if(JSON.stringify(data) !== '{}' && data[tableId]){
+    if(JSON.stringify(data) !== '{}' && data[tableId] && JSON.stringify(valueData) == '{}'){
       let scale = this.filterScale(data[tableId]);
       this.setState({
-        // valueData:JSON.parse(nextProps.scaleInfo[tableId][1].content),
         valueData:scale.content?JSON.parse(scale.content):{}
       })
     }
+    if(nextProps.comfirnFlag){
+      //非计分量表校验必填项
+      if(valueData.scaleType==2){
+        let unfinish;
+        const rows = valueData.rows;
+        for(let i=0; i<rows.length; i++){
+          if(rows[i].required==1 && !rows[i].isSelect){//必填项未填
+            unfinish = true;
+          }
+        }
+        if(unfinish){
+          Notify.info("请先将量表内容选择完整");
+          return
+        }
+        unscroeClose();
+      }else{
+        closeTable();//计分量表关闭弹窗
+      } 
+    }
   }
   componentDidMount(){
-    const {tableId,scaleInfo} = this.props;
+    const {tableId,scaleInfo,resetFlag} = this.props;
+    resetFlag&&resetFlag();//重置确定标识
     if(scaleInfo&&scaleInfo[tableId]){
       let scale = this.filterScale(scaleInfo[tableId]);
+      // 回读非计算量表结果result
+      let data = scale.content?JSON.parse(scale.content):{};
+      let result = {};
+      if(data.scaleType==2){
+        let rows = data.rows;
+        for(let i=0; i<rows.length; i++){
+          if(rows[i].isSelect){
+            let details = rows[i].details;
+            for(let j=0; j<details.length; j++){
+              if(details[j].select==1){
+                result[i] = details[j].detailName+'('+details[j].result+')'
+              }
+            }
+          }else{
+            result[i] = '';
+          }
+        }
+      }
       this.setState({
-        // valueData:JSON.parse(scaleInfo[tableId][1].content)
-        valueData:scale.content?JSON.parse(scale.content):{}
-      })
+        valueData:data,
+        result:result
+      }) 
     }  
   }
   componentWillUnmount(){
     // 储存计算结果和选择后的data
-    const {tableId,getResult,scaleInfo,saveScaleData,formulaResult} = this.props;
-    const {valueData,scaleResult1,start} = this.state;
+    const {tableId,getResult,scaleInfo,saveScaleData,formulaResult,comfirnFlag,flagT} = this.props;
+    const {valueData,scaleResult1,start,saveFlag} = this.state;
     // 替换表格内容--1)没有点计算且没有计算结果;2)点了计算
     const scaleResult = scaleResult1 || formulaResult&&formulaResult[tableId]; //量表计算结果
-    if(start || !scaleResult){
+    if(start || !scaleResult && valueData.scaleType==1){//仅计分量表储存
       let allDatas = scaleInfo[tableId]?JSON.parse(JSON.stringify(scaleInfo[tableId])):'' ;
       if(allDatas){
         for(let i=0; i<allDatas.length; i++){
@@ -216,7 +304,6 @@ class ScaleTable extends React.Component{
         saveScaleData&&saveScaleData({id:tableId,data:allDatas});
       }
     }
-    
      if(scaleResult1){
       const params = {
         type:1,
@@ -225,13 +312,43 @@ class ScaleTable extends React.Component{
       }
       getResult&&getResult(params);
     }
+    // 非计分
+    if(comfirnFlag && flagT){
+      // 存值-拼成与计算接口返回的格式一致
+      const data1 = {
+        calcalculate:{
+          result:{
+            value:this.getType2Reult()
+          }
+        }
+      }
+      const params = {
+        type:1,
+        data:data1,
+        id:tableId,
+      }
+      getResult&&getResult(params);
+      // 存数据源
+      let allDatas = scaleInfo[tableId]?JSON.parse(JSON.stringify(scaleInfo[tableId])):'' ;
+      if(allDatas){
+        for(let i=0; i<allDatas.length; i++){
+          if(allDatas[i].type==1){
+            allDatas[i].content = JSON.stringify(valueData);
+          }
+        }
+        saveScaleData&&saveScaleData({id:tableId,data:allDatas});
+      }
+    }
   }
   getContent(){ 
     let {selecteds,valueData,start,scaleResult1} = this.state;
-    const {tableId,formulaResult} = this.props;
+    const {tableId,formulaResult,comfirnFlag} = this.props;
     const scaleResult = scaleResult1 || formulaResult&&formulaResult[tableId]; //量表计算结果
-    const datas = valueData&&valueData.group?valueData:'';//console.log(666,datas);
-    let content =  datas&&datas.group&&datas.group.map((v,i)=>{
+    // const datas = valueData&&valueData.group?valueData:'';
+    const datas = valueData;
+    let content;
+    if(valueData&&valueData.scaleType==1){//计分
+      content =  datas&&datas.group&&datas.group.map((v,i)=>{
                 return <div className={style['group']}>
                   <p className={style['groupName']}>{v.groupName}</p>
                   {v.rows&&v.rows.map((it,ind)=>{
@@ -286,11 +403,29 @@ class ScaleTable extends React.Component{
                   </p>:''}  
                 </div>
               })
+    }else if(valueData&&valueData.scaleType==2){//不计分
+      content =  datas&&datas.rows.map((item,i)=>{
+        return <div className={style['block']} style={{border:item.required==1&&!item.isSelect&&comfirnFlag?'1px solid #f00':'none'}}>
+            <p className={style['miniName']}>{item.name}</p>
+            {item.details&&item.details.map((vv,ii)=>{
+              return <div className={style['item']}>
+                      <Radio label={vv.detailName+'('+vv.result+')'}
+                         isSelect={vv.select==1||selecteds[item.name]==vv.detailName}
+                         handleClick={this.handleRadio2.bind(this,item.name,vv,i)}>
+                      </Radio>
+                      {vv.state==1?<span className={style['recomand']}>(智能推荐)</span>:''}
+                  </div>
+            })}
+            
+          </div>
+      })
+    }
+
     return content;
   }
 
   render(){
-    const {scaleInfo,tableId,formulaResult} = this.props;
+    const {scaleInfo,tableId,formulaResult,resRef} = this.props;
     const data = scaleInfo[tableId];
     let {selecteds,scaleResult1} = this.state;
     const scale = data && this.filterScale(data);
@@ -309,9 +444,9 @@ class ScaleTable extends React.Component{
                   {this.getContent()}
                   {datas&&datas.Calc==1?<div className={style['total']}>
                     <span>总分:</span>
-                    <span>{scaleResult&&scaleResult.calcalculate&&scaleResult.calcalculate.result&&scaleResult.calcalculate.result.value +' '+ (scaleResult.calcalculate.result.text?scaleResult.calcalculate.result.text:'')}</span>
+                    <span ref={resRef}>{scaleResult&&scaleResult.calcalculate&&scaleResult.calcalculate.result&&scaleResult.calcalculate.result.value +' '+ (scaleResult.calcalculate.result.text?scaleResult.calcalculate.result.text:'')}</span>
                     <span className={style['totalBtn']} onClick={this.handleFormula}>得分</span>
-                  </div>:''}
+                  </div>:<p className={style['totalR']}>{"结果:"}{this.getType2Reult()||scaleResult&&scaleResult.calcalculate&&scaleResult.calcalculate.result&&scaleResult.calcalculate.result.value}</p>}
                 </div>
               }
             })}

+ 11 - 2
src/components/ScaleTable/index.less

@@ -31,10 +31,10 @@ strong{
     .recomand{
       color:#3B9ED0;
     }
-    .block{
+    /* .block{
       margin-top: 20px;
       padding: 5px 0 0 30px;
-    }
+    } */
     .redBorder{
       border: 1px solid #f00;
     }
@@ -87,6 +87,15 @@ strong{
       margin-left: 40px;
     }
   }
+  .block{
+    margin-top: 20px;
+    padding: 5px 0 0 30px;
+  }
+  .totalR{
+    text-align: right;
+    height: 72px;
+    line-height: 72px;
+  }
 }
 .printShow {
   display: none;

+ 2 - 1
src/containers/AssessResult.js

@@ -100,11 +100,12 @@ function mapDispatchToProps(dispatch) {
         data:deepClone(data)
       })
     },
-    showScaleFn(item){
+    showScaleFn(item,isPop){
       dispatch({
         type:SHOW_TABLE_LIST,
         name:'showTable',
         value:true,
+        isPop,
         item:Object.assign({},item)
       });
     },

+ 2 - 2
src/containers/ChronicInfo.js

@@ -69,11 +69,11 @@ function mapDispatchToProps(dispatch){
         id:it.type==1?it.content.id:undefined,      //只有量表需要记录id,去重用
       })
     },
-    addScaleItems(obj,i){
+    addScaleItems(obj,id){
       dispatch({
         type:ADD_WHOLE_SCALE_ITEMS,
         data:obj,
-        index:i
+        id
       })
     },
     //保存管理评估

+ 14 - 2
src/containers/ScaleSearchContainer.js

@@ -3,11 +3,14 @@ import { connect } from 'react-redux';
 import { getSearchList } from '@store/async-actions/ScaleSearch';
 import ScaleSearch from '@components/ScaleSearch';
 import {getScaleInfo} from '../store/async-actions/pushMessage';
+import {SHOW_TABLE_LIST} from '@store/types/pushMessage';
 
 function mapStateToProps(state) {
+    const {pushMessage} = state;
     return{
         searchResult: state.scaleSearch.searchResult,
-        formulaResult: state.pushMessage.formulaResult,//Á¿±íÄÚÈÝ
+        formulaResult: pushMessage.formulaResult,//????????
+        scaleInfo: pushMessage.scaleInfo,//Á¿±íÄÚÈÝ
     }
 }
 
@@ -18,7 +21,16 @@ function mapDispatchToProps(dispatch) {
         },
         getScale(name) {
             dispatch(getScaleInfo(name))
-        }
+        },
+        showScaleFn(item,isPop){
+          dispatch({
+            type:SHOW_TABLE_LIST,
+            name:'showTable',
+            value:true,
+            isPop,
+            item:Object.assign({},item)
+          });
+        },
     }
 }
 const ScaleSearchContainer = connect(

+ 2 - 1
src/containers/ScaleTable.js

@@ -16,7 +16,8 @@ function mapDispatchToProps (dispatch){
       dispatch({
         type:SAVE_TABLE_RESULT,
         id:obj.id,  //量表id
-        data:Object.assign({},obj.data,{pIndex:obj.pIndex})
+        // data:Object.assign({},obj.data,{pIndex:obj.pIndex})
+        data:Object.assign({},obj.data)
       })
     },
     saveScaleData(obj){//储存表格数据

+ 2 - 2
src/containers/SpreadDrop.js

@@ -11,7 +11,7 @@ import {SETCHECKBOX,CHANGECHECKTEXTLABEL,CHECKCONFIRMSELECTED} from '@types/chec
 import {CURRENT_CONFIRM,SETMAINCHECKBOX,CURRENT_TEXT_LABEL,CURRENT_GET_BIGDATAPUSH} from '@types/currentIll';
 import {billing} from '@store/async-actions/pushMessage';
 import {Notify} from '@commonComp';
-import {filterArr,didPushParamChange,filterDataArr,getLabelIndex,fullfillText,getIds} from '@utils/tools.js';
+import {filterArr,didPushParamChange,filterDataArr,getLabelIndex,fullfillText,checkFullfillText,getIds} from '@utils/tools.js';
 import config from '@config/index.js';
 
 function mapStateToProps(state) {//console.log(state);
@@ -272,7 +272,7 @@ function checkBodyConfirm(dispatch,store,params){
       });
       dispatch({
         type: CHECKCONFIRMSELECTED,
-        data: {exists:fullfillText(has,false,false).newArr,withs:fullfillText(wes,false,false).newArr,nones:nones,ikey,copyType}
+        data: {exists:checkFullfillText(has).newArr,withs:checkFullfillText(wes).newArr,nones:nones,ikey,copyType}
       });
       dispatch({
         type:ISREAD

+ 15 - 10
src/store/actions/checkBody.js

@@ -1,5 +1,5 @@
 import config from '@config/index.js';
-import {formatContinueDots,getLabelIndex,fullfillText} from '@utils/tools.js';
+import {formatContinueDots,getLabelIndex,fullfillText,checkFullfillText} from '@utils/tools.js';
 
 export function preSetCheckbody(state,action) {
   let res = Object.assign({},state);
@@ -11,7 +11,7 @@ export function preSetCheckbody(state,action) {
 export function set(state,action){
   let res = Object.assign({},state);
   const {data} = action;
-  const obj = fullfillText(data,false,false,false);
+  const obj = checkFullfillText(data);
   res.data = obj.newArr;
   res.saveText = obj.saveText;//存逗号
   res.showAll = obj.checkHiddenDefault;
@@ -67,7 +67,7 @@ export const confirm = (state,action) =>{
   arr.splice(ikey,0,...exists,...withs);
   //arr[ikey-1].value = text;
   //res.saveText[ikey+items.length] = text;
-  res.saveText = fullfillText(arr).saveText;
+  res.saveText = checkFullfillText(arr).saveText;
   res.update=Math.random();         //用于触发组件更新(data变化了因在对象中无法被组件检测到)
   return res;
 };
@@ -251,7 +251,7 @@ export function setCheckBoxValue(state,action) {
   }
   res.data[labelInx].value = showText;
   res.selecteds[labelInx] = action.data;
-  res.saveText = fullfillText(res.data).saveText;
+  res.saveText = checkFullfillText(res.data).saveText;
   res.update = Math.random();
   return res;
 }
@@ -271,7 +271,7 @@ export function insertLabelData(state,action){
   const searchStr = res.searchStr;
   const {index,data,isReplace,span,searchInEnd}=action;
   const showText = res.saveText[index];
-  let tempLabels = data.tagType==4?fullfillText(data.questionMapping).newArr:[data];
+  let tempLabels = data.tagType==4?checkFullfillText(data.questionMapping).newArr:[data];
   tempLabels = formatContinueDots(tempLabels);
   //查体中,默认显示区域搜索出来的标签要默认显示,隐藏区域搜索出的默认隐藏
   let hideAreaIndex = [...res.data].reverse().findIndex((it)=>it.showInCheck);
@@ -287,12 +287,12 @@ export function insertLabelData(state,action){
     const pText = Object.assign({},text,{value:newText});
     if(searchInEnd){
       res.data.splice(index,1,pText,...spreadLabels,text);
-      res.saveText = fullfillText(res.data).saveText;
+      res.saveText = checkFullfillText(res.data).saveText;
       //res.saveText.splice(index,1,newText,'','');
       res.selecteds.splice(index,1,null,...new Array(spreadLabels.length).fill(null),null);
     }else{
       res.data.splice(index,1,text,...spreadLabels,pText);
-      res.saveText = fullfillText(res.data).saveText;
+      res.saveText = checkFullfillText(res.data).saveText;
       //res.saveText.splice(index,1,'','',newText);
       res.selecteds.splice(index,1,null,...new Array(spreadLabels.length).fill(null),null);
     }
@@ -365,7 +365,7 @@ export const changeLabelVal = (state,action)=>{//双击标签输入改变值
     const num = nextIsDot?2:1;
     res.data.splice(index,num);
     res.selecteds.splice(index,num);//杂音类样式选中状态对应
-    res.saveText = fullfillText(res.data).saveText;
+    res.saveText = checkFullfillText(res.data).saveText;
   }
   res.update = Math.random();
   return res;
@@ -392,12 +392,17 @@ export const changeNumLabelVal = (state,action)=>{
       item.labelPrefix = prefix||'';
       item.labelSuffix = suffix||'';
     }
-    res.saveText[index] = totalVal;
+    if(newVal){
+      res.saveText[index] = totalVal;
+    }else{
+      res.saveText[index] = "";
+    }
+    
   }else{//删除完标签内容则删除该标签
     const num = nextIsDot?2:1;
     res.data.splice(index,num);
     res.selecteds.splice(index,num);      //杂音类样式选中状态对应
-    res.saveText = fullfillText(res.data).saveText;
+    res.saveText = checkFullfillText(res.data).saveText;
   }
 
   res.update = Math.random();

+ 13 - 18
src/store/actions/currentIll.js

@@ -346,9 +346,6 @@ export const confirm = (state,action) =>{
   let length1 = res.data.length;
   let arr = JSON.parse(JSON.stringify(res.data));
   const {nones,exists,withs,ikey,exclusion,excluName,ban,noneIds} = action.data;
-  /*let existsId = exists && exists.length>0?getIds(exists):[];
-  let withsId = withs && withs.length>0?getIds(withs):[];
-  res.symptomIds = res.symptomIds.concat(existsId,withsId,noneIds);//搜索去重*/
   let existConpId = [];
   let withConpId = [];
   exists.map((v,i)=>{
@@ -363,20 +360,22 @@ export const confirm = (state,action) =>{
 
   // 处理主症状标签及尾巴展开symptomType=1
   if(exists && exists.length>0){
-    // for(let i in exists){//ie8不支持for in循环
+    let tempArr = [];
      for(let i=0;i<exists.length; i++){
-      arr.splice(ikey,0,getLabel(exists[i].id,exists[i].questionMapping && exists[i].questionMapping.length==0?exists[i].name+',':exists[i].name),...(exists[i].questionMapping && exists[i].questionMapping.filter((item)=>{return item.symptomType==0||item.symptomType==1;})));
+      tempArr.push(getLabel(exists[i].id,exists[i].questionMapping && exists[i].questionMapping.length==0?exists[i].name+',':exists[i].name),...(exists[i].questionMapping && exists[i].questionMapping.filter((item)=>{return item.symptomType==0||item.symptomType==1;})));
     }
+    arr.splice(ikey,0,...tempArr);
   }
-
+  
   let length = arr.length - length1;
   let withsArr = JSON.parse(JSON.stringify(arr));
   // 伴 伴随症状标签及尾巴展开symptomType=2
   if(withs && withs.length>0){
-    // for(let i in withs){
+    let tempArr = [];
     for(let i=0;i<withs.length; i++){
-      withsArr.splice(parseInt(ikey)+length,0,banText,getLabel(withs[i].id,withs[i].questionMapping && withs[i].questionMapping.length==0?(withs[i].name+','):(withs[i].name)),...(withs[i].questionMapping&&withs[i].questionMapping.length>0?withs[i].questionMapping.filter((item)=>{return item.symptomType==0||item.symptomType==2;}):[]));
+      tempArr.push(banText,getLabel(withs[i].id,withs[i].questionMapping && withs[i].questionMapping.length==0?(withs[i].name+','):(withs[i].name)),...(withs[i].questionMapping&&withs[i].questionMapping.length>0?withs[i].questionMapping.filter((item)=>{return item.symptomType==0||item.symptomType==2;}):[]));
     }
+    withsArr.splice(parseInt(ikey)+length,0,...tempArr);
   }
 
   // 无 不用展开
@@ -857,7 +856,7 @@ export function addLabelItem(state,action){
 //文本输入标签
 export function setInputLabel(state,action){
   let res = Object.assign({},state);
-  const {i,text,prefix,suffix,subIndex} = action;
+  const {i,text,prefix,suffix,subIndex,total} = action;
   const item = res.data[i];
   if(+item.tagType===3){      //multSpred标签
     item.questionMapping[subIndex].value = text;
@@ -870,17 +869,13 @@ export function setInputLabel(state,action){
   }else{
     if(item){
       item.value=text;
+      res.saveText[i] = (prefix ||'')+ text + (suffix||'');
+    }else if(!total){//整个标签内容完全删除
+      res.data.splice(i,1);
+      res.saveText.splice(i,1);
     }
   }
-  if(text){
-    res.saveText[i] = prefix ||''+ text + suffix||'';
-  }else if(!text && !prefix && !suffix){//整个标签内容完全删除
-    res.data.splice(i,1);
-    res.saveText.splice(i,1);
-  }else{//删除完要清空
-    res.saveText[i] = "";
-  }
-  res.update = Math.random();
+  res.update = Math.random();//console.log(888,res,action)
   return res;
 }
 

+ 1 - 0
src/store/actions/pushMessage.js

@@ -28,6 +28,7 @@ export const setAdvice=(state,action)=>{
   res.doubt = action.determine.concat(action.doubt);
   res.possible = action.possible;
   res.vigilant = action.vigilant;
+  res.likely = action.likely;
   res.assay = action.lab;
 	res.check = action.pacs;
   return res;

+ 9 - 11
src/store/async-actions/fetchModules.js

@@ -2,7 +2,7 @@ import {json,expJson} from '@utils/ajax.js';
 import {SET,PRESET} from '@types/checkBody.js';
 import {SETDATA} from '@store/types/otherHistory';
 import store from '@store';
-import {getEMRParams,didPushParamChange,inspectAndAssist,fullfillText} from '@utils/tools.js';
+import {getEMRParams,didPushParamChange,inspectAndAssist,fullfillText,checkFullfillText,deepClone} from '@utils/tools.js';
 import {Notify} from '@commonComp';
 import {billing} from '@store/async-actions/pushMessage';
 import {SETOTHERHISTORY,ISREAD} from "../types/homePage";
@@ -110,9 +110,6 @@ export const getOtherHisRecord = ()=>{
               save:[]
             });
           }
-
-          //console.log('其他史最近数据无')
-          //arr = state.homePage.initData.otherHis;
         }else{
           arr = obj.other;
           if(mode =='1'){     //文本模式
@@ -168,7 +165,7 @@ export function pregetCheckbodyData(flag){     //flag=true获取到数据后立
           data:data
         });
         if(flag){
-          const arr = fullfillText(data,false,false,false).newArr;
+          const arr = checkFullfillText(data).newArr;
           dispatch({
             type:SET,
             data:arr,
@@ -192,7 +189,7 @@ export function getInitData(){
     if(!preData||preData.length==0){
       dispatch(pregetCheckbodyData(true));
     }
-      const arr = fullfillText(preData,false,false,false).newArr;
+      const arr = checkFullfillText(preData).newArr;
       dispatch({
         type:SET,
         data:arr,
@@ -208,12 +205,13 @@ export function setOtherHisModule(){
     const initData = state.homePage.initData;
     const block = Object.assign(JSON.parse(config.textLabel),{full:true});
     const mode = state.typeConfig.typeConfig;
-    const model = JSON.parse(JSON.stringify(initData.otherHisModel || null))||[block];     //查体模板
-    const arr = JSON.parse(JSON.stringify(initData.otherHis || null));        //最近其他史数据
-    const arrSave = JSON.parse(JSON.stringify(initData.otherHisSave || null));    //最近其他史saveText
-    const selects = JSON.parse(JSON.stringify(initData.otherSelecteds || null));  //其他史杂音类选中项
+    const model = deepClone(initData.otherHisModel)||[block];     //查体模板
+    const arr = deepClone(initData.otherHis);        //最近其他史数据
+    const arrSave = deepClone(initData.otherHisSave);    //最近其他史saveText
+    const selects = deepClone(initData.otherSelecteds);  //其他史杂音类选中项
     const isHis = initData.otherIsHis;     //是否是历史数据
-    const onlyOneText = arr && arr.length == 1 && arr[0].tagType == 8 && !arr[0].value;    //是否只有一个自由文本标签
+    const onlyOneText = arr && arr.length == 1 && arr[0].tagType == 8 && !arr[0].value;    //是否只有一个空的自由文本标签
+    //是历史数据且不为空则显示历史数据,否则显示模板
     const listObj = isHis && (mode == 1 || (!onlyOneText && mode == 0)) ? {
       newArr: arr,
       saveText: arrSave || []

+ 2 - 3
src/store/async-actions/homePage.js

@@ -3,11 +3,10 @@ import {SETINITDATA,MODI_LOADING,GET_ASSIST_LIST,GET_INSPECT_LIST,SETALLMODULES}
 import {SET_CURRENT} from '@store/types/currentIll';
 import {SET_MAINSUIT} from '@store/types/mainSuit';
 import config from '@config/index.js';
-import store from '@store';
 import {formatContinueDots} from '@utils/tools';
 import {getOtherHisRecord,getInitData} from '@store/async-actions/fetchModules.js';
 import {initHistoryDetails} from '@store/async-actions/patInfo';
-import {storageLocal,fullfillText} from '@utils/tools';
+import {storageLocal,fullfillText,checkFullfillText} from '@utils/tools';
 
 const api = {
   getModules:'/moduleInfo/getAll',
@@ -20,7 +19,7 @@ function modulesParseJson(data){
   let json = {},obj={},saveTextJson={},moduleName={};
   data.map((it)=>{
     moduleName[config.moduleCP[it.type]] = it.name;//添加病情变化/病程变化子模板需要使用模板名称
-    obj = it.type==4?fullfillText(it.moduleDetailDTOList,false,false,false):fullfillText(it.moduleDetailDTOList);
+    obj = it.type==4?checkFullfillText(it.moduleDetailDTOList):fullfillText(it.moduleDetailDTOList);
     json[config.moduleCP[it.type]] = formatContinueDots(obj.newArr);
     saveTextJson[config.moduleCP[it.type]] = obj.saveText;
   });

+ 4 - 1
src/store/async-actions/pushMessage.js

@@ -45,11 +45,13 @@ export const billing = (mdata,boxMark) => {
         let vigilant=[], //警惕
              doubt=[],    //疑似诊断
             possible = [],  //可能诊断
-            determine=[]; //确诊
+            determine=[], //确诊
+            likely=[];//  鉴别诊断
             doubt = dis&&dis['疑似诊断'],
             possible = dis&&dis['可能诊断'];
             vigilant = dis&&dis['警惕'];
             determine = dis&&dis['确诊']; //确诊
+            likely = dis&&dis['鉴别诊断'];
         if(lab) {
             for(let i = 0; i < lab.length; i++) {
                 lab[i].checked = false
@@ -71,6 +73,7 @@ export const billing = (mdata,boxMark) => {
             doubt: doubt||[],
             possible: possible||[],
             vigilant: vigilant||[],
+            likely:likely||[],
             lab: lab||[],
             pacs: pacs||[],
         });

+ 4 - 4
src/store/reducers/assessResult.js

@@ -17,7 +17,7 @@ const init = {
   },    //可能结果
   calcuResult:{},       //计算公式结果
   calcuValues:{},       //计算公式填的值
-  wholeScaleItems:[],   //全部量表中添加的整体评估项
+  wholeScaleItems:{},   //全部量表中添加的整体评估项
   addedScaleIds:[]
 };
 export default (state=init,action)=>{
@@ -60,7 +60,7 @@ export default (state=init,action)=>{
       res.wholeIndexs = action.wholeAssessItems||{};
       res.addedScaleIds = action.addedScaleIds||[];
       res.wholeResults = action.wholeResults||{};
-      res.wholeScaleItems = action.wholeScaleItems||[];
+      res.wholeScaleItems = action.wholeScaleItems||{};
       res.wholeAssessText = action.wholeAssessText||{};
       res.chooseSelecteds = action.chooseSelecteds||{};
       res.calcuResult = action.calcuResult||{};
@@ -74,8 +74,8 @@ export default (state=init,action)=>{
       res.update1 = Math.random();   //对象更新,与其他字段名不同因为绑定在pushItems,避免不必要的渲染
       return res;
     case ADD_WHOLE_SCALE_ITEMS:
-      res.wholeScaleItems[action.index] = action.data;
-      res.addedScaleIds.push(action.data.id);
+      res.wholeScaleItems[action.id] = action.data;
+      res.addedScaleIds.push(action.id);
       res.update1 = Math.random();
       return res;
     case REMOVE_ASSESS_ITEMS:

+ 1 - 1
src/store/reducers/pushMessage.js

@@ -65,7 +65,7 @@ export default function(state = initState, action) {
       res.tableList = action.data;
       return res;
     case SHOW_TABLE_LIST://显示、隐藏量表列表
-      res.showHide = Object.assign({},res.showHide,{[action.name]:action.value},action.item);
+      res.showHide = Object.assign({},res.showHide,{[action.name]:action.value,isPop:action.isPop},action.item);
       return res;
     case SET_CHRONIC_PUSHS:
       res.chronicPushItems = action.data;

+ 95 - 19
src/utils/tools.js

@@ -935,35 +935,111 @@ function notTextLabel(label){
 * 入参:arr源数组,
 *       noPre是否不添加前置文本标签,默认false即添加
 *       noEnd是否不添加后置文本标签,默认false即添加
-*       ifEmpty是否添加空标签,默认true即添加,传false添加逗号,如查体,
-*       showInCheck是否默认在查体中展开
+*  出参:newArr添加自由文本标签后的数据Array,
+*        saveText添加自由文本后对应的预览数据Array,
 * */
-function fullfillText(arr,noPre=false,noEnd=false,ifEmpty=true){
+function fullfillText(arr,noPre=false,noEnd=false){
   let newArr =[],
     pre={},
     textLabel={},
-    _textLabel={},
     notText = true,
     saveText=[],
     tempText = '',
     value = '',
-    item={},
-    cNum = 0,
-    checkHiddenDefault=false;//console.log(arr)
+    cNum = 0;
   arr&&arr.map((it,i)=>{
     notText = notTextLabel(it);
     cNum = i;
     value = it.value||'';
-    textLabel = !ifEmpty&&i==0?Object.assign({},JSON.parse(config.textLabel),{showInCheck:true}):JSON.parse(config.textLabel);
+    textLabel = JSON.parse(config.textLabel);
+    //n个显示的标签最后一个标签后面要落关标,所以+1
+    if(i===0){
+      //第一个标签不是文本标签时在前面添加文本标签
+      if(!noPre&&notText){
+        newArr.push(textLabel);
+        saveText.push('');
+      }
+      newArr.push(it);
+      if(it.tagType != 3){      //非血压类组合标签
+        tempText = value?it.labelPrefix+value+it.labelSuffix:'';
+        tempText = notText?tempText:it.value||it.name;
+      }else{
+        tempText = getSaveText(it);
+      }
+      saveText.push(tempText);
+      // 模板只有一个标签时第一项后面也要加空标签
+      if(arr.length==1&&notText){
+        newArr.push(JSON.parse(config.textLabel));
+        saveText.push('');
+      }
+    }else{
+      pre = arr[i-1];
+      //如果本身不是文本标签且前面一个也不是文本标签,该标签前面添加文本标签
+      if(notTextLabel(pre)&&notText){
+        newArr.push(textLabel,it);
+        if(it.tagType != 3) {
+          tempText = value ? it.labelPrefix + value + it.labelSuffix : '';
+        }else{
+          tempText = getSaveText(it);
+        }
+        saveText.push("",tempText);
+      }else{    //本身是或者前面是文本标签时,前面不添加文本标签
+        newArr.push(it);
+        if(it.tagType != 3) {
+          tempText = value ? it.labelPrefix + value + it.labelSuffix : '';
+          tempText = notText ? tempText : (it.value || it.value == "" ? it.value : it.name);
+        }else{
+          tempText = getSaveText(it);
+        }
+        saveText.push(tempText);
+      }
+      if(notText&&!noEnd&&i===arr.length-1){//最后一个非文本标签,后面添加一个文本标签
+        //不能用上面的变量textLabel,因为上一个if可能也进了,这样就是同一个对象,值改变时会同步
+        newArr.push(JSON.parse(config.textLabel));
+        saveText.push("");
+      }
+    }
+  });
+  return {newArr,saveText};
+};
+
+/*
+ * 查体添加自由文本标签函数
+ * 默认标签直接添加,
+ * 前config.showCheckNum个源数据标签默认显示,剩余隐藏收起
+ *  入参:arr源数组,
+ *       noPre是否不添加前置文本标签,默认false即添加
+ *       noEnd是否不添加后置文本标签,默认false即添加
+ *  showInCheck是否默认在查体中展开
+ *  出参:newArr添加自由文本标签后的数据Array,
+ *        saveText添加自由文本后对应的预览数据Array,
+ *        checkHiddenDefault查体是否全部标签展开
+ *
+ * */
+function checkFullfillText(arr,noPre=false,noEnd=false){
+  let newArr =[],
+    pre={},
+    textLabel={},
+    notText = true,
+    saveText=[],
+    tempText = '',
+    value = '',
+    item={},
+    checkHiddenDefault=false;
+  arr&&arr.map((it,i)=>{
+    notText = notTextLabel(it);
+    value = it.value||'';
+    //textLabel = i==0?JSON.parse(config.textLabel):Object.assign({},JSON.parse(config.textLabel),{showInCheck:true});
     //n个显示的标签最后一个标签后面要落关标,所以+1
-    _textLabel = !ifEmpty&&cNum<config.showCheckNum+1?Object.assign({},JSON.parse(config._textLabel),{showInCheck:true}):JSON.parse(config._textLabel);
+    //_textLabel = !ifEmpty&&cNum<config.showCheckNum+1?Object.assign({},JSON.parse(config._textLabel),{showInCheck:true}):JSON.parse(config._textLabel);
     if(i===0){
+      textLabel = Object.assign({},JSON.parse(config.textLabel),{showInCheck:true});
       //第一个标签不是文本标签时在前面添加文本标签
       if(!noPre&&notText){
         newArr.push(textLabel);
         saveText.push('');
       }
-      item = ifEmpty?it:Object.assign({},it,{showInCheck:true});
+      item = Object.assign({},it,{showInCheck:true});
       newArr.push(item);
       if(it.tagType != 3){
         tempText = value?it.labelPrefix+value+it.labelSuffix:'';
@@ -979,17 +1055,18 @@ function fullfillText(arr,noPre=false,noEnd=false,ifEmpty=true){
       }
     }else{
       pre = arr[i-1];
-      item = !ifEmpty&&cNum<config.showCheckNum?Object.assign({},it,{showInCheck:true}):it;
+      item = i<config.showCheckNum?Object.assign({},it,{showInCheck:true}):it;
       //判断单选项是否有默认选中,位置在隐藏区域时,查体所有标签展示
-      if(!ifEmpty&&!checkHiddenDefault&&cNum>config.showCheckNum&&+it.tagType===1&&(+it.controlType===0||+it.controlType===1)){
+      if(!checkHiddenDefault&&i>config.showCheckNum&&+it.tagType===1&&(+it.controlType===0||+it.controlType===1)){
         if(it.questionDetailList.find((it)=>it.defaultSelect=='1')){
           checkHiddenDefault=true;
         }
       }
       //如果本身不是文本标签且前面一个也不是文本标签,该标签前面添加文本标签
       if(notTextLabel(pre)&&notText){
-        // newArr.push(textLabel,it);
-        ifEmpty?newArr.push(textLabel,it):newArr.push(_textLabel,item);
+        textLabel = Object.assign(JSON.parse(config._textLabel),{showInCheck:i-1<config.showCheckNum?true:false});
+        newArr.push(textLabel,item);
+
         if(it.tagType != 3) {
           tempText = value ? it.labelPrefix + value + it.labelSuffix : '';
         }else{
@@ -1000,7 +1077,6 @@ function fullfillText(arr,noPre=false,noEnd=false,ifEmpty=true){
         newArr.push(item);
         if(it.tagType != 3) {
           tempText = value ? it.labelPrefix + value + it.labelSuffix : '';
-          // tempText = notText?tempText:it.value||it.name;
           tempText = notText ? tempText : (it.value || it.value == "" ? it.value : it.name);
         }else{
           tempText = getSaveText(it);
@@ -1008,15 +1084,14 @@ function fullfillText(arr,noPre=false,noEnd=false,ifEmpty=true){
         saveText.push(tempText);
       }
       if(notText&&!noEnd&&i===arr.length-1){//最后一个非文本标签,后面添加一个文本标签
-        //不能用上面的变量textLabel,因为上一个if可能也进了,这样就是同一个对象,值改变时会同步
-        const _text = arr.length>config.showCheckNum?JSON.parse(config._textLabel):_textLabel;
-        newArr.push(ifEmpty?textLabel:_text);
+        const _text = Object.assign(JSON.parse(config.textLabel),{showInCheck:arr.length>config.showCheckNum?false:true});
+        newArr.push(_text);
         saveText.push("");
       }
     }
   });
   return {newArr,saveText,checkHiddenDefault};
-};
+}
 
 
 //获取标签index,入参:病例项index+标签index+标签内index
@@ -1111,6 +1186,7 @@ module.exports = {
     getWindowInnerHeight,
     getLabelIndex,
     fullfillText,
+    checkFullfillText,
     parseUrl,
     getAge,
     dateParser,