Просмотр исходного кода

Merge remote-tracking branch 'origin/Chronic_test' into ChronicMag

# Conflicts:
#	src/components/AssessResult/ChartItem/index.jsx
#	src/components/AssessResult/ChooseItem/index.jsx
#	src/components/AssessResult/ScaleItem/index.jsx
#	src/components/AssessResult/index.jsx
#	src/components/ChronicInfo/index.jsx
#	src/components/ScaleTable/index.jsx
#	src/components/ScaleTable/index.less
#	src/containers/AssessResult.js
#	src/containers/ChronicInfo.js
#	src/containers/ScaleTable.js
#	src/store/async-actions/fetchModules.js
#	src/store/async-actions/pushMessage.js
#	src/store/reducers/assessResult.js
#	src/store/reducers/pushMessage.js
#	src/store/types/assessResult.js
zhouna 6 лет назад
Родитель
Сommit
8e3303abfc

+ 1 - 1
src/common/components/Radio/index.less

@@ -1,5 +1,5 @@
 .radio{
-  max-width: 120px;
+  // max-width: 120px;
   height: 35px;
   line-height: 35px;
   cursor: pointer;

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

@@ -5,24 +5,24 @@ import { Radio,CheckBtn } from '@commonComp';
  import Information from '../Information'
 /**
 *量表 具体信息页面
-*title:量表标题
-*data:量表内容
+*title:量表标题/scaleName
+*data:量表内容:scaleName量表标题,calculate量表计算结果,group分组,
+*
+*
 **/
 class ScaleTable extends React.Component{
   constructor(props){
     super(props);
     this.state={
-      data:props.data && data[1].content|| [],
+      // originData:props.data && data[1].content|| [],
+      originData:{},
       selecteds:{}
     }
-    this.handleChange = this.handleChange.bind(this);
-  }
-
-  handleChange(event){
-    console.log(event.target.value);
   }
   handleRadio(name,value){
-    const {selecteds} = this.state;
+    const {selecteds,originData} = this.state;
+    const content = originData && originData[1].content;//表格内容
+    const datas = content && JSON.parse(content);//console.log(1111,originData,datas);
     this.setState({
       selecteds:Object.assign({},selecteds,{[name]:value})
     })
@@ -52,22 +52,81 @@ class ScaleTable extends React.Component{
     // console.log("调计算接口");
     // getResult&&getResult(params);
   }
+  componentWillReceiveProps(nextProps){ 
+    const {tableId} = this.props;
+    if(JSON.stringify(nextProps.scaleInfo) !== '{}'){
+      this.setState({
+        originData:nextProps.scaleInfo[tableId]
+      })
+    }
+  }
+
+  getContent(){
+    const datas = mocks.newData;
+    let {selecteds} = this.state;
+    let content =  datas&&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']}>
+                              <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>
+                              })}
+                              
+                            </div>
+                          }else{
+                            return <div className={style['block']}>
+                                <p className={style['miniName']}>{item.name}</p>
+                                  {item.details&&item.details.map((vv,ii)=>{
+                                    return <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)}>
+                                          </CheckBtn>
+                                    {vv.state==1?<span style={{color:'#3B9ED0'}}>(智能推荐)</span>:''}
+                                  })}
+                            </div>
+                          }
+                        
+                      })}
+                    </div>
+                  })}
+                  {v.groupCalculate.isShow=='1(1-显示计算结果,0-不显示计算结果)'?<p className={style['subTotal']}>
+                    <span>计分</span>
+                    <span>{v.groupCalculate.result.value}</span>
+                  </p>:''}  
+                </div>
+              })
+    return content;
+  }
 
   render(){
-    const {data,title} = this.props;
+    const {title,scaleInfo,tableId} = this.props;
+    const data = scaleInfo[tableId];
     let {selecteds} = 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);
-    // console.log(555,datas,content);
+    // const datas = content && JSON.parse(content);
+    const datas = mocks.newData;
     return <div className={style['tableBox']} id="printcontent">
             <div className={style['printShow']}>
               <Information></Information>
             </div> 
-            <h1>{title}</h1>
+            {/*<h1>{title}</h1>*/}
+            <h1>{datas.scaleName}</h1>
             <div dangerouslySetInnerHTML={{__html:preContent}} className={style['textlh']}></div>
