Quellcode durchsuchen

Squashed commit of the following:

commit b970606b0b07f2bf28119d61a12880d1071f2e5f
Author: liucf <liucf@zjlantone.com>
Date:   Wed Apr 24 16:25:12 2019 +0800

    部分调整

commit 338aea67570a817f32aa76f8e5c480a13d1b051b
Author: liucf <liucf@zjlantone.com>
Date:   Wed Apr 24 16:12:57 2019 +0800

    合并远程分支

commit 251d20c792ecd15afa6b9360191b8f1c1fcb4859
Author: liucf <liucf@zjlantone.com>
Date:   Wed Apr 24 15:31:32 2019 +0800

    量表数据处理,前端计算结果并储存

commit 71f88df10c8d693c5226528f146085f843bf67dc
Author: liucf <liucf@zjlantone.com>
Date:   Tue Apr 23 17:41:39 2019 +0800

    合并分支

commit 2acca1ab13ad978eff9bc5597e5328e952efce71
Author: liucf <liucf@zjlantone.com>
Date:   Tue Apr 23 17:35:08 2019 +0800

    量表模拟数据进行选中逻辑处理

# Conflicts:
#	src/components/ChronicInfo/index.jsx
#	src/store/actions/mainSuit.js
#	src/store/async-actions/pushMessage.js
#	src/store/reducers/pushMessage.js
liucf vor 6 Jahren
Ursprung
Commit
d6cdd2319e

+ 53 - 33
src/components/ChronicInfo/index.jsx

