Browse Source

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

zhouna 6 years atrás
parent
commit
0781ae9355

+ 1 - 1
src/components/CopyRight/index.less

@@ -2,7 +2,7 @@
   position: absolute;
   bottom: 0px;      //页面布局
   z-index: 40;
-  width: 418px;
+  width: 450px;
   .disTips{
     padding: 10px 20px 0px 20px;
     font-size: 10px;

+ 69 - 0
src/components/Treat/AdverseReactions/index.jsx

@@ -0,0 +1,69 @@
+import React, { Component } from 'react';
+import style from './index.less';
+import info2 from './../img/info2.png';
+import info3 from './../img/info3.png';
+import $ from "jquery";
+
+class AdverseReactions extends Component {
+    constructor(props){
+        super(props);
+        this.state = {
+            currentIndex: -1
+        }
+        this.handleMouseLeaveDrug = this.handleMouseLeaveDrug.bind(this);
+        this.handleMouseLeaveImg = this.handleMouseLeaveImg.bind(this);
+        this.setDrugInfo = this.setDrugInfo.bind(this);
+    }
+    handleMouseEnterDrug(index, item) {
+        const drugNameWidth = parseInt($('#'+item.medicitionName)[0].offsetWidth)
+        const imgLeft = drugNameWidth/2-8
+        $('#'+item.medicitionName).find('img').css('left', imgLeft)
+        this.setState({
+            currentIndex: index,
+        })
+    }
+    handleMouseLeaveDrug() {
+        this.setState({
+            currentIndex: -1, 
+        })
+    }
+    handleMouseEnterImg() {
+        this.setState({
+            hasEnterImg: true
+        })
+    }
+    handleMouseLeaveImg() {
+        this.setState({
+            hasEnterImg: false
+        })
+    }
+    setDrugInfo(item) {
+        const { setDrugInfo } = this.props;
+        setDrugInfo && setDrugInfo(item);
+    }
+
+
+    render() {
+        const { icon, titleStyle,titleBg, filter, title, showDrugInfo, setDrugInfo, adversReactionList } = this.props
+        return(
+            <div className={style['last-treat-wrapper']}>
+                { console.log('adversReactionList', adversReactionList) }
+                <div className={style['last-treat-title-box']} style={titleStyle}></div>
+                <div className={style['last-treat-title']} ><img className={style['last-treat-icon']} src={icon}/>{title}</div>
+                {adversReactionList.map((item, index) => {
+                    return (<div key={item.id}><span>{item.tagName}:</span>
+                        {item.details.map((item, index) => {
+                            return <span key={item.name}>
+                                <input type="checkbox" checked={item.checked} id={item.name} onChange={()=>{console.log('change')}}/>
+                                <label for={item.name}> {item.name} </label>
+                            </span>
+                        })}
+                    </div>)
+                })}
+            </div>
+        )
+    }
+
+}
+
+export default AdverseReactions;

+ 27 - 0
src/components/Treat/AdverseReactions/index.less

@@ -0,0 +1,27 @@
+.last-treat-wrapper {
+    position: relative;
+    padding: 10px 0 0 0;
+}
+.last-treat-title-box {
+    height: 36px;
+    line-height: 36px;
+    background: rgb(47,199,156);
+    opacity: 0.1;
+    filter:alpha(opacity=10);
+    -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(opacity=10);";
+}
+.last-treat-title {
+    position: absolute;
+    width: 100%;
+    top: 10px;
+    height: 36px;
+    line-height: 36px;
+    font-weight: bold;
+}
+.last-treat-icon {
+    width: 16px;
+    float: left;
+    margin: 10px;
+}
+
+

+ 77 - 0
src/components/Treat/LastTreat/LastDrug/index.jsx

@@ -0,0 +1,77 @@
+import React, { Component } from 'react';
+import style from './index.less';
+import info2 from './../../img/info2.png';
+import info3 from './../../img/info3.png';
+import $ from "jquery";
+
+class LastDrug extends Component {
+    constructor(props){
+        super(props);
+        this.state = {
+            currentIndex: -1
+        }
+        this.handleMouseLeaveDrug = this.handleMouseLeaveDrug.bind(this);
+        this.handleMouseLeaveImg = this.handleMouseLeaveImg.bind(this);
+        this.setDrugInfo = this.setDrugInfo.bind(this);
+    }
+    handleMouseEnterDrug(index, item) {
+        const drugNameWidth = parseInt($('#'+item.medicitionName)[0].offsetWidth)
+        const imgLeft = drugNameWidth/2-8
+        $('#'+item.medicitionName).find('img').css('left', imgLeft)
+        this.setState({
+            currentIndex: index,
+        })
+    }
+    handleMouseLeaveDrug() {
+        this.setState({
+            currentIndex: -1, 
+        })
+    }
+    handleMouseEnterImg() {
+        this.setState({
+            hasEnterImg: true
+        })
+    }
+    handleMouseLeaveImg() {
+        this.setState({
+            hasEnterImg: false
+        })
+    }
+    setDrugInfo(item) {
+        const { setDrugInfo } = this.props;
+        setDrugInfo && setDrugInfo(item);
+    }
+
+
+    render() {
+        const { icon, titleStyle,titleBg, filter, title, lastDrugList, showDrugInfo } = this.props
+        const  { currentIndex, hasEnterImg } = this.state
+        return(
+             <div className={style['last-common-box']}>
+                <div className={style['last-common-title']}>{title}</div>
+                <div className={style['last-common-list']}>
+                    {lastDrugList.map((item, index) => {
+                        return<span
+                            onMouseEnter={this.handleMouseEnterDrug.bind(this, index, item)}
+                            onMouseLeave = {this.handleMouseLeaveDrug}
+                            id={item.medicitionName}
+                            className={style['last-common-warpper']}
+                            > 
+                            {item.medicitionName} 
+                            {<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();}}/>}
+                            {index == lastDrugList.length-1 ?  '' : <span>,</span>}
+                        </span>
+                    })}
+                </div>
+            </div>
+        )
+    }
+
+}
+
+export default LastDrug;

