Browse Source

Merge branch 'optimize' into optimize-zxc

zhangxc 6 năm trước cách đây
mục cha
commit
eade2c8062

+ 3 - 1
src/components/AddAssistCheck/index.jsx

@@ -70,12 +70,14 @@ class AddAssistCheck extends React.Component {
       if (!_cons.is(event.target) && _cons.has(event.target).length === 0) { // Mark 1
         this.setState({ date: false });
       }
-      if(!event.target.isEqualNode(_close) && !event.target.isEqualNode(_del)  && event.target.parentNode != _del && !event.target.isEqualNode(_closeTil)){
+      if(_del){
+        if(!event.target.isEqualNode(_close) && !event.target.isEqualNode(_del)  && event.target.parentNode != _del && !event.target.isEqualNode(_closeTil)){
           this.setState({
             visible: false,
             id: null,
             activeName:''
           })
+        }
       }
     });
     this.getCurrentDate();

+ 4 - 1
src/components/AddInspect/index.jsx

@@ -101,11 +101,14 @@ class Inspect extends React.Component {
           this.setState({ showFill: false, date: false });
         }
       }
-      if(!event.target.isEqualNode(_impClose) && !event.target.isEqualNode(_addClose) && !event.target.isEqualNode(_del)  && event.target.parentNode != _del && !event.target.isEqualNode(_closeTil)){
+      
+      if(_del){
+        if(!event.target.isEqualNode(_impClose) && !event.target.isEqualNode(_addClose) && !event.target.isEqualNode(_del)  && event.target.parentNode != _del && !event.target.isEqualNode(_closeTil)){
           this.setState({
             id: null,
             impId: null
           })
+        }
       }
     });
     this.getCurrentDate();

+ 1 - 0
src/components/AddInspect/index.less

@@ -185,6 +185,7 @@
         z-index: 30;
         border-radius: 50%;
         background: @closeIcon;
+        // background: url('/img/close.png') no-repeat center center;
         background-size: 100% 100%;
         background-color: #fff;
     }

+ 28 - 7
src/components/MainSuit/index.jsx

@@ -8,6 +8,7 @@ import config from "@config/index";
 import {isIE,getPageCoordinate,windowEventHandler,filterDataArr,getAllDataList,getAllDataStringList,ifOtherClear} from "@utils/tools.js";
 import $ from 'jquery';
 import store from '@store';
+import {getFeature} from '@store/async-actions/fetchModules';
 
 class MainSuit extends Component{
   constructor(props){
@@ -208,23 +209,43 @@ class MainSuit extends Component{
     });
 
   }
