浏览代码

慢病、文本模式处理

zhouna 5 年之前
父节点
当前提交
3b5fc15022

+ 24 - 7
src/common/components/Textarea/index.jsx

@@ -11,7 +11,8 @@ class Textarea extends Component {
     this.state = {
       timer:null,
       inpText:'',
-      overFlag:false
+      overFlag:false,
+      editable:true,
     };
     this.$dom = React.createRef();
     this.handleInput = this.handleInput.bind(this);
@@ -19,8 +20,20 @@ class Textarea extends Component {
     //this.handleBlur = this.handleBlur.bind(this);
     this.handleKeydown = this.handleKeydown.bind(this);
   }
-  handleFocus(){            //初始显示props中的值,focus已经显示输入的值,避免值更新闪烁
-    const {handleFocus,fuzhen,handleInput,isChronic} = this.props;
+  handleFocus(e){            //初始显示props中的值,focus已经显示输入的值,避免值更新闪烁
+    const {handleFocus,fuzhen,handleInput,isChronic,hasMain,boxMark} = this.props;
+    if(boxMark!='1'&&!hasMain){
+      this.setState({
+        editable:false
+      });
+      e.target.blur();
+      Notify.error("无法操作,请先输入主诉");
+      return;
+    }else{
+      this.setState({
+        editable:true
+      });
+    }
     handleFocus&&handleFocus();         //其他史、查体获取数据的方法
     if(fuzhen&& !isChronic&&!(this.$dom.current.innerText?this.$dom.current.innerText:this.$dom.current.innerHTML)){
       const text = config.currentText.replace("(**)",fuzhen.replace(";",''));
@@ -30,10 +43,14 @@ class Textarea extends Component {
 
   }
   handleInput(e){
-    const {handleInput,boxMark,handlePush,hasMain} = this.props;
-    const {inpText,overFlag} = this.state;
+    const {handleInput,boxMark,handlePush} = this.props;
+    const {inpText,overFlag,editable} = this.state;
     const text = e.target.innerText || e.target.innerHTML;
     const stimer = this.state.timer;
+    if(!editable){
+      e.target.innerText='';
+      return ;
+    }
     if(boxMark=='1'&&text.length>config.limited){           //主诉字符数限制
       e.target.innerText?(e.target.innerText = text.substr(0,config.limited)):(e.target.innerHTML = text.substr(0,config.limited));
       e.target.blur();
@@ -72,7 +89,7 @@ class Textarea extends Component {
   handleKeydown(e){
     const {boxMark} = this.props;
     const ev = e||window.event;
-    if(+boxMark==1){
+    if(+boxMark===1){
       //禁止回车事件
       if(ev.keyCode==13){return false;}
     }
@@ -111,7 +128,7 @@ class Textarea extends Component {
              ref={this.$dom}
              contentEditable={true}
              onInput={this.handleInput}
-             onkeydown={this.handleKeydown}>
+             onKeyDown={this.handleKeydown}>
         </div>
       </div>
     );

+ 2 - 1
src/components/CurrentIll/index.jsx

@@ -116,7 +116,7 @@ class CurrentIll extends Component{
   }
 
   render(){
-    const {readMode,fuzhen,isChronic,type,fetchPushInfos,handleInput,isRead,saveText,searchData,totalHide,editClear,data} = this.props;
+    const {hasMain,readMode,fuzhen,isChronic,type,fetchPushInfos,handleInput,isRead,saveText,searchData,totalHide,editClear,data} = this.props;
     const {forbidInput,boxLeft,boxTop} = this.state;
     const searchFlag = searchData.length > 0 ? true : false;
     const mode = readMode===-1?type:readMode;
@@ -125,6 +125,7 @@ class CurrentIll extends Component{
                         isRead={isRead}
                         value={saveText[0]}
                         fuzhen={fuzhen}
+                        hasMain={hasMain}
                         isChronic={isChronic}
                         handlePush={fetchPushInfos}
                         handleInput={handleInput}/>;

+ 13 - 24
src/components/DiagnosticList/index.jsx

@@ -108,40 +108,35 @@ class DiagnosticList extends Component {
         getTips && getTips({id:item.conceptId, type:7, name: item.name, position: 1});
     }
     referRecord() {
-        const { hideReferRecord, showHistoryCaseModal ,chronicMagItem,hisTemplates,autoFillModules,typeConfig} = this.props
-        hideReferRecord && hideReferRecord()
+        const { hideReferRecord, showHistoryCaseModal ,chronicMagItem,hisTemplates,autoFillModules,typeConfig} = this.props;
+        hideReferRecord && hideReferRecord();
         // showHistoryCaseModal && showHistoryCaseModal()
         // store.dispatch(initItemList(chronicMagItem))
         initItemList(chronicMagItem).then((res)=>{
-          console.log(99999,chronicMagItem)
             const result = res.data;
             if(result.code==0 && result.data){
               store.dispatch(setInitHistory(result.data));
               showHistoryCaseModal && showHistoryCaseModal();
             }else{
-              if(typeConfig==0){
-                Notify.info("暂无历史病历,已默认展示慢病相关内容");
-                const timer = setTimeout(function(){
-                  autoFillModules && autoFillModules();
-                  clearTimeout(timer);
-                },1000) //需求要求延时
-              }
+              Notify.info("暂无历史病历,已默认展示慢病相关内容");
+              const timer = setTimeout(function(){
+                autoFillModules && autoFillModules();
+                clearTimeout(timer);
+              },1000) //需求要求延时
             }
         })
     }
     noReferRecord() {
-        const { hideReferRecord ,autoFillModules,typeConfig} = this.props
+        const { hideReferRecord ,autoFillModules} = this.props;
         hideReferRecord && hideReferRecord();
-        if(typeConfig==0){//智能推送模式才自动填充
-            autoFillModules&&autoFillModules();
-        }
-        
+        autoFillModules&&autoFillModules();
+
     }
     referCase() {
-        const { hideHistoryCaseModal, items ,autoFillModules,typeConfig} = this.props
+        const { hideHistoryCaseModal, items ,autoFillModules,typeConfig} = this.props;
         const {sign} = this.state;
         hideHistoryCaseModal && hideHistoryCaseModal()
-        if (this.state.activeHistory === -1 && typeConfig==0) {//没有选择历史病例直接点确定
+        if (this.state.activeHistory === -1) {//没有选择历史病例直接点确定
             Notify.info("未选择历史病历,已默认展示慢病相关内容");
               const timer = setTimeout(function(){
                 autoFillModules && autoFillModules();
@@ -152,10 +147,6 @@ class DiagnosticList extends Component {
         let baseList = store.getState();
         
         let baseObj = items[this.state.activeHistory];
-        // 切换模式
-        if(sign != typeConfig){
-          store.dispatch({type: CONFIRM_TYPE, confirmType: baseObj.sign});
-        }
         pushAllDataList(baseObj.sign,'push',baseObj,'history')       //引用
         this.props.getBilling();
         this.setState({
@@ -170,9 +161,7 @@ class DiagnosticList extends Component {
             sign:-1
         })
         hideHistoryCaseModal && hideHistoryCaseModal()
-        if(typeConfig==0){//智能推送模式才自动填充
-            autoFillModules&&autoFillModules();
-        }
+        autoFillModules&&autoFillModules();
     }
     handleQuoteClick(item, index) {
         // const { handleQuoteClick } = this.props

+ 1 - 1
src/components/OtherHistory/index.jsx

@@ -37,7 +37,7 @@ class OtherHistory extends Component{
     const {hasMain,type,setInitData,isEmpty} = this.props;
     //无主诉提示在EditableSpan里
     //智能模式有主诉或者文本模式获取最近历史
-    if((+type===0&&hasMain&&isEmpty!=false)||(+type===1&&isEmpty!=false)){
+    if(hasMain&&isEmpty!=false){
       setInitData();
     }
   }

+ 3 - 2
src/containers/CurrentIll.js

@@ -7,11 +7,12 @@ import {getModules} from '../store/async-actions/fetchModules.js';
 import {HIDE,RESET,CLICKCOUNT,ISREAD,SETDROPSHOW} from '@store/types/homePage';
 import {billing} from '@store/async-actions/pushMessage';
 import {getModule} from '@store/async-actions/fetchModules';
-import {didPushParamChange} from '@utils/tools';
+import {didPushParamChange,filterDataArr} from '@utils/tools';
 import {Notify} from '@commonComp';
 
 function mapStateToProps(state) {
   const {homePage,currentIll,mainSuit,diagnosticList,typeConfig} = state;
+  const hasMain = filterDataArr(mainSuit.saveText);
     return {
         data:currentIll.data,//主诉模板
         emptyData:currentIll.emptyData,//空模板
@@ -39,7 +40,7 @@ function mapStateToProps(state) {
         // isChronic:!!diagnosticList.chronicMagItem,
         isChronic:mainSuit.chronicDesease?mainSuit.chronicDesease:diagnosticList.chronicMagItem,
         readMode:typeConfig.readMode,       //回读回来的模式(与当前模式并存)
-
+        hasMain,      //是否有主诉
     }
 }
 

+ 15 - 27
src/store/async-actions/fetchModules.js

@@ -89,11 +89,9 @@ export const getOtherHisRecord = ()=>{
   return (dispatch,getStore)=>{
     const state = getStore();
     const {message} =state.patInfo;
-    const mode = state.typeConfig.typeConfig;
     const param = {
       hospitalCode:message.hospitalCode,
       patientCode:message.patientCode,
-      /*sign:mode*/
     };
     json(api.getOtherHisRecord,param).then((res)=>{
       if(res.data.code=='0'){
@@ -102,38 +100,28 @@ export const getOtherHisRecord = ()=>{
         const objStr = JSON.parse(data.otherStr||'[]');
         let arr = [];//console.log(obj)
         if((!obj||!obj.other||obj.other.length==0)&&!objStr[0]){        //无其他史历史记录用默认模板
-          if(mode=='1'){      //文本模式
+          /*if(mode=='1'){      //文本模式
             dispatch({
               type:SETOTHERHISTORY,
               data:[],
               selecteds:[],
               save:[]
             });
-          }
+          }*/
         }else{
-          arr = obj.other;
-          if(mode =='1'){     //文本模式
-            dispatch({
-              type:SETOTHERHISTORY,
-              data:[],
-              selecteds:[],
-              save:[objStr[0]]
-            });
-          }else{
-            const text = filterDataArr(objStr);
-            dispatch({
-              type:SETOTHERHISTORY,
-              data:[{tagType:8,name:'',controlType:0,value:text}],
-              /*period:{
-                yjs_1: obj.yjs_1,
-                yjs_2: obj.yjs_2,
-                yjs_3: obj.yjs_3,
-                yjs_4: obj.yjs_4,
-              },
-              selecteds:obj.otherHistorySelecteds,*/
-              save:[text]
-            });
-          }
+          const text = filterDataArr(objStr);
+          dispatch({
+            type:SETOTHERHISTORY,
+            data:[{tagType:8,name:'',controlType:0,value:text}],
+            /*period:{
+              yjs_1: obj.yjs_1,
+              yjs_2: obj.yjs_2,
+              yjs_3: obj.yjs_3,
+              yjs_4: obj.yjs_4,
+            },
+            selecteds:obj.otherHistorySelecteds,*/
+            save:[text]
+          });
         }
       }
     });