+ 14 - 0
src/components/Treat/LastTreat/LastDrug/index.less

@@ -0,0 +1,14 @@
+.last-common-title {
+    height: 30px;
+    line-height: 30px;
+}
+.last-common-warpper {
+    position: relative;
+    margin: 0 20px 0 0
+}
+.info-img {
+    position: absolute;
+    width: 15px;
+    position: absolute;
+    top: -15px;
+}

+ 34 - 0
src/components/Treat/LastTreat/index.jsx

@@ -0,0 +1,34 @@
+import React, { Component } from 'react';
+import style from './index.less';
+import LastDrug from './LastDrug/index.jsx';
+import info2 from './../img/info2.png';
+import info3 from './../img/info3.png';
+import $ from "jquery";
+
+class LastTreat extends Component {
+    constructor(props){
+        super(props);
+        this.state = {
+            currentIndex: -1
+        }
+    }
+   
+
+    render() {
+        const { icon, titleStyle,titleBg, filter, title, lastTreat, showDrugInfo, setDrugInfo } = this.props
+        const { chronicDisMedica, commonDisMedica } = lastTreat
+        return(
+            chronicDisMedica && chronicDisMedica.length > 0 && commonDisMedica && commonDisMedica.length > 0 &&
+            <div className={style['last-treat-wrapper']}>
+                {console.log('lasttreatTreat', lastTreat)}
+                <div className={style['last-treat-title-box']} style={titleStyle}></div>
+                <div className={style['last-treat-title']} ><img className={style['last-treat-icon']} src={icon}/>{title}</div>
+                {commonDisMedica.length > 0 && <LastDrug title='普通病用药内容' lastDrugList = {commonDisMedica}  showDrugInfo={showDrugInfo} setDrugInfo={setDrugInfo}></LastDrug>}
+                {chronicDisMedica.length > 0 && <LastDrug title='慢病用药内容' lastDrugList = {chronicDisMedica}  showDrugInfo={showDrugInfo} setDrugInfo={setDrugInfo}></LastDrug>}
+            </div>
+        )
+    }
+
+}
+
+export default LastTreat;

+ 27 - 0
src/components/Treat/LastTreat/index.less

@@ -0,0 +1,27 @@
+.last-treat-wrapper {
+    position: relative;
+    padding: 10px 0 0 0;
+}
+.last-treat-title-box {
+    height: 36px;
+    line-height: 36px;
+    background: rgb(47,199,156);
+    opacity: 0.1;
+    filter:alpha(opacity=10);
+    -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(opacity=10);";
+}
+.last-treat-title {
+    position: absolute;
+    width: 100%;
+    top: 10px;
+    height: 36px;
+    line-height: 36px;
+    font-weight: bold;
+}
+.last-treat-icon {
+    width: 16px;
+    float: left;
+    margin: 10px;
+}
+
+

+ 5 - 1
src/components/Treat/index.jsx

@@ -2,6 +2,8 @@ import React,{ Component } from 'react';
 import style from './index.less';
 import GeneralTreat from './GeneralTreat/index.jsx';
 import DrugTreat from './DrugTreat/index.jsx';
+import LastTreat from './LastTreat/index.jsx';
+import AdverseReactions from './AdverseReactions/index.jsx';
 import TreatDesc from '@components/TreatDesc'
 import {dragBox,windowRemoveEventHandler} from '@utils/tools'
 import DrugInfo from '@components/TreatDesc/DrugInfo';
