zhangxc 6 éve
szülő
commit
8e2d79940b

+ 51 - 0
src/components/MedicalInfo/index.jsx

@@ -0,0 +1,51 @@
+import React, { Component } from 'react';
+import style from './index.less';
+import { SearchOption } from '@commonComp';
+import {windowEventHandler,getCurrentDate,getWindowInnerHeight} from '@utils/tools'
+
+class MedicalInfo extends Component {
+    constructor(props) {
+        super(props)
+        this.$cont = React.createRef();
+    }
+    
+    componentDidMount() {
+        const height = getWindowInnerHeight() - 200;
+        this.$cont.current.style.height = height + "px";
+    
+        windowEventHandler('resize', ()=>{
+          const height = getWindowInnerHeight() - 200;
+          this.$cont.current.style.height = height + "px";
+        });
+    }
+
+    getSearchList(searchResult) {
+        const { getAllConceptDetail } = this.props
+        return <div className={style['search-result']}>
+            {
+            searchResult && searchResult.map((item) => {
+                return (<div key={item.conceptId} className={style['search-result-item']} onClick={() =>getAllConceptDetail({name: item.name, type: item.type})}>{item.name + '('+ item.libTypeName + ')'}</div>)
+            })
+            }
+        </div>
+    }
+    render() {
+        const {searchResult, handleChangeValue,pageTop,windowHeight } = this.props
+        return (
+        <div className={style['mefical-info-wrapper']}> 
+            <div ref={this.$cont}>
+                <SearchOption handleChangeValue={handleChangeValue} pageTop={pageTop} windowHeight={windowHeight} height={180} visible={true}>
+                    {this.getSearchList(searchResult)}
+                </SearchOption>
+             </div>
+
+        </div>
+        
+        )
+
+        
+        
+    }
+}
+
+export default MedicalInfo;

+ 8 - 0
src/components/MedicalInfo/index.less

@@ -0,0 +1,8 @@
+@import "~@less/variables.less";
+.mefical-info-wrapper {
+    padding: 0px 15px;
+    line-height: 20px; 
+    width: @push-width;
+    overflow: hidden;
+    position: relative;
+}

+ 6 - 1
src/components/PushContainer/index.jsx

@@ -12,6 +12,7 @@ import TemplateItems from '@components/TemplateItems';
 import PushItemsContainer from '@containers/PushItemsContainer';
 import { pushAllDataList,getWindowInnerHeight } from '@utils/tools';
 import CopyRightContainer from "@containers/CopyRightContainer";
+import MedicalInfoContainer from '@containers/MedicalInfoContainer'
 class PushContainer extends Component {
     constructor(props) {
         super(props);
@@ -22,6 +23,9 @@ class PushContainer extends Component {
                 disabled: true
             }, {
                 title: '模板',
+            },
+            {
+                title: '医学知识',
             }],
             visible:false,
             message:'',                 //提示的内容
@@ -238,7 +242,7 @@ class PushContainer extends Component {
                 handleActiveClick={this.handleActiveClick}
             >
                 <TemplateContainer activeId={activeId}>
-                  <PushItemsContainer></PushItemsContainer>
+                    <PushItemsContainer></PushItemsContainer>
                     <TemplateItems
                         items={items}
                         checkItems={checkItems}
@@ -250,6 +254,7 @@ class PushContainer extends Component {
                         handleMangerTemplate={this.handleMangerTemplate}
                         handleAllCheckbox={this.handleAllCheckbox}
                     ></TemplateItems>
+                    <MedicalInfoContainer></MedicalInfoContainer>
                 </TemplateContainer>
             </Tab>
             <ConfirmModal 

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

@@ -119,8 +119,8 @@ class PushItems extends Component {
   }
 
   showTips() {
-    const { getTipsDetails, showTipsDetailsModal } = this.props;
-    getTipsDetails && getTipsDetails();
+    const { getTipsDetails, showTipsDetailsModal, clickDiag } = this.props;
+    getTipsDetails && getTipsDetails({name: clickDiag.name, type: clickDiag.type,position:2}); 
     showTipsDetailsModal && showTipsDetailsModal()
   }
   hideTips() {

+ 29 - 0
src/containers/MedicalInfoContainer.js

@@ -0,0 +1,29 @@
+import React from 'react';
+import { connect } from 'react-redux';
+import { getSearchList } from '@store/async-actions/medicalInfo';
+import MedicalInfo from '@components/MedicalInfo';
+import {getAllConceptDetail} from '../store/async-actions/pushMessage';
+
+function mapStateToProps(state) {
+    return{
+        searchValue: state.medicalInfo.searchValue,
+        searchResult: state.medicalInfo.searchResult,
+    }
+}
+
+function mapDispatchToProps(dispatch) {
+    return {
+        handleChangeValue(val){
+            dispatch(getSearchList(val))
+        },
+        getAllConceptDetail(item) {
+            dispatch(getAllConceptDetail(item))
+        }
+    }
+}
+const MedicalInfoContainer = connect(
+    mapStateToProps,
+    mapDispatchToProps
+)(MedicalInfo);
+
+export default MedicalInfoContainer

+ 3 - 3
src/containers/PushItemsContainer.js

@@ -12,7 +12,7 @@ function mapStateToProps(state) {
         pushMessage: pushMessage,
         tipsDiscalimer:  state.copyRight.disContent,
         chronicMagItem: diagnosticList.chronicMagItem,
-        questionId: diagnosticList.clickDiag,
+        clickDiag: diagnosticList.clickDiag,
         tableList: pushMessage.tableList,
         showList: pushMessage.showList,
         //chronicPushItems: pushMessage.chronicPushItems,
@@ -46,8 +46,8 @@ function mapDispatchToProps(dispatch) {
                 check: checkedCheck,
             })
         },
-        getTipsDetails: () => {
-            dispatch(getAllConceptDetail())
+        getTipsDetails: (item) => {
+            dispatch(getAllConceptDetail(item))
         },
         showTipsDetailsModal: () => {
             dispatch({

+ 27 - 0
src/store/actions/medicalInfo.js

@@ -0,0 +1,27 @@
+export const showSearch = (state,action) => {
+    const res = Object.assign({}, state);
+    res.show = true;
+    return res;
+}
+
+export const setSearchValue = (state,action) => {
+    const res = Object.assign({},state);
+    res.searchValue = action.searchValue;
+    return res;
+}
+
+export const getSearchResult= (state, action) => {
+    const res = Object.assign({},state);
+    // let searchResult = []
+    // action.searchResult && action.searchResult.map((item, index) =>{
+    //     let searchResultItem = {}
+    //     searchResultItem.id = item.questionId
+    //     searchResultItem.name = item.name
+    //     searchResultItem.showType = item.showType
+    //     searchResultItem.retrievalName = item.retrievalName
+    //     searchResultItem.conceptId = item.conceptId
+    //     searchResult.push(searchResultItem)
+    // }) 
+    res.searchResult = action.searchResult;
+    return res;
+}

+ 29 - 0
src/store/async-actions/medicalInfo.js

@@ -0,0 +1,29 @@
+import { json } from "@utils/ajax";
+import { GET_SEARCH_RESULT } from '@store/types/medicalInfo';
+
+
+export const getSearchList = (val) => {
+    if(val.trim() == ''){
+        const data = [];
+        return (dispatch) =>  dispatch({
+            type: GET_SEARCH_RESULT,
+            searchResult: []
+        })
+    }
+   
+    return (dispatch, getState) => {
+        const state = getState();
+        
+        json('/retrieval/getStaticKnowledge',{
+            inputStr:val,
+        })
+        .then((res)=>{
+            const data = res.data.data;
+            dispatch({
+                type: GET_SEARCH_RESULT,
+                searchResult: data
+            })
+        })
+    }
+};
+

+ 8 - 7
src/store/async-actions/pushMessage.js

@@ -1,12 +1,11 @@
 import { get, post, json } from "@utils/ajax";
-import { BILLING_ADVICE, SET_TIPS, SET_TIPS_DETAILS ,SET_CHRONIC_TABLELIST,SET_SCALE_INFO,SET_CHRONIC_PUSHS,SHOW_TABLE_LIST} from '@store/types/pushMessage';
+import { BILLING_ADVICE, SET_TIPS, SET_TIPS_DETAILS ,SET_CHRONIC_TABLELIST,SET_SCALE_INFO,SET_CHRONIC_PUSHS,SHOW_TABLE_LIST, SHOW_TIPS_DETAILS} from '@store/types/pushMessage';
 import { SET_DRUG_INFO, SHOW_DRUG_INFO } from '@store/types/treat';
 import { SET_CLICK_DIAG } from '../types/diagnosticList';
 import {storageLocal,getEMRParams} from '@utils/tools';
 import {SET_IMPORT_CHECKBODY_LABEL,PRESET} from "../types/checkBody";
 import { Notify} from '@commonComp';
 import {pregetCheckbodyData} from '@store/async-actions/fetchModules';
-
 const api={
   push:'/push/pushInner',
   getTableList:'/scale/getList', //获取量表列表
@@ -153,18 +152,20 @@ export const getConceptDetail = (item) => {
     }
 }
 
-export const getAllConceptDetail = () => {
+export const getAllConceptDetail = (item) => {
     return(dispatch, getState) => {
         const state = getState();
-        const clickItem = state.diagnosticList.clickDiag
         const params = {
-            type: clickItem.type,
-            name: clickItem.name,
-            position:2
+            type: item.type,
+            name: item.name,
+            position:item.position
         }
         json(api.getConceptDetail, params)
         .then((res)=>{
             if(res.data.code == '0') {
+                dispatch({
+                    type: SHOW_TIPS_DETAILS
+                })
                 dispatch({
                     type: SET_TIPS_DETAILS,
                     tipsDetails: res.data.data

+ 4 - 2
src/store/index.js

@@ -27,6 +27,7 @@ import treat from './reducers/treat';
 import currentIll from './reducers/currentIll';
 import assessResult from './reducers/assessResult';
 import assessResultHis from './reducers/assessResultHis';
+import medicalInfo from './reducers/medicalInfo';
 
 
 const composeEnhancers =
@@ -59,8 +60,9 @@ const rootReducer = combineReducers({
     getInfoByUuid,
 	checkBody,
     currentIll,
-  assessResult,
-  assessResultHis
+    assessResult,
+    assessResultHis,
+    medicalInfo
 });
 
 export default createStore(rootReducer, enhancer);

+ 18 - 0
src/store/reducers/medicalInfo.js

@@ -0,0 +1,18 @@
+import { SET_SEARCH_VALUE, GET_SEARCH_RESULT } from '../types/medicalInfo'; 
+import { setSearchValue, getSearchResult } from '../actions/medicalInfo'; 
+
+const initState = {
+    searchValue: '',
+    searchResult: []
+}
+
+export default function (state=initState, action) {
+    switch(action.type) {
+        case SET_SEARCH_VALUE: 
+            return setSearchValue(state, action);
+        case GET_SEARCH_RESULT: 
+            return getSearchResult(state, action);
+        default: 
+            return state;
+    }
+}

+ 2 - 0
src/store/types/medicalInfo.js

@@ -0,0 +1,2 @@
+export const SET_SEARCH_VALUE = 'SET_SEARCH_VALUE';
+export const GET_SEARCH_RESULT = 'GET_SEARCH_RESULT';