浏览代码

Merge remote-tracking branch 'origin/ChronicMag' into dev/new1

zhouna 6 年之前
父节点
当前提交
003d2e323d

+ 3 - 5
src/common/js/func.js

@@ -96,13 +96,12 @@ export const fullfillText = (arr,noPre=false,noEnd=false,ifEmpty=true)=>{
       value = '',
       item={},
       cNum = 0,
-      checkHiddenDefault=false;
+      checkHiddenDefault=false;//console.log(arr)
   arr&&arr.map((it,i)=>{
     notText = notTextLabel(it);
     cNum = i;
     value = it.value||'';
     textLabel = !ifEmpty&&i==0?Object.assign({},JSON.parse(config.textLabel),{showInCheck:true}):JSON.parse(config.textLabel);
-    //n个显示的标签最后一个标签后面要落关标,所以+1
     _textLabel = !ifEmpty&&cNum<config.showCheckNum+1?Object.assign({},JSON.parse(config._textLabel),{showInCheck:true}):JSON.parse(config._textLabel);
     if(i===0){
       //第一个标签不是文本标签时在前面添加文本标签
@@ -120,7 +119,7 @@ export const fullfillText = (arr,noPre=false,noEnd=false,ifEmpty=true)=>{
       }
       saveText.push(tempText);
       // 模板只有一个标签时第一项后面也要加空标签
-      if(arr.length==1&&notText){
+      if(arr.length==1){
         newArr.push(textLabel);
         saveText.push('');
       }
@@ -156,8 +155,7 @@ export const fullfillText = (arr,noPre=false,noEnd=false,ifEmpty=true)=>{
       }
       if(notText&&!noEnd&&i===arr.length-1){//最后一个非文本标签,后面添加一个文本标签
         //不能用上面的变量textLabel,因为上一个if可能也进了,这样就是同一个对象,值改变时会同步
-        const _text = arr.length>config.showCheckNum?JSON.parse(config._textLabel):_textLabel;
-        newArr.push(ifEmpty?textLabel:_text);
+        newArr.push(ifEmpty?textLabel:_textLabel);
         saveText.push("");
       }
     }

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

@@ -170,7 +170,8 @@ class AssessResult extends Component {
       <div className={style['printShow']}>
         <Information></Information>
       </div>
-      {!(data&&data.length>0)?<p className={style['loading']}><img src={loadingIcon} alt='loading...'/></p>:''}
+      {!data?<p className={style['loading']}><img src={loadingIcon} alt='loading...'/></p>:''}
+      {data&&data.length==0?<p className={style['no-data']}>暂无数据!</p>:''}
       {data && data.map((it, i) => {
         return this.handoutTypes(it, i);
       })}

+ 7 - 1
src/components/AssessResult/index.less

@@ -196,7 +196,13 @@
     width: 40px;
   }
 }
-
+.no-data{
+  color: #a5a3a3;
+  text-align: center;
+  margin-top: 40px;
+  font-size: 18px;
+  font-weight: bold;
+}
 @media print {
   .printShow,.textareaStatic {
     display: block;

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

@@ -252,7 +252,7 @@ class DiagnosticList extends Component {
                         return (<div draggable={true} className={style['diag-box'] + ' clearfix'}  key={item.id} >
                                     {index === 0 ? '' : <span className={style['diag-up']} onClick={() => {this.upDiagnostic(index)}}><img className={style["diag-up"]} src={diagUp}/></span>}
                                     {list.length === 1 ? '' : index !== 0 ? '' : <span onClick={() => {this.downDiagnostic(index)}} className={style['diag-down']}><img className={style["diag-down"]} src={diagDown}/></span>}
-                                    <span className={style['diag-number']} style={{fontWeight:index === 0 ?'bold':'normal'}}>{index === 0 ? '' : index+1}</span>
+                                    <span className={style['diag-number']} style={{fontWeight:index === 0 ?'bold':'normal'}}>{index === 0 ? '1' : index+1}</span>
                                     <span className={style['diag-name']} onClick={()=>{this.handleClickDiag(item)}}>{item.name}<span></span></span> 
                                     {item.type === 1 ? <span className={style['diag-first']}>初诊</span> :<span className={style['diag-second']}> 复诊</span>}
                                     <span className={style['treat']}

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

@@ -13,8 +13,6 @@ import $ from "jquery";
  * placeholder:灰显文字
  * data:下拉内容数据
  * handleSelect:选中事件
- * prefix:前缀
- * suffix:后缀
  *
  * ***/
 

+ 2 - 2
src/containers/CheckBody.js

@@ -29,10 +29,10 @@ function mapStateToProps(state){
   }
 }
 
-function mapDispatchToProps(dispatch,state){
+function mapDispatchToProps(dispatch){
   return {
     getInit(){
-      dispatch({type:MODI_LOADING,flag:true});
+      //dispatch({type:MODI_LOADING,flag:true});
       dispatch(getInitData());
     },
     fetchModules(param){

+ 1 - 1
src/containers/EditableSpan.js

@@ -182,7 +182,7 @@ function mapDispatchToProps(dispatch,state) {
       clearTimeout(timer);
       let timer = setTimeout(function(){      //延迟待确定后的数据更新后推送,避免获取的参数还是旧的
         if(didPushParamChange()){     //操作后内容有变化才推送
-          dispatch(billing());
+          dispatch(billing('',obj.boxMark));
           clearTimeout(timer);
         }
       },config.delayPushTime);

+ 1 - 1
src/containers/NumberDrop.js

@@ -128,7 +128,7 @@ function mapDispatchToProps(dispatch,store){
       clearTimeout(timer);
       let timer = setTimeout(function(){      //延迟待确定后的数据更新后推送,避免获取的参数还是旧的
         if(didPushParamChange()){     //操作后内容有变化才推送
-          dispatch(billing());
+          dispatch(billing('',params.ikey.substr(0,1)));
           clearTimeout(timer);
         }
       },config.delayPushTime);

+ 1 - 1
src/containers/NumberUnitDrop.js

@@ -136,7 +136,7 @@ function mapDispatchToProps(dispatch,store){
       clearTimeout(timer);
       let timer = setTimeout(function(){      //延迟待确定后的数据更新后推送,避免获取的参数还是旧的
         if(didPushParamChange()){     //操作后内容有变化才推送
-          dispatch(billing());
+          dispatch(billing('',params.ikey.substr(0,1)));
           clearTimeout(timer);
         }
       },config.delayPushTime);

+ 1 - 1
src/containers/RadioDrop.js

@@ -110,7 +110,7 @@ function mapDispatchToProps(dispatch,store){
       //右侧推送
       setTimeout(function(){      //延迟待确定后的数据更新后推送,避免获取的参数还是旧的
         if(didPushParamChange()){     //操作后内容有变化才推送
-          dispatch(billing());
+          dispatch(billing('',params.ikey.substr(0,1)));
         }
       },500);
     },

+ 1 - 1
src/containers/RadioInpDrop.js

@@ -138,7 +138,7 @@ function mapDispatchToProps(dispatch,store){
       //右侧推送
       setTimeout(function(){      //延迟待确定后的数据更新后推送,避免获取的参数还是旧的
         if(didPushParamChange()){     //操作后内容有变化才推送
-          dispatch(billing());
+          dispatch(billing('',params.ikey.substr(0,1)));
         }
       },500);
     },

+ 1 - 1
src/containers/SpreadDrop.js

@@ -457,7 +457,7 @@ function handleLabel(dispatch,params){
       break;
     default:
   }
-  dispatch(billing());
+  dispatch(billing('',type));
   dispatch({
     type:ISREAD
   })

+ 9 - 0
src/store/actions/checkBody.js

@@ -1,6 +1,14 @@
 import config from '@config/index.js';
 import {getLabelIndex,fullfillText} from '@common/js/func.js';
 import {formatContinueDots} from '@utils/tools.js';
+
+export function preSetCheckbody(state,action) {
+  let res = Object.assign({},state);
+  const {data} = action;
+  res.preData = data;
+  return res;
+}
+
 //设置查体数据
 export function set(state,action){
   let res = Object.assign({},state);
@@ -401,6 +409,7 @@ export const changeNumLabelVal = (state,action)=>{
 export function clearCheckBody(state,action){  //清空
   let res = Object.assign({},state);
   res.data = action.data;
+  res.preData = [];
   res.saveText = action.saveText;
   res.isEmpty = action.isEmpty;
   res.selecteds = action.selecteds?action.selecteds:[];

+ 34 - 16
src/store/async-actions/fetchModules.js

@@ -1,5 +1,5 @@
 import {json} from '@utils/ajax.js';
-import {SET} from '@types/checkBody.js';
+import {SET,PRESET} from '@types/checkBody.js';
 import {fullfillText,_fullfillText} from '@common/js/func';
 import {SETDATA} from '@store/types/otherHistory';
 import store from '@store';
@@ -138,9 +138,12 @@ export const getOtherHisRecord = ()=>{
   }
 };
 
-//查体模板数据获取
-export function getInitData(){
+//预取查体模板数据-现病史触发推送时获取
+export function pregetCheckbodyData(flag){     //flag=true获取到数据后立即显示
   return (dispatch)=>{
+    if(flag){
+      dispatch({type:MODI_LOADING,flag:true});
+    }
     const emrData = getEMRParams();
     const param = {
       age: emrData.age,
@@ -155,29 +158,44 @@ export function getInitData(){
     };
     json(api.getBigPush,param).then((res)=>{
       if(+res.data.code === 0){
-        dispatch({type:MODI_LOADING,flag:false});
         const data = res.data.data&&res.data.data.vital;
-        const str = JSON.stringify(data);
-        const arr = fullfillText(JSON.parse(str),false,false,false).newArr;
         dispatch({
-          type:SET,
-          data:arr,
-          isEmpty:false
+          type:PRESET,
+          data:data
         });
+        if(flag){
+          const arr = fullfillText(data,false,false,false).newArr;
+          dispatch({
+            type:SET,
+            data:arr,
+            isEmpty:false
+          });
+          dispatch({type:MODI_LOADING,flag:false});
+        }
       }else{
-        dispatch({type:MODI_LOADING,flag:false});
-        const block = Object.assign(JSON.parse(config.textLabel),{full:true});      //无数据时保留一个自由文本标签可输入
-        dispatch({
-          type:SET,
-          data:[block],
-          isEmpty:true
-        });
         Notify.error(res.data.msg);
       }
     });
   }
 }
 
+//查体模板数据获取
+export function getInitData(){
+  return (dispatch,getStore)=>{
+    const state =  getStore();
+    const preData = [...state.checkBody.preData];
+    if(!preData||preData.length==0){
+      dispatch(pregetCheckbodyData(true));
+    }
+      const arr = fullfillText(preData,false,false,false).newArr;
+      dispatch({
+        type:SET,
+        data:arr,
+        isEmpty:false
+      });
+  }
+}
+
 //其他史模板填充-先取最近记录,无则用模板
 export function setOtherHisModule(){
   return (dispatch, getStore) => {

+ 25 - 11
src/store/async-actions/pushMessage.js

@@ -4,6 +4,7 @@ import { SET_CLICK_DIAG } from '../types/diagnosticList';
 import {storageLocal,getEMRParams} from '@utils/tools';
 import {SET_IMPORT_CHECKBODY_LABEL} from "../types/checkBody";
 import { Notify} from '@commonComp';
+import {pregetCheckbodyData} from '@store/async-actions/fetchModules';
 
 const api={
   push:'/push/pushInner',
@@ -12,7 +13,7 @@ const api={
 }
 
 //获取右侧推送信息
-export const billing = (mdata) => {
+export const billing = (mdata,boxMark) => {
  return (dispatch, getState) =>{
   const state = getState();
   let url = api.push;
@@ -22,7 +23,7 @@ export const billing = (mdata) => {
   const emrData = getEMRParams();
   const params = {
     age: emrData.age,
-    featureType: "4,5,6,7,22",
+    featureType: "5,6,7",
     // featureType: "22",
     diag: emrData.dis,
     lis: emrData.lis,
@@ -34,7 +35,7 @@ export const billing = (mdata) => {
   };
   storageLocal.set('emrParam',params);      //推送数据存储,用作推送前对比是否有变,有变才推送
     json(url, params).then((data) => {
-        let {dis, lab, pacs,markedVitalIds,medicalIndications} = data.data.data||{};
+        let {dis, lab, pacs,markedVitalIds} = data.data.data||{};
         lab = lab||[];
         pacs = pacs||[];
         // console.log('推送数据', data.data.data);
@@ -65,11 +66,6 @@ export const billing = (mdata) => {
             lab: lab||[],
             pacs: pacs||[],
         });
-        //慢病推送模块数据
-        dispatch({
-          type:SET_CHRONIC_PUSHS,
-          data:medicalIndications
-        });
         //查体高亮标签
         dispatch({
           type:SET_IMPORT_CHECKBODY_LABEL,
@@ -77,12 +73,30 @@ export const billing = (mdata) => {
         })
   }).catch((e) =>{
       console.log(e)
-  }) 
+  });
+   //单独调指标
+   const ps = Object.assign({},params,{featureType:'22'});
+   json(url, ps).then((data) => {
+     let {medicalIndications} = data.data.data||{};
+
+     //慢病推送模块数据
+     dispatch({
+       type:SET_CHRONIC_PUSHS,
+       data:medicalIndications
+     });
+   }).catch((e) =>{
+     console.log(e)
+   });
+
+   //调查体,现病史触发推送且查体无数据时获取查体模板
+   const checkBody = state.checkBody.data;
+   if(boxMark==2&&!(checkBody&&checkBody.length>0&&!checkBody[0].full)){
+     dispatch(pregetCheckbodyData());
+   }
  }
 };
 
-
-export const getTips = (diagItem) =>{
+  export const getTips = (diagItem) =>{
     return (dispatch, getState) =>{
         dispatch({
             type: SET_CLICK_DIAG,

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

@@ -1,10 +1,10 @@
 import {SET,SETNUMBER4,SETSELECTED4,SETCHECKBOX,ADDLABELITEM,SETCHECKTEXT,SETSEARCHDATA,
   SELECTSEARCHDATA,CHANGECHECKTEXTLABEL,CLEARCHECKBODY,CHECK_FOCUS_INDEX,CHECKBODY_CLEAR,
   SETCHECKINPUT,DEL_CHECKBODY,CHANGECHECKTEXTLABEL_NUMBER,CHECKCONFIRMSELECTED,
-  CHECKBODY_MUL,DEL_CHECKBODY_LABLE,SET_CK_RADIO_INPUT_VAL,SET_IMPORT_CHECKBODY_LABEL} from '../types/checkBody.js';
+  CHECKBODY_MUL,DEL_CHECKBODY_LABLE,SET_CK_RADIO_INPUT_VAL,SET_IMPORT_CHECKBODY_LABEL,PRESET} from '../types/checkBody.js';
 import {set,setNumberValue,setRadioValue,setCheckBoxValue,addLabelItem,setCheckText,
   setSearchData,insertLabelData,changeLabelVal,clearCheckBody,setInputLabel,backspaceText,
-  changeNumLabelVal,confirm,multipleComfirn,delSingleLable,setRadioInputValue,setImportCheckbodyLabel} from '../actions/checkBody.js';
+  changeNumLabelVal,confirm,multipleComfirn,delSingleLable,setRadioInputValue,setImportCheckbodyLabel,preSetCheckbody} from '../actions/checkBody.js';
 import config from '@config/index.js';
 
 const block = Object.assign(JSON.parse(config.textLabel),{full:true});//空白时保留一个自由文本标签
@@ -16,11 +16,14 @@ const initState = {
                 focusIndex:'',
                 isEmpty:true,      //是否为空白,需要请求数据
                 showSearchBox:false,
-                importLabel:[]//[430,436,40,278,435,279,28,442,447,448,449,450,453,454,457,456,282]
+                importLabel:[],//[430,436,40,278,435,279,28,442,447,448,449,450,453,454,457,456,282]
+                preData:[],     //预存的查体模板
           };
 export default function(state=initState,action){
   let res = Object.assign({},state);
   switch(action.type){
+    case PRESET:
+      return preSetCheckbody(state,action);
     case SET:
       return set(state,action);
     case SETNUMBER4:

+ 2 - 4
src/store/reducers/pushMessage.js

@@ -1,8 +1,8 @@
 import {CHANGE_ASSAY, CHANGE_CHECK, BILLING_ADVICE, ADD_SCHEME, SET_TIPS,  SET_TIPS_DETAILS, 
         SET_CHANGE_ADVICE_TREATMENT, SET_CHANGE_ADVICE_ASSAY, SET_CHANGE_ADVICE_CHECK, ADD_BILLING,
-        CLEAR_ALL_PUSH_MESSAGE,SHOW_TIPS_DETAILS, HIDE_TIPS_DETAILS, SET_COMMONTREATMENT, IS_FIRST_MAIN_DIAG, 
+        CLEAR_ALL_PUSH_MESSAGE,SHOW_TIPS_DETAILS, HIDE_TIPS_DETAILS, SET_COMMONTREATMENT,
         SET_ADVICE_INPUT ,SET_CHRONIC_TABLELIST,SHOW_TABLE_LIST,SET_SCALE_INFO,SET_CHRONIC_PUSHS,
-        SAVE_TABLE_RESULT, SAVE_FOLLOW_UP, DEL_FOLLOW_UP} from '../types/pushMessage';
+        SAVE_TABLE_RESULT, SAVE_FOLLOW_UP, DEL_FOLLOW_UP,PRESET} from '../types/pushMessage';
 import {changeAssay, changeCheck, setAdvice, addScheme, setTips, setTipsDetails, setChangeAdviceTreatment, 
         setChangeAdviceAssay, setChangeAdviceCheck, addBilling, clearAllPushMessage, showTipsDetails, hideTipsDetails, 
         setCommontreatment, isFirstMainDiag, setAdviceInput, saveFollowUp, delFollowUp } from '../actions/pushMessage';
@@ -55,8 +55,6 @@ export default function(state = initState, action) {
       return hideTipsDetails(state, action);
     case SET_COMMONTREATMENT:
       return setCommontreatment(state, action);
-    case IS_FIRST_MAIN_DIAG:
-      return isFirstMainDiag(state, action);
     case SET_ADVICE_INPUT:
       return setAdviceInput(state, action);
     case SAVE_FOLLOW_UP: 

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

@@ -18,4 +18,5 @@ export const CHECKCONFIRMSELECTED = 'spread_check_body_labels';
 export const CHECKBODY_MUL = 'CHECKBODY_MUL';//单列多选
 export const DEL_CHECKBODY_LABLE = 'DEL_CHECKBODY_LABLE';
 export const SET_CK_RADIO_INPUT_VAL = 'SET_CK_RADIO_INPUT_VAL';
-export const SET_IMPORT_CHECKBODY_LABEL='SET_IMPORT_CHECKBODY_LABEL';
+export const SET_IMPORT_CHECKBODY_LABEL='SET_IMPORT_CHECKBODY_LABEL';
+export const PRESET = 'PRESET_CHECKBODY_DATA';