@@ -51,7 +53,7 @@ class Treat extends Component {
       $('#drugWrapper').css({'z-index': 301});
     }
     render(){
-        const {setDrugInfoMore,treatIndex,treatIndexSet, generalTreat, treatment, treatItem, surgeryTreat, selectDrug, drugInfo, treatDesc, setOtherRecommend, setDrugInfo, showDrug, showDrugInfo,hideDrugInfo, title, drugInfoList, hideDrugInfoMore} = this.props;
+        const {setDrugInfoMore,treatIndex,treatIndexSet, generalTreat, treatment, treatItem, surgeryTreat, lastTreat, selectDrug, drugInfo, treatDesc, setOtherRecommend, setDrugInfo, showDrug, showDrugInfo,hideDrugInfo, title, drugInfoList, hideDrugInfoMore, adversReactionList} = this.props;
         const { zIndex,show } = this.state
         return(
             <div   className={style['treat-wrapper']}>
@@ -63,6 +65,8 @@ class Treat extends Component {
 
                     <div className={style['treat-inner-box']}>
                         <GeneralTreat icon={generalIcon} title='一般治疗'   generalTreat={generalTreat}></GeneralTreat>
+                        {/* <LastTreat icon={generalIcon} title='上次用药情况' lastTreat={lastTreat}  showDrugInfo = {showDrugInfo} setDrugInfo={ setDrugInfo }></LastTreat>
+                        <AdverseReactions icon={generalIcon} title='不良反应' adversReactionList = {adversReactionList}></AdverseReactions> */}
                         <DrugTreat treatment={ treatment } 
                                 selectDrug={selectDrug} 
                                 setOtherRecommend={ setOtherRecommend } 

+ 11 - 9
src/containers/Treat.js

@@ -8,16 +8,18 @@ import { showDrugInfo } from '../store/actions/treat';
 
 
 function mapStateToProps(state){
-    const { treat } = state;
+    const { treatment, generalTreat, surgeryTreat, lastTreat, adversReactionList, treatDesc, drugInfo, showDrugInfo, treatItem , drugInfoList} = state.treat;
     return {
-        treatment: treat.treatment,
-        generalTreat: treat.generalTreat,
-        surgeryTreat: treat.surgeryTreat,
-        treatDesc: treat.treatDesc,
-        drugInfo: treat.drugInfo,
-        showDrug: treat.showDrugInfo,
-        treatItem: treat.treatItem,
-        drugInfoList: treat.drugInfoList,   //药品说明书列表(查询多个药品说明书)
+        treatment: treatment,
+        generalTreat: generalTreat,
+        surgeryTreat: surgeryTreat,
+        lastTreat: lastTreat,
+        adversReactionList: adversReactionList,
+        treatDesc: treatDesc,
+        drugInfo: drugInfo,
+        showDrug: showDrugInfo,
+        treatItem: treatItem,
+        drugInfoList: drugInfoList,   //药品说明书列表(查询多个药品说明书)
 
     }
 }

+ 76 - 0
src/store/reducers/treat.js

@@ -68,6 +68,82 @@ const initState = {
     //         ]
     //     }
     // ],
+    lastTreat: {
+        commonDisMedica: [
+            {
+                medicitionName: '泮托拉唑',
+                id: 145
+            },
+            {
+                medicitionName: '奥美拉唑',
+                id: 341
+            }
+        ],
+        chronicDisMedica: [
+            {
+                medicitionName: '兰索拉唑',
+                id: 342
+            },
+            {
+                medicitionName: '山莨菪碱',
+                id: 344
+            }
+        ],
+    },
+    adversReactionList:[
+        {
+            id: 40772,
+            name: '低血糖反应',
+            tagName: '低血糖反应',
+            showInfo: '0',
+            controlType: 2,
+            details: [
+                {
+                    name: "无",
+                    value: 0
+                },
+                {
+                    name: "偶尔",
+                    value: 0
+                },
+                {
+                    name: "频",
+                    value: 0
+                }
+            ]
+
+        },
+        {
+            id: 40773,
+            name: '胃肠道不良反应',
+            tagName: '胃肠道不良反应',
+            showInfo: '0',
+            controlType: 2,
+            details: [
+                {
+                    name: "腹胀 ",
+                    value: 0
+                },
+                {
+                    name: "厌食",
+                    value: 0
+                },
+                {
+                    name: "嗳气",
+                    value: 0
+                },
+                {
+                    name: "恶心",
+                    value: 0
+                },
+                {
+                    name: "呕吐",
+                    value: 0
+                }
+            ]
+
+        }
+    ],
     treatDesc:{
         title: '药品推荐',
     }