zhangxc 6 gadi atpakaļ
vecāks
revīzija
a0fd88e783

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

@@ -151,7 +151,7 @@ class ChronicInfo extends React.Component{
                                 close={this.closeInfo}>
                           {pureText}
                       </MiniToast>
-                      {v.details.map((it,j)=>{
+                      {v.details && v.details.map((it,j)=>{
                         if(it.type==1){
                           return <p>
                                 <span className={style["listName"]} onClick={this.showTable.bind(this,it.content)}>{'【'+it.content.name+'】'}</span>

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

@@ -7,44 +7,16 @@ 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);
+    changeReact(it, index) {
+        console.log('itttttttt', it, index)
+        this.props.changeReact(it, index);
     }
 
 
     render() {
-        const { icon, titleStyle,titleBg, filter, title, showDrugInfo, setDrugInfo, adversReactionList } = this.props
+        const { icon, titleStyle,titleBg, filter, title,  adversReactionList } = this.props
         return(
             <div className={style['last-treat-wrapper']}>
                 { console.log('adversReactionList', adversReactionList) }
@@ -52,9 +24,10 @@ class AdverseReactions extends Component {
                 <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((it, index) => {
+                        {console.log('item.details', item.details)}
+                        {item.details.map((it, idx) => {
                             return <span key={item.id + it.name}>
-                                <input type="checkbox" checked={item.checked} id={item.id + it.name} onChange={()=>{console.log('change')}}/>
+                                <input type="checkbox" checked={it.checked} id={item.id + it.name} onChange={this.changeReact.bind(this, it, index)}/>
                                 <label for={item.id + it.name}> {it.name} </label>
                             </span>
                         })}

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

@@ -20,7 +20,6 @@ class LastTreat extends Component {
         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>}

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

@@ -39,9 +39,10 @@ class Treat extends Component {
         Notify.info('该功能即将上线,敬请期待。', 2000)
     }
     handleDetermine() {
-        const { title, treatment, advice } = this.props
+        const { title, treatment, advice, treatItem, adversReactionList, saveAllAdverseReaction } = this.props
         const { addScheme } = this.props
         addScheme && addScheme(title, treatment);
+        saveAllAdverseReaction && saveAllAdverseReaction(treatItem)
         this.hideTreat()
     }
     showDrugInfo() {
@@ -53,8 +54,9 @@ class Treat extends Component {
       $('#drugWrapper').css({'z-index': 301});
     }
     render(){
-        const {setDrugInfoMore,treatIndex,treatIndexSet, generalTreat, treatment, treatItem, surgeryTreat, lastTreat, selectDrug, drugInfo, treatDesc, setOtherRecommend, setDrugInfo, showDrug, showDrugInfo,hideDrugInfo, title, drugInfoList, hideDrugInfoMore, adversReactionList} = this.props;
+        const {setDrugInfoMore,treatIndex,treatIndexSet, generalTreat, treatment, treatItem, surgeryTreat, lastTreat, selectDrug, drugInfo, treatDesc, setOtherRecommend, setDrugInfo, showDrug, showDrugInfo,hideDrugInfo, title, drugInfoList, hideDrugInfoMore, adversReactionList, changeReact} = this.props;
         const { zIndex,show } = this.state
+        {console.log('adversReactionListadversReactionList11', adversReactionList)}
         return(
             <div   className={style['treat-wrapper']}>
                 <div className={style['treat-mask']} onClick={this.hideTreat}>
@@ -66,7 +68,7 @@ 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>
+                        <AdverseReactions icon={generalIcon} title='不良反应' adversReactionList = {adversReactionList} changeReact = {changeReact}></AdverseReactions>
                         <DrugTreat treatment={ treatment } 
                                 selectDrug={selectDrug} 
                                 setOtherRecommend={ setOtherRecommend } 

+ 9 - 2
src/containers/Treat.js

@@ -1,8 +1,8 @@
 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, getInstroduceMore, commonTreatAddToAdvice } from '@store/async-actions/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, SET_ALL_ADVERSE_REACTIONS } from '@store/types/treat.js';
+import { getInstroduce, getRecommendBasic, getInstroduceMore, commonTreatAddToAdvice, saveAllAdverseReactions } from '@store/async-actions/treat';
 import { ADD_SCHEME } from '@store/types/pushMessage.js'
 import { showDrugInfo } from '../store/actions/treat';
 
@@ -26,6 +26,9 @@ function mapStateToProps(state){
  
 function mapDispatchToProps(dispatch) {
     return {
+        changeReact: (it, index) => {
+            dispatch({type: CHANGE_REACT, it, index})
+        },
         selectDrug: (index, ii)=>{
             dispatch ({
                 type: SELECT_DRUG,
@@ -76,6 +79,10 @@ function mapDispatchToProps(dispatch) {
             })
             dispatch(commonTreatAddToAdvice())
         },
+        saveAllAdverseReaction: (item) => {
+            dispatch(saveAllAdverseReactions(item))
+        },
+        
         //查询多条药品说明数据(添加数据用)
         setDrugInfoMore:(drugIdList) => {
             dispatch(getInstroduceMore(drugIdList));

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

@@ -16,6 +16,7 @@ export const clearTreat = (state, action) => {
     res.generalTreat = '';
     res.surgeryTreat = '';
     res.treatment = [];
+    res.adversReactionList=[];
     return res
 }
 
@@ -112,3 +113,40 @@ export const clearFirstMainDiag = (state, action) => {
     res.isFirstMainDiag = action.flag;
     return res;
 }
+
+//设置不良反应
+export const setAdverseReactions = (state, action) => {
+    const res = Object.assign({}, state);
+    res.adversReactionList = action.adversReactionList;
+    return res;
+}
+//保存所有不良反应(第二次打开质量方案不良反应有所变化时进行比较)
+export const setALLAdverseReactions =(state, action) => {
+    const res = JSON.parse(JSON.stringify(state));
+    let allAdversReactionList = res.allAdversReactionList
+    let hasAdversReactionList = false
+    for( let i = 0; i < allAdversReactionList.length; i++) {
+        if (action.adversReactionList.id == allAdversReactionList[i].id) {
+            allAdversReactionList[i] = action.adversReactionList
+            hasAdversReactionList = true
+        } 
+    }
+    if(!hasAdversReactionList) {
+        allAdversReactionList.push(action.adversReactionList)
+    }
+    res.allAdversReactionList = allAdversReactionList;
+    return res;
+}
+
+
+export const changeReact=(state,action)=>{
+    const res=Object.assign({},state);
+    const index = action.index
+    res.adversReactionList[index].details = res.adversReactionList[index].details.map(item => {
+      if(item.name == action.it.name){
+        item.checked = !item.checked
+      }
+      return item
+    })
+    return res;
+  };

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 56 - 73
src/store/async-actions/treat.js


+ 85 - 78
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, SET_DRUG_INFO_LIST,IS_FIRST_MAIN_DIAG,CLEAR_FIRST_MAIN_DIAG } from '../types/treat'
-import { selectDrug, setTreatInfo, setOtherDrug, setDrugInfo, clearDrugInfo, showTreat, hideTreat, clearTreat, showDrugInfo, hideDrugInfo, setTreatment, setGeneralTreat, setSurgeryTreat, setRecommendBasic, setDrugInfoList, isFirstMainDiag,clearFirstMainDiag } 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,IS_FIRST_MAIN_DIAG,CLEAR_FIRST_MAIN_DIAG ,SET_ADVERSE_REACTIONS, SET_ALL_ADVERSE_REACTIONS,CHANGE_REACT } from '../types/treat'
+import { selectDrug, setTreatInfo, setOtherDrug, setDrugInfo, clearDrugInfo, showTreat, hideTreat, clearTreat, showDrugInfo, hideDrugInfo, setTreatment, setGeneralTreat, setSurgeryTreat, setRecommendBasic, setDrugInfoList, isFirstMainDiag, clearFirstMainDiag, setAdverseReactions, setALLAdverseReactions, changeReact  } from '../actions/treat'
 const initState = {
     show: false, //治疗方案显示隐藏
     showDrugInfo: false, //药品信息显示隐藏
@@ -91,83 +91,84 @@ const initState = {
         ],
     },
     adversReactionList:[
-        {
-            id: 40772,
-            name: '低血糖反应',
-            tagName: '低血糖反应',
-            showInfo: '0',
-            controlType: 2,
-            details: [
-                {
-                    name: "否",
-                    value: 0
-                },
-                {
-                    name: "是",
-                    value: 0
-                },
-                {
-                    name: "轻度",
-                    value: 0
-                },
-                {
-                    name: "中度",
-                    value: 0
-                },
-                {
-                    name: "重度",
-                    value: 0
-                },
-                {
-                    name: "偶尔",
-                    value: 0
-                },
-                {
-                    name: "频繁",
-                    value: 0
-                }
-            ]
+        // {
+        //     id: 40772,
+        //     name: '低血糖反应',
+        //     tagName: '低血糖反应',
+        //     showInfo: '0',
+        //     controlType: 2,
+        //     details: [
+        //         {
+        //             name: "否",
+        //             value: 0
+        //         },
+        //         {
+        //             name: "是",
+        //             value: 0
+        //         },
+        //         {
+        //             name: "轻度",
+        //             value: 0
+        //         },
+        //         {
+        //             name: "中度",
+        //             value: 0
+        //         },
+        //         {
+        //             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
-                },
-                {
-                    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
+        //         },
+        //         {
+        //             name: "偶尔",
+        //             value: 0
+        //         },
+        //         {
+        //             name: "频繁",
+        //             value: 0
+        //         }
+        //     ]
 
-        }
+        // }
     ],
+    allAdversReactionList:[],
     treatDesc:{
         title: '药品推荐',
     }
@@ -299,9 +300,15 @@ export default function(state=initState, action){
         case SET_DRUG_INFO_LIST:
             return setDrugInfoList(state, action);
         case IS_FIRST_MAIN_DIAG: 
-            return isFirstMainDiag(state, action)
+            return isFirstMainDiag(state, action);
         case CLEAR_FIRST_MAIN_DIAG: 
-            return clearFirstMainDiag(state, action)
+            return clearFirstMainDiag(state, action);
+        case SET_ADVERSE_REACTIONS:
+            return setAdverseReactions(state, action);
+        case SET_ALL_ADVERSE_REACTIONS: 
+            return setALLAdverseReactions(state, action);
+        case CHANGE_REACT: 
+            return changeReact(state, action);
         default:
             return state
     }

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

@@ -15,3 +15,6 @@ export const SET_TREAT_INFO = 'SET_TREAT_INFO' //设置治疗方案信息(name
 export const SET_DRUG_INFO_LIST = 'SET_DRUG_INFO_LIST' //查询多个药品说明书(添加数据时查看药品说明用)
 export const IS_FIRST_MAIN_DIAG = 'IS_FIRST_MAIN_DIAG' //是否为主诊断第一次开单
 export const CLEAR_FIRST_MAIN_DIAG = 'CLEAR_FIRST_MAIN_DIAG' //回读清空是否为主诊断第一次开单
+export const SET_ADVERSE_REACTIONS = 'SET_ADVERSE_REACTIONS'    //设置不良反应
+export const SET_ALL_ADVERSE_REACTIONS = 'SET_ALL_ADVERSE_REACTIONS'    //设置所有不良反应
+export const CHANGE_REACT = 'CHANGE_REACT'  //改变不良反应状态