浏览代码

管理评估位置修改到每个慢病复诊诊断后,量表同步未完

zhouna 6 年之前
父节点
当前提交
1f144cff46

+ 3 - 2
src/common/components/MiniToast/index.jsx

@@ -8,6 +8,7 @@ import close from "../../images/close-icon.png";
 *children:弹窗内容
 *show:弹窗显示
 *footer:是否显示底部“确定”按钮,默认不显示
+*confirmText:确认按钮文字
 *close:关闭弹窗事件
 *confirm:确定事件
 *使用时,父元素需要加相对定位position: relative;
@@ -29,7 +30,7 @@ class MiniToast extends React.Component{
 
 
   render(){
-    const {show,title,icon,children,footer} = this.props;
+    const {show,title,icon,children,footer,confirmText} = this.props;
     return <div className={style["infoBox"]} style={{display:show?'block':'none'}}>
               <p className={style["infoTitle"]}>
                 {icon?<img src={icon} />:''}
@@ -38,7 +39,7 @@ class MiniToast extends React.Component{
               </p>
               <div className={style["infoCon"]}>{children}</div>
               <div className={style["infoFoot"]} style={{display:footer?'block':'none'}}>
-                <span onClick={this.confirm.bind(this)}>确定</span>
+                <span onClick={this.confirm.bind(this)}>{confirmText?confirmText:'确定'}</span>
               </div>
             </div>
   }

+ 60 - 64
src/components/AssessResult/ScaleItem/index.jsx

@@ -27,8 +27,8 @@ class ScaleItem extends Component {
       radioVal:Object.assign({},radioVal)||{},
       formulaId:'',
       text:props.text,
-      formulaData:{},       //计算公式值
-      isFormulaConfirm:false,
+      isCalculated:false,
+      calcuValues:deepClone(props.calcuValues),   //计算公式填的值
     };
     this.getItems = this.getItems.bind(this);
     this.getDetailItems = this.getDetailItems.bind(this);
@@ -79,58 +79,66 @@ class ScaleItem extends Component {
       radioVal:Object.assign({},radioVal,{[parent.id]:item.detailName})
     })
   }