-            <table className={style['table']}>
+            {/*<table className={style['table']}>
               <thead>
                 <tr>
                   {datas&&datas.title.map((v,i)=>{
@@ -80,15 +139,6 @@ class ScaleTable extends React.Component{
                     return <tr>
                     <td>{v.name}</td>
                     <td>
-                      {/*{v.details.map((it,index)=>{
-                            return <td className={style['block']}>
-                              <label>
-                                <input type="radio" name={v.name} value={it.score} onChange={this.handleChange}/>{it.detailName}
-                                <span style={{display:it.state==1?'inline':'none',color:'#3B9ED0'}}>(智能推荐)</span>
-                              </label>
-                            </td>
-                            
-                          })}*/}
                       {v.controltype==0?v.details.map((it,index)=>{
                           return <td className={style['block']}>
                             <Radio label={it.detailName}
@@ -127,7 +177,15 @@ class ScaleTable extends React.Component{
                   </td>
                 </tr>
               </tfoot>
-            </table>
+            </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>
+              </div>
+            </div>
             <div dangerouslySetInnerHTML={{__html:footContent}} className={style['textlh']}></div>
           </div>
   }

+ 46 - 1
src/components/ScaleTable/index.less

@@ -11,7 +11,7 @@
 }
 .table{
   width: 100%;
-  margin: 10px 0 10px;
+  margin: 10px 0;
   border-top: 10px solid #D8D8D8;
   border-bottom: 10px solid #D8D8D8;
   tr{
@@ -64,6 +64,51 @@ strong{
     line-height: 22px;
   }
 }
+.textContent{
+  margin: 40px 0 30px;
+  .group{
+    border-bottom: 4px solid #EBEBEB;
+    // margin-bottom: 25px;
+    margin-top: 25px;
+    .item{
+      display: inline-block;
+      margin-right: 24px;
+    }
+    .miniName{
+      margin-top: 25px;
+    }
+  }
+  .groupName{
+    font-size: 14px;
+    font-weight: bold;
+    color:#000;
+    margin: 25px 0;
+  }
+  .subTotal{
+    height: 49px;
+    line-height: 49px;
+    border-top: 1px solid #EBEBEB;
+    text-align: right;
+  }
+  .total{
+    height: 72px;
+    line-height: 72px;
+    border-bottom: 10px solid #EBEBEB;
+    text-align: right;
+    .totalBtn{
+      display: inline-block;
+      width: 64px;
+      height: 32px;
+      line-height: 32px;
+      color:#3B9ED0;
+      border: 1px solid #3B9ED0;
+      border-radius: 4px;
+      margin-left: 40px;
+      text-align: center;
+      cursor: auto;
+    }
+  }
+}
 .printShow {
   display: none;
 }

+ 1 - 1
src/containers/ChronicInfo.js

@@ -12,7 +12,7 @@ function mapStateToProps(state){
     questionId: state.diagnosticList.clickDiag,
     tableList: state.pushMessage.tableList,
     showList: state.pushMessage.showList,
-    scaleInfo: state.pushMessage.scaleInfo,//量表明细
+    scaleInfo: state.pushMessage.scaleInfo,//量表内容
     chronicDesease:state.mainSuit.chronicDesease,//主诉存的慢病
     update:state.assessResult.update1,
     formulaResult:state.pushMessage.formulaResult //量表信息

+ 1 - 0
src/containers/ScaleTable.js

@@ -4,6 +4,7 @@ import {getFormulaResult} from '@store/async-actions/fetchModules.js'
 
 function mapStateToProps (state){
   return {
+    scaleInfo: state.pushMessage.scaleInfo,//量表内容
     formulaResult:state.pushMessage.formulaResult //计算结果
   }
 }

+ 506 - 1
src/mock/chronicTable.js

@@ -84,5 +84,510 @@ module.exports = {
             ]
         }
     ]
-  }
+  },
+  newData:{
+    "scaleType":"1(1-评分量表)",
+    "scaleName":"危重病人APACHE II评分表",
+    "calculate":{
+        "result":{
+            "value":"",
+            "unit":"",
+            "text":""
+        },
+        "formula":"sum(分值*系数+常数)",
+        "range":[
+
+        ]
+    },
+    "group":[
+        {
+            "groupName":"A.年龄",
+            "title":{
+                "columns":[
+                    {
+                        "name":"指标名称",
+                        "column":"name"
+                    },
+                    {
+                        "name":"指标范围",
+                        "column":"detailName"
+                    },
+                    {
+                        "name":"得分",
+                        "column":"score"
+                    }
+                ],
+                "isShow":"1(1-标题展示,0-标题不展示)"
+            },
+            "groupCalculate":{
+                "result":{
+                    "value":"",
+                    "unit":"",
+                    "text":""
+                },
+                "isShow":"1(1-显示计算结果,0-不显示计算结果)"
+            },
+            "rows":[
+                {
+                    "mutex":"0(0-非互斥,1-互斥)",
+                    "required":"1(1-必填项,0-选填项)",
+                    "row":[
+                        {
+                            "coefficent":1,
+                            "constant":0,
+                            "details":[
+                                {
+                                    "detailName":"≤44",
+                                    "score":"0.0",
+                                    "state":"0"
+                                },
+                                {
+                                    "detailName":"45-54",
+                                    "score":"2.0",
+                                    "state":"0"
+                                },
+                                {
+                                    "detailName":"55-64",
+                                    "score":"3.0",
+                                    "state":"0"
+                                },
+                                {
+                                    "detailName":"65-74",
+                                    "score":"5.0",
+                                    "state":"0"
+                                }
+                            ],
+                            "name":"年龄",
+                            "controltype":0
+                        }
+                    ]
+                }
+            ]
+        },
+        {
+            "groupName":" B.有严重器官系统功能不全或免疫损害",
+            "title":{
+                "columns":[
+                    {
+                        "name":"指标名称",
+                        "column":"name"
+                    },
+                    {
+                        "name":"指标范围",
+                        "column":"detailName"
+                    },
+                    {
+                        "name":"得分",
+                        "column":"score"
+                    }
+                ],
+                "isShow":"0"
+            },
+            "groupCalculate":{
+                "result":{
+                    "value":"",
+                    "unit":"",
+                    "text":""
+                },
+                "isShow":"1(1-显示计算结果,0-不显示计算结果)"
+            },
+            "rows":[
+                {
+                    "mutex":"0",
+                    "required":"1",
+                    "row":[
+                        {
+                            "coefficent":1,
+                            "constant":0,
+                            "details":[
+                                {
+                                    "detailName":"非手术或择期手术后",
+                                    "score":"2.0",
+                                    "state":"0"
+                                },
+                                {
+                                    "detailName":"不能手术或急诊手术后",
+                                    "score":"5.0",
+                                    "state":"0"
+                                },
+                                {
+                                    "detailName":"无上述情况",
+                                    "score":"0.0",
+                                    "state":"0"
+                                }
+                            ],
+                            "name":"有严重器官系统功能不全或免疫损害",
+                            "controltype":0
+                        }
+                    ]
+                }
+            ]
+        },
+        {
+            "groupName":" C. GCS评分",
+            "title":{
+                "columns":[
+                    {
+                        "name":"指标名称",
+                        "column":"name"
+                    },
+                    {
+                        "name":"指标选项",
+                        "column":"detailName"
+                    },
+                    {
+                        "name":"得分",
+                        "column":"score"
+                    }
+                ],
+                "isShow":"0"
+            },
+            "groupCalculate":{
+                "result":{
+                    "value":"",
+                    "unit":"",
+                    "text":""
+                },
+                "isShow":"1(1-显示计算结果,0-不显示计算结果)"
+            },
+            "rows":[
+                {
+                    "mutex":"0",
+                    "required":"1",
+                    "row":[
+                        {
+                            "coefficent":-1,
+                            "constant":5,
+                            "details":[
+                                {
+                                    "detailName":"自动睁眼",
+                                    "score":"4.0",
+                                    "state":"0"
+                                },
+                                {
+                                    "detailName":"呼唤睁眼",
+                                    "score":"3.0",
+                                    "state":"0"
+                                },
+                                {
+                                    "detailName":"刺疼睁眼",
+                                    "score":"2.0",
+                                    "state":"0"
+                                },
+                                {
+                                    "detailName":"不能睁眼",
+                                    "score":"1.0",
+                                    "state":"0"
+                                }
+                            ],
+                            "name":"1.睁眼反应",
+                            "controltype":0
+                        }
+                    ]
+                },
+                {
+                    "mutex":"0",
+                    "required":"1",
+                    "row":[
+                        {
+                            "coefficent":-1,
+                            "constant":5,
+                            "details":[
+                                {
+                                    "detailName":"回答切题",
+                                    "score":"5.0",
+                                    "state":"0"
+                                },
+                                {
+                                    "detailName":"回答不切题",
+                                    "score":"4.0",
+                                    "state":"0"
+                                },
+                                {
+                                    "detailName":"答非所问",
+                                    "score":"3.0",
+                                    "state":"0"
+                                },
+                                {
+                                    "detailName":"只能发音",
+                                    "score":"2.0",
+                                    "state":"0"
+                                },
+                                {
+                                    "detailName":"不能言语",
+                                    "score":"1.0",
+                                    "state":"0"
+                                }
+                            ],
+                            "name":"2.语言反应",
+                            "controltype":0
+                        }
+                    ]
+                },
+                {
+                    "mutex":"0",
+                    "required":"1",
+                    "row":[
+                        {
+                            "coefficent":-1,
+                            "constant":5,
+                            "details":[
+                                {
+                                    "detailName":"按吩咐动作",
+                                    "score":"6.0",
+                                    "state":"0"
+                                },
+                                {
+                                    "detailName":"刺疼能定位",
+                                    "score":"5.0",
+                                    "state":"0"
+                                },
+                                {
+                                    "detailName":"刺疼能躲避",
+                                    "score":"4.0",
+                                    "state":"0"
+                                },
+                                {
+                                    "detailName":"刺疼肢体屈曲",
+                                    "score":"3.0",
+                                    "state":"0"
+                                },
+                                {
+                                    "detailName":"刺疼肢体伸展",
+                                    "score":"2.0",
+                                    "state":"0"
+                                },
+                                {
+                                    "detailName":"不能活动",
+                                    "score":"1.0",
+                                    "state":"0"
+                                }
+                            ],
+                            "name":"3.运动反应",
+                            "controltype":0
+                        }
+                    ]
+                }
+            ]
+        },
+        {
+            "groupName":" D.生理指标",
+            "title":{
+                "columns":[
+                    {
+                        "name":"指标名称",
+                        "column":"name"
+                    },
+                    {
+                        "name":"指标范围",
+                        "column":"detailName"
+                    },
+                    {
+                        "name":"得分",
+                        "column":"score"
+                    }
+                ],
+                "isShow":"0"
+            },
+            "groupCalculate":{
+                "result":{
+                    "value":"",
+                    "unit":"",
+                    "text":""
+                },
+                "isShow":"1(1-显示计算结果,0-不显示计算结果)"
+            },
+            "rows":[
+                {
+                    "mutex":"0",
+                    "required":"1",
+                    "row":[
+                        {
+                            "coefficent":1,
+                            "constant":0,
+                            "details":[
+                                {
+                                    "detailName":"≥41",
+                                    "score":"4.0",
+                                    "state":"0"
+                                },
+                                {
+                                    "detailName":"39-40.9",
+                                    "score":"3.0",
+                                    "state":"0"
+                                },
+                                {
+                                    "detailName":"38.5-38.9",
+                                    "score":"1.0",
+                                    "state":"0"
+                                },
+                                {
+                                    "detailName":"36-38.4",
+                                    "score":"0.0",
+                                    "state":"0"
+                                },
+                                {
+                                    "detailName":"34-35.9",
+                                    "score":"1.0",
+                                    "state":"0"
+                                },
+                                {
+                                    "detailName":"32-33.9",
+                                    "score":"2.0",
+                                    "state":"0"
+                                },
+                                {
+                                    "detailName":"30-31.9",
+                                    "score":"3.0",
+                                    "state":"0"
+                                },
+                                {
+                                    "detailName":"≤29.9",
+                                    "score":"4.0",
+                                    "state":"0"
+                                }
+                            ],
+                            "name":"1.体温(腋下℃)",
+                            "controltype":0
+                        }
+                    ]
+                },
+                {
+                    "mutex":"0",
+                    "required":"0",
+                    "row":[
+                        {
+                            "coefficent":1,
+                            "constant":0,
+                            "details":[
+                                {
+                                    "detailName":">70",
+                                    "score":"0.0",
+                                    "state":"0"
+                                },
+                                {
+                                    "detailName":"61-70",
+                                    "score":"1.0",
+                                    "state":"0"
+                                },
+                                {
+                                    "detailName":"55-60",
+                                    "score":"3.0",
+                                    "state":"0"
+                                },
+                                {
+                                    "detailName":"<55",
+                                    "score":"4.0",
+                                    "state":"0"
+                                }
+                            ],
+                            "name":"PaO2(mmHg)(FiO2<50%)",
+                            "controltype":0
+                        },
+                        {
+                            "coefficent":1,
+                            "constant":0,
+                            "details":[
+                                {
+                                    "detailName":"≥500",
+                                    "score":"4.0",
+                                    "state":"0"
+                                },
+                                {
+                                    "detailName":"350-499",
+                                    "score":"3.0",
+                                    "state":"0"
+                                },
+                                {
+                                    "detailName":"200-349",
+                                    "score":"2.0",
+                                    "state":"0"
+                                },
+                                {
+                                    "detailName":"<200",
+                                    "score":"0.0",
+                                    "state":"0"
+                                }
+                            ],
+                            "name":"A-aDO2(FiO2>50%)",
+                            "controltype":0
+                        }
+                    ]
+                },
+                {
+                    "mutex":"0",
+                    "required":"1",
+                    "row":[
+                        {
+                            "coefficent":2,
+                            "constant":0,
+                            "details":[
+                                {
+                                    "detailName":"≥3.5",
+                                    "score":"4.0",
+                                    "state":"0"
+                                },
+                                {
+                                    "detailName":"2-3.4",
+                                    "score":"3.0",
+                                    "state":"0"
+                                },
+                                {
+                                    "detailName":"1.5-1.9",
+                                    "score":"2.0",
+                                    "state":"0"
+                                },
+                                {
+                                    "detailName":"0.6-1.4",
+                                    "score":"0.0",
+                                    "state":"0"
+                                },
+                                {
+                                    "detailName":"<0.6",
+                                    "score":"2.0",
+                                    "state":"0"
+                                }
+                            ],
+                            "name":"9.血清肌酐(mg/dL)-急性肾功能衰竭",
+                            "controltype":0
+                        },
+                        {
+                            "coefficent":1,
+                            "constant":0,
+                            "details":[
+                                {
+                                    "detailName":"≥3.5",
+                                    "score":"4.0",
+                                    "state":"0"
+                                },
+                                {
+                                    "detailName":"2-3.4",
+                                    "score":"3.0",
+                                    "state":"0"
+                                },
+                                {
+                                    "detailName":"1.5-1.9",
+                                    "score":"2.0",
+                                    "state":"0"
+                                },
+                                {
+                                    "detailName":"0.6-1.4",
+                                    "score":"0.0",
+                                    "state":"0"
+                                },
+                                {
+                                    "detailName":"<0.6",
+                                    "score":"2.0",
+                                    "state":"0"
+                                }
+                            ],
+                            "name":"9.血清肌酐(mg/dL)",
+                            "controltype":0
+                        }
+                    ]
+                }
+            ]
+        }
+    ]
+}
 }

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

