luolei 4 years ago
parent
commit
c87d6acae2

+ 12 - 20
src/components/PatInfo/index.jsx

@@ -10,7 +10,6 @@ class PatInfo extends Component {
     super(props)
     super(props)
     this.state = {
     this.state = {
       show:false,
       show:false,
-      cover:true,
       name:'',
       name:'',
       sex:'',
       sex:'',
       age:'',
       age:'',
@@ -35,12 +34,6 @@ class PatInfo extends Component {
       }
       }
     });
     });
   }
   }
-  componentWillReceiveProps(nextProps){
-    const {patientName,sex,patientAge} = nextProps.patInfo.message;
-    if(!patientName&&!sex&&!patientAge){
-      this.setState({cover:true})
-    }
-  }
   handleName(e){
   handleName(e){
     let value = e.target.value
     let value = e.target.value
     const { setParams } = this.props;
     const { setParams } = this.props;
@@ -66,8 +59,6 @@ class PatInfo extends Component {
     this.checkValue(value.trim())
     this.checkValue(value.trim())
     const { setParams } = this.props;
     const { setParams } = this.props;
     setParams({patientAge:value.trim()})
     setParams({patientAge:value.trim()})
-
-
     this.setState({
     this.setState({
       age:value.trim()
       age:value.trim()
     },()=>{
     },()=>{
@@ -78,7 +69,8 @@ class PatInfo extends Component {
     const { setParams } = this.props;
     const { setParams } = this.props;
     setParams({sex:value,patientSex:value==1?'男':value==2?'女':''})
     setParams({sex:value,patientSex:value==1?'男':value==2?'女':''})
     this.setState({
     this.setState({
-      show:false,sex:value
+      show:false,
+      sex:value
     },()=>{
     },()=>{
       this.watchData()
       this.watchData()
     })
     })
@@ -88,10 +80,10 @@ class PatInfo extends Component {
     this.setState({show:!show})
     this.setState({show:!show})
   }
   }
   watchData(){
   watchData(){
-    const {name,age,sex} = this.state
-    const {handlePush,getInitModule} = this.props
-    let allow = this.checkValue(age)
-    if(name&&sex&&age&&allow){
+    const {handlePush,getInitModule,changeCover,patInfo} = this.props
+    const {patientName,sex,patientAge} = patInfo.message
+    let allow = this.checkValue(patientAge)
+    if(patientName&&sex&&patientAge&&allow){
       let stimer = this.state.timer
       let stimer = this.state.timer
       clearTimeout(stimer);
       clearTimeout(stimer);
       let timer = setTimeout(function(){
       let timer = setTimeout(function(){
@@ -101,10 +93,10 @@ class PatInfo extends Component {
       this.setState({
       this.setState({
         timer
         timer
       });
       });
-      this.setState({cover:false})
+      changeCover(false)
       getInitModule()
       getInitModule()
     }else{
     }else{
-      this.setState({cover:true})
+      changeCover(true)
     }
     }
   }
   }
   checkMsg(){
   checkMsg(){
@@ -123,8 +115,8 @@ class PatInfo extends Component {
     }
     }
   }
   }
   render(){
   render(){
-    const {message} = this.props.patInfo;
-    const {show,cover,reg} = this.state;
+    const {message,cover} = this.props.patInfo;
+    const {show,reg} = this.state;
      return <table className={style["table"]}>
      return <table className={style["table"]}>
       {/* <tr>
       {/* <tr>
         <td key='1' className={`${style.tdBorderB} ${style.tdBorderR}`} title={'卡号:' + (message.patientIdNo||'')}>卡号:{message.patientIdNo}</td>
         <td key='1' className={`${style.tdBorderB} ${style.tdBorderR}`} title={'卡号:' + (message.patientIdNo||'')}>卡号:{message.patientIdNo}</td>
@@ -141,11 +133,11 @@ class PatInfo extends Component {
       <tr>
       <tr>
         <td key='1' className={`${style.tdBorderB} ${style.tdBorderR} ${style.tdBorderOne}`}>
         <td key='1' className={`${style.tdBorderB} ${style.tdBorderR} ${style.tdBorderOne}`}>
           <span className={style['title']}>姓名:</span>
           <span className={style['title']}>姓名:</span>
-          <input type="text" placeholder="请输入" className={style['name']} onChange={(e)=>this.handleName(e)} value={message.patientName}/>
+          <input type="text" placeholder="请输入" className={style['name']} onInput={(e)=>this.handleName(e)} value={message.patientName}/>
         </td>
         </td>
         <td key='3' className={`${style.tdBorderB} ${style.tdBorderR} ${style.tdBorderTwo}`}>
         <td key='3' className={`${style.tdBorderB} ${style.tdBorderR} ${style.tdBorderTwo}`}>
           <span className={style['title']}>年龄:</span>
           <span className={style['title']}>年龄:</span>
-          <input type="text" className={style['age']} style={{"borderColor":reg?'#FF545B':'#E6E6E6'}} placeholder="请输入" onChange={(e)=>this.handleAge(e)} value={message.patientAge}/>
+          <input type="text" className={style['age']} style={{"borderColor":reg?'#FF545B':'#E6E6E6'}} placeholder="请输入" onInput={(e)=>this.handleAge(e)} value={message.patientAge}/>
           <i style={{color:reg?'#FF545B':'#999999',display:reg?'block':'none'}}>* 请输入1-150以内的整数</i>
           <i style={{color:reg?'#FF545B':'#999999',display:reg?'block':'none'}}>* 请输入1-150以内的整数</i>
         </td>
         </td>
         <td key='2' className={`${style.tdBorderB} ${style.tdBorderR} ${style.tdBorderThree}`}>
         <td key='2' className={`${style.tdBorderB} ${style.tdBorderR} ${style.tdBorderThree}`}>

+ 7 - 1
src/containers/PatInfoContainer.js

@@ -2,7 +2,7 @@ import React from 'react';
 import {connect} from 'react-redux';
 import {connect} from 'react-redux';
 import {getInitModules} from '@store/async-actions/homePage.js';
 import {getInitModules} from '@store/async-actions/homePage.js';
 import {initPersonInfo} from '../store/async-actions/patInfo';
 import {initPersonInfo} from '../store/async-actions/patInfo';
-import {SET_PARAMS} from '@store/types/patInfo.js';
+import {SET_PARAMS,CHANGECOVER} from '@store/types/patInfo.js';
 import PatInfo from '../components/PatInfo';
 import PatInfo from '../components/PatInfo';
 import {billing} from '@store/async-actions/pushMessage';
 import {billing} from '@store/async-actions/pushMessage';
 
 
@@ -26,6 +26,12 @@ function mapDispatchToProps(dispatch) {
         },
         },
         getInitModule:()=>{
         getInitModule:()=>{
             dispatch(getInitModules)
             dispatch(getInitModules)
+        },
+        changeCover:(flg)=>{
+            dispatch({
+                type:CHANGECOVER,
+                flg
+            })
         }
         }
 
 
     }
     }

+ 5 - 0
src/store/actions/patInfo.js

@@ -71,4 +71,9 @@ export const clearMsg=(state,action)=>{
   res.message = tmpObj;
   res.message = tmpObj;
   return res;
   return res;
 
 
+}
+export const changeCover=(state,action)=>{
+  const res=Object.assign({},state);
+  res.cover = action.flg;
+  return res;
 }
 }

+ 6 - 3
src/store/reducers/patInfo.js

@@ -1,5 +1,5 @@
-import {GET_PATIENT_MESSAGE,GET_HOSPITAL_MESSAGE,SET_PARAMS,CLEARMSG} from '../types/patInfo';
-import {updatePatientMessage,updateHospitalMessage,setParams,clearMsg} from '../actions/patInfo';
+import {GET_PATIENT_MESSAGE,GET_HOSPITAL_MESSAGE,SET_PARAMS,CLEARMSG,CHANGECOVER} from '../types/patInfo';
+import {updatePatientMessage,updateHospitalMessage,setParams,clearMsg,changeCover} from '../actions/patInfo';
 // age: 28
 // age: 28
 // mouduleType: 1
 // mouduleType: 1
 // relationId: 420671
 // relationId: 420671
@@ -32,7 +32,8 @@ const initState = {
       recordId: "",
       recordId: "",
       systemTime: "",
       systemTime: "",
     },
     },
-    hospitalMsg:{}
+    hospitalMsg:{},
+    cover:true
 };
 };
 export default function(state = initState,action){
 export default function(state = initState,action){
   switch(action.type){
   switch(action.type){
@@ -44,6 +45,8 @@ export default function(state = initState,action){
       return setParams(state,action);
       return setParams(state,action);
     case CLEARMSG:
     case CLEARMSG:
       return clearMsg(state,action);
       return clearMsg(state,action);
+    case CHANGECOVER:
+      return changeCover(state,action);
     default:
     default:
       return state;
       return state;
   }
   }

+ 2 - 1
src/store/types/patInfo.js

@@ -1,4 +1,5 @@
 export const GET_PATIENT_MESSAGE = 'GET_PATIENT_MESSAGE'
 export const GET_PATIENT_MESSAGE = 'GET_PATIENT_MESSAGE'
 export const GET_HOSPITAL_MESSAGE = 'GET_HOSPITAL_MESSAGE'
 export const GET_HOSPITAL_MESSAGE = 'GET_HOSPITAL_MESSAGE'
 export const SET_PARAMS = 'SET_PARAMS'
 export const SET_PARAMS = 'SET_PARAMS'
-export const CLEARMSG = 'CLEARMSG'
+export const CLEARMSG = 'CLEARMSG'
+export const CHANGECOVER = 'CHANGECOVER'

+ 5 - 1
src/utils/tools.js

@@ -11,7 +11,7 @@ import {ISREAD, SETREADDITEMS,SET_SELECTED_AREA,SET_CURRENT_MODULE} from "../sto
 import {CLEAR_FIRST_MAIN_DIAG, CLEAR_ALL_TREAT} from "../store/types/treat";
 import {CLEAR_FIRST_MAIN_DIAG, CLEAR_ALL_TREAT} from "../store/types/treat";
 import {tabChange} from '@store/actions/tabTemplate';
 import {tabChange} from '@store/actions/tabTemplate';
 import {CLEAR_ASSESS_RESULT_VALUE} from '@types/assessResult';
 import {CLEAR_ASSESS_RESULT_VALUE} from '@types/assessResult';
-import {CLEARMSG} from '@types/patInfo';
+import {CLEARMSG,CHANGECOVER} from '@types/patInfo';
 import { SET_READ_MODE } from "@store/types/typeConfig";
 import { SET_READ_MODE } from "@store/types/typeConfig";
 import config from '@config/index';
 import config from '@config/index';
 import up from '@images/up.png';
 import up from '@images/up.png';
@@ -225,6 +225,10 @@ const pushAllDataList =(whichSign,action,reData,type) =>{           //回读清
           type: SET_MR_ANALYSE,
           type: SET_MR_ANALYSE,
           MRAnalyseResult: []
           MRAnalyseResult: []
         })
         })
+        store.dispatch({
+            type:CHANGECOVER,
+            flg:true
+        })
         storageLocal.remove('emrParam');
         storageLocal.remove('emrParam');
         document.getElementById('addScrollEvent').scrollIntoView()
         document.getElementById('addScrollEvent').scrollIntoView()
        // Notify.success('页面已清空')
        // Notify.success('页面已清空')