浏览代码

回读后其他史为空标签则使用模板

zhouna 6 年之前
父节点
当前提交
a663c7eace
共有 3 个文件被更改,包括 19 次插入15 次删除
  1. 0 2
      src/components/OtherHistory/index.jsx
  2. 10 7
      src/containers/OtherHistory.js
  3. 9 6
      src/utils/tools.js

+ 0 - 2
src/components/OtherHistory/index.jsx

@@ -36,13 +36,11 @@ class OtherHistory extends Component{
   getData(){
     //第一次聚焦其他史时,主诉有数据则获取最近一次其他史记录(没有的话显示初始模板),主诉无数据则显示提示;其他时间其他史模板数据不调接口
     const {hasMain,type,setInitData,isEmpty} = this.props;
-    console.log(isEmpty)
     //无主诉提示在EditableSpan里
     //智能模式有主诉或者文本模式获取最近历史
     if((+type===0&&hasMain&&isEmpty!=false)||(+type===1&&isEmpty!=false)){
       setInitData();
     }
-
   }
   handleClick(e){//让搜索框跟随鼠标点击移动
     //e.stopPropagation();

+ 10 - 7
src/containers/OtherHistory.js

@@ -36,13 +36,16 @@ function mapDispatchToProps(dispatch,store){
     setInitData(){
       //先获取最近记录,没有的话显示模板
       dispatch((dispatch,getStore)=>{
-        const initData = getStore().homePage.initData;
-        const model = JSON.parse(JSON.stringify(initData.otherHisModel));
-        const arr = JSON.parse(JSON.stringify(initData.otherHis||null));
-        const arrSave = JSON.parse(JSON.stringify(initData.otherHisSave||null));
-        const selects = JSON.parse(JSON.stringify(initData.otherSelecteds||null));
-        const isHis = initData.otherIsHis;
-        const listObj = isHis?{newArr:arr,saveText:arrSave||[]}:fullfillText(model);
+        const state = getStore();
+        const initData = state.homePage.initData;
+        const mode = state.typeConfig.typeConfig;
+        const model = JSON.parse(JSON.stringify(initData.otherHisModel));     //查体模板
+        const arr = JSON.parse(JSON.stringify(initData.otherHis||null));        //最近其他史数据
+        const arrSave = JSON.parse(JSON.stringify(initData.otherHisSave||null));    //最近其他史saveText
+        const selects = JSON.parse(JSON.stringify(initData.otherSelecteds||null));  //其他史杂音类选中项
+        const isHis = initData.otherIsHis;     //是否是历史数据
+        const onlyOneText = arr.length==1&&arr[0].tagType==8&&!(arr[0].name||arr[0].value);    //是否只有一个自由文本标签
+        const listObj = isHis&&(mode==1||(!onlyOneText&&mode==0))?{newArr:arr,saveText:arrSave||[]}:fullfillText(model);
         dispatch({
           type:SETDATA,
           data:listObj.newArr,

+ 9 - 6
src/utils/tools.js

@@ -257,9 +257,12 @@ const pushAllDataList =(whichSign,action,reData,type) =>{           //回读清
        // Notify.success('页面已清空')
     }else{
         if (whichSign == 0) {
+          let dataJson = JSON.parse(reData.dataJson);
+          //其他史data
+          const oData = dataJson.other;
+          const onlyOneText = oData.length==1&&oData[0].tagType==8&&!(oData[0].name||oData[0].value);
             if(type == 'template'){        //结构化模板回读
-                let dataJson = JSON.parse(reData.dataJson);
-                let dataJsonStr = JSON.parse(reData.preview);
+              let dataJsonStr = JSON.parse(reData.preview);
                 // console.log(dataJson,dataJsonStr,'结构化模板引用')
                 store.dispatch({
                     type: CLEAR_MAIN_SUIT,
@@ -279,7 +282,7 @@ const pushAllDataList =(whichSign,action,reData,type) =>{           //回读清
                     type: CLEAROTHERHISTORY,
                     data:dataJson.other,
                     selecteds:dataJson.otherHistorySelecteds?dataJson.otherHistorySelecteds:[],
-                    isEmpty:dataJson.otherHistoryIsEmpty,
+                    isEmpty:onlyOneText?true:false,//dataJson.otherHistoryIsEmpty,
                     saveText:JSON.parse(dataJsonStr.other),
                     editClear:dataJson.other.length>0?false:true
                 });
@@ -312,9 +315,9 @@ const pushAllDataList =(whichSign,action,reData,type) =>{           //回读清
                   data:dataJson.addItems
                 });
             }else{    //结构化历史病历回读
-                let dataJson = JSON.parse(reData.dataJson);
+                /*let dataJson = JSON.parse(reData.dataJson);*/
                 let dataJsonStr = reData.detailList;
-                // console.log(dataJson,dataJsonStr,'结构化历史病历回读')
+              // console.log(dataJson,dataJsonStr,'结构化历史病历回读')
                 // console.log(dataJson.mainSuitSelecteds,7887)
                 store.dispatch({
                     type: CLEAR_MAIN_SUIT,
@@ -335,7 +338,7 @@ const pushAllDataList =(whichSign,action,reData,type) =>{           //回读清
                     data:dataJson.other,
                     selecteds:dataJson.otherHistorySelecteds?dataJson.otherHistorySelecteds:[],
                     saveText:dataJsonStr[2].content ? JSON.parse(dataJsonStr[2].content):[],
-                    isEmpty:dataJson.otherHistoryIsEmpty,
+                    isEmpty:onlyOneText?true:false,//dataJson.otherHistoryIsEmpty,回读回来后判断是否只有一个空标签,是的话要使用模板
                     editClear:dataJson.other.length>0?false:true
                 });
                 store.dispatch({