-  handleForRadio(id,idd, ind){
-    const {formulaData} = this.state;
-    const {calcuValues} = this.props;
-    const obj = deepClone(formulaData);
-    const data = obj&&obj[id];
-    data.content = calcuValues&&calcuValues[id];
-    if (data) {
-      for(let z = 0; z <  data.content.details[idd].details.length; z++) {
-        data.content.details[idd].details[z].state = 0;
-      }
-      data.content.details[idd].details[ind].state = 1;
-    };
+  handleInputformula(id,calcuContent,i,e) {
+    const {calcuValues} = this.state;
+    let obj = deepClone(calcuValues);
+    let values = (obj&&obj[id])||deepClone(calcuContent);
+    values[i].value = e.target.value;
+    obj[id] = values;
     this.setState({
-      formulaData:obj
+      isCalculated:false,
+      calcuValues:obj
     });
   }
-  showFormula(id,it){
-    const {formulaData} = this.state;
-    const obj = deepClone(formulaData)||{};
-    if(!obj[id]){
-      obj[id] = it;
+  handleForRadio(id,calcuContent,i,fidx){//计算公式
+    const { calcuValues } = this.state;
+    let obj = deepClone(calcuValues);
+    let values = (obj&&obj[id])||deepClone(calcuContent);
+    let details = values[i].details;
+    for(let x=0;x<details.length;x++){
+      if(x!=fidx){
+        details[x].state=0;
+      }else{
+        details[x].state=1;
+      }
     }
+    obj[id] = values;
     this.setState({
-      formulaId:id,
-      formulaData:obj
+      isCalculated:false,
+      calcuValues:obj
     });
   }
-  confirmFormula(){//计算公式确定
+  showFormula(id){
     this.setState({
-      isFormulaConfirm:true,
-      formulaId:null
+      formulaId:id
     });
   }
   closeFormula(){
-    this.setState({
-      formulaId:null
-    })
+    if(this.state.isCalculated){
+      this.setState({
+        formulaId:null,
+      });
+    }else{
+      this.setState({
+        formulaId:null,
+        calcuValues:deepClone(this.props.calcuValues)
+      });
+    }
   }
-  calcuFormula() { //计算公式计算
+  calcuFormula(item) { //计算公式计算
     const { calcuResult,handleCalcu } = this.props;
-    const {formulaId,formulaData} = this.state;
-    let it=formulaData&&formulaData[formulaId];
+    const {formulaId,calcuValues} = this.state;
+    let it=calcuValues&&calcuValues[formulaId];
     let allHasInfo = true;
-    for (let i = 0; i < it.content.details.length; i++) {
-      if(it.content.details[i].controlType == 2) {  //输入框类型的有没有填值
-        if(!it.content.details[i].value) {
+    for (let i = 0; i < it.length; i++) {
+      if(it[i].controlType == 2) {  //输入框类型的有没有填值
+        if(!it[i].value) {
           allHasInfo = false
         }
-      } else if(it.content.details[i].controlType == 0) {
+      } else if(it[i].controlType == 0) {
         let hasSelect = false;
-        for( let z = 0; z <it.content.details[i].details.length; z++) {
-          if(it.content.details[i].details[z].state == 1) {
+        for( let z = 0; z <it[i].details.length; z++) {
+          if(it[i].details[z].state == 1) {
             hasSelect= true
           }
         }
@@ -138,15 +146,18 @@ class ScaleItem extends Component {
           allHasInfo = false
         }
       }
-
     }
+    item.content.details = calcuValues[formulaId];
     if(allHasInfo) { //所有都有值,则计算
       let results = deepClone(calcuResult);
-      getFormulaResult({type:2,data:it}).then((res)=>{
+      getFormulaResult({type:2,data:item}).then((res)=>{
         if(+res.data.code==0){
           const result = res.data.data.result;
           results[formulaId] = result;
-          handleCalcu&&handleCalcu(results);
+          handleCalcu&&handleCalcu(calcuValues,results);
+          this.setState({
+            isCalculated:true
+          });
         }else{
           Notify.error(res.data.msg||'计算没有结果返回');
         }
@@ -155,49 +166,35 @@ class ScaleItem extends Component {
       Notify.info('请填写计算公式内容')
     }
   }
-  handleInputformula(id,idd,text) {
-    const {formulaData} = this.state;
-    const {calcuValues} = this.props;
-    const obj = deepClone(formulaData);
-    const data = obj&&obj[id];
-    data.content = calcuValues&&calcuValues[id];
-    if (data) {
-      data.content.details[idd].value = text;
-    }
-    this.setState({
-      formulaData:obj
-    });
-  }
   getDetailItems(item,i){
     let arr = [],temp='';
-    const {indexs,result,formulaResult,calcuValues,disabled,calcuResult} = this.props;
-    const {optionId,formulaId,radioVal,formulaData} = this.state;
+    const {indexs,result,formulaResult,disabled,calcuResult} = this.props;
+    const {optionId,formulaId,radioVal,calcuValues} = this.state;
     const possible=result&&result.possible;
 
     item.details.map((its,j)=>{
+      let it=its;
       if(indexs[i]&&indexs[i].includes(j)){
-        let it=null;
         if(its.type==1){     //量表
-          it=deepClone(its);
           let scaleRes=formulaResult&&formulaResult[it.content.id]&&formulaResult[it.content.id].calcalculate;
           temp =<span className={style['scale']}
                       onClick={()=>this.handleShowScale(it.content,item.id,i)}>
                         {scaleRes&&scaleRes.result?(' 【'+it.content.name+'】 结果:'+scaleRes.result.value+" "+(scaleRes.result.text||'')):'【'+it.content.name+'】'}
                         </span>;
         }else if(its.type==2){      //计算公式
-          it=formulaData[formulaId]||deepClone(its);
           const showRes = calcuResult&&calcuResult[item.id]||it.content.result;
-          const details = calcuValues&&calcuValues[item.id]&&calcuValues[item.id].details||it.content.details;
+          const details = calcuValues&&calcuValues[item.id]||it.content.details;
           const cresult = showRes&&showRes[1]&&showRes[1].text;
                     temp = <div className={style['results']}>
                     <span>计算公式结果:</span>
                     <span className={style["blue"]} onClick={this.showFormula.bind(this,item.id,it)}>{cresult?cresult:'请选择'}</span>
                     <img src={level1} />
                     <MiniToast title={it.content.name}
+                               confirmText='关闭'
                                icon={allTableIcon}
                                show={formulaId&&formulaId==item.id?true:false}
                                close={this.closeFormula}
-                               confirm={this.confirmFormula.bind(this,item,i)}
+                               confirm={this.closeFormula}
                                footer="true">
                       <table>
                         {details.map((item1,idd)=>{
@@ -212,7 +209,7 @@ class ScaleItem extends Component {
                                     <Radio label={ii.detailName}
                                            isSelect={ii.state == 1}
                                            disabled={disabled}
-                                           handleClick={this.handleForRadio.bind(this,item.id,idd, ind)}>
+                                           handleClick={this.handleForRadio.bind(this,item.id,details,idd,ind)}>
                                       >
                                     </Radio>
                                   </div>
@@ -225,7 +222,7 @@ class ScaleItem extends Component {
                                 <span>{'请输入'+item1.name+':'}</span>
                               </td>
                               <td>
-                                {disabled?item1.value:<input type="text" placeholder="请输入"  value={item1.value} onInput={(e)=>this.handleInputformula(item.id,idd,e.target.value)}/>}
+                                {disabled?item1.value:<input type="text" placeholder="请输入"  value={item1.value} onInput={(e)=>this.handleInputformula(item.id,details,idd,e)}/>}
                               </td>
                               <td>
                                 <span>{item1.uint}</span>
@@ -235,7 +232,7 @@ class ScaleItem extends Component {
                           }
                         })}
                       </table>
-                      {disabled?"":<div className={style["forMulBtn"]} onClick={this.calcuFormula.bind(this)}>计算</div>}
+                      {disabled?"":<div className={style["forMulBtn"]} onClick={this.calcuFormula.bind(this,its)}>计算</div>}
                       <table>
                         {showRes && Array.isArray(showRes) &&showRes.map((itemResult) => {
                           return <tr>
@@ -251,7 +248,6 @@ class ScaleItem extends Component {
                     </MiniToast>
                 </div>
         }else if(its.type==3){
-          it=deepClone(its);
           temp = <div className={style['results']}>
                     <span>可能结果:</span>
                     <span onClick={this.showOption.bind(this,item.id)} className={style["blue"]}>{possible&&possible[item.id]?possible[item.id]:'请选择'}</span>

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

@@ -27,6 +27,7 @@ class AssessResult extends Component {
         radioVal:props.radioVal
       },
       calcuResult:props.calcuResult,     //计算公式结果
+      calcuValues:props.calcuValues,    //计算公式填的值
     };
     this.handleChooseChange = this.handleChooseChange.bind(this);
     this.handleScaleDel = this.handleScaleDel.bind(this);
@@ -78,35 +79,34 @@ class AssessResult extends Component {
       chartTimeTypes:Object.assign(chartTimeTypes,{[i]:selects})
     });
   }
-  handleCalcu(ret){
+  handleCalcu(values,ret){
     this.setState({
-      calcuResult:ret
+      calcuResult:ret,
+      calcuValues:values
     });
   }
   componentWillUnmount(){
     //点确定关闭弹窗时把参数传到父组件去
-    const {handleSave,isAssessConfirm,clearChartData,handleSaveCalcu,isRecommend,saveCalcuResult} = this.props;
+    const {handleSave,isAssessConfirm,clearChartData,handleSavePossible,isRecommend} = this.props;
     clearChartData&&clearChartData();
     if(!isRecommend&&isAssessConfirm && readyKeepHistory() == 1){
       Notify.error("主诉不能为空");
     }else if(!isRecommend&&isAssessConfirm && readyKeepHistory() == 2){
       Notify.info('诊断不能为空');
     }
-    handleSaveCalcu&&handleSaveCalcu(this.state.wholeResults);
+    handleSavePossible&&handleSavePossible(this.state.wholeResults);
     if(isAssessConfirm){
       handleSave(this.state,readyKeepHistory(),isRecommend);
-    }else{
-      saveCalcuResult&&saveCalcuResult(this.state.calcuResult);
     }
   }
   handoutTypes(item,i){
     const {getIndexData,indexData,timeTypes,wholeIndexs,closeAssess,showScaleFn,isRecommend,chronicPushItems,
-      formulaResult,calcuValues,indexNames,showListScale} =this.props;
+      formulaResult,indexNames,showListScale} =this.props;
     let obj = [];
     Object.keys(wholeIndexs).map((i)=>{
       obj[i]=chronicPushItems[i];
     });
-    const {chooseSelecteds,wholeAssessItems,wholeScaleItems,wholeAssessText,chartTimeTypes,wholeResults,calcuResult} = this.state;
+    const {chooseSelecteds,wholeAssessItems,wholeScaleItems,wholeAssessText,chartTimeTypes,wholeResults,calcuResult,calcuValues} = this.state;
     const chartData = indexData;
     const name = item.regionName+":";
     const list = item.data&&item.data.rows;

+ 71 - 90
src/components/ChronicInfo/index.jsx

@@ -46,7 +46,8 @@ class ChronicInfo extends React.Component{
       formulaParam: {}, //量表计算公式计算入参
       showRecommend:false,      //显示推荐结果弹窗
       isRecommendConfirm:false,   //推荐结果确定
-      isFormulaConfirm:false,     //计算公式确定
+      isCalculated:false,     //是否刚计算过,关闭时值与结果对应
+      calcuValues:deepClone(props.calcuValues),       //计算公式填的值
     };
 
     this.showInfo = this.showInfo.bind(this);
@@ -60,8 +61,7 @@ class ChronicInfo extends React.Component{
     this.showFormula = this.showFormula.bind(this); //打开计算公式
     this.closeFormula = this.closeFormula.bind(this); //关闭计算公式
     this.handleAddAssessItem = this.handleAddAssessItem.bind(this);   //加入病例记录
-    this.handleSaveAssess = this.handleSaveAssess.bind(this);       //评估弹窗确定
-    this.onPrint = this.onPrint.bind(this); 
+    this.onPrint = this.onPrint.bind(this);
     this.handleForRadio = this.handleForRadio.bind(this);
     this.showRecommendFn = this.showRecommendFn.bind(this);
     this.handleSaveCalcu = this.handleSaveCalcu.bind(this);     //保存评估修改的计算和可能结果
@@ -179,9 +179,16 @@ class ChronicInfo extends React.Component{
     })
   }
   closeFormula(){
-    this.setState({
-      formulaId:null
-    })
+    if(this.state.isCalculated){
+      this.setState({
+        formulaId:null,
+      });
+    }else{
+      this.setState({
+        formulaId:null,
+        calcuValues:deepClone(this.props.calcuValues)
+      });
+    }
   }
   handleAddAssessItem(v,pIndex,i){
     const {addAssessItem} = this.props;
@@ -196,46 +203,33 @@ class ChronicInfo extends React.Component{
       that.showRecommendFn();
     });
   }
-  handleSaveAssess(){
+  handleInputformula(id,calcuContent,i,e) {
+    const {calcuValues} = this.state;
+    let obj = deepClone(calcuValues);
+    let values = (obj&&obj[id])||deepClone(calcuContent);
+    values[i].value = e.target.value;
+    obj[id] = values;
     this.setState({
-      isAssessConfirm:true
-    });
-    const that=this;
-    setTimeout(()=>{
-      that.showAssessFn();
+      isCalculated:false,
+      calcuValues:obj
     });
   }
-  handleInputformula(v,i, j,idd,  e) {
-    const { data, setChronicPush,calcuValues } = this.props;
-    let data1 = JSON.parse(JSON.stringify(data));
-    if(calcuValues&&calcuValues[data1[i].id]){
-      data1[i].details[j].content=calcuValues&&calcuValues[data1[i].id];
-    }
-    const text = e.target.value;
-    if (data1[i].details) {
-      data1[i].details[j].content.details[idd].value = text
-    }
-
-    setChronicPush(data1,data1[i].id,data1[i].details[j].content)
-  }
-  handleForRadio(ii,v,i, j,idd, ind){//计算公式
-    const { data, setChronicPush,calcuValues } = this.props;
-    const data1 = JSON.parse(JSON.stringify(data));
-    if(calcuValues&&calcuValues[data1[i].id]){
-      data1[i].details[j].content=calcuValues&&calcuValues[data1[i].id];
-    }
-    if (data1[i].details) {
-      for(let z = 0; z <  data1[i].details[j].content.details[idd].details.length; z++) {
-        data1[i].details[j].content.details[idd].details[z].state = 0
+  handleForRadio(id,calcuContent,i,fidx){//计算公式
+    const { calcuValues } = this.state;
+    let obj = deepClone(calcuValues);
+    let values = (obj&&obj[id])||deepClone(calcuContent);
+    let details = values[i].details;
+    for(let x=0;x<details.length;x++){
+      if(x!=fidx){
+        details[x].state=0;
+      }else{
+        details[x].state=1;
       }
-      data1[i].details[j].content.details[idd].details[ind].state = 1
     }
-    setChronicPush(data1,data1[i].id,data1[i].details[j].content);
-  }
-  confirmFormula(){//计算公式确定
+    obj[id] = values;
     this.setState({
-      isFormulaConfirm:true,
-      formulaId:null
+      isCalculated:false,
+      calcuValues:obj
     });
   }
   handleRadio(item,parent){//可能结果
@@ -260,41 +254,40 @@ class ChronicInfo extends React.Component{
       radioVal:Object.assign({},obj.radioVal),//不设置radioVal只有最近一次选中的值
     })
   }
-  calcuFormula(item,j, v, i) { //计算公式计算
-    const { calcuFormula ,data,calcuValues} = this.props;
-    let pushObj = deepClone(data);
-    if(calcuValues&&calcuValues[pushObj[i].id]){
-      pushObj[i].details[j].content=calcuValues&&calcuValues[pushObj[i].id];
-    }
-    let it = pushObj[i].details[j];
+  calcuFormula(id,it) { //计算公式计算
+    const { calcuFormula } = this.props;
+    let item = deepClone(it);
+    const values = this.state.calcuValues;
+    const calcuValues = Object.keys(values).length&&values[id]?values[id]:item.content.details;
     let allHasInfo = true;
-    for (let i = 0; i < it.content.details.length; i++) {
-      if(it.content.details[i].controlType == 2) {  //输入框类型的有没有填值
-        if(!it.content.details[i].value) {
-          allHasInfo = false
+    for (let i = 0; i < calcuValues.length; i++) {
+      if(calcuValues[i].controlType == 2) {  //输入框类型的有没有填值
+        if(!calcuValues[i].value) {
+          allHasInfo = false;
         }
-      } else if(it.content.details[i].controlType == 1) {
-        let hasSelect = false
-        for( let z = 0; z <it.content.details[i].details.length; z++) {
-          if(it.content.details[i].details[z].state == 1) {
-            hasSelect= true
+      } else if(calcuValues[i].controlType == 1) {
+        let hasSelect = false;
+        for( let z = 0; z <calcuValues[i].details.length; z++) {
+          if(calcuValues[i].details[z].state == 1) {
+            hasSelect= true;
           }
         }
         if(!hasSelect) {
-          allHasInfo = false
+          allHasInfo = false;
         }
       }
-
     }
+    item.content.details = calcuValues;
     if(allHasInfo) { //所有都有值,则计算
       let param = {
         type: 2,
-        data: it,
-        disId: v.id,
-        pIndex: j,
-        ppIndex: i
+        data: item,
+        disId: id
       };
-      calcuFormula({param,chronicPushItems:pushObj})
+      calcuFormula(param);
+      this.setState({
+        isCalculated:true
+      });
     } else {  //不是所有值都填过了
       Notify.info('请填写计算公式内容')
     }
@@ -331,8 +324,8 @@ class ChronicInfo extends React.Component{
     return btn;
   }
   getDetail(){
-    const {data,formulaResult,calcuResult,calcuValues} = this.props;
-    const {formulaId,optionId,possible,radioVal} = this.state;
+    const {data,formulaResult,calcuResult} = this.props;
+    const {formulaId,optionId,possible,radioVal,calcuValues} = this.state;
     let list = data&&data.map((v,i)=>{
                     return <div className={style["list"]}>
                       {v.name?<p>
@@ -354,7 +347,7 @@ class ChronicInfo extends React.Component{
                         }else if(it.type==2){
                           const cres = calcuResult&&calcuResult[v.id]||it.content.result;
                           const result = cres&&cres[1]&&cres[1].text;
-                          const details = calcuValues&&calcuValues[v.id]&&calcuValues[v.id].details||it.content.details;
+                          const details = calcuValues&&calcuValues[v.id]||it.content.details;
                           return <div className={style["marTop"]}>
                             <span className={style["limit"]}>
                               计算公式结果:
@@ -366,9 +359,10 @@ class ChronicInfo extends React.Component{
                             }
                             {formulaId&&formulaId==v.id&&<MiniToast title={it.content.name}
                                 icon={allTableIcon}
+                                confirmText='关闭'
                                 show={formulaId&&formulaId==v.id?true:false}
                                 close={this.closeFormula}
-                                confirm={this.confirmFormula.bind(this,v,i)}
+                                confirm={this.closeFormula}
                                 footer="true">
                                 <table>
                                 {details.map((item,idd)=>{
@@ -382,7 +376,7 @@ class ChronicInfo extends React.Component{
                                             return <div className={style["chooseItem"]}>
                                                     <Radio label={ii.detailName}
                                                              isSelect={ii.state == 1}
-                                                             handleClick={this.handleForRadio.bind(this,ii,v,i, j,idd, ind)}>
+                                                             handleClick={this.handleForRadio.bind(this,v.id,details,idd,ind)}>
                                                       </Radio>
                                                   </div>
                                           })}
@@ -394,7 +388,7 @@ class ChronicInfo extends React.Component{
                                           <span>{'请输入'+item.name+':'}</span>
                                         </td>
                                         <td>
-                                          <input type="text" placeholder="请输入"  value={item.value} onInput={this.handleInputformula.bind(this,v,i, j,idd)}/>
+                                          <input type="text" placeholder="请输入"  value={item.value} onInput={this.handleInputformula.bind(this,v.id,details,idd)}/>
                                         </td>
                                         <td>
                                           <span>{item.uint}</span>
@@ -404,7 +398,7 @@ class ChronicInfo extends React.Component{
                                     }
                                 })}
                                 </table>
-                                <div className={style["forMulBtn"]} onClick={this.calcuFormula.bind(this,it,j, v, i)}>计算</div>
+                                <div className={style["forMulBtn"]} onClick={this.calcuFormula.bind(this,v.id,it)}>计算</div>
                                 <table>
                                   {cres && Array.isArray(cres) &&cres.map((itemResult, resultIndex) => {
                                     return <tr>
@@ -456,12 +450,14 @@ class ChronicInfo extends React.Component{
                   })
     return list;
   }
-
+  componentWillReceiveProps(next){
+    if(JSON.stringify(next.calcuValues)!=JSON.stringify(this.props.calcuValues)){
+      this.setState({
+        calcuValues:next.calcuValues
+      })
+    }
+  }
   render(){
-    const footer = <div className={style['footer']}>
-      <span className={style['print']} onClick={this.onPrint}><img src={printIcon} alt=""/>打印</span>
-      <span className={style['okBtn']} onClick={()=>this.handleSaveAssess()}>确定</span>
-    </div>;
     const recFooter =<div className={style['footer']}>
       <span className={style['okBtn']} onClick={()=>this.handleSaveRecommend()}>确定</span>
     </div>;
@@ -525,21 +521,6 @@ class ChronicInfo extends React.Component{
                       width={820}>
                 <ScaleTable title={tableName} tableId={tableId} parentId={parentId} parentIndex={parentIndex}></ScaleTable>
               </ComplexModal>:''}
-              {showAssess?<ComplexModal onclose={this.showAssessFn} footer={footer}
-                      title='管理和评估'
-                      icon={manageIcon}
-                      top={'3%'}
-                      bottom={'3%'}
-                      width={820}>
-                <AssessResult handleSave={saveAssessInfos}
-                              handleSaveCalcu={this.handleSaveCalcu}
-                              closeAssess={this.showAssessFn}
-                              showScaleFn={this.showTable.bind(this)}
-                              showListScale={this.handleListClick.bind(this)}
-                              radioVal={radioVal}
-                              possible={possible}
-                              isAssessConfirm={isAssessConfirm}></AssessResult>
-              </ComplexModal>:''}
               {showRecommend?<ComplexModal onclose={this.showRecommendFn} footer={recFooter}
                                         title='推荐结果'
                                         icon={manageIcon}

+ 93 - 23
src/components/DiagnosticList/index.jsx

@@ -3,16 +3,18 @@ import style from './index.less';
 import del_icon from './img/delete.png'
 import diagUp from './img/diagUp.png'
 import diagDown from './img/diagDown.png'
-import {ConfirmModal, Message} from '@commonComp';
+import printIcon from '@common/images/team.png';
+import manageIcon from '@common/images/manage.png';
+import {ConfirmModal, Message,ComplexModal} from '@commonComp';
 import Notify from '@commonComp/Notify';
 import Treat from '@containers/Treat'
 import store from '@store';
 import { initItemList ,setInitHistory} from '@store/async-actions/historyTemplates';
-import { pushAllDataList,inspectAndAssist } from '@utils/tools';
+import { pushAllDataList,inspectAndAssist ,deepClone} from '@utils/tools';
 import iconRadioDefault from '@common/images/icon-radio-default.png'
 import iconRadioActive from '@common/images/icon-radio-active.png'
+import AssessResult from '@containers/AssessResult';
 import tableIcon from '@common/images/table.png';
-import { delFollowUp } from '../../store/actions/treat';
 import { CONFIRM_TYPE } from "@store/types/typeConfig";
 
 class DiagnosticList extends Component {
@@ -23,7 +25,12 @@ class DiagnosticList extends Component {
             delItem: {},
             treatTitle: '',
             activeHistory: -1,
-            sign:-1
+            sign:-1,
+            showAssess:false,
+            assessId:'',
+            isAssessConfirm:false,
+            radioVal:{},  //可能结果选择内容
+            possible:{},  //可能结果
         }
         this.deleteItem = this.deleteItem.bind(this);
         this.cancel = this.cancel.bind(this);
@@ -35,15 +42,9 @@ class DiagnosticList extends Component {
         this.getHistoryCase = this.getHistoryCase.bind(this);
         this.closeHistoryCaseModal = this.closeHistoryCaseModal.bind(this);
         this.referCase = this.referCase.bind(this);
+        this.handleSaveAssess = this.handleSaveAssess.bind(this);       //评估弹窗确定
+        this.handleSavePossible = this.handleSavePossible.bind(this);
     }
-
-    componentWillReceiveProps(nextprops) {
-        if (this.props.diagnosticStr != nextprops.diagnosticStr) {
-            this.props.getBilling();
-        }
-        
-    }
-
     upDiagnostic(index) {
         const { upDiagnostic } = this.props;
         upDiagnostic && upDiagnostic(index)
@@ -56,8 +57,8 @@ class DiagnosticList extends Component {
         const { delItem } = this.state;
         const { delDiagnostic, delReact,delFollowUp } = this.props;
         delDiagnostic && delDiagnostic(delItem);
-        delReact && delReact(delItem)
-        delFollowUp && delFollowUp(delItem)
+        delReact && delReact(delItem);
+        delFollowUp && delFollowUp(delItem);
         this.setState({
             visible: false,
         })
@@ -177,19 +178,69 @@ class DiagnosticList extends Component {
             })}
         </div>)
     }
-    
-    
+    showAssessFn(id){
+        if(typeof id!='object'){         //显示评估弹窗
+          this.setState({
+            showAssess:true,
+            isAssessConfirm:false,
+            assessId:id
+          });
+        }else{          //关闭评估弹窗
+            this.setState({
+              showAssess:false,
+              isAssessConfirm:false,
+            });
+        }
+    }
+    showTable(){
 
+    }
+    handleListClick(){
+
+    }
+    handleSavePossible(obj){
+      this.setState({
+        possible:Object.assign({},obj.possible),
+        radioVal:Object.assign({},obj.radioVal),//不设置radioVal只有最近一次选中的值
+      })
+    }
+    handleSaveAssess(){
+      this.setState({
+        isAssessConfirm:true
+      });
+      const that=this;
+      setTimeout(()=>{
+        that.setState({
+          showAssess:false
+        });
+      });
+    }
+    componentWillReceiveProps(nextprops) {
+      if (this.props.diagnosticStr != nextprops.diagnosticStr) {
+        this.props.getBilling();
+      }
+      if(deepClone(nextprops.wholeResults)!=deepClone(this.props.wholeResults)){
+          this.setState({
+            radioVal:Object.assign({},nextprops.wholeResults.radioVal),
+            possible:Object.assign({},nextprops.wholeResults.possible),
+          })
+      }
+    }
     render(){
-        const { list, treatment, showReferRecord, showHistoryCase } = this.props
-        const { visible, treatTitle } = this.state
-        const lastIndex = list.length -1;
+        const { list, treatment, showReferRecord, showHistoryCase ,saveAssessInfos} = this.props;
+        const { visible, treatTitle ,showAssess, isAssessConfirm, radioVal, possible} = this.state;
+        const chronicList = JSON.parse(localStorage.getItem('chronic')||null);
+        let isChronic = false;      //是否要显示管理评估
+        const footer = <div className={style['footer']}>
+          <span className={style['print']} onClick={this.onPrint}><img src={printIcon} alt=""/>打印</span>
+          <span className={style['okBtn']} onClick={()=>this.handleSaveAssess()}>确定</span>
+        </div>;
         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)
-                           || (item.drugHistory && item.drugHistory['慢病用药内容'] &&  item.drugHistory['慢病用药内容'].length > 0) || (item.drugHistory &&item.drugHistory['普通病用药内容'] &&  item.drugHistory['普通病用药内容'].length > 0) ||item.follow) 
-                        // const hasTreat= true;
+                           || (item.drugHistory && item.drugHistory['慢病用药内容'] &&  item.drugHistory['慢病用药内容'].length > 0) || (item.drugHistory &&item.drugHistory['普通病用药内容'] &&  item.drugHistory['普通病用药内容'].length > 0) ||item.follow)
+                        isChronic = item.type==2&&chronicList.findIndex((it)=>it.id==item.id)!=-1;
                         return (<div draggable={true} className={style['diag-box'] + ' clearfix'}  key={item.id} >
                                     {index === 0 ? '' : <span className={style['diag-up']} onClick={() => {this.upDiagnostic(index)}}><img className={style["diag-up"]} src={diagUp}/></span>}
                                     {list.length === 1 ? '' : index !== 0 ? '' : <span onClick={() => {this.downDiagnostic(index)}} className={style['diag-down']}><img className={style["diag-down"]} src={diagDown}/></span>}
@@ -197,15 +248,34 @@ class DiagnosticList extends Component {
                                     <span className={style['diag-name']} onClick={()=>{this.handleClickDiag(item)}}>{item.name}<span></span></span> 
                                     {item.type === 1 ? <span className={style['diag-first']}>初诊</span> :<span className={style['diag-second']}> 复诊</span>}
                                     <span className={style['treat']}
-                                        //   style ={{ color: hasTreat ?'' : 'gray', border: hasTreat ?'1px solid #3B9ED0' : '1px solid gray', cursor: hasTreat ? '' : 'text'}}
-                                          style ={hasTreat ? '' : { color: 'gray', border: '1px solid gray', cursor: 'text'}}
+                                          style ={hasTreat ? '' : { color: 'gray', cursor: 'text'}}
                                           onClick={() =>{hasTreat && this.showTreat(item, index)}}>
                                           治疗方案
                                     </span>
+                                    {isChronic?<span className={style['assess']}
+                                          onClick={this.showAssessFn.bind(this,item.id)}>
+                                        管理评估
+                                    </span>:''}
                                     <img className={style['diag-del']} src={del_icon} onClick={()=>{this.handleDeleteItem(item)}}/>
                         </div>)
                     })}
                      {treatment&&<Treat title={treatTitle}></Treat>}
+                     {showAssess?<ComplexModal onclose={this.showAssessFn.bind(this)} footer={footer}
+                                               title='管理和评估'
+                                               icon={manageIcon}
+                                               top={'3%'}
+                                               bottom={'3%'}
+                                               width={820}>
+                       <AssessResult handleSave={saveAssessInfos}
+                                     handleSavePossible={this.handleSavePossible}
+                                     closeAssess={this.showAssessFn.bind(this)}
+                                     showScaleFn={this.showTable.bind(this)}
+                                     showListScale={this.handleListClick.bind(this)}
+                                     radioVal={radioVal}
+                                     possible={possible}
+                                     isAssessConfirm={isAssessConfirm}
+                                     ></AssessResult>
+                      </ComplexModal>:''}
                     <ConfirmModal visible={visible} 
                                   okText='删除' 
                                   cancelText='取消' 

+ 39 - 3
src/components/DiagnosticList/index.less

@@ -81,11 +81,47 @@
     position: absolute;
     right: 40px;
     top: 11px;
-    border: 1px solid #3B9ED0;
-    border-radius: 4px;
     cursor: pointer;
 }
-
+.footer{
+    .print{
+        width: 111px;
+        height: 34px;
+        line-height: 34px;
+        outline: none;
+        border-radius: 4px;
+        /*color: #3B9ED0;*/
+        border: 0 none;
+        cursor: pointer;
+        background: #fff;
+        margin-right: 20px;
+        img{
+            width: 20px;
+            vertical-align: middle;
+            margin-right: 4px;
+        }
+    }
+    .okBtn{
+        width: 80px;
+        height: 34px;
+        line-height: 32px;
+        text-align: center;
+        outline: none;
+        border-radius: 4px;
+        cursor: pointer;
+        border: 1px solid #3B9ED0;
+        box-sizing: border-box;
+        margin-left: 20px;
+        background: #3B9ED0;
+        color: #fff;
+        float: right;
+        margin-right: 20px;
+    }
+}
+.assess{
+    .treat;
+    right: 106px;
+}
 .diag-del {
     position: absolute;
     right: 0;

+ 7 - 3
src/containers/ChronicInfo.js

@@ -91,15 +91,19 @@ function mapDispatchToProps(dispatch){
       });
     },
     // 计算公式计算
-    calcuFormula(item) {
-      const {param} = item;
+    calcuFormula(param) {
       getFormulaResult(param).then((res)=>{
         if(+res.data.code==0){
           const result = res.data.data.result;
           dispatch({
             type: SET_CHRONIC_CALCU_RESULT,
             result:deepClone(result),
-            id:item.param.disId
+            id:param.disId
+          });
+          dispatch({
+            type:SET_CALCU_VALUES,
+            data:param.data.content.details,
+            id:param.disId
           })
         }else{
           Notify.error(res.data.msg||'计算没有结果返回');

+ 16 - 2
src/containers/DiagnosticList.js

@@ -11,9 +11,12 @@ import {CURRENT_CHRONIC} from '@store/types/currentIll';
 import {autoFillModules} from '@store/async-actions/fetchModules';
 import { initItemList } from '@store/async-actions/historyTemplates';
 import {MODI_LOADING} from '@store/types/homePage.js';
+import {saveMessage} from "../store/async-actions/print";
+import {SET_SAVE_ASSESS_DATA} from "@types/assessResult";
+import {saveClickNum} from '@store/async-actions/homePage';
 
 function mapStateToProps(state) {
-    const {diagnosticList} = state;
+    const {diagnosticList,assessResult} = state;
     let diagnC = diagnosticList.chronicMagItem;
     return {
         list: diagnosticList.diagnosticList,
@@ -25,6 +28,7 @@ function mapStateToProps(state) {
         items:state.historyTemplates.items,
         chronicMagItem: diagnC&&diagnC.name?diagnC:state.mainSuit.chronicDesease,
         typeConfig: state.typeConfig.typeConfig,
+        wholeResults:assessResult.wholeResults,
     }
 }
 
@@ -109,7 +113,17 @@ function mapDispatchToProps(dispatch) {
         },
         autoFillModules(){
             dispatch(autoFillModules())//自动分发模板
-        },  
+        },
+        //保存管理评估
+        saveAssessInfos(obj,flg,noSave){     //noSave未true则不调页面保存接口
+          dispatch(Object.assign({},obj,{type:SET_SAVE_ASSESS_DATA}));
+          if(!noSave){
+            dispatch(saveClickNum);
+            if(flg != 1 && flg != 2){
+              dispatch(() => saveMessage())
+            }
+          }
+        },
     }
 }
 

+ 1 - 0
src/store/reducers/assessResult.js

@@ -61,6 +61,7 @@ export default (state=init,action)=>{
       res.wholeAssessText = action.wholeAssessText||'';
       res.chooseSelecteds = action.chooseSelecteds||{};
       res.calcuResult = action.calcuResult||{};
+      res.calcuValues = action.calcuValues||{};
       return res;
     //case CLEAR_ASSESS_DATA:
     case ADD_ASSESS_ITEMS: