Browse Source

药品说明书多个Id查询

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

+ 4 - 3
src/components/Treat/DrugTreat/index.jsx

@@ -46,13 +46,14 @@ class DrugTreat extends Component {
     //搜索药品说明书(查看数据用)
     handleInputDrug(e) {
         this.setState({
-            drugId: e.target.value
+            drugIdList: e.target.value
          })
     }
     //搜索药品说明书(查看数据用)
     searchDrug() {
-        const { showDrugInfo } = this.props
-        this.setDrugInfo({id: this.state.drugId})
+        const { showDrugInfo, setDrugInfoMore } = this.props
+        const drugIdList = this.state.drugIdList.split(' ')
+        setDrugInfoMore({drugIdList: drugIdList})
         showDrugInfo && showDrugInfo();
 
     }

+ 10 - 3
src/components/Treat/index.jsx

@@ -38,7 +38,10 @@ class Treat extends Component {
     }
 
     render(){
-        const { generalTreat, treatment, treatItem, surgeryTreat, selectDrug, drugInfo, treatDesc, setOtherRecommend, setDrugInfo, showDrug, showDrugInfo,hideDrugInfo, title} = this.props;
+    
+    
+        const { generalTreat, treatment, treatItem, surgeryTreat, selectDrug, drugInfo, treatDesc, setOtherRecommend, setDrugInfo, showDrug, showDrugInfo,hideDrugInfo, title, drugInfoList, hideDrugInfoMore} = this.props;
+        const { setDrugInfoMore } = this.props
         return(
             <div   className={style['treat-wrapper']}>
                 <div className={style['treat-mask']}>
@@ -52,7 +55,9 @@ class Treat extends Component {
                                 selectDrug={selectDrug} 
                                 setOtherRecommend={ setOtherRecommend } 
                                 showDrugInfo = {showDrugInfo}
-                                setDrugInfo={ setDrugInfo }>
+                                setDrugInfo={ setDrugInfo }
+                                setDrugInfoMore = {setDrugInfoMore} //查询多条药品说明数据
+                            >
                         </DrugTreat> 
                         <GeneralTreat icon={surgicalIcon} title='手术治疗' titleStyle={{background:'#FAEAEA',opacity:'1', filter:'alpha(opacity=100);',filter:'progid:DXImageTransform.Microsoft.Alpha(opacity=100);'}} titleBg='#FAEAEA' generalTreat={surgeryTreat}></GeneralTreat>
                     </div>
@@ -71,7 +76,9 @@ class Treat extends Component {
                 </div>
                 
                 
-                {showDrug && drugInfo && <DrugInfo drugInfo = {drugInfo} hideDrugInfo = {hideDrugInfo}></DrugInfo>}
+                {/* {showDrug && drugInfo && <DrugInfo drugInfo = {drugInfo} hideDrugInfo = {hideDrugInfo}></DrugInfo>} */}
+                {/* 查询多个药品说明书 (添加数据查看药品说明书用)*/}
+                {showDrug && <DrugInfo drugInfoList = {drugInfoList} hideDrugInfoMore = {hideDrugInfoMore}></DrugInfo>}
             </div>
                 
             

+ 37 - 13
src/components/TreatDesc/DrugInfo/index.jsx

@@ -8,23 +8,47 @@ class DrugInfo extends Component {
     }
 
     render() {
-        const { drugInfo, hideDrugInfo } = this.props
-        return (<div className={style['drug-info-wrapper']}>
-                <h3 className={style['drug-title']}>{drugInfo.title}说明书  <img src={close} onClick={hideDrugInfo} className={style['close-drug-desc']}/> </h3>
-                { drugInfo && drugInfo.drugDesc.length > 0 && <div className={style['drug-desc-wrapper']}>
-                    <div className={style['drug-title1']}>{drugInfo.title}说明书</div>
-                    {drugInfo.drugDesc.map((item, index) =>{
-                        return <div className={style['drug-desc-item']}><span className={style['drug-desc-title']}>{item.title.trim()}</span> <div className={style['drug-desc-content']} dangerouslySetInnerHTML ={{__html: item.content}}></div> </div>
-                    })}
-                </div> }
-                { !drugInfo || (drugInfo && drugInfo.drugDesc.length === 0) && <div className={style['drug-desc-wrapper']}>
-                    <div>
-                        该药品暂无说明
-                    </div>
+        const { drugInfo, hideDrugInfo, drugInfoList,hideDrugInfoMore } = this.props
+        // return (<div className={style['drug-info-wrapper']}>
+        //         <h3 className={style['drug-title']}>{drugInfo.title}说明书  <img src={close} onClick={hideDrugInfo} className={style['close-drug-desc']}/> </h3>
+        //         { drugInfo && drugInfo.drugDesc.length > 0 && <div className={style['drug-desc-wrapper']}>
+        //             <div className={style['drug-title1']}>{drugInfo.title}说明书</div>
+        //             {drugInfo.drugDesc.map((item, index) =>{
+        //                 return <div className={style['drug-desc-item']}><span className={style['drug-desc-title']}>{item.title.trim()}</span> <div className={style['drug-desc-content']} dangerouslySetInnerHTML ={{__html: item.content}}></div> </div>
+        //             })}
+        //         </div> }
+        //         { !drugInfo || (drugInfo && drugInfo.drugDesc.length === 0) && <div className={style['drug-desc-wrapper']}>
+        //             <div>
+        //                 该药品暂无说明
+        //             </div>
                     
+        //         </div> }
+
+        // </div>)
+
+         return (<div className={style['drug-info-wrapper']}>
+                <h3 className={style['drug-title']}>说明书  <img src={close} onClick={hideDrugInfoMore} className={style['close-drug-desc']}/> </h3>
+                { drugInfoList && drugInfoList.length > 0 && <div className={style['drug-desc-wrapper']}>
+                    {drugInfoList.map((item,index) => {
+                        return <div>
+                            <h3 style={{height:' 50px', fontSize:'40px', fontWeight: '800'}}>{'【'+item.id+'】'}{item.name}说明书  </h3>
+                            {item.introduceDetailList&&item.introduceDetailList.length>0&&item.introduceDetailList.map((it, index) =>{
+                                return <div className={style['drug-desc-item']}><span className={style['drug-desc-title']}>{it.title.trim()}</span> <div className={style['drug-desc-content']} dangerouslySetInnerHTML ={{__html: it.content}}></div> </div>
+                            })}
+                             <br/>
+                            <br/> <br/> <br/> <br/>
+                        </div>
+                        
+                       
+
+                    })}
+                   
                 </div> }
+               
 
         </div>)
+
+
     }
 }
 

+ 11 - 1
src/containers/Treat.js

@@ -2,7 +2,7 @@ import React from 'react';
 import { connect } from 'react-redux';
 import Treat from '@components/Treat';
 import { SELECT_DRUG, SET_OTHER_DRUG, SET_DRUG_INFO, CLEAR_DRUG_INFO,HIDE_TREAT, CLEAR_TREAT, SHOW_DRUG_INFO, HIDE_DRUG_INFO } from '@store/types/treat.js';
-import { getInstroduce, getRecommendBasic } from '@store/async-actions/treat';
+import { getInstroduce, getRecommendBasic, getInstroduceMore } from '@store/async-actions/treat';
 import { ADD_SCHEME } from '@store/types/pushMessage.js'
 import { showDrugInfo } from '../store/actions/treat';
 
@@ -17,6 +17,7 @@ function mapStateToProps(state){
         drugInfo: treat.drugInfo,
         showDrug: treat.showDrugInfo,
         treatItem: treat.treatItem,
+        drugInfoList: treat.drugInfoList,   //药品说明书列表(查询多个药品说明书)
     }
 }
  
@@ -70,6 +71,15 @@ function mapDispatchToProps(dispatch) {
                 title: title,
                 treatment: treatment
             })
+        },
+        //查询多条药品说明数据(添加数据用)
+        setDrugInfoMore:(drugIdList) => {
+            dispatch(getInstroduceMore(drugIdList));
+        },
+        hideDrugInfoMore: () =>{
+            dispatch({
+                type: HIDE_DRUG_INFO
+            })
         }
     }
 }

+ 8 - 0
src/store/actions/treat.js

@@ -91,3 +91,11 @@ export const setTreatInfo = (state, action) => {
     return res;
 }
 
+//设置多个药品说明书(添加数据时查看数据用)
+export const setDrugInfoList = (state, action) => {
+    const res = JSON.parse(JSON.stringify(state));
+    const drugInfoList = action.drugInfoList;
+    res.drugInfoList = drugInfoList
+    return res
+}
+

+ 41 - 1
src/store/async-actions/treat.js

@@ -1,7 +1,7 @@
 import { json } from "@utils/ajax";
 import { SET_TREAT } from '@store/types/diagnosticList';
 import { ADD_DIAGNOSTIC, GET_DIAGNOSTIC_STR} from '@store/types/diagnosticList';
-import { SET_DRUG_INFO, SET_TREATMENT, SET_TREAT_INFO, SET_RECOMMEND_BASIC } from '@store/types/treat';
+import { SET_DRUG_INFO, SET_TREATMENT, SET_TREAT_INFO, SET_RECOMMEND_BASIC, SET_DRUG_INFO_LIST } from '@store/types/treat';
 import {storageLocal,getEMRParams} from '@utils/tools';
 import { isAddMainSuit } from '@store/async-actions/diagnosticList';
 
@@ -248,6 +248,46 @@ export const getInstroduce = (item)=>{
 
 }
 
+export const  getInstroduceMore = (drugIdList) =>{
+    return (dispatch, getState) =>{
+        let drugInfoList = [];
+        for (let i = 0; i < drugIdList.drugIdList.length; i++ ) {
+            const url = '/api/icss/introduceInfo/getByQuestionId';
+            const params = {
+                questionId: drugIdList.drugIdList[i],
+                type: 8,
+                position: 5
+            }
+            json(url, params)
+            .then((data)=>{
+                    if(data.data.data) {
+                        drugInfoList.push(data.data.data)
+                        dispatch({
+                            type: SET_DRUG_INFO_LIST,
+                            drugInfoList: drugInfoList,
+                        })
+                        console.log('drugInfoList', drugInfoList)
+                    } else {
+                        drugInfoList.push([])
+                        dispatch({
+                            type: SET_DRUG_INFO_LIST,
+                            drugInfoList: drugInfoList,
+                        })
+                    }
+                    
+            }).catch((e) => {
+                console.log(e)
+            })
+
+
+
+
+        }
+        
+
+    }
+}
+
 //其他推荐推荐依据不用展示
 // export const getRecommendBasic = (item)=>{
     

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

@@ -1,5 +1,5 @@
-import { SELECT_DRUG, SET_TREAT_INFO, SET_OTHER_DRUG, SET_DRUG_INFO, CLEAR_DRUG_INFO,SHOW_TREAT, HIDE_TREAT, CLEAR_TREAT, SHOW_DRUG_INFO, HIDE_DRUG_INFO, SET_GENERAL_TREAT, SET_TREATMENT, SET_SURGERY_TREAT, SET_RECOMMEND_BASIC } from '../types/treat'
-import { selectDrug, setTreatInfo, setOtherDrug, setDrugInfo, clearDrugInfo, showTreat, hideTreat, clearTreat, showDrugInfo, hideDrugInfo, setTreatment, setGeneralTreat, setSurgeryTreat, setRecommendBasic } from '../actions/treat'
+import { SELECT_DRUG, SET_TREAT_INFO, SET_OTHER_DRUG, SET_DRUG_INFO, CLEAR_DRUG_INFO,SHOW_TREAT, HIDE_TREAT, CLEAR_TREAT, SHOW_DRUG_INFO, HIDE_DRUG_INFO, SET_GENERAL_TREAT, SET_TREATMENT, SET_SURGERY_TREAT, SET_RECOMMEND_BASIC, SET_DRUG_INFO_LIST } from '../types/treat'
+import { selectDrug, setTreatInfo, setOtherDrug, setDrugInfo, clearDrugInfo, showTreat, hideTreat, clearTreat, showDrugInfo, hideDrugInfo, setTreatment, setGeneralTreat, setSurgeryTreat, setRecommendBasic, setDrugInfoList } from '../actions/treat'
 const initState = {
     show: false, //治疗方案显示隐藏
     showDrugInfo: false, //药品信息显示隐藏
@@ -195,6 +195,8 @@ export default function(state=initState, action){
             return setTreatInfo(state, action);
         case CLEAR_DRUG_INFO:
             return clearDrugInfo(state, action);
+        case SET_DRUG_INFO_LIST:
+        return setDrugInfoList(state, action);
         default:
             return state
     }

+ 1 - 0
src/store/types/treat.js

@@ -12,3 +12,4 @@ export const SET_SURGERY_TREAT = 'SET_SURGERY_TREAT'; //设置手术治疗
 export const SET_TREATMENT = 'SET_TREATMENT' //设置治疗方案
 export const SET_RECOMMEND_BASIC = 'SET_RECOMMEND_BASIC'//设置其他推荐推荐依据
 export const SET_TREAT_INFO = 'SET_TREAT_INFO' //设置治疗方案信息(name,id等)
+export const SET_DRUG_INFO_LIST = 'SET_DRUG_INFO_LIST' //查询多个药品说明书(添加数据时查看药品说明用)