@@ -149,7 +149,13 @@ export const insertMain = (state,action) => {
         inserIndx = i;
       }
     })
-  data.splice(inserIndx-1,1,...obj);
+  // data.splice(inserIndx-1,1,...obj);
+  if(data[inserIndx-1]&&data[inserIndx-1].tagType==8&& !data[inserIndx-1].name){
+    data.splice(inserIndx-1,1,...obj);
+  }else{
+    data.splice(inserIndx-1,0,...obj);
+  }
+  
   // data[inserIndx-1] = text;//替换空标签
   res.data = data;
   res.saveText = [];//将手动输入的值清掉

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

@@ -115,7 +115,7 @@ export const getTipsDetails = () => {
 
         //弹窗显示
         const url ='/introduceInfo/getByQuestionId'
-        console.log(123,state.diagnosticList.clickDiag)
+        
         const params = {
             type: 7,
             questionId: state.diagnosticList.clickDiag.id,
@@ -170,7 +170,8 @@ export const getScaleInfo = (it)=>{
             if(result.code==0){
                 dispatch({
                     type: SET_SCALE_INFO,
-                    data: result.data.scale
+                    data: result.data.scale,
+                    table:it
                 })
             }
         }).catch((e) => {

+ 5 - 3
src/store/reducers/pushMessage.js

@@ -19,7 +19,8 @@ const initState = {
   AdviceStr: '',
   tmpFlg:'',
   tableList:[],
-  formulaResult:{}
+  formulaResult:{},
+  scaleInfo:{}
 };
 export default function(state = initState, action) {
   let res = Object.assign({},state);
@@ -68,8 +69,9 @@ export default function(state = initState, action) {
     case SET_CHRONIC_PUSHS:
       res.chronicPushItems = action.data;
       return res;
-    case SET_SCALE_INFO://量表明细
-      res.scaleInfo = action.data;
+    case SET_SCALE_INFO://量表内容
+      // res.scaleInfo = action.data;
+      res.scaleInfo = Object.assign({},res.scaleInfo,{[action.table.id]:action.data});;
       return res;
     case SAVE_TABLE_RESULT://量表计算结果
       res.formulaResult = Object.assign({},res.formulaResult,{[action.id]:action.data});