Jelajahi Sumber

Merge branch 'optimize-zxc' into optimize-ll

Luolei 6 tahun lalu
induk
melakukan
cf9d835e17

+ 0 - 4
src/components/DiagnosticList/index.jsx

@@ -5,11 +5,7 @@ import del_on from './img/delete-on.png'
 import diagUp from './img/diagUp.png'
 import diagDown from './img/diagDown.png'
 import manageIcon from '@common/images/manage.png';
-<<<<<<< HEAD
 import { ConfirmModal, Message, ComplexModal, Footer } from '@commonComp';
-=======
-import {ConfirmModal, Message,ComplexModal,Footer,Loading} from '@commonComp';
->>>>>>> optimize
 import Notify from '@commonComp/Notify';
 import Treat from '@containers/Treat'
 import store from '@store';

+ 8 - 9
src/components/Treat/AdverseReactions/index.jsx

@@ -37,15 +37,16 @@ class AdverseReactions extends Component {
         this.setState({
             hasEnterImg: false
         })
-    }
+
+     }
     setDrugInfo(item) {
         const { setDrugInfo } = this.props;
-        setDrugInfo && setDrugInfo(item, 10, 6);
+        setDrugInfo && setDrugInfo({name: item.name, type: 10, position: 6});
     }
 
 
     render() {
-        const { icon, titleStyle,titleBg, filter, title,  adversReactionList, showDrugInfo, setDrugInfo } = this.props
+        const { icon, titleStyle,titleBg, filter, title,  adversReactionList, setDrugInfo } = this.props
         const  { currentIndex, hasEnterImg } = this.state
         return(
             <div className={style['last-treat-wrapper']}>
@@ -54,22 +55,20 @@ class AdverseReactions extends Component {
                 {/* {console.log('adversReactionList', adversReactionList)} */}
 
                 {adversReactionList.map((item, index) => {
-                    return (<div className={style['adverse-reactions-item']} key={item.id}>
-                    <span className={style['last-treat-name-box']}
-                        
-                    >   
+                    return (<div className={style['adverse-reactions-item']} key={item.conceptId}>
+                    <span className={style['last-treat-name-box']}>   
                         <span   
                                 className={style['last-treat-big-name-box']} 
                                 onMouseEnter={this.handleMouseEnterDrug.bind(this, index, item)}
                                 onMouseLeave = {this.handleMouseLeaveDrug}
                         >
-                            <span className={style['last-treat-big-name']} >{item.tagName}:
+                            <span className={style['last-treat-big-name']} >{item.name}:
                                 {<img className={style['info-img']}  
                                     style ={currentIndex === index  ? {display: "inline-block"} : {display: "none"}}
                                     src={currentIndex === index ?(hasEnterImg ? info3 : info2 ): info2} 
                                     onMouseEnter={this.handleMouseEnterImg.bind(this)}
                                     onMouseLeave = {this.handleMouseLeaveImg}
-                                    onClick={() =>{this.setDrugInfo(item);showDrugInfo();}}/>}
+                                    onClick={this.setDrugInfo.bind(this, item)}/>}
                             </span>
                         </span>
                         

+ 3 - 3
src/components/Treat/DrugHistory/LastDrug/index.jsx

@@ -39,12 +39,12 @@ class LastDrug extends Component {
     }
     setDrugInfo(item) {
         const { setDrugInfo } = this.props;
-        setDrugInfo && setDrugInfo(item,8,5);
+        setDrugInfo && setDrugInfo({name: item.medicitionName,type: 8,position: 5});
     }
 
 
     render() {
-        const { icon, titleStyle,titleBg, filter, title, lastDrugList, showDrugInfo } = this.props
+        const { icon, titleStyle,titleBg, filter, title, lastDrugList } = this.props
         const  { currentIndex, hasEnterImg } = this.state
         return(
              <div className={style['last-common-box']}>
@@ -63,7 +63,7 @@ class LastDrug extends Component {
                                 src={currentIndex === index ?(hasEnterImg ? info3 : info2 ): info2} 
                                 onMouseEnter={this.handleMouseEnterImg.bind(this)}
                                 onMouseLeave = {this.handleMouseLeaveImg}
-                                onClick={() =>{this.setDrugInfo(item);showDrugInfo();}}/>}
+                                onClick={this.setDrugInfo.bind(this, item)}/>}
                             {index == lastDrugList.length-1 ?  '' : <span>,</span>}
                         </span>
                     })}

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

@@ -67,10 +67,9 @@ class DrugTreat extends Component {
     }
     //搜索药品说明书(查看数据用)
     searchDrug() {
-        const { showDrugInfo, setDrugInfoMore } = this.props
+        const { setDrugInfoMore } = this.props
         const drugIdList = this.state.drugIdList.split(' ')
         setDrugInfoMore({drugIdList: drugIdList})
-        showDrugInfo && showDrugInfo();
     }
     
     showTreatDesc() {
@@ -110,7 +109,7 @@ class DrugTreat extends Component {
                                               src={currentIndex === index ? (ii === currentImg ? (hasEnterImg ? info3 : info2) : info2): info2} 
                                               onMouseEnter={this.handleMouseEnterImg.bind(this, ii, index)}
                                               onMouseLeave = {this.handleMouseLeaveImg}
-                                              onClick={() =>{this.setDrugInfo(it);showDrugInfo();}}/>}
+                                              onClick={this.setDrugInfo.bind(this,it)}/>}
                                         </span>
                                         
                                         

+ 3 - 1
src/components/TreatDesc/DrugInfo/index.jsx

@@ -3,6 +3,8 @@ import style from './index.less';
 import close from './../img/close.png';
 import $ from "jquery";
 import {dragBox} from '@utils/drag'
+import { imageUrlPrefix } from '@utils/config.js';
+
 
 
 class DrugInfo extends Component {
@@ -62,7 +64,7 @@ class DrugInfo extends Component {
                     {drugInfo.drugDesc.map((item, index) =>{
                         return <div className={style['drug-desc-item']} id={item.title.trim()}>
                             <div className={style['drug-desc-title']} >{item.title.trim()}</div> 
-                            <div className={style['drug-desc-content']} dangerouslySetInnerHTML ={{__html: item.content}}></div> 
+                            <div className={style['drug-desc-content']} dangerouslySetInnerHTML ={{__html: item.content.replace(/{imageUrlPrefix}/g, imageUrlPrefix)}}></div> 
                         </div>
                     })}
                     <div className={style['content-menu-box']}>

+ 2 - 3
src/components/TreatDesc/index.jsx

@@ -62,11 +62,10 @@ class TreatDesc extends Component {
     }
 
     render(){
-        const  { treatment, treatDesc, setDrugInfo, showDrugInfo} = this.props
+        const  { treatment, treatDesc, setDrugInfo} = this.props
         const { title, basic, otherDrugIndex, drugDesc} = treatDesc
         const { currentIndex, hasEnterImg } = this.state
         return (treatment && treatment.length >0 && <div  className={style['treat-desc-box']}>
-            
             {title && title === '药品推荐' ? <div className={style['similar-drug-box']} id='treatDescBox'>
                 {/* { basic && basic.length > 0 && <div> //推荐依据不需要展示
                     <h3 className={style['recommend-title']}>推荐依据</h3>
@@ -98,7 +97,7 @@ class TreatDesc extends Component {
                                 src={currentIndex === index ?  (hasEnterImg ? info3 : info2) : info2} 
                                 onMouseEnter={this.handleMouseEnterImg.bind(this, index)}
                                 onMouseLeave = {this.handleMouseLeaveImg}
-                                onClick={() =>{setDrugInfo(item,8,5);showDrugInfo();}}
+                                onClick={() =>{setDrugInfo({name: item.medicitionName, type: 8, position: 5})}}
                                 />}
                         </span>              
                         

+ 3 - 5
src/containers/Treat.js

@@ -4,7 +4,7 @@ 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, CHANGE_REACT,  DEL_REACT, SET_FOLLOW_UP } from '@store/types/treat.js';
 import { getInstroduce, getRecommendBasic, getInstroduceMore, commonTreatAddToAdvice, saveAllAdverseReactions, setAllFollowUp } from '@store/async-actions/treat';
 import { ADD_SCHEME } from '@store/types/pushMessage.js'
-import { showDrugInfo } from '../store/actions/treat';
+import { getConceptDetail } from '@store/async-actions/pushMessage';
 
 
 function mapStateToProps(state){
@@ -51,7 +51,7 @@ function mapDispatchToProps(dispatch) {
             // dispatch(getRecommendBasic(item))
         },
         setDrugInfo: (item) => {
-            dispatch(getInstroduce(item));
+            dispatch(getConceptDetail(item));
         },
         hideTreat: () => {
             dispatch({
@@ -64,9 +64,7 @@ function mapDispatchToProps(dispatch) {
             })
         },
         showDrugInfo: () => {
-            dispatch({
-                type: SHOW_DRUG_INFO
-            })
+            
         },
         hideDrugInfo: () =>{
             

+ 4 - 4
src/store/actions/treat.js

@@ -149,7 +149,7 @@ export const setALLAdverseReactions =(state, action) => {
     let allAdversReactionList = res.allAdversReactionList
     let hasAdversReactionList = false
     for( let i = 0; i < allAdversReactionList.length; i++) {
-        if (action.adversReactionList.id == allAdversReactionList[i].id) {
+        if (action.adversReactionList.conceptId == allAdversReactionList[i].conceptId) {
             allAdversReactionList[i] = action.adversReactionList
             hasAdversReactionList = true
         } 
@@ -179,7 +179,7 @@ export const delReact = (state, action) => {
     const res = JSON.parse(JSON.stringify(state));
     let allAdversReactionList = res.allAdversReactionList;
     for( let i = 0; i < allAdversReactionList.length; i++) {
-        if (action.item.id == allAdversReactionList[i].id) {
+        if (action.item.conceptId == allAdversReactionList[i].conceptId) {
             allAdversReactionList.splice(i, 1)
         } 
     }
@@ -202,7 +202,7 @@ export const setAllFollowUp = (state, action) => {
     let followUpList = res.followUpList
     let hasfollowUp = false
     for( let i = 0; i < followUpList.length; i++) {
-        if (action.followUp.id == followUpList[i].id) {
+        if (action.followUp.conceptId == followUpList[i].conceptId) {
             followUpList[i] = action.followUp
             hasfollowUp = true
         } 
@@ -218,7 +218,7 @@ export const delFollowUp = (state, action) => {
     const res = JSON.parse(JSON.stringify(state));
     let followUpList = res.followUpList;
     for( let i = 0; i < followUpList.length; i++) {
-        if (action.delItem.id == followUpList[i].id) {
+        if (action.delItem.conceptId == followUpList[i].conceptId) {
             followUpList.splice(i, 1)
         } 
     }

+ 13 - 4
src/store/async-actions/pushMessage.js

@@ -1,5 +1,6 @@
 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 '../types/pushMessage';
+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 { 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";
@@ -121,7 +122,7 @@ export const getConceptDetail = (item) => {
 
         json(api.getConceptDetail, params).then((res) => {
             if(res.data.code == '0') {
-                if(item.position == '1') {
+                if(item.position == '1') {  //右侧提示信息
                     if(item.type == '5' || item.type == '6') {
                         dispatch({
                             type: SET_TIPS,
@@ -135,8 +136,16 @@ export const getConceptDetail = (item) => {
                         })
                     }
                     
-                } else if(item.position == '2'){
-
+                } else if(item.position == '5' || item.position == '6'){    //药品或不良反应说明
+                    dispatch({
+                        type: SET_DRUG_INFO,
+                        instroduce: res.data.data.details,
+                        name: item.name,
+                        tagType: item.type
+                    })
+                    dispatch({
+                        type: SHOW_DRUG_INFO
+                    })
                 }
             } else {
                 Notify.info('提示信息未维护')

+ 48 - 50
src/store/async-actions/treat.js

@@ -19,7 +19,6 @@ export const addDiagnostic = (item) => {
             const state = getState();
             let url = api.pushTreatment;
             const emrData = getEMRParams();
-            console.log('emrData', emrData)
             const diagnosticList = state.diagnosticList.diagnosticList;
             let diag = '';
             if(diagnosticList) {
@@ -62,7 +61,7 @@ export const addDiagnostic = (item) => {
                     getChronic().then(() =>{
                     chronicList = JSON.parse(storageLocal.get('chronic'));
                         for(let i=0; i<chronicList.length; i++){
-                            if(chronicList[i].id==item.id&&chronicList[i].name==item.name){ //判断某个病是否为慢病
+                            if(chronicList[i].conceptId==item.conceptId&&chronicList[i].name==item.name){ //判断某个病是否为慢病
                                 params.disType = 1
                             }
                         }
@@ -71,7 +70,7 @@ export const addDiagnostic = (item) => {
                     });
                 } else {
                     for(let i=0; i<chronicList.length; i++){
-                        if(chronicList[i].id==item.id&&chronicList[i].name==item.name){
+                        if(chronicList[i].conceptId==item.conceptId&&chronicList[i].name==item.name){
                             params.disType = 1
                         }
                     }
@@ -170,7 +169,7 @@ export const getTreatResult = (item) =>{
                 getChronic().then(() =>{
                     chronicList = JSON.parse(storageLocal.get('chronic'));
                     for(let i=0; i<chronicList.length; i++){
-                        if(chronicList[i].id==item.id&&chronicList[i].name==item.name){
+                        if(chronicList[i].conceptId==item.conceptId&&chronicList[i].name==item.name){
                             params.disType = 1
                         }
                     }
@@ -179,7 +178,7 @@ export const getTreatResult = (item) =>{
                 });
             } else {
                 for(let i=0; i<chronicList.length; i++){
-                    if(chronicList[i].id==item.id&&chronicList[i].name==item.name){
+                    if(chronicList[i].conceptId==item.conceptId&&chronicList[i].name==item.name){
                         params.disType = 1
                     }
                 }
@@ -217,10 +216,10 @@ function getTreatment(item, dispatch, state,url,params, isChronic) {
                      const allAdversReactionList = state.treat.allAdversReactionList
                      if(allAdversReactionList) {
                          for(let i = 0; i < allAdversReactionList.length; i++) {
-                             if(item.id == allAdversReactionList[i].id) {    //判断是否存过不良反应
+                             if(item.conceptId == allAdversReactionList[i].conceptId) {    //判断是否存过不良反应
                                  for (let j = 0; j < adverseReactions.length; j++) { //判断不良反应是否有相同的不良反应,如果有,替换
                                      for(let z = 0; z < allAdversReactionList[i].adversReactionList.length; z++) {
-                                         if(adverseReactions[j].id == allAdversReactionList[i].adversReactionList[z].id) {
+                                         if(adverseReactions[j].conceptId == allAdversReactionList[i].adversReactionList[z].conceptId) {
                                              for(let x = 0; x < allAdversReactionList[i].adversReactionList[z].details.length; x++) {
                                                  for(let y = 0; y < adverseReactions[j].details.length; y++) {//判断每一项是否选择过
                                                      if(allAdversReactionList[i].adversReactionList[z].details[x].name == adverseReactions[j].details[y].name && allAdversReactionList[i].adversReactionList[z].details[x].select) {
@@ -241,7 +240,7 @@ function getTreatment(item, dispatch, state,url,params, isChronic) {
                  if(isChronic) {
                      let chronicList = JSON.parse(storageLocal.get('chronic'));
                      for(let i=0; i<chronicList.length; i++){
-                         if(chronicList[i].id==item.id&&chronicList[i].name==item.name){ //判断某个病是否为慢病
+                         if(chronicList[i].conceptId==item.conceptId&&chronicList[i].name==item.name){ //判断某个病是否为慢病
                              followUp = '2周';
                          }
                      }
@@ -251,7 +250,7 @@ function getTreatment(item, dispatch, state,url,params, isChronic) {
                      const followUpList = state.treat.followUpList
                      if(followUpList) {  //判断之前有没有保存过的回访时间,如果有替换掉
                          for(let i = 0; i < followUpList.length; i++) {
-                             if(item.id == followUpList[i].id) {
+                             if(item.conceptId == followUpList[i].conceptId) {
                                  followUp = followUpList[i].followUp
                              }
                          }
@@ -287,7 +286,7 @@ export const saveAllAdverseReactions = (item) => {
         dispatch({
             type: SET_ALL_ADVERSE_REACTIONS,
             adversReactionList: {
-                'id': item.id,
+                'conceptId': item.conceptId,
                 'adversReactionList': adversReactionList
             }
         })
@@ -303,7 +302,7 @@ export const setAllFollowUp = (item) => {
         dispatch({
             type: SET_ALL_FOLLOW_UP,
             followUp: {
-                'id': item.id,
+                'conceptId': item.conceptId,
                 'followUp': followUp
             }
         })
@@ -313,27 +312,26 @@ export const setAllFollowUp = (item) => {
 export const getInstroduce = (item, type, position)=>{
 
     return (dispatch, getState) =>{
-        const url = '/conceptDetail/getConceptDetail';
         const params = {
             name: item.name,
             type: item.type,
             position: item.position
         }
-        json(url, params)
+        json(api.getConceptDetail, params)
         .then((data)=>{
-                if(data.data.data) {
+                if(data.data.code == '0') {
                     dispatch({
                         type: SET_DRUG_INFO,
                         instroduce: data.data.data.introduceDetailList,
-                        name: type ==8 ?item.medicitionName : type == 10 ? item.tagName : '',
-                        tagType: type
+                        name: item.name,
+                        tagType: item.type
                     })
                 } else {
                     dispatch({
                         type: SET_DRUG_INFO,
                         instroduce: [],
-                        name: type ==8 ?item.medicitionName : type == 10 ? item.tagName : '',
-                        tagType: type
+                        name: item.name,
+                        tagType: item.type
                     })
                 }
                 
@@ -345,51 +343,51 @@ export const getInstroduce = (item, type, position)=>{
 
 }
 
-export const  getInstroduceMore = (drugIdList) =>{
-    return (dispatch, getState) =>{
-        let drugInfoList = [];
-        for (let i = 0; i < drugIdList.drugIdList.length; i++ ) {
-            const url = '/conceptDetail/getConceptDetail';
-            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,
-                        })
-                    } else {
-                        drugInfoList.push([])
-                        dispatch({
-                            type: SET_DRUG_INFO_LIST,
-                            drugInfoList: drugInfoList,
-                        })
-                    }
+// export const  getInstroduceMore = (drugIdList) =>{
+//     return (dispatch, getState) =>{
+//         let drugInfoList = [];
+//         for (let i = 0; i < drugIdList.drugIdList.length; i++ ) {
+//             const url = '/conceptDetail/getConceptDetail';
+//             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,
+//                         })
+//                     } else {
+//                         drugInfoList.push([])
+//                         dispatch({
+//                             type: SET_DRUG_INFO_LIST,
+//                             drugInfoList: drugInfoList,
+//                         })
+//                     }
                     
-            }).catch((e) => {
-                console.log(e)
-            })
+//             }).catch((e) => {
+//                 console.log(e)
+//             })
 
 
 
 
-        }
+//         }
         
 
-    }
-}
+//     }
+// }
 
 //一般治疗添加到医嘱
 export const commonTreatAddToAdvice = () => {
     return (dispatch, getState) => {
         const state = getState();
         const followUp = state.treat.followUp
-        if(state.treat.treatItem.id === state.diagnosticList.diagnosticList[0].id && state.treat.isFirstMainDiag) {
+        if(state.treat.treatItem.conceptId === state.diagnosticList.diagnosticList[0].conceptId && state.treat.isFirstMainDiag) {
             dispatch({
                 type: IS_FIRST_MAIN_DIAG
             })