+  //除主诉外 其他是否为空
+  ifClear(){
+    let baseList = store.getState();
+    let jsonData = getAllDataList(baseList);
+    let jsonStr = getAllDataStringList(baseList);
+    let flg = ifOtherClear(jsonData,jsonStr,baseList);
+    return flg;
+  }
 
   handleBlur(e){//隐藏常见症状下拉、存自由输入的值
     const {freeText,saveText,datas,clearSearch,getSymptomFeature,currentData,saveChronic} = this.props;
     const that = this;
     let data = this.state.inpText;
+    //分词-现病史没有模板的时候才去获取
+    if(currentData&&currentData.length==0){
+      const me = getFeature(e.target.innerText);
+      me.then((res)=>{
+        // console.log(222,res)
+        if(res.data.code==0){
+          const result = res.data.data;
+          getSymptomFeature && getSymptomFeature(result);
+          // 判断是否为慢病复诊-请求慢病模板
+          /*let flg = this.ifClear();
+          if(result.? && !flg){
+            saveChronic && saveChronic({name:'糖尿病',id:21773});
+          }*/
+        }
+      })
+    }
     if(!isIE()){
-      if(currentData&&currentData.length==0){//现病史没有模板的时候才去获取
+      /*if(currentData&&currentData.length==0){//现病史没有模板的时候才去获取
         getSymptomFeature && getSymptomFeature(e.target.innerText);
-      } 
+      } */
       e.target.innerText?(e.target.innerText=""):(e.target.innerHTML="")
       freeText && freeText(data.trim());
       // 慢病模板获取:精确匹配"糖尿病复诊",储存慢病字段
-      // 页面有模板数据 就不在请求
-      let baseList = store.getState();
-      let jsonData = getAllDataList(baseList);
-      let jsonStr = getAllDataStringList(baseList);
-      let flg = ifOtherClear(jsonData,jsonStr,baseList);//除主诉外 其他是否为空
+      let flg = this.ifClear();
       if((data.trim()=='糖尿病复诊'||data.trim()=='糖尿病(复诊)'||data.trim()=='糖尿病(复诊)') && !flg){
         saveChronic && saveChronic({name:'糖尿病',id:21773});
       }

+ 2 - 2
src/components/NumberDrop/index.jsx

@@ -274,7 +274,7 @@ class NumberDrop extends Component{
             contentEditable={true}
             style={{minWidth:'10px',display:'inline-block',textAlign:'center'}}
             ref = {this.$span}
-            onkeydown={this.handleKeyDowm}
+            onKeyDown={this.handleKeyDowm}
             onBlur={this.numInpBlur}
             onInput={this.handleSpanInp}
             className={this.getSpanClass()}
@@ -282,7 +282,7 @@ class NumberDrop extends Component{
       <span ref = {this.$suf}>&nbsp;{suffix}</span>
       <NumberPan handleSelect={this.select.bind(this)}
                  onClose={handleHide}
-                 show={show} 
+                 show={show}
                  toClear={!hasSelect}
                  left={boxLeft}
                  top={boxTop}/>

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

@@ -164,7 +164,7 @@ class RadioInpDrop extends Component{
       if(typeof temp=='object'){
         list.push(<InputComp handleInp={this.handleInnerInp} editable={true} index={i} value={temp.value}></InputComp>);
       }else{
-        list.push(<span>{temp}</span>);
+        list.push(<span>&nbsp;{temp}</span>);
       }
     }
     /*if(value&&value.indexOf(config.radioOptionPer)!=-1){

+ 3 - 4
src/components/ScaleTable/index.jsx

@@ -21,8 +21,7 @@ class ScaleTable extends React.Component{
       valueData:{},
       start:false,   //点击计算
       scaleResult1:null,
-      result:{},
-      saveFlag:false
+      result:{}
     }
     this.handleFormula = this.handleFormula.bind(this);
   }
@@ -228,7 +227,7 @@ class ScaleTable extends React.Component{
   }
   componentWillReceiveProps(nextProps){
     const {tableId,saveScaleData,getResult,closeTable,scaleInfo,unscroeClose} = this.props;
-    const {valueData,saveFlag} = this.state;
+    const {valueData} = this.state;
     const data = nextProps.scaleInfo;
     // if(JSON.stringify(data) !== '{}' && data[tableId]){
     if(JSON.stringify(data) !== '{}' && data[tableId] && JSON.stringify(valueData) == '{}'){
@@ -289,7 +288,7 @@ class ScaleTable extends React.Component{
   componentWillUnmount(){
     // 储存计算结果和选择后的data
     const {tableId,getResult,scaleInfo,saveScaleData,formulaResult,comfirnFlag,flagT} = this.props;
-    const {valueData,scaleResult1,start,saveFlag} = this.state;
+    const {valueData,scaleResult1,start} = this.state;
     // 替换表格内容--1)没有点计算且没有计算结果;2)点了计算
     const scaleResult = scaleResult1 || formulaResult&&formulaResult[tableId]; //量表计算结果
     if(start || !scaleResult && valueData.scaleType==1){//仅计分量表储存

+ 7 - 1
src/containers/MainSuit.js

@@ -174,7 +174,7 @@ function mapDispatchToProps(dispatch) {
           dis:0
         })
       },
-      async getSymptomFeature(item){
+      /*async getSymptomFeature(item){
         const it = item&&item.trim();
         const symptomFeature = await getFeature(it);
         if(symptomFeature.data.code==0){
@@ -184,6 +184,12 @@ function mapDispatchToProps(dispatch) {
             data:data
           })
         }
+      },*/
+      getSymptomFeature(data){
+        dispatch({
+          type:SET_FEATURE,
+          data:data
+        })
       },
       async saveChronic(item){//储存慢病信息
         // loading

+ 1 - 1
src/containers/ScaleSearchContainer.js

@@ -10,7 +10,7 @@ function mapStateToProps(state) {
     return{
         searchResult: state.scaleSearch.searchResult,
         formulaResult: pushMessage.formulaResult,//????????
-        scaleInfo: pushMessage.scaleInfo,//��������
+        scaleInfo: pushMessage.scaleInfo,//量表内容
     }
 }
 

+ 18 - 12
src/modules/HomePage/index.jsx

@@ -5,10 +5,10 @@ import BannerContainer from '@containers/TypeConfigContainer';
 import BodyContainer from "@components/BodyContainer";
 import EmergencyProcedure from '@components/EmergencyProcedure';
 
-import {HIDEDROP,SETMINSCREEN} from '@store/types/homePage.js';
+import {HIDEDROP,SETMINSCREEN,SETSYSTEMCONFIG} from '@store/types/homePage.js';
 import style from './index.less';
-import {getInitModules,getChronic} from '@store/async-actions/homePage.js';
-import { getUrlArgObject } from "@utils/tools";
+import {getInitModules,getChronic,getSystemConfig} from '@store/async-actions/homePage.js';
+import { getUrlArgObject,parseNameVal } from "@utils/tools";
 import $ from 'jquery';
 import data from '@components/EmergencyProcedure/emergency';
 import loading from '@common/images/loading.gif';
@@ -22,16 +22,10 @@ class HomePage extends Component {
         this.setDataIdx = this.setDataIdx.bind(this)
     }
     componentDidMount(){
-        const {setWindow,getChronicList} = this.props;
+        const {setWindow,getChronicList,getConfig} = this.props;
+        getConfig();
         getChronicList&&getChronicList();//获取慢病列表
-       /* clearTimeout(this.state.timer);
-        const that = this;
-        const timer = setTimeout(function(){//解决患者信息在获取模板之后的问题
-            that.props.getInit();
-        },200)
-        this.setState({
-            timer
-        }) */ 
+
         // 获取并监听窗口宽度,用于有横向滚动条时患者信息和打印预览跟随滚动
         let width = $(window).width();
         let height = $(window).height();
@@ -98,6 +92,18 @@ const mapDispatchToProps = function (dispatch) {
         },
         getChronicList(){
             dispatch(getChronic)
+        },
+        getConfig(){
+          getSystemConfig().then((res)=>{
+            if(res.data.code=='0'){
+                dispatch({
+                  type:SETSYSTEMCONFIG,
+                  data: parseNameVal(res.data.data)
+                })
+            }else{
+
+            }
+          });
         }
     }
 };

+ 1 - 1
src/store/actions/currentIll.js

@@ -563,7 +563,7 @@ export const setRadioInputValue = (state,action)=>{
     });
     res.saveText[index] = sub.join('');
   }else {
-    res.saveText[ikey] = str;
+    res.saveText[index] = str;
   }
   res.update = Math.random();
   return res;

+ 0 - 35
src/store/async-actions/fetchModules.js

@@ -294,41 +294,6 @@ export function getIndexData(range,disName){
   }
 }
 
-// 计算接口
-/*export const getFormulaResult = (item)=>{
-  // type:1-量表 2-计算公式
-  const type = item.type;
-  let param = {
-      type:type,
-      data:item.data
-    }
-  return (dispatch,getState) => {
-    const state = getState();
-    json(api.getFormulaResult,param).then((res)=>{
-      if(+res.data.code==0){
-        if(type==1){//量表
-          dispatch({
-            type:SAVE_TABLE_RESULT,
-            // id:item.pId, //外层疾病id
-            id:item.id,  //量表id
-            data:Object.assign({},res.data.data,{pIndex:item.pIndex})
-          })
-        }else if(type==2){//计算公式
-          const data = state.pushMessage.chronicPushItems
-          data[item.ppIndex].details[item.pIndex].content.result =  res.data.data.result
-          dispatch({
-            type: SET_CHRONIC_PUSHS,
-            data: JSON.parse(JSON.stringify(data))
-          })
-          console.log('resss', res)
-        }
-        
-      }else{
-        Notify.error(res.data.msg);
-      }
-    })
-  }
-}*/
 export const getFormulaResult = (item)=>{
   // type:1-量表 2-计算公式
   const type = item.type;

+ 8 - 3
src/store/async-actions/homePage.js

@@ -3,18 +3,23 @@ import {SETINITDATA,MODI_LOADING,GET_ASSIST_LIST,GET_INSPECT_LIST,SETALLMODULES}
 import {SET_CURRENT} from '@store/types/currentIll';
 import {SET_MAINSUIT} from '@store/types/mainSuit';
 import config from '@config/index.js';
-import {formatContinueDots} from '@utils/tools';
+import {formatContinueDots,getUrlArgObject,storageLocal,fullfillText,checkFullfillText} from '@utils/tools';
 import {getOtherHisRecord,getInitData} from '@store/async-actions/fetchModules.js';
 import {initHistoryDetails} from '@store/async-actions/patInfo';
-import {storageLocal,fullfillText,checkFullfillText} from '@utils/tools';
 
 const api = {
   getModules:'/moduleInfo/getAll',
   clickCount:'/buriedSomeStatistical/saveBuriedSomeStatisticals', //埋点统计
   getChronic:'/disType/getDisType', //慢病列表
-  getQuestionUsual:'/questionUsual/getQuestionUsual' //化验常用标签
+  getQuestionUsual:'/questionUsual/getQuestionUsual', //化验常用标签
+  getSystemConfig:'/sysSet/getSysSetInfoDatas',     //获取系统配置
 };
 
+//获取系统配置
+export const getSystemConfig = ()=>{
+  const code = getUrlArgObject('hospitalId');
+  return json(api.getSystemConfig,{hospitalCode:code});
+};
 function modulesParseJson(data){
   let json = {},obj={},saveTextJson={},moduleName={};
   data.map((it)=>{

+ 4 - 5
src/store/reducers/homePage.js

@@ -1,5 +1,5 @@
 import {HIDE,RESET,SETINITDATA,SETDROPSHOW,SETADDITEMINIT,SETT0EDIT,SETREADDITEMS,
-  HIDEDROP,CLICKCOUNT,ISREAD,SETOTHERHISTORY,SETMINSCREEN,MODI_LOADING,SEARCH_DROP_LOCATION,GET_INSPECT_LIST,GET_ASSIST_LIST,SETALLMODULES} from '../types/homePage.js';
+  HIDEDROP,CLICKCOUNT,ISREAD,SETOTHERHISTORY,SETMINSCREEN,MODI_LOADING,SEARCH_DROP_LOCATION,GET_INSPECT_LIST,GET_ASSIST_LIST,SETALLMODULES,SETSYSTEMCONFIG} from '../types/homePage.js';
 import {showDrop,setAddItemInit,setLabelToEdit,confirmHide,clickNum,searchDropLocation,getInspectList,getAssistList} from '../actions/homePage.js';
 import SearchDrop from '../../components/SearchDrop/index.jsx';
 
@@ -17,6 +17,7 @@ const initState = {
   allModules:[],
   assistList:[],
   inspectList:[],
+  sysConfig:{}
 };
 
 export default function (state=initState,action) {
@@ -55,10 +56,6 @@ export default function (state=initState,action) {
       res.initData.otherIsHis = action.otherIsHis!=undefined?action.otherIsHis:true;
       res.initData.period = action.period;
       return res;
-    /*case SETTEXTFOCUS:
-      res.focusTextIndex = action.index;
-      res.span=action.$span;
-      return res;*/
     case SETMINSCREEN:
       res.windowWidth = action.obj.width;
       res.windowHeight = action.obj.height;
@@ -76,6 +73,8 @@ export default function (state=initState,action) {
     case SETALLMODULES:
       res.allModules = action.data;
       return res;
+    case SETSYSTEMCONFIG:
+      res.sysConfig = action.data;
     default:
       return res;
   }

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

@@ -15,4 +15,5 @@ export const MODI_LOADING = 'MODI_LOADING';    //1024标识
 export const SEARCH_DROP_LOCATION = 'SEARCH_DROP_LOCATION';    //1024标识
 export const GET_ASSIST_LIST = 'GET_ASSIST_LIST';    //辅检
 export const GET_INSPECT_LIST = 'GET_INSPECT_LIST';    //化验
-export const SETALLMODULES = 'SETALLMODULES';    //储存所有模板数据
+export const SETALLMODULES = 'SETALLMODULES';    //储存所有模板数据
+export const SETSYSTEMCONFIG = 'SETSYSTEMCONFIG';   //设置配置数据

+ 12 - 1
src/utils/tools.js

@@ -1179,6 +1179,16 @@ function getStatusImg(type,val,status){
     }
   }
 }
+
+//键值对转换
+function parseNameVal(arr){
+  let obj = {};
+  Array.isArray(arr)&&arr.map((it)=>{
+    obj[it.code]=it.value;
+  });
+  return obj;
+}
+
 module.exports = {
     checkType: Type.checkType,
     getIds,
@@ -1225,5 +1235,6 @@ module.exports = {
     parseChartData,
     getCalendarDate,
     downloadExportedData,
-    getStatusImg
+    getStatusImg,
+    parseNameVal
 };