Przeglądaj źródła

其他史查体慢病模板填充

zhouna 6 lat temu
rodzic
commit
5f7a3e89c1

+ 18 - 5
src/containers/MainSuit.js

@@ -6,13 +6,14 @@ import {RESET,CLICKCOUNT,ISREAD,SEARCH_DROP_LOCATION,MODI_LOADING} from '@store/
 import {getCommSymptoms,getCommSymptomPush} from '@store/async-actions/mainSuit.js'
 import {SET_MAIN_SUIT} from '@store/types/fillInfo';
 import {CLEAR_DIAGNOSE} from '@store/types/diagnosticList';
-import {getSearch,getFeature} from '@store/async-actions/fetchModules';
+import {getSearch,getFeature,setOtherHisModule} from '@store/async-actions/fetchModules';
 import {billing} from '@store/async-actions/pushMessage';
-import {filterArr,didPushParamChange,filterDataArr} from '@utils/tools.js';
+import {didPushParamChange,filterDataArr} from '@utils/tools.js';
 import config from '@config/index.js';
 import {Notify} from '@commonComp';
 import {getInitModules} from '@store/async-actions/homePage.js';
-import {CURRENT_CHRONIC} from '@store/types/currentIll'
+import {CURRENT_CHRONIC} from '@store/types/currentIll';
+import {SET} from '@types/checkBody';
 
 function mapStateToProps(state) {//console.log(11,state);
   return {
@@ -212,8 +213,20 @@ function mapDispatchToProps(dispatch) {
       getBilling: () => {
         dispatch(billing())
       },
-      autoFillMoudles(){//自动填充模板
-        dispatch({type:CURRENT_CHRONIC})//现病史
+      autoFillMoudles() {//自动填充模板
+        dispatch({type: CURRENT_CHRONIC})//现病史
+        //其他史模板填充-先去历史,无历史用模板
+        dispatch(setOtherHisModule());
+        //查体模板填充
+        dispatch((dispatch, getStore) => {
+          const state = getStore();
+          const initData = state.homePage.initData;
+          dispatch({
+            type: SET,
+            data: [...initData.checkbody],
+            isEmpty:false
+          });
+        });
       }
     }
 }

+ 2 - 24
src/containers/OtherHistory.js

@@ -3,7 +3,7 @@ import {connect} from 'react-redux';
 import OtherHistory from "../components/OtherHistory";
 import {SETSELECTED,CLEARSELECTED,CONFIRMSELECTED,SELECTOTHERSEARCHDATA,SETDATA,SETTEXTMODEVALUE,OTHEREDICLEAR} from '@types/otherHistory';
 import {HIDE,RESET,ISREAD,SEARCH_DROP_LOCATION} from '@store/types/homePage.js';
-import {getModule} from '@store/async-actions/fetchModules.js';
+import {getModule,setOtherHisModule} from '@store/async-actions/fetchModules.js';
 import {billing} from '@store/async-actions/pushMessage';
 import {fullfillText} from '@common/js/func';
 import {didPushParamChange,filterDataArr} from '@utils/tools.js';
@@ -37,29 +37,7 @@ function mapDispatchToProps(dispatch,store){
   return {
     setInitData(){
       //先获取最近记录,没有的话显示模板
-      dispatch((dispatch,getStore)=>{
-        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&&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,
-          selecteds:selects,
-          period:initData.period,
-          save:listObj.saveText,
-          isEmpty:false
-        });
-        dispatch({
-          type:ISREAD
-        })
-      });
+      dispatch(setOtherHisModule());
       //右侧推送
       setTimeout(function(){      //延迟待确定后的数据更新后推送,避免获取的参数还是旧的
         if(didPushParamChange()){     //操作后内容有变化才推送

+ 40 - 2
src/store/async-actions/fetchModules.js

@@ -3,9 +3,10 @@ import {SET} from '@types/checkBody.js';
 import {fullfillText,_fullfillText} from '@common/js/func';
 import {SETDATA} from '@store/types/otherHistory';
 import store from '@store';
-import {getEMRParams} from '@utils/tools.js';
+import {getEMRParams,didPushParamChange} from '@utils/tools.js';
 import {Notify} from '@commonComp';
-import {SETOTHERHISTORY} from "../types/homePage";
+import {billing} from '@store/async-actions/pushMessage';
+import {SETOTHERHISTORY,ISREAD} from "../types/homePage";
 import config from "@config/index";
 
 const api={
@@ -169,6 +170,43 @@ export function getInitData(){
   }
 }
 
+//其他史模板填充-先取最近记录,无则用模板
+export function setOtherHisModule(){
+  return (dispatch, getStore) => {
+    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 && 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,
+      selecteds: selects,
+      period: initData.period,
+      save: listObj.saveText,
+      isEmpty: false
+    });
+    dispatch({
+      type: ISREAD
+    });
+
+    //右侧推送
+    setTimeout(function () {      //延迟待确定后的数据更新后推送,避免获取的参数还是旧的
+      if (didPushParamChange()) {     //操作后内容有变化才推送
+        dispatch(billing());
+      }
+    }, 500);
+  }
+}
+
 //保存切换模式
 export function saveMode(mode){
   return (dispatch,getStore)=>{