@@ -30,7 +30,6 @@ class ChronicInfo extends React.Component{
       show:true,
       showInfo:false,
       showOption:false,
-      showTable:false,
       showAssess:false,      //评估弹窗
       infoId:null,  //静态知识
       formulaId:null, //计算公式
@@ -60,7 +59,8 @@ class ChronicInfo extends React.Component{
   }
 
   onPrint() {
-    let dom = this.state.showTable?$("#printcontent"):$("#AssistResult");
+    const {showHide} = this.props;
+    let dom = showHide&&showHide.showTable?$("#printcontent"):$("#AssistResult");
     dom.jqprint({
       debug: false,
       importCSS: true,
@@ -72,13 +72,22 @@ class ChronicInfo extends React.Component{
     $(this.$content.current)[0].scrollIntoView(true);
   }
   
-  showTableList(id){//量表
+  showTableList(id){//量表按钮
     const {getTableList,questionId} = this.props;
     // getTableList(questionId&&questionId.id);
     if(id){
       getTableList(id);
     }
   }
+  close(){//关闭量表列表
+    const {hideList} = this.props;
+    hideList&&hideList({name:'showList',value:false});
+  }
+  handleListClick(item){//量表列表单项点击
+    this.showTable(item,null);
+    this.close()
+  }
+
   showInfo(id){//显示静态知识
     // 静态知识显示在提示信息里(4-18)
     const {getInfomation} = this.props;
@@ -108,21 +117,20 @@ class ChronicInfo extends React.Component{
     })
   }
   showTable(it,parentId){
-    const {formulaResult} = this.props;
-    // 密西根糖尿病周围神经病评分(MDNS) 为例
-    /*const item = {
-      id:40744,
-      name:'密西根糖尿病周围神经病评分(MDNS)'
-    }*/
+    const {formulaResult,scaleInfo} = this.props;
+    // 密西根糖尿病周围神经病评分(MDNS) 为例 id:40744
     const item = {
       id:it.id,
       name:it.name
     }
-    // 判断:store里已经有改该量表就无需重新调接口
-    // formulaResult
-    this.props.getScaleInfo(item);
+    // 判断:store里已经有该量表就无需重新调接口
+    if(scaleInfo&&scaleInfo[it.id]){
+      this.props.hideList({name:'showTable',value:true});
+    }else{
+      this.props.getScaleInfo(item);
+    }
+    
     this.setState({
-      showTable:true,
       tableName:it.name,
       tableId:it.id,
       parentId:parentId
@@ -130,11 +138,11 @@ class ChronicInfo extends React.Component{
   }
   closeTable(){
     this.setState({
-      showTable:false,
       tableName:'',
       tableId:null,
       parentId:null,
     })
+    this.props.hideList({name:'showTable',value:false});
   }
   showAssessFn(){
     this.setState({
@@ -142,10 +150,7 @@ class ChronicInfo extends React.Component{
       isAssessConfirm:false
     });
   }
-  close(){
-    const {hideList} = this.props;
-    hideList&&hideList();
-  }
+  
   showFormula(id){//计算公式
     this.setState({
       formulaId:id
@@ -192,7 +197,7 @@ class ChronicInfo extends React.Component{
     
   }
   getDetail(){
-    const {data,indexs} = this.props;
+    const {data,indexs,scaleInfo,formulaResult} = this.props;
     const {showInfo,showOption,infoId,formulaId,optionId,possible,radioVal} = this.state;
     let list = data&&data.map((v,i)=>{
                     return <div className={style["list"]}>
@@ -210,7 +215,11 @@ class ChronicInfo extends React.Component{
                       {v.details&&v.details.map((it,j)=>{
                         if(it.type==1){
                           return <p>
-                                <span className={style["listName"]} onClick={this.showTable.bind(this,it.content,v.id)}>{'【'+it.content.name+'】'}</span>
+                                <span className={style["listName"]} onClick={this.showTable.bind(this,it.content,v.id)}>
+                                  {'【'+it.content.name+'】'}
+                                  {formulaResult&&formulaResult[it.content.id]?<i>{'结果:'+ formulaResult[it.content.id].text}</i>:''}
+                                  
+                                </span>
                                 {indexs[i]&&indexs[i].includes(j)?<span className={style["addResult"]}>
                                   <img src={added} />
                                   已加入
@@ -222,9 +231,11 @@ class ChronicInfo extends React.Component{
                               </p>
                         }else if(it.type==2){
                           return <div className={style["marTop"]}>
-                            <span>计算公式结果:</span>
-                            <span className={style["blue"]} onClick={this.showFormula.bind(this,v.id)}>请选择</span>
-                            <img src={level1} />
+                            <span className={style["limit"]}>
+                              计算公式结果:
+                              <i className={style["blue"]} onClick={this.showFormula.bind(this,v.id)}>请选择</i>
+                              <img src={level1} />
+                            </span>
                             {indexs[i]&&indexs[i].includes(j)?<span className={style["addResult"]}>
                                   <img src={added} />
                                   已加入
@@ -297,9 +308,11 @@ class ChronicInfo extends React.Component{
                           </div>
                         }else if(it.type==3){
                           return <div className={style["marTop"]}>
-                            <span>可能结果:</span>
-                            <span onClick={this.showOption.bind(this,v.id)} className={style["blue"]}>{possible[i]?possible[i]:'请选择'}</span>
-                            <img src={level1} />
+                            <span className={style["limit"]}>
+                              可能结果:
+                              <i onClick={this.showOption.bind(this,v.id)} className={style["blue"]}>{possible[i]?possible[i]:'请选择'}</i>
+                              <img src={level1} />
+                            </span>
                             {indexs[i]&&indexs[i].includes(j)?<span className={style["addResult"]}>
                                   <img src={added} />
                                   已加入
@@ -339,8 +352,12 @@ class ChronicInfo extends React.Component{
       <span className={style['print']} onClick={this.onPrint}><img src={printIcon} alt=""/>打印</span>
       <span className={style['okBtn']} onClick={()=>this.handleSaveAssess()}>确定</span>
     </div>;
-    const {chronicMagItem,showList,tableList,scaleInfo,data,saveAssessInfos,chronicDesease} = this.props;
-    const {showInfo,showOption,showTable,showAssess,isAssessConfirm,tableName,tableId,parentId,possible,radioVal} = this.state;
+    const scaleFooter = <div className={style['footer']}>
+      <span className={style['print']} onClick={this.onPrint}><img src={printIcon} alt=""/>打印</span>
+      <span className={style['okBtn']} onClick={()=>this.closeTable()}>确定</span>
+    </div>;
+    const {chronicMagItem,showList,tableList,scaleInfo,data,saveAssessInfos,chronicDesease,formulaResult,showHide} = this.props;
+    const {showInfo,showOption,showAssess,isAssessConfirm,tableName,tableId,parentId,possible,radioVal} = this.state;
     //console.log(8989,chronicMagItem,chronicDesease);
     return <div className={style["tips"]} style={{marginBottom:'15px'}}>
               <div className={`${style["tips-title"]} ${style["chronic"]}`}>
@@ -364,22 +381,25 @@ class ChronicInfo extends React.Component{
               <div className={style["content"]}> 
                   {this.getDetail()}
               </div>
-              <ConfirmModal visible={showList} noFooter='true' title='全部量表' close={this.close} titleBg="#DFEAFE" icon={allTableIcon} height={300}>
+              <ConfirmModal visible={showHide&&showHide.showList} noFooter='true' title='全部量表' close={this.close} titleBg="#DFEAFE" icon={allTableIcon} height={400} width={400}>
                       <ul className={style['toast-cont']}>
                         {tableList&&tableList.map((v,i)=>{
-                          return <li>
-                          <span>{'【'+v.name+'】'}</span>
+                          return <li onClick={this.handleListClick.bind(this,v)}>
+                          <span>
+                            {'【'+v.name+'】'}
+                            {formulaResult&&formulaResult[v.id]?<i>{'结果:'+formulaResult[v.id].text}</i>:''}
+                          </span>
                           </li>
                         })}
                       </ul>
               </ConfirmModal>
-              {showTable?<ComplexModal onclose={this.closeTable} footer={footer}
+              {showHide&&showHide.showTable?<ComplexModal onclose={this.closeTable} footer={scaleFooter}
                       title={tableName}
                       icon={tableIcon}
                       top={20}
                       bottom={20}
                       width={820}>
-                <ScaleTable data={scaleInfo} title={tableName} tableId={tableId} parentId={parentId}></ScaleTable>
+                <ScaleTable title={tableName} tableId={tableId} parentId={parentId}></ScaleTable>
               </ComplexModal>:''}
               {showAssess?<ComplexModal onclose={this.showAssessFn} footer={footer}
                       title='管理和评估'

+ 10 - 0
src/components/ChronicInfo/index.less

@@ -68,6 +68,8 @@
         .listName{
           color:#3B9ED0;
           cursor: pointer;
+          display: inline-block;
+          width: 73%;
         }
         .listResult,.addResult{
           float: right;
@@ -122,6 +124,10 @@
       .marTop{
         margin-top: 10px;
         position: relative;
+        .limit{
+          display: inline-block;
+          width: 72%;
+        }
         img{
           vertical-align: middle;
         }
@@ -210,6 +216,10 @@
         margin-top: 10px;
         cursor: pointer;
       }
+      i{
+        color:#3B9ED0;
+        margin-left: 10px;
+      }
     }
     .footer{
       .print{

+ 174 - 96
src/components/ScaleTable/index.jsx

@@ -1,8 +1,9 @@
 import React from 'react';
 import style from './index.less';
 import mocks from '../../mock/chronicTable.js'
-import { Radio,CheckBtn } from '@commonComp';
- import Information from '../Information'
+import { Radio,CheckBtn ,Notify} from '@commonComp';
+ import Information from '../Information';
+ import {deepClone} from '@utils/tools.js';
 /**
 *量表 具体信息页面
 *title:量表标题/scaleName
@@ -14,21 +15,59 @@ class ScaleTable extends React.Component{
   constructor(props){
     super(props);
     this.state={
-      // originData:props.data && data[1].content|| [],
-      originData:{},
-      selecteds:{}
+      selecteds:{},  //当前页面的选中标识,保存后使用select标识
+      valueData:{},
+      start:false,   //点击计算
+      score:{},  //选中的分数
+      totalScore:0  //前端计算结果
     }
   }
-  handleRadio(name,value){
-    const {selecteds,originData} = this.state;
-    const content = originData && originData[1].content;//表格内容
-    const datas = content && JSON.parse(content);//console.log(1111,originData,datas);
+  // handleRadio(groupName,name,value){
+  handleRadio(groupName,name,item){
+    const {selecteds,valueData,score} = this.state;
+    const value = item.detailName;
     this.setState({
-      selecteds:Object.assign({},selecteds,{[name]:value})
+      selecteds:Object.assign({},selecteds,{[name]:value}),
+      score:Object.assign({},score,{[name]:item.score})
+    })
+    const datas = JSON.parse(JSON.stringify(valueData));
+    const group = datas.group;
+    let rows;
+    let details;
+    for(let i=0; i<group.length; i++){
+      if(group[i].groupName==groupName){
+        rows = group[i].rows;
+        break;
+      }
+    }
+    if(rows){
+      for(let j=0; j<rows.length; j++){
+        let row = rows[j].row;
+        for(let k=0;k < row.length; k++){
+          if(row[k].name==name){
+            details = row[k].details;
+            row[k].isSelect = true;
+            break;
+          }
+        }
+      }
+    }
+    if(details){
+      for(let n=0; n<details.length; n++){
+        details[n].select = 0;
+        if(details[n].detailName==value){
+          details[n].select = 1;
+        }
+      }
+    }
+    this.setState({
+      valueData:datas
     })
   }
-  handleCheckbox(name,value){
-    let {selecteds} = this.state;
+  // handleCheckbox(name,value){
+  handleCheckbox(groupName,name,item){
+    let {selecteds,valueData} = this.state;
+    const value = item.detailName;
     selecteds[name]?selecteds[name]:selecteds[name]=[];
     const index = selecteds[name].findIndex((i)=>i==value);
     if(index!=-1){
@@ -39,48 +78,138 @@ class ScaleTable extends React.Component{
     this.setState({
       selecteds:selecteds
     });
+
+    const datas = JSON.parse(JSON.stringify(valueData));
+    const group = datas.group;
+    let rows;
+    let details;
+    for(let i=0; i<group.length; i++){
+      if(group[i].groupName==groupName){
+        rows = group[i].rows;
+        break;
+      }
+    }
+    if(rows){
+      for(let j=0; j<rows.length; j++){
+        let row = rows[j].row;
+        for(let k=0;k < row.length; k++){
+          if(row[k].name==name){
+            details = row[k].details;
+            row[k].isSelect = true;
+            break;
+          }
+        }
+      }
+    }
+    if(details){
+      for(let n=0; n<details.length; n++){
+        if(details[n].detailName==value){
+          if(!details[n].select || details[n].select==0){
+            details[n].select = 1;
+          }else{
+            details[n].select = 0;
+          }
+        }
+      }
+    }
   }
 
-  handleFormula(data){
-    const {tableId,getResult,parentId} = this.props; 
+  handleFormula(data){//得分计算
+    const {tableId,getResult,parentId,scaleInfo} = this.props; 
+    const {valueData,score} = this.state; 
+    this.setState({
+      start:true
+    })
+    // 遍历是否有必填项未填的情况 filter:required==1 && !isSelect
+    const group = valueData.group;
+    let unfinish;
+    for(let i=0; i<group.length; i++){
+      let rows = group[i].rows;
+      for(let j=0; j<rows.length; j++){
+        if(rows[j].required==1&& (rows[j].row.filter((it,i)=>{return !it.isSelect})).length>0){
+          unfinish = true;
+          break;
+        }
+      }
+    }
+    if(unfinish){
+      Notify.info("请先将量表内容选择完整");
+      return
+    }
+    // 前端计算分数
+    let totalScore = 0;
+    for(let i in score){
+      totalScore += parseFloat(score[i])
+    }
+    this.setState({
+      totalScore:totalScore
+    })
+    const range = valueData&&valueData.calculate?valueData.calculate.range:'';
+    let resultText;
+    if(range){
+      for(let k=0; k<range.length; k++){
+        if(parseFloat(range[k].min) < totalScore && totalScore > parseFloat(range[k].max)){
+          resultText = range[k].text;
+        }
+      }
+    }
+    const result = {
+      score:totalScore,
+      text:resultText
+    }
+
     const params = {
       type:1,
-      content:data, //选择后的数据--字符串形式
+      content:JSON.stringify(valueData), //选择后的数据--字符串形式
       id:parentId,
       scaleId:tableId,
-    }
-    // console.log("调计算接口");
-    // getResult&&getResult(params);
+    } 
+    // 替换表格内容
+    let allDatas = JSON.parse(JSON.stringify(scaleInfo[tableId])) ;
+     allDatas[1].content = JSON.stringify(valueData);
+    // 计算接口
+    getResult&&getResult({params,allDatas,result});
   }
   componentWillReceiveProps(nextProps){ 
     const {tableId} = this.props;
     if(JSON.stringify(nextProps.scaleInfo) !== '{}'){
       this.setState({
-        originData:nextProps.scaleInfo[tableId]
+        // valueData:nextProps.scaleInfo[tableId].length?mocks.newData:JSON.parse(nextProps.scaleInfo[tableId].content),
+        valueData:JSON.parse(nextProps.scaleInfo[tableId][1].content),
       })
     }
   }
-
-  getContent(){
-    const datas = mocks.newData;
-    let {selecteds} = this.state;
-    let content =  datas&&datas.group.map((v,i)=>{
+  componentDidMount(){
+    const {tableId,scaleInfo} = this.props;
+    if(scaleInfo&&scaleInfo[tableId]){
+      this.setState({
+        // valueData:scaleInfo[tableId].length?mocks.newData:JSON.parse(scaleInfo[tableId].content)
+        valueData:JSON.parse(scaleInfo[tableId][1].content)
+      })
+    }
+    
+  }
+  getContent(){ 
+    let {selecteds,valueData,start} = this.state;
+    // const datas = valueData&&valueData.group?valueData:mocks.newData;
+    const datas = valueData&&valueData.group?valueData:'';
+    let 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)=>{
                     return <div>
                       {it.row.map((item,index)=>{
-                        if(item.controltype==0){
-                          return <div className={style['block']}>
+                        if(item.controlType==0){
+                          return <div className={style['block']} style={{border:it.required==1&&!item.isSelect&&start?'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}
-                                         isSelect={selecteds[item.name]==vv.detailName}
-                                         handleClick={this.handleRadio.bind(this,item.name,vv.detailName)}>
-                                      </Radio>
-                                      {vv.state==1?<span style={{color:'#3B9ED0'}}>(智能推荐)</span>:''}
-                                  </div>
+                                        <Radio label={vv.detailName}
+                                           isSelect={vv.select==1||selecteds[item.name]==vv.detailName}
+                                           handleClick={this.handleRadio.bind(this,v.groupName,item.name,vv)}>
+                                        </Radio>
+                                        {vv.state==1?<span style={{color:'#3B9ED0'}}>(智能推荐)</span>:''}
+                                    </div>
                               })}
                               
                             </div>
@@ -88,12 +217,14 @@ class ScaleTable extends React.Component{
                             return <div className={style['block']}>
                                 <p className={style['miniName']}>{item.name}</p>
                                   {item.details&&item.details.map((vv,ii)=>{
-                                    return <CheckBtn value={vv.detailName}
+                                    return <div className={style['item']}>
+                                    <CheckBtn value={vv.detailName}
                                                     label={vv.detailName}
-                                                    isSelect={selecteds[v.name]&&selecteds[item.name].includes(vv.detailName)}
-                                                    handleClick={this.handleCheckbox.bind(this,item.name,vv.detailName)}>
+                                                    isSelect={vv.select==1||selecteds[item.name]&&selecteds[item.name].includes(vv.detailName)}
+                                                    handleClick={this.handleCheckbox.bind(this,v.groupName,item.name,vv)}>
                                           </CheckBtn>
                                     {vv.state==1?<span style={{color:'#3B9ED0'}}>(智能推荐)</span>:''}
+                                    </div>
                                   })}
                             </div>
                           }
@@ -101,7 +232,7 @@ class ScaleTable extends React.Component{
                       })}
                     </div>
                   })}
-                  {v.groupCalculate.isShow=='1(1-显示计算结果,0-不显示计算结果)'?<p className={style['subTotal']}>
+                  {v.groupCalculate.isShow==1?<p className={style['subTotal']}>
                     <span>计分</span>
                     <span>{v.groupCalculate.result.value}</span>
                   </p>:''}  
@@ -111,79 +242,26 @@ class ScaleTable extends React.Component{
   }
 
   render(){
-    const {title,scaleInfo,tableId} = this.props;
+    const {title,scaleInfo,tableId,formulaResult} = this.props;
     const data = scaleInfo[tableId];
-    let {selecteds} = this.state;
+    let {selecteds,totalScore} = this.state;
     const content = data && data[1].content;//表格内容
     const preContent = data && data[0].content;//表前文字
     const footContent = data && data[2].content; //表后文字
-    // const datas = content && JSON.parse(content);
-    const datas = mocks.newData;
+    const datas = content && JSON.parse(content);
+    const scaleResult = formulaResult&&formulaResult[tableId]; //量表计算结果
     return <div className={style['tableBox']} id="printcontent">
             <div className={style['printShow']}>
               <Information></Information>
             </div> 
-            {/*<h1>{title}</h1>*/}
-            <h1>{datas.scaleName}</h1>
+            <h1>{datas?datas.scaleName:''}</h1>
             <div dangerouslySetInnerHTML={{__html:preContent}} className={style['textlh']}></div>
-            {/*<table className={style['table']}>
-              <thead>
-                <tr>
-                  {datas&&datas.title.map((v,i)=>{
-                    return <td>{v.name}</td>
-                  })}  
-                </tr>
-              </thead>
-              <tbody>
-                {datas&&datas.rows.map((v,i)=>{
-                    return <tr>
-                    <td>{v.name}</td>
-                    <td>
-                      {v.controltype==0?v.details.map((it,index)=>{
-                          return <td className={style['block']}>
-                            <Radio label={it.detailName}
-                                   id={it.id}
-                                   isSelect={selecteds[v.name]==it.detailName}
-                                   handleClick={this.handleRadio.bind(this,v.name,it.detailName)}>
-                            </Radio>
-                            {it.state==1?<span style={{color:'#3B9ED0'}}>(智能推荐)</span>:''}
-                          </td>
-                        }):v.details.map((it,index)=>{
-                          return <td className={style['block']}>
-                              <CheckBtn id={it.detailName}
-                                        value={it.detailName}
-                                        label={it.detailName}
-                                        isSelect={selecteds[v.name]&&selecteds[v.name].includes(it.detailName)}
-                                        handleClick={this.handleCheckbox.bind(this,v.name,it.detailName)}>
-                              </CheckBtn>
-                            </td>
-                        })
-                    }
-                    </td>
-                    <td>
-                      {v.details.map((it,index)=>{
-                        return <td className={style['block']}>{it.score}</td>
-                      })}
-                    </td>
-                    <td></td>
-                    </tr>
-                  })} 
-              </tbody>
-              <tfoot>
-                <tr>
-                  <td colspan="4" className={style['sum']}>
-                  总计:<i>95</i>
-                  <span className={style['formulaBtn']} onClick={this.handleFormula.bind(this,datas)}>计算</span>
-                  </td>
-                </tr>
-              </tfoot>
-            </table>*/}
             <div className={style['textContent']}>
               {this.getContent()}
               <div className={style['total']}>
                 <span>总分:</span>
-                <span>{datas.calculate.result.value||'54' +'分'}</span>
-                <span className={style['totalBtn']}>得分</span>
+                <span>{scaleResult&&scaleResult.score||totalScore||''}</span>
+                <span className={style['totalBtn']} onClick={this.handleFormula.bind(this)}>得分</span>
               </div>
             </div>
             <div dangerouslySetInnerHTML={{__html:footContent}} className={style['textlh']}></div>

+ 18 - 9
src/components/ScaleTable/index.less

@@ -1,11 +1,12 @@
 .tableBox{
   // height: 690px;
   overflow-y: auto;
-  padding: 15px;
+  // padding: 15px;
+  padding: 30px;
   h1{
     font-size: 16px;
     font-weight: bold;
-    margin: 20px 0;
+    margin: 10px 0 30px;
     text-align: center;
   }
 }
@@ -52,9 +53,9 @@
       font-weight: normal;
     }
   }
-  .block{
-    display: block;
-  }
+  // .block{
+  //   display: block;
+  // }
 }
 strong{
   font-weight: bold;
@@ -68,15 +69,22 @@ strong{
   margin: 40px 0 30px;
   .group{
     border-bottom: 4px solid #EBEBEB;
-    // margin-bottom: 25px;
+    padding-bottom: 10px;
     margin-top: 25px;
     .item{
       display: inline-block;
       margin-right: 24px;
     }
-    .miniName{
-      margin-top: 25px;
+    .block{
+      margin-top: 20px;
+      padding-top: 5px;
     }
+    .redBorder{
+      border: 1px solid #f00;
+    }
+    // .miniName{
+    //   margin-top: 25px;
+    // }
   }
   .groupName{
     font-size: 14px;
@@ -89,6 +97,7 @@ strong{
     line-height: 49px;
     border-top: 1px solid #EBEBEB;
     text-align: right;
+    margin-top: 10px;
   }
   .total{
     height: 72px;
@@ -105,7 +114,7 @@ strong{
       border-radius: 4px;
       margin-left: 40px;
       text-align: center;
-      cursor: auto;
+      cursor: pointer;
     }
   }
 }

+ 9 - 4
src/containers/ChronicInfo.js

@@ -1,6 +1,6 @@
 import {connect} from 'react-redux';
 import ChronicInfo from '../components/ChronicInfo';
-import {SHOW_TABLE_LIST,HIDE_TABLE_LIST} from '@store/types/pushMessage';
+import {SHOW_TABLE_LIST} from '@store/types/pushMessage';
 import {getTableList,getScaleInfo,getTips} from '../store/async-actions/pushMessage';
 import {ADD_ASSESS_ITEMS,SET_SAVE_ASSESS_DATA} from "@types/assessResult";
 import {saveMessage} from "../store/async-actions/print";
@@ -12,6 +12,7 @@ function mapStateToProps(state){
     questionId: state.diagnosticList.clickDiag,
     tableList: state.pushMessage.tableList,
     showList: state.pushMessage.showList,
+    showHide: state.pushMessage.showHide,
     scaleInfo: state.pushMessage.scaleInfo,//量表内容
     chronicDesease:state.mainSuit.chronicDesease,//主诉存的慢病
     update:state.assessResult.update1,
@@ -23,10 +24,14 @@ function mapDispatchToProps(dispatch){
   return {
     getTableList(id){
       dispatch(getTableList(id))
-      dispatch({type:SHOW_TABLE_LIST})
+      // dispatch({type:SHOW_TABLE_LIST})
     },
-    hideList(){
-      dispatch({type:HIDE_TABLE_LIST})
+    hideList(item){
+      dispatch({
+        type:SHOW_TABLE_LIST,
+        name:item.name,
+        value:item.value
+      })
     },
     getScaleInfo(item){
       dispatch(getScaleInfo(item))

+ 2 - 9
src/containers/PushItemsContainer.js

@@ -1,9 +1,9 @@
 import React from 'react';
 import {connect} from 'react-redux';
 import PushItems from '../components/PushItems'
-import {CHANGE_ASSAY, CHANGE_CHECK, ADD_BILLING, SHOW_TIPS_DETAILS, HIDE_TIPS_DETAILS,SHOW_TABLE_LIST,HIDE_TABLE_LIST} from '@store/types/pushMessage';
+import {CHANGE_ASSAY, CHANGE_CHECK, ADD_BILLING, SHOW_TIPS_DETAILS, HIDE_TIPS_DETAILS,SHOW_TABLE_LIST} from '@store/types/pushMessage';
 import { ADD_DIAGNOSTIC, GET_DIAGNOSTIC_STR } from '@store/types/diagnosticList';
-import {billing, getTips, getTipsDetails,getTableList} from '../store/async-actions/pushMessage';
+import {billing, getTips, getTipsDetails} from '../store/async-actions/pushMessage';
 import { isAddMainSuit } from '@store/async-actions/diagnosticList';
 
 function mapStateToProps(state) {
@@ -63,13 +63,6 @@ function mapDispatchToProps(dispatch) {
             dispatch({
                 type: HIDE_TIPS_DETAILS
             })
-        },
-        getTableList(id){
-            dispatch(getTableList(id))
-            dispatch({type:SHOW_TABLE_LIST})
-        },
-        hideList(){
-            dispatch({type:HIDE_TABLE_LIST})
         }
     }
 }

+ 17 - 3
src/containers/ScaleTable.js

@@ -1,8 +1,9 @@
 import {connect} from 'react-redux';
 import ScaleTable from '@components/ScaleTable';
-import {getFormulaResult} from '@store/async-actions/fetchModules.js'
+import {getFormulaResult} from '@store/async-actions/fetchModules.js';
+import {SET_SCALE_INFO,SAVE_TABLE_RESULT} from '@store/types/pushMessage';
 
-function mapStateToProps (state){
+function mapStateToProps (state){//console.log(state);
   return {
     scaleInfo: state.pushMessage.scaleInfo,//量表内容
     formulaResult:state.pushMessage.formulaResult //计算结果
@@ -12,7 +13,20 @@ function mapStateToProps (state){
 function mapDispatchToProps (dispatch){
   return {
     getResult(obj){//计算结果
-      dispatch(getFormulaResult(obj));
+      const {params,allDatas,result} = obj;
+      // dispatch(getFormulaResult(obj.params));
+      dispatch({
+        type:SET_SCALE_INFO,
+        data:allDatas,
+        id:params.scaleId //量表id
+      })
+      if(result&&result.text){
+        dispatch({
+          type:SAVE_TABLE_RESULT,
+          id:params.scaleId,  
+          data:result
+        })
+      }
     }
   }
 }

+ 7 - 7
src/mock/chronicTable.js

@@ -117,7 +117,7 @@ module.exports = {
                         "column":"score"
                     }
                 ],
-                "isShow":"1(1-标题展示,0-标题不展示)"
+                "isShow":"1"
             },
             "groupCalculate":{
                 "result":{
@@ -125,12 +125,12 @@ module.exports = {
                     "unit":"",
                     "text":""
                 },
-                "isShow":"1(1-显示计算结果,0-不显示计算结果)"
+                "isShow":"1"
             },
             "rows":[
                 {
-                    "mutex":"0(0-非互斥,1-互斥)",
-                    "required":"1(1-必填项,0-选填项)",
+                    "mutex":"0",
+                    "required":"1",
                     "row":[
                         {
                             "coefficent":1,
@@ -189,7 +189,7 @@ module.exports = {
                     "unit":"",
                     "text":""
                 },
-                "isShow":"1(1-显示计算结果,0-不显示计算结果)"
+                "isShow":"1"
             },
             "rows":[
                 {
@@ -248,7 +248,7 @@ module.exports = {
                     "unit":"",
                     "text":""
                 },
-                "isShow":"1(1-显示计算结果,0-不显示计算结果)"
+                "isShow":"1"
             },
             "rows":[
                 {
@@ -395,7 +395,7 @@ module.exports = {
                     "unit":"",
                     "text":""
                 },
-                "isShow":"1(1-显示计算结果,0-不显示计算结果)"
+                "isShow":"1"
             },
             "rows":[
                 {

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

@@ -683,6 +683,7 @@ export const clearMainSuit = (state,action)=>{//回读和清除
   if(action.symptomFeature !== undefined){//清除分词数据
     res.symptomFeature.featureData = action.symptomFeature;
   }
+  // console.log(res,action);
   return res;
 }
 

+ 2 - 1
src/store/async-actions/fetchModules.js

@@ -285,7 +285,8 @@ export const getFormulaResult = (item)=>{
       if(+res.data.code==0){
         dispatch({
           type:SAVE_TABLE_RESULT,
-          id:id, //外层疾病id
+          // id:id, //外层疾病id
+          id:item.scaleId,  //量表id
           data:{
             data:item.content, //量表内容
             // id:item.scaleId,  //量表id

+ 19 - 5
src/store/async-actions/pushMessage.js

@@ -1,8 +1,9 @@
 import { get, post, json } from "@utils/ajax";
-import { BILLING_ADVICE, SET_TIPS, SET_TIPS_DETAILS ,SET_CHRONIC_TABLELIST,SET_SCALE_INFO,SET_CHRONIC_PUSHS} from '../types/pushMessage';
+import { BILLING_ADVICE, SET_TIPS, SET_TIPS_DETAILS ,SET_CHRONIC_TABLELIST,SET_SCALE_INFO,SET_CHRONIC_PUSHS,SHOW_TABLE_LIST} from '../types/pushMessage';
 import { SET_CLICK_DIAG } from '../types/diagnosticList';
 import {storageLocal,getEMRParams} from '@utils/tools';
 import {SET_IMPORT_CHECKBODY_LABEL} from "../types/checkBody";
+import { Notify} from '@commonComp';
 
 const api={
   push:'/push/pushInner',
@@ -21,9 +22,8 @@ export const billing = (mdata) => {
   const emrData = getEMRParams();
   const params = {
     age: emrData.age,
-    // featureType: "4,5,6,7,22",
-    featureType: "22",
-    // featureType: "4,5,6,22",
+    featureType: "4,5,6,7,22",
+    // featureType: "22",
     diag: emrData.dis,
     lis: emrData.lis,
     other: emrData.other,
@@ -143,6 +143,13 @@ export const getTableList = (id)=>{
                     type: SET_CHRONIC_TABLELIST,
                     data: res.data.data
                 })
+                dispatch({
+                    type:SHOW_TABLE_LIST,
+                    name:'showList',
+                    value:true
+                })
+            }else{
+                Notify.info(res.data.msg)
             }
         }).catch((e) => {
             console.log(e)
@@ -171,8 +178,15 @@ export const getScaleInfo = (it)=>{
                 dispatch({
                     type: SET_SCALE_INFO,
                     data: result.data.scale,
-                    table:it
+                    id:it.id
+                })
+                dispatch({
+                    type:SHOW_TABLE_LIST,
+                    name:'showTable',
+                    value:true
                 })
+            }else{
+                Notify.info(result.msg)
             }
         }).catch((e) => {
             console.log(e)

+ 8 - 11
src/store/reducers/pushMessage.js

@@ -1,7 +1,7 @@
 import {CHANGE_ASSAY, CHANGE_CHECK, BILLING_ADVICE, ADD_SCHEME, SET_TIPS,  SET_TIPS_DETAILS, 
         SET_CHANGE_ADVICE_TREATMENT, SET_CHANGE_ADVICE_ASSAY, SET_CHANGE_ADVICE_CHECK, ADD_BILLING,
         CLEAR_ALL_PUSH_MESSAGE,SHOW_TIPS_DETAILS, HIDE_TIPS_DETAILS, SET_COMMONTREATMENT, IS_FIRST_MAIN_DIAG, 
-        SET_ADVICE_INPUT ,SET_CHRONIC_TABLELIST,SHOW_TABLE_LIST,HIDE_TABLE_LIST,SET_SCALE_INFO,SET_CHRONIC_PUSHS,
+        SET_ADVICE_INPUT ,SET_CHRONIC_TABLELIST,SHOW_TABLE_LIST,SET_SCALE_INFO,SET_CHRONIC_PUSHS,
         SAVE_TABLE_RESULT, SAVE_FOLLOW_UP, DEL_FOLLOW_UP} from '../types/pushMessage';
 import {changeAssay, changeCheck, setAdvice, addScheme, setTips, setTipsDetails, setChangeAdviceTreatment, 
         setChangeAdviceAssay, setChangeAdviceCheck, addBilling, clearAllPushMessage, showTipsDetails, hideTipsDetails, 
@@ -26,7 +26,8 @@ const initState = {
   tmpFlg:'',
   tableList:[],
   formulaResult:{},
-  scaleInfo:{}
+  scaleInfo:{},
+  showHide:{}
 };
 export default function(state = initState, action) {
   let res = Object.assign({},state);
@@ -70,20 +71,16 @@ export default function(state = initState, action) {
     case SET_CHRONIC_TABLELIST://量表列表数据
       res.tableList = action.data;
       return res;
-    case SHOW_TABLE_LIST://显示量表列表数据
-      res.showList = true;
-      return res;
-    case HIDE_TABLE_LIST://隐藏量表列表数据
-      res.showList = false;
+    case SHOW_TABLE_LIST://显示、隐藏量表列表
+      res.showHide = Object.assign({},res.showHide,{[action.name]:action.value});
       return res;
     case SET_CHRONIC_PUSHS:
       res.chronicPushItems = action.data;
       return res;
-    case SET_SCALE_INFO://量表内容
-      // res.scaleInfo = action.data;
-      res.scaleInfo = Object.assign({},res.scaleInfo,{[action.table.id]:action.data});
+    case SET_SCALE_INFO://量表内容-量表id
+      res.scaleInfo = Object.assign({},res.scaleInfo,{[action.id]:action.data});
       return res;
-    case SAVE_TABLE_RESULT://量表计算结果
+    case SAVE_TABLE_RESULT://量表计算结果-量表id
       res.formulaResult = Object.assign({},res.formulaResult,{[action.id]:action.data});
       return res;
     default:

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

@@ -17,7 +17,6 @@ export const SET_COMMONTREATMENT = 'SET_COMMONTREATMENT';    //设置常见治
 export const SET_ADVICE_INPUT = 'SET_ADVICE_INPUT' ; //设置医嘱自由输入内容
 export const SET_CHRONIC_TABLELIST = 'SET_CHRONIC_TABLELIST' ; //设置量表列表
 export const SHOW_TABLE_LIST = 'SHOW_TABLE_LIST' ; //显示量表列表
-export const HIDE_TABLE_LIST = 'HIDE_TABLE_LIST' ; //隐藏量表列表
 export const SET_CHRONIC_PUSHS ='SET_CHRONIC_PUSHS'; //右侧慢病量表评估推送模块数据
 export const SET_SCALE_INFO = 'SET_SCALE_INFO' ; //量表明细
 export const SAVE_TABLE_RESULT = 'SAVE_TABLE_RESULT' ; //量表计算结果