Luolei 6 سال پیش
والد
کامیت
f22894ff6c

+ 2 - 2
src/components/Advice/index.jsx

@@ -66,7 +66,7 @@ class Advice extends Component{
 
   render(){
     const {advice} = this.props.pushMessage;
-    const {isRead, isFirstMainDiag, followUp, hasFollowUp, setFollowUp} = this.props
+    const {isRead, isFirstMainDiag, followUp, hasFollowUp, saveFollowUp} = this.props
     let scheme = advice.scheme && advice.scheme.map((item, index) => {
       return <p>{item.treatment.map((it,ii) =>{
         return(it.treatmentStr && it.treatmentStr.length > 0 ? 
@@ -93,7 +93,7 @@ class Advice extends Component{
             {/* {advice.commontreatment && <div className={style['treat-input']}  onInput={this.handleComTreatInput}  contentEditable={true} style = {{outline: 'none'}}></div>} */}
             {<Textarea value={advice.commontreatment} isRead={isRead} handleChangeAssistValue={this.handleComTreatInput} ></Textarea>}
         </div>}
-        {!isFirstMainDiag && <FollowUp  noTitle="true"   setFollowUp={setFollowUp} followUp = {followUp} isRead={isRead}></FollowUp>}
+        {!isFirstMainDiag && <FollowUp  noTitle="true"   setFollowUp={saveFollowUp} followUp = {followUp} isRead={isRead}></FollowUp>}
         {advice.scheme && advice.scheme.length > 0 &&<div contentEditable='false' className={style['scheme']}>
           {advice.scheme && advice.scheme.length > 0  && <h1>治疗方案</h1>}
           {scheme}

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

@@ -177,7 +177,7 @@ class ScaleItem extends Component {
           <span>{item.name}:</span>
           <div className={style['row']}>{temp}</div>
           <div className={style["recommend"]} onClick={()=>this.props.handleRemove(i,j)}>
-            <img src={deleteIcon} />
+            <img className={style["deleteIcon"]} src={deleteIcon} />
           </div>
         </li>);
       }
@@ -186,7 +186,7 @@ class ScaleItem extends Component {
   }
   getItems(){
     const { data } = this.props;
-    return data.map((it,i)=>{
+    return data&&data.map((it,i)=>{
       return this.getDetailItems(it,i);
     });
   }

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

@@ -5,6 +5,8 @@ import ChooseItem from "./ChooseItem";
 import ScaleItem from "./ScaleItem";
 import Information from '../Information'
 import ChartItem from "./ChartItem";
+import Notify from '@commonComp/Notify';
+import {readyKeepHistory} from '@utils/tools';
 
 class AssessResult extends Component {
   constructor(props) {
@@ -54,7 +56,12 @@ class AssessResult extends Component {
     //点确定关闭弹窗时把参数传到父组件去
     const {handleSave,isAssessConfirm,clearChartData} = this.props;
     clearChartData&&clearChartData();
-    isAssessConfirm&&handleSave(this.state);
+    if(isAssessConfirm && readyKeepHistory() == 1){
+      Notify.error("主诉不能为空");
+    }else if(isAssessConfirm && readyKeepHistory() == 2){
+      Notify.info('诊断不能为空');
+    }
+    isAssessConfirm&&handleSave(this.state,readyKeepHistory());
   }
   handoutTypes(item,i){
     const {getIndexData,indexData,timeTypes,wholeAssessData,scaleInfo,getScaleInfo,possible,radioVal} =this.props;

+ 3 - 0
src/components/AssessResult/index.less

@@ -150,4 +150,7 @@
   .printShow {
     display: block;
   }
+  .deleteIcon {
+    display: none;
+  }
 }

+ 79 - 15
src/components/ChronicInfo/index.jsx

@@ -13,6 +13,7 @@ import checkIcon from '@common/images/check.png';
 import {ComplexModal,ConfirmModal,MiniToast, Radio,CheckBtn} from '@commonComp';
 import AssessResult from '@containers/AssessResult';
 import ScaleTable from '@containers/ScaleTable';
+import Notify from '@commonComp/Notify';
 import $ from 'jquery';
 
 /***
@@ -41,6 +42,7 @@ class ChronicInfo extends React.Component{
       parentIndex:null,
       radioVal:{},  //可能结果选择内容
       possible:{},  //可能结果
+      formulaParam: {}, //量表计算公式计算入参
     };
 
     this.showInfo = this.showInfo.bind(this);
@@ -126,7 +128,7 @@ class ChronicInfo extends React.Component{
     }else{
       this.props.getScaleInfo(item);
     }
-    
+
     this.setState({
       tableName:it.name,
       tableId:it.id,
@@ -150,7 +152,7 @@ class ChronicInfo extends React.Component{
       isAssessConfirm:false
     });
   }
-  
+
   showFormula(id){//计算公式
     this.setState({
       formulaId:id,
@@ -174,10 +176,29 @@ class ChronicInfo extends React.Component{
     setTimeout(()=>{
       that.showAssessFn();
     });
-
   }
-  handleForRadio(item,parent,pIndex){//计算公式
-
+  handleInputformula(v,i, j,idd,  e) {
+    const { data, setChronicPush } = this.props
+    const text = e.target.value
+    if (data[i].details) {
+      data[i].details[j].content.details[idd].value = text
+    } 
+    
+    const data1 = JSON.parse(JSON.stringify(data))
+    setChronicPush(data1)
+  }
+  handleForRadio(ii,v,i, j,idd, ind){//计算公式
+    const { data, setChronicPush } = this.props
+    
+    if (data[i].details) {
+      for(let z = 0; z <  data[i].details[j].content.details[idd].details.length; z++) {
+        data[i].details[j].content.details[idd].details[z].state = 0
+      }
+      data[i].details[j].content.details[idd].details[ind].state = 1
+    } 
+    
+    const data1 = JSON.parse(JSON.stringify(data))
+    setChronicPush(data1)
   }
   confirmFormula(){//计算公式确定
 
@@ -197,6 +218,38 @@ class ChronicInfo extends React.Component{
     })
     
   }
+  calcuFormula(it, j, v) { //计算公式计算
+    const { calcuFormula } = this.props
+    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
+        }
+      } 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
+          }
+        }
+        if(!hasSelect) {
+          allHasInfo = false
+        }
+      }
+
+    }
+    if(allHasInfo) { //所有都有值,则计算
+      let param = {
+        type: 2,
+        content: it,
+        disId: v.id
+      }
+      calcuFormula(param)
+    } else {  //不是所有值都填过了
+      Notify.info('请填写计算公式内容')
+    }
+  }
   getDetail(){
     const {data,indexs,scaleInfo,formulaResult} = this.props;
     const {showInfo,showOption,infoId,formulaId,optionId,possible,radioVal} = this.state;
@@ -253,7 +306,7 @@ class ChronicInfo extends React.Component{
                                 footer="true">
                                 <table>
                                 {it.content.details.map((item,idd)=>{
-                                    if(item.controlType==0){//单选
+                                    if(item.controlType==1){//单选
                                       return <tr>
                                         <td>
                                           <span>{'请选择'+item.name+':'}</span>
@@ -262,8 +315,8 @@ class ChronicInfo extends React.Component{
                                           {item.details.map((ii,ind)=>{
                                             return <div className={style["chooseItem"]}>
                                                     <Radio label={ii.detailName}
-                                                             isSelect={radioVal[i]==ii.detailName}
-                                                             handleClick={this.handleForRadio.bind(this,ii,v,i)}>
+                                                             isSelect={ii.state == 1}
+                                                             handleClick={this.handleForRadio.bind(this,ii,v,i, j,idd, ind)}>
                                                       </Radio>
                                                   </div>
                                           })}
@@ -277,7 +330,7 @@ class ChronicInfo extends React.Component{
                                           <span>{'请输入'+item.name+':'}</span>
                                         </td>
                                         <td>
-                                          <input type="text" placeholder="请输入" value={item.value}/>
+                                          <input type="text" placeholder="请输入"  value={item.value} onInput={this.handleInputformula.bind(this,v,i, j,idd)}/>
                                         </td>
                                         <td>
                                           <span>{item.uint}</span>
@@ -293,7 +346,8 @@ class ChronicInfo extends React.Component{
                                           {item.details.map((ii,ind)=>{
                                             return <div className={style["chooseItem"]}>
                                                     <Radio label={ii.detailName}
-                                                            isSelect={radioVal[i]==ii.detailName}
+                                                            // isSelect={radioVal[i]==ii.detailName}
+                                                            isSelect={ii.state == 1}
                                                             handleClick={this.handleForRadio.bind(this,ii,v,i)}>
                                                     </Radio>
                                                   </div>
@@ -304,7 +358,20 @@ class ChronicInfo extends React.Component{
                                     }
                                 })}
                                 </table>
-                                <div className={style["forMulBtn"]}>计算</div>
+                                <div className={style["forMulBtn"]} onClick={this.calcuFormula.bind(this,it,j, v)}>计算</div>
+                                <table>
+                                  {/* {it.content.result &&it.content.result.map((itemResult, resultIndex) => {
+                                    return <tr>
+                                        <td>
+                                            <span>{itemResult.name+':'}</span>
+                                        </td>
+                                        <td>
+                                            <span>{itemResult.value}</span>
+                                        </td>
+                                    </tr>
+                                  })} */}
+                                </table>
+                                
                             </MiniToast>
                           </div>
                         }else if(it.type==3){
@@ -349,10 +416,7 @@ class ChronicInfo extends React.Component{
   }
 
   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 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>

+ 2 - 1
src/components/ChronicInfo/index.less

@@ -265,7 +265,8 @@
     line-height: 32px;
     text-align: center;
     color: #fff;
-    background: #DBDBDB;
+    // background: #DBDBDB;
+    background: #DFEAFE;
     border-radius: 4px;
     cursor: auto;
     margin-top: 15px;

+ 9 - 17
src/components/Operation/index.jsx

@@ -8,7 +8,7 @@ import PreviewContainer from '@containers/PreviewContainer';
 import { ConfirmModal, Notify } from '@commonComp';
 import check_circle from './img/check-circle.png';
 import check_right from './img/check-right.png';
-import {getAllDataList,getAllDataStringList,isAllClear,filterDataArr} from '@utils/tools';
+import {getAllDataList,getAllDataStringList,isAllClear,filterDataArr,readyKeepHistory} from '@utils/tools';
 import store from '@store';
 import $ from 'jquery';
 
@@ -67,8 +67,14 @@ class Operation extends Component {
   }
 
   saveAll(type) {
-    let flg = this.keepHistory();
-    if(flg){
+    let keepState = readyKeepHistory();
+    if(keepState == 1){
+        Notify.info('主诉不能为空');
+        return;
+    }else if(keepState == 2){
+        Notify.info('诊断不能为空');
+        return;
+    }else{
       this.setState({
         type: type,
         okText: '保存',
@@ -81,20 +87,6 @@ class Operation extends Component {
       this.props.diagShowTmp(true)
     }
   }
-  keepHistory(){
-    let baseList = store.getState();
-    let jsonStr = getAllDataStringList(baseList);
-    // console.log(jsonStr)
-    if(filterDataArr(JSON.parse(jsonStr.chief)) == ''){
-        Notify.info('主诉不能为空');
-        return false;
-    }else if(!jsonStr.diag || jsonStr.diag.trim().length < 1){
-        Notify.info('诊断不能为空');
-        return false;
-    }else{
-      return true;
-    }
-  }
   clearAll(type) {
     let baseList = store.getState();
     let jsonData = getAllDataList(baseList);

+ 0 - 12
src/components/PrintPreview/index.jsx

@@ -11,18 +11,6 @@ class PrintPreview extends Component {
     constructor(props) {
         super(props)
     }
-    surePrint(jsonStr){
-        if(filterDataArr(JSON.parse(jsonStr.chief)) == ''){
-          Notify.info('主诉不能为空');
-            return false;
-        }else if(!jsonStr.diag || jsonStr.diag.trim().length < 1){
-            Notify.info('诊断不能为空');
-            return false;
-        }else{
-            this.onPrint();
-            this.props.save(true)
-        }
-    }
     render() {
         const { onClose, visible, preInfo,save } = this.props;
         let baseList = store.getState();

+ 3 - 4
src/containers/AdviceContainer.js

@@ -1,8 +1,7 @@
 import React from 'react';
 import {connect} from 'react-redux';
 import Advice from '../components/Advice'
-import { SET_CHANGE_ADVICE_TREATMENT, SET_CHANGE_ADVICE_ASSAY, SET_CHANGE_ADVICE_CHECK, SET_COMMONTREATMENT ,SET_ADVICE_INPUT} from '@store/types/pushMessage';
-import { SET_FOLLOW_UP } from '@store/types/treat.js';
+import { SET_CHANGE_ADVICE_TREATMENT, SET_CHANGE_ADVICE_ASSAY, SET_CHANGE_ADVICE_CHECK, SET_COMMONTREATMENT ,SET_ADVICE_INPUT, SAVE_FOLLOW_UP} from '@store/types/pushMessage';
 
 function mapStateToProps(state) {
     return ({
@@ -49,9 +48,9 @@ function mapDispatchToProps(dispatch) {
                 adviceInput: text,
             })
         },
-        setFollowUp: (followUp) => {
+        saveFollowUp: (followUp) => {
             dispatch({
-                type: SET_FOLLOW_UP,
+                type: SAVE_FOLLOW_UP,
                 followUp: followUp
             })
         },

+ 17 - 3
src/containers/ChronicInfo.js

@@ -1,10 +1,11 @@
 import {connect} from 'react-redux';
 import ChronicInfo from '../components/ChronicInfo';
-import {SHOW_TABLE_LIST} from '@store/types/pushMessage';
+import {SHOW_TABLE_LIST,HIDE_TABLE_LIST, SET_CHRONIC_PUSHS} 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";
 import {saveClickNum} from '@store/async-actions/homePage';
+import { getFormulaResult } from '@store/async-actions/fetchModules'
 
 function mapStateToProps(state){
   return{
@@ -46,10 +47,23 @@ function mapDispatchToProps(dispatch){
       })
     },
     //保存管理评估
-    saveAssessInfos(obj){
+    saveAssessInfos(obj,flg){
       dispatch(Object.assign({},obj,{type:SET_SAVE_ASSESS_DATA}));
       dispatch(saveClickNum);
-      dispatch(() => saveMessage())
+      if(flg != 1 && flg != 2){
+        dispatch(() => saveMessage())
+      }
+    },
+    //设置量表推送内容
+    setChronicPush(data) {
+      dispatch({
+        type: SET_CHRONIC_PUSHS,
+        data: data
+      })
+    },
+    // 计算公式计算
+    calcuFormula(item) {
+      dispatch(getFormulaResult(item))
     },
     // 获取量表静态知识
     getInfomation(item){

+ 1 - 1
src/store/async-actions/print.js

@@ -22,7 +22,7 @@ export const saveMessage = (bool) => {
       htmlContent:JSON.stringify(getEvaluations(baseList.assessResult)),
       //scaleList:[]
     };//getEvaluation();
-    console.log(baseList)
+    //console.log(baseList)
     // console.log(jsonStr.diag,'保存历史病历')
     json('/inquiryInfo/saveInquiry', {
         "doctorId": state.doctorId,

+ 13 - 1
src/utils/tools.js

@@ -908,6 +908,17 @@ function inspectAndAssist(){
     store.dispatch(addAssistLabel(checkArr))
   }
 }
+function readyKeepHistory(){
+  let baseList = store.getState();
+  let jsonStr = getAllDataStringList(baseList);
+  if(filterDataArr(JSON.parse(jsonStr.chief)) == ''){
+      return 1;//主诉不能为空
+  }else if(!jsonStr.diag || jsonStr.diag.trim().length < 1){
+      return 2;//诊断不能为空
+  }else{
+    return 3;
+  }
+}
 module.exports = {
     checkType: Type.checkType,
     regexp,
@@ -941,5 +952,6 @@ module.exports = {
     formatContinueDots,
     inspectAndAssist,
     getCurrentDate,
-    ifOtherClear
+    ifOtherClear,
+    readyKeepHistory,
 };